Added download Bonjour code

This commit is contained in:
Xinyu Hou 2014-11-12 14:21:54 +00:00
parent 330121ce55
commit 5bd65b5426
2 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include <QMenuBar>
#include <QMessageBox>
#include <QFileDialog>
#include <QDesktopServices>
#if defined(Q_OS_MAC)
#include <ApplicationServices/ApplicationServices.h>
@ -48,6 +49,7 @@
#if defined(Q_OS_WIN)
static const char synergyConfigName[] = "synergy.sgc";
static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.sgc);;All files (*.*)"));
static const char BonjourUrl[] = "http://synergy-project.org/bonjour/BonjourPSSetup.exe";
#else
static const char synergyConfigName[] = "synergy.conf";
static const QString synergyConfigFilter(QObject::tr("Synergy Configurations (*.conf);;All files (*.*)"));
@ -907,7 +909,7 @@ void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked)
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
downloadBonjour();
}
else {
m_pAutoConnectCheckBox->setChecked(false);
@ -969,3 +971,10 @@ bool MainWindow::isBonjourRunning()
return result;
}
void MainWindow::downloadBonjour()
{
#if defined(Q_OS_WIN)
QDesktopServices::openUrl(QUrl(BonjourUrl));
#endif
}

View File

@ -148,6 +148,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void retranslateMenuBar();
bool isServiceRunning(QString name);
bool isBonjourRunning();
void downloadBonjour();
private:
QSettings& m_Settings;