Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 37 files). Show all
Unified · Split
| @@ -32,8 +32,8 @@ WindowScriptingInterface::WindowScriptingInterface() : · 31 unmodified lines | ||
| 32 | 32 | { |
| 33 | 33 | const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler(); |
| 34 | 34 | connect(&domainHandler, &DomainHandler::connectedToDomain, this, &WindowScriptingInterface::domainChanged); |
| 35 | − connect(Application::getInstance(), &Application::svoImportRequested, this, &WindowScriptingInterface::svoImportRequested); | |
| 36 | − connect(Application::getInstance(), &Application::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused); | |
| 35 | + connect(qApp, &Application::svoImportRequested, this, &WindowScriptingInterface::svoImportRequested); | |
| 36 | + connect(qApp, &Application::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused); | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height, bool isToolWindow) { |
| @@ -41,13 +41,13 @@ WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title · 1 unmodified line | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | QScriptValue WindowScriptingInterface::hasFocus() { |
| 44 | − return Application::getInstance()->hasFocus(); | |
| 44 | + return qApp->hasFocus(); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | void WindowScriptingInterface::setFocus() { |
| 48 | 48 | // It's forbidden to call focus() from another thread. |
| 49 | − Application::getInstance()->postLambdaEvent([] { | |
| 50 | − auto window = Application::getInstance()->getWindow(); | |
| 49 | + qApp->postLambdaEvent([] { | |
| 50 | + auto window = qApp->getWindow(); | |
| 51 | 51 | window->activateWindow(); |
| 52 | 52 | window->setFocus(); |
| 53 | 53 | }); |
| @@ -55,18 +55,18 @@ void WindowScriptingInterface::setFocus() { · 1 unmodified line | ||
| 55 | 55 | |
| 56 | 56 | void WindowScriptingInterface::raiseMainWindow() { |
| 57 | 57 | // It's forbidden to call raise() from another thread. |
| 58 | − Application::getInstance()->postLambdaEvent([] { | |
| 59 | − Application::getInstance()->getWindow()->raise(); | |
| 58 | + qApp->postLambdaEvent([] { | |
| 59 | + qApp->getWindow()->raise(); | |
| 60 | 60 | }); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | void WindowScriptingInterface::setCursorVisible(bool visible) { |
| 64 | − QMetaObject::invokeMethod(Application::getInstance(), "setCursorVisible", Qt::BlockingQueuedConnection, | |
| 64 | + QMetaObject::invokeMethod(qApp, "setCursorVisible", Qt::BlockingQueuedConnection, | |
| 65 | 65 | Q_ARG(bool, visible)); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | bool WindowScriptingInterface::isCursorVisible() const { |
| 69 | − return !Application::getInstance()->isMouseHidden(); | |
| 69 | + return !qApp->isMouseHidden(); | |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | void WindowScriptingInterface::setCursorPosition(int x, int y) { |
| @@ -167,7 +167,7 @@ QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue fo · 94 unmodified lines | ||
| 167 | 167 | /// \param const QString& message message to display |
| 168 | 168 | /// \return QScriptValue::UndefinedValue |
| 169 | 169 | QScriptValue WindowScriptingInterface::showAlert(const QString& message) { |
| 170 | − QMessageBox::warning(Application::getInstance()->getWindow(), "", message); | |
| 170 | + QMessageBox::warning(qApp->getWindow(), "", message); | |
| 171 | 171 | return QScriptValue::UndefinedValue; |
| 172 | 172 | } |
| 173 | 173 | |
| @@ -175,7 +175,7 @@ QScriptValue WindowScriptingInterface::showAlert(const QString& message) { · 1 unmodified line | ||
| 175 | 175 | /// \param const QString& message message to display |
| 176 | 176 | /// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise |
| 177 | 177 | QScriptValue WindowScriptingInterface::showConfirm(const QString& message) { |
| 178 | − QMessageBox::StandardButton response = QMessageBox::question(Application::getInstance()->getWindow(), "", message); | |
| 178 | + QMessageBox::StandardButton response = QMessageBox::question(qApp->getWindow(), "", message); | |
| 179 | 179 | return QScriptValue(response == QMessageBox::Yes); |
| 180 | 180 | } |
| 181 | 181 | |
| @@ -487,7 +487,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal · 305 unmodified lines | ||
| 487 | 487 | |
| 488 | 488 | |
| 489 | 489 | QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue form) { |
| 490 | − QDialog* editDialog = new QDialog(Application::getInstance()->getWindow()); | |
| 490 | + QDialog* editDialog = new QDialog(qApp->getWindow()); | |
| 491 | 491 | editDialog->setWindowTitle(title); |
| 492 | 492 | |
| 493 | 493 | bool cancelButton = false; |
| @@ -597,7 +597,7 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue · 103 unmodified lines | ||
| 597 | 597 | /// \param const QString& defaultText default text in the text box |
| 598 | 598 | /// \return QScriptValue string text value in text box if the dialog was accepted, `null` otherwise. |
| 599 | 599 | QScriptValue WindowScriptingInterface::showPrompt(const QString& message, const QString& defaultText) { |
| 600 | − QInputDialog promptDialog(Application::getInstance()->getWindow()); | |
| 600 | + QInputDialog promptDialog(qApp->getWindow()); | |
| 601 | 601 | promptDialog.setWindowTitle(""); |
| 602 | 602 | promptDialog.setLabelText(message); |
| 603 | 603 | promptDialog.setTextValue(defaultText); |
| @@ -627,7 +627,7 @@ QScriptValue WindowScriptingInterface::showBrowse(const QString& title, const QS · 23 unmodified lines | ||
| 627 | 627 | path = fileInfo.filePath(); |
| 628 | 628 | } |
| 629 | 629 | |
| 630 | − QFileDialog fileDialog(Application::getInstance()->getWindow(), title, path, nameFilter); | |
| 630 | + QFileDialog fileDialog(qApp->getWindow(), title, path, nameFilter); | |
| 631 | 631 | fileDialog.setAcceptMode(acceptMode); |
| 632 | 632 | QUrl fileUrl(directory); |
| 633 | 633 | if (acceptMode == QFileDialog::AcceptSave) { |
| @@ -657,17 +657,17 @@ QScriptValue WindowScriptingInterface::showS3Browse(const QString& nameFilter) { · 23 unmodified lines | ||
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | int WindowScriptingInterface::getInnerWidth() { |
| 660 | − return Application::getInstance()->getWindow()->geometry().width(); | |
| 660 | + return qApp->getWindow()->geometry().width(); | |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | int WindowScriptingInterface::getInnerHeight() { |
| 664 | − return Application::getInstance()->getWindow()->geometry().height(); | |
| 664 | + return qApp->getWindow()->geometry().height(); | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | int WindowScriptingInterface::getX() { |
| 668 | − return Application::getInstance()->getWindow()->x(); | |
| 668 | + return qApp->getWindow()->x(); | |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | int WindowScriptingInterface::getY() { |
| 672 | − return Application::getInstance()->getWindow()->y(); | |
| 672 | + return qApp->getWindow()->y(); | |
| 673 | 673 | } |