Showing the changes to interface/src/Application.cpp (1 of 219 files). Show all
Unified · Split
| @@ -688,6 +688,34 @@ private: · 687 unmodified lines | |||
| 688 | } | 688 | } |
| 689 | }; | 689 | }; |
| 690 | 690 | ||
| 691 | /**jsdoc | ||
| 692 | * <p>The <code>Controller.Hardware.Application</code> object has properties representing Interface's state. The property | ||
| 693 | * values are integer IDs, uniquely identifying each output. <em>Read-only.</em> These can be mapped to actions or functions or | ||
| 694 | * <code>Controller.Standard</code> items in a {@link RouteObject} mapping (e.g., using the {@link RouteObject#when} method). | ||
| 695 | * Each data value is either <code>1.0</code> for "true" or <code>0.0</code> for "false".</p> | ||
| 696 | * <table> | ||
| 697 | * <thead> | ||
| 698 | * <tr><th>Property</th><th>Type</th><th>Data</th><th>Description</th></tr> | ||
| 699 | * </thead> | ||
| 700 | * <tbody> | ||
| 701 | * <tr><td><code>CameraFirstPerson</code></td><td>number</td><td>number</td><td>The camera is in first-person mode. | ||
| 702 | * </td></tr> | ||
| 703 | * <tr><td><code>CameraThirdPerson</code></td><td>number</td><td>number</td><td>The camera is in third-person mode. | ||
| 704 | * </td></tr> | ||
| 705 | * <tr><td><code>CameraFSM</code></td><td>number</td><td>number</td><td>The camera is in full screen mirror mode.</td></tr> | ||
| 706 | * <tr><td><code>CameraIndependent</code></td><td>number</td><td>number</td><td>The camera is in independent mode.</td></tr> | ||
| 707 | * <tr><td><code>CameraEntity</code></td><td>number</td><td>number</td><td>The camera is in entity mode.</td></tr> | ||
| 708 | * <tr><td><code>InHMD</code></td><td>number</td><td>number</td><td>The user is in HMD mode.</td></tr> | ||
| 709 | * <tr><td><code>AdvancedMovement</code></td><td>number</td><td>number</td><td>Advanced movement controls are enabled. | ||
| 710 | * </td></tr> | ||
| 711 | * <tr><td><code>SnapTurn</code></td><td>number</td><td>number</td><td>Snap turn is enabled.</td></tr> | ||
| 712 | * <tr><td><code>Grounded</code></td><td>number</td><td>number</td><td>The user's avatar is on the ground.</td></tr> | ||
| 713 | * <tr><td><code>NavigationFocused</code></td><td>number</td><td>number</td><td><em>Not used.</em></td></tr> | ||
| 714 | * </tbody> | ||
| 715 | * </table> | ||
| 716 | * @typedef Controller.Hardware-Application | ||
| 717 | */ | ||
| 718 | |||
| 691 | static const QString STATE_IN_HMD = "InHMD"; | 719 | static const QString STATE_IN_HMD = "InHMD"; |
| 692 | static const QString STATE_CAMERA_FULL_SCREEN_MIRROR = "CameraFSM"; | 720 | static const QString STATE_CAMERA_FULL_SCREEN_MIRROR = "CameraFSM"; |
| 693 | static const QString STATE_CAMERA_FIRST_PERSON = "CameraFirstPerson"; | 721 | static const QString STATE_CAMERA_FIRST_PERSON = "CameraFirstPerson"; |
| @@ -1294,49 +1322,48 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 600 unmodified lines | |||
| 1294 | // Make sure we don't time out during slow operations at startup | 1322 | // Make sure we don't time out during slow operations at startup |
| 1295 | updateHeartbeat(); | 1323 | updateHeartbeat(); |
| 1296 | 1324 | ||
| 1297 | // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. | 1325 | constexpr auto INSTALLER_INI_NAME = "installer.ini"; |
| 1298 | // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. | 1326 | auto iniPath = QDir(applicationDirPath()).filePath(INSTALLER_INI_NAME); |
| 1299 | static const QString TESTER = "HIFI_TESTER"; | 1327 | QFile installerFile { iniPath }; |
| 1300 | auto gpuIdent = GPUIdent::getInstance(); | 1328 | std::unordered_map<QString, QString> installerKeyValues; |
| 1301 | auto glContextData = getGLContextData(); | 1329 | if (installerFile.open(QIODevice::ReadOnly)) { |
| 1302 | QJsonObject properties = { | 1330 | while (!installerFile.atEnd()) { |
| 1303 | { "version", applicationVersion() }, | 1331 | auto line = installerFile.readLine(); |
| 1304 | { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, | 1332 | if (!line.isEmpty()) { |
| 1305 | { "previousSessionCrashed", _previousSessionCrashed }, | 1333 | auto index = line.indexOf("="); |
| 1306 | { "previousSessionRuntime", sessionRunTime.get() }, | 1334 | if (index >= 0) { |
| 1307 | { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, | 1335 | installerKeyValues[line.mid(0, index).trimmed()] = line.mid(index + 1).trimmed(); |
| 1308 | { "kernel_type", QSysInfo::kernelType() }, | 1336 | } |
| 1309 | { "kernel_version", QSysInfo::kernelVersion() }, | 1337 | } |
| 1310 | { "os_type", QSysInfo::productType() }, | 1338 | } |
| 1311 | { "os_version", QSysInfo::productVersion() }, | ||
| 1312 | { "gpu_name", gpuIdent->getName() }, | ||
| 1313 | { "gpu_driver", gpuIdent->getDriver() }, | ||
| 1314 | { "gpu_memory", static_cast<qint64>(gpuIdent->getMemory()) }, | ||
| 1315 | { "gl_version_int", glVersionToInteger(glContextData.value("version").toString()) }, | ||
| 1316 | { "gl_version", glContextData["version"] }, | ||
| 1317 | { "gl_vender", glContextData["vendor"] }, | ||
| 1318 | { "gl_sl_version", glContextData["sl_version"] }, | ||
| 1319 | { "gl_renderer", glContextData["renderer"] }, | ||
| 1320 | { "ideal_thread_count", QThread::idealThreadCount() } | ||
| 1321 | }; | ||
| 1322 | auto macVersion = QSysInfo::macVersion(); | ||
| 1323 | if (macVersion != QSysInfo::MV_None) { | ||
| 1324 | properties["os_osx_version"] = QSysInfo::macVersion(); | ||
| 1325 | } | ||
| 1326 | auto windowsVersion = QSysInfo::windowsVersion(); | ||
| 1327 | if (windowsVersion != QSysInfo::WV_None) { | ||
| 1328 | properties["os_win_version"] = QSysInfo::windowsVersion(); | ||
| 1329 | } | 1339 | } |
| 1330 | 1340 | ||
| 1331 | ProcessorInfo procInfo; | 1341 | // In practice we shouldn't run across installs that don't have a known installer type. |
| 1332 | if (getProcessorInfo(procInfo)) { | 1342 | // Client or Client+Server installs should always have the installer.ini next to their |
| 1333 | properties["processor_core_count"] = procInfo.numProcessorCores; | 1343 | // respective interface.exe, and Steam installs will be detected as such. If a user were |
| 1334 | properties["logical_processor_count"] = procInfo.numLogicalProcessors; | 1344 | // to delete the installer.ini, though, and as an example, we won't know the context of the |
| 1335 | properties["processor_l1_cache_count"] = procInfo.numProcessorCachesL1; | 1345 | // original install. |
| 1336 | properties["processor_l2_cache_count"] = procInfo.numProcessorCachesL2; | 1346 | constexpr auto INSTALLER_KEY_TYPE = "type"; |
| 1337 | properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3; | 1347 | constexpr auto INSTALLER_KEY_CAMPAIGN = "campaign"; |
| 1348 | constexpr auto INSTALLER_TYPE_UNKNOWN = "unknown"; | ||
| 1349 | constexpr auto INSTALLER_TYPE_STEAM = "steam"; | ||
| 1350 | |||
| 1351 | auto typeIt = installerKeyValues.find(INSTALLER_KEY_TYPE); | ||
| 1352 | QString installerType = INSTALLER_TYPE_UNKNOWN; | ||
| 1353 | if (typeIt == installerKeyValues.end()) { | ||
| 1354 | if (property(hifi::properties::STEAM).toBool()) { | ||
| 1355 | installerType = INSTALLER_TYPE_STEAM; | ||
| 1356 | } | ||
| 1357 | } else { | ||
| 1358 | installerType = typeIt->second; | ||
| 1338 | } | 1359 | } |
| 1339 | 1360 | ||
| 1361 | auto campaignIt = installerKeyValues.find(INSTALLER_KEY_CAMPAIGN); | ||
| 1362 | QString installerCampaign = campaignIt != installerKeyValues.end() ? campaignIt->second : ""; | ||
| 1363 | |||
| 1364 | qDebug() << "Detected installer type:" << installerType; | ||
| 1365 | qDebug() << "Detected installer campaign:" << installerCampaign; | ||
| 1366 | |||
| 1340 | // add firstRun flag from settings to launch event | 1367 | // add firstRun flag from settings to launch event |
| 1341 | Setting::Handle<bool> firstRun { Settings::firstRun, true }; | 1368 | Setting::Handle<bool> firstRun { Settings::firstRun, true }; |
| 1342 | 1369 | ||
| @@ -1358,6 +1385,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 15 unmodified lines | |||
| 1358 | QJsonObject properties = { | 1385 | QJsonObject properties = { |
| 1359 | { "version", applicationVersion() }, | 1386 | { "version", applicationVersion() }, |
| 1360 | { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, | 1387 | { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, |
| 1388 | { "installer_campaign", installerCampaign }, | ||
| 1389 | { "installer_type", installerType }, | ||
| 1361 | { "previousSessionCrashed", _previousSessionCrashed }, | 1390 | { "previousSessionCrashed", _previousSessionCrashed }, |
| 1362 | { "previousSessionRuntime", sessionRunTime.get() }, | 1391 | { "previousSessionRuntime", sessionRunTime.get() }, |
| 1363 | { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, | 1392 | { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, |
| @@ -1677,7 +1706,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 313 unmodified lines | |||
| 1677 | const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater"; | 1706 | const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater"; |
| 1678 | bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1; | 1707 | bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1; |
| 1679 | if (!noUpdater) { | 1708 | if (!noUpdater) { |
| 1709 | constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only"; | ||
| 1710 | |||
| 1680 | auto applicationUpdater = DependencyManager::get<AutoUpdater>(); | 1711 | auto applicationUpdater = DependencyManager::get<AutoUpdater>(); |
| 1712 | |||
| 1713 | AutoUpdater::InstallerType type = installerType == INSTALLER_TYPE_CLIENT_ONLY | ||
| 1714 | ? AutoUpdater::InstallerType::CLIENT_ONLY : AutoUpdater::InstallerType::FULL; | ||
| 1715 | |||
| 1716 | applicationUpdater->setInstallerType(type); | ||
| 1717 | applicationUpdater->setInstallerCampaign(installerCampaign); | ||
| 1681 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); | 1718 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); |
| 1682 | applicationUpdater->checkForUpdate(); | 1719 | applicationUpdater->checkForUpdate(); |
| 1683 | } | 1720 | } |
| @@ -2654,6 +2691,12 @@ void Application::initializeUi() { · 970 unmodified lines | |||
| 2654 | // Now that the menu is instantiated, ensure the display plugin menu is properly updated | 2691 | // Now that the menu is instantiated, ensure the display plugin menu is properly updated |
| 2655 | updateDisplayMode(); | 2692 | updateDisplayMode(); |
| 2656 | flushMenuUpdates(); | 2693 | flushMenuUpdates(); |
| 2694 | |||
| 2695 | // The display plugins are created before the menu now, so we need to do this here to hide the menu bar | ||
| 2696 | // now that it exists | ||
| 2697 | if (_window && _window->isFullScreen()) { | ||
| 2698 | setFullscreen(nullptr, true); | ||
| 2699 | } | ||
| 2657 | } | 2700 | } |
| 2658 | 2701 | ||
| 2659 | 2702 | ||
| @@ -4707,7 +4750,7 @@ void Application::updateLOD(float deltaTime) const { · 2047 unmodified lines | |||
| 4707 | } | 4750 | } |
| 4708 | } | 4751 | } |
| 4709 | 4752 | ||
| 4710 | void Application::pushPostUpdateLambda(void* key, std::function<void()> func) { | 4753 | void Application::pushPostUpdateLambda(void* key, const std::function<void()>& func) { |
| 4711 | std::unique_lock<std::mutex> guard(_postUpdateLambdasLock); | 4754 | std::unique_lock<std::mutex> guard(_postUpdateLambdasLock); |
| 4712 | _postUpdateLambdas[key] = func; | 4755 | _postUpdateLambdas[key] = func; |
| 4713 | } | 4756 | } |
| @@ -7308,7 +7351,7 @@ void Application::windowMinimizedChanged(bool minimized) { · 2594 unmodified lines | |||
| 7308 | } | 7351 | } |
| 7309 | } | 7352 | } |
| 7310 | 7353 | ||
| 7311 | void Application::postLambdaEvent(std::function<void()> f) { | 7354 | void Application::postLambdaEvent(const std::function<void()>& f) { |
| 7312 | if (this->thread() == QThread::currentThread()) { | 7355 | if (this->thread() == QThread::currentThread()) { |
| 7313 | f(); | 7356 | f(); |
| 7314 | } else { | 7357 | } else { |
| @@ -7316,6 +7359,15 @@ void Application::postLambdaEvent(std::function<void()> f) { · 1 unmodified line | |||
| 7316 | } | 7359 | } |
| 7317 | } | 7360 | } |
| 7318 | 7361 | ||
| 7362 | void Application::sendLambdaEvent(const std::function<void()>& f) { | ||
| 7363 | if (this->thread() == QThread::currentThread()) { | ||
| 7364 | f(); | ||
| 7365 | } else { | ||
| 7366 | LambdaEvent event(f); | ||
| 7367 | QCoreApplication::sendEvent(this, &event); | ||
| 7368 | } | ||
| 7369 | } | ||
| 7370 | |||
| 7319 | void Application::initPlugins(const QStringList& arguments) { | 7371 | void Application::initPlugins(const QStringList& arguments) { |
| 7320 | QCommandLineOption display("display", "Preferred displays", "displays"); | 7372 | QCommandLineOption display("display", "Preferred displays", "displays"); |
| 7321 | QCommandLineOption disableDisplays("disable-displays", "Displays to disable", "displays"); | 7373 | QCommandLineOption disableDisplays("disable-displays", "Displays to disable", "displays"); |