Showing the changes to interface/src/ui/ScriptEditorWidget.cpp (1 of 11 files). Show all
Unified · Split
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <QWidget> |
| 27 | 27 | |
| 28 | 28 | #include <NetworkAccessManager.h> |
| 29 | +#include <OffscreenUi.h> | |
| 29 | 30 | |
| 30 | 31 | #include "Application.h" |
| 31 | 32 | #include "ScriptHighlighting.h" |
| @@ -120,7 +121,7 @@ bool ScriptEditorWidget::setRunning(bool run) { · 88 unmodified lines | ||
| 120 | 121 | bool ScriptEditorWidget::saveFile(const QString &scriptPath) { |
| 121 | 122 | QFile file(scriptPath); |
| 122 | 123 | if (!file.open(QFile::WriteOnly | QFile::Text)) { |
| 123 | − QMessageBox::warning(this, tr("Interface"), tr("Cannot write script %1:\n%2.").arg(scriptPath) | |
| 124 | + OffscreenUi::warning(this, tr("Interface"), tr("Cannot write script %1:\n%2.").arg(scriptPath) | |
| 124 | 125 | .arg(file.errorString())); |
| 125 | 126 | return false; |
| 126 | 127 | } |
| @@ -141,7 +142,7 @@ void ScriptEditorWidget::loadFile(const QString& scriptPath) { · 14 unmodified lines | ||
| 141 | 142 | if (url.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) { |
| 142 | 143 | QFile file(scriptPath); |
| 143 | 144 | if (!file.open(QFile::ReadOnly | QFile::Text)) { |
| 144 | − QMessageBox::warning(this, tr("Interface"), tr("Cannot read script %1:\n%2.").arg(scriptPath) | |
| 145 | + OffscreenUi::warning(this, tr("Interface"), tr("Cannot read script %1:\n%2.").arg(scriptPath) | |
| 145 | 146 | .arg(file.errorString())); |
| 146 | 147 | return; |
| 147 | 148 | } |
| @@ -208,7 +209,7 @@ void ScriptEditorWidget::setScriptFile(const QString& scriptPath) { · 60 unmodified lines | ||
| 208 | 209 | |
| 209 | 210 | bool ScriptEditorWidget::questionSave() { |
| 210 | 211 | if (_scriptEditorWidgetUI->scriptEdit->document()->isModified()) { |
| 211 | − QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Interface"), | |
| 212 | + QMessageBox::StandardButton button = OffscreenUi::warning(this, tr("Interface"), | |
| 212 | 213 | tr("The script has been modified.\nDo you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | |
| 213 | 214 | QMessageBox::Cancel, QMessageBox::Save); |
| 214 | 215 | return button == QMessageBox::Save ? save() : (button == QMessageBox::Discard); |
| @@ -222,7 +223,7 @@ void ScriptEditorWidget::onWindowActivated() { · 7 unmodified lines | ||
| 222 | 223 | |
| 223 | 224 | if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) { |
| 224 | 225 | if (static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent())->autoReloadScripts() |
| 225 | − || QMessageBox::warning(this, _currentScript, | |
| 226 | + || OffscreenUi::warning(this, _currentScript, | |
| 226 | 227 | tr("This file has been modified outside of the Interface editor.") + "\n\n" |
| 227 | 228 | + (isModified() |
| 228 | 229 | ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?") |