forked from jbagg/QtZeroConf
Added debug operator<< to QZeroConfService
Signed-off-by: Jonathan Bagg <drwho@infidigm.net>
This commit is contained in:
committed by
Jonathan Bagg
parent
802572f50f
commit
6c9553bd5e
@ -30,6 +30,7 @@
|
||||
#include <QTableWidgetItem>
|
||||
#include <QNetworkInterface>
|
||||
#include <QHeaderView>
|
||||
#include <QDebug>
|
||||
#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 <QTableWidgetItem*> search = table.findItems(zcs.name(), Qt::MatchExactly);
|
||||
for (i=0; i<search.size(); i++) {
|
||||
@ -179,3 +183,8 @@ void mainWindow::removeService(QZeroConfService zcs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindow::updateService(QZeroConfService zcs)
|
||||
{
|
||||
qDebug() << "Service updated: " << zcs;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ private slots:
|
||||
void stopPublishClicked();
|
||||
void addService(QZeroConfService item);
|
||||
void removeService(QZeroConfService item);
|
||||
void updateService(QZeroConfService zcs);
|
||||
};
|
||||
|
||||
#endif /* WINDOW_H_ */
|
||||
|
@ -142,3 +142,10 @@ bool QZeroConfService::operator==(const QZeroConfService &rhs) const
|
||||
{
|
||||
return this->name() == 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();
|
||||
}
|
@ -50,6 +50,8 @@ private:
|
||||
QExplicitlySharedDataPointer<QZeroConfServiceData> data;
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug debug, const QZeroConfService &service);
|
||||
|
||||
Q_DECLARE_METATYPE(QZeroConfService)
|
||||
|
||||
#endif // QZEROCONFSERVICE_H
|
||||
|
Reference in New Issue
Block a user