From fb76dee8cc8b0a89082caa2f17b7961096074c50 Mon Sep 17 00:00:00 2001 From: XinyuHou Date: Thu, 23 Apr 2015 15:37:07 +0100 Subject: [PATCH] Reintroduced GUI auto-hide setting (disabled by default) #4569 --- src/gui/res/SettingsDialogBase.ui | 9 ++++++++- src/gui/src/AppConfig.cpp | 5 ++++- src/gui/src/AppConfig.h | 3 +++ src/gui/src/MainWindow.cpp | 9 +++++++++ src/gui/src/MainWindow.h | 1 + src/gui/src/SettingsDialog.cpp | 1 + 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui index 1033a2d3..58a897d8 100644 --- a/src/gui/res/SettingsDialogBase.ui +++ b/src/gui/res/SettingsDialogBase.ui @@ -1,4 +1,4 @@ - + SettingsDialogBase @@ -121,6 +121,13 @@ + + + + &Hide when server/client starts + + + diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index d3b0791f..975aa50b 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -57,7 +57,8 @@ AppConfig::AppConfig(QSettings* settings) : m_AutoConfig(true), m_ElevateMode(false), m_AutoConfigPrompted(false), - m_CryptoEnabled(false) + m_CryptoEnabled(false), + m_AutoHide(false) { Q_ASSERT(m_pSettings); @@ -130,6 +131,7 @@ void AppConfig::loadSettings() m_ActivateEmail = settings().value("activateEmail", "").toString(); m_UserToken = settings().value("userToken", "").toString(); m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool(); + m_AutoHide = settings().value("autoHide", false).toBool(); } void AppConfig::saveSettings() @@ -150,6 +152,7 @@ void AppConfig::saveSettings() settings().setValue("activateEmail", m_ActivateEmail); settings().setValue("userToken", m_UserToken); settings().setValue("cryptoEnabled", m_CryptoEnabled); + settings().setValue("autoHide", m_AutoHide); } void AppConfig::setAutoConfig(bool autoConfig) diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 6d19f74b..e533d08c 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -87,6 +87,8 @@ class AppConfig void setCryptoEnabled(bool e) { m_CryptoEnabled = e; } bool getCryptoEnabled() { return m_CryptoEnabled; } + void setAutoHide(bool b) { m_AutoHide = b; } + bool getAutoHide() { return m_AutoHide; } protected: QSettings& settings() { return *m_pSettings; } @@ -123,6 +125,7 @@ class AppConfig QString m_ActivateEmail; QString m_UserToken; bool m_CryptoEnabled; + bool m_AutoHide; static const char m_SynergysName[]; static const char m_SynergycName[]; diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index e54c9c37..9490a7fb 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -446,6 +446,14 @@ void MainWindow::checkFingerprint(const QString& line) } } +void MainWindow::autoHide() +{ + if ((appConfig().processMode() == Desktop) && + appConfig().getAutoHide()) { + hide(); + } +} + void MainWindow::clearLog() { m_pLogOutput->clear(); @@ -787,6 +795,7 @@ void MainWindow::setSynergyState(qSynergyState state) } setStatus(tr("Synergy is running.")); + autoHide(); break; } case synergyConnecting: diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 40bb7975..5fe7bf3c 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -168,6 +168,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void updateEdition(); QString getProfileRootForArg(); void checkFingerprint(const QString& line); + void autoHide(); private: QSettings& m_Settings; diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index 04e83c79..fd3c80ec 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -79,6 +79,7 @@ void SettingsDialog::accept() appConfig().setLogFilename(m_pLineEditLogFilename->text()); appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()); appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked()); + appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked()); appConfig().saveSettings(); QDialog::accept(); }