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