diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2018-05-22 12:08:16 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-05-22 11:17:56 +0000 |
commit | 49e31884c7e6ce796c5275e1bb8ab4fb36a0405e (patch) | |
tree | 737fe96b512140286a5321fd0d09d06dda2ed291 /src/Authoring/Studio/MainFrm.cpp | |
parent | 51f360fc1c48e7b47ea9e984f592e7d597896fd2 (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/MainFrm.cpp')
-rw-r--r-- | src/Authoring/Studio/MainFrm.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp index f4e8a0fe..e8908efa 100644 --- a/src/Authoring/Studio/MainFrm.cpp +++ b/src/Authoring/Studio/MainFrm.cpp @@ -69,6 +69,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qurl.h> #include <QtCore/qdir.h> +#include <QtCore/qprocess.h> // Constants const long PLAYBACK_TIMER_TIMEOUT = 10; // 10 milliseconds @@ -910,6 +911,8 @@ void CMainFrame::EditPreferences(short inPageIndex) RecheckSizingMode(); } else if (thePrefsReturn == PREFS_RESET_LAYOUT) { onViewResetLayout(); + } else if (thePrefsReturn == PREFS_SETTINGS_RESTART) { + QTimer::singleShot(0, this, &CMainFrame::handleRestart); } } @@ -1515,7 +1518,7 @@ void CMainFrame::onViewResetLayout() tr("Restart Needed"), tr("Are you sure that you want to restore Qt 3D Studio " "layout? \nYour current layout will be lost, and " - "Studio will exit.")); + "Studio will restart.")); // If "Yes" is clicked, delete window geometry and window state keys from QSettings if (theChoice == QMessageBox::Yes) { @@ -1526,7 +1529,7 @@ void CMainFrame::onViewResetLayout() settings.remove(stateKey); // Prevent saving geometry and state, and exit m_resettingLayout = true; - QTimer::singleShot(0, this, &CMainFrame::close); + QTimer::singleShot(0, this, &CMainFrame::handleRestart); } } @@ -1929,6 +1932,14 @@ void CMainFrame::handleGeometryAndState(bool save) } } +void CMainFrame::handleRestart() +{ + QStringList presentationFile = QStringList(g_StudioApp.GetCore()->GetDoc() + ->GetDocumentPath().GetAbsolutePath().toQString()); + close(); + QProcess::startDetached(qApp->arguments()[0], presentationFile); +} + void CMainFrame::initializeGeometryAndState() { QSettings settings; |