Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -16,6 +16,8 @@ · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | #include <SettingHandle.h> | 17 | #include <SettingHandle.h> |
| 18 | 18 | ||
| 19 | #include <display-plugins/CompositorHelper.h> | ||
| 20 | |||
| 19 | #include "Application.h" | 21 | #include "Application.h" |
| 20 | #include "DomainHandler.h" | 22 | #include "DomainHandler.h" |
| 21 | #include "MainWindow.h" | 23 | #include "MainWindow.h" |
| @@ -147,6 +149,15 @@ void WindowScriptingInterface::setPreviousBrowseLocation(const QString& location · 125 unmodified lines | |||
| 147 | Setting::Handle<QVariant>(LAST_BROWSE_LOCATION_SETTING).set(location); | 149 | Setting::Handle<QVariant>(LAST_BROWSE_LOCATION_SETTING).set(location); |
| 148 | } | 150 | } |
| 149 | 151 | ||
| 152 | /// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and | ||
| 153 | /// might be in same thread as a script that sets the reticle to invisible | ||
| 154 | void WindowScriptingInterface::ensureReticleVisible() const { | ||
| 155 | auto compositorHelper = DependencyManager::get<CompositorHelper>(); | ||
| 156 | if (!compositorHelper->getReticleVisible()) { | ||
| 157 | compositorHelper->setReticleVisible(true); | ||
| 158 | } | ||
| 159 | } | ||
| 160 | |||
| 150 | /// Display an open file dialog. If `directory` is an invalid file or directory the browser will start at the current | 161 | /// Display an open file dialog. If `directory` is an invalid file or directory the browser will start at the current |
| 151 | /// working directory. | 162 | /// working directory. |
| 152 | /// \param const QString& title title of the window | 163 | /// \param const QString& title title of the window |
| @@ -154,6 +165,7 @@ void WindowScriptingInterface::setPreviousBrowseLocation(const QString& location · 1 unmodified line | |||
| 154 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` | 165 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` |
| 155 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` | 166 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` |
| 156 | QScriptValue WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) { | 167 | QScriptValue WindowScriptingInterface::browse(const QString& title, const QString& directory, const QString& nameFilter) { |
| 168 | ensureReticleVisible(); | ||
| 157 | QString path = directory; | 169 | QString path = directory; |
| 158 | if (path.isEmpty()) { | 170 | if (path.isEmpty()) { |
| 159 | path = getPreviousBrowseLocation(); | 171 | path = getPreviousBrowseLocation(); |
| @@ -175,6 +187,7 @@ QScriptValue WindowScriptingInterface::browse(const QString& title, const QStrin · 15 unmodified lines | |||
| 175 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` | 187 | /// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog` |
| 176 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` | 188 | /// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue` |
| 177 | QScriptValue WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) { | 189 | QScriptValue WindowScriptingInterface::save(const QString& title, const QString& directory, const QString& nameFilter) { |
| 190 | ensureReticleVisible(); | ||
| 178 | QString path = directory; | 191 | QString path = directory; |
| 179 | if (path.isEmpty()) { | 192 | if (path.isEmpty()) { |
| 180 | path = getPreviousBrowseLocation(); | 193 | path = getPreviousBrowseLocation(); |