DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dbusinterface.h
1// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBUSINTERFACE_H
6#define DBUSINTERFACE_H
7
8#include <QtCore/QObject>
9#include <QtCore/QByteArray>
10#include <QtCore/QList>
11#include <QtCore/QMap>
12#include <QtCore/QString>
13#include <QtCore/QStringList>
14#include <QtCore/QVariant>
15#include <QtDBus/QtDBus>
16
17/*
18 * Proxy class for interface org.freedesktop.DBus
19 */
20class DBusInterface: public QDBusAbstractInterface
21{
22 Q_OBJECT
23
24 Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
25 {
26 QList<QVariant> arguments = msg.arguments();
27 if (3 != arguments.count())
28 return;
29 QString interfaceName = msg.arguments().at(0).toString();
30 if (interfaceName != "org.freedesktop.DBus")
31 return;
32 QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
33 Q_FOREACH(const QString &prop, changedProps.keys()) {
34 const QMetaObject* self = metaObject();
35 for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
36 QMetaProperty p = self->property(i);
37#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
38 QGenericArgument value(QMetaType::typeName(p.type()), const_cast<void*>(changedProps[prop].constData()));
39#else
40 QGenericArgument value(p.metaType().name(), const_cast<void*>(changedProps[prop].constData()));
41#endif
42
43 if (p.name() == prop) {
44 Q_EMIT p.notifySignal().invoke(this, value);
45 }
46 }
47 }
48 }
49public:
50 static inline const char *staticInterfaceName()
51 { return "org.freedesktop.DBus"; }
52
53public:
54 DBusInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
55
57
58public Q_SLOTS: // METHODS
59 inline QDBusPendingReply<> AddMatch(const QString &in0)
60 {
61 QList<QVariant> argumentList;
62 argumentList << QVariant::fromValue(in0);
63 return asyncCallWithArgumentList(QStringLiteral("AddMatch"), argumentList);
64 }
65
66 inline QDBusPendingReply<QByteArray> GetAdtAuditSessionData(const QString &in0)
67 {
68 QList<QVariant> argumentList;
69 argumentList << QVariant::fromValue(in0);
70 return asyncCallWithArgumentList(QStringLiteral("GetAdtAuditSessionData"), argumentList);
71 }
72
73 inline QDBusPendingReply<QByteArray> GetConnectionSELinuxSecurityContext(const QString &in0)
74 {
75 QList<QVariant> argumentList;
76 argumentList << QVariant::fromValue(in0);
77 return asyncCallWithArgumentList(QStringLiteral("GetConnectionSELinuxSecurityContext"), argumentList);
78 }
79
80 inline QDBusPendingReply<uint> GetConnectionUnixProcessID(const QString &in0)
81 {
82 QList<QVariant> argumentList;
83 argumentList << QVariant::fromValue(in0);
84 return asyncCallWithArgumentList(QStringLiteral("GetConnectionUnixProcessID"), argumentList);
85 }
86
87 inline QDBusPendingReply<uint> GetConnectionUnixUser(const QString &in0)
88 {
89 QList<QVariant> argumentList;
90 argumentList << QVariant::fromValue(in0);
91 return asyncCallWithArgumentList(QStringLiteral("GetConnectionUnixUser"), argumentList);
92 }
93
94 inline QDBusPendingReply<QString> GetId()
95 {
96 QList<QVariant> argumentList;
97 return asyncCallWithArgumentList(QStringLiteral("GetId"), argumentList);
98 }
99
100 inline QDBusPendingReply<QString> GetNameOwner(const QString &in0)
101 {
102 QList<QVariant> argumentList;
103 argumentList << QVariant::fromValue(in0);
104 return asyncCallWithArgumentList(QStringLiteral("GetNameOwner"), argumentList);
105 }
106
107 inline QDBusPendingReply<QString> Hello()
108 {
109 QList<QVariant> argumentList;
110 return asyncCallWithArgumentList(QStringLiteral("Hello"), argumentList);
111 }
112
113 inline QDBusPendingReply<QStringList> ListActivatableNames()
114 {
115 QList<QVariant> argumentList;
116 return asyncCallWithArgumentList(QStringLiteral("ListActivatableNames"), argumentList);
117 }
118
119 inline QDBusPendingReply<QStringList> ListNames()
120 {
121 QList<QVariant> argumentList;
122 return asyncCallWithArgumentList(QStringLiteral("ListNames"), argumentList);
123 }
124
125 inline QDBusPendingReply<QStringList> ListQueuedOwners(const QString &in0)
126 {
127 QList<QVariant> argumentList;
128 argumentList << QVariant::fromValue(in0);
129 return asyncCallWithArgumentList(QStringLiteral("ListQueuedOwners"), argumentList);
130 }
131
132 inline QDBusPendingReply<bool> NameHasOwner(const QString &in0)
133 {
134 QList<QVariant> argumentList;
135 argumentList << QVariant::fromValue(in0);
136 return asyncCallWithArgumentList(QStringLiteral("NameHasOwner"), argumentList);
137 }
138
139 inline QDBusPendingReply<uint> ReleaseName(const QString &in0)
140 {
141 QList<QVariant> argumentList;
142 argumentList << QVariant::fromValue(in0);
143 return asyncCallWithArgumentList(QStringLiteral("ReleaseName"), argumentList);
144 }
145
146 inline QDBusPendingReply<> ReloadConfig()
147 {
148 QList<QVariant> argumentList;
149 return asyncCallWithArgumentList(QStringLiteral("ReloadConfig"), argumentList);
150 }
151
152 inline QDBusPendingReply<> RemoveMatch(const QString &in0)
153 {
154 QList<QVariant> argumentList;
155 argumentList << QVariant::fromValue(in0);
156 return asyncCallWithArgumentList(QStringLiteral("RemoveMatch"), argumentList);
157 }
158
159 inline QDBusPendingReply<uint> RequestName(const QString &in0, uint in1)
160 {
161 QList<QVariant> argumentList;
162 argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
163 return asyncCallWithArgumentList(QStringLiteral("RequestName"), argumentList);
164 }
165
166 inline QDBusPendingReply<uint> StartServiceByName(const QString &in0, uint in1)
167 {
168 QList<QVariant> argumentList;
169 argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
170 return asyncCallWithArgumentList(QStringLiteral("StartServiceByName"), argumentList);
171 }
172
173Q_SIGNALS: // SIGNALS
174 void NameAcquired(const QString &in0);
175 void NameLost(const QString &in0);
176 void NameOwnerChanged(const QString &in0, const QString &in1, const QString &in2);
177// begin property changed signals
178};
179
180namespace org {
181 namespace freedesktop {
182 typedef ::DBusInterface DBus;
183 }
184}
185#endif
Definition dbusinterface.h:21