History

Replace Application::getInstance() with qApp

Atlante45 committed 11 years ago

Commit cf3b33a1 parent 2c276bb37 files · +197 −181Browse files

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

Unified · Split

interface/src/Application.cpp+17−17
@@ -218,11 +218,11 @@ public: · 217 unmodified lines
218218 }
219219
220220 if (message->message == UWM_SHOW_APPLICATION) {
221− MainWindow* applicationWindow = Application::getInstance()->getWindow();
221+ MainWindow* applicationWindow = qApp->getWindow();
222222 if (applicationWindow->isMinimized()) {
223223 applicationWindow->showNormal(); // Restores to windowed or maximized state appropriately.
224224 }
225− Application::getInstance()->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.
225+ qApp->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.
226226 return true;
227227 }
228228
@@ -248,7 +248,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 19 unmodified lines
248248 OutputDebugStringA(logMessage.toLocal8Bit().constData());
249249 OutputDebugStringA("\n");
250250 #endif
251− Application::getInstance()->getLogger()->addMessage(qPrintable(logMessage + "\n"));
251+ qApp->getLogger()->addMessage(qPrintable(logMessage + "\n"));
252252 }
253253 }
254254
@@ -1104,7 +1104,7 @@ void Application::paintGL() { · 849 unmodified lines
11041104 PerformanceTimer perfTimer("renderOverlay");
11051105 // NOTE: There is no batch associated with this renderArgs
11061106 // the ApplicationOverlay class assumes it's viewport is setup to be the device size
1107− QSize size = qApp->getDeviceSize();
1107+ QSize size = getDeviceSize();
11081108 renderArgs._viewport = glm::ivec4(0, 0, size.width(), size.height());
11091109 _applicationOverlay.renderOverlay(&renderArgs);
11101110 }
@@ -1116,7 +1116,7 @@ void Application::paintGL() { · 5 unmodified lines
11161116 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
11171117 Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
11181118 Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(_myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
1119− Application::getInstance()->cameraMenuChanged();
1119+ cameraMenuChanged();
11201120 }
11211121
11221122 // The render mode is default or mirror if the camera is in mirror mode, assigned further below
@@ -3561,7 +3561,7 @@ namespace render { · 2438 unmodified lines
35613561
35623562 skybox = skyStage->getSkybox();
35633563 if (skybox) {
3564− skybox->render(batch, *(Application::getInstance()->getDisplayViewFrustum()));
3564+ skybox->render(batch, *(qApp->getDisplayViewFrustum()));
35653565 }
35663566 }
35673567 }
@@ -4526,7 +4526,7 @@ void Application::loadDialog() { · 958 unmodified lines
45264526 }
45274527
45284528 void Application::loadScriptURLDialog() {
4529− QInputDialog scriptURLDialog(Application::getInstance()->getWindow());
4529+ QInputDialog scriptURLDialog(getWindow());
45304530 scriptURLDialog.setWindowTitle("Open and Run Script URL");
45314531 scriptURLDialog.setLabelText("Script:");
45324532 scriptURLDialog.setWindowFlags(Qt::Sheet);
@@ -5095,8 +5095,8 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 562 unmodified lines
50955095
50965096 unsigned int deviceID = index == 0 ? CONTROLLER_0_EVENT : CONTROLLER_1_EVENT;
50975097
5098− if (qApp->isHMDMode()) {
5099− pos = qApp->getApplicationCompositor().getPalmClickLocation(palm);
5098+ if (isHMDMode()) {
5099+ pos = getApplicationCompositor().getPalmClickLocation(palm);
51005100 }
51015101 else {
51025102 // Get directon relative to avatar orientation
@@ -5105,7 +5105,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 2 unmodified lines
51055105 // Get the angles, scaled between (-0.5,0.5)
51065106 float xAngle = (atan2f(direction.z, direction.x) + (float)M_PI_2);
51075107 float yAngle = 0.5f - ((atan2f(direction.z, direction.y) + (float)M_PI_2));
5108− auto canvasSize = qApp->getCanvasSize();
5108+ auto canvasSize = getCanvasSize();
51095109 // Get the pixel range over which the xAngle and yAngle are scaled
51105110 float cursorRange = canvasSize.x * InputDevice::getCursorPixelRangeMult();
51115111
@@ -5120,14 +5120,14 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 8 unmodified lines
51205120 if (_oldHandLeftClick[index]) {
51215121 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);
51225122
5123− qApp->mouseReleaseEvent(&mouseEvent, deviceID);
5123+ mouseReleaseEvent(&mouseEvent, deviceID);
51245124
51255125 _oldHandLeftClick[index] = false;
51265126 }
51275127 if (_oldHandRightClick[index]) {
51285128 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);
51295129
5130− qApp->mouseReleaseEvent(&mouseEvent, deviceID);
5130+ mouseReleaseEvent(&mouseEvent, deviceID);
51315131
51325132 _oldHandRightClick[index] = false;
51335133 }
@@ -5141,7 +5141,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 7 unmodified lines
51415141 // Only send the mouse event if the opposite left button isnt held down.
51425142 // Is this check necessary?
51435143 if (!_oldHandLeftClick[(int)(!index)]) {
5144− qApp->mouseMoveEvent(&mouseEvent, deviceID);
5144+ mouseMoveEvent(&mouseEvent, deviceID);
51455145 }
51465146 }
51475147 _oldHandMouseX[index] = pos.x();
@@ -5162,12 +5162,12 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 14 unmodified lines
51625162
51635163 QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::RightButton, 0);
51645164
5165− qApp->mousePressEvent(&mouseEvent, deviceID);
5165+ mousePressEvent(&mouseEvent, deviceID);
51665166 }
51675167 } else if (_oldHandRightClick[index]) {
51685168 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);
51695169
5170− qApp->mouseReleaseEvent(&mouseEvent, deviceID);
5170+ mouseReleaseEvent(&mouseEvent, deviceID);
51715171
51725172 _oldHandRightClick[index] = false;
51735173 }
@@ -5179,12 +5179,12 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 5 unmodified lines
51795179
51805180 QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, 0);
51815181
5182− qApp->mousePressEvent(&mouseEvent, deviceID);
5182+ mousePressEvent(&mouseEvent, deviceID);
51835183 }
51845184 } else if (_oldHandLeftClick[index]) {
51855185 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);
51865186
5187− qApp->mouseReleaseEvent(&mouseEvent, deviceID);
5187+ mouseReleaseEvent(&mouseEvent, deviceID);
51885188
51895189 _oldHandLeftClick[index] = false;
51905190 }