Modified auto hide feature #4569

Made auto hide on startup and added an info masseage on first connection
This commit is contained in:
XinyuHou 2015-04-23 17:32:18 +01:00
parent fb76dee8cc
commit c7b444a762
4 changed files with 25 additions and 10 deletions

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>368</width> <width>368</width>
<height>354</height> <height>377</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -124,7 +124,7 @@
<item row="5" column="0"> <item row="5" column="0">
<widget class="QCheckBox" name="m_pCheckBoxAutoHide"> <widget class="QCheckBox" name="m_pCheckBoxAutoHide">
<property name="text"> <property name="text">
<string>&amp;Hide when server/client starts</string> <string>&amp;Hide on startup</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -161,7 +161,9 @@ void MainWindow::open()
{ {
createTrayIcon(); createTrayIcon();
if (!autoHide()) {
showNormal(); showNormal();
}
m_VersionChecker.checkLatest(); m_VersionChecker.checkLatest();
@ -399,6 +401,17 @@ void MainWindow::updateStateFromLogLine(const QString &line)
line.contains("watchdog status: ok")) line.contains("watchdog status: ok"))
{ {
setSynergyState(synergyConnected); 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); checkFingerprint(line);
@ -446,12 +459,15 @@ void MainWindow::checkFingerprint(const QString& line)
} }
} }
void MainWindow::autoHide() bool MainWindow::autoHide()
{ {
if ((appConfig().processMode() == Desktop) && if ((appConfig().processMode() == Desktop) &&
appConfig().getAutoHide()) { appConfig().getAutoHide()) {
hide(); hide();
return true;
} }
return false;
} }
void MainWindow::clearLog() void MainWindow::clearLog()
@ -568,10 +584,6 @@ void MainWindow::startSynergy()
QString command(app + " " + args.join(" ")); QString command(app + " " + args.join(" "));
m_IpcClient.sendCommand(command, appConfig().elevateMode()); m_IpcClient.sendCommand(command, appConfig().elevateMode());
} }
appConfig().setStartedBefore(true);
appConfig().saveSettings();
} }
bool MainWindow::clientArgs(QStringList& args, QString& app) bool MainWindow::clientArgs(QStringList& args, QString& app)
@ -795,7 +807,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,7 +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(); bool autoHide();
private: private:
QSettings& m_Settings; QSettings& m_Settings;

View File

@ -50,11 +50,14 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile()); m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
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());
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
m_SuppressElevateWarning = true; m_SuppressElevateWarning = true;
m_pCheckBoxElevateMode->setChecked(appConfig().elevateMode()); m_pCheckBoxElevateMode->setChecked(appConfig().elevateMode());
m_SuppressElevateWarning = false; m_SuppressElevateWarning = false;
m_pCheckBoxAutoHide->hide();
#else #else
// elevate checkbox is only useful on ms windows. // elevate checkbox is only useful on ms windows.
m_pCheckBoxElevateMode->hide(); m_pCheckBoxElevateMode->hide();