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

View File

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

View File

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

View File

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