Asked users if they want to install Bonjour

This commit is contained in:
Xinyu Hou 2014-11-12 13:17:49 +00:00
parent 5db30cff74
commit 330121ce55
2 changed files with 25 additions and 3 deletions

View File

@ -75,7 +75,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pMenuEdit(NULL), m_pMenuEdit(NULL),
m_pMenuWindow(NULL), m_pMenuWindow(NULL),
m_pMenuHelp(NULL), m_pMenuHelp(NULL),
m_pZeroconfService(NULL) m_pZeroconfService(NULL),
m_SuppressBonjourWarning(appConfig.autoConnect())
{ {
setupUi(this); setupUi(this);
@ -105,8 +106,6 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
setMinimumSize(size()); setMinimumSize(size());
#endif #endif
updateZeroconfService();
m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect()); m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect());
} }
@ -894,6 +893,28 @@ void MainWindow::on_m_pButtonApply_clicked()
void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked) 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); m_pLineEditHostname->setDisabled(checked);
appConfig().setAutoConnect(checked); appConfig().setAutoConnect(checked);
updateZeroconfService(); updateZeroconfService();

View File

@ -167,6 +167,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QMenu* m_pMenuWindow; QMenu* m_pMenuWindow;
QMenu* m_pMenuHelp; QMenu* m_pMenuHelp;
ZeroconfService* m_pZeroconfService; ZeroconfService* m_pZeroconfService;
bool m_SuppressBonjourWarning;
private slots: private slots:
void on_m_pAutoConnectCheckBox_toggled(bool checked); void on_m_pAutoConnectCheckBox_toggled(bool checked);