Reintroduced GUI auto-hide setting (disabled by default) #4569

This commit is contained in:
XinyuHou 2015-04-23 15:37:07 +01:00
parent fb6186304b
commit fb76dee8cc
6 changed files with 26 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="utf-8"?>
<ui version="4.0"> <ui version="4.0">
<class>SettingsDialogBase</class> <class>SettingsDialogBase</class>
<widget class="QDialog" name="SettingsDialogBase"> <widget class="QDialog" name="SettingsDialogBase">
@ -121,6 +121,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QCheckBox" name="m_pCheckBoxAutoHide">
<property name="text">
<string>&amp;Hide when server/client starts</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -57,7 +57,8 @@ AppConfig::AppConfig(QSettings* settings) :
m_AutoConfig(true), m_AutoConfig(true),
m_ElevateMode(false), m_ElevateMode(false),
m_AutoConfigPrompted(false), m_AutoConfigPrompted(false),
m_CryptoEnabled(false) m_CryptoEnabled(false),
m_AutoHide(false)
{ {
Q_ASSERT(m_pSettings); Q_ASSERT(m_pSettings);
@ -130,6 +131,7 @@ void AppConfig::loadSettings()
m_ActivateEmail = settings().value("activateEmail", "").toString(); m_ActivateEmail = settings().value("activateEmail", "").toString();
m_UserToken = settings().value("userToken", "").toString(); m_UserToken = settings().value("userToken", "").toString();
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool(); m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
m_AutoHide = settings().value("autoHide", false).toBool();
} }
void AppConfig::saveSettings() void AppConfig::saveSettings()
@ -150,6 +152,7 @@ void AppConfig::saveSettings()
settings().setValue("activateEmail", m_ActivateEmail); settings().setValue("activateEmail", m_ActivateEmail);
settings().setValue("userToken", m_UserToken); settings().setValue("userToken", m_UserToken);
settings().setValue("cryptoEnabled", m_CryptoEnabled); settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("autoHide", m_AutoHide);
} }
void AppConfig::setAutoConfig(bool autoConfig) void AppConfig::setAutoConfig(bool autoConfig)

View File

@ -87,6 +87,8 @@ class AppConfig
void setCryptoEnabled(bool e) { m_CryptoEnabled = e; } void setCryptoEnabled(bool e) { m_CryptoEnabled = e; }
bool getCryptoEnabled() { return m_CryptoEnabled; } bool getCryptoEnabled() { return m_CryptoEnabled; }
void setAutoHide(bool b) { m_AutoHide = b; }
bool getAutoHide() { return m_AutoHide; }
protected: protected:
QSettings& settings() { return *m_pSettings; } QSettings& settings() { return *m_pSettings; }
@ -123,6 +125,7 @@ class AppConfig
QString m_ActivateEmail; QString m_ActivateEmail;
QString m_UserToken; QString m_UserToken;
bool m_CryptoEnabled; bool m_CryptoEnabled;
bool m_AutoHide;
static const char m_SynergysName[]; static const char m_SynergysName[];
static const char m_SynergycName[]; static const char m_SynergycName[];

View File

@ -446,6 +446,14 @@ void MainWindow::checkFingerprint(const QString& line)
} }
} }
void MainWindow::autoHide()
{
if ((appConfig().processMode() == Desktop) &&
appConfig().getAutoHide()) {
hide();
}
}
void MainWindow::clearLog() void MainWindow::clearLog()
{ {
m_pLogOutput->clear(); m_pLogOutput->clear();
@ -787,6 +795,7 @@ void MainWindow::setSynergyState(qSynergyState state)
} }
setStatus(tr("Synergy is running.")); setStatus(tr("Synergy is running."));
autoHide();
break; break;
} }
case synergyConnecting: case synergyConnecting:

View File

@ -168,6 +168,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void updateEdition(); void updateEdition();
QString getProfileRootForArg(); QString getProfileRootForArg();
void checkFingerprint(const QString& line); void checkFingerprint(const QString& line);
void autoHide();
private: private:
QSettings& m_Settings; QSettings& m_Settings;

View File

@ -79,6 +79,7 @@ void SettingsDialog::accept()
appConfig().setLogFilename(m_pLineEditLogFilename->text()); appConfig().setLogFilename(m_pLineEditLogFilename->text());
appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()); appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked()); appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked());
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
appConfig().saveSettings(); appConfig().saveSettings();
QDialog::accept(); QDialog::accept();
} }