History

Merge branch 'master' of https://github.com/highfidelity/hifi into 20143

Stojce committed 12 years ago

Commit 1debad32 parents 9be107c 4e7e96436 files · +1298 −792Browse files

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

Unified · Split

interface/src/Application.cpp+50−5
@@ -55,6 +55,8 @@ · 54 unmodified lines
5555 #include <AccountManager.h>
5656 #include <AudioInjector.h>
5757 #include <EntityScriptingInterface.h>
58+#include <HFActionEvent.h>
59+#include <HFBackEvent.h>
5860 #include <LocalVoxelsList.h>
5961 #include <Logging.h>
6062 #include <NetworkAccessManager.h>
@@ -67,14 +69,16 @@ · 6 unmodified lines
6769 #include <UUID.h>
6870
6971 #include "Application.h"
70−#include "ui/DataWebDialog.h"
7172 #include "InterfaceVersion.h"
7273 #include "Menu.h"
7374 #include "ModelUploader.h"
7475 #include "Util.h"
76+
77+#include "devices/Leapmotion.h"
7578 #include "devices/MIDIManager.h"
7679 #include "devices/OculusManager.h"
7780 #include "devices/TV3DManager.h"
81+
7882 #include "renderer/ProgramObject.h"
7983
8084 #include "scripting/AccountScriptingInterface.h"
@@ -87,12 +91,12 @@ · 6 unmodified lines
8791 #include "scripting/SettingsScriptingInterface.h"
8892 #include "scripting/WindowScriptingInterface.h"
8993
94+#include "ui/DataWebDialog.h"
9095 #include "ui/InfoView.h"
9196 #include "ui/Snapshot.h"
9297 #include "ui/Stats.h"
9398 #include "ui/TextRenderer.h"
9499
95−#include "devices/Leapmotion.h"
96100
97101 using namespace std;
98102
@@ -136,6 +140,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 37 unmodified lines
136140 _glWidget(new GLCanvas()),
137141 _nodeThread(new QThread(this)),
138142 _datagramProcessor(),
143+ _undoStack(),
144+ _undoStackScriptingInterface(&_undoStack),
139145 _frameCount(0),
140146 _fps(60.0f),
141147 _justStarted(true),
@@ -172,8 +178,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 30 unmodified lines
172178 _nodeBoundsDisplay(this),
173179 _previousScriptLocation(),
174180 _applicationOverlay(),
175− _undoStack(),
176− _undoStackScriptingInterface(&_undoStack),
177181 _runningScriptsWidget(NULL),
178182 _runningScriptsWidgetWasVisible(false),
179183 _trayIcon(new QSystemTrayIcon(_window)),
@@ -835,6 +839,10 @@ bool Application::event(QEvent* event) { · 655 unmodified lines
835839 return false;
836840 }
837841
842+ if (HFActionEvent::types().contains(event->type())) {
843+ _controllerScriptingInterface.handleMetaEvent(static_cast<HFMetaEvent*>(event));
844+ }
845+
838846 return QApplication::event(event);
839847 }
840848
@@ -1109,9 +1117,23 @@ void Application::keyPressEvent(QKeyEvent* event) { · 268 unmodified lines
11091117 case Qt::Key_Equal:
11101118 _myAvatar->resetSize();
11111119 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: {
11131128 OculusManager::abandonCalibration();
1129+
1130+ // this starts the HFCancelEvent
1131+ HFBackEvent startBackEvent(HFBackEvent::startType());
1132+ sendEvent(this, &startBackEvent);
1133+
11141134 break;
1135+ }
1136+
11151137 default:
11161138 event->ignore();
11171139 break;
@@ -1182,6 +1204,20 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 64 unmodified lines
11821204 case Qt::Key_Alt:
11831205 _myAvatar->clearDriveKeys();
11841206 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+ }
11851221 default:
11861222 event->ignore();
11871223 break;
@@ -1254,6 +1290,10 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { · 66 unmodified lines
12541290 // stop propagation
12551291 return;
12561292 }
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);
12571297
12581298 } else if (event->button() == Qt::RightButton) {
12591299 // right click items here
@@ -1274,12 +1314,17 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { · 14 unmodified lines
12741314 _mouseX = event->x();
12751315 _mouseY = event->y();
12761316 _mousePressed = false;
1317+
12771318 checkBandwidthMeterClick();
12781319 if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
12791320 // let's set horizontal offset to give stats some margin to mirror
12801321 int horizontalOffset = MIRROR_VIEW_WIDTH;
12811322 Stats::getInstance()->checkClick(_mouseX, _mouseY, _mouseDragStartedX, _mouseDragStartedY, horizontalOffset);
12821323 }
1324+
1325+ // fire an action end event
1326+ HFActionEvent actionEvent(HFActionEvent::endType(), event->localPos());
1327+ sendEvent(this, &actionEvent);
12831328 }
12841329 }
12851330 }

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