Showing the changes to interface/src/Application.cpp (1 of 36 files). Show all
Unified · Split
| @@ -55,6 +55,8 @@ · 54 unmodified lines | ||
| 55 | 55 | #include <AccountManager.h> |
| 56 | 56 | #include <AudioInjector.h> |
| 57 | 57 | #include <EntityScriptingInterface.h> |
| 58 | +#include <HFActionEvent.h> | |
| 59 | +#include <HFBackEvent.h> | |
| 58 | 60 | #include <LocalVoxelsList.h> |
| 59 | 61 | #include <Logging.h> |
| 60 | 62 | #include <NetworkAccessManager.h> |
| @@ -67,14 +69,16 @@ · 6 unmodified lines | ||
| 67 | 69 | #include <UUID.h> |
| 68 | 70 | |
| 69 | 71 | #include "Application.h" |
| 70 | −#include "ui/DataWebDialog.h" | |
| 71 | 72 | #include "InterfaceVersion.h" |
| 72 | 73 | #include "Menu.h" |
| 73 | 74 | #include "ModelUploader.h" |
| 74 | 75 | #include "Util.h" |
| 76 | + | |
| 77 | +#include "devices/Leapmotion.h" | |
| 75 | 78 | #include "devices/MIDIManager.h" |
| 76 | 79 | #include "devices/OculusManager.h" |
| 77 | 80 | #include "devices/TV3DManager.h" |
| 81 | + | |
| 78 | 82 | #include "renderer/ProgramObject.h" |
| 79 | 83 | |
| 80 | 84 | #include "scripting/AccountScriptingInterface.h" |
| @@ -87,12 +91,12 @@ · 6 unmodified lines | ||
| 87 | 91 | #include "scripting/SettingsScriptingInterface.h" |
| 88 | 92 | #include "scripting/WindowScriptingInterface.h" |
| 89 | 93 | |
| 94 | +#include "ui/DataWebDialog.h" | |
| 90 | 95 | #include "ui/InfoView.h" |
| 91 | 96 | #include "ui/Snapshot.h" |
| 92 | 97 | #include "ui/Stats.h" |
| 93 | 98 | #include "ui/TextRenderer.h" |
| 94 | 99 | |
| 95 | −#include "devices/Leapmotion.h" | |
| 96 | 100 | |
| 97 | 101 | using namespace std; |
| 98 | 102 | |
| @@ -136,6 +140,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 37 unmodified lines | ||
| 136 | 140 | _glWidget(new GLCanvas()), |
| 137 | 141 | _nodeThread(new QThread(this)), |
| 138 | 142 | _datagramProcessor(), |
| 143 | + _undoStack(), | |
| 144 | + _undoStackScriptingInterface(&_undoStack), | |
| 139 | 145 | _frameCount(0), |
| 140 | 146 | _fps(60.0f), |
| 141 | 147 | _justStarted(true), |
| @@ -172,8 +178,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 30 unmodified lines | ||
| 172 | 178 | _nodeBoundsDisplay(this), |
| 173 | 179 | _previousScriptLocation(), |
| 174 | 180 | _applicationOverlay(), |
| 175 | − _undoStack(), | |
| 176 | − _undoStackScriptingInterface(&_undoStack), | |
| 177 | 181 | _runningScriptsWidget(NULL), |
| 178 | 182 | _runningScriptsWidgetWasVisible(false), |
| 179 | 183 | _trayIcon(new QSystemTrayIcon(_window)), |
| @@ -835,6 +839,10 @@ bool Application::event(QEvent* event) { · 655 unmodified lines | ||
| 835 | 839 | return false; |
| 836 | 840 | } |
| 837 | 841 | |
| 842 | + if (HFActionEvent::types().contains(event->type())) { | |
| 843 | + _controllerScriptingInterface.handleMetaEvent(static_cast<HFMetaEvent*>(event)); | |
| 844 | + } | |
| 845 | + | |
| 838 | 846 | return QApplication::event(event); |
| 839 | 847 | } |
| 840 | 848 | |
| @@ -1109,9 +1117,23 @@ void Application::keyPressEvent(QKeyEvent* event) { · 268 unmodified lines | ||
| 1109 | 1117 | case Qt::Key_Equal: |
| 1110 | 1118 | _myAvatar->resetSize(); |
| 1111 | 1119 | break; |
| 1112 | − case Qt::Key_Escape: | |
| 1120 | + case Qt::Key_Space: { | |
| 1121 | + // this starts an HFActionEvent | |
| 1122 | + HFActionEvent startActionEvent(HFActionEvent::startType(), getViewportCenter()); | |
| 1123 | + sendEvent(this, &startActionEvent); | |
| 1124 | + | |
| 1125 | + break; | |
| 1126 | + } | |
| 1127 | + case Qt::Key_Escape: { | |
| 1113 | 1128 | OculusManager::abandonCalibration(); |
| 1129 | + | |
| 1130 | + // this starts the HFCancelEvent | |
| 1131 | + HFBackEvent startBackEvent(HFBackEvent::startType()); | |
| 1132 | + sendEvent(this, &startBackEvent); | |
| 1133 | + | |
| 1114 | 1134 | break; |
| 1135 | + } | |
| 1136 | + | |
| 1115 | 1137 | default: |
| 1116 | 1138 | event->ignore(); |
| 1117 | 1139 | break; |
| @@ -1182,6 +1204,20 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 64 unmodified lines | ||
| 1182 | 1204 | case Qt::Key_Alt: |
| 1183 | 1205 | _myAvatar->clearDriveKeys(); |
| 1184 | 1206 | break; |
| 1207 | + case Qt::Key_Space: { | |
| 1208 | + // this ends the HFActionEvent | |
| 1209 | + HFActionEvent endActionEvent(HFActionEvent::endType(), getViewportCenter()); | |
| 1210 | + sendEvent(this, &endActionEvent); | |
| 1211 | + | |
| 1212 | + break; | |
| 1213 | + } | |
| 1214 | + case Qt::Key_Escape: { | |
| 1215 | + // this ends the HFCancelEvent | |
| 1216 | + HFBackEvent endBackEvent(HFBackEvent::endType()); | |
| 1217 | + sendEvent(this, &endBackEvent); | |
| 1218 | + | |
| 1219 | + break; | |
| 1220 | + } | |
| 1185 | 1221 | default: |
| 1186 | 1222 | event->ignore(); |
| 1187 | 1223 | break; |
| @@ -1254,6 +1290,10 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { · 66 unmodified lines | ||
| 1254 | 1290 | // stop propagation |
| 1255 | 1291 | return; |
| 1256 | 1292 | } |
| 1293 | + | |
| 1294 | + // nobody handled this - make it an action event on the _window object | |
| 1295 | + HFActionEvent actionEvent(HFActionEvent::startType(), event->localPos()); | |
| 1296 | + sendEvent(this, &actionEvent); | |
| 1257 | 1297 | |
| 1258 | 1298 | } else if (event->button() == Qt::RightButton) { |
| 1259 | 1299 | // right click items here |
| @@ -1274,12 +1314,17 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { · 14 unmodified lines | ||
| 1274 | 1314 | _mouseX = event->x(); |
| 1275 | 1315 | _mouseY = event->y(); |
| 1276 | 1316 | _mousePressed = false; |
| 1317 | + | |
| 1277 | 1318 | checkBandwidthMeterClick(); |
| 1278 | 1319 | if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) { |
| 1279 | 1320 | // let's set horizontal offset to give stats some margin to mirror |
| 1280 | 1321 | int horizontalOffset = MIRROR_VIEW_WIDTH; |
| 1281 | 1322 | Stats::getInstance()->checkClick(_mouseX, _mouseY, _mouseDragStartedX, _mouseDragStartedY, horizontalOffset); |
| 1282 | 1323 | } |
| 1324 | + | |
| 1325 | + // fire an action end event | |
| 1326 | + HFActionEvent actionEvent(HFActionEvent::endType(), event->localPos()); | |
| 1327 | + sendEvent(this, &actionEvent); | |
| 1283 | 1328 | } |
| 1284 | 1329 | } |
| 1285 | 1330 | } |