Skip to content

Commit

Permalink
feat: Add files generated by qdbusXML2cpp and DCONG2cpp
Browse files Browse the repository at this point in the history
Add files generated by qdbusXML2cpp and DCONG2cpp

Log: Add files generated by qdbusXML2cpp and DCONG2cpp
  • Loading branch information
USFunction committed Jan 14, 2025
1 parent 8aff15c commit bda7161
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,8 @@ License: LGPL-3.0-or-later
Files: tests/data/*
Copyright: None
License: CC0-1.0


Files: toolGenerate/**/*
Copyright: None
License: CC0-1.0
214 changes: 214 additions & 0 deletions toolGenerate/dconfig2cpp/org_deepin_dtkwidget_feature-display.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
/**
* This file is generated by dconfig2cpp.
* Command line arguments: ./dconfig2cpp -p ./dtkwidget/toolGenerate/dconfig2cpp ./dtkwidget/src/org.deepin.dtkwidget.feature-display.json
* Generation time: 2025-01-14T10:54:57
* JSON file version: 1.0
*
* WARNING: DO NOT MODIFY THIS FILE MANUALLY.
* If you need to change the content, please modify the dconfig2cpp tool.
*/

#ifndef ORG_DEEPIN_DTKWIDGET_FEATURE-DISPLAY_H
#define ORG_DEEPIN_DTKWIDGET_FEATURE-DISPLAY_H

#include <QThread>
#include <QVariant>
#include <QDebug>
#include <QAtomicPointer>
#include <QAtomicInteger>
#include <DConfig>

class org_deepin_dtkwidget_feature-display : public QObject {
Q_OBJECT

Q_PROPERTY(bool autoDisplayFeature READ autoDisplayFeature WRITE setAutoDisplayFeature NOTIFY autoDisplayFeatureChanged)
Q_PROPERTY(bool featureUpdated READ featureUpdated WRITE setFeatureUpdated NOTIFY featureUpdatedChanged)
public:
explicit org_deepin_dtkwidget_feature-display(QThread *thread, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr)
: QObject(parent) {

if (!thread->isRunning()) {
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
}
Q_ASSERT(QThread::currentThread() != thread);
auto worker = new QObject();
worker->moveToThread(thread);
QMetaObject::invokeMethod(worker, [=]() {
auto config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr);
if (!config) {
qWarning() << QStringLiteral("Failed to create DConfig instance.");
worker->deleteLater();
return;
}
config->moveToThread(QThread::currentThread());
initialize(config);
worker->deleteLater();
});
}
explicit org_deepin_dtkwidget_feature-display(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr)
: QObject(parent) {

if (!thread->isRunning()) {
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
}
Q_ASSERT(QThread::currentThread() != thread);
auto worker = new QObject();
worker->moveToThread(thread);
QMetaObject::invokeMethod(worker, [=]() {
auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr);
if (!config) {
qWarning() << QStringLiteral("Failed to create DConfig instance.");
worker->deleteLater();
return;
}
config->moveToThread(QThread::currentThread());
initialize(config);
worker->deleteLater();
});
}
explicit org_deepin_dtkwidget_feature-display(QThread *thread, const QString &name, const QString &subpath, QObject *parent = nullptr)
: QObject(parent) {

if (!thread->isRunning()) {
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
}
Q_ASSERT(QThread::currentThread() != thread);
auto worker = new QObject();
worker->moveToThread(thread);
QMetaObject::invokeMethod(worker, [=]() {
auto config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr);
if (!config) {
qWarning() << QStringLiteral("Failed to create DConfig instance.");
worker->deleteLater();
return;
}
config->moveToThread(QThread::currentThread());
initialize(config);
worker->deleteLater();
});
}
explicit org_deepin_dtkwidget_feature-display(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent = nullptr)
: QObject(parent) {

if (!thread->isRunning()) {
qWarning() << QStringLiteral("Warning: The provided thread is not running.");
}
Q_ASSERT(QThread::currentThread() != thread);
auto worker = new QObject();
worker->moveToThread(thread);
QMetaObject::invokeMethod(worker, [=]() {
auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr);
if (!config) {
qWarning() << QStringLiteral("Failed to create DConfig instance.");
worker->deleteLater();
return;
}
config->moveToThread(QThread::currentThread());
initialize(config);
worker->deleteLater();
});
}
~org_deepin_dtkwidget_feature-display() {
if (m_config.loadRelaxed()) {
m_config.loadRelaxed()->deleteLater();
}
}

bool autoDisplayFeature() const {
return p_autoDisplayFeature;
}
void setAutoDisplayFeature(const bool &value) {
auto oldValue = p_autoDisplayFeature;
p_autoDisplayFeature = value;
markPropertySet(0);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("autoDisplayFeature"), value);
});
}
if (p_autoDisplayFeature != oldValue) {
Q_EMIT autoDisplayFeatureChanged();
}
}
bool featureUpdated() const {
return p_featureUpdated;
}
void setFeatureUpdated(const bool &value) {
auto oldValue = p_featureUpdated;
p_featureUpdated = value;
markPropertySet(1);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("featureUpdated"), value);
});
}
if (p_featureUpdated != oldValue) {
Q_EMIT featureUpdatedChanged();
}
}
Q_SIGNALS:
void autoDisplayFeatureChanged();
void featureUpdatedChanged();
private:
void initialize(DTK_CORE_NAMESPACE::DConfig *config) {
Q_ASSERT(!m_config.loadRelaxed());
m_config.storeRelaxed(config);
if (testPropertySet(0)) {
config->setValue(QStringLiteral("autoDisplayFeature"), QVariant::fromValue(p_autoDisplayFeature));
} else {
updateValue(QStringLiteral("autoDisplayFeature"), QVariant::fromValue(p_autoDisplayFeature));
}
if (testPropertySet(1)) {
config->setValue(QStringLiteral("featureUpdated"), QVariant::fromValue(p_featureUpdated));
} else {
updateValue(QStringLiteral("featureUpdated"), QVariant::fromValue(p_featureUpdated));
}

connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) {
updateValue(key);
}, Qt::DirectConnection);
}
void updateValue(const QString &key, const QVariant &fallback = QVariant()) {
Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread());
const QVariant &value = m_config.loadRelaxed()->value(key, fallback);
if (key == QStringLiteral("autoDisplayFeature")) {
auto newValue = qvariant_cast<bool>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_autoDisplayFeature != newValue) {
p_autoDisplayFeature = newValue;
Q_EMIT autoDisplayFeatureChanged();
}
});
return;
}
if (key == QStringLiteral("featureUpdated")) {
auto newValue = qvariant_cast<bool>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_featureUpdated != newValue) {
p_featureUpdated = newValue;
Q_EMIT featureUpdatedChanged();
}
});
return;
}
}
inline void markPropertySet(const int index) {
if (index < 32) {
m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0));
return;
}
Q_UNREACHABLE();
}
inline bool testPropertySet(const int index) const {
if (index < 32) {
return (m_propertySetStatus0.loadRelaxed() & (1 << (index - 0)));
}
Q_UNREACHABLE();
}
QAtomicPointer<DTK_CORE_NAMESPACE::DConfig> m_config = nullptr;
bool p_autoDisplayFeature { false };
bool p_featureUpdated { false };
QAtomicInteger<quint32> m_propertySetStatus0 = 0;
};

#endif // ORG_DEEPIN_DTKWIDGET_FEATURE-DISPLAY_H

0 comments on commit bda7161

Please sign in to comment.