History

Merge pull request #9318 from birarda/ovr-platform-entitlement

handle OVR Platform entitlement checks

Stephen Birarda committed 9 years ago

Commit 1993e352 parents d2c7342 8f279ce7 files · +171 −35Browse files

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

Unified · Split

interface/src/Application.cpp+22−19
@@ -252,7 +252,7 @@ public: · 251 unmodified lines
252 static const unsigned long MAX_HEARTBEAT_AGE_USECS = 30 * USECS_PER_SECOND;252 static const unsigned long MAX_HEARTBEAT_AGE_USECS = 30 * USECS_PER_SECOND;
253 static const int WARNING_ELAPSED_HEARTBEAT = 500 * USECS_PER_MSEC; // warn if elapsed heartbeat average is large253 static const int WARNING_ELAPSED_HEARTBEAT = 500 * USECS_PER_MSEC; // warn if elapsed heartbeat average is large
254 static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples254 static const int HEARTBEAT_SAMPLES = 100000; // ~5 seconds worth of samples
255 255
256 // Set the heartbeat on launch256 // Set the heartbeat on launch
257 DeadlockWatchdogThread() {257 DeadlockWatchdogThread() {
258 setObjectName("Deadlock Watchdog");258 setObjectName("Deadlock Watchdog");
@@ -616,7 +616,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 357 unmodified lines
616 _window->setWindowTitle("Interface");616 _window->setWindowTitle("Interface");
617 617
618 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us618 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
619 619
620 auto nodeList = DependencyManager::get<NodeList>();620 auto nodeList = DependencyManager::get<NodeList>();
621 621
622 // Set up a watchdog thread to intentionally crash the application on deadlocks622 // Set up a watchdog thread to intentionally crash the application on deadlocks
@@ -637,6 +637,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 14 unmodified lines
637 qCDebug(interfaceapp) << "[VERSION] We will use DEVELOPMENT global services.";637 qCDebug(interfaceapp) << "[VERSION] We will use DEVELOPMENT global services.";
638#endif638#endif
639 639
640 // set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store
641 static const QString OCULUS_STORE_ARG = "--oculus-store";
642 setProperty(hifi::properties::OCULUS_STORE, arguments().indexOf(OCULUS_STORE_ARG) != -1);
640 643
641 static const QString NO_UPDATER_ARG = "--no-updater";644 static const QString NO_UPDATER_ARG = "--no-updater";
642 static const bool noUpdater = arguments().indexOf(NO_UPDATER_ARG) != -1;645 static const bool noUpdater = arguments().indexOf(NO_UPDATER_ARG) != -1;
@@ -697,7 +700,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 54 unmodified lines
697 audioIO->setPositionGetter([]{700 audioIO->setPositionGetter([]{
698 auto avatarManager = DependencyManager::get<AvatarManager>();701 auto avatarManager = DependencyManager::get<AvatarManager>();
699 auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;702 auto myAvatar = avatarManager ? avatarManager->getMyAvatar() : nullptr;
700 703
701 return myAvatar ? myAvatar->getPositionForAudio() : Vectors::ZERO;704 return myAvatar ? myAvatar->getPositionForAudio() : Vectors::ZERO;
702 });705 });
703 audioIO->setOrientationGetter([]{706 audioIO->setOrientationGetter([]{
@@ -880,7 +883,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 176 unmodified lines
880#ifdef Q_OS_MAC883#ifdef Q_OS_MAC
881 auto cursorTarget = _window; // OSX doesn't seem to provide for hiding the cursor only on the GL widget884 auto cursorTarget = _window; // OSX doesn't seem to provide for hiding the cursor only on the GL widget
882#else885#else
883 // On windows and linux, hiding the top level cursor also means it's invisible when hovering over the 886 // On windows and linux, hiding the top level cursor also means it's invisible when hovering over the
884 // window menu, which is a pain, so only hide it for the GL surface887 // window menu, which is a pain, so only hide it for the GL surface
885 auto cursorTarget = _glWidget;888 auto cursorTarget = _glWidget;
886#endif889#endif
@@ -1125,7 +1128,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 238 unmodified lines
1125 loadSettings();1128 loadSettings();
1126 1129
1127 // Now that we've loaded the menu and thus switched to the previous display plugin1130 // Now that we've loaded the menu and thus switched to the previous display plugin
1128 // we can unlock the desktop repositioning code, since all the positions will be 1131 // we can unlock the desktop repositioning code, since all the positions will be
1129 // relative to the desktop size for this plugin1132 // relative to the desktop size for this plugin
1130 auto offscreenUi = DependencyManager::get<OffscreenUi>();1133 auto offscreenUi = DependencyManager::get<OffscreenUi>();
1131 offscreenUi->getDesktop()->setProperty("repositionLocked", false);1134 offscreenUi->getDesktop()->setProperty("repositionLocked", false);
@@ -1598,7 +1601,7 @@ void Application::checkChangeCursor() { · 466 unmodified lines
1598#ifdef Q_OS_MAC1601#ifdef Q_OS_MAC
1599 auto cursorTarget = _window; // OSX doesn't seem to provide for hiding the cursor only on the GL widget1602 auto cursorTarget = _window; // OSX doesn't seem to provide for hiding the cursor only on the GL widget
1600#else1603#else
1601 // On windows and linux, hiding the top level cursor also means it's invisible when hovering over the 1604 // On windows and linux, hiding the top level cursor also means it's invisible when hovering over the
1602 // window menu, which is a pain, so only hide it for the GL surface1605 // window menu, which is a pain, so only hide it for the GL surface
1603 auto cursorTarget = _glWidget;1606 auto cursorTarget = _glWidget;
1604#endif1607#endif
@@ -1785,7 +1788,7 @@ Application::~Application() { · 180 unmodified lines
1785#endif1788#endif
1786 // The window takes ownership of the menu, so this has the side effect of destroying it.1789 // The window takes ownership of the menu, so this has the side effect of destroying it.
1787 _window->setMenuBar(nullptr);1790 _window->setMenuBar(nullptr);
1788 1791
1789 _window->deleteLater();1792 _window->deleteLater();
1790 1793
1791 // Can't log to file passed this point, FileLogger about to be deleted1794 // Can't log to file passed this point, FileLogger about to be deleted
@@ -1811,10 +1814,10 @@ void Application::initializeGL() { · 19 unmodified lines
1811 1814
1812 _glWidget->makeCurrent();1815 _glWidget->makeCurrent();
1813 gpu::Context::init<gpu::gl::GLBackend>();1816 gpu::Context::init<gpu::gl::GLBackend>();
1814 qApp->setProperty(hifi::properties::gl::MAKE_PROGRAM_CALLBACK, 1817 qApp->setProperty(hifi::properties::gl::MAKE_PROGRAM_CALLBACK,
1815 QVariant::fromValue((void*)(&gpu::gl::GLBackend::makeProgram)));1818 QVariant::fromValue((void*)(&gpu::gl::GLBackend::makeProgram)));
1816 _gpuContext = std::make_shared<gpu::Context>();1819 _gpuContext = std::make_shared<gpu::Context>();
1817 // The gpu context can make child contexts for transfers, so 1820 // The gpu context can make child contexts for transfers, so
1818 // we need to restore primary rendering context1821 // we need to restore primary rendering context
1819 _glWidget->makeCurrent();1822 _glWidget->makeCurrent();
1820 1823
@@ -2034,7 +2037,7 @@ void Application::paintGL() { · 213 unmodified lines
2034 // FIXME not needed anymore?2037 // FIXME not needed anymore?
2035 _offscreenContext->makeCurrent();2038 _offscreenContext->makeCurrent();
2036 2039
2037 // If a display plugin loses it's underlying support, it 2040 // If a display plugin loses it's underlying support, it
2038 // needs to be able to signal us to not use it2041 // needs to be able to signal us to not use it
2039 if (!displayPlugin->beginFrameRender(_frameCount)) {2042 if (!displayPlugin->beginFrameRender(_frameCount)) {
2040 _inPaint = false;2043 _inPaint = false;
@@ -2846,7 +2849,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 805 unmodified lines
2846 if (isMirrorChecked) {2849 if (isMirrorChecked) {
2847 2850
2848 // if we got here without coming in from a non-Full Screen mirror case, then our2851 // if we got here without coming in from a non-Full Screen mirror case, then our
2849 // _returnFromFullScreenMirrorTo is unknown. In that case we'll go to the old 2852 // _returnFromFullScreenMirrorTo is unknown. In that case we'll go to the old
2850 // behavior of returning to ThirdPerson2853 // behavior of returning to ThirdPerson
2851 if (_returnFromFullScreenMirrorTo.isEmpty()) {2854 if (_returnFromFullScreenMirrorTo.isEmpty()) {
2852 _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;2855 _returnFromFullScreenMirrorTo = MenuOption::ThirdPerson;
@@ -3020,7 +3023,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 167 unmodified lines
3020 maybeToggleMenuVisible(event);3023 maybeToggleMenuVisible(event);
3021 3024
3022 auto& compositor = getApplicationCompositor();3025 auto& compositor = getApplicationCompositor();
3023 // if this is a real mouse event, and we're in HMD mode, then we should use it to move the 3026 // if this is a real mouse event, and we're in HMD mode, then we should use it to move the
3024 // compositor reticle3027 // compositor reticle
3025 // handleRealMouseMoveEvent() will return true, if we shouldn't process the event further3028 // handleRealMouseMoveEvent() will return true, if we shouldn't process the event further
3026 if (!compositor.fakeEventActive() && compositor.handleRealMouseMoveEvent()) {3029 if (!compositor.fakeEventActive() && compositor.handleRealMouseMoveEvent()) {
@@ -4109,7 +4112,7 @@ void Application::setKeyboardFocusEntity(EntityItemID entityItemID) { · 1082 unmodified lines
4109 }4112 }
4110 _lastAcceptedKeyPress = usecTimestampNow();4113 _lastAcceptedKeyPress = usecTimestampNow();
4111 4114
4112 setKeyboardFocusHighlight(entity->getPosition(), entity->getRotation(), 4115 setKeyboardFocusHighlight(entity->getPosition(), entity->getRotation(),
4113 entity->getDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR);4116 entity->getDimensions() * FOCUS_HIGHLIGHT_EXPANSION_FACTOR);
4114 }4117 }
4115 }4118 }
@@ -4700,7 +4703,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 584 unmodified lines
4700 _octreeQuery.setMaxQueryPacketsPerSecond(0);4703 _octreeQuery.setMaxQueryPacketsPerSecond(0);
4701 }4704 }
4702 4705
4703 // if asked to forceResend, then set the query's position/orientation to be degenerate in a manner 4706 // if asked to forceResend, then set the query's position/orientation to be degenerate in a manner
4704 // that will cause our next query to be guarenteed to be different and the server will resend to us4707 // that will cause our next query to be guarenteed to be different and the server will resend to us
4705 if (forceResend) {4708 if (forceResend) {
4706 _octreeQuery.setCameraPosition(glm::vec3(-0.1, -0.1, -0.1));4709 _octreeQuery.setCameraPosition(glm::vec3(-0.1, -0.1, -0.1));
@@ -5833,7 +5836,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 1126 unmodified lines
5833 mapping = mapping.insert(mapping.lastIndexOf("."), "-" + QString::number(copy));5836 mapping = mapping.insert(mapping.lastIndexOf("."), "-" + QString::number(copy));
5834 addAssetToWorldWithNewMapping(filePath, mapping, copy);5837 addAssetToWorldWithNewMapping(filePath, mapping, copy);
5835 } else {5838 } else {
5836 QString errorInfo = "Too many copies of asset name: " 5839 QString errorInfo = "Too many copies of asset name: "
5837 + mapping.left(mapping.length() - QString::number(copy).length() - 1);5840 + mapping.left(mapping.length() - QString::number(copy).length() - 1);
5838 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;5841 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
5839 addAssetToWorldError(filenameFromPath(filePath), errorInfo);5842 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
@@ -5900,7 +5903,7 @@ void Application::addAssetToWorldAddEntity(QString filePath, QString mapping) { · 60 unmodified lines
5900 5903
5901 // Note: Model dimensions are not available here; model is scaled per FBX mesh in RenderableModelEntityItem::update() later5904 // Note: Model dimensions are not available here; model is scaled per FBX mesh in RenderableModelEntityItem::update() later
5902 // on. But FBX dimensions may be in cm, so we monitor for the dimension change and rescale again if warranted.5905 // on. But FBX dimensions may be in cm, so we monitor for the dimension change and rescale again if warranted.
5903 5906
5904 if (entityID == QUuid()) {5907 if (entityID == QUuid()) {
5905 QString errorInfo = "Could not add model " + mapping + " to world.";5908 QString errorInfo = "Could not add model " + mapping + " to world.";
5906 qWarning(interfaceapp) << "Could not add model to world: " + errorInfo;5909 qWarning(interfaceapp) << "Could not add model to world: " + errorInfo;
@@ -6364,7 +6367,7 @@ glm::uvec2 Application::getCanvasSize() const { · 457 unmodified lines
6364}6367}
6365 6368
6366QRect Application::getRenderingGeometry() const {6369QRect Application::getRenderingGeometry() const {
6367 auto geometry = _glWidget->geometry(); 6370 auto geometry = _glWidget->geometry();
6368 auto topLeft = geometry.topLeft();6371 auto topLeft = geometry.topLeft();
6369 auto topLeftScreen = _glWidget->mapToGlobal(topLeft);6372 auto topLeftScreen = _glWidget->mapToGlobal(topLeft);
6370 geometry.moveTopLeft(topLeftScreen);6373 geometry.moveTopLeft(topLeftScreen);
@@ -6727,8 +6730,8 @@ bool Application::makeRenderingContextCurrent() { · 356 unmodified lines
6727 return _offscreenContext->makeCurrent();6730 return _offscreenContext->makeCurrent();
6728}6731}
6729 6732
6730bool Application::isForeground() const { 6733bool Application::isForeground() const {
6731 return _isForeground && !_window->isMinimized(); 6734 return _isForeground && !_window->isMinimized();
6732}6735}
6733 6736
6734void Application::sendMousePressOnEntity(QUuid id, PointerEvent event) {6737void Application::sendMousePressOnEntity(QUuid id, PointerEvent event) {