mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
Add checkbox that automatically reloads externally changed files
This commit is contained in:
parent
c454c790fa
commit
ce874305be
4 changed files with 23 additions and 7 deletions
|
@ -219,12 +219,13 @@ void ScriptEditorWidget::onWindowActivated() {
|
||||||
_isReloading = true;
|
_isReloading = true;
|
||||||
|
|
||||||
if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) {
|
if (QFileInfo(_currentScript).lastModified() > _currentScriptModified) {
|
||||||
if (QMessageBox::warning(this, _currentScript,
|
if (static_cast<ScriptEditorWindow*>(this->parent()->parent()->parent())->autoReloadScripts()
|
||||||
tr("This file has been modified outside of the Interface editor.") + "\n\n"
|
|| QMessageBox::warning(this, _currentScript,
|
||||||
+(isModified()
|
tr("This file has been modified outside of the Interface editor.") + "\n\n"
|
||||||
? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
|
+ (isModified()
|
||||||
: tr("Do you want to reload it?")),
|
? tr("Do you want to reload it and lose the changes you've made in the Interface editor?")
|
||||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
: tr("Do you want to reload it?")),
|
||||||
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||||
loadFile(_currentScript);
|
loadFile(_currentScript);
|
||||||
if (_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isRunning()) {
|
if (_scriptEditorWidgetUI->onTheFlyCheckBox->isChecked() && isRunning()) {
|
||||||
_isRestarting = true;
|
_isRestarting = true;
|
||||||
|
|
|
@ -220,6 +220,10 @@ void ScriptEditorWindow::terminateCurrentTab() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScriptEditorWindow::autoReloadScripts() {
|
||||||
|
return _ScriptEditorWindowUI->autoReloadCheckBox->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
bool ScriptEditorWindow::event(QEvent* event) {
|
bool ScriptEditorWindow::event(QEvent* event) {
|
||||||
if (event->type() == QEvent::WindowActivate) {
|
if (event->type() == QEvent::WindowActivate) {
|
||||||
emit windowActivated();
|
emit windowActivated();
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
~ScriptEditorWindow();
|
~ScriptEditorWindow();
|
||||||
|
|
||||||
void terminateCurrentTab();
|
void terminateCurrentTab();
|
||||||
|
bool autoReloadScripts();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void windowActivated();
|
void windowActivated();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0,0">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -185,6 +185,16 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autoReloadCheckBox">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font: 13px "Helvetica","Arial","sans-serif";</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Automatically reload externally changed files</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
Loading…
Reference in a new issue