dde-control-center
Deepin Control Center
载入中...
搜索中...
未找到
dccquickdbusinterface.h
1// SPDX-FileCopyrightText: 2024 - 2027 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4#ifndef DCCQUICKDBUSINTERFACE_H
5#define DCCQUICKDBUSINTERFACE_H
6
7#include <QObject>
8#include <QQmlParserStatus>
9#include <QtQml/qqml.h>
10
11namespace dccV25 {
12class DccQuickDBusInterface : public QObject, public QQmlParserStatus
13{
14 Q_OBJECT
15 QML_ELEMENT
16
17 Q_PROPERTY(QString service READ service WRITE setService NOTIFY serviceChanged)
18 Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
19 Q_PROPERTY(QString inter READ interface WRITE setInterface NOTIFY interfaceChanged)
20 Q_PROPERTY(BusType connection READ connection WRITE setConnection NOTIFY connectionChanged)
21 Q_PROPERTY(QString suffix READ suffix WRITE setSuffix NOTIFY suffixChanged)
22public:
23 explicit DccQuickDBusInterface(QObject *parent = nullptr);
24 ~DccQuickDBusInterface() override;
25
26 enum BusType {
27 SessionBus,
28 SystemBus,
29 };
30 Q_ENUM(BusType)
31
32 QString service() const;
33 void setService(const QString &service);
34 QString path() const;
35 void setPath(const QString &path);
36 QString interface() const;
37 void setInterface(const QString &interface);
38 BusType connection() const;
39 void setConnection(const BusType &connection);
40 // 属性前缀,防止属性与关键字冲突
41 QString suffix() const;
42 void setSuffix(const QString &suffix);
43
44public Q_SLOTS:
45 bool callWithCallback(const QString &method, const QList<QVariant> &args, const QJSValue member, const QJSValue errorSlot);
46
47Q_SIGNALS:
48 void serviceChanged(const QString &service);
49 void pathChanged(const QString &path);
50 void interfaceChanged(const QString &interface);
51 void connectionChanged(const BusType &connection);
52 void suffixChanged(const QString &suffix);
53
54protected:
55 void connectNotify(const QMetaMethod &signal) override;
56 void disconnectNotify(const QMetaMethod &signal) override;
57 void classBegin() override;
58 void componentComplete() override;
59
60protected:
61 class Private;
62 Private *p_ptr;
63};
64} // namespace dccV25
65#endif // DCCQUICKDBUSINTERFACE_H
Definition dccquickdbusinterface.h:13