Skip to content

Commit d29d7be

Browse files
committed
feat: Add files generated by qdbusXML2cpp and DCONG2cpp
Add files generated by qdbusXML2cpp and DCONG2cpp Log: Add files generated by qdbusXML2cpp and DCONG2cpp
1 parent fc4eb8b commit d29d7be

30 files changed

+4497
-0
lines changed

.reuse/dep5

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,9 @@ License: CC0-1.0
7575
Files: panels/dock/tray/*
7676
Copyright: UnionTech Software Technology Co., Ltd.
7777
License: GPL-3.0-or-later
78+
79+
Files: toolGenerate/**/*
80+
Copyright: None
81+
License: CC0-1.0
82+
83+
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/**
2+
* This file is generated by dconfig2cpp.
3+
* Command line arguments: ./dconfig2cpp -p ./dde-shell/toolGenerate/dconfig2cpp ./dde-shell/shell/org.deepin.dde.shell.json
4+
* Generation time: 2025-01-14T10:55:02
5+
* JSON file version: 1.0
6+
*
7+
* WARNING: DO NOT MODIFY THIS FILE MANUALLY.
8+
* If you need to change the content, please modify the dconfig2cpp tool.
9+
*/
10+
11+
#ifndef ORG_DEEPIN_DDE_SHELL_H
12+
#define ORG_DEEPIN_DDE_SHELL_H
13+
14+
#include <QThread>
15+
#include <QVariant>
16+
#include <QDebug>
17+
#include <QAtomicPointer>
18+
#include <QAtomicInteger>
19+
#include <DConfig>
20+
21+
class org_deepin_dde_shell : public QObject {
22+
Q_OBJECT
23+
24+
Q_PROPERTY(QVariantMap migratedDConfigs READ migratedDConfigs WRITE setMigratedDConfigs NOTIFY migratedDConfigsChanged)
25+
public:
26+
explicit org_deepin_dde_shell(QThread *thread, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr)
27+
: QObject(parent) {
28+
29+
if (!thread->isRunning()) {
30+
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
31+
}
32+
Q_ASSERT(QThread::currentThread() != thread);
33+
auto worker = new QObject();
34+
worker->moveToThread(thread);
35+
QMetaObject::invokeMethod(worker, [=]() {
36+
auto config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr);
37+
if (!config) {
38+
qWarning() << QStringLiteral("Failed to create DConfig instance.");
39+
worker->deleteLater();
40+
return;
41+
}
42+
config->moveToThread(QThread::currentThread());
43+
initialize(config);
44+
worker->deleteLater();
45+
});
46+
}
47+
explicit org_deepin_dde_shell(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr)
48+
: QObject(parent) {
49+
50+
if (!thread->isRunning()) {
51+
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
52+
}
53+
Q_ASSERT(QThread::currentThread() != thread);
54+
auto worker = new QObject();
55+
worker->moveToThread(thread);
56+
QMetaObject::invokeMethod(worker, [=]() {
57+
auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr);
58+
if (!config) {
59+
qWarning() << QStringLiteral("Failed to create DConfig instance.");
60+
worker->deleteLater();
61+
return;
62+
}
63+
config->moveToThread(QThread::currentThread());
64+
initialize(config);
65+
worker->deleteLater();
66+
});
67+
}
68+
explicit org_deepin_dde_shell(QThread *thread, const QString &name, const QString &subpath, QObject *parent = nullptr)
69+
: QObject(parent) {
70+
71+
if (!thread->isRunning()) {
72+
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
73+
}
74+
Q_ASSERT(QThread::currentThread() != thread);
75+
auto worker = new QObject();
76+
worker->moveToThread(thread);
77+
QMetaObject::invokeMethod(worker, [=]() {
78+
auto config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr);
79+
if (!config) {
80+
qWarning() << QStringLiteral("Failed to create DConfig instance.");
81+
worker->deleteLater();
82+
return;
83+
}
84+
config->moveToThread(QThread::currentThread());
85+
initialize(config);
86+
worker->deleteLater();
87+
});
88+
}
89+
explicit org_deepin_dde_shell(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent = nullptr)
90+
: QObject(parent) {
91+
92+
if (!thread->isRunning()) {
93+
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
94+
}
95+
Q_ASSERT(QThread::currentThread() != thread);
96+
auto worker = new QObject();
97+
worker->moveToThread(thread);
98+
QMetaObject::invokeMethod(worker, [=]() {
99+
auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr);
100+
if (!config) {
101+
qWarning() << QStringLiteral("Failed to create DConfig instance.");
102+
worker->deleteLater();
103+
return;
104+
}
105+
config->moveToThread(QThread::currentThread());
106+
initialize(config);
107+
worker->deleteLater();
108+
});
109+
}
110+
~org_deepin_dde_shell() {
111+
if (m_config.loadRelaxed()) {
112+
m_config.loadRelaxed()->deleteLater();
113+
}
114+
}
115+
116+
QVariantMap migratedDConfigs() const {
117+
return p_migratedDConfigs;
118+
}
119+
void setMigratedDConfigs(const QVariantMap &value) {
120+
auto oldValue = p_migratedDConfigs;
121+
p_migratedDConfigs = value;
122+
markPropertySet(0);
123+
if (auto config = m_config.loadRelaxed()) {
124+
QMetaObject::invokeMethod(config, [this, value]() {
125+
m_config.loadRelaxed()->setValue(QStringLiteral("migratedDConfigs"), value);
126+
});
127+
}
128+
if (p_migratedDConfigs != oldValue) {
129+
Q_EMIT migratedDConfigsChanged();
130+
}
131+
}
132+
Q_SIGNALS:
133+
void migratedDConfigsChanged();
134+
private:
135+
void initialize(DTK_CORE_NAMESPACE::DConfig *config) {
136+
Q_ASSERT(!m_config.loadRelaxed());
137+
m_config.storeRelaxed(config);
138+
if (testPropertySet(0)) {
139+
config->setValue(QStringLiteral("migratedDConfigs"), QVariant::fromValue(p_migratedDConfigs));
140+
} else {
141+
updateValue(QStringLiteral("migratedDConfigs"), QVariant::fromValue(p_migratedDConfigs));
142+
}
143+
144+
connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) {
145+
updateValue(key);
146+
}, Qt::DirectConnection);
147+
}
148+
void updateValue(const QString &key, const QVariant &fallback = QVariant()) {
149+
Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread());
150+
const QVariant &value = m_config.loadRelaxed()->value(key, fallback);
151+
if (key == QStringLiteral("migratedDConfigs")) {
152+
auto newValue = qvariant_cast<QVariantMap>(value);
153+
QMetaObject::invokeMethod(this, [this, newValue]() {
154+
if (p_migratedDConfigs != newValue) {
155+
p_migratedDConfigs = newValue;
156+
Q_EMIT migratedDConfigsChanged();
157+
}
158+
});
159+
return;
160+
}
161+
}
162+
inline void markPropertySet(const int index) {
163+
if (index < 32) {
164+
m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0));
165+
return;
166+
}
167+
Q_UNREACHABLE();
168+
}
169+
inline bool testPropertySet(const int index) const {
170+
if (index < 32) {
171+
return (m_propertySetStatus0.loadRelaxed() & (1 << (index - 0)));
172+
}
173+
Q_UNREACHABLE();
174+
}
175+
QAtomicPointer<DTK_CORE_NAMESPACE::DConfig> m_config = nullptr;
176+
QVariantMap p_migratedDConfigs { QVariantMap{} };
177+
QAtomicInteger<quint32> m_propertySetStatus0 = 0;
178+
};
179+
180+
#endif // ORG_DEEPIN_DDE_SHELL_H

0 commit comments

Comments
 (0)