Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 14 files). Show all
Unified · Split
| @@ -77,6 +77,7 @@ WindowScriptingInterface::~WindowScriptingInterface() { · 76 unmodified lines | ||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | ScriptValue WindowScriptingInterface::hasFocus() { |
| 80 | + Q_ASSERT(engine); | |
| 80 | 81 | return engine()->newValue(qApp->hasFocus()); |
| 81 | 82 | } |
| 82 | 83 | |
| @@ -105,6 +106,7 @@ void WindowScriptingInterface::alert(const QString& message) { · 22 unmodified lines | ||
| 105 | 106 | /// \param const QString& message message to display |
| 106 | 107 | /// \return ScriptValue `true` if 'Yes' was clicked, `false` otherwise |
| 107 | 108 | ScriptValue WindowScriptingInterface::confirm(const QString& message) { |
| 109 | + Q_ASSERT(engine); | |
| 108 | 110 | return engine()->newValue((QMessageBox::Yes == OffscreenUi::question("", message, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))); |
| 109 | 111 | } |
| 110 | 112 | |
| @@ -114,6 +116,7 @@ ScriptValue WindowScriptingInterface::confirm(const QString& message) { · 3 unmodified lines | ||
| 114 | 116 | /// \return ScriptValue string text value in text box if the dialog was accepted, `null` otherwise. |
| 115 | 117 | ScriptValue WindowScriptingInterface::prompt(const QString& message, const QString& defaultText) { |
| 116 | 118 | QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText); |
| 119 | + Q_ASSERT(engine); | |
| 117 | 120 | auto sResult = engine()->newValue(result); |
| 118 | 121 | if (sResult.equals(engine()->newValue(""))) { |
| 119 | 122 | return engine()->nullValue(); |
| @@ -232,6 +235,7 @@ ScriptValue WindowScriptingInterface::browseDir(const QString& title, const QStr · 112 unmodified lines | ||
| 232 | 235 | if (!result.isEmpty()) { |
| 233 | 236 | setPreviousBrowseLocation(QFileInfo(result).absolutePath()); |
| 234 | 237 | } |
| 238 | + Q_ASSERT(engine); | |
| 235 | 239 | return result.isEmpty() ? engine()->nullValue() : engine()->newValue(result); |
| 236 | 240 | } |
| 237 | 241 | |
| @@ -276,6 +280,7 @@ ScriptValue WindowScriptingInterface::browse(const QString& title, const QString · 38 unmodified lines | ||
| 276 | 280 | if (!result.isEmpty()) { |
| 277 | 281 | setPreviousBrowseLocation(QFileInfo(result).absolutePath()); |
| 278 | 282 | } |
| 283 | + Q_ASSERT(engine); | |
| 279 | 284 | return result.isEmpty() ? engine()->nullValue() : engine()->newValue(result); |
| 280 | 285 | } |
| 281 | 286 | |
| @@ -323,6 +328,7 @@ ScriptValue WindowScriptingInterface::save(const QString& title, const QString& · 41 unmodified lines | ||
| 323 | 328 | if (!result.isEmpty()) { |
| 324 | 329 | setPreviousBrowseLocation(QFileInfo(result).absolutePath()); |
| 325 | 330 | } |
| 331 | + Q_ASSERT(engine); | |
| 326 | 332 | return result.isEmpty() ? engine()->nullValue() : engine()->newValue(result); |
| 327 | 333 | } |
| 328 | 334 | |
| @@ -373,6 +379,7 @@ ScriptValue WindowScriptingInterface::browseAssets(const QString& title, const Q · 44 unmodified lines | ||
| 373 | 379 | if (!result.isEmpty()) { |
| 374 | 380 | setPreviousBrowseAssetLocation(QFileInfo(result).absolutePath()); |
| 375 | 381 | } |
| 382 | + Q_ASSERT(engine); | |
| 376 | 383 | return result.isEmpty() ? engine()->nullValue() : engine()->newValue(result); |
| 377 | 384 | } |
| 378 | 385 | |