DtkCore
DTK Core module
载入中...
搜索中...
未找到
ddbusextendedabstractinterface.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2015 Jolla Ltd.
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef DBUSEXTENDEDABSTRACTINTERFACE_H
6#define DBUSEXTENDEDABSTRACTINTERFACE_H
7#include "dtkcore_global.h"
8
9#include <QDBusAbstractInterface>
10#include <QDBusError>
11class QDBusPendingCallWatcher;
12DCORE_BEGIN_NAMESPACE
13
14class DDBusExtendedPendingCallWatcher;
15
16class LIBDTKCORESHARED_EXPORT DDBusExtendedAbstractInterface : public QDBusAbstractInterface
17{
18 Q_OBJECT
19
20public:
22
23 Q_PROPERTY(bool sync READ sync WRITE setSync)
24 inline bool sync() const { return m_sync; }
25 void setSync(bool sync);
26 void setSync(bool sync, bool autoStart);
27
28 Q_PROPERTY(bool useCache READ useCache WRITE setUseCache)
29 inline bool useCache() const { return m_useCache; }
30 inline void setUseCache(bool useCache) { m_useCache = useCache; }
31
33 inline QDBusError lastExtendedError() const { return m_lastExtendedError; }
34
35public Q_SLOTS:
37
38protected:
40 const QString &service, const QString &path, const char *interface, const QDBusConnection &connection, QObject *parent);
41
42 void connectNotify(const QMetaMethod &signal);
43 void disconnectNotify(const QMetaMethod &signal);
44 QVariant internalPropGet(const char *propname, void *propertyPtr);
45 void internalPropSet(const char *propname, const QVariant &value, void *propertyPtr);
46
47Q_SIGNALS:
48 void serviceValidChanged(const bool valid) const;
49 void serviceStartFinished(const quint32 ret) const;
50 void propertyChanged(const QString &propertyName, const QVariant &value);
51 void propertyInvalidated(const QString &propertyName);
52 void asyncPropertyFinished(const QString &propertyName);
53 void asyncSetPropertyFinished(const QString &propertyName);
55
56private Q_SLOTS:
57 void onPropertiesChanged(const QString &interfaceName,
58 const QVariantMap &changedProperties,
59 const QStringList &invalidatedProperties);
60 void onDBusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
61 void onAsyncPropertyFinished(QDBusPendingCallWatcher *w);
62 void onAsyncSetPropertyFinished(QDBusPendingCallWatcher *w);
63 void onAsyncGetAllPropertiesFinished(QDBusPendingCallWatcher *watcher);
64 void onStartServiceProcessFinished(QDBusPendingCallWatcher *w);
65
66private:
67 QVariant asyncProperty(const QString &propertyName);
68 void asyncSetProperty(const QString &propertyName, const QVariant &value);
69 static QVariant
70 demarshall(const QString &interface, const QMetaProperty &metaProperty, const QVariant &value, QDBusError *error);
71
72 bool m_sync;
73 bool m_useCache;
74 QDBusPendingCallWatcher *m_getAllPendingCallWatcher;
75 QDBusError m_lastExtendedError;
76 QString m_dbusOwner;
77 bool m_propertiesChangedConnected;
78};
79DCORE_END_NAMESPACE
80
81#endif /* DBUSEXTENDEDABSTRACTINTERFACE_H */
扩展DBus接口, 继承自QDBusAbstractInterface
Definition ddbusextendedabstractinterface.h:17
void disconnectNotify(const QMetaMethod &signal)
信号断开连接通知函数
void setUseCache(bool useCache)
设置是否使用缓存
Definition ddbusextendedabstractinterface.h:30
void getAllProperties()
获取所有属性
void setSync(bool sync)
设置是否同步
void startServiceProcess()
启动服务进程
QVariant internalPropGet(const char *propname, void *propertyPtr)
内部属性获取函数
void propertyChanged(const QString &propertyName, const QVariant &value)
属性改变信号
void asyncPropertyFinished(const QString &propertyName)
异步获取属性完成通知信号
void setSync(bool sync, bool autoStart)
设置是否同步和自启动
QDBusError lastExtendedError() const
获取上一次的错误
Definition ddbusextendedabstractinterface.h:33
void propertyInvalidated(const QString &propertyName)
属性失效通知信号
void asyncSetPropertyFinished(const QString &propertyName)
异步设置属性完成通知信号
void asyncGetAllPropertiesFinished()
异步获取所有属性完成的通知信号
void connectNotify(const QMetaMethod &signal)
信号连接通知函数
void serviceStartFinished(const quint32 ret) const
服务启动完成通知信号
void serviceValidChanged(const bool valid) const
服务是否有效状态改变信号
void internalPropSet(const char *propname, const QVariant &value, void *propertyPtr)
内部属性设置函数
DDBusExtendedAbstractInterface(const QString &service, const QString &path, const char *interface, const QDBusConnection &connection, QObject *parent)
构造函数