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