From d0abad91238393b77f8148af7b93696837aab76e Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 27 Jan 2014 16:50:41 +0000 Subject: [PATCH] auto start and auto hide by default --- src/gui/src/MainWindow.cpp | 25 ++++++++----------------- src/gui/src/MainWindow.h | 1 - 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index f25cf11f..fc73c281 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -121,19 +121,19 @@ void MainWindow::start(bool firstRun) { createTrayIcon(); - // always show. auto-hide only happens when we have a connection. showNormal(); m_VersionChecker.checkLatest(); + + if (appConfig().processMode() == Desktop) { + startSynergy(); + } } void MainWindow::onModeChanged(bool startDesktop, bool applyService) { if (appConfig().processMode() == Service) { - // form is always enabled in service mode. - setFormEnabled(true); - // 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())); @@ -445,8 +445,11 @@ void MainWindow::startSynergy() if (desktopMode) { synergyProcess()->start(app, args); - if (!synergyProcess()->waitForStarted()) + if (synergyProcess()->waitForStarted()) { + hide(); + } + else { stopSynergy(); show(); QMessageBox::warning(this, tr("Program can not be started"), QString(tr("The executable

%1

could not be successfully started, although it does exist. Please check if you have sufficient permissions to run this program.").arg(app))); @@ -650,12 +653,6 @@ void MainWindow::setSynergyState(qSynergyState state) bool connected = state == synergyConnected; - // only disable controls in desktop mode. in service mode, we can use the apply button. - if (appConfig().processMode() == Desktop) - { - setFormEnabled(!connected); - } - m_pActionStartSynergy->setEnabled(!connected); m_pActionStopSynergy->setEnabled(connected); @@ -678,12 +675,6 @@ void MainWindow::setSynergyState(qSynergyState state) m_SynergyState = state; } -void MainWindow::setFormEnabled(bool enabled) -{ - m_pGroupClient->setEnabled(enabled); - m_pGroupServer->setEnabled(enabled); -} - void MainWindow::setVisible(bool visible) { QMainWindow::setVisible(visible); diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 0db6420a..37956bd1 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -140,7 +140,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase QString getScreenName(); void stopService(); void stopDesktop(); - void setFormEnabled(bool enabled); void changeEvent(QEvent* event); void retranslateMenuBar(); void updatePremiumInfo();