From 330121ce55e51173866a0d9618c33e745a4ea6e5 Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Wed, 12 Nov 2014 13:17:49 +0000 Subject: [PATCH] Asked users if they want to install Bonjour --- src/gui/src/MainWindow.cpp | 27 ++++++++++++++++++++++++--- src/gui/src/MainWindow.h | 1 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 76909e46..de6ff520 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -75,7 +75,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pMenuEdit(NULL), m_pMenuWindow(NULL), m_pMenuHelp(NULL), - m_pZeroconfService(NULL) + m_pZeroconfService(NULL), + m_SuppressBonjourWarning(appConfig.autoConnect()) { setupUi(this); @@ -105,8 +106,6 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : setMinimumSize(size()); #endif - updateZeroconfService(); - m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect()); } @@ -894,6 +893,28 @@ void MainWindow::on_m_pButtonApply_clicked() void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked) { + if (!isBonjourRunning() && checked) { + if (m_SuppressBonjourWarning) { + m_pAutoConnectCheckBox->setChecked(false); + m_SuppressBonjourWarning = false; + return; + } + + int r = QMessageBox::warning( + this, tr("Synergy"), + tr("Auto connect feature requires Bonjour installed.\n\n" + "Do you want to install Bonjour?"), + QMessageBox::Yes | QMessageBox::No); + + if (r == QMessageBox::Yes) { + + } + else { + m_pAutoConnectCheckBox->setChecked(false); + return; + } + } + m_pLineEditHostname->setDisabled(checked); appConfig().setAutoConnect(checked); updateZeroconfService(); diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 1221211f..20cd3739 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -167,6 +167,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase QMenu* m_pMenuWindow; QMenu* m_pMenuHelp; ZeroconfService* m_pZeroconfService; + bool m_SuppressBonjourWarning; private slots: void on_m_pAutoConnectCheckBox_toggled(bool checked);