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