Commit 3e7a62a5 authored by Jan Möbius's avatar Jan Möbius
Browse files

Dont use initializer lists as this collides with an explicit in QT 5.4 or less

parent 8552e734
...@@ -326,95 +326,104 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err ...@@ -326,95 +326,104 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, QString *err
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
parser.addOptions({
{{"d", "debug"},
QCoreApplication::translate("main", "Enable debugging mode")},
{"disable-stereo",
QCoreApplication::translate("main", "Disable stereo mode")},
{{"b", "batch"},
QCoreApplication::translate("main", "Batch mode, you have to provide a script for execution")},
{{"c", "log-to-console"},
QCoreApplication::translate("main", "Write logger window contents to console")},
{"remote-control",
QCoreApplication::translate("main", "Batch mode accepting remote connections")},
{{"f", "fullscreen"},
QCoreApplication::translate("main", "Start in fulscreen mode")},
{{"l", "hide-logger"},
QCoreApplication::translate("main", "Start with hidden log window")},
{{"t", "hide-toolbox"},
QCoreApplication::translate("main", "Start with hidden toolbox")},
{"no-splash",
QCoreApplication::translate("main", "Hide splash screen")},
{"p",
QCoreApplication::translate("main", "Open files as PolyMeshes")},
{"remote-port",
QCoreApplication::translate("main", "Remote port"),"portnumber"},
});
const QCommandLineOption helpOption = parser.addHelpOption();
const QCommandLineOption versionOption = parser.addVersionOption();
// Now parse the command line
if (!parser.parse(QCoreApplication::arguments())) {
*errorMessage = parser.errorText();
return CommandLineError;
}
if (parser.isSet(helpOption)) QCommandLineOption debugOption(QStringList() << "d" << "debug",QCoreApplication::translate("main", "Enable debugging mode"));
return CommandLineHelpRequested; parser.addOption(debugOption);
if (parser.isSet(versionOption)) QCommandLineOption stereoOption("disable-stereo",QCoreApplication::translate("main", "Disable stereo mode"));
return CommandLineVersionRequested; parser.addOption(stereoOption);
if (parser.isSet("debug")) { QCommandLineOption batchOption(QStringList() << "b" << "batch",QCoreApplication::translate("main", "Batch mode, you have to provide a script for execution"));
OpenFlipper::Options::debug(true); parser.addOption(batchOption);
}
if (parser.isSet("disable-stereo")) { QCommandLineOption logConsoleOption(QStringList() << "c" << "log-to-console",QCoreApplication::translate("main", "Write logger window contents to console"));
OpenFlipper::Options::stereo(false); parser.addOption(logConsoleOption);
}
if (parser.isSet("batch")) { QCommandLineOption remoteControlOption("remote-control",QCoreApplication::translate("main", "Batch mode accepting remote connections"));
OpenFlipper::Options::nogui(true); parser.addOption(remoteControlOption);
}
if (parser.isSet("log-to-console")) { QCommandLineOption fulscreenOption(QStringList() << "f" << "fulscreen",QCoreApplication::translate("main", "Start in fulscreen mode"));
OpenFlipper::Options::logToConsole(true); parser.addOption(fulscreenOption);
}
if (parser.isSet("remote-control")) { QCommandLineOption hideLoggerOption(QStringList() << "l" << "hide-logger",QCoreApplication::translate("main", "Start with hidden log window"));
OpenFlipper::Options::remoteControl(true); parser.addOption(hideLoggerOption);
}
if (parser.isSet("fullscreen")) { QCommandLineOption hideToolboxOption(QStringList() << "t" << "hide-toolbox",QCoreApplication::translate("main", "Start with hidden toolbox"));
OpenFlipperSettings().setValue("Core/Gui/fullscreen",true); parser.addOption(hideToolboxOption);
}
if (parser.isSet("hide-logger")) { QCommandLineOption noSplashOption("no-splash",QCoreApplication::translate("main", "Hide splash screen"));
OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden); parser.addOption(noSplashOption);
}
if (parser.isSet("hide-toolbox")) { QCommandLineOption polyMeshOption("p",QCoreApplication::translate("main", "Open files as PolyMeshes"));
OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",true); parser.addOption(polyMeshOption);
}
if (parser.isSet("no-splash")) { QCommandLineOption remotePortOption("remote-port",QCoreApplication::translate("main", "Remote port"),"portnumber");
OpenFlipperSettings().setValue("Core/Gui/splash",false); parser.addOption(remotePortOption);
}
if (parser.isSet("p")) { const QCommandLineOption helpOption = parser.addHelpOption();
openPolyMeshes = true; const QCommandLineOption versionOption = parser.addVersionOption();
}
if (parser.isSet("remote-port")) {
const QString port = parser.value("remote-port");
std::cerr << "Got port option : " << port.toStdString() << std::endl;
OpenFlipper::Options::remoteControl(port.toInt());
} // Now parse the command line
if (!parser.parse(QCoreApplication::arguments())) {
*errorMessage = parser.errorText();
return CommandLineError;
}
if (parser.isSet(helpOption))
return CommandLineHelpRequested;
if (parser.isSet(versionOption))
return CommandLineVersionRequested;
if (parser.isSet(debugOption)) {
OpenFlipper::Options::debug(true);
}
if (parser.isSet(stereoOption)) {
OpenFlipper::Options::stereo(false);
}
if (parser.isSet(batchOption)) {
OpenFlipper::Options::nogui(true);
}
if (parser.isSet(logConsoleOption)) {
OpenFlipper::Options::logToConsole(true);
}
if (parser.isSet(remoteControlOption)) {
OpenFlipper::Options::remoteControl(true);
}
if (parser.isSet(fulscreenOption)) {
OpenFlipperSettings().setValue("Core/Gui/fullscreen",true);
}
if (parser.isSet(hideLoggerOption)) {
OpenFlipper::Options::loggerState(OpenFlipper::Options::Hidden);
}
if (parser.isSet(hideToolboxOption)) {
OpenFlipperSettings().setValue("Core/Gui/ToolBoxes/hidden",true);
}
if (parser.isSet(noSplashOption)) {
OpenFlipperSettings().setValue("Core/Gui/splash",false);
}
if (parser.isSet(polyMeshOption)) {
openPolyMeshes = true;
}
if (parser.isSet(remotePortOption)) {
const QString port = parser.value("remote-port");
std::cerr << "Got port option : " << port.toStdString() << std::endl;
OpenFlipper::Options::remoteControl(port.toInt());
}
return CommandLineOk; return CommandLineOk;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment