Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 124 files). Show all
Unified · Split
| @@ -198,8 +198,7 @@ void WindowScriptingInterface::ensureReticleVisible() const { · 197 unmodified lines | |||
| 198 | /// Display a "browse to directory" dialog. If `directory` is an invalid file or directory the browser will start at the current | 198 | /// Display a "browse to directory" dialog. If `directory` is an invalid file or directory the browser will start at the current |
| 199 | /// working directory. | 199 | /// working directory. |
| 200 | /// \param const QString& title title of the window | 200 | /// \param const QString& title title of the window |
| 201 | /// \param const QString& directory directory to start the file browser at | 201 | /// \param const QString& directory directory to start the directory browser at |
| 202 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` | ||
| 203 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` | 202 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` |
| 204 | QScriptValue WindowScriptingInterface::browseDir(const QString& title, const QString& directory) { | 203 | QScriptValue WindowScriptingInterface::browseDir(const QString& title, const QString& directory) { |
| 205 | ensureReticleVisible(); | 204 | ensureReticleVisible(); |
| @@ -220,8 +219,7 @@ QScriptValue WindowScriptingInterface::browseDir(const QString& title, const QSt · 14 unmodified lines | |||
| 220 | /// Display a "browse to directory" dialog. If `directory` is an invalid file or directory the browser will start at the current | 219 | /// Display a "browse to directory" dialog. If `directory` is an invalid file or directory the browser will start at the current |
| 221 | /// working directory. | 220 | /// working directory. |
| 222 | /// \param const QString& title title of the window | 221 | /// \param const QString& title title of the window |
| 223 | /// \param const QString& directory directory to start the file browser at | 222 | /// \param const QString& directory directory to start the directory browser at |
| 224 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` | ||
| 225 | void WindowScriptingInterface::browseDirAsync(const QString& title, const QString& directory) { | 223 | void WindowScriptingInterface::browseDirAsync(const QString& title, const QString& directory) { |
| 226 | ensureReticleVisible(); | 224 | ensureReticleVisible(); |
| 227 | QString path = directory; | 225 | QString path = directory; |
| @@ -465,6 +463,41 @@ int WindowScriptingInterface::openMessageBox(QString title, QString text, int bu · 237 unmodified lines | |||
| 465 | return createMessageBox(title, text, buttons, defaultButton); | 463 | return createMessageBox(title, text, buttons, defaultButton); |
| 466 | } | 464 | } |
| 467 | 465 | ||
| 466 | /**jsdoc | ||
| 467 | * <p>The buttons that may be included in a message box created by {@link Window.openMessageBox|openMessageBox} are defined by | ||
| 468 | * numeric values: | ||
| 469 | * <table> | ||
| 470 | * <thead> | ||
| 471 | * <tr> | ||
| 472 | * <th>Button</th> | ||
| 473 | * <th>Value</th> | ||
| 474 | * <th>Description</th> | ||
| 475 | * </tr> | ||
| 476 | * </thead> | ||
| 477 | * <tbody> | ||
| 478 | * <tr> <td><strong>NoButton</strong></td> <td><code>0x0</code></td> <td>An invalid button.</td> </tr> | ||
| 479 | * <tr> <td><strong>Ok</strong></td> <td><code>0x400</code></td> <td>"OK"</td> </tr> | ||
| 480 | * <tr> <td><strong>Save</strong></td> <td><code>0x800</code></td> <td>"Save"</td> </tr> | ||
| 481 | * <tr> <td><strong>SaveAll</strong></td> <td><code>0x1000</code></td> <td>"Save All"</td> </tr> | ||
| 482 | * <tr> <td><strong>Open</strong></td> <td><code>0x2000</code></td> <td>"Open"</td> </tr> | ||
| 483 | * <tr> <td><strong>Yes</strong></td> <td><code>0x4000</code></td> <td>"Yes"</td> </tr> | ||
| 484 | * <tr> <td><strong>YesToAll</strong></td> <td><code>0x8000</code></td> <td>"Yes to All"</td> </tr> | ||
| 485 | * <tr> <td><strong>No</strong></td> <td><code>0x10000</code></td> <td>"No"</td> </tr> | ||
| 486 | * <tr> <td><strong>NoToAll</strong></td> <td><code>0x20000</code></td> <td>"No to All"</td> </tr> | ||
| 487 | * <tr> <td><strong>Abort</strong></td> <td><code>0x40000</code></td> <td>"Abort"</td> </tr> | ||
| 488 | * <tr> <td><strong>Retry</strong></td> <td><code>0x80000</code></td> <td>"Retry"</td> </tr> | ||
| 489 | * <tr> <td><strong>Ignore</strong></td> <td><code>0x100000</code></td> <td>"Ignore"</td> </tr> | ||
| 490 | * <tr> <td><strong>Close</strong></td> <td><code>0x200000</code></td> <td>"Close"</td> </tr> | ||
| 491 | * <tr> <td><strong>Cancel</strong></td> <td><code>0x400000</code></td> <td>"Cancel"</td> </tr> | ||
| 492 | * <tr> <td><strong>Discard</strong></td> <td><code>0x800000</code></td> <td>"Discard" or "Don't Save"</td> </tr> | ||
| 493 | * <tr> <td><strong>Help</strong></td> <td><code>0x1000000</code></td> <td>"Help"</td> </tr> | ||
| 494 | * <tr> <td><strong>Apply</strong></td> <td><code>0x2000000</code></td> <td>"Apply"</td> </tr> | ||
| 495 | * <tr> <td><strong>Reset</strong></td> <td><code>0x4000000</code></td> <td>"Reset"</td> </tr> | ||
| 496 | * <tr> <td><strong>RestoreDefaults</strong></td> <td><code>0x8000000</code></td> <td>"Restore Defaults"</td> </tr> | ||
| 497 | * </tbody> | ||
| 498 | * </table> | ||
| 499 | * @typedef Window.MessageBoxButton | ||
| 500 | */ | ||
| 468 | int WindowScriptingInterface::createMessageBox(QString title, QString text, int buttons, int defaultButton) { | 501 | int WindowScriptingInterface::createMessageBox(QString title, QString text, int buttons, int defaultButton) { |
| 469 | auto messageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION, title, text, | 502 | auto messageBox = DependencyManager::get<OffscreenUi>()->createMessageBox(OffscreenUi::ICON_INFORMATION, title, text, |
| 470 | static_cast<QFlags<QMessageBox::StandardButton>>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton)); | 503 | static_cast<QFlags<QMessageBox::StandardButton>>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton)); |