History

Changes parser pointer to reference.

Penguin-Guru committed 4 years ago

Commit b11b1731 parent 759b4283 files · +44 −44Browse files

Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all

Unified · Split

interface/src/Application.cpp+39−39
@@ -723,24 +723,24 @@ extern DisplayPluginList getDisplayPlugins(); · 722 unmodified lines
723723 extern InputPluginList getInputPlugins();
724724 extern void saveInputPluginSettings(const InputPluginList& plugins);
725725
726−bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, bool runningMarkerExisted) {
726+bool setupEssentials(int& argc, char** argv, const QCommandLineParser& parser, bool runningMarkerExisted) {
727727 const char** constArgv = const_cast<const char**>(argv);
728728
729729 qInstallMessageHandler(messageHandler);
730730
731731
732− const int listenPort = parser->isSet("listenPort") ? parser->value("listenPort").toInt() : INVALID_PORT;
732+ const int listenPort = parser.isSet("listenPort") ? parser.value("listenPort").toInt() : INVALID_PORT;
733733
734− bool suppressPrompt = parser->isSet("suppress-settings-reset");
734+ bool suppressPrompt = parser.isSet("suppress-settings-reset");
735735
736736 // set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store
737− qApp->setProperty(hifi::properties::OCULUS_STORE, parser->isSet("oculus-store"));
737+ qApp->setProperty(hifi::properties::OCULUS_STORE, parser.isSet("oculus-store"));
738738
739739 // emulate standalone device
740− qApp->setProperty(hifi::properties::STANDALONE, parser->isSet("standalone"));
740+ qApp->setProperty(hifi::properties::STANDALONE, parser.isSet("standalone"));
741741
742742 // Ignore any previous crashes if running from command line with a test script.
743− bool inTestMode = parser->isSet("testScript");
743+ bool inTestMode = parser.isSet("testScript");
744744
745745 bool previousSessionCrashed { false };
746746 if (!inTestMode) {
@@ -748,8 +748,8 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, b · 1 unmodified line
748748 }
749749
750750 // get dir to use for cache
751− if (parser->isSet("cache")) {
752− qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, parser->value("cache"));
751+ if (parser.isSet("cache")) {
752+ qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, parser.value("cache"));
753753 }
754754
755755 {
@@ -791,7 +791,7 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, b · 35 unmodified lines
791791 QCoreApplication::addLibraryPath(audioDLLPath);
792792 #endif
793793
794− QString defaultScriptsOverrideOption = parser->value("defaultScriptsOverride");
794+ QString defaultScriptsOverrideOption = parser.value("defaultScriptsOverride");
795795
796796 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
797797 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
@@ -917,7 +917,7 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, b · 119 unmodified lines
917917 });
918918
919919
920− QString setBookmarkValue = parser->value("setBookmark");
920+ QString setBookmarkValue = parser.value("setBookmark");
921921 if (!setBookmarkValue.isEmpty()) {
922922 // Bookmarks are expected to be in a name=url form.
923923 // An `=` character in the name or url is unsupported.
@@ -976,7 +976,7 @@ QSharedPointer<OffscreenUi> getOffscreenUI() { · 52 unmodified lines
976976
977977 Application::Application(
978978 int& argc, char** argv,
979− const QCommandLineParser* parser,
979+ const QCommandLineParser& parser,
980980 QElapsedTimer& startupTimer,
981981 bool runningMarkerExisted
982982 ) :
@@ -1023,8 +1023,8 @@ Application::Application( · 40 unmodified lines
10231023 LogHandler::getInstance().setupRepeatedMessageFlusher();
10241024
10251025 {
1026− if (parser->isSet("testScript")) {
1027− QString testScriptPath = parser->value("testScript");
1026+ if (parser.isSet("testScript")) {
1027+ QString testScriptPath = parser.value("testScript");
10281028 // If the URL scheme is http(s) or ftp, then use as is, else - treat it as a local file
10291029 // This is done so as not break previous command line scripts
10301030 if (testScriptPath.left(HIFI_URL_SCHEME_HTTP.length()) == HIFI_URL_SCHEME_HTTP ||
@@ -1035,20 +1035,20 @@ Application::Application( · 4 unmodified lines
10351035 setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));
10361036 }
10371037
1038− if (parser->isSet("quitWhenFinished")) {
1038+ if (parser.isSet("quitWhenFinished")) {
10391039 quitWhenFinished = true;
10401040 }
10411041 }
1042− if (parser->isSet("testResultsLocation")) {
1042+ if (parser.isSet("testResultsLocation")) {
10431043 // Set test snapshot location only if it is a writeable directory
1044− QString path = parser->value("testResultsLocation");
1044+ QString path = parser.value("testResultsLocation");
10451045
10461046 QFileInfo fileInfo(path);
10471047 if (fileInfo.isDir() && fileInfo.isWritable()) {
10481048 TestScriptingInterface::getInstance()->setTestResultsLocation(path);
10491049 }
10501050 }
1051− _urlParam = parser->value("url");
1051+ _urlParam = parser.value("url");
10521052 }
10531053
10541054 {
@@ -1114,7 +1114,7 @@ Application::Application( · 59 unmodified lines
11141114 auto addressManager = DependencyManager::get<AddressManager>();
11151115 addressManager->moveToThread(nodeList->thread());
11161116
1117− if (parser->isSet("disableWatchdog")) {
1117+ if (parser.isSet("disableWatchdog")) {
11181118 DISABLE_WATCHDOG = true;
11191119 }
11201120 // Set up a watchdog thread to intentionally crash the application on deadlocks
@@ -1435,9 +1435,9 @@ Application::Application( · 314 unmodified lines
14351435 connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
14361436 connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this, &Application::addingEntityWithCertificate);
14371437
1438− if (parser->isSet("concurrent-downloads")) {
1438+ if (parser.isSet("concurrent-downloads")) {
14391439 bool success;
1440− uint32_t concurrentDownloads = parser->value("concurrent-downloads").toUInt(&success);
1440+ uint32_t concurrentDownloads = parser.value("concurrent-downloads").toUInt(&success);
14411441 if (!success) {
14421442 concurrentDownloads = MAX_CONCURRENT_RESOURCE_DOWNLOADS;
14431443 }
@@ -1446,15 +1446,15 @@ Application::Application( · 2 unmodified lines
14461446
14471447 // perhaps override the avatar url. Since we will test later for validity
14481448 // we don't need to do so here.
1449− if (parser->isSet("avatarURL")) {
1450− _avatarOverrideUrl = QUrl::fromUserInput(parser->value("avatarURL"));
1449+ if (parser.isSet("avatarURL")) {
1450+ _avatarOverrideUrl = QUrl::fromUserInput(parser.value("avatarURL"));
14511451 }
14521452
14531453 // If someone specifies both --avatarURL and --replaceAvatarURL,
14541454 // the replaceAvatarURL wins. So only set the _overrideUrl if this
14551455 // does have a non-empty string.
1456− if (parser->isSet("replaceAvatarURL")) {
1457− QString replaceURL = parser->value("replaceAvatarURL");
1456+ if (parser.isSet("replaceAvatarURL")) {
1457+ QString replaceURL = parser.value("replaceAvatarURL");
14581458 _avatarOverrideUrl = QUrl::fromUserInput(replaceURL);
14591459 _saveAvatarOverrideUrl = true;
14601460 }
@@ -1472,7 +1472,7 @@ Application::Application( · 11 unmodified lines
14721472 _glWidget->setFocusPolicy(Qt::StrongFocus);
14731473 _glWidget->setFocus();
14741474
1475− if (parser->isSet("system-cursor")) {
1475+ if (parser.isSet("system-cursor")) {
14761476 _preferredCursor.set(Cursor::Manager::getIconName(Cursor::Icon::SYSTEM));
14771477 }
14781478 showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get()));
@@ -1547,7 +1547,7 @@ Application::Application( · 68 unmodified lines
15471547 });
15481548 #else
15491549 // Do not show login dialog if requested not to on the command line
1550− if (_disableLoginScreen || parser->isSet("no-login-suggestion")) {
1550+ if (_disableLoginScreen || parser.isSet("no-login-suggestion")) {
15511551 connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
15521552 resumeAfterLoginDialogActionTaken();
15531553 });
@@ -1919,8 +1919,8 @@ Application::Application( · 365 unmodified lines
19191919 userInputMapper->registerDevice(_touchscreenVirtualPadDevice->getInputDevice());
19201920 }
19211921
1922− if (parser->isSet("scripts")) {
1923− _defaultScriptsLocation.setPath(parser->value("scripts")); // Might need to be done in "main.cpp".
1922+ if (parser.isSet("scripts")) {
1923+ _defaultScriptsLocation.setPath(parser.value("scripts")); // Might need to be done in "main.cpp".
19241924 _overrideDefaultScriptsLocation = true;
19251925 } else {
19261926 _overrideDefaultScriptsLocation = false;
@@ -1982,7 +1982,7 @@ Application::Application( · 55 unmodified lines
19821982 // If launched from Steam, let it handle updates
19831983 bool buildCanUpdate = BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable
19841984 || BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master;
1985− if (!parser->isSet("no-updater") && buildCanUpdate) {
1985+ if (!parser.isSet("no-updater") && buildCanUpdate) {
19861986 constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only";
19871987
19881988 auto applicationUpdater = DependencyManager::set<AutoUpdater>();
@@ -2152,7 +2152,7 @@ Application::Application( · 163 unmodified lines
21522152
21532153 // setup the stats interval depending on if the 1s faster hearbeat was requested
21542154 static int SEND_STATS_INTERVAL_MS;
2155− if (parser->isSet("fast-heartbeat")) {
2155+ if (parser.isSet("fast-heartbeat")) {
21562156 SEND_STATS_INTERVAL_MS = 1000;
21572157 } else {
21582158 SEND_STATS_INTERVAL_MS = 10000;
@@ -5473,7 +5473,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa · 3314 unmodified lines
54735473 return exportEntities(filename, entities, &center);
54745474 }
54755475
5476−void Application::loadSettings(const QCommandLineParser* parser) {
5476+void Application::loadSettings(const QCommandLineParser& parser) {
54775477
54785478 sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value.
54795479 DependencyManager::get<AudioClient>()->loadSettings();
@@ -5503,7 +5503,7 @@ void Application::loadSettings(const QCommandLineParser* parser) { · 23 unmodified lines
55035503 }
55045504
55055505 bool isFirstPerson = false;
5506− if (parser->isSet("no-launcher")) {
5506+ if (parser.isSet("no-launcher")) {
55075507 const auto& displayPlugins = pluginManager->getDisplayPlugins();
55085508 for (const auto& plugin : displayPlugins) {
55095509 if (!plugin->isHmd()) {
@@ -8790,21 +8790,21 @@ void Application::sendLambdaEvent(const std::function<void()>& f) { · 3280 unmodified lines
87908790 }
87918791 }
87928792
8793−void Application::initPlugins(const QCommandLineParser* parser) {
8794− if (parser->isSet("display")) {
8795− auto preferredDisplays = parser->value("display").split(',', Qt::SkipEmptyParts);
8793+void Application::initPlugins(const QCommandLineParser& parser) {
8794+ if (parser.isSet("display")) {
8795+ auto preferredDisplays = parser.value("display").split(',', Qt::SkipEmptyParts);
87968796 qInfo() << "Setting prefered display plugins:" << preferredDisplays;
87978797 PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays);
87988798 }
87998799
8800− if (parser->isSet("disable-displays")) {
8801− auto disabledDisplays = parser->value("disableDisplays").split(',', Qt::SkipEmptyParts);
8800+ if (parser.isSet("disable-displays")) {
8801+ auto disabledDisplays = parser.value("disableDisplays").split(',', Qt::SkipEmptyParts);
88028802 qInfo() << "Disabling following display plugins:" << disabledDisplays;
88038803 PluginManager::getInstance()->disableDisplays(disabledDisplays);
88048804 }
88058805
8806− if (parser->isSet("disable-inputs")) {
8807− auto disabledInputs = parser->value("disableInputs").split(',', Qt::SkipEmptyParts);
8806+ if (parser.isSet("disable-inputs")) {
8807+ auto disabledInputs = parser.value("disableInputs").split(',', Qt::SkipEmptyParts);
88088808 qInfo() << "Disabling following input plugins:" << disabledInputs;
88098809 PluginManager::getInstance()->disableInputs(disabledInputs);
88108810 }