Resolved Auto-conf server select #4218
This commit is contained in:
parent
6cb589d18e
commit
f0cb271902
|
@ -241,12 +241,22 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="m_pAutoConnectCheckBox">
|
||||
<widget class="QCheckBox" name="m_pCheckBoxAutoConnect">
|
||||
<property name="text">
|
||||
<string>Auto connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="m_pLabelServerList">
|
||||
<property name="text">
|
||||
<string>Server list:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="m_pComboServerList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -73,9 +73,9 @@ void ZeroconfService::serverDetected(const QList<ZeroconfRecord>& 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()) {
|
||||
|
|
Loading…
Reference in New Issue