History

Add checkbox that automatically reloads externally changed files

David Rowe committed 12 years ago

Commit ce874301 parent c454c794 files · +23 −7Browse files

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

Unified · Split

interface/src/ui/ScriptEditorWidget.cpp+7−6
@@ -219,12 +219,13 @@ void ScriptEditorWidget::onWindowActivated() { · 218 unmodified lines
219219 _isReloading = true;
220220
221221 if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) {
222− if (QMessageBox::warning(this, _currentScript,
223− tr("This file has been modified outside of the Interface editor.") + "\n\n"
224− +(isModified()
225− ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
226− : tr("Do you want to reload it?")),
227− QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
222+ if (static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent())->autoReloadScripts()
223+ || QMessageBox::warning(this, _currentScript,
224+ tr("This file has been modified outside of the Interface editor.") + "\n\n"
225+ + (isModified()
226+ ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
227+ : tr("Do you want to reload it?")),
228+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
228229 loadFile(_currentScript);
229230 if (_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isRunning()) {
230231 _isRestarting = true;