History

merge upstream/master into andrew/nova

Andrew Meadows committed 11 years ago

Commit 3031d552 parents b023fe5 2bf7387111 files · +2879 −1273Browse files

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

Unified · Split

interface/src/Application.cpp+30−5
@@ -63,6 +63,7 @@ · 62 unmodified lines
6363 #include <GlowEffect.h>
6464 #include <HFActionEvent.h>
6565 #include <HFBackEvent.h>
66+#include <VrMenu.h>
6667 #include <LogHandler.h>
6768 #include <MainWindow.h>
6869 #include <ModelEntityItem.h>
@@ -357,9 +358,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 288 unmodified lines
357358
358359 _bookmarks = new Bookmarks(); // Before setting up the menu
359360
360− // call Menu getInstance static method to set up the menu
361− _window->setMenuBar(Menu::getInstance());
362−
363361 _runningScriptsWidget = new RunningScriptsWidget(_window);
364362
365363 // start the nodeThread so its event loop is running
@@ -466,6 +464,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 100 unmodified lines
466464 addressManager->setOrientationGetter(getOrientationForPath);
467465
468466 connect(addressManager.data(), &AddressManager::rootPlaceNameChanged, this, &Application::updateWindowTitle);
467+ connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
469468
470469 #ifdef _WIN32
471470 WSADATA WsaData;
@@ -731,6 +730,10 @@ void Application::initializeGL() { · 259 unmodified lines
731730 qCDebug(interfaceapp, "Initialized Offscreen UI.");
732731 _glWidget->makeCurrent();
733732
733+ // call Menu getInstance static method to set up the menu
734+ // Needs to happen AFTER the QML UI initialization
735+ _window->setMenuBar(Menu::getInstance());
736+
734737 init();
735738 qCDebug(interfaceapp, "init() complete.");
736739
@@ -766,6 +769,7 @@ void Application::initializeUi() { · 29 unmodified lines
766769 AddressBarDialog::registerType();
767770 LoginDialog::registerType();
768771 MessageDialog::registerType();
772+ VrMenu::registerType();
769773
770774 auto offscreenUi = DependencyManager::get<OffscreenUi>();
771775 offscreenUi->create(_glWidget->context()->contextHandle());
@@ -774,6 +778,8 @@ void Application::initializeUi() { · 2 unmodified lines
774778 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
775779 offscreenUi->load("Root.qml");
776780 offscreenUi->load("RootMenu.qml");
781+ VrMenu::load();
782+ VrMenu::executeQueuedLambdas();
777783 offscreenUi->setMouseTranslator([this](const QPointF& p){
778784 if (OculusManager::isConnected()) {
779785 glm::vec2 pos = _applicationOverlay.screenToOverlay(toGlm(p));
@@ -1068,8 +1074,10 @@ bool Application::eventFilter(QObject* object, QEvent* event) { · 288 unmodified lines
10681074 return false;
10691075 }
10701076
1071−void Application::keyPressEvent(QKeyEvent* event) {
1077+static bool _altPressed{ false };
10721078
1079+void Application::keyPressEvent(QKeyEvent* event) {
1080+ _altPressed = event->key() == Qt::Key_Alt;
10731081 _keysPressed.insert(event->key());
10741082
10751083 _controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts
@@ -1146,7 +1154,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 70 unmodified lines
11461154 case Qt::Key_A:
11471155 if (isShifted) {
11481156 Menu::getInstance()->triggerOption(MenuOption::Atmosphere);
1149− } else {
1157+ } else if (!isMeta) {
11501158 _myAvatar->setDriveKeys(ROT_LEFT, 1.0f);
11511159 }
11521160 break;
@@ -1317,7 +1325,19 @@ void Application::keyPressEvent(QKeyEvent* event) { · 164 unmodified lines
13171325 }
13181326 }
13191327
1328+
1329+//#define VR_MENU_ONLY_IN_HMD
1330+
13201331 void Application::keyReleaseEvent(QKeyEvent* event) {
1332+ if (event->key() == Qt::Key_Alt && _altPressed && _window->isActiveWindow()) {
1333+#ifdef VR_MENU_ONLY_IN_HMD
1334+ if (OculusManager::isConnected()) {
1335+#endif
1336+ VrMenu::toggle();
1337+#ifdef VR_MENU_ONLY_IN_HMD
1338+ }
1339+#endif
1340+ }
13211341
13221342 _keysPressed.remove(event->key());
13231343
@@ -1328,6 +1348,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 4 unmodified lines
13281348 return;
13291349 }
13301350
1351+
13311352 switch (event->key()) {
13321353 case Qt::Key_E:
13331354 case Qt::Key_PageUp:
@@ -4457,3 +4478,7 @@ void Application::friendsWindowClosed() { · 3123 unmodified lines
44574478 delete _friendsWindow;
44584479 _friendsWindow = NULL;
44594480 }
4481+
4482+void Application::postLambdaEvent(std::function<void()> f) {
4483+ QCoreApplication::postEvent(this, new LambdaEvent(f));
4484+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t