History

Merge branch 'master' of https://github.com/highfidelity/hifi into orange

samcake committed 9 years ago

Commit 96a10d22 parents 07e18eb e5602aa66 files · +3223 −627Browse files

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

Unified · Split

interface/src/Application.cpp+34−8
@@ -109,6 +109,7 @@ · 108 unmodified lines
109109 #include <plugins/PluginManager.h>
110110 #include <plugins/PluginUtils.h>
111111 #include <plugins/SteamClientPlugin.h>
112+#include <plugins/InputConfiguration.h>
112113 #include <RecordingScriptingInterface.h>
113114 #include <RenderableWebEntityItem.h>
114115 #include <UpdateSceneTask.h>
@@ -211,7 +212,7 @@ static QTimer pingTimer; · 96 unmodified lines
211212
212213 static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
213214
214−// For processing on QThreadPool, we target a number of threads after reserving some
215+// For processing on QThreadPool, we target a number of threads after reserving some
215216 // based on how many are being consumed by the application and the display plugin. However,
216217 // we will never drop below the 'min' value
217218 static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
@@ -536,6 +537,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 318 unmodified lines
536537 DependencyManager::set<HMDScriptingInterface>();
537538 DependencyManager::set<ResourceScriptingInterface>();
538539 DependencyManager::set<TabletScriptingInterface>();
540+ DependencyManager::set<InputConfiguration>();
539541 DependencyManager::set<ToolbarScriptingInterface>();
540542 DependencyManager::set<UserActivityLoggerScriptingInterface>();
541543 DependencyManager::set<AssetMappingsScriptingInterface>();
@@ -884,6 +886,20 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 342 unmodified lines
884886 }
885887 ResourceCache::setRequestLimit(concurrentDownloads);
886888
889+ // perhaps override the avatar url. Since we will test later for validity
890+ // we don't need to do so here.
891+ QString avatarURL = getCmdOption(argc, constArgv, "--avatarURL");
892+ _avatarOverrideUrl = QUrl::fromUserInput(avatarURL);
893+
894+ // If someone specifies both --avatarURL and --replaceAvatarURL,
895+ // the replaceAvatarURL wins. So only set the _overrideUrl if this
896+ // does have a non-empty string.
897+ QString replaceURL = getCmdOption(argc, constArgv, "--replaceAvatarURL");
898+ if (!replaceURL.isEmpty()) {
899+ _avatarOverrideUrl = QUrl::fromUserInput(replaceURL);
900+ _saveAvatarOverrideUrl = true;
901+ }
902+
887903 _glWidget = new GLCanvas();
888904 getApplicationCompositor().setRenderingWidget(_glWidget);
889905 _window->setCentralWidget(_glWidget);
@@ -1273,7 +1289,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 383 unmodified lines
12731289 // Add periodic checks to send user activity data
12741290 static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000;
12751291 static int NEARBY_AVATAR_RADIUS_METERS = 10;
1276−
1292+
12771293 // setup the stats interval depending on if the 1s faster hearbeat was requested
12781294 static const QString FAST_STATS_ARG = "--fast-heartbeat";
12791295 static int SEND_STATS_INTERVAL_MS = arguments().indexOf(FAST_STATS_ARG) != -1 ? 1000 : 10000;
@@ -1423,10 +1439,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 143 unmodified lines
14231439
14241440 _autoSwitchDisplayModeSupportedHMDPlugin = nullptr;
14251441 foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
1426− if (displayPlugin->isHmd() &&
1442+ if (displayPlugin->isHmd() &&
14271443 displayPlugin->getSupportsAutoSwitch()) {
14281444 _autoSwitchDisplayModeSupportedHMDPlugin = displayPlugin;
1429− _autoSwitchDisplayModeSupportedHMDPluginName =
1445+ _autoSwitchDisplayModeSupportedHMDPluginName =
14301446 _autoSwitchDisplayModeSupportedHMDPlugin->getName();
14311447 _previousHMDWornStatus =
14321448 _autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible();
@@ -1678,7 +1694,7 @@ void Application::onAboutToQuit() { · 245 unmodified lines
16781694 }
16791695
16801696 getActiveDisplayPlugin()->deactivate();
1681− if (_autoSwitchDisplayModeSupportedHMDPlugin
1697+ if (_autoSwitchDisplayModeSupportedHMDPlugin
16821698 && _autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
16831699 _autoSwitchDisplayModeSupportedHMDPlugin->endSession();
16841700 }
@@ -1747,8 +1763,8 @@ void Application::cleanupBeforeQuit() { · 62 unmodified lines
17471763
17481764 // Cleanup all overlays after the scripts, as scripts might add more
17491765 _overlays.cleanupAllOverlays();
1750− // The cleanup process enqueues the transactions but does not process them. Calling this here will force the actual
1751− // removal of the items.
1766+ // The cleanup process enqueues the transactions but does not process them. Calling this here will force the actual
1767+ // removal of the items.
17521768 // See https://highfidelity.fogbugz.com/f/cases/5328
17531769 _main3DScene->processTransactionQueue();
17541770
@@ -2023,6 +2039,7 @@ void Application::initializeUi() { · 268 unmodified lines
20232039 surfaceContext->setContextProperty("TextureCache", DependencyManager::get<TextureCache>().data());
20242040 surfaceContext->setContextProperty("ModelCache", DependencyManager::get<ModelCache>().data());
20252041 surfaceContext->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
2042+ surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
20262043
20272044 surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
20282045 surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
@@ -5240,7 +5257,7 @@ void Application::clearDomainOctreeDetails() { · 3211 unmodified lines
52405257 skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);
52415258
52425259 _recentlyClearedDomain = true;
5243−
5260+
52445261 DependencyManager::get<AnimationCache>()->clearUnusedResources();
52455262 DependencyManager::get<ModelCache>()->clearUnusedResources();
52465263 DependencyManager::get<SoundCache>()->clearUnusedResources();
@@ -5304,6 +5321,10 @@ void Application::nodeActivated(SharedNodePointer node) { · 57 unmodified lines
53045321 if (node->getType() == NodeType::AvatarMixer) {
53055322 // new avatar mixer, send off our identity packet on next update loop
53065323 // Reset skeletonModelUrl if the last server modified our choice.
5324+ // Override the avatar url (but not model name) here too.
5325+ if (_avatarOverrideUrl.isValid()) {
5326+ getMyAvatar()->useFullAvatarURL(_avatarOverrideUrl);
5327+ }
53075328 static const QUrl empty{};
53085329 if (getMyAvatar()->getFullAvatarURLFromPreferences() != getMyAvatar()->cannonicalSkeletonModelURL(empty)) {
53095330 getMyAvatar()->resetFullAvatarURL();
@@ -7058,3 +7079,8 @@ QUuid Application::getTabletFrameID() const { · 1748 unmodified lines
70587079 auto HMD = DependencyManager::get<HMDScriptingInterface>();
70597080 return HMD->getCurrentTabletFrameID();
70607081 }
7082+
7083+void Application::setAvatarOverrideUrl(const QUrl& url, bool save) {
7084+ _avatarOverrideUrl = url;
7085+ _saveAvatarOverrideUrl = save;
7086+}