From 197b78d228f776e66c2cd9dcece234d970cd421f Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 22:32:47 -0700 Subject: [PATCH] Probably finished the ones in main. --- interface/src/main.cpp | 58 +++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 30b0c57b4f..1151d03187 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -177,28 +177,40 @@ int main(int argc, const char* argv[]) { ); QCommandLineOption overrideScriptsPathOption( SCRIPTS_SWITCH, - "set scripts ", + "Set scripts ", "path" ); + QCommandLineOption defaultScriptOverrideOption( + "defaultScriptsOverride", + "Override defaultsScripts.js.", + "string" + ); QCommandLineOption responseTokensOption( "tokens", - "set response tokens .", + "Set response tokens .", "json" ); QCommandLineOption displayNameOption( "displayName", - "set user display name .", + "Set user display name .", "string" ); - QCommandLineOption defaultScriptOverrideOption( - "defaultScriptsOverride", - "override defaultsScripts.js.", - "string" + QCommandLineOption traceFileOption( + "traceFile", + "Probably writes a trace to a file?", + "path" + ); + QCommandLineOption traceDurationOption( + "traceDuration", + "Only works if \"--traceFile\" is provided.", + "value" + ); + QCommandLineOption clockSkewOption( + "clockSkew", + "Forces client instance's clock to skew for demonstration purposes." ); // "--qmljsdebugger", which appears in output from "--help-all". - // Those below are found in this file but have not yet been moved here. - // --traceFile - // --clockSkew + // Those below don't seem to be optional. // --ignore-gpu-blacklist // --suppress-settings-reset @@ -230,6 +242,9 @@ int main(int argc, const char* argv[]) { parser.addOption(responseTokensOption); parser.addOption(displayNameOption); parser.addOption(defaultScriptOverrideOption); + parser.addOption(traceFileOption); + parser.addOption(traceDurationOption); + parser.addOption(clockSkewOption); QStringList arguments; QString applicationPath; @@ -303,18 +318,14 @@ int main(int argc, const char* argv[]) { // Early check for --traceFile argument auto tracer = DependencyManager::set(); const char * traceFile = nullptr; - const QString traceFileFlag("--traceFile"); - float traceDuration = 0.0f; - for (int a = 1; a < argc; ++a) { - if (traceFileFlag == argv[a] && argc > a + 1) { - traceFile = argv[a + 1]; - if (argc > a + 2) { - traceDuration = atof(argv[a + 2]); - } - break; + float traceDuration; + if (parser.isSet(traceFileOption)) { + traceFile = parser.value(traceFileOption).toStdString().c_str(); + if (parser.isSet(traceDurationOption)) { + traceDuration = parser.value(traceDurationOption).toFloat(); + } else { + traceDuration = 0.0f; } - } - if (traceFile != nullptr) { tracer->startTracing(); } @@ -447,9 +458,8 @@ int main(int argc, const char* argv[]) { // Debug option to demonstrate that the client's local time does not // need to be in sync with any other network node. This forces clock // skew for the individual client - const char* CLOCK_SKEW = "--clockSkew"; - const char* clockSkewOption = getCmdOption(argc, argv, CLOCK_SKEW); - if (clockSkewOption) { + if (parser.isSet(clockSkewOption)) { + const char* clockSkewOption = parser.value(clockSkewOption).toStdString().c_str(); qint64 clockSkew = atoll(clockSkewOption); usecTimestampNowForceClockSkew(clockSkew); qCDebug(interfaceapp) << "clockSkewOption=" << clockSkewOption << "clockSkew=" << clockSkew;