From: Boyuan Yang Date: Sun, 16 Mar 2025 19:38:09 +0000 (-0400) Subject: New upstream version 5.7.12 X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~3^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=baac9d637ee9c368ae242ceb4481a70ec7389ef7;p=dtkcore.git New upstream version 5.7.12 --- diff --git a/.reuse/dep5 b/.reuse/dep5 index d10a694..405ac49 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -83,3 +83,8 @@ License: MIT Files: docs/references/* Copyright: UnionTech Software Technology Co., Ltd. License: CC-BY-4.0 + + +Files: toolGenerate/**/* +Copyright: None +License: CC0-1.0 diff --git a/cmake/DtkTools/DtkDConfigMacros.cmake b/cmake/DtkTools/DtkDConfigMacros.cmake index f6a385c..93a2b92 100644 --- a/cmake/DtkTools/DtkDConfigMacros.cmake +++ b/cmake/DtkTools/DtkDConfigMacros.cmake @@ -13,7 +13,7 @@ function(dtk_add_config_to_cpp OUTPUT_VAR JSON_FILE) cmake_parse_arguments( "arg" "" - "OUTPUT_FILE_NAME;CLASS_NAME;USE_QPROPERTY" + "OUTPUT_FILE_NAME;CLASS_NAME" "" ${ARGN} ) @@ -33,22 +33,10 @@ function(dtk_add_config_to_cpp OUTPUT_VAR JSON_FILE) set(CLASS_NAME_ARG "") endif() - if(NOT DEFINED arg_USE_QPROPERTY) - if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) - set(arg_USE_QPROPERTY ON) - endif() - endif() - - if (arg_USE_QPROPERTY) - set(USE_QPROPERTY_ARG "--use-qproperty") - else() - set(USE_QPROPERTY_ARG "") - endif() - # Add a custom command to run dconfig2cpp add_custom_command( OUTPUT ${OUTPUT_HEADER} - COMMAND ${DTK_DCONFIG2CPP} -o ${OUTPUT_HEADER} ${CLASS_NAME_ARG} ${USE_QPROPERTY_ARG} ${JSON_FILE} + COMMAND ${DTK_DCONFIG2CPP} -o ${OUTPUT_HEADER} ${CLASS_NAME_ARG} ${JSON_FILE} DEPENDS ${JSON_FILE} ${DTK_XML2CPP} COMMENT "Generating ${OUTPUT_HEADER} from ${JSON_FILE}" VERBATIM diff --git a/debian/changelog b/debian/changelog index 29ada81..a611f01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +dtkcore (5.7.12) unstable; urgency=medium + + * feat: dconfig2cpp always add bindableFoo functions on Qt6 + * feat: Add files generated by qdbusXML2cpp and DCONG2cpp + + -- YeShanShan Thu, 06 Mar 2025 17:29:21 +0800 + dtkcore (5.7.11) unstable; urgency=medium * feat: dconfig2cpp generated codes supports qml diff --git a/src/log/dconfig_org_deepin_dtk_preference.hpp b/src/log/dconfig_org_deepin_dtk_preference.hpp index a300e9f..74e181e 100644 --- a/src/log/dconfig_org_deepin_dtk_preference.hpp +++ b/src/log/dconfig_org_deepin_dtk_preference.hpp @@ -1,7 +1,7 @@ /** * This file is generated by dconfig2cpp. * Command line arguments: /home/zccrs/projects/dtkcore/build/unknown-Debug/tools/dconfig2cpp/dconfig2cpp /home/zccrs/projects/dtkcommon/configs/org.deepin.dtk.preference.json - * Generation time: 2025-02-21T13:49:21 + * Generation time: 2025-03-06T10:40:41 * JSON file version: 1.0 * * WARNING: DO NOT MODIFY THIS FILE MANUALLY. @@ -16,6 +16,9 @@ #include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include +#endif #include class dconfig_org_deepin_dtk_preference : public QObject { @@ -97,29 +100,29 @@ public: } Q_INVOKABLE QStringList keyList() const { - return { QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065"), - QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064"), - QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064"), - QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073"), - QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), - QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), - QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074")}; + return { QStringLiteral("autoDisplayFeature"), + QStringLiteral("featureUpdated"), + QStringLiteral("keyboardsearchDisabled"), + QStringLiteral("rules"), + QStringLiteral("themeType"), + QStringLiteral("titlebarHeight"), + QStringLiteral("underlineShortcut")}; } Q_INVOKABLE bool isDefaultValue(const QString &key) const { - if (key == QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065")) + if (key == QStringLiteral("autoDisplayFeature")) return autoDisplayFeatureIsDefaultValue(); - if (key == QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064")) + if (key == QStringLiteral("featureUpdated")) return featureUpdatedIsDefaultValue(); - if (key == QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064")) + if (key == QStringLiteral("keyboardsearchDisabled")) return keyboardsearchDisabledIsDefaultValue(); - if (key == QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073")) + if (key == QStringLiteral("rules")) return rulesIsDefaultValue(); - if (key == QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065")) + if (key == QStringLiteral("themeType")) return themeTypeIsDefaultValue(); - if (key == QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074")) + if (key == QStringLiteral("titlebarHeight")) return titlebarHeightIsDefaultValue(); - if (key == QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074")) + if (key == QStringLiteral("underlineShortcut")) return underlineShortcutIsDefaultValue(); return false; } @@ -133,21 +136,26 @@ public: markPropertySet(0); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("autoDisplayFeature"), value); }); } if (p_autoDisplayFeature != oldValue) { Q_EMIT autoDisplayFeatureChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065"), value); + Q_EMIT valueChanged(QStringLiteral("autoDisplayFeature"), value); } } void resetAutoDisplayFeature() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065")); + m_config.loadRelaxed()->reset(QStringLiteral("autoDisplayFeature")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableAutoDisplayFeature() { + return QBindable(this, QStringLiteral("autoDisplayFeature")); + } +#endif Q_INVOKABLE bool autoDisplayFeatureIsDefaultValue() const { return !testPropertySet(0); } @@ -160,21 +168,26 @@ public: markPropertySet(1); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("featureUpdated"), value); }); } if (p_featureUpdated != oldValue) { Q_EMIT featureUpdatedChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064"), value); + Q_EMIT valueChanged(QStringLiteral("featureUpdated"), value); } } void resetFeatureUpdated() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064")); + m_config.loadRelaxed()->reset(QStringLiteral("featureUpdated")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableFeatureUpdated() { + return QBindable(this, QStringLiteral("featureUpdated")); + } +#endif Q_INVOKABLE bool featureUpdatedIsDefaultValue() const { return !testPropertySet(1); } @@ -187,21 +200,26 @@ public: markPropertySet(2); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("keyboardsearchDisabled"), value); }); } if (p_keyboardsearchDisabled != oldValue) { Q_EMIT keyboardsearchDisabledChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064"), value); + Q_EMIT valueChanged(QStringLiteral("keyboardsearchDisabled"), value); } } void resetKeyboardsearchDisabled() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064")); + m_config.loadRelaxed()->reset(QStringLiteral("keyboardsearchDisabled")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableKeyboardsearchDisabled() { + return QBindable(this, QStringLiteral("keyboardsearchDisabled")); + } +#endif Q_INVOKABLE bool keyboardsearchDisabledIsDefaultValue() const { return !testPropertySet(2); } @@ -214,21 +232,26 @@ public: markPropertySet(3); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("rules"), value); }); } if (p_rules != oldValue) { Q_EMIT rulesChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073"), value); + Q_EMIT valueChanged(QStringLiteral("rules"), value); } } void resetRules() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073")); + m_config.loadRelaxed()->reset(QStringLiteral("rules")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableRules() { + return QBindable(this, QStringLiteral("rules")); + } +#endif Q_INVOKABLE bool rulesIsDefaultValue() const { return !testPropertySet(3); } @@ -241,21 +264,26 @@ public: markPropertySet(4); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("themeType"), value); }); } if (p_themeType != oldValue) { Q_EMIT themeTypeChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), value); + Q_EMIT valueChanged(QStringLiteral("themeType"), value); } } void resetThemeType() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065")); + m_config.loadRelaxed()->reset(QStringLiteral("themeType")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableThemeType() { + return QBindable(this, QStringLiteral("themeType")); + } +#endif Q_INVOKABLE bool themeTypeIsDefaultValue() const { return !testPropertySet(4); } @@ -268,21 +296,26 @@ public: markPropertySet(5); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("titlebarHeight"), value); }); } if (p_titlebarHeight != oldValue) { Q_EMIT titlebarHeightChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), value); + Q_EMIT valueChanged(QStringLiteral("titlebarHeight"), value); } } void resetTitlebarHeight() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074")); + m_config.loadRelaxed()->reset(QStringLiteral("titlebarHeight")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableTitlebarHeight() { + return QBindable(this, QStringLiteral("titlebarHeight")); + } +#endif Q_INVOKABLE bool titlebarHeightIsDefaultValue() const { return !testPropertySet(5); } @@ -295,21 +328,26 @@ public: markPropertySet(6); if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this, value]() { - m_config.loadRelaxed()->setValue(QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074"), value); + m_config.loadRelaxed()->setValue(QStringLiteral("underlineShortcut"), value); }); } if (p_underlineShortcut != oldValue) { Q_EMIT underlineShortcutChanged(); - Q_EMIT valueChanged(QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074"), value); + Q_EMIT valueChanged(QStringLiteral("underlineShortcut"), value); } } void resetUnderlineShortcut() { if (auto config = m_config.loadRelaxed()) { QMetaObject::invokeMethod(config, [this]() { - m_config.loadRelaxed()->reset(QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074")); + m_config.loadRelaxed()->reset(QStringLiteral("underlineShortcut")); }); } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QBindable bindableUnderlineShortcut() { + return QBindable(this, QStringLiteral("underlineShortcut")); + } +#endif Q_INVOKABLE bool underlineShortcutIsDefaultValue() const { return !testPropertySet(6); } @@ -336,39 +374,39 @@ private: } if (testPropertySet(0)) { - config->setValue(QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065"), QVariant::fromValue(p_autoDisplayFeature)); + config->setValue(QStringLiteral("autoDisplayFeature"), QVariant::fromValue(p_autoDisplayFeature)); } else { - updateValue(QStringLiteral(u"\u0061\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065"), QVariant::fromValue(p_autoDisplayFeature)); + updateValue(QStringLiteral("autoDisplayFeature"), QVariant::fromValue(p_autoDisplayFeature)); } if (testPropertySet(1)) { - config->setValue(QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064"), QVariant::fromValue(p_featureUpdated)); + config->setValue(QStringLiteral("featureUpdated"), QVariant::fromValue(p_featureUpdated)); } else { - updateValue(QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064"), QVariant::fromValue(p_featureUpdated)); + updateValue(QStringLiteral("featureUpdated"), QVariant::fromValue(p_featureUpdated)); } if (testPropertySet(2)) { - config->setValue(QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064"), QVariant::fromValue(p_keyboardsearchDisabled)); + config->setValue(QStringLiteral("keyboardsearchDisabled"), QVariant::fromValue(p_keyboardsearchDisabled)); } else { - updateValue(QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064"), QVariant::fromValue(p_keyboardsearchDisabled)); + updateValue(QStringLiteral("keyboardsearchDisabled"), QVariant::fromValue(p_keyboardsearchDisabled)); } if (testPropertySet(3)) { - config->setValue(QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073"), QVariant::fromValue(p_rules)); + config->setValue(QStringLiteral("rules"), QVariant::fromValue(p_rules)); } else { - updateValue(QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073"), QVariant::fromValue(p_rules)); + updateValue(QStringLiteral("rules"), QVariant::fromValue(p_rules)); } if (testPropertySet(4)) { - config->setValue(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), QVariant::fromValue(p_themeType)); + config->setValue(QStringLiteral("themeType"), QVariant::fromValue(p_themeType)); } else { - updateValue(QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065"), QVariant::fromValue(p_themeType)); + updateValue(QStringLiteral("themeType"), QVariant::fromValue(p_themeType)); } if (testPropertySet(5)) { - config->setValue(QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), QVariant::fromValue(p_titlebarHeight)); + config->setValue(QStringLiteral("titlebarHeight"), QVariant::fromValue(p_titlebarHeight)); } else { - updateValue(QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074"), QVariant::fromValue(p_titlebarHeight)); + updateValue(QStringLiteral("titlebarHeight"), QVariant::fromValue(p_titlebarHeight)); } if (testPropertySet(6)) { - config->setValue(QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074"), QVariant::fromValue(p_underlineShortcut)); + config->setValue(QStringLiteral("underlineShortcut"), QVariant::fromValue(p_underlineShortcut)); } else { - updateValue(QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074"), QVariant::fromValue(p_underlineShortcut)); + updateValue(QStringLiteral("underlineShortcut"), QVariant::fromValue(p_underlineShortcut)); } connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) { @@ -381,7 +419,7 @@ private: 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\u0075\u0074\u006f\u0044\u0069\u0073\u0070\u006c\u0061\u0079\u0046\u0065\u0061\u0074\u0075\u0072\u0065")) { + if (key == QStringLiteral("autoDisplayFeature")) { markPropertySet(0, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { @@ -394,7 +432,7 @@ private: }); return; } - if (key == QStringLiteral(u"\u0066\u0065\u0061\u0074\u0075\u0072\u0065\u0055\u0070\u0064\u0061\u0074\u0065\u0064")) { + if (key == QStringLiteral("featureUpdated")) { markPropertySet(1, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { @@ -407,7 +445,7 @@ private: }); return; } - if (key == QStringLiteral(u"\u006b\u0065\u0079\u0062\u006f\u0061\u0072\u0064\u0073\u0065\u0061\u0072\u0063\u0068\u0044\u0069\u0073\u0061\u0062\u006c\u0065\u0064")) { + if (key == QStringLiteral("keyboardsearchDisabled")) { markPropertySet(2, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { @@ -420,7 +458,7 @@ private: }); return; } - if (key == QStringLiteral(u"\u0072\u0075\u006c\u0065\u0073")) { + if (key == QStringLiteral("rules")) { markPropertySet(3, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { @@ -433,7 +471,7 @@ private: }); return; } - if (key == QStringLiteral(u"\u0074\u0068\u0065\u006d\u0065\u0054\u0079\u0070\u0065")) { + if (key == QStringLiteral("themeType")) { markPropertySet(4, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { @@ -446,7 +484,7 @@ private: }); return; } - if (key == QStringLiteral(u"\u0074\u0069\u0074\u006c\u0065\u0062\u0061\u0072\u0048\u0065\u0069\u0067\u0068\u0074")) { + if (key == QStringLiteral("titlebarHeight")) { markPropertySet(5, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { @@ -459,7 +497,7 @@ private: }); return; } - if (key == QStringLiteral(u"\u0075\u006e\u0064\u0065\u0072\u006c\u0069\u006e\u0065\u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074")) { + if (key == QStringLiteral("underlineShortcut")) { markPropertySet(6, !m_config.loadRelaxed()->isDefaultValue(key)); auto newValue = qvariant_cast(value); QMetaObject::invokeMethod(this, [this, newValue, key, value]() { diff --git a/toolGenerate/dconfig2cpp/dconf-example_meta.hpp b/toolGenerate/dconfig2cpp/dconf-example_meta.hpp new file mode 100644 index 0000000..3ceef68 --- /dev/null +++ b/toolGenerate/dconfig2cpp/dconf-example_meta.hpp @@ -0,0 +1,554 @@ +/** + * This file is generated by dconfig2cpp. + * Command line arguments: ./dconfig2cpp -p ./dtkcore/toolGenerate/dconfig2cpp ./dtkcore/tests/data/dconf-example.meta.json + * Generation time: 2025-01-14T10:54:59 + * JSON file version: 1.0 + * + * WARNING: DO NOT MODIFY THIS FILE MANUALLY. + * If you need to change the content, please modify the dconfig2cpp tool. + */ + +#ifndef DCONF-EXAMPLE_META_H +#define DCONF-EXAMPLE_META_H + +#include +#include +#include +#include +#include +#include + +class dconf-example_meta : public QObject { + Q_OBJECT + + Q_PROPERTY(QList array READ array WRITE setArray NOTIFY arrayChanged) + Q_PROPERTY(QList array_map READ array_map WRITE setArray_map NOTIFY array_mapChanged) + Q_PROPERTY(QList array_map_struct READ array_map_struct WRITE setArray_map_struct NOTIFY array_map_structChanged) + Q_PROPERTY(bool canExit READ canExit WRITE setCanExit NOTIFY canExitChanged) + Q_PROPERTY(QString key2 READ key2 WRITE setKey2 NOTIFY key2Changed) + Q_PROPERTY(QString key3 READ key3 WRITE setKey3 NOTIFY key3Changed) + Q_PROPERTY(QVariantMap map READ map WRITE setMap NOTIFY mapChanged) + Q_PROPERTY(QVariantMap map_array READ map_array WRITE setMap_array NOTIFY map_arrayChanged) + Q_PROPERTY(double number READ number WRITE setNumber NOTIFY numberChanged) + Q_PROPERTY(double numberDouble READ numberDouble WRITE setNumberDouble NOTIFY numberDoubleChanged) + Q_PROPERTY(bool publicConfig READ publicConfig WRITE setPublicConfig NOTIFY publicConfigChanged) + Q_PROPERTY(QVariantMap struct READ struct WRITE setStruct NOTIFY structChanged) +public: + explicit dconf-example_meta(QThread *thread, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-example_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-example_meta(QThread *thread, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-example_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + ~dconf-example_meta() { + if (m_config.loadRelaxed()) { + m_config.loadRelaxed()->deleteLater(); + } + } + + QList array() const { + return p_array; + } + void setArray(const QList &value) { + auto oldValue = p_array; + p_array = value; + markPropertySet(0); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("array"), value); + }); + } + if (p_array != oldValue) { + Q_EMIT arrayChanged(); + } + } + QList array_map() const { + return p_array_map; + } + void setArray_map(const QList &value) { + auto oldValue = p_array_map; + p_array_map = value; + markPropertySet(1); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("array_map"), value); + }); + } + if (p_array_map != oldValue) { + Q_EMIT array_mapChanged(); + } + } + QList array_map_struct() const { + return p_array_map_struct; + } + void setArray_map_struct(const QList &value) { + auto oldValue = p_array_map_struct; + p_array_map_struct = value; + markPropertySet(2); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("array_map_struct"), value); + }); + } + if (p_array_map_struct != oldValue) { + Q_EMIT array_map_structChanged(); + } + } + bool canExit() const { + return p_canExit; + } + void setCanExit(const bool &value) { + auto oldValue = p_canExit; + p_canExit = value; + markPropertySet(3); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("canExit"), value); + }); + } + if (p_canExit != oldValue) { + Q_EMIT canExitChanged(); + } + } + QString key2() const { + return p_key2; + } + void setKey2(const QString &value) { + auto oldValue = p_key2; + p_key2 = value; + markPropertySet(4); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("key2"), value); + }); + } + if (p_key2 != oldValue) { + Q_EMIT key2Changed(); + } + } + QString key3() const { + return p_key3; + } + void setKey3(const QString &value) { + auto oldValue = p_key3; + p_key3 = value; + markPropertySet(5); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("key3"), value); + }); + } + if (p_key3 != oldValue) { + Q_EMIT key3Changed(); + } + } + QVariantMap map() const { + return p_map; + } + void setMap(const QVariantMap &value) { + auto oldValue = p_map; + p_map = value; + markPropertySet(6); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("map"), value); + }); + } + if (p_map != oldValue) { + Q_EMIT mapChanged(); + } + } + QVariantMap map_array() const { + return p_map_array; + } + void setMap_array(const QVariantMap &value) { + auto oldValue = p_map_array; + p_map_array = value; + markPropertySet(7); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("map_array"), value); + }); + } + if (p_map_array != oldValue) { + Q_EMIT map_arrayChanged(); + } + } + double number() const { + return p_number; + } + void setNumber(const double &value) { + auto oldValue = p_number; + p_number = value; + markPropertySet(8); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("number"), value); + }); + } + if (p_number != oldValue) { + Q_EMIT numberChanged(); + } + } + double numberDouble() const { + return p_numberDouble; + } + void setNumberDouble(const double &value) { + auto oldValue = p_numberDouble; + p_numberDouble = value; + markPropertySet(9); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("numberDouble"), value); + }); + } + if (p_numberDouble != oldValue) { + Q_EMIT numberDoubleChanged(); + } + } + bool publicConfig() const { + return p_publicConfig; + } + void setPublicConfig(const bool &value) { + auto oldValue = p_publicConfig; + p_publicConfig = value; + markPropertySet(10); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("publicConfig"), value); + }); + } + if (p_publicConfig != oldValue) { + Q_EMIT publicConfigChanged(); + } + } + QVariantMap struct() const { + return p_struct; + } + void setStruct(const QVariantMap &value) { + auto oldValue = p_struct; + p_struct = value; + markPropertySet(11); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("struct"), value); + }); + } + if (p_struct != oldValue) { + Q_EMIT structChanged(); + } + } +Q_SIGNALS: + void arrayChanged(); + void array_mapChanged(); + void array_map_structChanged(); + void canExitChanged(); + void key2Changed(); + void key3Changed(); + void mapChanged(); + void map_arrayChanged(); + void numberChanged(); + void numberDoubleChanged(); + void publicConfigChanged(); + void structChanged(); +private: + void initialize(DTK_CORE_NAMESPACE::DConfig *config) { + Q_ASSERT(!m_config.loadRelaxed()); + m_config.storeRelaxed(config); + if (testPropertySet(0)) { + config->setValue(QStringLiteral("array"), QVariant::fromValue(p_array)); + } else { + updateValue(QStringLiteral("array"), QVariant::fromValue(p_array)); + } + if (testPropertySet(1)) { + config->setValue(QStringLiteral("array_map"), QVariant::fromValue(p_array_map)); + } else { + updateValue(QStringLiteral("array_map"), QVariant::fromValue(p_array_map)); + } + if (testPropertySet(2)) { + config->setValue(QStringLiteral("array_map_struct"), QVariant::fromValue(p_array_map_struct)); + } else { + updateValue(QStringLiteral("array_map_struct"), QVariant::fromValue(p_array_map_struct)); + } + if (testPropertySet(3)) { + config->setValue(QStringLiteral("canExit"), QVariant::fromValue(p_canExit)); + } else { + updateValue(QStringLiteral("canExit"), QVariant::fromValue(p_canExit)); + } + if (testPropertySet(4)) { + config->setValue(QStringLiteral("key2"), QVariant::fromValue(p_key2)); + } else { + updateValue(QStringLiteral("key2"), QVariant::fromValue(p_key2)); + } + if (testPropertySet(5)) { + config->setValue(QStringLiteral("key3"), QVariant::fromValue(p_key3)); + } else { + updateValue(QStringLiteral("key3"), QVariant::fromValue(p_key3)); + } + if (testPropertySet(6)) { + config->setValue(QStringLiteral("map"), QVariant::fromValue(p_map)); + } else { + updateValue(QStringLiteral("map"), QVariant::fromValue(p_map)); + } + if (testPropertySet(7)) { + config->setValue(QStringLiteral("map_array"), QVariant::fromValue(p_map_array)); + } else { + updateValue(QStringLiteral("map_array"), QVariant::fromValue(p_map_array)); + } + if (testPropertySet(8)) { + config->setValue(QStringLiteral("number"), QVariant::fromValue(p_number)); + } else { + updateValue(QStringLiteral("number"), QVariant::fromValue(p_number)); + } + if (testPropertySet(9)) { + config->setValue(QStringLiteral("numberDouble"), QVariant::fromValue(p_numberDouble)); + } else { + updateValue(QStringLiteral("numberDouble"), QVariant::fromValue(p_numberDouble)); + } + if (testPropertySet(10)) { + config->setValue(QStringLiteral("publicConfig"), QVariant::fromValue(p_publicConfig)); + } else { + updateValue(QStringLiteral("publicConfig"), QVariant::fromValue(p_publicConfig)); + } + if (testPropertySet(11)) { + config->setValue(QStringLiteral("struct"), QVariant::fromValue(p_struct)); + } else { + updateValue(QStringLiteral("struct"), QVariant::fromValue(p_struct)); + } + + connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) { + updateValue(key); + }, Qt::DirectConnection); + } + void updateValue(const QString &key, const QVariant &fallback = QVariant()) { + Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread()); + const QVariant &value = m_config.loadRelaxed()->value(key, fallback); + if (key == QStringLiteral("array")) { + auto newValue = qvariant_cast>(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_array != newValue) { + p_array = newValue; + Q_EMIT arrayChanged(); + } + }); + return; + } + if (key == QStringLiteral("array_map")) { + auto newValue = qvariant_cast>(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_array_map != newValue) { + p_array_map = newValue; + Q_EMIT array_mapChanged(); + } + }); + return; + } + if (key == QStringLiteral("array_map_struct")) { + auto newValue = qvariant_cast>(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_array_map_struct != newValue) { + p_array_map_struct = newValue; + Q_EMIT array_map_structChanged(); + } + }); + return; + } + if (key == QStringLiteral("canExit")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_canExit != newValue) { + p_canExit = newValue; + Q_EMIT canExitChanged(); + } + }); + return; + } + if (key == QStringLiteral("key2")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_key2 != newValue) { + p_key2 = newValue; + Q_EMIT key2Changed(); + } + }); + return; + } + if (key == QStringLiteral("key3")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_key3 != newValue) { + p_key3 = newValue; + Q_EMIT key3Changed(); + } + }); + return; + } + if (key == QStringLiteral("map")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_map != newValue) { + p_map = newValue; + Q_EMIT mapChanged(); + } + }); + return; + } + if (key == QStringLiteral("map_array")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_map_array != newValue) { + p_map_array = newValue; + Q_EMIT map_arrayChanged(); + } + }); + return; + } + if (key == QStringLiteral("number")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_number != newValue) { + p_number = newValue; + Q_EMIT numberChanged(); + } + }); + return; + } + if (key == QStringLiteral("numberDouble")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_numberDouble != newValue) { + p_numberDouble = newValue; + Q_EMIT numberDoubleChanged(); + } + }); + return; + } + if (key == QStringLiteral("publicConfig")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_publicConfig != newValue) { + p_publicConfig = newValue; + Q_EMIT publicConfigChanged(); + } + }); + return; + } + if (key == QStringLiteral("struct")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_struct != newValue) { + p_struct = newValue; + Q_EMIT structChanged(); + } + }); + return; + } + } + inline void markPropertySet(const int index) { + if (index < 32) { + m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0)); + return; + } + Q_UNREACHABLE(); + } + inline bool testPropertySet(const int index) const { + if (index < 32) { + return (m_propertySetStatus0.loadRelaxed() & (1 << (index - 0))); + } + Q_UNREACHABLE(); + } + QAtomicPointer m_config = nullptr; + QList p_array { QList{QVariant(QStringLiteral("value1")), QVariant(QStringLiteral("value2"))} }; + QList p_array_map { QList{QVariant(QVariantMap{{QStringLiteral("key1"), QVariant(QStringLiteral("value1"))}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}})} }; + QList p_array_map_struct { QList{QVariant(QVariantMap{{QStringLiteral("key1"), QVariant(QVariantMap{{QStringLiteral("field1"), QVariant(QStringLiteral("value1"))}})}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}})} }; + bool p_canExit { true }; + QString p_key2 { QStringLiteral("125") }; + QString p_key3 { QStringLiteral("application") }; + QVariantMap p_map { QVariantMap{{QStringLiteral("key1"), QVariant(QStringLiteral("value1"))}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}} }; + QVariantMap p_map_array { QVariantMap{{QStringLiteral("key1"), QVariant(QList{QVariant(QStringLiteral("value1"))})}, {QStringLiteral("key2"), QVariant(QList{QVariant(QStringLiteral("value2"))})}} }; + double p_number { 1 }; + double p_numberDouble { 1 }; + bool p_publicConfig { true }; + QVariantMap p_struct { QVariantMap{{QStringLiteral("key1"), QVariant(QStringLiteral("value1"))}, {QStringLiteral("key2"), QVariant(QStringLiteral("value2"))}} }; + QAtomicInteger m_propertySetStatus0 = 0; +}; + +#endif // DCONF-EXAMPLE_META_H diff --git a/toolGenerate/dconfig2cpp/dconf-example_other_app_configure_meta.hpp b/toolGenerate/dconfig2cpp/dconf-example_other_app_configure_meta.hpp new file mode 100644 index 0000000..1f9a54e --- /dev/null +++ b/toolGenerate/dconfig2cpp/dconf-example_other_app_configure_meta.hpp @@ -0,0 +1,214 @@ +/** + * This file is generated by dconfig2cpp. + * Command line arguments: ./dconfig2cpp -p ./dtkcore/toolGenerate/dconfig2cpp ./dtkcore/tests/data/dconf-example_other_app_configure.meta.json + * Generation time: 2025-01-14T10:54:59 + * JSON file version: 1.0 + * + * WARNING: DO NOT MODIFY THIS FILE MANUALLY. + * If you need to change the content, please modify the dconfig2cpp tool. + */ + +#ifndef DCONF-EXAMPLE_OTHER_APP_CONFIGURE_META_H +#define DCONF-EXAMPLE_OTHER_APP_CONFIGURE_META_H + +#include +#include +#include +#include +#include +#include + +class dconf-example_other_app_configure_meta : public QObject { + Q_OBJECT + + Q_PROPERTY(QString appPrivate READ appPrivate WRITE setAppPrivate NOTIFY appPrivateChanged) + Q_PROPERTY(QString appPublic READ appPublic WRITE setAppPublic NOTIFY appPublicChanged) +public: + explicit dconf-example_other_app_configure_meta(QThread *thread, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-example_other_app_configure_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-example_other_app_configure_meta(QThread *thread, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-example_other_app_configure_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + ~dconf-example_other_app_configure_meta() { + if (m_config.loadRelaxed()) { + m_config.loadRelaxed()->deleteLater(); + } + } + + QString appPrivate() const { + return p_appPrivate; + } + void setAppPrivate(const QString &value) { + auto oldValue = p_appPrivate; + p_appPrivate = value; + markPropertySet(0); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("appPrivate"), value); + }); + } + if (p_appPrivate != oldValue) { + Q_EMIT appPrivateChanged(); + } + } + QString appPublic() const { + return p_appPublic; + } + void setAppPublic(const QString &value) { + auto oldValue = p_appPublic; + p_appPublic = value; + markPropertySet(1); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("appPublic"), value); + }); + } + if (p_appPublic != oldValue) { + Q_EMIT appPublicChanged(); + } + } +Q_SIGNALS: + void appPrivateChanged(); + void appPublicChanged(); +private: + void initialize(DTK_CORE_NAMESPACE::DConfig *config) { + Q_ASSERT(!m_config.loadRelaxed()); + m_config.storeRelaxed(config); + if (testPropertySet(0)) { + config->setValue(QStringLiteral("appPrivate"), QVariant::fromValue(p_appPrivate)); + } else { + updateValue(QStringLiteral("appPrivate"), QVariant::fromValue(p_appPrivate)); + } + if (testPropertySet(1)) { + config->setValue(QStringLiteral("appPublic"), QVariant::fromValue(p_appPublic)); + } else { + updateValue(QStringLiteral("appPublic"), QVariant::fromValue(p_appPublic)); + } + + connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) { + updateValue(key); + }, Qt::DirectConnection); + } + void updateValue(const QString &key, const QVariant &fallback = QVariant()) { + Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread()); + const QVariant &value = m_config.loadRelaxed()->value(key, fallback); + if (key == QStringLiteral("appPrivate")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_appPrivate != newValue) { + p_appPrivate = newValue; + Q_EMIT appPrivateChanged(); + } + }); + return; + } + if (key == QStringLiteral("appPublic")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_appPublic != newValue) { + p_appPublic = newValue; + Q_EMIT appPublicChanged(); + } + }); + return; + } + } + inline void markPropertySet(const int index) { + if (index < 32) { + m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0)); + return; + } + Q_UNREACHABLE(); + } + inline bool testPropertySet(const int index) const { + if (index < 32) { + return (m_propertySetStatus0.loadRelaxed() & (1 << (index - 0))); + } + Q_UNREACHABLE(); + } + QAtomicPointer m_config = nullptr; + QString p_appPrivate { QStringLiteral("appPrivate") }; + QString p_appPublic { QStringLiteral("publicValue") }; + QAtomicInteger m_propertySetStatus0 = 0; +}; + +#endif // DCONF-EXAMPLE_OTHER_APP_CONFIGURE_META_H diff --git a/toolGenerate/dconfig2cpp/dconf-global_meta.hpp b/toolGenerate/dconfig2cpp/dconf-global_meta.hpp new file mode 100644 index 0000000..50071ad --- /dev/null +++ b/toolGenerate/dconfig2cpp/dconf-global_meta.hpp @@ -0,0 +1,180 @@ +/** + * This file is generated by dconfig2cpp. + * Command line arguments: ./dconfig2cpp -p ./dtkcore/toolGenerate/dconfig2cpp ./dtkcore/tests/data/dconf-global.meta.json + * Generation time: 2025-01-14T10:54:59 + * JSON file version: 1.0 + * + * WARNING: DO NOT MODIFY THIS FILE MANUALLY. + * If you need to change the content, please modify the dconfig2cpp tool. + */ + +#ifndef DCONF-GLOBAL_META_H +#define DCONF-GLOBAL_META_H + +#include +#include +#include +#include +#include +#include + +class dconf-global_meta : public QObject { + Q_OBJECT + + Q_PROPERTY(QString key3 READ key3 WRITE setKey3 NOTIFY key3Changed) +public: + explicit dconf-global_meta(QThread *thread, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-global_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-global_meta(QThread *thread, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + explicit dconf-global_meta(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath, QObject *parent = nullptr) + : QObject(parent) { + + if (!thread->isRunning()) { + qWarning() << QStringLiteral("Warning: The provided thread is not running."); + } + Q_ASSERT(QThread::currentThread() != thread); + auto worker = new QObject(); + worker->moveToThread(thread); + QMetaObject::invokeMethod(worker, [=]() { + auto config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr); + if (!config) { + qWarning() << QStringLiteral("Failed to create DConfig instance."); + worker->deleteLater(); + return; + } + config->moveToThread(QThread::currentThread()); + initialize(config); + worker->deleteLater(); + }); + } + ~dconf-global_meta() { + if (m_config.loadRelaxed()) { + m_config.loadRelaxed()->deleteLater(); + } + } + + QString key3() const { + return p_key3; + } + void setKey3(const QString &value) { + auto oldValue = p_key3; + p_key3 = value; + markPropertySet(0); + if (auto config = m_config.loadRelaxed()) { + QMetaObject::invokeMethod(config, [this, value]() { + m_config.loadRelaxed()->setValue(QStringLiteral("key3"), value); + }); + } + if (p_key3 != oldValue) { + Q_EMIT key3Changed(); + } + } +Q_SIGNALS: + void key3Changed(); +private: + void initialize(DTK_CORE_NAMESPACE::DConfig *config) { + Q_ASSERT(!m_config.loadRelaxed()); + m_config.storeRelaxed(config); + if (testPropertySet(0)) { + config->setValue(QStringLiteral("key3"), QVariant::fromValue(p_key3)); + } else { + updateValue(QStringLiteral("key3"), QVariant::fromValue(p_key3)); + } + + connect(config, &DTK_CORE_NAMESPACE::DConfig::valueChanged, this, [this](const QString &key) { + updateValue(key); + }, Qt::DirectConnection); + } + void updateValue(const QString &key, const QVariant &fallback = QVariant()) { + Q_ASSERT(QThread::currentThread() == m_config.loadRelaxed()->thread()); + const QVariant &value = m_config.loadRelaxed()->value(key, fallback); + if (key == QStringLiteral("key3")) { + auto newValue = qvariant_cast(value); + QMetaObject::invokeMethod(this, [this, newValue]() { + if (p_key3 != newValue) { + p_key3 = newValue; + Q_EMIT key3Changed(); + } + }); + return; + } + } + inline void markPropertySet(const int index) { + if (index < 32) { + m_propertySetStatus0.fetchAndOrOrdered(1 << (index - 0)); + return; + } + Q_UNREACHABLE(); + } + inline bool testPropertySet(const int index) const { + if (index < 32) { + return (m_propertySetStatus0.loadRelaxed() & (1 << (index - 0))); + } + Q_UNREACHABLE(); + } + QAtomicPointer m_config = nullptr; + QString p_key3 { QStringLiteral("global") }; + QAtomicInteger m_propertySetStatus0 = 0; +}; + +#endif // DCONF-GLOBAL_META_H diff --git a/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.cpp b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.cpp new file mode 100644 index 0000000..920f32c --- /dev/null +++ b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.cpp @@ -0,0 +1,113 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp ./dtkcore/src/dbus/org.desktopspec.ConfigManager.Manager.xml -a ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor -i ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.Manager.h + * + * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd. + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.h" +#include +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class ManagerAdaptor + */ + +ManagerAdaptor::ManagerAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +ManagerAdaptor::~ManagerAdaptor() +{ + // destructor +} + +QStringList ManagerAdaptor::keyList() const +{ + // get the value of property keyList + return qvariant_cast< QStringList >(parent()->property("keyList")); +} + +QString ManagerAdaptor::version() const +{ + // get the value of property version + return qvariant_cast< QString >(parent()->property("version")); +} + +QString ManagerAdaptor::description(const QString &key, const QString &language) +{ + // handle method call org.desktopspec.ConfigManager.Manager.description + QString description; + QMetaObject::invokeMethod(parent(), "description", Q_RETURN_ARG(QString, description), Q_ARG(QString, key), Q_ARG(QString, language)); + return description; +} + +bool ManagerAdaptor::isDefaultValue(const QString &key) +{ + // handle method call org.desktopspec.ConfigManager.Manager.isDefaultValue + bool isDefaultValue; + QMetaObject::invokeMethod(parent(), "isDefaultValue", Q_RETURN_ARG(bool, isDefaultValue), Q_ARG(QString, key)); + return isDefaultValue; +} + +QString ManagerAdaptor::name(const QString &key, const QString &language) +{ + // handle method call org.desktopspec.ConfigManager.Manager.name + QString name; + QMetaObject::invokeMethod(parent(), "name", Q_RETURN_ARG(QString, name), Q_ARG(QString, key), Q_ARG(QString, language)); + return name; +} + +QString ManagerAdaptor::permissions(const QString &key) +{ + // handle method call org.desktopspec.ConfigManager.Manager.permissions + QString permissions; + QMetaObject::invokeMethod(parent(), "permissions", Q_RETURN_ARG(QString, permissions), Q_ARG(QString, key)); + return permissions; +} + +void ManagerAdaptor::release() +{ + // handle method call org.desktopspec.ConfigManager.Manager.release + QMetaObject::invokeMethod(parent(), "release"); +} + +void ManagerAdaptor::reset(const QString &key) +{ + // handle method call org.desktopspec.ConfigManager.Manager.reset + QMetaObject::invokeMethod(parent(), "reset", Q_ARG(QString, key)); +} + +void ManagerAdaptor::setValue(const QString &key, const QDBusVariant &value) +{ + // handle method call org.desktopspec.ConfigManager.Manager.setValue + QMetaObject::invokeMethod(parent(), "setValue", Q_ARG(QString, key), Q_ARG(QDBusVariant, value)); +} + +QDBusVariant ManagerAdaptor::value(const QString &key) +{ + // handle method call org.desktopspec.ConfigManager.Manager.value + QDBusVariant value; + QMetaObject::invokeMethod(parent(), "value", Q_RETURN_ARG(QDBusVariant, value), Q_ARG(QString, key)); + return value; +} + +QString ManagerAdaptor::visibility(const QString &key) +{ + // handle method call org.desktopspec.ConfigManager.Manager.visibility + QString visibility; + QMetaObject::invokeMethod(parent(), "visibility", Q_RETURN_ARG(QString, visibility), Q_ARG(QString, key)); + return visibility; +} + diff --git a/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.h b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.h new file mode 100644 index 0000000..4aa5e5c --- /dev/null +++ b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor.h @@ -0,0 +1,102 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp ./dtkcore/src/dbus/org.desktopspec.ConfigManager.Manager.xml -a ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.ManagerAdaptor -i ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.Manager.h + * + * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd. + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef ORG_DESKTOPSPEC_CONFIGMANAGER_MANAGERADAPTOR_H +#define ORG_DESKTOPSPEC_CONFIGMANAGER_MANAGERADAPTOR_H + +#include +#include +#include "./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.Manager.h" +QT_BEGIN_NAMESPACE +class QByteArray; +template class QList; +template class QMap; +class QString; +class QStringList; +class QVariant; +QT_END_NAMESPACE + +/* + * Adaptor class for interface org.desktopspec.ConfigManager.Manager + */ +class ManagerAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.desktopspec.ConfigManager.Manager") + Q_CLASSINFO("D-Bus Introspection", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + ManagerAdaptor(QObject *parent); + virtual ~ManagerAdaptor(); + +public: // PROPERTIES + Q_PROPERTY(QStringList keyList READ keyList) + QStringList keyList() const; + + Q_PROPERTY(QString version READ version) + QString version() const; + +public Q_SLOTS: // METHODS + QString description(const QString &key, const QString &language); + bool isDefaultValue(const QString &key); + QString name(const QString &key, const QString &language); + QString permissions(const QString &key); + void release(); + void reset(const QString &key); + void setValue(const QString &key, const QDBusVariant &value); + QDBusVariant value(const QString &key); + QString visibility(const QString &key); +Q_SIGNALS: // SIGNALS + void valueChanged(const QString &key); +}; + +#endif diff --git a/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.cpp b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.cpp new file mode 100644 index 0000000..120fc9c --- /dev/null +++ b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.cpp @@ -0,0 +1,55 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp ./dtkcore/src/dbus/org.desktopspec.ConfigManager.xml -a ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor -i ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.h + * + * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd. + * + * This is an auto-generated file. + * Do not edit! All changes made to it will be lost. + */ + +#include "./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.h" +#include +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class ConfigManagerAdaptor + */ + +ConfigManagerAdaptor::ConfigManagerAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +ConfigManagerAdaptor::~ConfigManagerAdaptor() +{ + // destructor +} + +QDBusObjectPath ConfigManagerAdaptor::acquireManager(const QString &appid, const QString &name, const QString &subpath) +{ + // handle method call org.desktopspec.ConfigManager.acquireManager + QDBusObjectPath path; + QMetaObject::invokeMethod(parent(), "acquireManager", Q_RETURN_ARG(QDBusObjectPath, path), Q_ARG(QString, appid), Q_ARG(QString, name), Q_ARG(QString, subpath)); + return path; +} + +void ConfigManagerAdaptor::sync(const QString &path) +{ + // handle method call org.desktopspec.ConfigManager.sync + QMetaObject::invokeMethod(parent(), "sync", Q_ARG(QString, path)); +} + +void ConfigManagerAdaptor::update(const QString &path) +{ + // handle method call org.desktopspec.ConfigManager.update + QMetaObject::invokeMethod(parent(), "update", Q_ARG(QString, path)); +} + diff --git a/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.h b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.h new file mode 100644 index 0000000..abb79a7 --- /dev/null +++ b/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor.h @@ -0,0 +1,62 @@ +/* + * This file was generated by qdbusxml2cpp version 0.8 + * Command line was: qdbusxml2cpp ./dtkcore/src/dbus/org.desktopspec.ConfigManager.xml -a ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManagerAdaptor -i ./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.h + * + * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd. + * + * This is an auto-generated file. + * This file may have been hand-edited. Look for HAND-EDIT comments + * before re-generating it. + */ + +#ifndef ORG_DESKTOPSPEC_CONFIGMANAGERADAPTOR_H +#define ORG_DESKTOPSPEC_CONFIGMANAGERADAPTOR_H + +#include +#include +#include "./dtkcore/toolGenerate/qdbusxml2cpp/org.desktopspec.ConfigManager.h" +QT_BEGIN_NAMESPACE +class QByteArray; +template class QList; +template class QMap; +class QString; +class QStringList; +class QVariant; +QT_END_NAMESPACE + +/* + * Adaptor class for interface org.desktopspec.ConfigManager + */ +class ConfigManagerAdaptor: public QDBusAbstractAdaptor +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.desktopspec.ConfigManager") + Q_CLASSINFO("D-Bus Introspection", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + ConfigManagerAdaptor(QObject *parent); + virtual ~ConfigManagerAdaptor(); + +public: // PROPERTIES +public Q_SLOTS: // METHODS + QDBusObjectPath acquireManager(const QString &appid, const QString &name, const QString &subpath); + void sync(const QString &path); + void update(const QString &path); +Q_SIGNALS: // SIGNALS +}; + +#endif diff --git a/tools/dconfig2cpp/main.cpp b/tools/dconfig2cpp/main.cpp index 30ee258..c6aae60 100644 --- a/tools/dconfig2cpp/main.cpp +++ b/tools/dconfig2cpp/main.cpp @@ -79,10 +79,6 @@ int main(int argc, char *argv[]) { QLatin1String("sourceFile")); parser.addOption(sourceFileOption); - QCommandLineOption cppPropertyOption(QStringList() << QLatin1String("use-qproperty"), - QLatin1String("Generate Qt/C++ properties use QProperty")); - parser.addOption(cppPropertyOption); - QCommandLineOption forceRequestThread(QStringList() << QLatin1String("force-request-thread"), QLatin1String("Force request thread to create DConfig instance")); parser.addOption(forceRequestThread); @@ -168,10 +164,9 @@ int main(int argc, char *argv[]) { headerStream << "#include \n"; headerStream << "#include \n"; headerStream << "#include \n"; - - if (parser.isSet(cppPropertyOption)) { - headerStream << "#include \n"; - } + headerStream << "#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)\n" + << "#include \n" + << "#endif\n"; headerStream << "#include \n\n"; headerStream << "class " << className << " : public QObject {\n"; @@ -237,7 +232,7 @@ int main(int argc, char *argv[]) { typeName, propertyName, capitalizedPropertyName, - "QStringLiteral(u\"" + toUnicodeEscape(propertyName) + "\")", + "QStringLiteral(\"" + propertyName + "\")", obj[QLatin1String("value")] })); propertyNameStrings << properties.last().propertyNameString; @@ -380,11 +375,11 @@ int main(int argc, char *argv[]) { << " });\n" << " }\n" << " }\n"; - if (parser.isSet(cppPropertyOption)) { - headerStream << " QBindable<" << property.typeName << "> bindable" << property.capitalizedPropertyName << "() {\n" - << " return QBindable<" << property.typeName << ">(this, " << property.propertyNameString << ");\n" - << " }\n"; - } + headerStream << "#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)\n"; + headerStream << " QBindable<" << property.typeName << "> bindable" << property.capitalizedPropertyName << "() {\n" + << " return QBindable<" << property.typeName << ">(this, " << property.propertyNameString << ");\n" + << " }\n"; + headerStream << "#endif\n"; headerStream << " Q_INVOKABLE bool " << property.propertyName << "IsDefaultValue() const {\n" << " return !testPropertySet(" << i << ");\n"