Reformat project with clang-format

This commit is contained in:
Alexander Lohnau 2023-09-25 06:31:46 +02:00
parent a8adedd100
commit dc8f3e209e
11 changed files with 178 additions and 113 deletions

View file

@ -47,8 +47,8 @@ void BluetoothLinkProvider::onStart()
mKdeconnectService = mBluetoothServer->listen(mServiceUuid, QStringLiteral("KDE Connect"));
// Disabled for the moment as once the server is listening, the client will not be able to connect anyway
//mServiceDiscoveryAgent->start();
//connectTimer->start();
// mServiceDiscoveryAgent->start();
// connectTimer->start();
}
void BluetoothLinkProvider::onStop()
@ -105,7 +105,9 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i
{
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered executed ";
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered info: " << old_info.device().address() << old_info.serviceName() << old_info.serviceDescription() << old_info.socketProtocol() << old_info.isValid() << old_info.isComplete() << old_info.isRegistered() << old_info.serviceClassUuids();
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered info: " << old_info.device().address() << old_info.serviceName()
<< old_info.serviceDescription() << old_info.socketProtocol() << old_info.isValid() << old_info.isComplete()
<< old_info.isRegistered() << old_info.serviceClassUuids();
auto info = *(new QBluetoothServiceInfo(old_info));
info.setServiceUuid(mServiceUuid);
@ -113,7 +115,7 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered sockets contains address, returning";
return;
}
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered before creating socket";
QBluetoothSocket *socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
@ -134,7 +136,7 @@ void BluetoothLinkProvider::serviceDiscovered(const QBluetoothServiceInfo &old_i
#endif
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider::serviceDiscovered about to call connectToService";
socket->connectToService(info);
qCDebug(KDECONNECT_CORE) << "BluetoothLinkProvider Connecting to" << info.device().address();

View file

@ -128,13 +128,13 @@ bool ConnectionMultiplexer::tryParseMessage()
uint16_t message_length = qFromBigEndian<uint16_t>(&header.data()[1]);
quint128 message_uuid_raw;
#ifndef QT_SUPPORTS_INT128
#ifndef QT_SUPPORTS_INT128
for (int i = 0; i < 16; ++i) {
message_uuid_raw.data[i] = header[3 + i];
}
#else
#else
message_uuid_raw = qFromBigEndian<quint128>(&header.data()[3]);
#endif
#endif
QBluetoothUuid message_uuid = QBluetoothUuid(message_uuid_raw);
// Check if we have the full message including its data

View file

@ -18,7 +18,6 @@
namespace MdnsWrapper
{
const char *recordTypeToStr(int rtype)
{
switch (rtype) {
@ -79,10 +78,22 @@ static sockaddr_in6 qHostAddressToSockaddr6(QHostAddress hostAddress)
}
// Callback that handles responses to a query
static int query_callback(int sock, const struct sockaddr* from, size_t addrlen, mdns_entry_type_t entry_type,
uint16_t query_id, uint16_t record_type, uint16_t rclass, uint32_t ttl, const void* data,
size_t size, size_t name_offset, size_t name_length, size_t record_offset,
size_t record_length, void* user_data) {
static int query_callback(int sock,
const struct sockaddr *from,
size_t addrlen,
mdns_entry_type_t entry_type,
uint16_t query_id,
uint16_t record_type,
uint16_t rclass,
uint32_t ttl,
const void *data,
size_t size,
size_t name_offset,
size_t name_length,
size_t record_offset,
size_t record_length,
void *user_data)
{
Q_UNUSED(sock);
Q_UNUSED(addrlen);
Q_UNUSED(query_id);
@ -92,18 +103,20 @@ static int query_callback(int sock, const struct sockaddr* from, size_t addrlen,
Q_UNUSED(name_offset);
Q_UNUSED(name_length);
//qCDebug(KDECONNECT_CORE) << "Received DNS record of type" << recordTypeToStr(record_type) << "from socket" << sock << "with type" << entryTypeToStr(entry_type);
// qCDebug(KDECONNECT_CORE) << "Received DNS record of type" << recordTypeToStr(record_type) << "from socket" << sock << "with type" <<
// entryTypeToStr(entry_type);
Discoverer::MdnsService *discoveredService = (Discoverer::MdnsService *)user_data;
switch (record_type) {
case MDNS_RECORDTYPE_PTR: {
// We don't use mdns_record_parse_ptr() because we want to extract just the service name instead of the full "<instance-name>._<service-type>._tcp.local." string
// We don't use mdns_record_parse_ptr() because we want to extract just the service name instead of the full
// "<instance-name>._<service-type>._tcp.local." string
mdns_string_pair_t instanceNamePos = mdns_get_next_substring(data, size, record_offset);
discoveredService->name = QString::fromLatin1((char *)data + instanceNamePos.offset, instanceNamePos.length);
//static char instanceNameBuffer[256];
//mdns_string_t instanceName = mdns_record_parse_ptr(data, size, record_offset, record_length, instanceNameBuffer, sizeof(instanceNameBuffer));
//discoveredService->name = QString::fromLatin1(instanceName.str, instanceName.length);
// static char instanceNameBuffer[256];
// mdns_string_t instanceName = mdns_record_parse_ptr(data, size, record_offset, record_length, instanceNameBuffer, sizeof(instanceNameBuffer));
// discoveredService->name = QString::fromLatin1(instanceName.str, instanceName.length);
if (discoveredService->address == QHostAddress::Null) {
discoveredService->address = QHostAddress(from); // In case we don't receive a A record, use from as address
}
@ -112,7 +125,7 @@ static int query_callback(int sock, const struct sockaddr* from, size_t addrlen,
static char nameBuffer[256];
mdns_record_srv_t record = mdns_record_parse_srv(data, size, record_offset, record_length, nameBuffer, sizeof(nameBuffer));
// We can use the IP to connect so we don't need to store the "<hostname>.local." address.
//discoveredService->qualifiedHostname = QString::fromLatin1(record.name.str, record.name.length);
// discoveredService->qualifiedHostname = QString::fromLatin1(record.name.str, record.name.length);
discoveredService->port = record.port;
} break;
case MDNS_RECORDTYPE_A: {
@ -122,8 +135,8 @@ static int query_callback(int sock, const struct sockaddr* from, size_t addrlen,
} break;
case MDNS_RECORDTYPE_AAAA:
// Ignore IPv6 for now
//sockaddr_in6 addr6;
//mdns_record_parse_aaaa(data, size, record_offset, record_length, &addr6);
// sockaddr_in6 addr6;
// mdns_record_parse_aaaa(data, size, record_offset, record_length, &addr6);
break;
case MDNS_RECORDTYPE_TXT: {
mdns_record_txt_t records[24];
@ -251,7 +264,8 @@ static mdns_string_t createMdnsString(const QByteArray &str)
return mdns_string_t{str.constData(), (size_t)str.length()};
}
int countCommonLeadingBits(quint32 int1, quint32 int2) {
int countCommonLeadingBits(quint32 int1, quint32 int2)
{
int count = 0;
while (int1 != 0 && int2 != 0) {
if ((int1 & 0x80000000) == (int2 & 0x80000000)) {
@ -283,7 +297,7 @@ static QHostAddress findBestAddressMatchV4(const QVector<QHostAddress> &hostAddr
QHostAddress matchingIp = hostAddresses[0];
int matchingBits = -1;
quint32 rawOtherIp = otherIp.toIPv4Address();
for (const QHostAddress& ip : hostAddresses) {
for (const QHostAddress &ip : hostAddresses) {
Q_ASSERT(ip.protocol() == QAbstractSocket::IPv4Protocol);
quint32 rawMyIp = ip.toIPv4Address();
// Since we don't have the network mask, we just compare the prefixes of the IPs to find the longest match
@ -299,7 +313,7 @@ static QHostAddress findBestAddressMatchV4(const QVector<QHostAddress> &hostAddr
return matchingIp;
}
static QHostAddress findBestAddressMatchV6(const QVector<QHostAddress>& hostAddresses, const struct sockaddr *fromAddress)
static QHostAddress findBestAddressMatchV6(const QVector<QHostAddress> &hostAddresses, const struct sockaddr *fromAddress)
{
Q_ASSERT(!hostAddresses.empty());
// We could do the same logic for v6 that we do for V4, but we don't care that much about IPv6
@ -349,10 +363,22 @@ static mdns_record_t createMdnsRecord(const Announcer::AnnouncedInfo &self,
}
// Callback handling questions incoming on service sockets
static int service_callback(int sock, const struct sockaddr* from, size_t addrlen, mdns_entry_type_t entry_type,
uint16_t query_id, uint16_t record_type, uint16_t rclass, uint32_t ttl, const void* data,
size_t size, size_t name_offset, size_t name_length, size_t record_offset,
size_t record_length, void* user_data) {
static int service_callback(int sock,
const struct sockaddr *from,
size_t addrlen,
mdns_entry_type_t entry_type,
uint16_t query_id,
uint16_t record_type,
uint16_t rclass,
uint32_t ttl,
const void *data,
size_t size,
size_t name_offset,
size_t name_length,
size_t record_offset,
size_t record_length,
void *user_data)
{
Q_UNUSED(ttl);
Q_UNUSED(name_length);
Q_UNUSED(record_offset);
@ -379,9 +405,20 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle
uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE);
if (unicast) {
ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id,
(mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length,
answer, nullptr, 0, nullptr, 0);
ret = mdns_query_answer_unicast(sock,
from,
addrlen,
sendbuffer,
sizeof(sendbuffer),
query_id,
(mdns_record_type_t)record_type,
nameMdnsString.str,
nameMdnsString.length,
answer,
nullptr,
0,
nullptr,
0);
} else {
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, nullptr, 0);
}
@ -409,12 +446,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle
uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE);
if (unicast) {
ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id,
(mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length,
answer, nullptr, 0, additional.constData(), additional.length());
ret = mdns_query_answer_unicast(sock,
from,
addrlen,
sendbuffer,
sizeof(sendbuffer),
query_id,
(mdns_record_type_t)record_type,
nameMdnsString.str,
nameMdnsString.length,
answer,
nullptr,
0,
additional.constData(),
additional.length());
} else {
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0,
additional.constData(), additional.length());
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length());
}
}
} else if (name == self.serviceInstance) {
@ -439,12 +486,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle
uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE);
if (unicast) {
ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id,
(mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length,
answer, nullptr, 0, additional.constData(), additional.length());
ret = mdns_query_answer_unicast(sock,
from,
addrlen,
sendbuffer,
sizeof(sendbuffer),
query_id,
(mdns_record_type_t)record_type,
nameMdnsString.str,
nameMdnsString.length,
answer,
nullptr,
0,
additional.constData(),
additional.length());
} else {
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0,
additional.constData(), additional.length());
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length());
}
}
} else if (name == self.hostname) {
@ -465,12 +522,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle
uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE);
if (unicast) {
ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id,
(mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length,
answer, nullptr, 0, additional.constData(), additional.length());
ret = mdns_query_answer_unicast(sock,
from,
addrlen,
sendbuffer,
sizeof(sendbuffer),
query_id,
(mdns_record_type_t)record_type,
nameMdnsString.str,
nameMdnsString.length,
answer,
nullptr,
0,
additional.constData(),
additional.length());
} else {
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0,
additional.constData(), additional.length());
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length());
}
} else if (((record_type == MDNS_RECORDTYPE_AAAA) || (record_type == MDNS_RECORDTYPE_ANY)) && !self.addressesV6.empty()) {
// The AAAA query was for our qualified hostname and we have an IPv6 address, answer with an AAAA
@ -489,12 +556,22 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle
uint16_t unicast = (rclass & MDNS_UNICAST_RESPONSE);
if (unicast) {
ret = mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id,
(mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length,
answer, nullptr, 0, additional.constData(), additional.length());
ret = mdns_query_answer_unicast(sock,
from,
addrlen,
sendbuffer,
sizeof(sendbuffer),
query_id,
(mdns_record_type_t)record_type,
nameMdnsString.str,
nameMdnsString.length,
answer,
nullptr,
0,
additional.constData(),
additional.length());
} else {
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0,
additional.constData(), additional.length());
ret = mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length());
}
}
} // else request is not for me

View file

@ -21,7 +21,6 @@
*/
namespace MdnsWrapper
{
class KDECONNECTCORE_EXPORT Discoverer : public QObject
{
Q_OBJECT

View file

@ -96,7 +96,7 @@ void DBusInstancePrivate::launchDBusDaemon()
m_dbusProcess->setStandardOutputFile(KdeConnectConfig::instance().privateDBusAddressPath());
m_dbusProcess->setStandardErrorFile(QProcess::nullDevice());
m_dbusProcess->start();
m_dbusProcess->waitForStarted(); // Avoid potential racing condition
m_dbusProcess->waitForStarted(); // Avoid potential racing condition
#ifdef Q_OS_MAC
// Set launchctl env

View file

@ -19,7 +19,6 @@ extern "C" {
namespace SslHelper
{
QString getSslError()
{
char buf[256];

View file

@ -29,16 +29,12 @@ IndicatorHelper::IndicatorHelper()
// Use a hardcoded QPixmap because QIcon::fromTheme will instantiate a QPlatformTheme theme
// which could try to use DBus before we have started it and cache an invalid DBus session
// in QDBusConnectionManager
const QString iconPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kdeconnect-icons"), QStandardPaths::LocateDirectory);
const QString iconPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("kdeconnect-icons"), QStandardPaths::LocateDirectory);
QPixmap splashPixmap(iconPath + QStringLiteral("/hicolor/scalable/apps/kdeconnect.svg"));
m_splashScreen = new QSplashScreen(splashPixmap);
// Icon is white, set the text color to black
m_splashScreen->showMessage(
i18n("Launching") + QStringLiteral("\n"),
Qt::AlignHCenter | Qt::AlignBottom,
Qt::black
);
m_splashScreen->showMessage(i18n("Launching") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::black);
m_splashScreen->show();
}
@ -88,11 +84,7 @@ int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
}
// Start daemon
m_splashScreen->showMessage(
i18n("Launching daemon") + QStringLiteral("\n"),
Qt::AlignHCenter | Qt::AlignBottom,
Qt::black
);
m_splashScreen->showMessage(i18n("Launching daemon") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::black);
// Here we will try to bring our private session D-Bus
if (!hasUsableSessionBus) {
@ -101,11 +93,7 @@ int IndicatorHelper::daemonHook(QProcess &kdeconnectd)
DBusHelper::launchDBusDaemon();
// Wait for dbus daemon env
QProcess getLaunchdDBusEnv;
m_splashScreen->showMessage(
i18n("Waiting D-Bus") + QStringLiteral("\n"),
Qt::AlignHCenter | Qt::AlignBottom,
Qt::black
);
m_splashScreen->showMessage(i18n("Waiting D-Bus") + QStringLiteral("\n"), Qt::AlignHCenter | Qt::AlignBottom, Qt::black);
int retry = 0;
getLaunchdDBusEnv.setProgram(QStringLiteral("launchctl"));
getLaunchdDBusEnv.setArguments({QStringLiteral("getenv"), QStringLiteral(KDECONNECT_SESSION_DBUS_LAUNCHD_ENV)});

View file

@ -78,8 +78,7 @@ DeviceNotificationsDbusInterface::DeviceNotificationsDbusInterface(const QString
NotificationDbusInterface::NotificationDbusInterface(const QString &deviceId, const QString &notificationId, QObject *parent)
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(),
QLatin1String("/modules/kdeconnect/devices/%1/notifications/").arg(deviceId)
+ notificationId,
QLatin1String("/modules/kdeconnect/devices/%1/notifications/").arg(deviceId) + notificationId,
QDBusConnection::sessionBus(),
parent)
, id(notificationId)

View file

@ -26,7 +26,8 @@ K_PLUGIN_CLASS_WITH_JSON(MprisControlPlugin, "kdeconnect_mpriscontrol.json")
namespace
{
const QString DEFAULT_PLAYER = i18nc("@title Users select this to control the current media player when we can't detect a specific player name like VLC", "Current Player");
const QString DEFAULT_PLAYER =
i18nc("@title Users select this to control the current media player when we can't detect a specific player name like VLC", "Current Player");
}
MprisControlPlugin::MprisControlPlugin(QObject *parent, const QVariantList &args)
@ -289,8 +290,7 @@ bool MprisControlPlugin::sendAlbumArt(std::variant<NetworkPacket, QString> const
void MprisControlPlugin::handleDefaultPlayer(const NetworkPacket &np)
{
if (np.has(QStringLiteral("action"))) {
INPUT input={0};
INPUT input = {0};
input.type = INPUT_KEYBOARD;
input.ki.time = 0;
@ -300,28 +300,25 @@ void MprisControlPlugin::handleDefaultPlayer(const NetworkPacket &np)
const QString &action = np.get<QString>(QStringLiteral("action"));
if (action == QStringLiteral("PlayPause") || (action == QStringLiteral("Play")) || (action == QStringLiteral("Pause")) ) {
if (action == QStringLiteral("PlayPause") || (action == QStringLiteral("Play")) || (action == QStringLiteral("Pause"))) {
input.ki.wVk = VK_MEDIA_PLAY_PAUSE;
::SendInput(1,&input,sizeof(INPUT));
::SendInput(1, &input, sizeof(INPUT));
} else if (action == QStringLiteral("Stop")) {
input.ki.wVk = VK_MEDIA_STOP;
::SendInput(1,&input,sizeof(INPUT));
}
else if (action == QStringLiteral("Next")) {
input.ki.wVk = VK_MEDIA_NEXT_TRACK;
::SendInput(1,&input,sizeof(INPUT));
}
else if (action == QStringLiteral("Previous")) {
::SendInput(1, &input, sizeof(INPUT));
} else if (action == QStringLiteral("Next")) {
input.ki.wVk = VK_MEDIA_NEXT_TRACK;
::SendInput(1, &input, sizeof(INPUT));
} else if (action == QStringLiteral("Previous")) {
input.ki.wVk = VK_MEDIA_PREV_TRACK;
::SendInput(1,&input,sizeof(INPUT));
}
else if (action == QStringLiteral("Stop")) {
::SendInput(1, &input, sizeof(INPUT));
} else if (action == QStringLiteral("Stop")) {
input.ki.wVk = VK_MEDIA_STOP;
::SendInput(1,&input,sizeof(INPUT));
::SendInput(1, &input, sizeof(INPUT));
}
}
//Send something read from the mpris interface
// Send something read from the mpris interface
NetworkPacket answer(PACKET_TYPE_MPRIS);
answer.set(QStringLiteral("player"), DEFAULT_PLAYER);
bool somethingToSend = false;

View file

@ -20,7 +20,8 @@
#include <core/kdeconnectplugin.h>
#include <core/kdeconnectpluginconfig.h>
namespace {
namespace
{
// https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html
inline constexpr const char *NOTIFY_SIGNATURE = "susssasa{sv}i";
inline constexpr const char *IMAGE_DATA_SIGNATURE = "iiibiiay";
@ -142,7 +143,6 @@ QVariant nextVariant(DBusMessageIter *iter)
case DBUS_TYPE_STRING:
return QVariant(QString::fromUtf8(value.str));
case DBUS_STRUCT_BEGIN_CHAR: {
}
default:
break;
@ -253,13 +253,13 @@ DBusNotificationsListener::~DBusNotificationsListener()
}
void DBusNotificationsListener::onNotify(const QString &appName,
uint replacesId,
const QString &appIcon,
const QString &summary,
const QString &body,
const QStringList &actions,
const QVariantMap &hints,
int timeout)
uint replacesId,
const QString &appIcon,
const QString &summary,
const QString &body,
const QStringList &actions,
const QVariantMap &hints,
int timeout)
{
Q_UNUSED(actions);
@ -330,7 +330,8 @@ void DBusNotificationsListener::onNotify(const QString &appName,
auto it = hints.constFind(QStringLiteral("image-data"));
if (it != hints.cend() || (it = hints.constFind(QStringLiteral("image_data"))) != hints.cend()) {
iconSource = iconForImageData(it.value());
} else if ((it = hints.constFind(QStringLiteral("image-path"))) != hints.cend() || (it = hints.constFind(QStringLiteral("image_path"))) != hints.cend()) {
} else if ((it = hints.constFind(QStringLiteral("image-path"))) != hints.cend()
|| (it = hints.constFind(QStringLiteral("image_path"))) != hints.cend()) {
iconSource = iconForIconName(it.value().toString());
} else if (!appIcon.isEmpty()) {
iconSource = iconForIconName(appIcon);
@ -346,13 +347,13 @@ void DBusNotificationsListener::onNotify(const QString &appName,
}
bool DBusNotificationsListener::parseImageDataArgument(const QVariant &argument,
int &width,
int &height,
int &rowStride,
int &bitsPerSample,
int &channels,
bool &hasAlpha,
QByteArray &imageData) const
int &width,
int &height,
int &rowStride,
int &bitsPerSample,
int &channels,
bool &hasAlpha,
QByteArray &imageData) const
{
// FIXME
// if (!argument.canConvert<QDBusArgument>()) {

View file

@ -38,13 +38,16 @@ private Q_SLOTS:
QSignalSpy spy(&discoverer, &MdnsWrapper::Discoverer::serviceFound);
connect(&discoverer, &MdnsWrapper::Discoverer::serviceFound, this, [instanceName, instancePort, txtKey, txtValue](const MdnsWrapper::Discoverer::MdnsService &service) {
QCOMPARE(instanceName, service.name);
QCOMPARE(instancePort, service.port);
QVERIFY(service.txtRecords.size() == 1);
QVERIFY(service.txtRecords.contains(txtKey));
QCOMPARE(txtValue, service.txtRecords.value(txtKey));
});
connect(&discoverer,
&MdnsWrapper::Discoverer::serviceFound,
this,
[instanceName, instancePort, txtKey, txtValue](const MdnsWrapper::Discoverer::MdnsService &service) {
QCOMPARE(instanceName, service.name);
QCOMPARE(instancePort, service.port);
QVERIFY(service.txtRecords.size() == 1);
QVERIFY(service.txtRecords.contains(txtKey));
QCOMPARE(txtValue, service.txtRecords.value(txtKey));
});
announcer.startAnnouncing();
discoverer.startDiscovering(serviceType);