History

migrate callers of QMessageBox::warning() to OffscreenUi::warning()

Brad Hefta-Gaub committed 10 years ago

Commit 927fe971 parent d98c2d111 files · +57 −26Browse files

Showing the changes to interface/src/ui/ScriptEditorWidget.cpp (1 of 11 files). Show all

Unified · Split

interface/src/ui/ScriptEditorWidget.cpp+5−4
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <QWidget>
2727
2828 #include <NetworkAccessManager.h>
29+#include <OffscreenUi.h>
2930
3031 #include "Application.h"
3132 #include "ScriptHighlighting.h"
@@ -120,7 +121,7 @@ bool ScriptEditorWidget::setRunning(bool run) { · 88 unmodified lines
120121 bool ScriptEditorWidget::saveFile(const QString &scriptPath) {
121122 QFile file(scriptPath);
122123 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)
124125 .arg(file.errorString()));
125126 return false;
126127 }
@@ -141,7 +142,7 @@ void ScriptEditorWidget::loadFile(const QString& scriptPath) { · 14 unmodified lines
141142 if (url.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) {
142143 QFile file(scriptPath);
143144 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)
145146 .arg(file.errorString()));
146147 return;
147148 }
@@ -208,7 +209,7 @@ void ScriptEditorWidget::setScriptFile(const QString& scriptPath) { · 60 unmodified lines
208209
209210 bool ScriptEditorWidget::questionSave() {
210211 if (_scriptEditorWidgetUI->scriptEdit->document()->isModified()) {
211− QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Interface"),
212+ QMessageBox::StandardButton button = OffscreenUi::warning(this, tr("Interface"),
212213 tr("The script has been modified.\nDo you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard |
213214 QMessageBox::Cancel, QMessageBox::Save);
214215 return button == QMessageBox::Save ? save() : (button == QMessageBox::Discard);
@@ -222,7 +223,7 @@ void ScriptEditorWidget::onWindowActivated() { · 7 unmodified lines
222223
223224 if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) {
224225 if (static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent())->autoReloadScripts()
225− || QMessageBox::warning(this, _currentScript,
226+ || OffscreenUi::warning(this, _currentScript,
226227 tr("This file has been modified outside of the Interface editor.") + "\n\n"
227228 + (isModified()
228229 ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")