diff --git a/src/gui/res/MainWindowBase.ui b/src/gui/res/MainWindowBase.ui
index a428a6a4..cb5e9a65 100644
--- a/src/gui/res/MainWindowBase.ui
+++ b/src/gui/res/MainWindowBase.ui
@@ -241,12 +241,22 @@
-
-
+
Auto connect
+ -
+
+
+ Server list:
+
+
+
+ -
+
+
diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp
index ac67e654..b11545ff 100644
--- a/src/gui/src/MainWindow.cpp
+++ b/src/gui/src/MainWindow.cpp
@@ -116,7 +116,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
promptAutoConnect();
}
- m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect());
+ m_pCheckBoxAutoConnect->setChecked(appConfig.autoConnect());
}
MainWindow::~MainWindow()
@@ -517,7 +517,20 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
args << "--log" << appConfig().logFilenameCmd();
}
- args << m_pLineEditHostname->text() + ":" + QString::number(appConfig().port());
+ if (m_pCheckBoxAutoConnect->isChecked()) {
+ if (m_pComboServerList->count() == 0) {
+ QMessageBox::warning(this, tr("No server detected"),
+ tr("Sorry, Synergy doesn't detect any server."));
+ return false;
+ }
+ else {
+ QString serverIp = m_pComboServerList->currentText();
+ args << serverIp + ":" + QString::number(appConfig().port());
+ }
+ }
+ else {
+ args << m_pLineEditHostname->text() + ":" + QString::number(appConfig().port());
+ }
return true;
}
@@ -804,6 +817,13 @@ void MainWindow::updateZeroconfService()
}
}
+void MainWindow::serverDetected(const QString name)
+{
+ if (m_pComboServerList->findText(name) == -1) {
+ m_pComboServerList->addItem(name);
+ }
+}
+
void MainWindow::on_m_pGroupClient_toggled(bool on)
{
m_pGroupServer->setChecked(!on);
@@ -905,7 +925,7 @@ void MainWindow::on_m_pButtonApply_clicked()
startSynergy();
}
-void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked)
+void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
{
if (!isBonjourRunning() && checked) {
int r = QMessageBox::warning(
@@ -918,13 +938,17 @@ void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked)
downloadBonjour();
}
- m_pAutoConnectCheckBox->setChecked(false);
+ m_pCheckBoxAutoConnect->setChecked(false);
return;
}
m_pLineEditHostname->setDisabled(checked);
appConfig().setAutoConnect(checked);
updateZeroconfService();
+
+ if (!checked) {
+ m_pComboServerList->clear();
+ }
}
bool MainWindow::isServiceRunning(QString name)
@@ -1051,3 +1075,10 @@ void MainWindow::promptAutoConnect()
m_AppConfig.setAutoConnectPrompted(true);
}
+
+void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
+{
+ if (m_pComboServerList->count() != 0) {
+ startSynergy();
+ }
+}
diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h
index 3b4b3828..0fa7dd27 100644
--- a/src/gui/src/MainWindow.h
+++ b/src/gui/src/MainWindow.h
@@ -101,6 +101,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void showConfigureServer() { showConfigureServer(""); }
void autoAddScreen(const QString name);
void updateZeroconfService();
+ void serverDetected(const QString name);
public slots:
void appendLogRaw(const QString& text);
@@ -177,7 +178,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QAbstractButton* m_pCancelButton;
private slots:
- void on_m_pAutoConnectCheckBox_toggled(bool checked);
+ void on_m_pComboServerList_currentIndexChanged(QString );
+ void on_m_pCheckBoxAutoConnect_toggled(bool checked);
void on_m_pButtonApply_clicked();
void installBonjour();
};
diff --git a/src/gui/src/ZeroconfService.cpp b/src/gui/src/ZeroconfService.cpp
index 26552207..fec08447 100644
--- a/src/gui/src/ZeroconfService.cpp
+++ b/src/gui/src/ZeroconfService.cpp
@@ -73,9 +73,9 @@ void ZeroconfService::serverDetected(const QList& list)
{
foreach (ZeroconfRecord record, list) {
registerService(false);
- m_pMainWindow->m_pLineEditHostname->setText(record.serviceName);
m_pMainWindow->appendLogNote(tr("zeroconf server detected: %1").arg(
record.serviceName));
+ m_pMainWindow->serverDetected(record.serviceName);
}
if (!list.isEmpty()) {