History

Merge remote-tracking branch 'hifi/master' into android_places_goto

Cristian Luis Duarte committed 8 years ago

Commit 401bf2f2 parents e47173a 1e25d48168 files · +5803 −1664Browse files

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

Unified · Split

interface/src/Application.cpp+111−42
@@ -145,6 +145,16 @@ · 144 unmodified lines
145#include <avatars-renderer/ScriptAvatar.h>145#include <avatars-renderer/ScriptAvatar.h>
146#include <RenderableEntityItem.h>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#include "AudioClient.h"158#include "AudioClient.h"
149#include "audio/AudioScope.h"159#include "audio/AudioScope.h"
150#include "avatar/AvatarManager.h"160#include "avatar/AvatarManager.h"
@@ -1307,6 +1317,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1156 unmodified lines
1307 // Needs to happen AFTER the render engine initialization to access its configuration1317 // Needs to happen AFTER the render engine initialization to access its configuration
1308 initializeUi();1318 initializeUi();
1309 1319
1320 updateVerboseLogging();
1321
1310 init();1322 init();
1311 qCDebug(interfaceapp, "init() complete.");1323 qCDebug(interfaceapp, "init() complete.");
1312 1324
@@ -1323,49 +1335,48 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 10 unmodified lines
1323 // Make sure we don't time out during slow operations at startup1335 // Make sure we don't time out during slow operations at startup
1324 updateHeartbeat();1336 updateHeartbeat();
1325 1337
1326 // sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.1338 constexpr auto INSTALLER_INI_NAME = "installer.ini";
1327 // The value will be 0 if the user blew away settings this session, which is both a feature and a bug.1339 auto iniPath = QDir(applicationDirPath()).filePath(INSTALLER_INI_NAME);
1328 static const QString TESTER = "HIFI_TESTER";1340 QFile installerFile { iniPath };
1329 auto gpuIdent = GPUIdent::getInstance();1341 std::unordered_map<QString, QString> installerKeyValues;
1330 auto glContextData = getGLContextData();1342 if (installerFile.open(QIODevice::ReadOnly)) {
1331 QJsonObject properties = {1343 while (!installerFile.atEnd()) {
1332 { "version", applicationVersion() },1344 auto line = installerFile.readLine();
1333 { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) },1345 if (!line.isEmpty()) {
1334 { "previousSessionCrashed", _previousSessionCrashed },1346 auto index = line.indexOf("=");
1335 { "previousSessionRuntime", sessionRunTime.get() },1347 if (index >= 0) {
1336 { "cpu_architecture", QSysInfo::currentCpuArchitecture() },1348 installerKeyValues[line.mid(0, index).trimmed()] = line.mid(index + 1).trimmed();
1337 { "kernel_type", QSysInfo::kernelType() },1349 }
1338 { "kernel_version", QSysInfo::kernelVersion() },1350 }
1339 { "os_type", QSysInfo::productType() },1351 }
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();
1358 }1352 }
1359 1353
1360 ProcessorInfo procInfo;1354 // In practice we shouldn't run across installs that don't have a known installer type.
1361 if (getProcessorInfo(procInfo)) {1355 // Client or Client+Server installs should always have the installer.ini next to their
1362 properties["processor_core_count"] = procInfo.numProcessorCores;1356 // respective interface.exe, and Steam installs will be detected as such. If a user were
1363 properties["logical_processor_count"] = procInfo.numLogicalProcessors;1357 // to delete the installer.ini, though, and as an example, we won't know the context of the
1364 properties["processor_l1_cache_count"] = procInfo.numProcessorCachesL1;1358 // original install.
1365 properties["processor_l2_cache_count"] = procInfo.numProcessorCachesL2;1359 constexpr auto INSTALLER_KEY_TYPE = "type";
1366 properties["processor_l3_cache_count"] = procInfo.numProcessorCachesL3;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 // add firstRun flag from settings to launch event1380 // add firstRun flag from settings to launch event
1370 Setting::Handle<bool> firstRun { Settings::firstRun, true };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 QJsonObject properties = {1398 QJsonObject properties = {
1388 { "version", applicationVersion() },1399 { "version", applicationVersion() },
1389 { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) },1400 { "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) },
1401 { "installer_campaign", installerCampaign },
1402 { "installer_type", installerType },
1390 { "previousSessionCrashed", _previousSessionCrashed },1403 { "previousSessionCrashed", _previousSessionCrashed },
1391 { "previousSessionRuntime", sessionRunTime.get() },1404 { "previousSessionRuntime", sessionRunTime.get() },
1392 { "cpu_architecture", QSysInfo::currentCpuArchitecture() },1405 { "cpu_architecture", QSysInfo::currentCpuArchitecture() },
@@ -1706,7 +1719,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 313 unmodified lines
1706 const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater";1719 const QString HIFI_NO_UPDATER_COMMAND_LINE_KEY = "--no-updater";
1707 bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1;1720 bool noUpdater = arguments().indexOf(HIFI_NO_UPDATER_COMMAND_LINE_KEY) != -1;
1708 if (!noUpdater) {1721 if (!noUpdater) {
1722 constexpr auto INSTALLER_TYPE_CLIENT_ONLY = "client_only";
1723
1709 auto applicationUpdater = DependencyManager::get<AutoUpdater>();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 connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);1731 connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
1711 applicationUpdater->checkForUpdate();1732 applicationUpdater->checkForUpdate();
1712 }1733 }
@@ -2170,6 +2191,46 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 457 unmodified lines
2170#endif2191#endif
2171}2192}
2172 2193
2194void 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
2173void Application::domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) {2234void Application::domainConnectionRefused(const QString& reasonMessage, int reasonCodeInt, const QString& extraInfo) {
2174 DomainHandler::ConnectionRefusedReason reasonCode = static_cast<DomainHandler::ConnectionRefusedReason>(reasonCodeInt);2235 DomainHandler::ConnectionRefusedReason reasonCode = static_cast<DomainHandler::ConnectionRefusedReason>(reasonCodeInt);
2175 2236
@@ -3041,7 +3102,6 @@ void Application::handleSandboxStatus(QNetworkReply* reply) { · 865 unmodified lines
3041 PROFILE_RANGE(render, __FUNCTION__);3102 PROFILE_RANGE(render, __FUNCTION__);
3042 3103
3043 bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll());3104 bool sandboxIsRunning = SandboxUtils::readStatus(reply->readAll());
3044 qDebug() << "HandleSandboxStatus" << sandboxIsRunning;
3045 3105
3046 enum HandControllerType {3106 enum HandControllerType {
3047 Vive,3107 Vive,
@@ -4758,7 +4818,7 @@ void Application::updateLOD(float deltaTime) const { · 1710 unmodified lines
4758 }4818 }
4759}4819}
4760 4820
4761void Application::pushPostUpdateLambda(void* key, std::function<void()> func) {4821void Application::pushPostUpdateLambda(void* key, const std::function<void()>& func) {
4762 std::unique_lock<std::mutex> guard(_postUpdateLambdasLock);4822 std::unique_lock<std::mutex> guard(_postUpdateLambdasLock);
4763 _postUpdateLambdas[key] = func;4823 _postUpdateLambdas[key] = func;
4764}4824}
@@ -7368,7 +7428,7 @@ void Application::windowMinimizedChanged(bool minimized) { · 2603 unmodified lines
7368 }7428 }
7369}7429}
7370 7430
7371void Application::postLambdaEvent(std::function<void()> f) {7431void Application::postLambdaEvent(const std::function<void()>& f) {
7372 if (this->thread() == QThread::currentThread()) {7432 if (this->thread() == QThread::currentThread()) {
7373 f();7433 f();
7374 } else {7434 } else {
@@ -7376,6 +7436,15 @@ void Application::postLambdaEvent(std::function<void()> f) { · 1 unmodified line
7376 }7436 }
7377}7437}
7378 7438
7439void 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
7379void Application::initPlugins(const QStringList& arguments) {7448void Application::initPlugins(const QStringList& arguments) {
7380 QCommandLineOption display("display", "Preferred displays", "displays");7449 QCommandLineOption display("display", "Preferred displays", "displays");
7381 QCommandLineOption disableDisplays("disable-displays", "Displays to disable", "displays");7450 QCommandLineOption disableDisplays("disable-displays", "Displays to disable", "displays");