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
723extern InputPluginList getInputPlugins();723extern InputPluginList getInputPlugins();
724extern void saveInputPluginSettings(const InputPluginList& plugins);724extern void saveInputPluginSettings(const InputPluginList& plugins);
725 725
726bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, bool runningMarkerExisted) {726bool setupEssentials(int& argc, char** argv, const QCommandLineParser& parser, bool runningMarkerExisted) {
727 const char** constArgv = const_cast<const char**>(argv);727 const char** constArgv = const_cast<const char**>(argv);
728 728
729 qInstallMessageHandler(messageHandler);729 qInstallMessageHandler(messageHandler);
730 730
731 731
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;
733 733
734 bool suppressPrompt = parser->isSet("suppress-settings-reset");734 bool suppressPrompt = parser.isSet("suppress-settings-reset");
735 735
736 // set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store736 // 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"));
738 738
739 // emulate standalone device739 // emulate standalone device
740 qApp->setProperty(hifi::properties::STANDALONE, parser->isSet("standalone"));740 qApp->setProperty(hifi::properties::STANDALONE, parser.isSet("standalone"));
741 741
742 // Ignore any previous crashes if running from command line with a test script.742 // 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");
744 744
745 bool previousSessionCrashed { false };745 bool previousSessionCrashed { false };
746 if (!inTestMode) {746 if (!inTestMode) {
@@ -748,8 +748,8 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, b · 1 unmodified line
748 }748 }
749 749
750 // get dir to use for cache750 // get dir to use for cache
751 if (parser->isSet("cache")) {751 if (parser.isSet("cache")) {
752 qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, parser->value("cache"));752 qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, parser.value("cache"));
753 }753 }
754 754
755 {755 {
@@ -791,7 +791,7 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, b · 35 unmodified lines
791 QCoreApplication::addLibraryPath(audioDLLPath);791 QCoreApplication::addLibraryPath(audioDLLPath);
792#endif792#endif
793 793
794 QString defaultScriptsOverrideOption = parser->value("defaultScriptsOverride");794 QString defaultScriptsOverrideOption = parser.value("defaultScriptsOverride");
795 795
796 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();796 DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
797 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();797 DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
@@ -917,7 +917,7 @@ bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, b · 119 unmodified lines
917 });917 });
918 918
919 919
920 QString setBookmarkValue = parser->value("setBookmark");920 QString setBookmarkValue = parser.value("setBookmark");
921 if (!setBookmarkValue.isEmpty()) {921 if (!setBookmarkValue.isEmpty()) {
922 // Bookmarks are expected to be in a name=url form.922 // Bookmarks are expected to be in a name=url form.
923 // An `=` character in the name or url is unsupported.923 // An `=` character in the name or url is unsupported.
@@ -976,7 +976,7 @@ QSharedPointer<OffscreenUi> getOffscreenUI() { · 52 unmodified lines
976 976
977Application::Application(977Application::Application(
978 int& argc, char** argv,978 int& argc, char** argv,
979 const QCommandLineParser* parser,979 const QCommandLineParser& parser,
980 QElapsedTimer& startupTimer,980 QElapsedTimer& startupTimer,
981 bool runningMarkerExisted981 bool runningMarkerExisted
982) :982) :
@@ -1023,8 +1023,8 @@ Application::Application( · 40 unmodified lines
1023 LogHandler::getInstance().setupRepeatedMessageFlusher();1023 LogHandler::getInstance().setupRepeatedMessageFlusher();
1024 1024
1025 {1025 {
1026 if (parser->isSet("testScript")) {1026 if (parser.isSet("testScript")) {
1027 QString testScriptPath = parser->value("testScript");1027 QString testScriptPath = parser.value("testScript");
1028 // If the URL scheme is http(s) or ftp, then use as is, else - treat it as a local file1028 // If the URL scheme is http(s) or ftp, then use as is, else - treat it as a local file
1029 // This is done so as not break previous command line scripts1029 // This is done so as not break previous command line scripts
1030 if (testScriptPath.left(HIFI_URL_SCHEME_HTTP.length()) == HIFI_URL_SCHEME_HTTP ||1030 if (testScriptPath.left(HIFI_URL_SCHEME_HTTP.length()) == HIFI_URL_SCHEME_HTTP ||
@@ -1035,20 +1035,20 @@ Application::Application( · 4 unmodified lines
1035 setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));1035 setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));
1036 }1036 }
1037 1037
1038 if (parser->isSet("quitWhenFinished")) {1038 if (parser.isSet("quitWhenFinished")) {
1039 quitWhenFinished = true;1039 quitWhenFinished = true;
1040 }1040 }
1041 }1041 }
1042 if (parser->isSet("testResultsLocation")) {1042 if (parser.isSet("testResultsLocation")) {
1043 // Set test snapshot location only if it is a writeable directory1043 // Set test snapshot location only if it is a writeable directory
1044 QString path = parser->value("testResultsLocation");1044 QString path = parser.value("testResultsLocation");
1045 1045
1046 QFileInfo fileInfo(path);1046 QFileInfo fileInfo(path);
1047 if (fileInfo.isDir() && fileInfo.isWritable()) {1047 if (fileInfo.isDir() && fileInfo.isWritable()) {
1048 TestScriptingInterface::getInstance()->setTestResultsLocation(path);1048 TestScriptingInterface::getInstance()->setTestResultsLocation(path);
1049 }1049 }
1050 }1050 }
1051 _urlParam = parser->value("url");1051 _urlParam = parser.value("url");
1052 }1052 }
1053 1053
1054 {1054 {
@@ -1114,7 +1114,7 @@ Application::Application( · 59 unmodified lines
1114 auto addressManager = DependencyManager::get<AddressManager>();1114 auto addressManager = DependencyManager::get<AddressManager>();
1115 addressManager->moveToThread(nodeList->thread());1115 addressManager->moveToThread(nodeList->thread());
1116 1116
1117 if (parser->isSet("disableWatchdog")) {1117 if (parser.isSet("disableWatchdog")) {
1118 DISABLE_WATCHDOG = true;1118 DISABLE_WATCHDOG = true;
1119 }1119 }
1120 // Set up a watchdog thread to intentionally crash the application on deadlocks1120 // Set up a watchdog thread to intentionally crash the application on deadlocks
@@ -1435,9 +1435,9 @@ Application::Application( · 314 unmodified lines
1435 connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);1435 connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
1436 connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this, &Application::addingEntityWithCertificate);1436 connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this, &Application::addingEntityWithCertificate);
1437 1437
1438 if (parser->isSet("concurrent-downloads")) {1438 if (parser.isSet("concurrent-downloads")) {
1439 bool success;1439 bool success;
1440 uint32_t concurrentDownloads = parser->value("concurrent-downloads").toUInt(&success);1440 uint32_t concurrentDownloads = parser.value("concurrent-downloads").toUInt(&success);
1441 if (!success) {1441 if (!success) {
1442 concurrentDownloads = MAX_CONCURRENT_RESOURCE_DOWNLOADS;1442 concurrentDownloads = MAX_CONCURRENT_RESOURCE_DOWNLOADS;
1443 }1443 }
@@ -1446,15 +1446,15 @@ Application::Application( · 2 unmodified lines
1446 1446
1447 // perhaps override the avatar url. Since we will test later for validity1447 // perhaps override the avatar url. Since we will test later for validity
1448 // we don't need to do so here.1448 // we don't need to do so here.
1449 if (parser->isSet("avatarURL")) {1449 if (parser.isSet("avatarURL")) {
1450 _avatarOverrideUrl = QUrl::fromUserInput(parser->value("avatarURL"));1450 _avatarOverrideUrl = QUrl::fromUserInput(parser.value("avatarURL"));
1451 }1451 }
1452 1452
1453 // If someone specifies both --avatarURL and --replaceAvatarURL,1453 // If someone specifies both --avatarURL and --replaceAvatarURL,
1454 // the replaceAvatarURL wins. So only set the _overrideUrl if this1454 // the replaceAvatarURL wins. So only set the _overrideUrl if this
1455 // does have a non-empty string.1455 // does have a non-empty string.
1456 if (parser->isSet("replaceAvatarURL")) {1456 if (parser.isSet("replaceAvatarURL")) {
1457 QString replaceURL = parser->value("replaceAvatarURL");1457 QString replaceURL = parser.value("replaceAvatarURL");
1458 _avatarOverrideUrl = QUrl::fromUserInput(replaceURL);1458 _avatarOverrideUrl = QUrl::fromUserInput(replaceURL);
1459 _saveAvatarOverrideUrl = true;1459 _saveAvatarOverrideUrl = true;
1460 }1460 }
@@ -1472,7 +1472,7 @@ Application::Application( · 11 unmodified lines
1472 _glWidget->setFocusPolicy(Qt::StrongFocus);1472 _glWidget->setFocusPolicy(Qt::StrongFocus);
1473 _glWidget->setFocus();1473 _glWidget->setFocus();
1474 1474
1475 if (parser->isSet("system-cursor")) {1475 if (parser.isSet("system-cursor")) {
1476 _preferredCursor.set(Cursor::Manager::getIconName(Cursor::Icon::SYSTEM));1476 _preferredCursor.set(Cursor::Manager::getIconName(Cursor::Icon::SYSTEM));
1477 }1477 }
1478 showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get()));1478 showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get()));
@@ -1547,7 +1547,7 @@ Application::Application( · 68 unmodified lines
1547 });1547 });
1548#else1548#else
1549 // Do not show login dialog if requested not to on the command line1549 // 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")) {
1551 connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {1551 connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
1552 resumeAfterLoginDialogActionTaken();1552 resumeAfterLoginDialogActionTaken();
1553 });1553 });
@@ -1919,8 +1919,8 @@ Application::Application( · 365 unmodified lines
1919 userInputMapper->registerDevice(_touchscreenVirtualPadDevice->getInputDevice());1919 userInputMapper->registerDevice(_touchscreenVirtualPadDevice->getInputDevice());
1920 }1920 }
1921 1921
1922 if (parser->isSet("scripts")) {1922 if (parser.isSet("scripts")) {
1923 _defaultScriptsLocation.setPath(parser->value("scripts")); // Might need to be done in "main.cpp".1923 _defaultScriptsLocation.setPath(parser.value("scripts")); // Might need to be done in "main.cpp".
1924 _overrideDefaultScriptsLocation = true;1924 _overrideDefaultScriptsLocation = true;
1925 } else {1925 } else {
1926 _overrideDefaultScriptsLocation = false;1926 _overrideDefaultScriptsLocation = false;
@@ -1982,7 +1982,7 @@ Application::Application( · 55 unmodified lines
1982 // If launched from Steam, let it handle updates1982 // If launched from Steam, let it handle updates
1983 bool buildCanUpdate = BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable1983 bool buildCanUpdate = BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable
1984 || BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master;1984 || BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master;
1985 if (!parser->isSet("no-updater") && buildCanUpdate) {1985 if (!parser.isSet("no-updater") && buildCanUpdate) {
1986 constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only";1986 constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only";
1987 1987
1988 auto applicationUpdater = DependencyManager::set<AutoUpdater>();1988 auto applicationUpdater = DependencyManager::set<AutoUpdater>();
@@ -2152,7 +2152,7 @@ Application::Application( · 163 unmodified lines
2152 2152
2153 // setup the stats interval depending on if the 1s faster hearbeat was requested2153 // setup the stats interval depending on if the 1s faster hearbeat was requested
2154 static int SEND_STATS_INTERVAL_MS;2154 static int SEND_STATS_INTERVAL_MS;
2155 if (parser->isSet("fast-heartbeat")) {2155 if (parser.isSet("fast-heartbeat")) {
2156 SEND_STATS_INTERVAL_MS = 1000;2156 SEND_STATS_INTERVAL_MS = 1000;
2157 } else {2157 } else {
2158 SEND_STATS_INTERVAL_MS = 10000;2158 SEND_STATS_INTERVAL_MS = 10000;
@@ -5473,7 +5473,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa · 3314 unmodified lines
5473 return exportEntities(filename, entities, &center);5473 return exportEntities(filename, entities, &center);
5474}5474}
5475 5475
5476void Application::loadSettings(const QCommandLineParser* parser) {5476void Application::loadSettings(const QCommandLineParser& parser) {
5477 5477
5478 sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value.5478 sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value.
5479 DependencyManager::get<AudioClient>()->loadSettings();5479 DependencyManager::get<AudioClient>()->loadSettings();
@@ -5503,7 +5503,7 @@ void Application::loadSettings(const QCommandLineParser* parser) { · 23 unmodified lines
5503 }5503 }
5504 5504
5505 bool isFirstPerson = false;5505 bool isFirstPerson = false;
5506 if (parser->isSet("no-launcher")) {5506 if (parser.isSet("no-launcher")) {
5507 const auto& displayPlugins = pluginManager->getDisplayPlugins();5507 const auto& displayPlugins = pluginManager->getDisplayPlugins();
5508 for (const auto& plugin : displayPlugins) {5508 for (const auto& plugin : displayPlugins) {
5509 if (!plugin->isHmd()) {5509 if (!plugin->isHmd()) {
@@ -8790,21 +8790,21 @@ void Application::sendLambdaEvent(const std::function<void()>& f) { · 3280 unmodified lines
8790 }8790 }
8791}8791}
8792 8792
8793void Application::initPlugins(const QCommandLineParser* parser) {8793void Application::initPlugins(const QCommandLineParser& parser) {
8794 if (parser->isSet("display")) {8794 if (parser.isSet("display")) {
8795 auto preferredDisplays = parser->value("display").split(',', Qt::SkipEmptyParts);8795 auto preferredDisplays = parser.value("display").split(',', Qt::SkipEmptyParts);
8796 qInfo() << "Setting prefered display plugins:" << preferredDisplays;8796 qInfo() << "Setting prefered display plugins:" << preferredDisplays;
8797 PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays);8797 PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays);
8798 }8798 }
8799 8799
8800 if (parser->isSet("disable-displays")) {8800 if (parser.isSet("disable-displays")) {
8801 auto disabledDisplays = parser->value("disableDisplays").split(',', Qt::SkipEmptyParts);8801 auto disabledDisplays = parser.value("disableDisplays").split(',', Qt::SkipEmptyParts);
8802 qInfo() << "Disabling following display plugins:" << disabledDisplays;8802 qInfo() << "Disabling following display plugins:" << disabledDisplays;
8803 PluginManager::getInstance()->disableDisplays(disabledDisplays);8803 PluginManager::getInstance()->disableDisplays(disabledDisplays);
8804 }8804 }
8805 8805
8806 if (parser->isSet("disable-inputs")) {8806 if (parser.isSet("disable-inputs")) {
8807 auto disabledInputs = parser->value("disableInputs").split(',', Qt::SkipEmptyParts);8807 auto disabledInputs = parser.value("disableInputs").split(',', Qt::SkipEmptyParts);
8808 qInfo() << "Disabling following input plugins:" << disabledInputs;8808 qInfo() << "Disabling following input plugins:" << disabledInputs;
8809 PluginManager::getInstance()->disableInputs(disabledInputs);8809 PluginManager::getInstance()->disableInputs(disabledInputs);
8810 }8810 }