Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 170 files). Show all
Unified · Split
| @@ -76,7 +76,7 @@ WindowScriptingInterface::~WindowScriptingInterface() { · 75 unmodified lines | |||
| 76 | _messageBoxes.clear(); | 76 | _messageBoxes.clear(); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | ScriptValuePointer WindowScriptingInterface::hasFocus() { | 79 | ScriptValue WindowScriptingInterface::hasFocus() { |
| 80 | return engine()->newValue(qApp->hasFocus()); | 80 | return engine()->newValue(qApp->hasFocus()); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| @@ -96,26 +96,26 @@ void WindowScriptingInterface::raise() { · 13 unmodified lines | |||
| 96 | 96 | ||
| 97 | /// Display an alert box | 97 | /// Display an alert box |
| 98 | /// \param const QString& message message to display | 98 | /// \param const QString& message message to display |
| 99 | /// \return ScriptValuePointer::UndefinedValue | 99 | /// \return ScriptValue::UndefinedValue |
| 100 | void WindowScriptingInterface::alert(const QString& message) { | 100 | void WindowScriptingInterface::alert(const QString& message) { |
| 101 | OffscreenUi::asyncWarning("", message, QMessageBox::Ok, QMessageBox::Ok); | 101 | OffscreenUi::asyncWarning("", message, QMessageBox::Ok, QMessageBox::Ok); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | /// Display a confirmation box with the options 'Yes' and 'No' | 104 | /// Display a confirmation box with the options 'Yes' and 'No' |
| 105 | /// \param const QString& message message to display | 105 | /// \param const QString& message message to display |
| 106 | /// \return ScriptValuePointer `true` if 'Yes' was clicked, `false` otherwise | 106 | /// \return ScriptValue `true` if 'Yes' was clicked, `false` otherwise |
| 107 | ScriptValuePointer WindowScriptingInterface::confirm(const QString& message) { | 107 | ScriptValue WindowScriptingInterface::confirm(const QString& message) { |
| 108 | return engine()->newValue((QMessageBox::Yes == OffscreenUi::question("", message, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))); | 108 | return engine()->newValue((QMessageBox::Yes == OffscreenUi::question("", message, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /// Display a prompt with a text box | 111 | /// Display a prompt with a text box |
| 112 | /// \param const QString& message message to display | 112 | /// \param const QString& message message to display |
| 113 | /// \param const QString& defaultText default text in the text box | 113 | /// \param const QString& defaultText default text in the text box |
| 114 | /// \return ScriptValuePointer string text value in text box if the dialog was accepted, `null` otherwise. | 114 | /// \return ScriptValue string text value in text box if the dialog was accepted, `null` otherwise. |
| 115 | ScriptValuePointer WindowScriptingInterface::prompt(const QString& message, const QString& defaultText) { | 115 | ScriptValue WindowScriptingInterface::prompt(const QString& message, const QString& defaultText) { |
| 116 | QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText); | 116 | QString result = OffscreenUi::getText(nullptr, "", message, QLineEdit::Normal, defaultText); |
| 117 | auto sResult = engine()->newValue(result); | 117 | auto sResult = engine()->newValue(result); |
| 118 | if (sResult->equals(engine()->newValue(""))) { | 118 | if (sResult.equals(engine()->newValue(""))) { |
| 119 | return engine()->nullValue(); | 119 | return engine()->nullValue(); |
| 120 | } | 120 | } |
| 121 | return sResult; | 121 | return sResult; |
| @@ -218,8 +218,8 @@ void WindowScriptingInterface::ensureReticleVisible() const { · 96 unmodified lines | |||
| 218 | /// working directory. | 218 | /// working directory. |
| 219 | /// \param const QString& title title of the window | 219 | /// \param const QString& title title of the window |
| 220 | /// \param const QString& directory directory to start the directory browser at | 220 | /// \param const QString& directory directory to start the directory browser at |
| 221 | /// \return ScriptValuePointer file path as a string if one was selected, otherwise `ScriptValuePointer::NullValue` | 221 | /// \return ScriptValue file path as a string if one was selected, otherwise `ScriptValue::NullValue` |
| 222 | ScriptValuePointer WindowScriptingInterface::browseDir(const QString& title, const QString& directory) { | 222 | ScriptValue WindowScriptingInterface::browseDir(const QString& title, const QString& directory) { |
| 223 | ensureReticleVisible(); | 223 | ensureReticleVisible(); |
| 224 | QString path = directory; | 224 | QString path = directory; |
| 225 | if (path.isEmpty()) { | 225 | if (path.isEmpty()) { |
| @@ -262,8 +262,8 @@ void WindowScriptingInterface::browseDirAsync(const QString& title, const QStrin · 36 unmodified lines | |||
| 262 | /// \param const QString& title title of the window | 262 | /// \param const QString& title title of the window |
| 263 | /// \param const QString& directory directory to start the file browser at | 263 | /// \param const QString& directory directory to start the file browser at |
| 264 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` | 264 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` |
| 265 | /// \return ScriptValuePointer file path as a string if one was selected, otherwise `ScriptValuePointer::NullValue` | 265 | /// \return ScriptValue file path as a string if one was selected, otherwise `ScriptValue::NullValue` |
| 266 | ScriptValuePointer WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) { | 266 | ScriptValue WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) { |
| 267 | ensureReticleVisible(); | 267 | ensureReticleVisible(); |
| 268 | QString path = directory; | 268 | QString path = directory; |
| 269 | if (path.isEmpty()) { | 269 | if (path.isEmpty()) { |
| @@ -309,8 +309,8 @@ void WindowScriptingInterface::browseAsync(const QString& title, const QString& · 39 unmodified lines | |||
| 309 | /// \param const QString& title title of the window | 309 | /// \param const QString& title title of the window |
| 310 | /// \param const QString& directory directory to start the file browser at | 310 | /// \param const QString& directory directory to start the file browser at |
| 311 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` | 311 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` |
| 312 | /// \return ScriptValuePointer file path as a string if one was selected, otherwise `ScriptValuePointer::NullValue` | 312 | /// \return ScriptValue file path as a string if one was selected, otherwise `ScriptValue::NullValue` |
| 313 | ScriptValuePointer WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) { | 313 | ScriptValue WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) { |
| 314 | ensureReticleVisible(); | 314 | ensureReticleVisible(); |
| 315 | QString path = directory; | 315 | QString path = directory; |
| 316 | if (path.isEmpty()) { | 316 | if (path.isEmpty()) { |
| @@ -356,8 +356,8 @@ void WindowScriptingInterface::saveAsync(const QString& title, const QString& di · 39 unmodified lines | |||
| 356 | /// \param const QString& title title of the window | 356 | /// \param const QString& title title of the window |
| 357 | /// \param const QString& directory directory to start the asset browser at | 357 | /// \param const QString& directory directory to start the asset browser at |
| 358 | /// \param const QString& nameFilter filter to filter asset names by - see `QFileDialog` | 358 | /// \param const QString& nameFilter filter to filter asset names by - see `QFileDialog` |
| 359 | /// \return ScriptValuePointer asset path as a string if one was selected, otherwise `ScriptValuePointer::NullValue` | 359 | /// \return ScriptValue asset path as a string if one was selected, otherwise `ScriptValue::NullValue` |
| 360 | ScriptValuePointer WindowScriptingInterface::browseAssets(const QString& title, const QString& directory, const QString& nameFilter) { | 360 | ScriptValue WindowScriptingInterface::browseAssets(const QString& title, const QString& directory, const QString& nameFilter) { |
| 361 | ensureReticleVisible(); | 361 | ensureReticleVisible(); |
| 362 | QString path = directory; | 362 | QString path = directory; |
| 363 | if (path.isEmpty()) { | 363 | if (path.isEmpty()) { |