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
957957 return DependencyManager::get<OffscreenUi>()->navigationFocused() ? 1 : 0;
958958 });
959959
960− // Setup the keyboardMouseDevice and the user input mapper with the default bindings
960+ // Setup the _keyboardMouseDevice, _touchscreenDevice and the user input mapper with the default bindings
961961 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+ }
962966
963967 // force the model the look at the correct directory (weird order of operations issue)
964968 scriptEngines->setScriptsLocation(scriptEngines->getScriptsLocation());
@@ -1600,6 +1604,9 @@ void Application::initializeUi() { · 635 unmodified lines
16001604 if (KeyboardMouseDevice::NAME == inputPlugin->getName()) {
16011605 _keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin);
16021606 }
1607+ if (TouchscreenDevice::NAME == inputPlugin->getName()) {
1608+ _touchscreenDevice = std::dynamic_pointer_cast<TouchscreenDevice>(inputPlugin);
1609+ }
16031610 }
16041611 _window->setMenuBar(new Menu());
16051612
@@ -2096,6 +2103,9 @@ bool Application::event(QEvent* event) { · 490 unmodified lines
20962103 case QEvent::TouchUpdate:
20972104 touchUpdateEvent(static_cast<QTouchEvent*>(event));
20982105 return true;
2106+ case QEvent::Gesture:
2107+ touchGestureEvent((QGestureEvent*)event);
2108+ return true;
20992109 case QEvent::Wheel:
21002110 wheelEvent(static_cast<QWheelEvent*>(event));
21012111 return true;
@@ -2727,6 +2737,9 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 625 unmodified lines
27272737 if (_keyboardMouseDevice->isActive()) {
27282738 _keyboardMouseDevice->touchUpdateEvent(event);
27292739 }
2740+ if (_touchscreenDevice->isActive()) {
2741+ _touchscreenDevice->touchUpdateEvent(event);
2742+ }
27302743 }
27312744
27322745 void Application::touchBeginEvent(QTouchEvent* event) {
@@ -2745,6 +2758,9 @@ void Application::touchBeginEvent(QTouchEvent* event) { · 12 unmodified lines
27452758 if (_keyboardMouseDevice->isActive()) {
27462759 _keyboardMouseDevice->touchBeginEvent(event);
27472760 }
2761+ if (_touchscreenDevice->isActive()) {
2762+ _touchscreenDevice->touchBeginEvent(event);
2763+ }
27482764
27492765 }
27502766
@@ -2762,10 +2778,19 @@ void Application::touchEndEvent(QTouchEvent* event) { · 11 unmodified lines
27622778 if (_keyboardMouseDevice->isActive()) {
27632779 _keyboardMouseDevice->touchEndEvent(event);
27642780 }
2781+ if (_touchscreenDevice->isActive()) {
2782+ _touchscreenDevice->touchEndEvent(event);
2783+ }
27652784
27662785 // put any application specific touch behavior below here..
27672786 }
27682787
2788+void Application::touchGestureEvent(QGestureEvent* event) {
2789+ if (_touchscreenDevice->isActive()) {
2790+ _touchscreenDevice->touchGestureEvent(event);
2791+ }
2792+}
2793+
27692794 void Application::wheelEvent(QWheelEvent* event) const {
27702795 _altPressed = false;
27712796 _controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts