| 53 | } |
| 54 | |
| 55 | auto LemonBaseApplication::parseCommandLine(bool *canContinue, QString *errorMessage) -> bool { |
| 56 | *canContinue = true; |
| 57 | QStringList filteredArgs; |
| 58 | for (const auto &arg : arguments()) { |
| 59 | #ifdef Q_OS_MACOS |
| 60 | if (arg.contains("-psn")) |
| 61 | continue; |
| 62 | #endif |
| 63 | filteredArgs << arg; |
| 64 | } |
| 65 | QCommandLineParser parser; |
| 66 | // |
| 67 | QCommandLineOption debugLogOption("debug", QObject::tr("Enable debug output")); |
| 68 | // |
| 69 | parser.setApplicationDescription(QObject::tr("LemonLime - A tiny judging environment for OI contest.")); |
| 70 | parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); |
| 71 | // |
| 72 | parser.addOption(debugLogOption); |
| 73 | // |
| 74 | const auto helpOption = parser.addHelpOption(); |
| 75 | const auto versionOption = parser.addVersionOption(); |
| 76 | |
| 77 | if (! parser.parse(filteredArgs)) { |
| 78 | *canContinue = true; |
| 79 | *errorMessage = parser.errorText(); |
| 80 | return false; |
| 81 | } |
| 82 | |
| 83 | if (parser.isSet(versionOption)) { |
| 84 | parser.showVersion(); |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | if (parser.isSet(helpOption)) { |
| 89 | parser.showHelp(); |
| 90 | return true; |
| 91 | } |
| 92 | |
| 93 | #define ProcessExtraStartupOptions(option) \ |
| 94 | DEBUG("Startup Options:" GEN_PAIR(parser.isSet(option##Option))); \ |
| 95 | StartupArguments.option = parser.isSet(option##Option); |
| 96 | |
| 97 | ProcessExtraStartupOptions(debugLog); |
| 98 | return true; |
| 99 | } |
nothing calls this directly
no outgoing calls
no test coverage detected