Don't ask about differences over after the user has said no -- until the external file changes again.

This commit is contained in:
Howard Stearns 2016-03-17 19:58:28 -07:00
parent d59d5549a1
commit 0cbddb217c

View file

@ -224,17 +224,18 @@ void ScriptEditorWidget::onWindowActivated() {
if (!_isReloading) { if (!_isReloading) {
_isReloading = true; _isReloading = true;
if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) { QDateTime fileStamp = QFileInfo(_currentScript).lastModified();
if (fileStamp > _currentScriptModified) {
bool doReload = false; bool doReload = false;
auto window = static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent()); auto window = static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent());
window->inModalDialog = true; window->inModalDialog = true;
if (window->autoReloadScripts() if (window->autoReloadScripts()
|| OffscreenUi::question(this, tr("Reload Script"), || OffscreenUi::question(this, tr("Reload Script"),
tr("The following file has been modified outside of the Interface editor:") + "\n" + _currentScript + "\n" tr("The following file has been modified outside of the Interface editor:") + "\n" + _currentScript + "\n"
+ (isModified() + (isModified()
? tr("Do you want to reload it and lose the changes you've made in the Interface editor?") ? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
: tr("Do you want to reload it?")), : tr("Do you want to reload it?")),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
doReload = true; doReload = true;
} }
window->inModalDialog = false; window->inModalDialog = false;
@ -245,8 +246,10 @@ void ScriptEditorWidget::onWindowActivated() {
setRunning(false); setRunning(false);
// Script is restarted once current script instance finishes. // Script is restarted once current script instance finishes.
} }
} else {
_currentScriptModified = fileStamp; // Asked and answered. Don't ask again until the external file is changed again.
} }
} }
_isReloading = false; _isReloading = false;
} }
} }