Skip to content

Conversation

@zccrs
Copy link
Member

@zccrs zccrs commented Dec 3, 2024

使用方法:
自动使用:

  1. cmake 中添加 Dtk 的Tools模块:find_package(Dtk6 REQUIRED COMPONENTS Core Tools)
  2. 调用 dtk_add_config_to_cpp(DCONFIG_SOURCES foo.example.json),会自动把生成的hpp文件加到SOURCES这个变量中

或手动使用:dconfig2cpp foo.example.json

生成的代码:

#ifndef DCONFIG_ORG_DEEPIN_TREELAND_H
#define DCONFIG_ORG_DEEPIN_TREELAND_H

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

class dconfig_org_deepin_treeland : public QObject {
    Q_OBJECT

    Q_PROPERTY(QString activeColor READ activeColor WRITE setActiveColor NOTIFY activeColorChanged RESET resetActiveColor)
    Q_PROPERTY(qlonglong currentWorkspace READ currentWorkspace WRITE setCurrentWorkspace NOTIFY currentWorkspaceChanged RESET resetCurrentWorkspace)
    Q_PROPERTY(bool cursorBlink READ cursorBlink WRITE setCursorBlink NOTIFY cursorBlinkChanged RESET resetCursorBlink)
    Q_PROPERTY(qlonglong cursorBlinkTime READ cursorBlinkTime WRITE setCursorBlinkTime NOTIFY cursorBlinkTimeChanged RESET resetCursorBlinkTime)
    Q_PROPERTY(qlonglong cursorSize READ cursorSize WRITE setCursorSize NOTIFY cursorSizeChanged RESET resetCursorSize)
    Q_PROPERTY(QString cursorThemeName READ cursorThemeName WRITE setCursorThemeName NOTIFY cursorThemeNameChanged RESET resetCursorThemeName)
    Q_PROPERTY(QString defaultBackground READ defaultBackground WRITE setDefaultBackground NOTIFY defaultBackgroundChanged RESET resetDefaultBackground)
    Q_PROPERTY(qlonglong dndDragThreshold READ dndDragThreshold WRITE setDndDragThreshold NOTIFY dndDragThresholdChanged RESET resetDndDragThreshold)
    Q_PROPERTY(qlonglong doubleClickDistance READ doubleClickDistance WRITE setDoubleClickDistance NOTIFY doubleClickDistanceChanged RESET resetDoubleClickDistance)
    Q_PROPERTY(qlonglong doubleClickTime READ doubleClickTime WRITE setDoubleClickTime NOTIFY doubleClickTimeChanged RESET resetDoubleClickTime)
    Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged RESET resetFont)
    Q_PROPERTY(qlonglong fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged RESET resetFontSize)
    Q_PROPERTY(bool forceSoftwareCursor READ forceSoftwareCursor WRITE setForceSoftwareCursor NOTIFY forceSoftwareCursorChanged RESET resetForceSoftwareCursor)
    Q_PROPERTY(QString iconThemeName READ iconThemeName WRITE setIconThemeName NOTIFY iconThemeNameChanged RESET resetIconThemeName)
    Q_PROPERTY(QString lostScreen READ lostScreen WRITE setLostScreen NOTIFY lostScreenChanged RESET resetLostScreen)
    Q_PROPERTY(qlonglong maxWorkspace READ maxWorkspace WRITE setMaxWorkspace NOTIFY maxWorkspaceChanged RESET resetMaxWorkspace)
    Q_PROPERTY(QString monoFont READ monoFont WRITE setMonoFont NOTIFY monoFontChanged RESET resetMonoFont)
    Q_PROPERTY(qlonglong numWorkspace READ numWorkspace WRITE setNumWorkspace NOTIFY numWorkspaceChanged RESET resetNumWorkspace)
    Q_PROPERTY(bool preferDark READ preferDark WRITE setPreferDark NOTIFY preferDarkChanged RESET resetPreferDark)
    Q_PROPERTY(bool showOnLock READ showOnLock WRITE setShowOnLock NOTIFY showOnLockChanged RESET resetShowOnLock)
    Q_PROPERTY(QString themeName READ themeName WRITE setThemeName NOTIFY themeNameChanged RESET resetThemeName)
    Q_PROPERTY(qlonglong windowOpacity READ windowOpacity WRITE setWindowOpacity NOTIFY windowOpacityChanged RESET resetWindowOpacity)
    Q_PROPERTY(qlonglong windowRadius READ windowRadius WRITE setWindowRadius NOTIFY windowRadiusChanged RESET resetWindowRadius)
    Q_PROPERTY(qlonglong windowThemeType READ windowThemeType WRITE setWindowThemeType NOTIFY windowThemeTypeChanged RESET resetWindowThemeType)
    Q_PROPERTY(qlonglong windowTitlebarHeight READ windowTitlebarHeight WRITE setWindowTitlebarHeight NOTIFY windowTitlebarHeightChanged RESET resetWindowTitlebarHeight)
public:
    explicit dconfig_org_deepin_treeland(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &appId, const QString &subpath, QObject *parent)
                : QObject(parent) {
        if (!thread->isRunning()) {
            qWarning() << QLatin1String("Warning: The provided thread is not running.");
        }
        Q_ASSERT(QThread::currentThread() != thread);
        auto worker = new QObject();
        worker->moveToThread(thread);
        QMetaObject::invokeMethod(worker, [=, this]() {
            DTK_CORE_NAMESPACE::DConfig *config = nullptr;
            if (backend) {
                if (appId.isNull()) {
                    config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr);
                } else {
                    config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr);
                }
            } else {
                if (appId.isNull()) {
                    config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr);
                } else {
                    config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr);
                }
            }
            if (!config) {
                qWarning() << QLatin1String("Failed to create DConfig instance.");
                worker->deleteLater();
                return;
            }
            config->moveToThread(QThread::currentThread());
            initializeInConfigThread(config);
            worker->deleteLater();
        });
    }
    static dconfig_org_deepin_treeland* create(const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new dconfig_org_deepin_treeland(thread, nullptr, appId, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0074\u0072\u0065\u0065\u006c\u0061\u006e\u0064"), subpath, parent); }
    static dconfig_org_deepin_treeland* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new dconfig_org_deepin_treeland(thread, backend, appId, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0074\u0072\u0065\u0065\u006c\u0061\u006e\u0064"), subpath, parent); }
    static dconfig_org_deepin_treeland* createByName(const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new dconfig_org_deepin_treeland(thread, nullptr, appId, name, subpath, parent); }
    static dconfig_org_deepin_treeland* createByName(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new dconfig_org_deepin_treeland(thread, backend, appId, name, subpath, parent); }
    ~dconfig_org_deepin_treeland() {
        if (m_config.loadRelaxed()) {
            m_config.loadRelaxed()->deleteLater();
        }
    }

    DTK_CORE_NAMESPACE::DConfig *config() const {
        return m_config.loadRelaxed();
    }

    bool isInitializeSucceed() const {
        return m_status.loadRelaxed() == static_cast<int>(Status::Succeed);
    }

    bool isInitializeFailed() const {
        return m_status.loadRelaxed() == static_cast<int>(Status::Failed);
    }

    bool isInitializing() const {
        return m_status.loadRelaxed() == static_cast<int>(Status::Invalid);
    }

    QString activeColor() const {
        return p_activeColor;
    }
    void setActiveColor(const QString &value) {
        auto oldValue = p_activeColor;
        p_activeColor = value;
        markPropertySet(0);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0061\u0063\u0074\u0069\u0076\u0065\u0043\u006f\u006c\u006f\u0072"), value);
            });
        }
        if (p_activeColor != oldValue) {
            Q_EMIT activeColorChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0061\u0063\u0074\u0069\u0076\u0065\u0043\u006f\u006c\u006f\u0072"), value);
        }
    }
    void resetActiveColor() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0061\u0063\u0074\u0069\u0076\u0065\u0043\u006f\u006c\u006f\u0072"));
            });
        }
    }
    qlonglong currentWorkspace() const {
        return p_currentWorkspace;
    }
    void setCurrentWorkspace(const qlonglong &value) {
        auto oldValue = p_currentWorkspace;
        p_currentWorkspace = value;
        markPropertySet(1);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), value);
            });
        }
        if (p_currentWorkspace != oldValue) {
            Q_EMIT currentWorkspaceChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), value);
        }
    }
    void resetCurrentWorkspace() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"));
            });
        }
    }
    bool cursorBlink() const {
        return p_cursorBlink;
    }
    void setCursorBlink(const bool &value) {
        auto oldValue = p_cursorBlink;
        p_cursorBlink = value;
        markPropertySet(2);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b"), value);
            });
        }
        if (p_cursorBlink != oldValue) {
            Q_EMIT cursorBlinkChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b"), value);
        }
    }
    void resetCursorBlink() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b"));
            });
        }
    }
    qlonglong cursorBlinkTime() const {
        return p_cursorBlinkTime;
    }
    void setCursorBlinkTime(const qlonglong &value) {
        auto oldValue = p_cursorBlinkTime;
        p_cursorBlinkTime = value;
        markPropertySet(3);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b\u0054\u0069\u006d\u0065"), value);
            });
        }
        if (p_cursorBlinkTime != oldValue) {
            Q_EMIT cursorBlinkTimeChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b\u0054\u0069\u006d\u0065"), value);
        }
    }
    void resetCursorBlinkTime() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b\u0054\u0069\u006d\u0065"));
            });
        }
    }
    qlonglong cursorSize() const {
        return p_cursorSize;
    }
    void setCursorSize(const qlonglong &value) {
        auto oldValue = p_cursorSize;
        p_cursorSize = value;
        markPropertySet(4);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0053\u0069\u007a\u0065"), value);
            });
        }
        if (p_cursorSize != oldValue) {
            Q_EMIT cursorSizeChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0053\u0069\u007a\u0065"), value);
        }
    }
    void resetCursorSize() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0053\u0069\u007a\u0065"));
            });
        }
    }
    QString cursorThemeName() const {
        return p_cursorThemeName;
    }
    void setCursorThemeName(const QString &value) {
        auto oldValue = p_cursorThemeName;
        p_cursorThemeName = value;
        markPropertySet(5);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), value);
            });
        }
        if (p_cursorThemeName != oldValue) {
            Q_EMIT cursorThemeNameChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), value);
        }
    }
    void resetCursorThemeName() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"));
            });
        }
    }
    QString defaultBackground() const {
        return p_defaultBackground;
    }
    void setDefaultBackground(const QString &value) {
        auto oldValue = p_defaultBackground;
        p_defaultBackground = value;
        markPropertySet(6);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064"), value);
            });
        }
        if (p_defaultBackground != oldValue) {
            Q_EMIT defaultBackgroundChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064"), value);
        }
    }
    void resetDefaultBackground() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064"));
            });
        }
    }
    qlonglong dndDragThreshold() const {
        return p_dndDragThreshold;
    }
    void setDndDragThreshold(const qlonglong &value) {
        auto oldValue = p_dndDragThreshold;
        p_dndDragThreshold = value;
        markPropertySet(7);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0064\u006e\u0064\u0044\u0072\u0061\u0067\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064"), value);
            });
        }
        if (p_dndDragThreshold != oldValue) {
            Q_EMIT dndDragThresholdChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0064\u006e\u0064\u0044\u0072\u0061\u0067\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064"), value);
        }
    }
    void resetDndDragThreshold() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0064\u006e\u0064\u0044\u0072\u0061\u0067\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064"));
            });
        }
    }
    qlonglong doubleClickDistance() const {
        return p_doubleClickDistance;
    }
    void setDoubleClickDistance(const qlonglong &value) {
        auto oldValue = p_doubleClickDistance;
        p_doubleClickDistance = value;
        markPropertySet(8);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0044\u0069\u0073\u0074\u0061\u006e\u0063\u0065"), value);
            });
        }
        if (p_doubleClickDistance != oldValue) {
            Q_EMIT doubleClickDistanceChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0044\u0069\u0073\u0074\u0061\u006e\u0063\u0065"), value);
        }
    }
    void resetDoubleClickDistance() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0044\u0069\u0073\u0074\u0061\u006e\u0063\u0065"));
            });
        }
    }
    qlonglong doubleClickTime() const {
        return p_doubleClickTime;
    }
    void setDoubleClickTime(const qlonglong &value) {
        auto oldValue = p_doubleClickTime;
        p_doubleClickTime = value;
        markPropertySet(9);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0054\u0069\u006d\u0065"), value);
            });
        }
        if (p_doubleClickTime != oldValue) {
            Q_EMIT doubleClickTimeChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0054\u0069\u006d\u0065"), value);
        }
    }
    void resetDoubleClickTime() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0054\u0069\u006d\u0065"));
            });
        }
    }
    QString font() const {
        return p_font;
    }
    void setFont(const QString &value) {
        auto oldValue = p_font;
        p_font = value;
        markPropertySet(10);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0066\u006f\u006e\u0074"), value);
            });
        }
        if (p_font != oldValue) {
            Q_EMIT fontChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0066\u006f\u006e\u0074"), value);
        }
    }
    void resetFont() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0066\u006f\u006e\u0074"));
            });
        }
    }
    qlonglong fontSize() const {
        return p_fontSize;
    }
    void setFontSize(const qlonglong &value) {
        auto oldValue = p_fontSize;
        p_fontSize = value;
        markPropertySet(11);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0066\u006f\u006e\u0074\u0053\u0069\u007a\u0065"), value);
            });
        }
        if (p_fontSize != oldValue) {
            Q_EMIT fontSizeChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0066\u006f\u006e\u0074\u0053\u0069\u007a\u0065"), value);
        }
    }
    void resetFontSize() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0066\u006f\u006e\u0074\u0053\u0069\u007a\u0065"));
            });
        }
    }
    bool forceSoftwareCursor() const {
        return p_forceSoftwareCursor;
    }
    void setForceSoftwareCursor(const bool &value) {
        auto oldValue = p_forceSoftwareCursor;
        p_forceSoftwareCursor = value;
        markPropertySet(12);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0066\u006f\u0072\u0063\u0065\u0053\u006f\u0066\u0074\u0077\u0061\u0072\u0065\u0043\u0075\u0072\u0073\u006f\u0072"), value);
            });
        }
        if (p_forceSoftwareCursor != oldValue) {
            Q_EMIT forceSoftwareCursorChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0066\u006f\u0072\u0063\u0065\u0053\u006f\u0066\u0074\u0077\u0061\u0072\u0065\u0043\u0075\u0072\u0073\u006f\u0072"), value);
        }
    }
    void resetForceSoftwareCursor() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0066\u006f\u0072\u0063\u0065\u0053\u006f\u0066\u0074\u0077\u0061\u0072\u0065\u0043\u0075\u0072\u0073\u006f\u0072"));
            });
        }
    }
    QString iconThemeName() const {
        return p_iconThemeName;
    }
    void setIconThemeName(const QString &value) {
        auto oldValue = p_iconThemeName;
        p_iconThemeName = value;
        markPropertySet(13);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0069\u0063\u006f\u006e\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), value);
            });
        }
        if (p_iconThemeName != oldValue) {
            Q_EMIT iconThemeNameChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0069\u0063\u006f\u006e\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), value);
        }
    }
    void resetIconThemeName() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0069\u0063\u006f\u006e\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"));
            });
        }
    }
    QString lostScreen() const {
        return p_lostScreen;
    }
    void setLostScreen(const QString &value) {
        auto oldValue = p_lostScreen;
        p_lostScreen = value;
        markPropertySet(14);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u006c\u006f\u0073\u0074\u0053\u0063\u0072\u0065\u0065\u006e"), value);
            });
        }
        if (p_lostScreen != oldValue) {
            Q_EMIT lostScreenChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u006c\u006f\u0073\u0074\u0053\u0063\u0072\u0065\u0065\u006e"), value);
        }
    }
    void resetLostScreen() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u006c\u006f\u0073\u0074\u0053\u0063\u0072\u0065\u0065\u006e"));
            });
        }
    }
    qlonglong maxWorkspace() const {
        return p_maxWorkspace;
    }
    void setMaxWorkspace(const qlonglong &value) {
        auto oldValue = p_maxWorkspace;
        p_maxWorkspace = value;
        markPropertySet(15);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u006d\u0061\u0078\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), value);
            });
        }
        if (p_maxWorkspace != oldValue) {
            Q_EMIT maxWorkspaceChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u006d\u0061\u0078\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), value);
        }
    }
    void resetMaxWorkspace() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u006d\u0061\u0078\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"));
            });
        }
    }
    QString monoFont() const {
        return p_monoFont;
    }
    void setMonoFont(const QString &value) {
        auto oldValue = p_monoFont;
        p_monoFont = value;
        markPropertySet(16);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u006d\u006f\u006e\u006f\u0046\u006f\u006e\u0074"), value);
            });
        }
        if (p_monoFont != oldValue) {
            Q_EMIT monoFontChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u006d\u006f\u006e\u006f\u0046\u006f\u006e\u0074"), value);
        }
    }
    void resetMonoFont() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u006d\u006f\u006e\u006f\u0046\u006f\u006e\u0074"));
            });
        }
    }
    qlonglong numWorkspace() const {
        return p_numWorkspace;
    }
    void setNumWorkspace(const qlonglong &value) {
        auto oldValue = p_numWorkspace;
        p_numWorkspace = value;
        markPropertySet(17);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u006e\u0075\u006d\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), value);
            });
        }
        if (p_numWorkspace != oldValue) {
            Q_EMIT numWorkspaceChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u006e\u0075\u006d\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), value);
        }
    }
    void resetNumWorkspace() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u006e\u0075\u006d\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"));
            });
        }
    }
    bool preferDark() const {
        return p_preferDark;
    }
    void setPreferDark(const bool &value) {
        auto oldValue = p_preferDark;
        p_preferDark = value;
        markPropertySet(18);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0070\u0072\u0065\u0066\u0065\u0072\u0044\u0061\u0072\u006b"), value);
            });
        }
        if (p_preferDark != oldValue) {
            Q_EMIT preferDarkChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0070\u0072\u0065\u0066\u0065\u0072\u0044\u0061\u0072\u006b"), value);
        }
    }
    void resetPreferDark() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0070\u0072\u0065\u0066\u0065\u0072\u0044\u0061\u0072\u006b"));
            });
        }
    }
    bool showOnLock() const {
        return p_showOnLock;
    }
    void setShowOnLock(const bool &value) {
        auto oldValue = p_showOnLock;
        p_showOnLock = value;
        markPropertySet(19);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0073\u0068\u006f\u0077\u004f\u006e\u004c\u006f\u0063\u006b"), value);
            });
        }
        if (p_showOnLock != oldValue) {
            Q_EMIT showOnLockChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0073\u0068\u006f\u0077\u004f\u006e\u004c\u006f\u0063\u006b"), value);
        }
    }
    void resetShowOnLock() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0073\u0068\u006f\u0077\u004f\u006e\u004c\u006f\u0063\u006b"));
            });
        }
    }
    QString themeName() const {
        return p_themeName;
    }
    void setThemeName(const QString &value) {
        auto oldValue = p_themeName;
        p_themeName = value;
        markPropertySet(20);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), value);
            });
        }
        if (p_themeName != oldValue) {
            Q_EMIT themeNameChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), value);
        }
    }
    void resetThemeName() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"));
            });
        }
    }
    qlonglong windowOpacity() const {
        return p_windowOpacity;
    }
    void setWindowOpacity(const qlonglong &value) {
        auto oldValue = p_windowOpacity;
        p_windowOpacity = value;
        markPropertySet(21);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u004f\u0070\u0061\u0063\u0069\u0074\u0079"), value);
            });
        }
        if (p_windowOpacity != oldValue) {
            Q_EMIT windowOpacityChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u004f\u0070\u0061\u0063\u0069\u0074\u0079"), value);
        }
    }
    void resetWindowOpacity() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u004f\u0070\u0061\u0063\u0069\u0074\u0079"));
            });
        }
    }
    qlonglong windowRadius() const {
        return p_windowRadius;
    }
    void setWindowRadius(const qlonglong &value) {
        auto oldValue = p_windowRadius;
        p_windowRadius = value;
        markPropertySet(22);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0052\u0061\u0064\u0069\u0075\u0073"), value);
            });
        }
        if (p_windowRadius != oldValue) {
            Q_EMIT windowRadiusChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0052\u0061\u0064\u0069\u0075\u0073"), value);
        }
    }
    void resetWindowRadius() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0052\u0061\u0064\u0069\u0075\u0073"));
            });
        }
    }
    qlonglong windowThemeType() const {
        return p_windowThemeType;
    }
    void setWindowThemeType(const qlonglong &value) {
        auto oldValue = p_windowThemeType;
        p_windowThemeType = value;
        markPropertySet(23);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), value);
            });
        }
        if (p_windowThemeType != oldValue) {
            Q_EMIT windowThemeTypeChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), value);
        }
    }
    void resetWindowThemeType() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"));
            });
        }
    }
    qlonglong windowTitlebarHeight() const {
        return p_windowTitlebarHeight;
    }
    void setWindowTitlebarHeight(const qlonglong &value) {
        auto oldValue = p_windowTitlebarHeight;
        p_windowTitlebarHeight = value;
        markPropertySet(24);
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this, value]() {
                m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), value);
            });
        }
        if (p_windowTitlebarHeight != oldValue) {
            Q_EMIT windowTitlebarHeightChanged();
            Q_EMIT valueChanged(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), value);
        }
    }
    void resetWindowTitlebarHeight() {
        if (auto config = m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [this]() {
                m_config.loadRelaxed()->reset(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"));
            });
        }
    }
Q_SIGNALS:
    void configInitializeFailed(DTK_CORE_NAMESPACE::DConfig *config);
    void configInitializeSucceed(DTK_CORE_NAMESPACE::DConfig *config);
    void valueChanged(const QString &key, const QVariant &value);

    void activeColorChanged();
    void currentWorkspaceChanged();
    void cursorBlinkChanged();
    void cursorBlinkTimeChanged();
    void cursorSizeChanged();
    void cursorThemeNameChanged();
    void defaultBackgroundChanged();
    void dndDragThresholdChanged();
    void doubleClickDistanceChanged();
    void doubleClickTimeChanged();
    void fontChanged();
    void fontSizeChanged();
    void forceSoftwareCursorChanged();
    void iconThemeNameChanged();
    void lostScreenChanged();
    void maxWorkspaceChanged();
    void monoFontChanged();
    void numWorkspaceChanged();
    void preferDarkChanged();
    void showOnLockChanged();
    void themeNameChanged();
    void windowOpacityChanged();
    void windowRadiusChanged();
    void windowThemeTypeChanged();
    void windowTitlebarHeightChanged();
private:
    void initializeInConfigThread(DTK_CORE_NAMESPACE::DConfig *config) {
        Q_ASSERT(!m_config.loadRelaxed());
        m_config.storeRelaxed(config);
        if (!config->isValid()) {
           m_status.storeRelaxed(static_cast<int>(Status::Failed));
           Q_EMIT configInitializeFailed(config);
           return;
        }

        if (testPropertySet(0)) {
            config->setValue(QStringLiteral(u"\u0061\u0063\u0074\u0069\u0076\u0065\u0043\u006f\u006c\u006f\u0072"), QVariant::fromValue(p_activeColor));
        } else {
            updateValue(QStringLiteral(u"\u0061\u0063\u0074\u0069\u0076\u0065\u0043\u006f\u006c\u006f\u0072"), QVariant::fromValue(p_activeColor));
        }
        if (testPropertySet(1)) {
            config->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), QVariant::fromValue(p_currentWorkspace));
        } else {
            updateValue(QStringLiteral(u"\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), QVariant::fromValue(p_currentWorkspace));
        }
        if (testPropertySet(2)) {
            config->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b"), QVariant::fromValue(p_cursorBlink));
        } else {
            updateValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b"), QVariant::fromValue(p_cursorBlink));
        }
        if (testPropertySet(3)) {
            config->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b\u0054\u0069\u006d\u0065"), QVariant::fromValue(p_cursorBlinkTime));
        } else {
            updateValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b\u0054\u0069\u006d\u0065"), QVariant::fromValue(p_cursorBlinkTime));
        }
        if (testPropertySet(4)) {
            config->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0053\u0069\u007a\u0065"), QVariant::fromValue(p_cursorSize));
        } else {
            updateValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0053\u0069\u007a\u0065"), QVariant::fromValue(p_cursorSize));
        }
        if (testPropertySet(5)) {
            config->setValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), QVariant::fromValue(p_cursorThemeName));
        } else {
            updateValue(QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), QVariant::fromValue(p_cursorThemeName));
        }
        if (testPropertySet(6)) {
            config->setValue(QStringLiteral(u"\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064"), QVariant::fromValue(p_defaultBackground));
        } else {
            updateValue(QStringLiteral(u"\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064"), QVariant::fromValue(p_defaultBackground));
        }
        if (testPropertySet(7)) {
            config->setValue(QStringLiteral(u"\u0064\u006e\u0064\u0044\u0072\u0061\u0067\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064"), QVariant::fromValue(p_dndDragThreshold));
        } else {
            updateValue(QStringLiteral(u"\u0064\u006e\u0064\u0044\u0072\u0061\u0067\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064"), QVariant::fromValue(p_dndDragThreshold));
        }
        if (testPropertySet(8)) {
            config->setValue(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0044\u0069\u0073\u0074\u0061\u006e\u0063\u0065"), QVariant::fromValue(p_doubleClickDistance));
        } else {
            updateValue(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0044\u0069\u0073\u0074\u0061\u006e\u0063\u0065"), QVariant::fromValue(p_doubleClickDistance));
        }
        if (testPropertySet(9)) {
            config->setValue(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0054\u0069\u006d\u0065"), QVariant::fromValue(p_doubleClickTime));
        } else {
            updateValue(QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0054\u0069\u006d\u0065"), QVariant::fromValue(p_doubleClickTime));
        }
        if (testPropertySet(10)) {
            config->setValue(QStringLiteral(u"\u0066\u006f\u006e\u0074"), QVariant::fromValue(p_font));
        } else {
            updateValue(QStringLiteral(u"\u0066\u006f\u006e\u0074"), QVariant::fromValue(p_font));
        }
        if (testPropertySet(11)) {
            config->setValue(QStringLiteral(u"\u0066\u006f\u006e\u0074\u0053\u0069\u007a\u0065"), QVariant::fromValue(p_fontSize));
        } else {
            updateValue(QStringLiteral(u"\u0066\u006f\u006e\u0074\u0053\u0069\u007a\u0065"), QVariant::fromValue(p_fontSize));
        }
        if (testPropertySet(12)) {
            config->setValue(QStringLiteral(u"\u0066\u006f\u0072\u0063\u0065\u0053\u006f\u0066\u0074\u0077\u0061\u0072\u0065\u0043\u0075\u0072\u0073\u006f\u0072"), QVariant::fromValue(p_forceSoftwareCursor));
        } else {
            updateValue(QStringLiteral(u"\u0066\u006f\u0072\u0063\u0065\u0053\u006f\u0066\u0074\u0077\u0061\u0072\u0065\u0043\u0075\u0072\u0073\u006f\u0072"), QVariant::fromValue(p_forceSoftwareCursor));
        }
        if (testPropertySet(13)) {
            config->setValue(QStringLiteral(u"\u0069\u0063\u006f\u006e\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), QVariant::fromValue(p_iconThemeName));
        } else {
            updateValue(QStringLiteral(u"\u0069\u0063\u006f\u006e\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), QVariant::fromValue(p_iconThemeName));
        }
        if (testPropertySet(14)) {
            config->setValue(QStringLiteral(u"\u006c\u006f\u0073\u0074\u0053\u0063\u0072\u0065\u0065\u006e"), QVariant::fromValue(p_lostScreen));
        } else {
            updateValue(QStringLiteral(u"\u006c\u006f\u0073\u0074\u0053\u0063\u0072\u0065\u0065\u006e"), QVariant::fromValue(p_lostScreen));
        }
        if (testPropertySet(15)) {
            config->setValue(QStringLiteral(u"\u006d\u0061\u0078\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), QVariant::fromValue(p_maxWorkspace));
        } else {
            updateValue(QStringLiteral(u"\u006d\u0061\u0078\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), QVariant::fromValue(p_maxWorkspace));
        }
        if (testPropertySet(16)) {
            config->setValue(QStringLiteral(u"\u006d\u006f\u006e\u006f\u0046\u006f\u006e\u0074"), QVariant::fromValue(p_monoFont));
        } else {
            updateValue(QStringLiteral(u"\u006d\u006f\u006e\u006f\u0046\u006f\u006e\u0074"), QVariant::fromValue(p_monoFont));
        }
        if (testPropertySet(17)) {
            config->setValue(QStringLiteral(u"\u006e\u0075\u006d\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), QVariant::fromValue(p_numWorkspace));
        } else {
            updateValue(QStringLiteral(u"\u006e\u0075\u006d\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065"), QVariant::fromValue(p_numWorkspace));
        }
        if (testPropertySet(18)) {
            config->setValue(QStringLiteral(u"\u0070\u0072\u0065\u0066\u0065\u0072\u0044\u0061\u0072\u006b"), QVariant::fromValue(p_preferDark));
        } else {
            updateValue(QStringLiteral(u"\u0070\u0072\u0065\u0066\u0065\u0072\u0044\u0061\u0072\u006b"), QVariant::fromValue(p_preferDark));
        }
        if (testPropertySet(19)) {
            config->setValue(QStringLiteral(u"\u0073\u0068\u006f\u0077\u004f\u006e\u004c\u006f\u0063\u006b"), QVariant::fromValue(p_showOnLock));
        } else {
            updateValue(QStringLiteral(u"\u0073\u0068\u006f\u0077\u004f\u006e\u004c\u006f\u0063\u006b"), QVariant::fromValue(p_showOnLock));
        }
        if (testPropertySet(20)) {
            config->setValue(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), QVariant::fromValue(p_themeName));
        } else {
            updateValue(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065"), QVariant::fromValue(p_themeName));
        }
        if (testPropertySet(21)) {
            config->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u004f\u0070\u0061\u0063\u0069\u0074\u0079"), QVariant::fromValue(p_windowOpacity));
        } else {
            updateValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u004f\u0070\u0061\u0063\u0069\u0074\u0079"), QVariant::fromValue(p_windowOpacity));
        }
        if (testPropertySet(22)) {
            config->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0052\u0061\u0064\u0069\u0075\u0073"), QVariant::fromValue(p_windowRadius));
        } else {
            updateValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0052\u0061\u0064\u0069\u0075\u0073"), QVariant::fromValue(p_windowRadius));
        }
        if (testPropertySet(23)) {
            config->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), QVariant::fromValue(p_windowThemeType));
        } else {
            updateValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), QVariant::fromValue(p_windowThemeType));
        }
        if (testPropertySet(24)) {
            config->setValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), QVariant::fromValue(p_windowTitlebarHeight));
        } else {
            updateValue(QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), QVariant::fromValue(p_windowTitlebarHeight));
        }

        connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) {
            updateValue(key);
        }, Qt::DirectConnection);

        m_status.storeRelaxed(static_cast<int>(Status::Succeed));
        Q_EMIT configInitializeSucceed(config);
    }
    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(u"\u0061\u0063\u0074\u0069\u0076\u0065\u0043\u006f\u006c\u006f\u0072")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_activeColor != newValue) {
                    p_activeColor = newValue;
                    Q_EMIT activeColorChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0063\u0075\u0072\u0072\u0065\u006e\u0074\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_currentWorkspace != newValue) {
                    p_currentWorkspace = newValue;
                    Q_EMIT currentWorkspaceChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b")) {
            auto newValue = qvariant_cast<bool>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_cursorBlink != newValue) {
                    p_cursorBlink = newValue;
                    Q_EMIT cursorBlinkChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0042\u006c\u0069\u006e\u006b\u0054\u0069\u006d\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_cursorBlinkTime != newValue) {
                    p_cursorBlinkTime = newValue;
                    Q_EMIT cursorBlinkTimeChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0053\u0069\u007a\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_cursorSize != newValue) {
                    p_cursorSize = newValue;
                    Q_EMIT cursorSizeChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0063\u0075\u0072\u0073\u006f\u0072\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_cursorThemeName != newValue) {
                    p_cursorThemeName = newValue;
                    Q_EMIT cursorThemeNameChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u0042\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_defaultBackground != newValue) {
                    p_defaultBackground = newValue;
                    Q_EMIT defaultBackgroundChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0064\u006e\u0064\u0044\u0072\u0061\u0067\u0054\u0068\u0072\u0065\u0073\u0068\u006f\u006c\u0064")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_dndDragThreshold != newValue) {
                    p_dndDragThreshold = newValue;
                    Q_EMIT dndDragThresholdChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0044\u0069\u0073\u0074\u0061\u006e\u0063\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_doubleClickDistance != newValue) {
                    p_doubleClickDistance = newValue;
                    Q_EMIT doubleClickDistanceChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0064\u006f\u0075\u0062\u006c\u0065\u0043\u006c\u0069\u0063\u006b\u0054\u0069\u006d\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_doubleClickTime != newValue) {
                    p_doubleClickTime = newValue;
                    Q_EMIT doubleClickTimeChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0066\u006f\u006e\u0074")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_font != newValue) {
                    p_font = newValue;
                    Q_EMIT fontChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0066\u006f\u006e\u0074\u0053\u0069\u007a\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_fontSize != newValue) {
                    p_fontSize = newValue;
                    Q_EMIT fontSizeChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0066\u006f\u0072\u0063\u0065\u0053\u006f\u0066\u0074\u0077\u0061\u0072\u0065\u0043\u0075\u0072\u0073\u006f\u0072")) {
            auto newValue = qvariant_cast<bool>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_forceSoftwareCursor != newValue) {
                    p_forceSoftwareCursor = newValue;
                    Q_EMIT forceSoftwareCursorChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0069\u0063\u006f\u006e\u0054\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_iconThemeName != newValue) {
                    p_iconThemeName = newValue;
                    Q_EMIT iconThemeNameChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u006c\u006f\u0073\u0074\u0053\u0063\u0072\u0065\u0065\u006e")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_lostScreen != newValue) {
                    p_lostScreen = newValue;
                    Q_EMIT lostScreenChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u006d\u0061\u0078\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_maxWorkspace != newValue) {
                    p_maxWorkspace = newValue;
                    Q_EMIT maxWorkspaceChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u006d\u006f\u006e\u006f\u0046\u006f\u006e\u0074")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_monoFont != newValue) {
                    p_monoFont = newValue;
                    Q_EMIT monoFontChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u006e\u0075\u006d\u0057\u006f\u0072\u006b\u0073\u0070\u0061\u0063\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_numWorkspace != newValue) {
                    p_numWorkspace = newValue;
                    Q_EMIT numWorkspaceChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0070\u0072\u0065\u0066\u0065\u0072\u0044\u0061\u0072\u006b")) {
            auto newValue = qvariant_cast<bool>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_preferDark != newValue) {
                    p_preferDark = newValue;
                    Q_EMIT preferDarkChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0073\u0068\u006f\u0077\u004f\u006e\u004c\u006f\u0063\u006b")) {
            auto newValue = qvariant_cast<bool>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_showOnLock != newValue) {
                    p_showOnLock = newValue;
                    Q_EMIT showOnLockChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u004e\u0061\u006d\u0065")) {
            auto newValue = qvariant_cast<QString>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_themeName != newValue) {
                    p_themeName = newValue;
                    Q_EMIT themeNameChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u004f\u0070\u0061\u0063\u0069\u0074\u0079")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_windowOpacity != newValue) {
                    p_windowOpacity = newValue;
                    Q_EMIT windowOpacityChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0052\u0061\u0064\u0069\u0075\u0073")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_windowRadius != newValue) {
                    p_windowRadius = newValue;
                    Q_EMIT windowRadiusChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_windowThemeType != newValue) {
                    p_windowThemeType = newValue;
                    Q_EMIT windowThemeTypeChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
        if (key == QStringLiteral(u"\u0077\u0069\u006e\u0064\u006f\u0077\u0054\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074")) {
            auto newValue = qvariant_cast<qlonglong>(value);
            QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                Q_ASSERT(QThread::currentThread() == this->thread());
                if (p_windowTitlebarHeight != newValue) {
                    p_windowTitlebarHeight = newValue;
                    Q_EMIT windowTitlebarHeightChanged();
                    Q_EMIT valueChanged(key, value);
                }
            });
            return;
        }
    }
    inline void markPropertySet(const int index, bool on = true) {
        if (index < 32) {
            if (on)
                m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0));
            else
                m_propertySetStatus0.fetchAndAndOrdered(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;

public:
    enum class Status {
        Invalid = 0,
        Succeed = 1,
        Failed = 2
    };
private:
    QAtomicInteger<int> m_status = static_cast<int>(Status::Invalid);

    // Default value: "#1F6EE7"
    QString p_activeColor { QStringLiteral(u"\u0023\u0031\u0046\u0036\u0045\u0045\u0037") };
    qlonglong p_currentWorkspace { 0 };
    bool p_cursorBlink { true };
    qlonglong p_cursorBlinkTime { 1200 };
    qlonglong p_cursorSize { 24 };
    // Default value: "bloom"
    QString p_cursorThemeName { QStringLiteral(u"\u0062\u006c\u006f\u006f\u006d") };
    // Default value: "/usr/share/backgrounds/default_background.jpg"
    QString p_defaultBackground { QStringLiteral(u"\u002f\u0075\u0073\u0072\u002f\u0073\u0068\u0061\u0072\u0065\u002f\u0062\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064\u0073\u002f\u0064\u0065\u0066\u0061\u0075\u006c\u0074\u005f\u0062\u0061\u0063\u006b\u0067\u0072\u006f\u0075\u006e\u0064\u002e\u006a\u0070\u0067") };
    qlonglong p_dndDragThreshold { 8 };
    qlonglong p_doubleClickDistance { 5 };
    qlonglong p_doubleClickTime { 250 };
    // Default value: "Source Han Sans SC"
    QString p_font { QStringLiteral(u"\u0053\u006f\u0075\u0072\u0063\u0065\u0020\u0048\u0061\u006e\u0020\u0053\u0061\u006e\u0073\u0020\u0053\u0043") };
    qlonglong p_fontSize { 105 };
    bool p_forceSoftwareCursor { false };
    // Default value: "nirvana"
    QString p_iconThemeName { QStringLiteral(u"\u006e\u0069\u0072\u0076\u0061\u006e\u0061") };
    // Default value: "MoveToPrimary"
    QString p_lostScreen { QStringLiteral(u"\u004d\u006f\u0076\u0065\u0054\u006f\u0050\u0072\u0069\u006d\u0061\u0072\u0079") };
    qlonglong p_maxWorkspace { 6 };
    // Default value: "Noto Mono"
    QString p_monoFont { QStringLiteral(u"\u004e\u006f\u0074\u006f\u0020\u004d\u006f\u006e\u006f") };
    qlonglong p_numWorkspace { 2 };
    bool p_preferDark { false };
    bool p_showOnLock { false };
    // Default value: ""
    QString p_themeName { QLatin1String("") };
    qlonglong p_windowOpacity { 40 };
    qlonglong p_windowRadius { 12 };
    qlonglong p_windowThemeType { 0 };
    qlonglong p_windowTitlebarHeight { 40 };
    QAtomicInteger<quint32> m_propertySetStatus0 = 0;
};

#endif // DCONFIG_ORG_DEEPIN_TREELAND_H

deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 3, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Dec 4, 2024
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@deepin-bot
Copy link
Contributor

deepin-bot bot commented Dec 4, 2024

TAG Bot

New tag: 5.7.4
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #446

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Dec 17, 2024

TAG Bot

New tag: 5.7.5
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #450

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 2, 2025

TAG Bot

New tag: 5.7.6
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #452

deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Jan 2, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 9, 2025

TAG Bot

New tag: 5.7.7
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #453

deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Jan 10, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. CMakeLists.txt 文件:

    • tools/CMakeLists.txt 文件中添加了 dconfig2cpp 子目录,这是一个好的做法,但应确保 dconfig2cpp 目录中包含必要的构建文件和源代码。
  2. dconfig2cpp/CMakeLists.txt 文件:

    • set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 这一行是好的,因为它可以帮助开发者在构建时生成 compile_commands.json 文件,方便代码分析工具使用。
    • find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) 这一行确保了项目依赖于 Qt 库,但应检查 QT_VERSION_MAJOR 是否在项目配置中定义。
  3. main.cpp 文件:

    • jsonValueToCppCode 函数中,对于 QVariant 的处理逻辑较为复杂,建议添加注释说明每个分支的用途。
    • main 函数中,对 JSON 文件的读取和处理逻辑较为冗长,建议将这部分逻辑拆分成多个函数以提高代码的可读性和可维护性。
    • 在生成头文件时,使用了大量的字符串拼接,建议使用 QStringBuilder 来提高性能。
    • 在处理 JSON 文件时,没有对异常情况进行处理,例如文件不存在或 JSON 格式错误,建议添加相应的错误处理逻辑。
    • 在生成头文件时,使用了大量的 QStringLiteral,这可能会导致生成的文件较大,建议评估是否需要使用 QString 而不是 QStringLiteral
    • 在生成头文件时,使用了大量的 Q_ASSERT,这可能会导致在发布版本中产生不必要的断言失败,建议在调试版本中使用 Q_ASSERT,而在发布版本中移除。
  4. 代码风格和格式:

    • 代码中存在一些不一致的缩进和空格使用,建议统一代码风格,以提高代码的可读性。
    • main.cpp 文件中,注释的格式和位置不一致,建议统一注释的格式和位置。
  5. 安全性:

    • 在读取和解析 JSON 文件时,没有对输入进行验证,可能会导致安全漏洞,建议添加输入验证逻辑。
    • 在生成头文件时,使用了用户输入的值来生成文件名,这可能会导致文件名注入攻击,建议对用户输入进行验证和清理。
  6. 性能:

    • jsonValueToCppCode 函数中,对于 QVariant 的处理逻辑可能存在性能问题,建议评估是否需要优化。
    • 在生成头文件时,使用了大量的字符串拼接,这可能会导致性能问题,建议评估是否需要优化。
  7. 错误处理:

    • main 函数中,对于文件打开失败的情况,只是简单地打印了警告信息并返回了错误码,建议添加更详细的错误处理逻辑,例如记录日志或抛出异常。
  8. 代码重复:

    • main.cpp 文件中,生成构造函数的代码逻辑重复,建议提取公共逻辑到一个单独的函数中。
  9. 代码注释:

    • main.cpp 文件中,部分代码缺少注释,建议添加必要的注释以提高代码的可读性。
  10. 代码健壮性:

    • main.cpp 文件中,对于 JSON 文件的处理逻辑没有进行充分的测试,建议添加单元测试来验证代码的健壮性。

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 14, 2025

TAG Bot

New tag: 5.7.8
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #455

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 23, 2025

TAG Bot

New tag: 5.7.9
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #456

deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 13, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 19, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 19, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
18202781743
18202781743 previously approved these changes Feb 19, 2025
@zccrs zccrs marked this pull request as draft February 19, 2025 10:31
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 19, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@18202781743
Copy link
Contributor

Dconfig传入的filename可以生成,不用外部指定,

deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 20, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@zccrs zccrs requested a review from 18202781743 February 20, 2025 02:43
@zccrs zccrs marked this pull request as ready for review February 20, 2025 02:45
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 20, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 20, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@zccrs
Copy link
Member Author

zccrs commented Feb 20, 2025

Dconfig传入的filename可以生成,不用外部指定,

Fix

To help developer get/set dconfig in the non GUI thread.
Avoid block the application if DConfig's IO is slow.
deepin-ci-robot added a commit to linuxdeepin/dtk6core that referenced this pull request Feb 20, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
@zccrs zccrs requested a review from 18202781743 February 20, 2025 11:28
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, zccrs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zccrs zccrs merged commit 6dfb3c7 into linuxdeepin:master Feb 20, 2025
19 of 21 checks passed
@zccrs zccrs deleted the dconfig branch February 20, 2025 11:45
18202781743 pushed a commit to linuxdeepin/dtk6core that referenced this pull request Feb 20, 2025
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants