mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-11-28 08:11:17 +00:00
[fix two simple, announced main.cpp bugs]
1. log qDebug et al to stdout 2. use 'noquote' for qDebug
This commit is contained in:
parent
1cf6e2743b
commit
1486706471
21
app/main.cpp
21
app/main.cpp
@ -1,3 +1,5 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QtQml/QQmlApplicationEngine>
|
#include <QtQml/QQmlApplicationEngine>
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
@ -23,8 +25,20 @@ QString getNamedArgument(QStringList args, QString name)
|
|||||||
return getNamedArgument(args, name, "");
|
return getNamedArgument(args, name, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
|
{
|
||||||
|
(void) type;
|
||||||
|
(void) context;
|
||||||
|
std::cout << msg.toStdString() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
// Install message handler
|
||||||
|
qInstallMessageHandler(messageHandler);
|
||||||
|
|
||||||
|
|
||||||
// Some environmental variable are necessary on certain platforms.
|
// Some environmental variable are necessary on certain platforms.
|
||||||
|
|
||||||
// This disables QT appmenu under Ubuntu, which is not working with QML apps.
|
// This disables QT appmenu under Ubuntu, which is not working with QML apps.
|
||||||
@ -51,10 +65,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Manage command line arguments from the cpp side
|
// Manage command line arguments from the cpp side
|
||||||
QStringList args = app.arguments();
|
QStringList args = app.arguments();
|
||||||
if (args.contains("-h") || args.contains("--help")) {
|
if (args.contains("-h") || args.contains("--help"))
|
||||||
// BUG: This usage help text goes to stderr, should go to stdout.
|
{
|
||||||
// BUG: First line of output is surrounded by double quotes.
|
qDebug().noquote() << "Usage: " + args.at(0) + " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]";
|
||||||
qDebug() << "Usage: " + args.at(0) + " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]";
|
|
||||||
qDebug() << " --default-settings Run cool-retro-term with the default settings";
|
qDebug() << " --default-settings Run cool-retro-term with the default settings";
|
||||||
qDebug() << " --workdir <dir> Change working directory to 'dir'";
|
qDebug() << " --workdir <dir> Change working directory to 'dir'";
|
||||||
qDebug() << " -e <cmd> Command to execute. This option will catch all following arguments, so use it as the last option.";
|
qDebug() << " -e <cmd> Command to execute. This option will catch all following arguments, so use it as the last option.";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user