History

Merge pull request #6959 from Triplelexx/20769

CR for Job #20769 - Touchscreen camera input for Interface

Brad Hefta-Gaub committed 10 years ago

Commit bcee1282 parents e0739dc 9b993b215 files · +312 −27Browse files

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

Unified · Split

interface/src/Application.cpp+26−1
@@ -957,8 +957,12 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 956 unmodified lines
957 return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;957 return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
958 });958 });
959 959
960 // Setup the keyboardMouseDevice and the user input mapper with the default bindings960 // Setup the _keyboardMouseDevice, _touchscreenDevice and the user input mapper with the default bindings
961 userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice());961 userInputMapper->registerDevice(_keyboardMouseDevice->getInputDevice());
962 // if the _touchscreenDevice is not supported it will not be registered
963 if (_touchscreenDevice) {
964 userInputMapper->registerDevice(_touchscreenDevice->getInputDevice());
965 }
962 966
963 // force the model the look at the correct directory (weird order of operations issue)967 // force the model the look at the correct directory (weird order of operations issue)
964 scriptEngines->setScriptsLocation(scriptEngines->getScriptsLocation());968 scriptEngines->setScriptsLocation(scriptEngines->getScriptsLocation());
@@ -1600,6 +1604,9 @@ void Application::initializeUi() { · 635 unmodified lines
1600 if (KeyboardMouseDevice::NAME == inputPlugin->getName()) {1604 if (KeyboardMouseDevice::NAME == inputPlugin->getName()) {
1601 _keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin);1605 _keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin);
1602 }1606 }
1607 if (TouchscreenDevice::NAME == inputPlugin->getName()) {
1608 _touchscreenDevice = std::dynamic_pointer_cast<TouchscreenDevice>(inputPlugin);
1609 }
1603 }1610 }
1604 _window->setMenuBar(new Menu());1611 _window->setMenuBar(new Menu());
1605 1612
@@ -2096,6 +2103,9 @@ bool Application::event(QEvent* event) { · 490 unmodified lines
2096 case QEvent::TouchUpdate:2103 case QEvent::TouchUpdate:
2097 touchUpdateEvent(static_cast<QTouchEvent*>(event));2104 touchUpdateEvent(static_cast<QTouchEvent*>(event));
2098 return true;2105 return true;
2106 case QEvent::Gesture:
2107 touchGestureEvent((QGestureEvent*)event);
2108 return true;
2099 case QEvent::Wheel:2109 case QEvent::Wheel:
2100 wheelEvent(static_cast<QWheelEvent*>(event));2110 wheelEvent(static_cast<QWheelEvent*>(event));
2101 return true;2111 return true;
@@ -2727,6 +2737,9 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 625 unmodified lines
2727 if (_keyboardMouseDevice->isActive()) {2737 if (_keyboardMouseDevice->isActive()) {
2728 _keyboardMouseDevice->touchUpdateEvent(event);2738 _keyboardMouseDevice->touchUpdateEvent(event);
2729 }2739 }
2740 if (_touchscreenDevice->isActive()) {
2741 _touchscreenDevice->touchUpdateEvent(event);
2742 }
2730}2743}
2731 2744
2732void Application::touchBeginEvent(QTouchEvent* event) {2745void Application::touchBeginEvent(QTouchEvent* event) {
@@ -2745,6 +2758,9 @@ void Application::touchBeginEvent(QTouchEvent* event) { · 12 unmodified lines
2745 if (_keyboardMouseDevice->isActive()) {2758 if (_keyboardMouseDevice->isActive()) {
2746 _keyboardMouseDevice->touchBeginEvent(event);2759 _keyboardMouseDevice->touchBeginEvent(event);
2747 }2760 }
2761 if (_touchscreenDevice->isActive()) {
2762 _touchscreenDevice->touchBeginEvent(event);
2763 }
2748 2764
2749}2765}
2750 2766
@@ -2762,10 +2778,19 @@ void Application::touchEndEvent(QTouchEvent* event) { · 11 unmodified lines
2762 if (_keyboardMouseDevice->isActive()) {2778 if (_keyboardMouseDevice->isActive()) {
2763 _keyboardMouseDevice->touchEndEvent(event);2779 _keyboardMouseDevice->touchEndEvent(event);
2764 }2780 }
2781 if (_touchscreenDevice->isActive()) {
2782 _touchscreenDevice->touchEndEvent(event);
2783 }
2765 2784
2766 // put any application specific touch behavior below here..2785 // put any application specific touch behavior below here..
2767}2786}
2768 2787
2788void Application::touchGestureEvent(QGestureEvent* event) {
2789 if (_touchscreenDevice->isActive()) {
2790 _touchscreenDevice->touchGestureEvent(event);
2791 }
2792}
2793
2769void Application::wheelEvent(QWheelEvent* event) const {2794void Application::wheelEvent(QWheelEvent* event) const {
2770 _altPressed = false;2795 _altPressed = false;
2771 _controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts2796 _controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts