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