summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/UI
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2018-05-22 12:08:16 +0300
committerTomi Korpipää <tomi.korpipaa@qt.io>2018-05-22 11:17:56 +0000
commit49e31884c7e6ce796c5275e1bb8ab4fb36a0405e (patch)
tree737fe96b512140286a5321fd0d09d06dda2ed291 /src/Authoring/Studio/UI
parent51f360fc1c48e7b47ea9e984f592e7d597896fd2 (diff)
Restart Studio if settings that require a restart are made
Previously we just told a restart is required (for settings changes), or exited after showing a dialog. Replace both options with actual restart. Task-number: QT3DS-1742 Change-Id: Ie86a618b00f9e24af638bba36efbecb1de1d6760 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Studio/UI')
-rw-r--r--src/Authoring/Studio/UI/StudioAppPrefsPage.cpp38
-rw-r--r--src/Authoring/Studio/UI/StudioAppPrefsPage.h2
-rw-r--r--src/Authoring/Studio/UI/StudioPreferencesPropSheet.cpp12
-rw-r--r--src/Authoring/Studio/UI/StudioPreferencesPropSheet.h6
-rw-r--r--src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp12
-rw-r--r--src/Authoring/Studio/UI/StudioProjectSettingsPage.h2
6 files changed, 31 insertions, 41 deletions
diff --git a/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp b/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
index 4e3cab0e..03d02120 100644
--- a/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
+++ b/src/Authoring/Studio/UI/StudioAppPrefsPage.cpp
@@ -250,14 +250,7 @@ void CStudioAppPrefsPage::saveSettings()
savePreviewSettings();
#endif
- if (m_restartNeeded) {
- // If handles changed, a restart of Studio is needed
- QMessageBox::information(this, tr("Restart Needed"),
- tr("Some settings were changed that require a"
- " restart of the Qt 3D Studio to take effect."));
- // Just show the dialog once (unless the values are changed again)
- m_restartNeeded = false;
- }
+ checkRestartCondition();
}
//==============================================================================
@@ -282,18 +275,6 @@ bool CStudioAppPrefsPage::onApply()
//==============================================================================
/**
- * OnOK: Handler for the OK button
- *
- * @param None
- */
-//==============================================================================
-void CStudioAppPrefsPage::onOK()
-{
- CStudioPreferencesPropPage::onOK();
-}
-
-//==============================================================================
-/**
* OnButtonRestoreDefaults: Restore the defaults and exit the preferences.
*
* @param None
@@ -461,6 +442,23 @@ void CStudioAppPrefsPage::onClearAutosaveFiles()
}
}
+void CStudioAppPrefsPage::checkRestartCondition()
+{
+ if (m_restartNeeded) {
+ // If special settings have changed, a restart of Studio is needed
+ int retval = QMessageBox::question(this, tr("Restart Needed"),
+ tr("Some settings were changed that require a\n"
+ "restart of the Qt 3D Studio to take effect.\n"
+ "Restart now?"));
+
+ if (retval == QMessageBox::Yes)
+ CStudioPreferencesPropPage::endDialog(PREFS_SETTINGS_RESTART);
+
+ // Just show the dialog once (unless the values are changed again)
+ m_restartNeeded = false;
+ }
+}
+
//==============================================================================
/**
* Load the build properties for the current preview application selected
diff --git a/src/Authoring/Studio/UI/StudioAppPrefsPage.h b/src/Authoring/Studio/UI/StudioAppPrefsPage.h
index 26a8f280..dd749f4c 100644
--- a/src/Authoring/Studio/UI/StudioAppPrefsPage.h
+++ b/src/Authoring/Studio/UI/StudioAppPrefsPage.h
@@ -61,7 +61,6 @@ public:
public:
bool onApply() override;
- void onOK() override;
void onBackgroundColorChanged(const QColor &color);
protected:
@@ -87,6 +86,7 @@ protected:
void setAutosaveInterval(int interval);
void onClearAutosaveFiles();
void onitEditStartViewCombo();
+ void checkRestartCondition();
protected:
std::list<TBuildNameControlPair> m_buildProperties; // List of build properties, either
diff --git a/src/Authoring/Studio/UI/StudioPreferencesPropSheet.cpp b/src/Authoring/Studio/UI/StudioPreferencesPropSheet.cpp
index 6edb1cfb..dd1f9802 100644
--- a/src/Authoring/Studio/UI/StudioPreferencesPropSheet.cpp
+++ b/src/Authoring/Studio/UI/StudioPreferencesPropSheet.cpp
@@ -109,15 +109,21 @@ bool CStudioPreferencesPropSheet::apply()
return true;
}
+void CStudioPreferencesPropSheet::done(int code)
+{
+ m_returnCode = code;
+ QDialog::done(code);
+}
+
void CStudioPreferencesPropSheet::accept()
{
- if (apply())
+ if (apply() && !m_returnCode)
QDialog::accept();
+ else
+ QDialog::done(m_returnCode);
}
void CStudioPreferencesPropSheet::reject()
{
- for (auto page : findChildren<CStudioPreferencesPropPage *>())
- page->onCancel();
QDialog::reject();
}
diff --git a/src/Authoring/Studio/UI/StudioPreferencesPropSheet.h b/src/Authoring/Studio/UI/StudioPreferencesPropSheet.h
index e732cd21..0e969a4d 100644
--- a/src/Authoring/Studio/UI/StudioPreferencesPropSheet.h
+++ b/src/Authoring/Studio/UI/StudioPreferencesPropSheet.h
@@ -51,9 +51,7 @@ class CStudioPreferencesPropPage : public QWidget
public:
explicit CStudioPreferencesPropPage(QWidget *parent = nullptr);
- virtual bool onApply() { onOK(); setModified(false); return true; }
- virtual void onOK() {}
- virtual void onCancel() {}
+ virtual bool onApply() { setModified(false); return true; }
protected:
CStudioPreferencesPropSheet* sheet();
@@ -74,6 +72,7 @@ protected:
public:
virtual ~CStudioPreferencesPropSheet();
+ void done(int code) override;
protected:
virtual void onInitDialog();
@@ -84,6 +83,7 @@ protected:
private:
QScopedPointer<QT_PREPEND_NAMESPACE(Ui::StudioPreferencesPropSheet)> m_ui;
+ int m_returnCode = 0;
};
#endif
diff --git a/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp b/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp
index 240d96f9..9dcb616c 100644
--- a/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp
+++ b/src/Authoring/Studio/UI/StudioProjectSettingsPage.cpp
@@ -230,18 +230,6 @@ bool CStudioProjectSettingsPage::onApply()
//==============================================================================
/**
- * OnOK: Handler for the OK button
- *
- * @param None
- */
-//==============================================================================
-void CStudioProjectSettingsPage::onOK()
-{
- CStudioPreferencesPropPage::onOK();
-}
-
-//==============================================================================
-/**
* OnChangeEditPresWidth: EN_CHANGE handler for the IDC_EDIT_PRESWIDTH field
*
* @param None
diff --git a/src/Authoring/Studio/UI/StudioProjectSettingsPage.h b/src/Authoring/Studio/UI/StudioProjectSettingsPage.h
index fd66c77a..dfd53c2b 100644
--- a/src/Authoring/Studio/UI/StudioProjectSettingsPage.h
+++ b/src/Authoring/Studio/UI/StudioProjectSettingsPage.h
@@ -67,10 +67,8 @@ public:
~CStudioProjectSettingsPage();
// Overrides
- // ClassWizard generate virtual function overrides
public:
bool onApply() override;
- void onOK() override;
// Implementation
protected: