diff --git a/src/gui/res/SettingsDialogBase.ui b/src/gui/res/SettingsDialogBase.ui index 1a71051d..c5eaa841 100644 --- a/src/gui/res/SettingsDialogBase.ui +++ b/src/gui/res/SettingsDialogBase.ui @@ -7,7 +7,7 @@ 0 0 383 - 470 + 387 @@ -42,9 +42,6 @@ P&ort: - - m_pSpinBoxGamePoll - @@ -83,6 +80,30 @@ + + + + &Process mode: + + + m_pLineEditInterface + + + + + + + + Service + + + + + Desktop (legacy) + + + + @@ -96,7 +117,7 @@ - + Logging @@ -178,103 +199,6 @@ - - - - &Game device support - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - &Mode: - - - m_pLineEditInterface - - - - - - - - None - - - - - Next Generation (XInput) - 32-bit only - - - - - Legacy (JOYINFOEX) - - - - - - - - &Polling: - - - m_pLineEditInterface - - - - - - - Dynamic (align with client polling) - - - true - - - - - - - - - Static frequency: - - - - - - - true - - - - 0 - 0 - - - - 10 - - - 10000 - - - 10 - - - 60 - - - - - - - - @@ -305,6 +229,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/src/gui/res/SetupWizardBase.ui b/src/gui/res/SetupWizardBase.ui index b6357b32..8b98e791 100644 --- a/src/gui/res/SetupWizardBase.ui +++ b/src/gui/res/SetupWizardBase.ui @@ -125,155 +125,6 @@ - - - - 0 - 0 - - - - Startup Mode - - - - - - - 75 - true - - - - &Service - - - true - - - - - - - Always run Synergy in the background automatically at startup. This allows you to use Synergy at the login prompt. If you experience problems while using this mode, you can run this wizard again and select the "Desktop" option. - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 75 - true - - - - &Desktop - - - - - - - - 0 - 0 - - - - Synergy will start when your desktop loads (after you login). This mode can help if you experience problems with the "Service" option. - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 75 - true - - - - &None - - - - - - - - 0 - 0 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Do not start Synergy when your computer starts.</span></p></body></html> - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::MinimumExpanding - - - - 0 - 0 - - - - - - diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index 68c162a2..bbbc88f6 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -24,10 +24,12 @@ const char AppConfig::m_SynergysName[] = "synergys.exe"; const char AppConfig::m_SynergycName[] = "synergyc.exe"; const char AppConfig::m_SynergyLogDir[] = "log/"; +#define DEFAULT_PROCESS_MODE Service #else const char AppConfig::m_SynergysName[] = "synergys"; const char AppConfig::m_SynergycName[] = "synergyc"; const char AppConfig::m_SynergyLogDir[] = "/var/log/"; +#define DEFAULT_PROCESS_MODE Desktop #endif static const char* logLevelNames[] = @@ -52,9 +54,7 @@ AppConfig::AppConfig(QSettings* settings) : m_AutoHide(false), m_AutoStartPrompt(false), m_WizardHasRun(false), - m_GameModeIndex(0), - m_GamePollingDynamic(true), - m_GamePollingFrequency(60) + m_ProcessMode(DEFAULT_PROCESS_MODE) { Q_ASSERT(m_pSettings); @@ -154,10 +154,7 @@ void AppConfig::loadSettings() m_AutoHide = settings().value("autoHide", true).toBool(); m_AutoStartPrompt = settings().value("autoStartPrompt", true).toBool(); m_WizardHasRun = settings().value("wizardHasRun", false).toBool(); - m_ProcessMode = (ProcessMode)settings().value("processMode", Desktop).toInt(); - m_GameModeIndex = settings().value("gameModeIndex", 0).toInt(); - m_GamePollingDynamic = settings().value("gamePollingDynamic", true).toBool(); - m_GamePollingFrequency = settings().value("gamePollingFrequency", 60).toInt(); + m_ProcessMode = (ProcessMode)settings().value("processMode2", DEFAULT_PROCESS_MODE).toInt(); } void AppConfig::saveSettings() @@ -173,8 +170,5 @@ void AppConfig::saveSettings() settings().setValue("autoHide", m_AutoHide); settings().setValue("autoStartPrompt", m_AutoStartPrompt); settings().setValue("wizardHasRun", m_WizardHasRun); - settings().setValue("processMode", m_ProcessMode); - settings().setValue("gameModeIndex", m_GameModeIndex); - settings().setValue("gamePollingDynamic", m_GamePollingDynamic); - settings().setValue("gamePollingFrequency", m_GamePollingFrequency); + settings().setValue("processMode2", m_ProcessMode); } diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index beae4f0e..dbc066c3 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -53,9 +53,6 @@ class AppConfig bool autoStartPrompt() const { return m_AutoStartPrompt; } bool wizardHasRun() const { return m_WizardHasRun; } ProcessMode processMode() const { return m_ProcessMode; } - int gameModeIndex() const { return m_GameModeIndex; } - bool gamePollingDynamic() const { return m_GamePollingDynamic; } - int gamePollingFrequency() const { return m_GamePollingFrequency; } QString synergysName() const { return m_SynergysName; } QString synergycName() const { return m_SynergycName; } @@ -79,9 +76,6 @@ class AppConfig void setAutoStartPrompt(bool b) { m_AutoStartPrompt = b; } void setWizardHasRun(bool b) { m_WizardHasRun = b; } void setProcessMode(ProcessMode p) { m_ProcessMode = p; } - void setGameModeIndex(int i) { m_GameModeIndex = i; } - void setGamePollingDynamic(bool b) { m_GamePollingDynamic = b; } - void setGamePollingFrequency(int i) { m_GamePollingFrequency = i; } void loadSettings(); void saveSettings(); @@ -100,9 +94,6 @@ class AppConfig bool m_AutoStartPrompt; bool m_WizardHasRun; ProcessMode m_ProcessMode; - int m_GameModeIndex; - bool m_GamePollingDynamic; - int m_GamePollingFrequency; static const char m_SynergysName[]; static const char m_SynergycName[]; diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 412850d2..f5716f3e 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -81,7 +81,6 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pLabelIpAddresses->setText(getIPAddresses()); m_SetupWizard = new SetupWizard(*this, false); - connect(m_SetupWizard, SIGNAL(finished(int)), this, SLOT(wizardFinished())); #if defined(Q_OS_WIN) // ipc must always be enabled, so that we can disable command when switching to desktop mode. @@ -118,17 +117,15 @@ void MainWindow::start(bool firstRun) m_versionChecker.checkLatest(); } -void MainWindow::wizardFinished() -{ - onModeChanged(true, true); -} - void MainWindow::onModeChanged(bool startDesktop, bool applyService) { refreshApplyButton(); 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())); @@ -361,9 +358,10 @@ void MainWindow::startSynergy() if (desktopMode) { stopSynergy(); - setSynergyState(synergyConnecting); } + setSynergyState(synergyConnecting); + QString app; QStringList args; @@ -372,28 +370,6 @@ void MainWindow::startSynergy() if (!appConfig().screenName().isEmpty()) args << "--name" << appConfig().screenName(); - if (appConfig().gameModeIndex() != 0) - { - if (appConfig().gameModeIndex() == 1) - { - args << "--game-mode" << "xinput"; - } - else if (appConfig().gameModeIndex() == 2) - { - args << "--game-mode" << "joyinfoex"; - } - - if (appConfig().gamePollingDynamic()) - { - args << "--game-poll" << "dynamic"; - } - else - { - args << "--game-poll" << "static"; - args << "--game-poll-freq" << QString::number(appConfig().gamePollingFrequency()); - } - } - if (desktopMode) { setSynergyProcess(new QProcess(this)); @@ -646,17 +622,16 @@ void MainWindow::setSynergyState(qSynergyState state) // only disable controls in desktop mode. in service mode, we can use the apply button. if (appConfig().processMode() == Desktop) { - m_pGroupClient->setEnabled(state == synergyDisconnected); - m_pGroupServer->setEnabled(state == synergyDisconnected); - m_pActionStartSynergy->setEnabled(state == synergyDisconnected); - m_pActionStopSynergy->setEnabled(state == synergyConnected); + setFormEnabled(state != synergyConnected); } switch (state) { - case synergyConnected: - setStatus(tr("Synergy is running.")); + case synergyConnected: { + QString mode(appConfig().processMode() == Service ? tr("service mode") : tr("desktop mode")); + setStatus(tr("Synergy is running (%1).").arg(mode)); break; + } case synergyConnecting: setStatus(tr("Synergy is starting.")); break; @@ -670,6 +645,14 @@ void MainWindow::setSynergyState(qSynergyState state) m_SynergyState = state; } +void MainWindow::setFormEnabled(bool enabled) +{ + m_pGroupClient->setEnabled(enabled); + m_pGroupServer->setEnabled(enabled); + m_pActionStartSynergy->setEnabled(enabled); + m_pActionStopSynergy->setEnabled(enabled); +} + void MainWindow::setVisible(bool visible) { m_pActionMinimize->setEnabled(visible); @@ -712,7 +695,7 @@ QString MainWindow::getIPAddresses() } if (result == "") { - return "Unknown"; + return tr("Unknown"); } // remove trailing comma. @@ -765,8 +748,15 @@ void MainWindow::on_m_pActionAbout_triggered() void MainWindow::on_m_pActionSettings_triggered() { + ProcessMode lastProcessMode = appConfig().processMode(); + SettingsDialog dlg(this, appConfig()); dlg.exec(); + + if (lastProcessMode != appConfig().processMode()) + { + onModeChanged(true, true); + } } void MainWindow::on_m_pButtonConfigureServer_clicked() diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 8c77310e..df22b364 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -113,7 +113,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void logError(); void updateFound(const QString& version); void refreshApplyButton(); - void wizardFinished(); protected: QSettings& settings() { return m_Settings; } @@ -140,6 +139,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase QString getScreenName(); void stopService(); void stopDesktop(); + void setFormEnabled(bool enabled); private: QSettings& m_Settings; diff --git a/src/gui/src/SettingsDialog.cpp b/src/gui/src/SettingsDialog.cpp index cf1cc517..4fd50086 100644 --- a/src/gui/src/SettingsDialog.cpp +++ b/src/gui/src/SettingsDialog.cpp @@ -33,20 +33,12 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) : m_pLineEditScreenName->setText(appConfig().screenName()); m_pSpinBoxPort->setValue(appConfig().port()); m_pLineEditInterface->setText(appConfig().interface()); + m_pComboProcessMode->setCurrentIndex(appConfig().processMode()); m_pComboLogLevel->setCurrentIndex(appConfig().logLevel()); m_pCheckBoxLogToFile->setChecked(appConfig().logToFile()); m_pLineEditLogFilename->setText(appConfig().logFilename()); m_pCheckBoxAutoStart->setChecked(appConfig().autoStart()); m_pCheckBoxAutoHide->setChecked(appConfig().autoHide()); - -#ifdef Q_OS_WIN - m_pComboBoxGameDevice->setCurrentIndex(appConfig().gameModeIndex()); - m_pRadioButtonGamePollDynamic->setChecked(appConfig().gamePollingDynamic()); - m_pRadioButtonGamePollStatic->setChecked(!appConfig().gamePollingDynamic()); - m_pSpinBoxGamePoll->setValue(appConfig().gamePollingFrequency()); -#else - m_pGroupGameDevices->setEnabled(false); -#endif } void SettingsDialog::accept() @@ -55,14 +47,12 @@ void SettingsDialog::accept() appConfig().setScreenName(m_pLineEditScreenName->text()); appConfig().setPort(m_pSpinBoxPort->value()); appConfig().setInterface(m_pLineEditInterface->text()); + appConfig().setProcessMode((ProcessMode)m_pComboProcessMode->currentIndex()); appConfig().setLogLevel(m_pComboLogLevel->currentIndex()); appConfig().setLogToFile(m_pCheckBoxLogToFile->isChecked()); appConfig().setLogFilename(m_pLineEditLogFilename->text()); appConfig().setAutoStart(m_pCheckBoxAutoStart->isChecked()); appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked()); - appConfig().setGameModeIndex(m_pComboBoxGameDevice->currentIndex()); - appConfig().setGamePollingDynamic(m_pRadioButtonGamePollDynamic->isChecked()); - appConfig().setGamePollingFrequency(m_pSpinBoxGamePoll->value()); QDialog::accept(); } diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index 180d8939..6c33f97c 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -62,18 +62,6 @@ bool SetupWizard::validateCurrentPage() message.exec(); } } - else if(currentPage() == m_pStartupPage) - { - result = m_pServiceRadioButton->isChecked() || - m_pDesktopRadioButton->isChecked() || - m_pNoneRadioButton->isChecked(); - - if (!result) - { - message.setText(tr("Please select an option.")); - message.exec(); - } - } return result; } @@ -82,21 +70,7 @@ void SetupWizard::handlefinished() close(); AppConfig& appConfig = m_MainWindow.appConfig(); - if (m_pServiceRadioButton->isChecked()) - { - appConfig.setProcessMode(Service); - } - else if (m_pDesktopRadioButton->isChecked()) - { - appConfig.setProcessMode(Desktop); - appConfig.setAutoStart(true); - appConfig.setAutoConnect(true); - } - else if (m_pNoneRadioButton->isChecked()) - { - // still use desktop mode, but don't auto start. - appConfig.setProcessMode(Desktop); - } + appConfig.setWizardHasRun(true); appConfig.saveSettings();