diff --git a/src/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui index 58a897d8..d97f805b 100644 --- a/src/gui/res/SettingsDialogBase.ui +++ b/src/gui/res/SettingsDialogBase.ui @@ -7,7 +7,7 @@ 0 0 368 - 354 + 377 @@ -124,7 +124,7 @@ - &Hide when server/client starts + &Hide on startup diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 9490a7fb..f14f93cc 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -161,7 +161,9 @@ void MainWindow::open() { createTrayIcon(); - showNormal(); + if (!autoHide()) { + showNormal(); + } m_VersionChecker.checkLatest(); @@ -399,6 +401,17 @@ void MainWindow::updateStateFromLogLine(const QString &line) line.contains("watchdog status: ok")) { setSynergyState(synergyConnected); + + if (!appConfig().startedBefore()) { + QMessageBox::information( + this, "Synergy", + tr("Synergy is now connected, You can close the " + "config window. Synergy will remain connected in " + "the background.")); + + appConfig().setStartedBefore(true); + appConfig().saveSettings(); + } } checkFingerprint(line); @@ -446,12 +459,15 @@ void MainWindow::checkFingerprint(const QString& line) } } -void MainWindow::autoHide() +bool MainWindow::autoHide() { if ((appConfig().processMode() == Desktop) && appConfig().getAutoHide()) { hide(); + return true; } + + return false; } void MainWindow::clearLog() @@ -568,10 +584,6 @@ void MainWindow::startSynergy() QString command(app + " " + args.join(" ")); m_IpcClient.sendCommand(command, appConfig().elevateMode()); } - - appConfig().setStartedBefore(true); - appConfig().saveSettings(); - } bool MainWindow::clientArgs(QStringList& args, QString& app) @@ -795,7 +807,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 5fe7bf3c..0abf1191 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -168,7 +168,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void updateEdition(); QString getProfileRootForArg(); void checkFingerprint(const QString& line); - void autoHide(); + bool autoHide(); private: QSettings& m_Settings; diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index fd3c80ec..91be2243 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -50,11 +50,14 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : m_pCheckBoxLogToFile->setChecked(appConfig().logToFile()); m_pLineEditLogFilename->setText(appConfig().logFilename()); setIndexFromItemData(m_pComboLanguage, appConfig().language()); + m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide()); #if defined(Q_OS_WIN) m_SuppressElevateWarning = true; m_pCheckBoxElevateMode->setChecked(appConfig().elevateMode()); m_SuppressElevateWarning = false; + + m_pCheckBoxAutoHide->hide(); #else // elevate checkbox is only useful on ms windows. m_pCheckBoxElevateMode->hide();