31 #include <QMetaMethod>
49 #define LC_N(a) (QMetaObject::normalizedSignature(a))
50 #define LC_TOSLOT(a) ('1' + QByteArray(a))
51 #define LC_TOSIGNAL(a) ('2' + QByteArray(a))
52 void ConnectHookSignals (QObject *sender, QObject *receiver,
bool destSlot)
54 const QMetaObject *mo = sender->metaObject ();
55 for (
int i = 0, size = mo->methodCount (); i < size; ++i)
57 QMetaMethod method = mo->method (i);
58 if (method.methodType () != QMetaMethod::Signal)
60 if (method.parameterTypes ().size () == 0)
62 if (method.parameterTypes ().at (0) !=
"LeechCraft::IHookProxy_ptr")
65 #if QT_VERSION >= 0x050000
66 const auto& signature = method.methodSignature ();
68 const auto& signature = method.signature ();
71 if (receiver->metaObject ()->indexOfMethod (
LC_N (signature)) == -1)
75 qWarning () << Q_FUNC_INFO
76 <<
"not found meta method for"
78 <<
"in receiver object"
84 if (!QObject::connect (sender,
88 Qt::UniqueConnection))
90 qWarning () << Q_FUNC_INFO
108 ConnectHookSignals (
this, plugin,
true);
113 ConnectHookSignals (
object,
this,
false);
BaseHookInterconnector(QObject *parent=0)
Creates the interconnector with the given parent.
virtual ~BaseHookInterconnector()
Virtual destructor.
void RegisterHookable(QObject *hookable)
Adds a hookable object from the root plugin.
QList< QObject * > Plugins_
virtual void AddPlugin(QObject *plugin)
Adds a subplugin to this interconnector.