auto start and auto hide by default

This commit is contained in:
Nick Bolton 2014-01-27 16:50:41 +00:00
parent 3d963bfbe7
commit d0abad9123
2 changed files with 8 additions and 18 deletions

View File

@ -121,19 +121,19 @@ void MainWindow::start(bool firstRun)
{ {
createTrayIcon(); createTrayIcon();
// always show. auto-hide only happens when we have a connection.
showNormal(); showNormal();
m_VersionChecker.checkLatest(); m_VersionChecker.checkLatest();
if (appConfig().processMode() == Desktop) {
startSynergy();
}
} }
void MainWindow::onModeChanged(bool startDesktop, bool applyService) void MainWindow::onModeChanged(bool startDesktop, bool applyService)
{ {
if (appConfig().processMode() == Service) if (appConfig().processMode() == Service)
{ {
// form is always enabled in service mode.
setFormEnabled(true);
// ensure that the apply button actually does something, since desktop // ensure that the apply button actually does something, since desktop
// mode screws around with connecting/disconnecting the action. // mode screws around with connecting/disconnecting the action.
disconnect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger())); disconnect(m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
@ -445,8 +445,11 @@ void MainWindow::startSynergy()
if (desktopMode) if (desktopMode)
{ {
synergyProcess()->start(app, args); synergyProcess()->start(app, args);
if (!synergyProcess()->waitForStarted()) if (synergyProcess()->waitForStarted())
{ {
hide();
}
else {
stopSynergy(); stopSynergy();
show(); show();
QMessageBox::warning(this, tr("Program can not be started"), QString(tr("The executable<br><br>%1<br><br>could not be successfully started, although it does exist. Please check if you have sufficient permissions to run this program.").arg(app))); QMessageBox::warning(this, tr("Program can not be started"), QString(tr("The executable<br><br>%1<br><br>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; 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_pActionStartSynergy->setEnabled(!connected);
m_pActionStopSynergy->setEnabled(connected); m_pActionStopSynergy->setEnabled(connected);
@ -678,12 +675,6 @@ void MainWindow::setSynergyState(qSynergyState state)
m_SynergyState = state; m_SynergyState = state;
} }
void MainWindow::setFormEnabled(bool enabled)
{
m_pGroupClient->setEnabled(enabled);
m_pGroupServer->setEnabled(enabled);
}
void MainWindow::setVisible(bool visible) void MainWindow::setVisible(bool visible)
{ {
QMainWindow::setVisible(visible); QMainWindow::setVisible(visible);

View File

@ -140,7 +140,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QString getScreenName(); QString getScreenName();
void stopService(); void stopService();
void stopDesktop(); void stopDesktop();
void setFormEnabled(bool enabled);
void changeEvent(QEvent* event); void changeEvent(QEvent* event);
void retranslateMenuBar(); void retranslateMenuBar();
void updatePremiumInfo(); void updatePremiumInfo();