Showing the changes to interface/src/Application.cpp (1 of 168 files). Show all
Unified · Split
| @@ -145,6 +145,16 @@ · 144 unmodified lines | ||
| 145 | 145 | #include <avatars-renderer/ScriptAvatar.h> |
| 146 | 146 | #include <RenderableEntityItem.h> |
| 147 | 147 | |
| 148 | +#include <AnimationLogging.h> | |
| 149 | +#include <AvatarLogging.h> | |
| 150 | +#include <ScriptEngineLogging.h> | |
| 151 | +#include <ModelFormatLogging.h> | |
| 152 | +#include <controllers/Logging.h> | |
| 153 | +#include <NetworkLogging.h> | |
| 154 | +#include <shared/StorageLogging.h> | |
| 155 | +#include <ScriptEngineLogging.h> | |
| 156 | +#include <ui/Logging.h> | |
| 157 | + | |
| 148 | 158 | #include "AudioClient.h" |
| 149 | 159 | #include "audio/AudioScope.h" |
| 150 | 160 | #include "avatar/AvatarManager.h" |
| @@ -1307,6 +1317,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1156 unmodified lines | ||
| 1307 | 1317 | // Needs to happen AFTER the render engine initialization to access its configuration |
| 1308 | 1318 | initializeUi(); |
| 1309 | 1319 | |
| 1320 | + updateVerboseLogging(); | |
| 1321 | + | |
| 1310 | 1322 | init(); |
| 1311 | 1323 | qCDebug(interfaceapp, "init() complete."); |
| 1312 | 1324 | |
| @@ -1323,49 +1335,48 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 10 unmodified lines | ||
| 1323 | 1335 | // Make sure we don't time out during slow operations at startup |
| 1324 | 1336 | updateHeartbeat(); |
| 1325 | 1337 | |
| 1326 | − // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value. | |
| 1327 | − // The value will be 0 if the user blew away settings this session, which is both a feature and a bug. | |
| 1328 | − static const QString TESTER = "HIFI_TESTER"; | |
| 1329 | − auto gpuIdent = GPUIdent::getInstance(); | |
| 1330 | − auto glContextData = getGLContextData(); | |
| 1331 | − QJsonObject properties = { | |
| 1332 | − { "version", applicationVersion() }, | |
| 1333 | − { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, | |
| 1334 | − { "previousSessionCrashed", _previousSessionCrashed }, | |
| 1335 | − { "previousSessionRuntime", sessionRunTime.get() }, | |
| 1336 | − { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, | |
| 1337 | − { "kernel_type", QSysInfo::kernelType() }, | |
| 1338 | − { "kernel_version", QSysInfo::kernelVersion() }, | |
| 1339 | − { "os_type", QSysInfo::productType() }, | |
| 1340 | − { "os_version", QSysInfo::productVersion() }, | |
| 1341 | − { "gpu_name", gpuIdent->getName() }, | |
| 1342 | − { "gpu_driver", gpuIdent->getDriver() }, | |
| 1343 | − { "gpu_memory", static_cast<qint64>(gpuIdent->getMemory()) }, | |
| 1344 | − { "gl_version_int", glVersionToInteger(glContextData.value("version").toString()) }, | |
| 1345 | − { "gl_version", glContextData["version"] }, | |
| 1346 | − { "gl_vender", glContextData["vendor"] }, | |
| 1347 | − { "gl_sl_version", glContextData["sl_version"] }, | |
| 1348 | − { "gl_renderer", glContextData["renderer"] }, | |
| 1349 | − { "ideal_thread_count", QThread::idealThreadCount() } | |
| 1350 | − }; | |
| 1351 | − auto macVersion = QSysInfo::macVersion(); | |
| 1352 | − if (macVersion != QSysInfo::MV_None) { | |
| 1353 | − properties["os_osx_version"] = QSysInfo::macVersion(); | |
| 1354 | − } | |
| 1355 | − auto windowsVersion = QSysInfo::windowsVersion(); | |
| 1356 | − if (windowsVersion != QSysInfo::WV_None) { | |
| 1357 | − properties["os_win_version"] = QSysInfo::windowsVersion(); | |
| 1338 | + constexpr auto INSTALLER_INI_NAME = "installer.ini"; | |
| 1339 | + auto iniPath = QDir(applicationDirPath()).filePath(INSTALLER_INI_NAME); | |
| 1340 | + QFile installerFile { iniPath }; | |
| 1341 | + std::unordered_map<QString, QString> installerKeyValues; | |
| 1342 | + if (installerFile.open(QIODevice::ReadOnly)) { | |
| 1343 | + while (!installerFile.atEnd()) { | |
| 1344 | + auto line = installerFile.readLine(); | |
| 1345 | + if (!line.isEmpty()) { | |
| 1346 | + auto index = line.indexOf("="); | |
| 1347 | + if (index >= 0) { | |
| 1348 | + installerKeyValues[line.mid(0, index).trimmed()] = line.mid(index + 1).trimmed(); | |
| 1349 | + } | |
| 1350 | + } | |
| 1351 | + } | |
| 1358 | 1352 | } |
| 1359 | 1353 | |
| 1360 | − ProcessorInfo procInfo; | |
| 1361 | − if (getProcessorInfo(procInfo)) { | |
| 1362 | − properties["processor_core_count"] = procInfo.numProcessorCores; | |
| 1363 | − properties["logical_processor_count"] = procInfo.numLogicalProcessors; | |
| 1364 | − properties["processor_l1_cache_count"] = procInfo.numProcessorCachesL1; | |
| 1365 | − properties["processor_l2_cache_count"] = procInfo.numProcessorCachesL2; | |
| 1366 | − properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3; | |
| 1354 | + // In practice we shouldn't run across installs that don't have a known installer type. | |
| 1355 | + // Client or Client+Server installs should always have the installer.ini next to their | |
| 1356 | + // respective interface.exe, and Steam installs will be detected as such. If a user were | |
| 1357 | + // to delete the installer.ini, though, and as an example, we won't know the context of the | |
| 1358 | + // original install. | |
| 1359 | + constexpr auto INSTALLER_KEY_TYPE = "type"; | |
| 1360 | + constexpr auto INSTALLER_KEY_CAMPAIGN = "campaign"; | |
| 1361 | + constexpr auto INSTALLER_TYPE_UNKNOWN = "unknown"; | |
| 1362 | + constexpr auto INSTALLER_TYPE_STEAM = "steam"; | |
| 1363 | + | |
| 1364 | + auto typeIt = installerKeyValues.find(INSTALLER_KEY_TYPE); | |
| 1365 | + QString installerType = INSTALLER_TYPE_UNKNOWN; | |
| 1366 | + if (typeIt == installerKeyValues.end()) { | |
| 1367 | + if (property(hifi::properties::STEAM).toBool()) { | |
| 1368 | + installerType = INSTALLER_TYPE_STEAM; | |
| 1369 | + } | |
| 1370 | + } else { | |
| 1371 | + installerType = typeIt->second; | |
| 1367 | 1372 | } |
| 1368 | 1373 | |
| 1374 | + auto campaignIt = installerKeyValues.find(INSTALLER_KEY_CAMPAIGN); | |
| 1375 | + QString installerCampaign = campaignIt != installerKeyValues.end() ? campaignIt->second : ""; | |
| 1376 | + | |
| 1377 | + qDebug() << "Detected installer type:" << installerType; | |
| 1378 | + qDebug() << "Detected installer campaign:" << installerCampaign; | |
| 1379 | + | |
| 1369 | 1380 | // add firstRun flag from settings to launch event |
| 1370 | 1381 | Setting::Handle<bool> firstRun { Settings::firstRun, true }; |
| 1371 | 1382 | |
| @@ -1387,6 +1398,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 15 unmodified lines | ||
| 1387 | 1398 | QJsonObject properties = { |
| 1388 | 1399 | { "version", applicationVersion() }, |
| 1389 | 1400 | { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) }, |
| 1401 | + { "installer_campaign", installerCampaign }, | |
| 1402 | + { "installer_type", installerType }, | |
| 1390 | 1403 | { "previousSessionCrashed", _previousSessionCrashed }, |
| 1391 | 1404 | { "previousSessionRuntime", sessionRunTime.get() }, |
| 1392 | 1405 | { "cpu_architecture", QSysInfo::currentCpuArchitecture() }, |
| @@ -1706,7 +1719,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 313 unmodified lines | ||
| 1706 | 1719 | const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater"; |
| 1707 | 1720 | bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1; |
| 1708 | 1721 | if (!noUpdater) { |
| 1722 | + constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only"; | |
| 1723 | + | |
| 1709 | 1724 | auto applicationUpdater = DependencyManager::get<AutoUpdater>(); |
| 1725 | + | |
| 1726 | + AutoUpdater::InstallerType type = installerType == INSTALLER_TYPE_CLIENT_ONLY | |
| 1727 | + ? AutoUpdater::InstallerType::CLIENT_ONLY : AutoUpdater::InstallerType::FULL; | |
| 1728 | + | |
| 1729 | + applicationUpdater->setInstallerType(type); | |
| 1730 | + applicationUpdater->setInstallerCampaign(installerCampaign); | |
| 1710 | 1731 | connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog); |
| 1711 | 1732 | applicationUpdater->checkForUpdate(); |
| 1712 | 1733 | } |
| @@ -2170,6 +2191,46 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 457 unmodified lines | ||
| 2170 | 2191 | #endif |
| 2171 | 2192 | } |
| 2172 | 2193 | |
| 2194 | +void Application::updateVerboseLogging() { | |
| 2195 | + bool enable = Menu::getInstance()->isOptionChecked(MenuOption::VerboseLogging); | |
| 2196 | + | |
| 2197 | + const_cast<QLoggingCategory*>(&animation())->setEnabled(QtDebugMsg, enable); | |
| 2198 | + const_cast<QLoggingCategory*>(&animation())->setEnabled(QtInfoMsg, enable); | |
| 2199 | + | |
| 2200 | + const_cast<QLoggingCategory*>(&avatars())->setEnabled(QtDebugMsg, enable); | |
| 2201 | + const_cast<QLoggingCategory*>(&avatars())->setEnabled(QtInfoMsg, enable); | |
| 2202 | + | |
| 2203 | + const_cast<QLoggingCategory*>(&scriptengine())->setEnabled(QtDebugMsg, enable); | |
| 2204 | + const_cast<QLoggingCategory*>(&scriptengine())->setEnabled(QtInfoMsg, enable); | |
| 2205 | + | |
| 2206 | + const_cast<QLoggingCategory*>(&modelformat())->setEnabled(QtDebugMsg, enable); | |
| 2207 | + const_cast<QLoggingCategory*>(&modelformat())->setEnabled(QtInfoMsg, enable); | |
| 2208 | + | |
| 2209 | + const_cast<QLoggingCategory*>(&controllers())->setEnabled(QtDebugMsg, enable); | |
| 2210 | + const_cast<QLoggingCategory*>(&controllers())->setEnabled(QtInfoMsg, enable); | |
| 2211 | + | |
| 2212 | + const_cast<QLoggingCategory*>(&resourceLog())->setEnabled(QtDebugMsg, enable); | |
| 2213 | + const_cast<QLoggingCategory*>(&resourceLog())->setEnabled(QtInfoMsg, enable); | |
| 2214 | + | |
| 2215 | + const_cast<QLoggingCategory*>(&networking())->setEnabled(QtDebugMsg, enable); | |
| 2216 | + const_cast<QLoggingCategory*>(&networking())->setEnabled(QtInfoMsg, enable); | |
| 2217 | + | |
| 2218 | + const_cast<QLoggingCategory*>(&asset_client())->setEnabled(QtDebugMsg, enable); | |
| 2219 | + const_cast<QLoggingCategory*>(&asset_client())->setEnabled(QtInfoMsg, enable); | |
| 2220 | + | |
| 2221 | + const_cast<QLoggingCategory*>(&messages_client())->setEnabled(QtDebugMsg, enable); | |
| 2222 | + const_cast<QLoggingCategory*>(&messages_client())->setEnabled(QtInfoMsg, enable); | |
| 2223 | + | |
| 2224 | + const_cast<QLoggingCategory*>(&storagelogging())->setEnabled(QtDebugMsg, enable); | |
| 2225 | + const_cast<QLoggingCategory*>(&storagelogging())->setEnabled(QtInfoMsg, enable); | |
| 2226 | + | |
| 2227 | + const_cast<QLoggingCategory*>(&uiLogging())->setEnabled(QtDebugMsg, enable); | |
| 2228 | + const_cast<QLoggingCategory*>(&uiLogging())->setEnabled(QtInfoMsg, enable); | |
| 2229 | + | |
| 2230 | + const_cast<QLoggingCategory*>(&glLogging())->setEnabled(QtDebugMsg, enable); | |
| 2231 | + const_cast<QLoggingCategory*>(&glLogging())->setEnabled(QtInfoMsg, enable); | |
| 2232 | +} | |
| 2233 | + | |
| 2173 | 2234 | void Application::domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) { |
| 2174 | 2235 | DomainHandler::ConnectionRefusedReason reasonCode = static_cast<DomainHandler::ConnectionRefusedReason>(reasonCodeInt); |
| 2175 | 2236 | |
| @@ -3041,7 +3102,6 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { · 865 unmodified lines | ||
| 3041 | 3102 | PROFILE_RANGE(render, __FUNCTION__); |
| 3042 | 3103 | |
| 3043 | 3104 | bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll()); |
| 3044 | − qDebug() << "HandleSandboxStatus" << sandboxIsRunning; | |
| 3045 | 3105 | |
| 3046 | 3106 | enum HandControllerType { |
| 3047 | 3107 | Vive, |
| @@ -4758,7 +4818,7 @@ void Application::updateLOD(float deltaTime) const { · 1710 unmodified lines | ||
| 4758 | 4818 | } |
| 4759 | 4819 | } |
| 4760 | 4820 | |
| 4761 | −void Application::pushPostUpdateLambda(void* key, std::function<void()> func) { | |
| 4821 | +void Application::pushPostUpdateLambda(void* key, const std::function<void()>& func) { | |
| 4762 | 4822 | std::unique_lock<std::mutex> guard(_postUpdateLambdasLock); |
| 4763 | 4823 | _postUpdateLambdas[key] = func; |
| 4764 | 4824 | } |
| @@ -7368,7 +7428,7 @@ void Application::windowMinimizedChanged(bool minimized) { · 2603 unmodified lines | ||
| 7368 | 7428 | } |
| 7369 | 7429 | } |
| 7370 | 7430 | |
| 7371 | −void Application::postLambdaEvent(std::function<void()> f) { | |
| 7431 | +void Application::postLambdaEvent(const std::function<void()>& f) { | |
| 7372 | 7432 | if (this->thread() == QThread::currentThread()) { |
| 7373 | 7433 | f(); |
| 7374 | 7434 | } else { |
| @@ -7376,6 +7436,15 @@ void Application::postLambdaEvent(std::function<void()> f) { · 1 unmodified line | ||
| 7376 | 7436 | } |
| 7377 | 7437 | } |
| 7378 | 7438 | |
| 7439 | +void Application::sendLambdaEvent(const std::function<void()>& f) { | |
| 7440 | + if (this->thread() == QThread::currentThread()) { | |
| 7441 | + f(); | |
| 7442 | + } else { | |
| 7443 | + LambdaEvent event(f); | |
| 7444 | + QCoreApplication::sendEvent(this, &event); | |
| 7445 | + } | |
| 7446 | +} | |
| 7447 | + | |
| 7379 | 7448 | void Application::initPlugins(const QStringList& arguments) { |
| 7380 | 7449 | QCommandLineOption display("display", "Preferred displays", "displays"); |
| 7381 | 7450 | QCommandLineOption disableDisplays("disable-displays", "Displays to disable", "displays"); |