Ref T259, error message if proxy signal cannot be connected

Do not relay some signals
This commit is contained in:
Klaus Basan
2018-02-27 01:18:44 +01:00
parent d4b7d7d181
commit 79d898baec
2 changed files with 9 additions and 4 deletions

View File

@@ -12,6 +12,7 @@
#ifndef BLACKMISC_GENERICDBUSINTERFACE_H
#define BLACKMISC_GENERICDBUSINTERFACE_H
#include "logmessage.h"
#include <QDBusAbstractInterface>
#include <QDBusPendingCall>
#include <QDBusPendingReply>
@@ -50,12 +51,16 @@ namespace BlackMisc
for (int i = superMetaObject->methodOffset(), count = metaObject->methodCount(); i < count; ++i)
{
QMetaMethod method = metaObject->method(i);
const QMetaMethod method = metaObject->method(i);
if (method.methodType() != QMetaMethod::Signal) { continue; }
if (method.tag() && strcmp(method.tag(), "BLACK_NO_RELAY") == 0) { continue; }
this->connection().connect(this->service(), this->path(), this->interface(), method.name(), this->parent(),
method.methodSignature().prepend("2")); // the reason for this "2" can be found in the definition of SIGNAL() macro
const QByteArray signature = method.methodSignature().prepend("2"); // the reason for this "2" can be found in the definition of SIGNAL() macro
const bool c = this->connection().connect(this->service(), this->path(), this->interface(), method.name(), this->parent(), signature);
if (!c)
{
CLogMessage(this).error("Cannot connect signal: %1") << QString(signature);
}
}
}