mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 16:56:53 +08:00
refs #466 Refactored automatic signal relaying into CGenericDBusInterface.
This commit is contained in:
@@ -17,21 +17,7 @@ namespace BlackSimPlugin
|
||||
CXBusServiceProxy::CXBusServiceProxy(QDBusConnection &connection, QObject *parent, bool dummy) : QObject(parent)
|
||||
{
|
||||
m_dbusInterface = new BlackMisc::CGenericDBusInterface(XBUS_SERVICE_SERVICENAME, ObjectPath(), InterfaceName(), connection, this);
|
||||
if (! dummy) { relaySignals(); }
|
||||
}
|
||||
|
||||
void CXBusServiceProxy::relaySignals()
|
||||
{
|
||||
// TODO can this be refactored into CGenericDBusInterface?
|
||||
for (int i = 0, count = metaObject()->methodCount(); i < count; ++i)
|
||||
{
|
||||
auto method = metaObject()->method(i);
|
||||
if (method.methodType() == QMetaMethod::Signal)
|
||||
{
|
||||
m_dbusInterface->connection().connect(m_dbusInterface->service(), m_dbusInterface->path(), m_dbusInterface->interface(),
|
||||
method.name(), this, method.methodSignature().prepend("2"));
|
||||
}
|
||||
}
|
||||
if (! dummy) { m_dbusInterface->relayParentSignals(); }
|
||||
}
|
||||
|
||||
void CXBusServiceProxy::updateAirportsInRange()
|
||||
|
||||
@@ -56,8 +56,6 @@ namespace BlackSimPlugin
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dbusInterface = nullptr;
|
||||
|
||||
void relaySignals();
|
||||
|
||||
// Returns a function object which can be passed to CGenericDBusInterface::callDBusAsync.
|
||||
template <typename T>
|
||||
std::function<void(QDBusPendingCallWatcher *)> setterCallback(T *obj)
|
||||
|
||||
@@ -17,21 +17,7 @@ namespace BlackSimPlugin
|
||||
CXBusTrafficProxy::CXBusTrafficProxy(QDBusConnection &connection, QObject *parent, bool dummy) : QObject(parent)
|
||||
{
|
||||
m_dbusInterface = new BlackMisc::CGenericDBusInterface(XBUS_SERVICENAME, ObjectPath(), InterfaceName(), connection, this);
|
||||
if (! dummy) { relaySignals(); }
|
||||
}
|
||||
|
||||
void CXBusTrafficProxy::relaySignals()
|
||||
{
|
||||
// TODO can this be refactored into CGenericDBusInterface?
|
||||
for (int i = 0, count = metaObject()->methodCount(); i < count; ++i)
|
||||
{
|
||||
auto method = metaObject()->method(i);
|
||||
if (method.methodType() == QMetaMethod::Signal)
|
||||
{
|
||||
m_dbusInterface->connection().connect(m_dbusInterface->service(), m_dbusInterface->path(), m_dbusInterface->interface(),
|
||||
method.name(), this, method.methodSignature().prepend("2"));
|
||||
}
|
||||
}
|
||||
if (! dummy) { m_dbusInterface->relayParentSignals(); }
|
||||
}
|
||||
|
||||
bool CXBusTrafficProxy::initialize()
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace BlackSimPlugin
|
||||
private:
|
||||
BlackMisc::CGenericDBusInterface *m_dbusInterface = nullptr;
|
||||
|
||||
void relaySignals();
|
||||
|
||||
signals:
|
||||
//! \copydoc XBus::CTraffic::installedModelsUpdated
|
||||
void installedModelsUpdated(const QStringList &modelStrings, const QStringList &icaos, const QStringList &airlines, const QStringList &liveries);
|
||||
|
||||
Reference in New Issue
Block a user