mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
refs #199, featuring proxy to server side DBus signals.
So far we only could send server to proxy side signals, causing inconsistencies between remote and local contexts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "context.h"
|
||||
#include <QDebug>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -48,6 +49,26 @@ namespace BlackCore
|
||||
return this->getRuntime()->getIContextSimulator();
|
||||
}
|
||||
|
||||
void CContext::reEmitSignalFromProxy(const QString &signalName)
|
||||
{
|
||||
if (signalName.isEmpty()) return;
|
||||
if (this->usingLocalObjects())
|
||||
{
|
||||
// resent in implementation
|
||||
QString sn = signalName;
|
||||
if (!sn.endsWith("()")) sn.append("()");
|
||||
const QMetaObject *metaObject = this->metaObject();
|
||||
int signalId = metaObject->indexOfSignal(sn.toUtf8().constData());
|
||||
Q_ASSERT(signalId >= 0);
|
||||
void *a[] = { 0 };
|
||||
QMetaObject::activate(this, signalId, a);
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT_X(false, "signalFromProxy", "Proxy needs to override method");
|
||||
}
|
||||
}
|
||||
|
||||
const IContextSimulator *CContext::getIContextSimulator() const
|
||||
{
|
||||
return this->getRuntime()->getIContextSimulator();
|
||||
|
||||
Reference in New Issue
Block a user