* made service mode default (and changed setting key so new installs use service as default).

* removed startup mode wizard screen and move process mode to settings dialog.
* fixed: form can get stuck on disabled when switching from desktop to service mode.
* stripped out game controller stuff (this will probably be moved to a plugin setting file in future).
This commit is contained in:
Nick Bolton 2012-07-28 22:58:51 +00:00
parent 5193dc510f
commit 377858334b
8 changed files with 74 additions and 347 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>383</width>
<height>470</height>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
@ -42,9 +42,6 @@
<property name="text">
<string>P&amp;ort:</string>
</property>
<property name="buddy">
<cstring>m_pSpinBoxGamePoll</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
@ -83,6 +80,30 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_pLabel_22">
<property name="text">
<string>&amp;Process mode:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="m_pComboProcessMode">
<item>
<property name="text">
<string>Service</string>
</property>
</item>
<item>
<property name="text">
<string>Desktop (legacy)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
@ -96,7 +117,7 @@
</property>
</widget>
</item>
<item row="4" column="0" rowspan="2" colspan="2">
<item row="3" column="0" rowspan="2" colspan="2">
<widget class="QGroupBox" name="m_pGroupLog">
<property name="title">
<string>Logging</string>
@ -178,103 +199,6 @@
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="m_pGroupGameDevices">
<property name="title">
<string>&amp;Game device support</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="m_pLabel_22">
<property name="text">
<string>&amp;Mode:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_pComboBoxGameDevice">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Next Generation (XInput) - 32-bit only</string>
</property>
</item>
<item>
<property name="text">
<string>Legacy (JOYINFOEX)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="m_pLabel_23">
<property name="text">
<string>&amp;Polling:</string>
</property>
<property name="buddy">
<cstring>m_pLineEditInterface</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QRadioButton" name="m_pRadioButtonGamePollDynamic">
<property name="text">
<string>Dynamic (align with client polling)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="m_pRadioButtonGamePollStatic">
<property name="text">
<string>Static frequency:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_pSpinBoxGamePoll">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="m_pGroupStart">
<property name="title">
@ -305,6 +229,19 @@
</layout>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>

View File

@ -125,155 +125,6 @@
</item>
</layout>
</widget>
<widget class="QWizardPage" name="m_pStartupPage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Startup Mode</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="m_pServiceRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;Service</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pServiceLabel">
<property name="text">
<string>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 &quot;Desktop&quot; option.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="m_pDesktopRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;Desktop</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pDesktopLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Synergy will start when your desktop loads (after you login). This mode can help if you experience problems with the &quot;Service&quot; option.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="m_pNoneRadioButton">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&amp;None</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pNoneLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Do not start Synergy when your computer starts.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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