* @brief Parses the command line and runs early-exit flows (version/reset/license). */
| 203 | * @brief Parses the command line and runs early-exit flows (version/reset/license). |
| 204 | */ |
| 205 | CLI::ProcessResult CLI::process(QApplication& app) |
| 206 | { |
| 207 | m_parser.process(app); |
| 208 | |
| 209 | if (m_parser.isSet(m_opts.versionOpt)) { |
| 210 | qDebug() << APP_NAME << "version" << APP_VERSION; |
| 211 | qDebug() << "Written by Alex Spataru <https://github.com/alex-spataru>"; |
| 212 | return ProcessResult::ExitSuccess; |
| 213 | } |
| 214 | |
| 215 | if (m_parser.isSet(m_opts.resetOpt)) { |
| 216 | QSettings(APP_SUPPORT_URL, APP_NAME).clear(); |
| 217 | qDebug() << APP_NAME << "settings cleared!"; |
| 218 | return ProcessResult::ExitSuccess; |
| 219 | } |
| 220 | |
| 221 | if (m_parser.isSet(m_opts.benchmarkHotpathOpt) || m_parser.isSet(m_opts.benchmarkFramesOpt) |
| 222 | || m_parser.isSet(m_opts.benchmarkSecondsOpt) || m_parser.isSet(m_opts.minFpsOpt)) |
| 223 | return runHotpathBenchmark(); |
| 224 | |
| 225 | if (m_parser.isSet(m_opts.dumpApiSchemaOpt)) |
| 226 | return dumpApiSchema(m_parser.value(m_opts.dumpApiSchemaOpt)); |
| 227 | |
| 228 | #ifdef BUILD_COMMERCIAL |
| 229 | if (m_parser.isSet(m_opts.selftestOfflineOpt)) { |
| 230 | return Licensing::runOfflineSelfTest() == 0 ? ProcessResult::ExitSuccess |
| 231 | : ProcessResult::ExitFailure; |
| 232 | } |
| 233 | |
| 234 | if (m_parser.isSet(m_opts.activateOpt)) { |
| 235 | return activateLicense(app, m_parser.value(m_opts.activateOpt)) == EXIT_SUCCESS |
| 236 | ? ProcessResult::ExitSuccess |
| 237 | : ProcessResult::ExitFailure; |
| 238 | } |
| 239 | |
| 240 | if (m_parser.isSet(m_opts.deactivateOpt)) { |
| 241 | return deactivateLicense(app) == EXIT_SUCCESS ? ProcessResult::ExitSuccess |
| 242 | : ProcessResult::ExitFailure; |
| 243 | } |
| 244 | #endif |
| 245 | |
| 246 | return ProcessResult::Continue; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * @brief Runs the frame-extraction throughput benchmark and maps the result to an exit code. |
no test coverage detected