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">
<class>SettingsDialogBase</class>
<widget class="QDialog" name="SettingsDialogBase">
@ -121,6 +121,13 @@
</property>
</widget>
</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>
</widget>
</item>

View File

@ -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)

View File

@ -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[];

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()
{
m_pLogOutput->clear();
@ -787,6 +795,7 @@ void MainWindow::setSynergyState(qSynergyState state)
}
setStatus(tr("Synergy is running."));
autoHide();
break;
}
case synergyConnecting:

View File

@ -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;

View File

@ -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();
}