Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include "DomainHandler.h" | 21 | #include "DomainHandler.h" |
| 22 | #include "MainWindow.h" | 22 | #include "MainWindow.h" |
| 23 | #include "Menu.h" | 23 | #include "Menu.h" |
| 24 | #include "OffscreenUi.h" | ||
| 24 | #include "ui/ModelsBrowser.h" | 25 | #include "ui/ModelsBrowser.h" |
| 25 | 26 | ||
| 26 | #include "WindowScriptingInterface.h" | 27 | #include "WindowScriptingInterface.h" |
| @@ -153,12 +154,11 @@ QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue fo · 126 unmodified lines | |||
| 153 | return retVal; | 154 | return retVal; |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | |||
| 157 | /// Display an alert box | 157 | /// Display an alert box |
| 158 | /// \param const QString& message message to display | 158 | /// \param const QString& message message to display |
| 159 | /// \return QScriptValue::UndefinedValue | 159 | /// \return QScriptValue::UndefinedValue |
| 160 | QScriptValue WindowScriptingInterface::showAlert(const QString& message) { | 160 | QScriptValue WindowScriptingInterface::showAlert(const QString& message) { |
| 161 | QMessageBox::warning(qApp->getWindow(), "", message); | 161 | OffscreenUi::warning("", message); |
| 162 | return QScriptValue::UndefinedValue; | 162 | return QScriptValue::UndefinedValue; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| @@ -166,8 +166,16 @@ QScriptValue WindowScriptingInterface::showAlert(const QString& message) { · 1 unmodified line | |||
| 166 | /// \param const QString& message message to display | 166 | /// \param const QString& message message to display |
| 167 | /// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise | 167 | /// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise |
| 168 | QScriptValue WindowScriptingInterface::showConfirm(const QString& message) { | 168 | QScriptValue WindowScriptingInterface::showConfirm(const QString& message) { |
| 169 | QMessageBox::StandardButton response = QMessageBox::question(qApp->getWindow(), "", message); | 169 | bool confirm = false; |
| 170 | return QScriptValue(response == QMessageBox::Yes); | 170 | bool waiting = true; |
| 171 | OffscreenUi::question("", message, [&](QMessageBox::StandardButton response){ | ||
| 172 | confirm = (response == QMessageBox::Yes); | ||
| 173 | waiting = false; | ||
| 174 | }); | ||
| 175 | while (waiting) { | ||
| 176 | QCoreApplication::processEvents(); | ||
| 177 | } | ||
| 178 | return QScriptValue(confirm); | ||
| 171 | } | 179 | } |
| 172 | 180 | ||
| 173 | void WindowScriptingInterface::chooseDirectory() { | 181 | void WindowScriptingInterface::chooseDirectory() { |
| @@ -597,7 +605,6 @@ QScriptValue WindowScriptingInterface::showPrompt(const QString& message, const · 423 unmodified lines | |||
| 597 | if (promptDialog.exec() == QDialog::Accepted) { | 605 | if (promptDialog.exec() == QDialog::Accepted) { |
| 598 | return QScriptValue(promptDialog.textValue()); | 606 | return QScriptValue(promptDialog.textValue()); |
| 599 | } | 607 | } |
| 600 | |||
| 601 | return QScriptValue::NullValue; | 608 | return QScriptValue::NullValue; |
| 602 | } | 609 | } |
| 603 | 610 | ||