diff --git a/example/window.cpp b/example/window.cpp index 61abf41..af3f165 100644 --- a/example/window.cpp +++ b/example/window.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "window.h" #ifdef Q_OS_IOS @@ -55,6 +56,7 @@ mainWindow::mainWindow() connect(&zeroConf, &QZeroConf::serviceAdded, this, &mainWindow::addService); connect(&zeroConf, &QZeroConf::serviceRemoved, this, &mainWindow::removeService); + connect(&zeroConf, &QZeroConf::serviceUpdated, this, &mainWindow::updateService); connect(qGuiApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(appStateChanged(Qt::ApplicationState))); publishEnabled = 1; @@ -149,6 +151,7 @@ void mainWindow::addService(QZeroConfService zcs) { qint32 row; QTableWidgetItem *cell; + qDebug() << "Added service: " << zcs; row = table.rowCount(); table.insertRow(row); @@ -166,6 +169,7 @@ void mainWindow::removeService(QZeroConfService zcs) { qint32 i, row; QTableWidgetItem *nameItem, *ipItem; + qDebug() << "Removed service: " << zcs; QList search = table.findItems(zcs.name(), Qt::MatchExactly); for (i=0; iname() == rhs.name() && (this->ip() == rhs.ip() || this->ipv6() == rhs.ipv6()); } + +QDebug operator<<(QDebug debug, const QZeroConfService &service) +{ + QDebugStateSaver saver(debug); + debug.nospace() << "Zeroconf Service: " + service.name() + " @ " + service.host() + " ("+ service.ip().toString() + ":" + QString::number( service.port()) + ")"; + return debug.maybeSpace(); +} \ No newline at end of file diff --git a/qzeroconfservice.h b/qzeroconfservice.h index 0156032..0cd2677 100644 --- a/qzeroconfservice.h +++ b/qzeroconfservice.h @@ -50,6 +50,8 @@ private: QExplicitlySharedDataPointer data; }; +QDebug operator<<(QDebug debug, const QZeroConfService &service); + Q_DECLARE_METATYPE(QZeroConfService) #endif // QZEROCONFSERVICE_H