Check is Bonjour running before update zeroconf
This commit is contained in:
parent
6ef744cd81
commit
588494a730
|
@ -75,8 +75,7 @@ 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_BonjourRunning(true)
|
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
@ -106,13 +105,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||||
setMinimumSize(size());
|
setMinimumSize(size());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
m_BonjourRunning = isServiceRunning("Bonjour Service");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_BonjourRunning) {
|
|
||||||
updateZeroconfService();
|
updateZeroconfService();
|
||||||
}
|
|
||||||
|
|
||||||
m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect());
|
m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect());
|
||||||
}
|
}
|
||||||
|
@ -784,6 +777,7 @@ void MainWindow::changeEvent(QEvent* event)
|
||||||
|
|
||||||
void MainWindow::updateZeroconfService()
|
void MainWindow::updateZeroconfService()
|
||||||
{
|
{
|
||||||
|
if (isBonjourRunning()) {
|
||||||
if (!m_AppConfig.wizardShouldRun()) {
|
if (!m_AppConfig.wizardShouldRun()) {
|
||||||
if (m_pZeroconfService) {
|
if (m_pZeroconfService) {
|
||||||
delete m_pZeroconfService;
|
delete m_pZeroconfService;
|
||||||
|
@ -794,6 +788,7 @@ void MainWindow::updateZeroconfService()
|
||||||
m_pZeroconfService = new ZeroconfService(this);
|
m_pZeroconfService = new ZeroconfService(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||||
|
@ -937,3 +932,16 @@ bool MainWindow::isServiceRunning(QString name)
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::isBonjourRunning()
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
result = isServiceRunning("Bonjour Service");
|
||||||
|
#else
|
||||||
|
result = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
void changeEvent(QEvent* event);
|
void changeEvent(QEvent* event);
|
||||||
void retranslateMenuBar();
|
void retranslateMenuBar();
|
||||||
bool isServiceRunning(QString name);
|
bool isServiceRunning(QString name);
|
||||||
|
bool isBonjourRunning();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSettings& m_Settings;
|
QSettings& m_Settings;
|
||||||
|
@ -166,7 +167,6 @@ 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_BonjourRunning;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_pAutoConnectCheckBox_toggled(bool checked);
|
void on_m_pAutoConnectCheckBox_toggled(bool checked);
|
||||||
|
|
Loading…
Reference in New Issue