mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-14 01:07:12 +02:00
Streamlined handling with single parameter source.
This commit is contained in:
parent
dd75c14dba
commit
e1d79c7b59
3 changed files with 149 additions and 136 deletions
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include <QtCore/QResource>
|
||||
#include <QtCore/QAbstractNativeEventFilter>
|
||||
#include <QtCore/QCommandLineParser>
|
||||
#include <QtCore/QMimeData>
|
||||
#include <QtCore/QThreadPool>
|
||||
#include <QtCore/QFileSelector>
|
||||
|
@ -724,12 +723,9 @@ extern DisplayPluginList getDisplayPlugins();
|
|||
extern InputPluginList getInputPlugins();
|
||||
extern void saveInputPluginSettings(const InputPluginList& plugins);
|
||||
|
||||
// Parameters used for running tests from teh command line
|
||||
const QString TEST_SCRIPT_COMMAND{ "--testScript" };
|
||||
const QString TEST_QUIT_WHEN_FINISHED_OPTION{ "quitWhenFinished" };
|
||||
const QString TEST_RESULTS_LOCATION_COMMAND{ "--testResultsLocation" };
|
||||
// Parameters used for running tests from the command line
|
||||
|
||||
bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||
bool setupEssentials(int& argc, char** argv, const QCommandLineParser* parser, bool runningMarkerExisted) {
|
||||
const char** constArgv = const_cast<const char**>(argv);
|
||||
|
||||
qInstallMessageHandler(messageHandler);
|
||||
|
@ -737,6 +733,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
// HRS: I could not figure out how to move these any earlier in startup, so when using this option, be sure to also supply
|
||||
// --allowMultipleInstances
|
||||
auto reportAndQuit = [&](const char* commandSwitch, std::function<void(FILE* fp)> report) {
|
||||
// Do something about this:
|
||||
const char* reportfile = getCmdOption(argc, constArgv, commandSwitch);
|
||||
// Reports to the specified file, because stdout is set up to be captured for logging.
|
||||
if (reportfile) {
|
||||
|
@ -755,36 +752,23 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
reportAndQuit("--protocolVersion", [&](FILE* fp) {
|
||||
auto version = protocolVersionsSignatureBase64();
|
||||
fputs(version.toLatin1().data(), fp);
|
||||
});
|
||||
reportAndQuit("--version", [&](FILE* fp) {
|
||||
}); // This doesn't seem to work.
|
||||
/*reportAndQuit("--version", [&](FILE* fp) {
|
||||
fputs(BuildInfo::VERSION.toLatin1().data(), fp);
|
||||
});
|
||||
});*/
|
||||
|
||||
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
||||
const int listenPort = portStr ? atoi(portStr) : INVALID_PORT;
|
||||
const int listenPort = parser->isSet("listenPort") ? parser->value("listenPort").toInt() : INVALID_PORT;
|
||||
|
||||
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
||||
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
||||
bool suppressPrompt = parser->isSet("suppress-settings-reset");
|
||||
|
||||
// set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store
|
||||
static const auto OCULUS_STORE_ARG = "--oculus-store";
|
||||
bool isStore = cmdOptionExists(argc, const_cast<const char**>(argv), OCULUS_STORE_ARG);
|
||||
qApp->setProperty(hifi::properties::OCULUS_STORE, isStore);
|
||||
qApp->setProperty(hifi::properties::OCULUS_STORE, parser->isSet("oculus-store"));
|
||||
|
||||
// emulate standalone device
|
||||
static const auto STANDALONE_ARG = "--standalone";
|
||||
bool isStandalone = cmdOptionExists(argc, const_cast<const char**>(argv), STANDALONE_ARG);
|
||||
qApp->setProperty(hifi::properties::STANDALONE, isStandalone);
|
||||
qApp->setProperty(hifi::properties::STANDALONE, parser->isSet("standalone"));
|
||||
|
||||
// Ignore any previous crashes if running from command line with a test script.
|
||||
bool inTestMode { false };
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
QString parameter(argv[i]);
|
||||
if (parameter == TEST_SCRIPT_COMMAND) {
|
||||
inTestMode = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool inTestMode = parser->isSet("testScript");
|
||||
|
||||
bool previousSessionCrashed { false };
|
||||
if (!inTestMode) {
|
||||
|
@ -792,10 +776,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
}
|
||||
|
||||
// get dir to use for cache
|
||||
static const auto CACHE_SWITCH = "--cache";
|
||||
QString cacheDir = getCmdOption(argc, const_cast<const char**>(argv), CACHE_SWITCH);
|
||||
if (!cacheDir.isEmpty()) {
|
||||
qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, cacheDir);
|
||||
if (parser->isSet("cache")) {
|
||||
qApp->setProperty(hifi::properties::APP_LOCAL_DATA_PATH, parser->value("cache"));
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -837,7 +819,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
QCoreApplication::addLibraryPath(audioDLLPath);
|
||||
#endif
|
||||
|
||||
QString defaultScriptsOverrideOption = getCmdOption(argc, constArgv, "--defaultScriptsOverride");
|
||||
QString defaultScriptsOverrideOption = parser->value("defaultScriptsOverride");
|
||||
|
||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
|
||||
|
@ -963,7 +945,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
});
|
||||
|
||||
|
||||
QString setBookmarkValue = getCmdOption(argc, constArgv, "--setBookmark");
|
||||
QString setBookmarkValue = parser->value("setBookmark");
|
||||
if (!setBookmarkValue.isEmpty()) {
|
||||
// Bookmarks are expected to be in a name=url form.
|
||||
// An `=` character in the name or url is unsupported.
|
||||
|
@ -1020,14 +1002,19 @@ QSharedPointer<OffscreenUi> getOffscreenUI() {
|
|||
#endif
|
||||
}
|
||||
|
||||
Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bool runningMarkerExisted) :
|
||||
Application::Application(
|
||||
int& argc, char** argv,
|
||||
const QCommandLineParser* parser,
|
||||
QElapsedTimer& startupTimer,
|
||||
bool runningMarkerExisted
|
||||
) :
|
||||
QApplication(argc, argv),
|
||||
_window(new MainWindow(desktop())),
|
||||
_sessionRunTimer(startupTimer),
|
||||
#ifndef Q_OS_ANDROID
|
||||
_logger(new FileLogger(this)),
|
||||
#endif
|
||||
_previousSessionCrashed(setupEssentials(argc, argv, runningMarkerExisted)),
|
||||
_previousSessionCrashed(setupEssentials(argc, argv, parser, runningMarkerExisted)),
|
||||
_entitySimulation(std::make_shared<PhysicalEntitySimulation>()),
|
||||
_physicsEngine(std::make_shared<PhysicsEngine>(Vectors::ZERO)),
|
||||
_entityClipboard(std::make_shared<EntityTree>()),
|
||||
|
@ -1064,12 +1051,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
LogHandler::getInstance().setupRepeatedMessageFlusher();
|
||||
|
||||
{
|
||||
const QStringList args = arguments();
|
||||
|
||||
for (int i = 0; i < args.size() - 1; ++i) {
|
||||
if (args.at(i) == TEST_SCRIPT_COMMAND && (i + 1) < args.size()) {
|
||||
QString testScriptPath = args.at(i + 1);
|
||||
|
||||
if (parser->isSet("testScript")) {
|
||||
QString testScriptPath = parser->value("testScript");
|
||||
// If the URL scheme is http(s) or ftp, then use as is, else - treat it as a local file
|
||||
// This is done so as not break previous command line scripts
|
||||
if (testScriptPath.left(HIFI_URL_SCHEME_HTTP.length()) == HIFI_URL_SCHEME_HTTP ||
|
||||
|
@ -1080,20 +1063,20 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
setProperty(hifi::properties::TEST, QUrl::fromLocalFile(testScriptPath));
|
||||
}
|
||||
|
||||
// quite when finished parameter must directly follow the test script
|
||||
if ((i + 2) < args.size() && args.at(i + 2) == TEST_QUIT_WHEN_FINISHED_OPTION) {
|
||||
if (parser->isSet("quitWhenFinished")) {
|
||||
quitWhenFinished = true;
|
||||
}
|
||||
} else if (args.at(i) == TEST_RESULTS_LOCATION_COMMAND) {
|
||||
// Set test snapshot location only if it is a writeable directory
|
||||
QString path(args.at(i + 1));
|
||||
}
|
||||
if (parser->isSet("testResultsLocation")) {
|
||||
// Set test snapshot location only if it is a writeable directory
|
||||
QString path = parser->value("testResultsLocation");
|
||||
|
||||
QFileInfo fileInfo(path);
|
||||
if (fileInfo.isDir() && fileInfo.isWritable()) {
|
||||
TestScriptingInterface::getInstance()->setTestResultsLocation(path);
|
||||
}
|
||||
QFileInfo fileInfo(path);
|
||||
if (fileInfo.isDir() && fileInfo.isWritable()) {
|
||||
TestScriptingInterface::getInstance()->setTestResultsLocation(path);
|
||||
}
|
||||
}
|
||||
_urlParam = parser->value("url");
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1159,8 +1142,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
addressManager->moveToThread(nodeList->thread());
|
||||
|
||||
const char** constArgv = const_cast<const char**>(argv);
|
||||
if (cmdOptionExists(argc, constArgv, "--disableWatchdog")) {
|
||||
if (parser->isSet("disableWatchdog")) {
|
||||
DISABLE_WATCHDOG = true;
|
||||
}
|
||||
// Set up a watchdog thread to intentionally crash the application on deadlocks
|
||||
|
@ -1481,24 +1463,26 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
connect(&_entityEditSender, &EntityEditPacketSender::packetSent, this, &Application::packetSent);
|
||||
connect(&_entityEditSender, &EntityEditPacketSender::addingEntityWithCertificate, this, &Application::addingEntityWithCertificate);
|
||||
|
||||
QString concurrentDownloadsStr = getCmdOption(argc, constArgv, "--concurrent-downloads");
|
||||
bool success;
|
||||
uint32_t concurrentDownloads = concurrentDownloadsStr.toUInt(&success);
|
||||
if (!success) {
|
||||
concurrentDownloads = MAX_CONCURRENT_RESOURCE_DOWNLOADS;
|
||||
if (parser->isSet("concurrent-downloads")) {
|
||||
bool success;
|
||||
uint32_t concurrentDownloads = parser->value("concurrent-downloads").toUInt(&success);
|
||||
if (!success) {
|
||||
concurrentDownloads = MAX_CONCURRENT_RESOURCE_DOWNLOADS;
|
||||
}
|
||||
ResourceCache::setRequestLimit(concurrentDownloads);
|
||||
}
|
||||
ResourceCache::setRequestLimit(concurrentDownloads);
|
||||
|
||||
// perhaps override the avatar url. Since we will test later for validity
|
||||
// we don't need to do so here.
|
||||
QString avatarURL = getCmdOption(argc, constArgv, "--avatarURL");
|
||||
_avatarOverrideUrl = QUrl::fromUserInput(avatarURL);
|
||||
if (parser->isSet("avatarURL")) {
|
||||
_avatarOverrideUrl = QUrl::fromUserInput(parser->value("avatarURL"));
|
||||
}
|
||||
|
||||
// If someone specifies both --avatarURL and --replaceAvatarURL,
|
||||
// the replaceAvatarURL wins. So only set the _overrideUrl if this
|
||||
// does have a non-empty string.
|
||||
QString replaceURL = getCmdOption(argc, constArgv, "--replaceAvatarURL");
|
||||
if (!replaceURL.isEmpty()) {
|
||||
if (parser->isSet("replaceAvatarURL")) {
|
||||
QString replaceURL = parser->value("replaceAvatarURL");
|
||||
_avatarOverrideUrl = QUrl::fromUserInput(replaceURL);
|
||||
_saveAvatarOverrideUrl = true;
|
||||
}
|
||||
|
@ -1516,7 +1500,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_glWidget->setFocusPolicy(Qt::StrongFocus);
|
||||
_glWidget->setFocus();
|
||||
|
||||
if (cmdOptionExists(argc, constArgv, "--system-cursor")) {
|
||||
if (parser->isSet("system-cursor")) {
|
||||
_preferredCursor.set(Cursor::Manager::getIconName(Cursor::Icon::SYSTEM));
|
||||
}
|
||||
showCursor(Cursor::Manager::lookupIcon(_preferredCursor.get()));
|
||||
|
@ -1585,21 +1569,23 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
}
|
||||
});
|
||||
|
||||
#if defined(Q_OS_ANDROID) || defined(DISABLE_QML)
|
||||
connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
|
||||
#if !defined(Q_OS_ANDROID) && !defined(DISABLE_QML)
|
||||
// Do not show login dialog if requested not to on the command line
|
||||
QString hifiNoLoginCommandLineKey = QString("--").append(HIFI_NO_LOGIN_COMMAND_LINE_KEY);
|
||||
int index = arguments().indexOf(hifiNoLoginCommandLineKey);
|
||||
if (index != -1 || _disableLoginScreen) {
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
return;
|
||||
}
|
||||
|
||||
showLoginScreen();
|
||||
#else
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
#endif
|
||||
});
|
||||
#else
|
||||
// Do not show login dialog if requested not to on the command line
|
||||
if (_disableLoginScreen || parser->isSet("no-login-suggestion")) {
|
||||
connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
});
|
||||
} else {
|
||||
connect(offscreenUi.data(), &OffscreenUi::keyboardFocusActive, [this]() {
|
||||
showLoginScreen();
|
||||
resumeAfterLoginDialogActionTaken();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize the user interface and menu system
|
||||
// Needs to happen AFTER the render engine initialization to access its configuration
|
||||
|
@ -1961,13 +1947,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
userInputMapper->registerDevice(_touchscreenVirtualPadDevice->getInputDevice());
|
||||
}
|
||||
|
||||
QString scriptsSwitch = QString("--").append(SCRIPTS_SWITCH);
|
||||
_defaultScriptsLocation.setPath(getCmdOption(argc, constArgv, scriptsSwitch.toStdString().c_str()));
|
||||
if (parser->isSet("scripts")) {
|
||||
_defaultScriptsLocation.setPath(parser->value("scripts")); // Already done in "main.cpp".
|
||||
_overrideDefaultScriptsLocation = true;
|
||||
} else {
|
||||
_overrideDefaultScriptsLocation = false;
|
||||
}
|
||||
|
||||
// Make sure we don't time out during slow operations at startup
|
||||
updateHeartbeat();
|
||||
|
||||
loadSettings();
|
||||
loadSettings(parser);
|
||||
|
||||
updateVerboseLogging();
|
||||
|
||||
|
@ -2018,11 +2008,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
|
||||
|
||||
// If launched from Steam, let it handle updates
|
||||
const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater";
|
||||
bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1;
|
||||
bool buildCanUpdate = BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Stable
|
||||
|| BuildInfo::BUILD_TYPE == BuildInfo::BuildType::Master;
|
||||
if (!noUpdater && buildCanUpdate) {
|
||||
if (!parser->isSet("no-updater") && buildCanUpdate) {
|
||||
constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only";
|
||||
|
||||
auto applicationUpdater = DependencyManager::set<AutoUpdater>();
|
||||
|
@ -2191,8 +2179,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
static int NEARBY_AVATAR_RADIUS_METERS = 10;
|
||||
|
||||
// setup the stats interval depending on if the 1s faster hearbeat was requested
|
||||
static const QString FAST_STATS_ARG = "--fast-heartbeat";
|
||||
static int SEND_STATS_INTERVAL_MS = arguments().indexOf(FAST_STATS_ARG) != -1 ? 1000 : 10000;
|
||||
static int SEND_STATS_INTERVAL_MS;
|
||||
if (parser->isSet("fast-heartbeat")) {
|
||||
SEND_STATS_INTERVAL_MS = 1000;
|
||||
} else {
|
||||
SEND_STATS_INTERVAL_MS = 10000;
|
||||
}
|
||||
|
||||
static glm::vec3 lastAvatarPosition = myAvatar->getWorldPosition();
|
||||
static glm::mat4 lastHMDHeadPose = getHMDSensorPose();
|
||||
|
@ -4022,16 +4014,11 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
|
|||
QString addressLookupString;
|
||||
|
||||
// when --url in command line, teleport to location
|
||||
QCommandLineParser parser;
|
||||
QCommandLineOption urlOption("url", "", "value");
|
||||
parser.addOption(urlOption);
|
||||
parser.parse(arguments());
|
||||
if (parser.isSet(urlOption)) {
|
||||
QUrl url = QUrl(parser.value(urlOption));
|
||||
if (url.scheme() == URL_SCHEME_VIRCADIAAPP) {
|
||||
Setting::Handle<QVariant>("startUpApp").set(url.path());
|
||||
if (!_urlParam.isEmpty()) { // Not sure if format supported by isValid().
|
||||
if (_urlParam.scheme() == URL_SCHEME_VIRCADIAAPP) {
|
||||
Setting::Handle<QVariant>("startUpApp").set(_urlParam.path());
|
||||
} else {
|
||||
addressLookupString = url.toString();
|
||||
addressLookupString = _urlParam.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5514,7 +5501,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa
|
|||
return exportEntities(filename, entities, ¢er);
|
||||
}
|
||||
|
||||
void Application::loadSettings() {
|
||||
void Application::loadSettings(const QCommandLineParser* parser) {
|
||||
|
||||
sessionRunTime.set(0); // Just clean living. We're about to saveSettings, which will update value.
|
||||
DependencyManager::get<AudioClient>()->loadSettings();
|
||||
|
@ -5544,7 +5531,7 @@ void Application::loadSettings() {
|
|||
}
|
||||
|
||||
bool isFirstPerson = false;
|
||||
if (arguments().contains("--no-launcher")) {
|
||||
if (parser->isSet("no-launcher")) {
|
||||
const auto& displayPlugins = pluginManager->getDisplayPlugins();
|
||||
for (const auto& plugin : displayPlugins) {
|
||||
if (!plugin->isHmd()) {
|
||||
|
@ -5849,7 +5836,7 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
|||
scriptEngines->reloadLocalFiles();
|
||||
|
||||
// if the --scripts command-line argument was used.
|
||||
if (_defaultScriptsLocation.exists() && (arguments().indexOf(QString("--").append(SCRIPTS_SWITCH))) != -1) {
|
||||
if (_overrideDefaultScriptsLocation && _defaultScriptsLocation.exists()) {
|
||||
scriptEngines->loadDefaultScripts();
|
||||
scriptEngines->defaultScriptsLocationOverridden(true);
|
||||
} else {
|
||||
|
@ -5869,7 +5856,7 @@ void Application::resumeAfterLoginDialogActionTaken() {
|
|||
// Set last parameter to exit interface when the test script finishes, if so requested
|
||||
DependencyManager::get<ScriptEngines>()->loadScript(testScript, false, false, false, false, quitWhenFinished);
|
||||
// This is done so we don't get a "connection time-out" message when we haven't passed in a URL.
|
||||
if (arguments().contains("--url")) {
|
||||
if (!_urlParam.isEmpty()) {
|
||||
auto reply = SandboxUtils::getStatus();
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply] { handleSandboxStatus(reply); });
|
||||
}
|
||||
|
@ -8831,31 +8818,21 @@ void Application::sendLambdaEvent(const std::function<void()>& f) {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::initPlugins(const QStringList& arguments) {
|
||||
QCommandLineOption display("display", "Preferred displays", "displays");
|
||||
QCommandLineOption disableDisplays("disable-displays", "Displays to disable", "displays");
|
||||
QCommandLineOption disableInputs("disable-inputs", "Inputs to disable", "inputs");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addOption(display);
|
||||
parser.addOption(disableDisplays);
|
||||
parser.addOption(disableInputs);
|
||||
parser.parse(arguments);
|
||||
|
||||
if (parser.isSet(display)) {
|
||||
auto preferredDisplays = parser.value(display).split(',', Qt::SkipEmptyParts);
|
||||
void Application::initPlugins(const QCommandLineParser* parser) {
|
||||
if (parser->isSet("display")) {
|
||||
auto preferredDisplays = parser->value("display").split(',', Qt::SkipEmptyParts);
|
||||
qInfo() << "Setting prefered display plugins:" << preferredDisplays;
|
||||
PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays);
|
||||
}
|
||||
|
||||
if (parser.isSet(disableDisplays)) {
|
||||
auto disabledDisplays = parser.value(disableDisplays).split(',', Qt::SkipEmptyParts);
|
||||
if (parser->isSet("disable-displays")) {
|
||||
auto disabledDisplays = parser->value("disableDisplays").split(',', Qt::SkipEmptyParts);
|
||||
qInfo() << "Disabling following display plugins:" << disabledDisplays;
|
||||
PluginManager::getInstance()->disableDisplays(disabledDisplays);
|
||||
}
|
||||
|
||||
if (parser.isSet(disableInputs)) {
|
||||
auto disabledInputs = parser.value(disableInputs).split(',', Qt::SkipEmptyParts);
|
||||
if (parser->isSet("disable-inputs")) {
|
||||
auto disabledInputs = parser->value("disableInputs").split(',', Qt::SkipEmptyParts);
|
||||
qInfo() << "Disabling following input plugins:" << disabledInputs;
|
||||
PluginManager::getInstance()->disableInputs(disabledInputs);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
#include <QtCore/QCommandLineParser>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QSet>
|
||||
|
@ -22,6 +23,7 @@
|
|||
#include <QtCore/QStringList>
|
||||
#include <QtQuick/QQuickItem>
|
||||
|
||||
|
||||
#include <QtGui/QImage>
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
|
@ -96,8 +98,6 @@ namespace controller {
|
|||
|
||||
|
||||
static const QString RUNNING_MARKER_FILENAME = "Interface.running";
|
||||
static const QString SCRIPTS_SWITCH = "scripts";
|
||||
static const QString HIFI_NO_LOGIN_COMMAND_LINE_KEY = "no-login-suggestion";
|
||||
|
||||
class Application;
|
||||
#if defined(qApp)
|
||||
|
@ -130,10 +130,15 @@ public:
|
|||
virtual DisplayPluginPointer getActiveDisplayPlugin() const override;
|
||||
|
||||
// FIXME? Empty methods, do we still need them?
|
||||
static void initPlugins(const QStringList& arguments);
|
||||
static void initPlugins(const QCommandLineParser* parser);
|
||||
static void shutdownPlugins();
|
||||
|
||||
Application(int& argc, char** argv, QElapsedTimer& startup_time, bool runningMarkerExisted);
|
||||
Application(
|
||||
int& argc, char** argv,
|
||||
const QCommandLineParser* parser,
|
||||
QElapsedTimer& startup_time,
|
||||
bool runningMarkerExisted
|
||||
);
|
||||
~Application();
|
||||
|
||||
void postLambdaEvent(const std::function<void()>& f) override;
|
||||
|
@ -505,7 +510,7 @@ private slots:
|
|||
|
||||
void notifyPacketVersionMismatch();
|
||||
|
||||
void loadSettings();
|
||||
void loadSettings(const QCommandLineParser* parser);
|
||||
void saveSettings() const;
|
||||
void setFailedToConnectToEntityServer();
|
||||
|
||||
|
@ -705,6 +710,8 @@ private:
|
|||
QPointer<LogDialog> _logDialog;
|
||||
QPointer<EntityScriptServerLogDialog> _entityScriptServerLogDialog;
|
||||
QDir _defaultScriptsLocation;
|
||||
// If above is only set by parameter, below is unnecessary.
|
||||
bool _overrideDefaultScriptsLocation;
|
||||
|
||||
TouchEvent _lastTouchEvent;
|
||||
|
||||
|
@ -830,6 +837,8 @@ private:
|
|||
|
||||
bool quitWhenFinished { false };
|
||||
|
||||
QUrl _urlParam;
|
||||
|
||||
bool _showTrackedObjects { false };
|
||||
bool _prevShowTrackedObjects { false };
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ int main(int argc, const char* argv[]) {
|
|||
);
|
||||
QCommandLineOption protocolVersionOption(
|
||||
"protocolVersion",
|
||||
"Displays the protocol version."
|
||||
"Writes the protocol version base64 signature to a file?",
|
||||
"path" // Why??
|
||||
);
|
||||
QCommandLineOption noUpdaterOption(
|
||||
"no-updater",
|
||||
|
@ -106,11 +107,11 @@ int main(int argc, const char* argv[]) {
|
|||
"set test cache <dir>.",
|
||||
"dir"
|
||||
);
|
||||
//QCommandLineOption scriptsOption(
|
||||
// "scripts",
|
||||
// "Set path for defaultScripts.",
|
||||
// "dir"
|
||||
//); // Use this once SCRIPTS_SWITCH is removed.
|
||||
QCommandLineOption scriptsOption(
|
||||
"scripts",
|
||||
"Set path for defaultScripts.",
|
||||
"dir"
|
||||
);
|
||||
QCommandLineOption allowMultipleInstancesOption(
|
||||
"allowMultipleInstances",
|
||||
"Allow multiple instances to run."
|
||||
|
@ -122,11 +123,13 @@ int main(int argc, const char* argv[]) {
|
|||
);
|
||||
QCommandLineOption disableDisplaysOption(
|
||||
"disable-displays",
|
||||
"Displays to disable."
|
||||
"Displays to disable.",
|
||||
"string"
|
||||
);
|
||||
QCommandLineOption disableInputsOption(
|
||||
"disable-inputs",
|
||||
"Inputs to disable."
|
||||
"Inputs to disable.",
|
||||
"string"
|
||||
);
|
||||
QCommandLineOption suppressSettingsResetOption(
|
||||
"suppress-settings-reset",
|
||||
|
@ -175,11 +178,11 @@ int main(int argc, const char* argv[]) {
|
|||
"no-launcher",
|
||||
"Do not execute the launcher."
|
||||
);
|
||||
QCommandLineOption overrideScriptsPathOption(
|
||||
/*QCommandLineOption overrideScriptsPathOption(
|
||||
SCRIPTS_SWITCH,
|
||||
"Set scripts <path>",
|
||||
"path"
|
||||
);
|
||||
);*/
|
||||
QCommandLineOption defaultScriptOverrideOption(
|
||||
"defaultScriptsOverride",
|
||||
"Override defaultsScripts.js.",
|
||||
|
@ -195,6 +198,10 @@ int main(int argc, const char* argv[]) {
|
|||
"Set user display name <string>.",
|
||||
"string"
|
||||
);
|
||||
QCommandLineOption noLoginOption(
|
||||
"no-login-suggestion",
|
||||
"Do not show log-in dialogue."
|
||||
);
|
||||
QCommandLineOption traceFileOption(
|
||||
"traceFile",
|
||||
"Probably writes a trace to a file?",
|
||||
|
@ -210,6 +217,24 @@ int main(int argc, const char* argv[]) {
|
|||
"Forces client instance's clock to skew for demonstration purposes.",
|
||||
"value"
|
||||
);
|
||||
QCommandLineOption testScriptOption(
|
||||
"testScript",
|
||||
"Undocumented. Accepts parameter as U.R.L.",
|
||||
"string"
|
||||
);
|
||||
QCommandLineOption testResultsLocationOption(
|
||||
"testResultsLocation",
|
||||
"Undocumented",
|
||||
"path"
|
||||
);
|
||||
QCommandLineOption quitWhenFinishedOption(
|
||||
"quitWhenFinished",
|
||||
"Only works if \"--testScript\" is provided."
|
||||
); // Should probably also work on testResultsLocationOption.
|
||||
QCommandLineOption fastHeartbeatOption(
|
||||
"fast-heartbeat",
|
||||
"Change stats polling interval from 10000ms to 1000ms."
|
||||
);
|
||||
// "--qmljsdebugger", which appears in output from "--help-all".
|
||||
// Those below don't seem to be optional.
|
||||
// --ignore-gpu-blacklist
|
||||
|
@ -223,7 +248,7 @@ int main(int argc, const char* argv[]) {
|
|||
parser.addOption(listenPortOption);
|
||||
parser.addOption(serverContentPathOption);
|
||||
parser.addOption(overrideAppLocalDataPathOption);
|
||||
//parser.addOption(scriptsOption); // Use this once SCRIPTS_SWITCH is removed.
|
||||
parser.addOption(scriptsOption); // Also known as "overrideScriptsPathOption"?
|
||||
parser.addOption(allowMultipleInstancesOption);
|
||||
parser.addOption(displaysOption);
|
||||
parser.addOption(disableDisplaysOption);
|
||||
|
@ -239,15 +264,17 @@ int main(int argc, const char* argv[]) {
|
|||
parser.addOption(setBookmarkOption);
|
||||
parser.addOption(forceCrashReportingOption);
|
||||
parser.addOption(noLauncherOption);
|
||||
parser.addOption(overrideScriptsPathOption); // Remove this along with SCRIPTS_SWITCH.
|
||||
parser.addOption(responseTokensOption);
|
||||
parser.addOption(displayNameOption);
|
||||
parser.addOption(defaultScriptOverrideOption);
|
||||
parser.addOption(traceFileOption);
|
||||
parser.addOption(traceDurationOption);
|
||||
parser.addOption(clockSkewOption);
|
||||
parser.addOption(testScriptOption);
|
||||
parser.addOption(testResultsLocationOption);
|
||||
parser.addOption(quitWhenFinishedOption);
|
||||
parser.addOption(fastHeartbeatOption);
|
||||
|
||||
QStringList arguments;
|
||||
QString applicationPath;
|
||||
// A temporary application instance is needed to get the location of the running executable
|
||||
// Tests using high_resolution_clock show that this takes about 30-50 microseconds (on my machine, YMMV)
|
||||
|
@ -257,7 +284,6 @@ int main(int argc, const char* argv[]) {
|
|||
QCoreApplication tempApp(argc, const_cast<char**>(argv));
|
||||
|
||||
parser.process(QCoreApplication::arguments()); // Must be run after QCoreApplication is initalised.
|
||||
arguments = parser.positionalArguments(); // Must be run after parser processes arguments.
|
||||
|
||||
#ifdef Q_OS_OSX
|
||||
if (QFileInfo::exists(QCoreApplication::applicationDirPath() + "/../../../config.json")) {
|
||||
|
@ -386,12 +412,13 @@ int main(int argc, const char* argv[]) {
|
|||
// this needs to be done here in main, as the mechanism for setting the
|
||||
// scripts directory appears not to work. See the bug report
|
||||
// https://highfidelity.fogbugz.com/f/cases/5759/Issues-changing-scripts-directory-in-ScriptsEngine
|
||||
if (parser.isSet(overrideScriptsPathOption)) {
|
||||
// It is currently also done in "Application.cpp". Not sure if necessary.
|
||||
/*if (parser.isSet(overrideScriptsPathOption)) {
|
||||
QDir scriptsPath(parser.value(overrideScriptsPathOption));
|
||||
if (scriptsPath.exists()) {
|
||||
PathUtils::defaultScriptsLocation(scriptsPath.path());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (instanceMightBeRunning) {
|
||||
// Try to connect and send message to existing interface instance
|
||||
|
@ -469,7 +496,7 @@ int main(int argc, const char* argv[]) {
|
|||
// Oculus initialization MUST PRECEDE OpenGL context creation.
|
||||
// The nature of the Application constructor means this has to be either here,
|
||||
// or in the main window ctor, before GL startup.
|
||||
Application::initPlugins(arguments);
|
||||
Application::initPlugins(&parser);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// If we're running in steam mode, we need to do an explicit check to ensure we're up to the required min spec
|
||||
|
@ -517,7 +544,7 @@ int main(int argc, const char* argv[]) {
|
|||
|
||||
PROFILE_SYNC_END(startup, "main startup", "");
|
||||
PROFILE_SYNC_BEGIN(startup, "app full ctor", "");
|
||||
Application app(argcExtended, const_cast<char**>(argvExtended.data()), startupTime, runningMarkerExisted);
|
||||
Application app(argcExtended, const_cast<char**>(argvExtended.data()), &parser, startupTime, runningMarkerExisted);
|
||||
PROFILE_SYNC_END(startup, "app full ctor", "");
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
|
|
Loading…
Reference in a new issue