Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files generated by qdbusXML2cpp and DCONG2cpp #392

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ License: GPL-3.0-or-later
Files: debian/* rpm/* archlinux/*
Copyright: None
License: CC0-1.0

Files: toolGenerate/**/*
Copyright: None
License: CC0-1.0
316 changes: 316 additions & 0 deletions toolGenerate/dconfig2cpp/lightdm-deepin-greeter-default-wayland.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
/**
* This file is generated by dconfig2cpp.
* Command line arguments: ./dconfig2cpp -p ./dde-session-shell/toolGenerate/dconfig2cpp ./dde-session-shell/files/wayland/lightdm-deepin-greeter-default-wayland.json
* Generation time: 2025-01-14T10:55:00
* 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 LIGHTDM-DEEPIN-GREETER-DEFAULT-WAYLAND_H
#define LIGHTDM-DEEPIN-GREETER-DEFAULT-WAYLAND_H

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

class lightdm-deepin-greeter-default-wayland : public QObject {
Q_OBJECT

Q_PROPERTY(bool allowSwitchingToWayland READ allowSwitchingToWayland WRITE setAllowSwitchingToWayland NOTIFY allowSwitchingToWaylandChanged)
Q_PROPERTY(QString defaultSession READ defaultSession WRITE setDefaultSession NOTIFY defaultSessionChanged)
Q_PROPERTY(bool hideOnboard READ hideOnboard WRITE setHideOnboard NOTIFY hideOnboardChanged)
Q_PROPERTY(QList<QVariant> numLockState READ numLockState WRITE setNumLockState NOTIFY numLockStateChanged)
Q_PROPERTY(bool useSolidBackground READ useSolidBackground WRITE setUseSolidBackground NOTIFY useSolidBackgroundChanged)
public:
explicit lightdm-deepin-greeter-default-wayland(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 lightdm-deepin-greeter-default-wayland(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 lightdm-deepin-greeter-default-wayland(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 lightdm-deepin-greeter-default-wayland(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();
});
}
~lightdm-deepin-greeter-default-wayland() {
if (m_config.loadRelaxed()) {
m_config.loadRelaxed()->deleteLater();
}
}

bool allowSwitchingToWayland() const {
return p_allowSwitchingToWayland;
}
void setAllowSwitchingToWayland(const bool &value) {
auto oldValue = p_allowSwitchingToWayland;
p_allowSwitchingToWayland = value;
markPropertySet(0);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("allowSwitchingToWayland"), value);
});
}
if (p_allowSwitchingToWayland != oldValue) {
Q_EMIT allowSwitchingToWaylandChanged();
}
}
QString defaultSession() const {
return p_defaultSession;
}
void setDefaultSession(const QString &value) {
auto oldValue = p_defaultSession;
p_defaultSession = value;
markPropertySet(1);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("defaultSession"), value);
});
}
if (p_defaultSession != oldValue) {
Q_EMIT defaultSessionChanged();
}
}
bool hideOnboard() const {
return p_hideOnboard;
}
void setHideOnboard(const bool &value) {
auto oldValue = p_hideOnboard;
p_hideOnboard = value;
markPropertySet(2);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("hideOnboard"), value);
});
}
if (p_hideOnboard != oldValue) {
Q_EMIT hideOnboardChanged();
}
}
QList<QVariant> numLockState() const {
return p_numLockState;
}
void setNumLockState(const QList<QVariant> &value) {
auto oldValue = p_numLockState;
p_numLockState = value;
markPropertySet(3);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("numLockState"), value);
});
}
if (p_numLockState != oldValue) {
Q_EMIT numLockStateChanged();
}
}
bool useSolidBackground() const {
return p_useSolidBackground;
}
void setUseSolidBackground(const bool &value) {
auto oldValue = p_useSolidBackground;
p_useSolidBackground = value;
markPropertySet(4);
if (auto config = m_config.loadRelaxed()) {
QMetaObject::invokeMethod(config, [this, value]() {
m_config.loadRelaxed()->setValue(QStringLiteral("useSolidBackground"), value);
});
}
if (p_useSolidBackground != oldValue) {
Q_EMIT useSolidBackgroundChanged();
}
}
Q_SIGNALS:
void allowSwitchingToWaylandChanged();
void defaultSessionChanged();
void hideOnboardChanged();
void numLockStateChanged();
void useSolidBackgroundChanged();
private:
void initialize(DTK_CORE_NAMESPACE::DConfig *config) {
Q_ASSERT(!m_config.loadRelaxed());
m_config.storeRelaxed(config);
if (testPropertySet(0)) {
config->setValue(QStringLiteral("allowSwitchingToWayland"), QVariant::fromValue(p_allowSwitchingToWayland));
} else {
updateValue(QStringLiteral("allowSwitchingToWayland"), QVariant::fromValue(p_allowSwitchingToWayland));
}
if (testPropertySet(1)) {
config->setValue(QStringLiteral("defaultSession"), QVariant::fromValue(p_defaultSession));
} else {
updateValue(QStringLiteral("defaultSession"), QVariant::fromValue(p_defaultSession));
}
if (testPropertySet(2)) {
config->setValue(QStringLiteral("hideOnboard"), QVariant::fromValue(p_hideOnboard));
} else {
updateValue(QStringLiteral("hideOnboard"), QVariant::fromValue(p_hideOnboard));
}
if (testPropertySet(3)) {
config->setValue(QStringLiteral("numLockState"), QVariant::fromValue(p_numLockState));
} else {
updateValue(QStringLiteral("numLockState"), QVariant::fromValue(p_numLockState));
}
if (testPropertySet(4)) {
config->setValue(QStringLiteral("useSolidBackground"), QVariant::fromValue(p_useSolidBackground));
} else {
updateValue(QStringLiteral("useSolidBackground"), QVariant::fromValue(p_useSolidBackground));
}

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("allowSwitchingToWayland")) {
auto newValue = qvariant_cast<bool>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_allowSwitchingToWayland != newValue) {
p_allowSwitchingToWayland = newValue;
Q_EMIT allowSwitchingToWaylandChanged();
}
});
return;
}
if (key == QStringLiteral("defaultSession")) {
auto newValue = qvariant_cast<QString>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_defaultSession != newValue) {
p_defaultSession = newValue;
Q_EMIT defaultSessionChanged();
}
});
return;
}
if (key == QStringLiteral("hideOnboard")) {
auto newValue = qvariant_cast<bool>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_hideOnboard != newValue) {
p_hideOnboard = newValue;
Q_EMIT hideOnboardChanged();
}
});
return;
}
if (key == QStringLiteral("numLockState")) {
auto newValue = qvariant_cast<QList<QVariant>>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_numLockState != newValue) {
p_numLockState = newValue;
Q_EMIT numLockStateChanged();
}
});
return;
}
if (key == QStringLiteral("useSolidBackground")) {
auto newValue = qvariant_cast<bool>(value);
QMetaObject::invokeMethod(this, [this, newValue]() {
if (p_useSolidBackground != newValue) {
p_useSolidBackground = newValue;
Q_EMIT useSolidBackgroundChanged();
}
});
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_allowSwitchingToWayland { false };
QString p_defaultSession { QStringLiteral("Wayland") };
bool p_hideOnboard { false };
QList<QVariant> p_numLockState { QList<QVariant>{} };
bool p_useSolidBackground { false };
QAtomicInteger<quint32> m_propertySetStatus0 = 0;
};

#endif // LIGHTDM-DEEPIN-GREETER-DEFAULT-WAYLAND_H
Loading
Loading