7
7
8
8
#ifdef USE_ZEROCONF
9
9
# include " Zeroconf.h"
10
- # include " BonjourServiceBrowser.h"
11
- # include " BonjourServiceResolver.h"
12
10
#endif
13
11
14
12
#include " Channel.h"
@@ -1033,22 +1031,16 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
1033
1031
startDns (si);
1034
1032
qtwServers->siFavorite ->addServerItem (si);
1035
1033
}
1036
-
1037
1034
#ifdef USE_ZEROCONF
1038
- // Make sure the we got the objects we need, then wire them up
1039
- if (bAllowZeroconf && g.zeroconf ->bsbBrowser && g.zeroconf ->bsrResolver ) {
1040
- connect (g.zeroconf ->bsbBrowser .data (), SIGNAL (error (DNSServiceErrorType)), this ,
1041
- SLOT (onLanBrowseError (DNSServiceErrorType)));
1042
- connect (g.zeroconf ->bsbBrowser .data (), SIGNAL (currentBonjourRecordsChanged (const QList< BonjourRecord > &)),
1043
- this , SLOT (onUpdateLanList (const QList< BonjourRecord > &)));
1044
- connect (g.zeroconf ->bsrResolver .data (), SIGNAL (error (BonjourRecord, DNSServiceErrorType)), this ,
1045
- SLOT (onLanResolveError (BonjourRecord, DNSServiceErrorType)));
1046
- connect (g.zeroconf ->bsrResolver .data (), SIGNAL (bonjourRecordResolved (BonjourRecord, QString, int )), this ,
1047
- SLOT (onResolved (BonjourRecord, QString, int )));
1048
- onUpdateLanList (g.zeroconf ->bsbBrowser ->currentRecords ());
1035
+ if (bAllowZeroconf && g.zeroconf && g.zeroconf ->isOk ()) {
1036
+ connect (g.zeroconf , &Zeroconf::recordsChanged, this , &ConnectDialog::onUpdateLanList);
1037
+ connect (g.zeroconf , &Zeroconf::recordResolved, this , &ConnectDialog::onResolved);
1038
+ connect (g.zeroconf , &Zeroconf::resolveError, this , &ConnectDialog::onLanResolveError);
1039
+ onUpdateLanList (g.zeroconf ->currentRecords ());
1040
+
1041
+ g.zeroconf ->startBrowser (QLatin1String (" _mumble._tcp" ));
1049
1042
}
1050
1043
#endif
1051
-
1052
1044
qtPingTick = new QTimer (this );
1053
1045
connect (qtPingTick, SIGNAL (timeout ()), this , SLOT (timeTick ()));
1054
1046
@@ -1082,6 +1074,12 @@ ConnectDialog::ConnectDialog(QWidget *p, bool autoconnect) : QDialog(p), bAutoCo
1082
1074
}
1083
1075
1084
1076
ConnectDialog::~ConnectDialog () {
1077
+ #ifdef USE_ZEROCONF
1078
+ if (bAllowZeroconf && g.zeroconf && g.zeroconf ->isOk ()) {
1079
+ g.zeroconf ->stopBrowser ();
1080
+ g.zeroconf ->cleanupResolvers ();
1081
+ }
1082
+ #endif
1085
1083
ServerItem::qmIcons.clear ();
1086
1084
1087
1085
QList< FavoriteServer > ql;
@@ -1356,7 +1354,7 @@ void ConnectDialog::initList() {
1356
1354
}
1357
1355
1358
1356
#ifdef USE_ZEROCONF
1359
- void ConnectDialog::onResolved (BonjourRecord record, QString host, int port) {
1357
+ void ConnectDialog::onResolved (const BonjourRecord record, const QString host, const uint16_t port) {
1360
1358
qlBonjourActive.removeAll (record);
1361
1359
foreach (ServerItem *si, qlItems) {
1362
1360
if (si->zeroconfRecord == record) {
@@ -1393,7 +1391,7 @@ void ConnectDialog::onUpdateLanList(const QList< BonjourRecord > &list) {
1393
1391
if (!found) {
1394
1392
ServerItem *si = new ServerItem (record);
1395
1393
qlItems << si;
1396
- g.zeroconf ->bsrResolver -> resolveBonjourRecord (record);
1394
+ g.zeroconf ->startResolver (record);
1397
1395
startDns (si);
1398
1396
qtwServers->siLAN ->addServerItem (si);
1399
1397
}
@@ -1406,13 +1404,8 @@ void ConnectDialog::onUpdateLanList(const QList< BonjourRecord > &list) {
1406
1404
}
1407
1405
}
1408
1406
1409
- void ConnectDialog::onLanBrowseError (DNSServiceErrorType err) {
1410
- qWarning () << " Bonjour reported browser error " << err;
1411
- }
1412
-
1413
- void ConnectDialog::onLanResolveError (BonjourRecord br, DNSServiceErrorType err) {
1414
- qlBonjourActive.removeAll (br);
1415
- qWarning () << " Bonjour reported resolver error " << err;
1407
+ void ConnectDialog::onLanResolveError (const BonjourRecord record) {
1408
+ qlBonjourActive.removeAll (record);
1416
1409
}
1417
1410
#endif
1418
1411
@@ -1627,17 +1620,15 @@ void ConnectDialog::startDns(ServerItem *si) {
1627
1620
foreach (const ServerAddress &addr, si->qlAddresses ) { qhPings[addr].insert (si); }
1628
1621
return ;
1629
1622
}
1630
-
1631
1623
#ifdef USE_ZEROCONF
1632
1624
if (bAllowZeroconf && si->qsHostname .isEmpty () && !si->zeroconfRecord .serviceName .isEmpty ()) {
1633
1625
if (!qlBonjourActive.contains (si->zeroconfRecord )) {
1634
- g.zeroconf ->bsrResolver -> resolveBonjourRecord (si->zeroconfRecord );
1626
+ g.zeroconf ->startResolver (si->zeroconfRecord );
1635
1627
qlBonjourActive.append (si->zeroconfRecord );
1636
1628
}
1637
1629
return ;
1638
1630
}
1639
1631
#endif
1640
-
1641
1632
if (!qhDNSWait.contains (unresolved)) {
1642
1633
if (si->itType == ServerItem::PublicType)
1643
1634
qlDNSLookup.append (unresolved);
0 commit comments