/**
 * This file is generated by dconfig2cpp.
 * Command line arguments: /usr/lib/dtk6/DCore/bin/dconfig2cpp -o /build/treeland/src/treeland/build/src/seatuserconfig.hpp -c SeatUserDConfig /build/treeland/src/treeland/misc/dconfig/org.deepin.dde.treeland.user.seat.json
 * Generation time: 2026-08-18T12:51:56
 * JSON file version: 1.0
 * Tool version: 1.1
 *
 * WARNING: DO NOT MODIFY THIS FILE MANUALLY.
 * If you need to change the content, please modify the dconfig2cpp tool.
 */

#ifndef SEATUSERDCONFIG_H
#define SEATUSERDCONFIG_H

#define SEATUSERDCONFIG_DCONFIG_FILE_VERSION_MAJOR 1
#define SEATUSERDCONFIG_DCONFIG_FILE_VERSION_MINOR 1
#define SEATUSERDCONFIG_DCONFIG_FILE_keyboardDelay
#define SEATUSERDCONFIG_DCONFIG_FILE_keyboardRate
#define SEATUSERDCONFIG_DCONFIG_FILE_mouseAccelSpeed
#define SEATUSERDCONFIG_DCONFIG_FILE_mouseAccelerationProfile
#define SEATUSERDCONFIG_DCONFIG_FILE_mouseNaturalScroll
#define SEATUSERDCONFIG_DCONFIG_FILE_pointerHandMode
#define SEATUSERDCONFIG_DCONFIG_FILE_pointerScrollFactor
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadAccelSpeed
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadAccelerationProfile
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadDisableWhileTyping
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadHoldTimeoutMs
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadNaturalScroll
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadSendEventsMode
#define SEATUSERDCONFIG_DCONFIG_FILE_touchpadTapToClick

#include <QThread>
#include <QVariant>
#include <QPointer>
#include <QDebug>
#include <QAtomicPointer>
#include <QAtomicInteger>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QProperty>
#endif
#include <QEvent>
#include <DSGApplication>
#include <DConfig>

class SeatUserDConfig : public QObject {
    Q_OBJECT

    Q_PROPERTY(qlonglong keyboardDelay READ keyboardDelay WRITE setKeyboardDelay NOTIFY keyboardDelayChanged RESET resetKeyboardDelay)
    Q_PROPERTY(qlonglong keyboardRate READ keyboardRate WRITE setKeyboardRate NOTIFY keyboardRateChanged RESET resetKeyboardRate)
    Q_PROPERTY(double mouseAccelSpeed READ mouseAccelSpeed WRITE setMouseAccelSpeed NOTIFY mouseAccelSpeedChanged RESET resetMouseAccelSpeed)
    Q_PROPERTY(qlonglong mouseAccelerationProfile READ mouseAccelerationProfile WRITE setMouseAccelerationProfile NOTIFY mouseAccelerationProfileChanged RESET resetMouseAccelerationProfile)
    Q_PROPERTY(bool mouseNaturalScroll READ mouseNaturalScroll WRITE setMouseNaturalScroll NOTIFY mouseNaturalScrollChanged RESET resetMouseNaturalScroll)
    Q_PROPERTY(QString pointerHandMode READ pointerHandMode WRITE setPointerHandMode NOTIFY pointerHandModeChanged RESET resetPointerHandMode)
    Q_PROPERTY(double pointerScrollFactor READ pointerScrollFactor WRITE setPointerScrollFactor NOTIFY pointerScrollFactorChanged RESET resetPointerScrollFactor)
    Q_PROPERTY(double touchpadAccelSpeed READ touchpadAccelSpeed WRITE setTouchpadAccelSpeed NOTIFY touchpadAccelSpeedChanged RESET resetTouchpadAccelSpeed)
    Q_PROPERTY(qlonglong touchpadAccelerationProfile READ touchpadAccelerationProfile WRITE setTouchpadAccelerationProfile NOTIFY touchpadAccelerationProfileChanged RESET resetTouchpadAccelerationProfile)
    Q_PROPERTY(bool touchpadDisableWhileTyping READ touchpadDisableWhileTyping WRITE setTouchpadDisableWhileTyping NOTIFY touchpadDisableWhileTypingChanged RESET resetTouchpadDisableWhileTyping)
    Q_PROPERTY(qlonglong touchpadHoldTimeoutMs READ touchpadHoldTimeoutMs WRITE setTouchpadHoldTimeoutMs NOTIFY touchpadHoldTimeoutMsChanged RESET resetTouchpadHoldTimeoutMs)
    Q_PROPERTY(bool touchpadNaturalScroll READ touchpadNaturalScroll WRITE setTouchpadNaturalScroll NOTIFY touchpadNaturalScrollChanged RESET resetTouchpadNaturalScroll)
    Q_PROPERTY(qlonglong touchpadSendEventsMode READ touchpadSendEventsMode WRITE setTouchpadSendEventsMode NOTIFY touchpadSendEventsModeChanged RESET resetTouchpadSendEventsMode)
    Q_PROPERTY(bool touchpadTapToClick READ touchpadTapToClick WRITE setTouchpadTapToClick NOTIFY touchpadTapToClickChanged RESET resetTouchpadTapToClick)
    Q_CLASSINFO("DConfigKeyList", "keyboardDelay;keyboardRate;mouseAccelSpeed;mouseAccelerationProfile;mouseNaturalScroll;pointerHandMode;pointerScrollFactor;touchpadAccelSpeed;touchpadAccelerationProfile;touchpadDisableWhileTyping;touchpadHoldTimeoutMs;touchpadNaturalScroll;touchpadSendEventsMode;touchpadTapToClick")
    Q_CLASSINFO("DConfigFileName", "org.deepin.dde.treeland.user.seat")
    Q_CLASSINFO("DConfigFileVersion", "1.0")

public:
    explicit SeatUserDConfig(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend,
                        const QString &name, const QString &appId, const QString &subpath,
                        bool isGeneric, QObject *parent)
                  : QObject(parent), m_data(new Data) {
        m_data->m_userConfig = this;
        m_data->moveToThread(this->thread());

        if (!thread->isRunning()) {
            qWarning() << QLatin1String("Warning: The provided thread is not running.");
        }
        Q_ASSERT(QThread::currentThread() != thread);
        auto worker = new QObject();
        worker->moveToThread(thread);

        QPointer<Data> safeData(m_data);

        QMetaObject::invokeMethod(worker, [safeData, backend, name, appId, subpath, isGeneric, worker]() mutable {
            delete worker;
            worker = nullptr;

            if (!safeData->m_status.testAndSetOrdered(static_cast<int>(Data::Status::Invalid),
                                                      static_cast<int>(Data::Status::Initializing))) {
                // CAS failed: status changed (e.g., set to Destroyed by destructor)
                // Schedule deletion of Data object via deleteLater to avoid direct delete in Config thread
                safeData->deleteLater();
                return;
            }

            DTK_CORE_NAMESPACE::DConfig *config = nullptr;
            if (isGeneric) {
                if (backend) {
                    config = DTK_CORE_NAMESPACE::DConfig::createGeneric(backend, name, subpath, nullptr);
                } else {
                    config = DTK_CORE_NAMESPACE::DConfig::createGeneric(name, subpath, nullptr);
                }
            } else {
                if (backend) {
                    if (appId.isNull()) {
                        config = DTK_CORE_NAMESPACE::DConfig::create(backend, DTK_CORE_NAMESPACE::DSGApplication::id(),
                                                                     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(DTK_CORE_NAMESPACE::DSGApplication::id(),
                                                                     name, subpath, nullptr);
                    } else {
                        config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr);
                    }
                }
            }

            if (!config || !config->isValid()) {
                qWarning() << QLatin1String("Failed to create DConfig instance.");

                QMetaObject::invokeMethod(safeData, [safeData]() {
                    if (safeData->m_status.testAndSetOrdered(static_cast<int>(Data::Status::Initializing),
                                                             static_cast<int>(Data::Status::Failed))) {
                        Q_EMIT safeData->m_userConfig->configInitializeFailed();
                    } else {
                        // CAS failed, destroy data object
                        delete safeData;
                    }
                }, Qt::QueuedConnection);

                if (config)
                    delete config;

                return;
            }
            config->moveToThread(QThread::currentThread());
            // Initialize through Data class
            safeData->initializeInConfigThread(config);

            // Queue state transition to main thread, to ensure config values are fully initialized.
            QMetaObject::invokeMethod(safeData, [safeData, config]() {
                // Try to transition from Initializing to Succeeded
                if (safeData->m_status.testAndSetOrdered(static_cast<int>(Data::Status::Initializing),
                                                         static_cast<int>(Data::Status::Succeeded))) {
                    // CAS succeeded: connect config destroyed signal to cleanup Data, then emit success signal to main thread
                    QObject::connect(config, &QObject::destroyed, safeData, &QObject::deleteLater);
                    if (safeData->m_userConfig) {
                        Q_EMIT safeData->m_userConfig->configInitializeSucceed(config);
                    }
                } else {
                    // CAS failed - state changed (e.g., set to Destroyed)
                    // We must clean up the config we just created
                    config->deleteLater();
                    safeData->deleteLater();
                }
            }, Qt::QueuedConnection);
        });
    }
    static SeatUserDConfig* create(const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, nullptr, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0064\u0065\u002e\u0074\u0072\u0065\u0065\u006c\u0061\u006e\u0064\u002e\u0075\u0073\u0065\u0072\u002e\u0073\u0065\u0061\u0074"), appId, subpath, false, parent); }
    static SeatUserDConfig* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, backend, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0064\u0065\u002e\u0074\u0072\u0065\u0065\u006c\u0061\u006e\u0064\u002e\u0075\u0073\u0065\u0072\u002e\u0073\u0065\u0061\u0074"), appId, subpath, false, parent); }
    static SeatUserDConfig* createByName(const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, nullptr, name, appId, subpath, false, parent); }
    static SeatUserDConfig* 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 SeatUserDConfig(thread, backend, name, appId, subpath, false, parent); }
    static SeatUserDConfig* createGeneric(const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, nullptr, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0064\u0065\u002e\u0074\u0072\u0065\u0065\u006c\u0061\u006e\u0064\u002e\u0075\u0073\u0065\u0072\u002e\u0073\u0065\u0061\u0074"), {}, subpath, true, parent); }
    static SeatUserDConfig* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, backend, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0064\u0065\u002e\u0074\u0072\u0065\u0065\u006c\u0061\u006e\u0064\u002e\u0075\u0073\u0065\u0072\u002e\u0073\u0065\u0061\u0074"), {}, subpath, true, parent); }
    static SeatUserDConfig* createGenericByName(const QString &name, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, nullptr, name, {}, subpath, true, parent); }
    static SeatUserDConfig* createGenericByName(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
    { return new SeatUserDConfig(thread, backend, name, {}, subpath, true, parent); }
    ~SeatUserDConfig() {
        m_data->m_userConfig = nullptr;
        int oldStatus = m_data->m_status.fetchAndStoreOrdered(static_cast<int>(Data::Status::Destroyed));
        if (oldStatus == static_cast<int>(Data::Status::Succeeded)) {
            // When Succeeded, release config object only
            auto config = m_data->m_config.loadRelaxed();
            Q_ASSERT(config);
            config->deleteLater();
            // m_data will be deleted by config's destroyed signal
        } else if (oldStatus == static_cast<int>(Data::Status::Failed)) {
            // When Failed state, schedule cleanup of Data object
            m_data->deleteLater();
        }
    }

    Q_INVOKABLE DTK_CORE_NAMESPACE::DConfig *config() const {
        return m_data->m_config.loadRelaxed();
    }
    // Deprecated: Use isInitializeSucceeded() instead
    Q_INVOKABLE Q_DECL_DEPRECATED_X("Use isInitializeSucceeded() instead")
    bool isInitializeSucceed() const {
        return isInitializeSucceeded();
    }
    Q_INVOKABLE bool isInitializeSucceeded() const {
        return m_data->m_status.loadRelaxed() == static_cast<int>(Data::Status::Succeeded);
    }
    Q_INVOKABLE bool isInitializeFailed() const {
        return m_data->m_status.loadRelaxed() == static_cast<int>(Data::Status::Failed);
    }
    Q_INVOKABLE bool isInitializing() const {
        return m_data->m_status.loadRelaxed() == static_cast<int>(Data::Status::Initializing);
    }

    Q_INVOKABLE QStringList keyList() const {
        return { QStringLiteral("keyboardDelay"),
                 QStringLiteral("keyboardRate"),
                 QStringLiteral("mouseAccelSpeed"),
                 QStringLiteral("mouseAccelerationProfile"),
                 QStringLiteral("mouseNaturalScroll"),
                 QStringLiteral("pointerHandMode"),
                 QStringLiteral("pointerScrollFactor"),
                 QStringLiteral("touchpadAccelSpeed"),
                 QStringLiteral("touchpadAccelerationProfile"),
                 QStringLiteral("touchpadDisableWhileTyping"),
                 QStringLiteral("touchpadHoldTimeoutMs"),
                 QStringLiteral("touchpadNaturalScroll"),
                 QStringLiteral("touchpadSendEventsMode"),
                 QStringLiteral("touchpadTapToClick")};
    }

    Q_INVOKABLE bool isDefaultValue(const QString &key) const {
        if (key == QStringLiteral("keyboardDelay"))
            return keyboardDelayIsDefaultValue();
        if (key == QStringLiteral("keyboardRate"))
            return keyboardRateIsDefaultValue();
        if (key == QStringLiteral("mouseAccelSpeed"))
            return mouseAccelSpeedIsDefaultValue();
        if (key == QStringLiteral("mouseAccelerationProfile"))
            return mouseAccelerationProfileIsDefaultValue();
        if (key == QStringLiteral("mouseNaturalScroll"))
            return mouseNaturalScrollIsDefaultValue();
        if (key == QStringLiteral("pointerHandMode"))
            return pointerHandModeIsDefaultValue();
        if (key == QStringLiteral("pointerScrollFactor"))
            return pointerScrollFactorIsDefaultValue();
        if (key == QStringLiteral("touchpadAccelSpeed"))
            return touchpadAccelSpeedIsDefaultValue();
        if (key == QStringLiteral("touchpadAccelerationProfile"))
            return touchpadAccelerationProfileIsDefaultValue();
        if (key == QStringLiteral("touchpadDisableWhileTyping"))
            return touchpadDisableWhileTypingIsDefaultValue();
        if (key == QStringLiteral("touchpadHoldTimeoutMs"))
            return touchpadHoldTimeoutMsIsDefaultValue();
        if (key == QStringLiteral("touchpadNaturalScroll"))
            return touchpadNaturalScrollIsDefaultValue();
        if (key == QStringLiteral("touchpadSendEventsMode"))
            return touchpadSendEventsModeIsDefaultValue();
        if (key == QStringLiteral("touchpadTapToClick"))
            return touchpadTapToClickIsDefaultValue();
        return false;
    }

    qlonglong keyboardDelay() const {
        return m_data->p_keyboardDelay;
    }
    void setKeyboardDelay(const qlonglong &value) {
        auto oldValue = m_data->p_keyboardDelay;
        m_data->p_keyboardDelay = value;
        m_data->markPropertySet(0);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("keyboardDelay"), value);
            });
        }
        if (m_data->p_keyboardDelay != oldValue) {
            Q_EMIT keyboardDelayChanged();
            Q_EMIT valueChanged(QStringLiteral("keyboardDelay"), value);
        }
    }
    void resetKeyboardDelay() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("keyboardDelay"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<qlonglong> bindableKeyboardDelay() {
        return QBindable<qlonglong>(this, "keyboardDelay");
    }
#endif
    Q_INVOKABLE bool keyboardDelayIsDefaultValue() const {
        return !m_data->testPropertySet(0);
    }
    qlonglong keyboardRate() const {
        return m_data->p_keyboardRate;
    }
    void setKeyboardRate(const qlonglong &value) {
        auto oldValue = m_data->p_keyboardRate;
        m_data->p_keyboardRate = value;
        m_data->markPropertySet(1);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("keyboardRate"), value);
            });
        }
        if (m_data->p_keyboardRate != oldValue) {
            Q_EMIT keyboardRateChanged();
            Q_EMIT valueChanged(QStringLiteral("keyboardRate"), value);
        }
    }
    void resetKeyboardRate() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("keyboardRate"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<qlonglong> bindableKeyboardRate() {
        return QBindable<qlonglong>(this, "keyboardRate");
    }
#endif
    Q_INVOKABLE bool keyboardRateIsDefaultValue() const {
        return !m_data->testPropertySet(1);
    }
    double mouseAccelSpeed() const {
        return m_data->p_mouseAccelSpeed;
    }
    void setMouseAccelSpeed(const double &value) {
        auto oldValue = m_data->p_mouseAccelSpeed;
        m_data->p_mouseAccelSpeed = value;
        m_data->markPropertySet(2);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("mouseAccelSpeed"), value);
            });
        }
        if (m_data->p_mouseAccelSpeed != oldValue) {
            Q_EMIT mouseAccelSpeedChanged();
            Q_EMIT valueChanged(QStringLiteral("mouseAccelSpeed"), value);
        }
    }
    void resetMouseAccelSpeed() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("mouseAccelSpeed"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<double> bindableMouseAccelSpeed() {
        return QBindable<double>(this, "mouseAccelSpeed");
    }
#endif
    Q_INVOKABLE bool mouseAccelSpeedIsDefaultValue() const {
        return !m_data->testPropertySet(2);
    }
    qlonglong mouseAccelerationProfile() const {
        return m_data->p_mouseAccelerationProfile;
    }
    void setMouseAccelerationProfile(const qlonglong &value) {
        auto oldValue = m_data->p_mouseAccelerationProfile;
        m_data->p_mouseAccelerationProfile = value;
        m_data->markPropertySet(3);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("mouseAccelerationProfile"), value);
            });
        }
        if (m_data->p_mouseAccelerationProfile != oldValue) {
            Q_EMIT mouseAccelerationProfileChanged();
            Q_EMIT valueChanged(QStringLiteral("mouseAccelerationProfile"), value);
        }
    }
    void resetMouseAccelerationProfile() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("mouseAccelerationProfile"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<qlonglong> bindableMouseAccelerationProfile() {
        return QBindable<qlonglong>(this, "mouseAccelerationProfile");
    }
#endif
    Q_INVOKABLE bool mouseAccelerationProfileIsDefaultValue() const {
        return !m_data->testPropertySet(3);
    }
    bool mouseNaturalScroll() const {
        return m_data->p_mouseNaturalScroll;
    }
    void setMouseNaturalScroll(const bool &value) {
        auto oldValue = m_data->p_mouseNaturalScroll;
        m_data->p_mouseNaturalScroll = value;
        m_data->markPropertySet(4);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("mouseNaturalScroll"), value);
            });
        }
        if (m_data->p_mouseNaturalScroll != oldValue) {
            Q_EMIT mouseNaturalScrollChanged();
            Q_EMIT valueChanged(QStringLiteral("mouseNaturalScroll"), value);
        }
    }
    void resetMouseNaturalScroll() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("mouseNaturalScroll"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<bool> bindableMouseNaturalScroll() {
        return QBindable<bool>(this, "mouseNaturalScroll");
    }
#endif
    Q_INVOKABLE bool mouseNaturalScrollIsDefaultValue() const {
        return !m_data->testPropertySet(4);
    }
    QString pointerHandMode() const {
        return m_data->p_pointerHandMode;
    }
    void setPointerHandMode(const QString &value) {
        auto oldValue = m_data->p_pointerHandMode;
        m_data->p_pointerHandMode = value;
        m_data->markPropertySet(5);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("pointerHandMode"), value);
            });
        }
        if (m_data->p_pointerHandMode != oldValue) {
            Q_EMIT pointerHandModeChanged();
            Q_EMIT valueChanged(QStringLiteral("pointerHandMode"), value);
        }
    }
    void resetPointerHandMode() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("pointerHandMode"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<QString> bindablePointerHandMode() {
        return QBindable<QString>(this, "pointerHandMode");
    }
#endif
    Q_INVOKABLE bool pointerHandModeIsDefaultValue() const {
        return !m_data->testPropertySet(5);
    }
    double pointerScrollFactor() const {
        return m_data->p_pointerScrollFactor;
    }
    void setPointerScrollFactor(const double &value) {
        auto oldValue = m_data->p_pointerScrollFactor;
        m_data->p_pointerScrollFactor = value;
        m_data->markPropertySet(6);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("pointerScrollFactor"), value);
            });
        }
        if (m_data->p_pointerScrollFactor != oldValue) {
            Q_EMIT pointerScrollFactorChanged();
            Q_EMIT valueChanged(QStringLiteral("pointerScrollFactor"), value);
        }
    }
    void resetPointerScrollFactor() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("pointerScrollFactor"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<double> bindablePointerScrollFactor() {
        return QBindable<double>(this, "pointerScrollFactor");
    }
#endif
    Q_INVOKABLE bool pointerScrollFactorIsDefaultValue() const {
        return !m_data->testPropertySet(6);
    }
    double touchpadAccelSpeed() const {
        return m_data->p_touchpadAccelSpeed;
    }
    void setTouchpadAccelSpeed(const double &value) {
        auto oldValue = m_data->p_touchpadAccelSpeed;
        m_data->p_touchpadAccelSpeed = value;
        m_data->markPropertySet(7);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadAccelSpeed"), value);
            });
        }
        if (m_data->p_touchpadAccelSpeed != oldValue) {
            Q_EMIT touchpadAccelSpeedChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadAccelSpeed"), value);
        }
    }
    void resetTouchpadAccelSpeed() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadAccelSpeed"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<double> bindableTouchpadAccelSpeed() {
        return QBindable<double>(this, "touchpadAccelSpeed");
    }
#endif
    Q_INVOKABLE bool touchpadAccelSpeedIsDefaultValue() const {
        return !m_data->testPropertySet(7);
    }
    qlonglong touchpadAccelerationProfile() const {
        return m_data->p_touchpadAccelerationProfile;
    }
    void setTouchpadAccelerationProfile(const qlonglong &value) {
        auto oldValue = m_data->p_touchpadAccelerationProfile;
        m_data->p_touchpadAccelerationProfile = value;
        m_data->markPropertySet(8);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadAccelerationProfile"), value);
            });
        }
        if (m_data->p_touchpadAccelerationProfile != oldValue) {
            Q_EMIT touchpadAccelerationProfileChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadAccelerationProfile"), value);
        }
    }
    void resetTouchpadAccelerationProfile() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadAccelerationProfile"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<qlonglong> bindableTouchpadAccelerationProfile() {
        return QBindable<qlonglong>(this, "touchpadAccelerationProfile");
    }
#endif
    Q_INVOKABLE bool touchpadAccelerationProfileIsDefaultValue() const {
        return !m_data->testPropertySet(8);
    }
    bool touchpadDisableWhileTyping() const {
        return m_data->p_touchpadDisableWhileTyping;
    }
    void setTouchpadDisableWhileTyping(const bool &value) {
        auto oldValue = m_data->p_touchpadDisableWhileTyping;
        m_data->p_touchpadDisableWhileTyping = value;
        m_data->markPropertySet(9);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadDisableWhileTyping"), value);
            });
        }
        if (m_data->p_touchpadDisableWhileTyping != oldValue) {
            Q_EMIT touchpadDisableWhileTypingChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadDisableWhileTyping"), value);
        }
    }
    void resetTouchpadDisableWhileTyping() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadDisableWhileTyping"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<bool> bindableTouchpadDisableWhileTyping() {
        return QBindable<bool>(this, "touchpadDisableWhileTyping");
    }
#endif
    Q_INVOKABLE bool touchpadDisableWhileTypingIsDefaultValue() const {
        return !m_data->testPropertySet(9);
    }
    qlonglong touchpadHoldTimeoutMs() const {
        return m_data->p_touchpadHoldTimeoutMs;
    }
    void setTouchpadHoldTimeoutMs(const qlonglong &value) {
        auto oldValue = m_data->p_touchpadHoldTimeoutMs;
        m_data->p_touchpadHoldTimeoutMs = value;
        m_data->markPropertySet(10);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadHoldTimeoutMs"), value);
            });
        }
        if (m_data->p_touchpadHoldTimeoutMs != oldValue) {
            Q_EMIT touchpadHoldTimeoutMsChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadHoldTimeoutMs"), value);
        }
    }
    void resetTouchpadHoldTimeoutMs() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadHoldTimeoutMs"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<qlonglong> bindableTouchpadHoldTimeoutMs() {
        return QBindable<qlonglong>(this, "touchpadHoldTimeoutMs");
    }
#endif
    Q_INVOKABLE bool touchpadHoldTimeoutMsIsDefaultValue() const {
        return !m_data->testPropertySet(10);
    }
    bool touchpadNaturalScroll() const {
        return m_data->p_touchpadNaturalScroll;
    }
    void setTouchpadNaturalScroll(const bool &value) {
        auto oldValue = m_data->p_touchpadNaturalScroll;
        m_data->p_touchpadNaturalScroll = value;
        m_data->markPropertySet(11);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadNaturalScroll"), value);
            });
        }
        if (m_data->p_touchpadNaturalScroll != oldValue) {
            Q_EMIT touchpadNaturalScrollChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadNaturalScroll"), value);
        }
    }
    void resetTouchpadNaturalScroll() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadNaturalScroll"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<bool> bindableTouchpadNaturalScroll() {
        return QBindable<bool>(this, "touchpadNaturalScroll");
    }
#endif
    Q_INVOKABLE bool touchpadNaturalScrollIsDefaultValue() const {
        return !m_data->testPropertySet(11);
    }
    qlonglong touchpadSendEventsMode() const {
        return m_data->p_touchpadSendEventsMode;
    }
    void setTouchpadSendEventsMode(const qlonglong &value) {
        auto oldValue = m_data->p_touchpadSendEventsMode;
        m_data->p_touchpadSendEventsMode = value;
        m_data->markPropertySet(12);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadSendEventsMode"), value);
            });
        }
        if (m_data->p_touchpadSendEventsMode != oldValue) {
            Q_EMIT touchpadSendEventsModeChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadSendEventsMode"), value);
        }
    }
    void resetTouchpadSendEventsMode() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadSendEventsMode"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<qlonglong> bindableTouchpadSendEventsMode() {
        return QBindable<qlonglong>(this, "touchpadSendEventsMode");
    }
#endif
    Q_INVOKABLE bool touchpadSendEventsModeIsDefaultValue() const {
        return !m_data->testPropertySet(12);
    }
    bool touchpadTapToClick() const {
        return m_data->p_touchpadTapToClick;
    }
    void setTouchpadTapToClick(const bool &value) {
        auto oldValue = m_data->p_touchpadTapToClick;
        m_data->p_touchpadTapToClick = value;
        m_data->markPropertySet(13);
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config, value]() {
                config->setValue(QStringLiteral("touchpadTapToClick"), value);
            });
        }
        if (m_data->p_touchpadTapToClick != oldValue) {
            Q_EMIT touchpadTapToClickChanged();
            Q_EMIT valueChanged(QStringLiteral("touchpadTapToClick"), value);
        }
    }
    void resetTouchpadTapToClick() {
        if (auto config = m_data->m_config.loadRelaxed()) {
            QMetaObject::invokeMethod(config, [config]() {
                config->reset(QStringLiteral("touchpadTapToClick"));
            });
        }
    }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
    QBindable<bool> bindableTouchpadTapToClick() {
        return QBindable<bool>(this, "touchpadTapToClick");
    }
#endif
    Q_INVOKABLE bool touchpadTapToClickIsDefaultValue() const {
        return !m_data->testPropertySet(13);
    }
protected:
    bool event(QEvent *e) override {
        if (e->type() == QEvent::ThreadChange) {
            Q_ASSERT(this->thread() == m_data->thread());
        }
        return QObject::event(e);
    }
Q_SIGNALS:
    void configInitializeFailed();
    void configInitializeSucceed(DTK_CORE_NAMESPACE::DConfig *config);
    void valueChanged(const QString &key, const QVariant &value);
    void keyboardDelayChanged();
    void keyboardRateChanged();
    void mouseAccelSpeedChanged();
    void mouseAccelerationProfileChanged();
    void mouseNaturalScrollChanged();
    void pointerHandModeChanged();
    void pointerScrollFactorChanged();
    void touchpadAccelSpeedChanged();
    void touchpadAccelerationProfileChanged();
    void touchpadDisableWhileTypingChanged();
    void touchpadHoldTimeoutMsChanged();
    void touchpadNaturalScrollChanged();
    void touchpadSendEventsModeChanged();
    void touchpadTapToClickChanged();

private:
    // Prevent external moveToThread calls
    using QObject::moveToThread;
    class Data : public QObject {
    public:
        enum class Status {
            Invalid = 0,
            Initializing = 1,
            Succeeded = 2,
            Failed = 3,
            Destroyed = 4
        };

        explicit Data()
            : QObject(nullptr) {}

        inline void initializeInConfigThread(DTK_CORE_NAMESPACE::DConfig *config) {
            Q_ASSERT(!m_config.loadRelaxed());
            m_config.storeRelaxed(config);
            if (testPropertySet(0)) {
                config->setValue(QStringLiteral("keyboardDelay"), QVariant::fromValue(p_keyboardDelay));
            } else {
                updateValue(QStringLiteral("keyboardDelay"), QVariant::fromValue(p_keyboardDelay));
            }
            if (testPropertySet(1)) {
                config->setValue(QStringLiteral("keyboardRate"), QVariant::fromValue(p_keyboardRate));
            } else {
                updateValue(QStringLiteral("keyboardRate"), QVariant::fromValue(p_keyboardRate));
            }
            if (testPropertySet(2)) {
                config->setValue(QStringLiteral("mouseAccelSpeed"), QVariant::fromValue(p_mouseAccelSpeed));
            } else {
                updateValue(QStringLiteral("mouseAccelSpeed"), QVariant::fromValue(p_mouseAccelSpeed));
            }
            if (testPropertySet(3)) {
                config->setValue(QStringLiteral("mouseAccelerationProfile"), QVariant::fromValue(p_mouseAccelerationProfile));
            } else {
                updateValue(QStringLiteral("mouseAccelerationProfile"), QVariant::fromValue(p_mouseAccelerationProfile));
            }
            if (testPropertySet(4)) {
                config->setValue(QStringLiteral("mouseNaturalScroll"), QVariant::fromValue(p_mouseNaturalScroll));
            } else {
                updateValue(QStringLiteral("mouseNaturalScroll"), QVariant::fromValue(p_mouseNaturalScroll));
            }
            if (testPropertySet(5)) {
                config->setValue(QStringLiteral("pointerHandMode"), QVariant::fromValue(p_pointerHandMode));
            } else {
                updateValue(QStringLiteral("pointerHandMode"), QVariant::fromValue(p_pointerHandMode));
            }
            if (testPropertySet(6)) {
                config->setValue(QStringLiteral("pointerScrollFactor"), QVariant::fromValue(p_pointerScrollFactor));
            } else {
                updateValue(QStringLiteral("pointerScrollFactor"), QVariant::fromValue(p_pointerScrollFactor));
            }
            if (testPropertySet(7)) {
                config->setValue(QStringLiteral("touchpadAccelSpeed"), QVariant::fromValue(p_touchpadAccelSpeed));
            } else {
                updateValue(QStringLiteral("touchpadAccelSpeed"), QVariant::fromValue(p_touchpadAccelSpeed));
            }
            if (testPropertySet(8)) {
                config->setValue(QStringLiteral("touchpadAccelerationProfile"), QVariant::fromValue(p_touchpadAccelerationProfile));
            } else {
                updateValue(QStringLiteral("touchpadAccelerationProfile"), QVariant::fromValue(p_touchpadAccelerationProfile));
            }
            if (testPropertySet(9)) {
                config->setValue(QStringLiteral("touchpadDisableWhileTyping"), QVariant::fromValue(p_touchpadDisableWhileTyping));
            } else {
                updateValue(QStringLiteral("touchpadDisableWhileTyping"), QVariant::fromValue(p_touchpadDisableWhileTyping));
            }
            if (testPropertySet(10)) {
                config->setValue(QStringLiteral("touchpadHoldTimeoutMs"), QVariant::fromValue(p_touchpadHoldTimeoutMs));
            } else {
                updateValue(QStringLiteral("touchpadHoldTimeoutMs"), QVariant::fromValue(p_touchpadHoldTimeoutMs));
            }
            if (testPropertySet(11)) {
                config->setValue(QStringLiteral("touchpadNaturalScroll"), QVariant::fromValue(p_touchpadNaturalScroll));
            } else {
                updateValue(QStringLiteral("touchpadNaturalScroll"), QVariant::fromValue(p_touchpadNaturalScroll));
            }
            if (testPropertySet(12)) {
                config->setValue(QStringLiteral("touchpadSendEventsMode"), QVariant::fromValue(p_touchpadSendEventsMode));
            } else {
                updateValue(QStringLiteral("touchpadSendEventsMode"), QVariant::fromValue(p_touchpadSendEventsMode));
            }
            if (testPropertySet(13)) {
                config->setValue(QStringLiteral("touchpadTapToClick"), QVariant::fromValue(p_touchpadTapToClick));
            } else {
                updateValue(QStringLiteral("touchpadTapToClick"), QVariant::fromValue(p_touchpadTapToClick));
            }
            connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) {
                updateValue(key);
            }, Qt::DirectConnection);
        }

        inline void updateValue(const QString &key, const QVariant &fallback = QVariant()) {
            if (!m_config.loadRelaxed())
                return;
            Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread());
            const QVariant &value = m_config.loadRelaxed()->value(key, fallback);
            if (key == QStringLiteral("keyboardDelay")) {
                markPropertySet(0, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<qlonglong>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_keyboardDelay != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_keyboardDelay = newValue;
                        Q_EMIT m_userConfig->keyboardDelayChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("keyboardRate")) {
                markPropertySet(1, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<qlonglong>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_keyboardRate != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_keyboardRate = newValue;
                        Q_EMIT m_userConfig->keyboardRateChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("mouseAccelSpeed")) {
                markPropertySet(2, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<double>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_mouseAccelSpeed != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_mouseAccelSpeed = newValue;
                        Q_EMIT m_userConfig->mouseAccelSpeedChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("mouseAccelerationProfile")) {
                markPropertySet(3, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<qlonglong>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_mouseAccelerationProfile != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_mouseAccelerationProfile = newValue;
                        Q_EMIT m_userConfig->mouseAccelerationProfileChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("mouseNaturalScroll")) {
                markPropertySet(4, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<bool>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_mouseNaturalScroll != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_mouseNaturalScroll = newValue;
                        Q_EMIT m_userConfig->mouseNaturalScrollChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("pointerHandMode")) {
                markPropertySet(5, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<QString>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_pointerHandMode != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_pointerHandMode = newValue;
                        Q_EMIT m_userConfig->pointerHandModeChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("pointerScrollFactor")) {
                markPropertySet(6, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<double>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_pointerScrollFactor != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_pointerScrollFactor = newValue;
                        Q_EMIT m_userConfig->pointerScrollFactorChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadAccelSpeed")) {
                markPropertySet(7, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<double>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadAccelSpeed != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadAccelSpeed = newValue;
                        Q_EMIT m_userConfig->touchpadAccelSpeedChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadAccelerationProfile")) {
                markPropertySet(8, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<qlonglong>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadAccelerationProfile != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadAccelerationProfile = newValue;
                        Q_EMIT m_userConfig->touchpadAccelerationProfileChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadDisableWhileTyping")) {
                markPropertySet(9, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<bool>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadDisableWhileTyping != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadDisableWhileTyping = newValue;
                        Q_EMIT m_userConfig->touchpadDisableWhileTypingChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadHoldTimeoutMs")) {
                markPropertySet(10, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<qlonglong>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadHoldTimeoutMs != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadHoldTimeoutMs = newValue;
                        Q_EMIT m_userConfig->touchpadHoldTimeoutMsChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadNaturalScroll")) {
                markPropertySet(11, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<bool>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadNaturalScroll != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadNaturalScroll = newValue;
                        Q_EMIT m_userConfig->touchpadNaturalScrollChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadSendEventsMode")) {
                markPropertySet(12, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<qlonglong>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadSendEventsMode != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadSendEventsMode = newValue;
                        Q_EMIT m_userConfig->touchpadSendEventsModeChanged();
                        Q_EMIT m_userConfig->valueChanged(key, value);
                    }
                });
                return;
            }
            if (key == QStringLiteral("touchpadTapToClick")) {
                markPropertySet(13, !m_config.loadRelaxed()->isDefaultValue(key));
                auto newValue = qvariant_cast<bool>(value);
                QMetaObject::invokeMethod(this, [this, newValue, key, value]() {
                    if (m_userConfig && p_touchpadTapToClick != newValue) {
                        Q_ASSERT(QThread::currentThread() == m_userConfig->thread());
                        p_touchpadTapToClick = newValue;
                        Q_EMIT m_userConfig->touchpadTapToClickChanged();
                        Q_EMIT m_userConfig->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();
        }
        // Member variables
        QAtomicPointer<DTK_CORE_NAMESPACE::DConfig> m_config = nullptr;
        QAtomicInteger<int> m_status = static_cast<int>(Status::Invalid);
        QPointer<SeatUserDConfig> m_userConfig = nullptr;
        QAtomicInteger<quint32> m_propertySetStatus0 = 0;

        // Property storage
        qlonglong p_keyboardDelay { 250 };
        qlonglong p_keyboardRate { 20 };
        double p_mouseAccelSpeed { 0.333333 };
        qlonglong p_mouseAccelerationProfile { 2 };
        bool p_mouseNaturalScroll { false };
        // Default value: "Right"
        QString p_pointerHandMode { QStringLiteral(u"\u0052\u0069\u0067\u0068\u0074") };
        double p_pointerScrollFactor { 1 };
        double p_touchpadAccelSpeed { 0.333333 };
        qlonglong p_touchpadAccelerationProfile { 1 };
        bool p_touchpadDisableWhileTyping { true };
        qlonglong p_touchpadHoldTimeoutMs { 0 };
        bool p_touchpadNaturalScroll { true };
        qlonglong p_touchpadSendEventsMode { 0 };
        bool p_touchpadTapToClick { true };
    };

    QPointer<Data> m_data;
};

#endif // SEATUSERDCONFIG_H
