#6524 Adds new minimize to tray functionality and setting to enable/disable
This commit is contained in:
parent
629ed12885
commit
d67f2e8036
|
@ -57,7 +57,8 @@ AppConfig::AppConfig(QSettings* settings) :
|
||||||
m_CryptoEnabled(false),
|
m_CryptoEnabled(false),
|
||||||
m_AutoHide(false),
|
m_AutoHide(false),
|
||||||
m_LastExpiringWarningTime(0),
|
m_LastExpiringWarningTime(0),
|
||||||
m_AutoConfigServer()
|
m_AutoConfigServer(),
|
||||||
|
m_MinimizeToTray(false)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_pSettings);
|
Q_ASSERT(m_pSettings);
|
||||||
|
|
||||||
|
@ -165,6 +166,7 @@ void AppConfig::loadSettings()
|
||||||
m_lastVersion = settings().value("lastVersion", "Unknown").toString();
|
m_lastVersion = settings().value("lastVersion", "Unknown").toString();
|
||||||
m_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt();
|
m_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt();
|
||||||
m_ActivationHasRun = settings().value("activationHasRun", false).toBool();
|
m_ActivationHasRun = settings().value("activationHasRun", false).toBool();
|
||||||
|
m_MinimizeToTray = settings().value("minimizeToTray", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppConfig::saveSettings()
|
void AppConfig::saveSettings()
|
||||||
|
@ -191,6 +193,7 @@ void AppConfig::saveSettings()
|
||||||
settings().setValue("lastVersion", m_lastVersion);
|
settings().setValue("lastVersion", m_lastVersion);
|
||||||
settings().setValue("lastExpiringWarningTime", m_LastExpiringWarningTime);
|
settings().setValue("lastExpiringWarningTime", m_LastExpiringWarningTime);
|
||||||
settings().setValue("activationHasRun", m_ActivationHasRun);
|
settings().setValue("activationHasRun", m_ActivationHasRun);
|
||||||
|
settings().setValue("minimizeToTray", m_MinimizeToTray);
|
||||||
settings().sync();
|
settings().sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,3 +301,7 @@ bool AppConfig::getCryptoEnabled() const {
|
||||||
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
void AppConfig::setAutoHide(bool b) { m_AutoHide = b; }
|
||||||
|
|
||||||
bool AppConfig::getAutoHide() { return m_AutoHide; }
|
bool AppConfig::getAutoHide() { return m_AutoHide; }
|
||||||
|
|
||||||
|
void AppConfig::setMinimizeToTray(bool b) { m_MinimizeToTray = b; }
|
||||||
|
|
||||||
|
bool AppConfig::getMinimizeToTray() { return m_MinimizeToTray; }
|
||||||
|
|
|
@ -110,6 +110,9 @@ class AppConfig: public QObject
|
||||||
|
|
||||||
QString lastVersion() const;
|
QString lastVersion() const;
|
||||||
|
|
||||||
|
void setMinimizeToTray(bool b);
|
||||||
|
bool getMinimizeToTray();
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void setLastVersion(QString version);
|
void setLastVersion(QString version);
|
||||||
|
|
||||||
|
@ -150,6 +153,7 @@ protected:
|
||||||
QString m_lastVersion;
|
QString m_lastVersion;
|
||||||
int m_LastExpiringWarningTime;
|
int m_LastExpiringWarningTime;
|
||||||
bool m_ActivationHasRun;
|
bool m_ActivationHasRun;
|
||||||
|
bool m_MinimizeToTray;
|
||||||
|
|
||||||
static const char m_SynergysName[];
|
static const char m_SynergysName[];
|
||||||
static const char m_SynergycName[];
|
static const char m_SynergycName[];
|
||||||
|
|
|
@ -223,28 +223,6 @@ void MainWindow::open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onModeChanged(bool startDesktop, bool applyService)
|
|
||||||
{
|
|
||||||
if (appConfig().processMode() == Service)
|
|
||||||
{
|
|
||||||
// ensure that the apply button actually does something, since desktop
|
|
||||||
// mode screws around with connecting/disconnecting the action.
|
|
||||||
disconnect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
|
|
||||||
connect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
|
|
||||||
|
|
||||||
if (applyService)
|
|
||||||
{
|
|
||||||
stopDesktop();
|
|
||||||
startSynergy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((appConfig().processMode() == Desktop) && startDesktop)
|
|
||||||
{
|
|
||||||
stopService();
|
|
||||||
startSynergy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::setStatus(const QString &status)
|
void MainWindow::setStatus(const QString &status)
|
||||||
{
|
{
|
||||||
m_pStatusLabel->setText(status);
|
m_pStatusLabel->setText(status);
|
||||||
|
@ -1093,10 +1071,15 @@ void MainWindow::changeEvent(QEvent* event)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
case QEvent::WindowStateChange:
|
||||||
QMainWindow::changeEvent(event);
|
{
|
||||||
|
windowStateChanged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// all that do not return are allowing the event to propagate
|
||||||
|
QMainWindow::changeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addZeroconfServer(const QString name)
|
void MainWindow::addZeroconfServer(const QString name)
|
||||||
|
@ -1291,21 +1274,7 @@ void MainWindow::updateAutoConfigWidgets()
|
||||||
|
|
||||||
void MainWindow::on_m_pActionSettings_triggered()
|
void MainWindow::on_m_pActionSettings_triggered()
|
||||||
{
|
{
|
||||||
ProcessMode lastProcessMode = appConfig().processMode();
|
SettingsDialog(this, appConfig()).exec();
|
||||||
bool lastAutoConfig = appConfig().autoConfig();
|
|
||||||
|
|
||||||
SettingsDialog dlg(this, appConfig());
|
|
||||||
dlg.exec();
|
|
||||||
|
|
||||||
if (lastProcessMode != appConfig().processMode())
|
|
||||||
{
|
|
||||||
onModeChanged(true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastAutoConfig != appConfig().autoConfig()) {
|
|
||||||
updateAutoConfigWidgets();
|
|
||||||
updateZeroconfService();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::autoAddScreen(const QString name)
|
void MainWindow::autoAddScreen(const QString name)
|
||||||
|
@ -1439,3 +1408,9 @@ void MainWindow::on_m_pComboServerList_currentIndexChanged(const QString &server
|
||||||
appConfig().setAutoConfigServer(server);
|
appConfig().setAutoConfigServer(server);
|
||||||
appConfig().saveSettings();
|
appConfig().saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::windowStateChanged()
|
||||||
|
{
|
||||||
|
if (windowState() == Qt::WindowMinimized && appConfig().getMinimizeToTray())
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
|
@ -176,7 +176,6 @@ public slots:
|
||||||
bool serverArgs(QStringList& args, QString& app);
|
bool serverArgs(QStringList& args, QString& app);
|
||||||
void setStatus(const QString& status);
|
void setStatus(const QString& status);
|
||||||
void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors);
|
void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors);
|
||||||
void onModeChanged(bool startDesktop, bool applyService);
|
|
||||||
void updateFromLogLine(const QString& line);
|
void updateFromLogLine(const QString& line);
|
||||||
QString getIPAddresses();
|
QString getIPAddresses();
|
||||||
void stopService();
|
void stopService();
|
||||||
|
@ -203,6 +202,9 @@ public slots:
|
||||||
void showEvent (QShowEvent*);
|
void showEvent (QShowEvent*);
|
||||||
void secureSocket(bool secureSocket);
|
void secureSocket(bool secureSocket);
|
||||||
|
|
||||||
|
void windowStateChanged();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifndef SYNERGY_ENTERPRISE
|
#ifndef SYNERGY_ENTERPRISE
|
||||||
LicenseManager* m_LicenseManager;
|
LicenseManager* m_LicenseManager;
|
||||||
|
|
|
@ -57,6 +57,8 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
m_pLineEditLogFilename->setText(appConfig().logFilename());
|
m_pLineEditLogFilename->setText(appConfig().logFilename());
|
||||||
setIndexFromItemData(m_pComboLanguage, appConfig().language());
|
setIndexFromItemData(m_pComboLanguage, appConfig().language());
|
||||||
m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide());
|
m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide());
|
||||||
|
m_pCheckBoxMinimizeToTray->setChecked(appConfig().getMinimizeToTray());
|
||||||
|
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
m_pBonjourWindows = new BonjourWindows(this, m_pMainWindow, m_appConfig);
|
m_pBonjourWindows = new BonjourWindows(this, m_pMainWindow, m_appConfig);
|
||||||
|
@ -66,7 +68,6 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
|
|
||||||
m_pComboElevate->setCurrentIndex(static_cast<int>(appConfig().elevateMode()));
|
m_pComboElevate->setCurrentIndex(static_cast<int>(appConfig().elevateMode()));
|
||||||
|
|
||||||
m_pCheckBoxAutoHide->hide();
|
|
||||||
#else
|
#else
|
||||||
// elevate checkbox is only useful on ms windows.
|
// elevate checkbox is only useful on ms windows.
|
||||||
m_pLabelElevate->hide();
|
m_pLabelElevate->hide();
|
||||||
|
@ -106,9 +107,10 @@ void SettingsDialog::accept()
|
||||||
appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked());
|
appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked());
|
||||||
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(static_cast<ElevateMode>(m_pComboElevate->currentIndex()));
|
appConfig().setElevateMode(static_cast<ElevateMode>(m_pComboElevate->currentIndex()));
|
||||||
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
|
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
|
||||||
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
|
appConfig().setAutoConfig(m_pCheckBoxAutoConfig->isChecked());
|
||||||
|
appConfig().setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
|
||||||
appConfig().saveSettings();
|
appConfig().saveSettings();
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,13 +114,6 @@
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="m_pComboLanguage"/>
|
<widget class="QComboBox" name="m_pComboLanguage"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QCheckBox" name="m_pCheckBoxAutoHide">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Hide on startup</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QComboBox" name="m_pComboElevate">
|
<widget class="QComboBox" name="m_pComboElevate">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -153,6 +146,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QCheckBox" name="m_pCheckBoxAutoHide">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Hide on startup</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QCheckBox" name="m_pCheckBoxMinimizeToTray">
|
||||||
|
<property name="text">
|
||||||
|
<string>Minimize to System &Tray</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -392,6 +399,7 @@
|
||||||
<tabstop>m_pLineEditScreenName</tabstop>
|
<tabstop>m_pLineEditScreenName</tabstop>
|
||||||
<tabstop>m_pSpinBoxPort</tabstop>
|
<tabstop>m_pSpinBoxPort</tabstop>
|
||||||
<tabstop>m_pLineEditInterface</tabstop>
|
<tabstop>m_pLineEditInterface</tabstop>
|
||||||
|
<tabstop>m_pCheckBoxMinimizeToTray</tabstop>
|
||||||
<tabstop>m_pComboElevate</tabstop>
|
<tabstop>m_pComboElevate</tabstop>
|
||||||
<tabstop>m_pCheckBoxAutoHide</tabstop>
|
<tabstop>m_pCheckBoxAutoHide</tabstop>
|
||||||
<tabstop>m_pComboLogLevel</tabstop>
|
<tabstop>m_pComboLogLevel</tabstop>
|
||||||
|
|
Loading…
Reference in New Issue