Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -199,9 +199,9 @@ void WindowScriptingInterface::setInterstitialModeEnabled(bool enableInterstitia · 198 unmodified lines | ||
| 199 | 199 | DependencyManager::get<NodeList>()->getDomainHandler().setInterstitialModeEnabled(enableInterstitialMode); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | −bool WindowScriptingInterface::isPointOnDesktopWindow(QVariant point) { | |
| 203 | − auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 204 | − return offscreenUi->isPointOnDesktopWindow(point); | |
| 202 | +bool WindowScriptingInterface::isPointOnDesktopWindow(QVariant point) { | |
| 203 | + auto offscreenUI = DependencyManager::get<OffscreenUi>(); | |
| 204 | + return offscreenUI ? offscreenUI->isPointOnDesktopWindow(point) : false; | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and |
| @@ -553,12 +553,14 @@ int WindowScriptingInterface::openMessageBox(QString title, QString text, int bu · 345 unmodified lines | ||
| 553 | 553 | * @typedef {number} Window.MessageBoxButton |
| 554 | 554 | */ |
| 555 | 555 | int WindowScriptingInterface::createMessageBox(QString title, QString text, int buttons, int defaultButton) { |
| 556 | − auto messageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION, title, text, | |
| 557 | − static_cast<QFlags<QMessageBox::StandardButton>>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton)); | |
| 558 | − connect(messageBox, SIGNAL(selected(int)), this, SLOT(onMessageBoxSelected(int))); | |
| 556 | + if (auto offscreenUI = DependencyManager::get<OffscreenUi>()) { | |
| 557 | + auto messageBox = offscreenUI->createMessageBox(OffscreenUi::ICON_INFORMATION, title, text, | |
| 558 | + static_cast<QFlags<QMessageBox::StandardButton>>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton)); | |
| 559 | + connect(messageBox, SIGNAL(selected(int)), this, SLOT(onMessageBoxSelected(int))); | |
| 559 | 560 | |
| 560 | − _lastMessageBoxID += 1; | |
| 561 | − _messageBoxes.insert(_lastMessageBoxID, messageBox); | |
| 561 | + _lastMessageBoxID += 1; | |
| 562 | + _messageBoxes.insert(_lastMessageBoxID, messageBox); | |
| 563 | + } | |
| 562 | 564 | |
| 563 | 565 | return _lastMessageBoxID; |
| 564 | 566 | } |
| @@ -646,13 +648,17 @@ void WindowScriptingInterface::setActiveDisplayPlugin(int index) { · 81 unmodified lines | ||
| 646 | 648 | } |
| 647 | 649 | |
| 648 | 650 | void WindowScriptingInterface::openWebBrowser(const QString& url) { |
| 651 | + auto offscreenUI = DependencyManager::get<OffscreenUi>(); | |
| 652 | + if (!offscreenUI) { | |
| 653 | + return; | |
| 654 | + } | |
| 655 | + | |
| 649 | 656 | if (QThread::currentThread() != thread()) { |
| 650 | 657 | QMetaObject::invokeMethod(this, "openWebBrowser", Q_ARG(const QString&, url)); |
| 651 | 658 | return; |
| 652 | 659 | } |
| 653 | 660 | |
| 654 | − auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 655 | − offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) { | |
| 661 | + offscreenUI->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) { | |
| 656 | 662 | if (!url.isEmpty()) { |
| 657 | 663 | newObject->setProperty("url", url); |
| 658 | 664 | } |