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
218 }218 }
219 219
220 if (message->message == UWM_SHOW_APPLICATION) {220 if (message->message == UWM_SHOW_APPLICATION) {
221 MainWindow* applicationWindow = Application::getInstance()->getWindow();221 MainWindow* applicationWindow = qApp->getWindow();
222 if (applicationWindow->isMinimized()) {222 if (applicationWindow->isMinimized()) {
223 applicationWindow->showNormal(); // Restores to windowed or maximized state appropriately.223 applicationWindow->showNormal(); // Restores to windowed or maximized state appropriately.
224 }224 }
225 Application::getInstance()->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.225 qApp->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.
226 return true;226 return true;
227 }227 }
228 228
@@ -248,7 +248,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 19 unmodified lines
248 OutputDebugStringA(logMessage.toLocal8Bit().constData());248 OutputDebugStringA(logMessage.toLocal8Bit().constData());
249 OutputDebugStringA("\n");249 OutputDebugStringA("\n");
250#endif250#endif
251 Application::getInstance()->getLogger()->addMessage(qPrintable(logMessage + "\n"));251 qApp->getLogger()->addMessage(qPrintable(logMessage + "\n"));
252 }252 }
253}253}
254 254
@@ -1104,7 +1104,7 @@ void Application::paintGL() { · 849 unmodified lines
1104 PerformanceTimer perfTimer("renderOverlay");1104 PerformanceTimer perfTimer("renderOverlay");
1105 // NOTE: There is no batch associated with this renderArgs1105 // NOTE: There is no batch associated with this renderArgs
1106 // the ApplicationOverlay class assumes it's viewport is setup to be the device size1106 // the ApplicationOverlay class assumes it's viewport is setup to be the device size
1107 QSize size = qApp->getDeviceSize();1107 QSize size = getDeviceSize();
1108 renderArgs._viewport = glm::ivec4(0, 0, size.width(), size.height());1108 renderArgs._viewport = glm::ivec4(0, 0, size.width(), size.height());
1109 _applicationOverlay.renderOverlay(&renderArgs);1109 _applicationOverlay.renderOverlay(&renderArgs);
1110 }1110 }
@@ -1116,7 +1116,7 @@ void Application::paintGL() { · 5 unmodified lines
1116 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {1116 if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
1117 Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);1117 Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
1118 Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(_myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));1118 Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(_myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
1119 Application::getInstance()->cameraMenuChanged();1119 cameraMenuChanged();
1120 }1120 }
1121 1121
1122 // The render mode is default or mirror if the camera is in mirror mode, assigned further below1122 // 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
3561 3561
3562 skybox = skyStage->getSkybox();3562 skybox = skyStage->getSkybox();
3563 if (skybox) {3563 if (skybox) {
3564 skybox->render(batch, *(Application::getInstance()->getDisplayViewFrustum()));3564 skybox->render(batch, *(qApp->getDisplayViewFrustum()));
3565 }3565 }
3566 }3566 }
3567 }3567 }
@@ -4526,7 +4526,7 @@ void Application::loadDialog() { · 958 unmodified lines
4526}4526}
4527 4527
4528void Application::loadScriptURLDialog() {4528void Application::loadScriptURLDialog() {
4529 QInputDialog scriptURLDialog(Application::getInstance()->getWindow());4529 QInputDialog scriptURLDialog(getWindow());
4530 scriptURLDialog.setWindowTitle("Open and Run Script URL");4530 scriptURLDialog.setWindowTitle("Open and Run Script URL");
4531 scriptURLDialog.setLabelText("Script:");4531 scriptURLDialog.setLabelText("Script:");
4532 scriptURLDialog.setWindowFlags(Qt::Sheet);4532 scriptURLDialog.setWindowFlags(Qt::Sheet);
@@ -5095,8 +5095,8 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 562 unmodified lines
5095 5095
5096 unsigned int deviceID = index == 0 ? CONTROLLER_0_EVENT : CONTROLLER_1_EVENT;5096 unsigned int deviceID = index == 0 ? CONTROLLER_0_EVENT : CONTROLLER_1_EVENT;
5097 5097
5098 if (qApp->isHMDMode()) {5098 if (isHMDMode()) {
5099 pos = qApp->getApplicationCompositor().getPalmClickLocation(palm);5099 pos = getApplicationCompositor().getPalmClickLocation(palm);
5100 }5100 }
5101 else {5101 else {
5102 // Get directon relative to avatar orientation5102 // Get directon relative to avatar orientation
@@ -5105,7 +5105,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 2 unmodified lines
5105 // Get the angles, scaled between (-0.5,0.5)5105 // Get the angles, scaled between (-0.5,0.5)
5106 float xAngle = (atan2f(direction.z, direction.x) + (float)M_PI_2);5106 float xAngle = (atan2f(direction.z, direction.x) + (float)M_PI_2);
5107 float yAngle = 0.5f - ((atan2f(direction.z, direction.y) + (float)M_PI_2));5107 float yAngle = 0.5f - ((atan2f(direction.z, direction.y) + (float)M_PI_2));
5108 auto canvasSize = qApp->getCanvasSize();5108 auto canvasSize = getCanvasSize();
5109 // Get the pixel range over which the xAngle and yAngle are scaled5109 // Get the pixel range over which the xAngle and yAngle are scaled
5110 float cursorRange = canvasSize.x * InputDevice::getCursorPixelRangeMult();5110 float cursorRange = canvasSize.x * InputDevice::getCursorPixelRangeMult();
5111 5111
@@ -5120,14 +5120,14 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 8 unmodified lines
5120 if (_oldHandLeftClick[index]) {5120 if (_oldHandLeftClick[index]) {
5121 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);5121 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);
5122 5122
5123 qApp->mouseReleaseEvent(&mouseEvent, deviceID);5123 mouseReleaseEvent(&mouseEvent, deviceID);
5124 5124
5125 _oldHandLeftClick[index] = false;5125 _oldHandLeftClick[index] = false;
5126 }5126 }
5127 if (_oldHandRightClick[index]) {5127 if (_oldHandRightClick[index]) {
5128 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);5128 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);
5129 5129
5130 qApp->mouseReleaseEvent(&mouseEvent, deviceID);5130 mouseReleaseEvent(&mouseEvent, deviceID);
5131 5131
5132 _oldHandRightClick[index] = false;5132 _oldHandRightClick[index] = false;
5133 }5133 }
@@ -5141,7 +5141,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 7 unmodified lines
5141 // Only send the mouse event if the opposite left button isnt held down.5141 // Only send the mouse event if the opposite left button isnt held down.
5142 // Is this check necessary?5142 // Is this check necessary?
5143 if (!_oldHandLeftClick[(int)(!index)]) {5143 if (!_oldHandLeftClick[(int)(!index)]) {
5144 qApp->mouseMoveEvent(&mouseEvent, deviceID);5144 mouseMoveEvent(&mouseEvent, deviceID);
5145 }5145 }
5146 }5146 }
5147 _oldHandMouseX[index] = pos.x();5147 _oldHandMouseX[index] = pos.x();
@@ -5162,12 +5162,12 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 14 unmodified lines
5162 5162
5163 QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::RightButton, 0);5163 QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::RightButton, 0);
5164 5164
5165 qApp->mousePressEvent(&mouseEvent, deviceID);5165 mousePressEvent(&mouseEvent, deviceID);
5166 }5166 }
5167 } else if (_oldHandRightClick[index]) {5167 } else if (_oldHandRightClick[index]) {
5168 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);5168 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);
5169 5169
5170 qApp->mouseReleaseEvent(&mouseEvent, deviceID);5170 mouseReleaseEvent(&mouseEvent, deviceID);
5171 5171
5172 _oldHandRightClick[index] = false;5172 _oldHandRightClick[index] = false;
5173 }5173 }
@@ -5179,12 +5179,12 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index) · 5 unmodified lines
5179 5179
5180 QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, 0);5180 QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, 0);
5181 5181
5182 qApp->mousePressEvent(&mouseEvent, deviceID);5182 mousePressEvent(&mouseEvent, deviceID);
5183 }5183 }
5184 } else if (_oldHandLeftClick[index]) {5184 } else if (_oldHandLeftClick[index]) {
5185 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);5185 QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);
5186 5186
5187 qApp->mouseReleaseEvent(&mouseEvent, deviceID);5187 mouseReleaseEvent(&mouseEvent, deviceID);
5188 5188
5189 _oldHandLeftClick[index] = false;5189 _oldHandLeftClick[index] = false;
5190 }5190 }