Use lightweight printf instead of iostream

Using iostream usually adds a lot of other operators (<<, endl), whereas
*printf takes only 1 function call.

Also use qUtf8Printable whenever possible.
This commit is contained in:
Chocobo1 2018-03-15 00:13:47 +08:00
parent ccc91e2e52
commit 37ea01bd44
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
6 changed files with 29 additions and 26 deletions

View file

@ -32,7 +32,7 @@
#include "cmdoptions.h"
#include <iostream>
#include <cstdio>
#include <QDebug>
#include <QFileInfo>
@ -578,7 +578,7 @@ QString makeUsage(const QString &prgName)
void displayUsage(const QString &prgName)
{
#ifndef Q_OS_WIN
std::cout << qPrintable(makeUsage(prgName)) << std::endl;
printf("%s\n", qUtf8Printable(makeUsage(prgName)));
#else
QMessageBox msgBox(QMessageBox::Information, QObject::tr("Help"), makeUsage(prgName), QMessageBox::Ok);
msgBox.show(); // Need to be shown or to moveToCenter does not work