Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 41 additions & 20 deletions src/log/dconfig_org_deepin_dtk_preference.hpp
Original file line number Diff line number Diff line change
@@ -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-03-06T10:40:41
* Generation time: 2025-03-06T20:18:27
* JSON file version: 1.0
*
* WARNING: DO NOT MODIFY THIS FILE MANUALLY.
Expand All @@ -19,7 +19,8 @@
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QProperty>
#endif
#include <DSGApplication>

Check warning on line 22 in src/log/dconfig_org_deepin_dtk_preference.hpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DSGApplication> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DConfig>

Check warning on line 23 in src/log/dconfig_org_deepin_dtk_preference.hpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DConfig> not found. Please note: Cppcheck does not need standard library headers to get proper results.

class dconfig_org_deepin_dtk_preference : public QObject {
Q_OBJECT
Expand All @@ -36,7 +37,9 @@
Q_CLASSINFO("DConfigFileVersion", "1.0")

public:
explicit dconfig_org_deepin_dtk_preference(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &appId, const QString &subpath, QObject *parent)
explicit dconfig_org_deepin_dtk_preference(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend,
const QString &name, const QString &appId, const QString &subpath,
bool isGeneric, QObject *parent)
: QObject(parent) {
if (!thread->isRunning()) {
qWarning() << QLatin1String("Warning: The provided thread is not running.");
Expand All @@ -46,17 +49,27 @@
worker->moveToThread(thread);
QMetaObject::invokeMethod(worker, [=, this]() {
DTK_CORE_NAMESPACE::DConfig *config = nullptr;
if (backend) {
if (appId.isNull()) {
config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr);
if (isGeneric) {
if (backend) {
config = DTK_CORE_NAMESPACE::DConfig::createGeneric(backend, name, subpath, nullptr);
} else {
config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr);
config = DTK_CORE_NAMESPACE::DConfig::createGeneric(name, subpath, nullptr);
}
} else {
if (appId.isNull()) {
config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr);
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 {
config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr);
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) {
Expand All @@ -70,13 +83,21 @@
});
}
static dconfig_org_deepin_dtk_preference* create(const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
{ return new dconfig_org_deepin_dtk_preference(thread, nullptr, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0074\u006b\u002e\u0070\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"), appId, subpath, parent); }
{ return new dconfig_org_deepin_dtk_preference(thread, nullptr, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0074\u006b\u002e\u0070\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"), appId, subpath, false, parent); }
static dconfig_org_deepin_dtk_preference* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
{ return new dconfig_org_deepin_dtk_preference(thread, backend, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0074\u006b\u002e\u0070\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"), appId, subpath, parent); }
{ return new dconfig_org_deepin_dtk_preference(thread, backend, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0074\u006b\u002e\u0070\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"), appId, subpath, false, parent); }
static dconfig_org_deepin_dtk_preference* createByName(const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())

Check warning on line 89 in src/log/dconfig_org_deepin_dtk_preference.hpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'createByName' is never used.
{ return new dconfig_org_deepin_dtk_preference(thread, nullptr, name, appId, subpath, parent); }
{ return new dconfig_org_deepin_dtk_preference(thread, nullptr, name, appId, subpath, false, parent); }
static dconfig_org_deepin_dtk_preference* createByName(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
{ return new dconfig_org_deepin_dtk_preference(thread, backend, name, appId, subpath, parent); }
{ return new dconfig_org_deepin_dtk_preference(thread, backend, name, appId, subpath, false, parent); }
static dconfig_org_deepin_dtk_preference* createGeneric(const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
{ return new dconfig_org_deepin_dtk_preference(thread, nullptr, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0074\u006b\u002e\u0070\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"), {}, subpath, true, parent); }
static dconfig_org_deepin_dtk_preference* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
{ return new dconfig_org_deepin_dtk_preference(thread, backend, QStringLiteral(u"\u006f\u0072\u0067\u002e\u0064\u0065\u0065\u0070\u0069\u006e\u002e\u0064\u0074\u006b\u002e\u0070\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065"), {}, subpath, true, parent); }
static dconfig_org_deepin_dtk_preference* createGenericByName(const QString &name, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())

Check warning on line 97 in src/log/dconfig_org_deepin_dtk_preference.hpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'createGenericByName' is never used.
{ return new dconfig_org_deepin_dtk_preference(thread, nullptr, name, {}, subpath, true, parent); }
static dconfig_org_deepin_dtk_preference* createGenericByName(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())
{ return new dconfig_org_deepin_dtk_preference(thread, backend, name, {}, subpath, true, parent); }
~dconfig_org_deepin_dtk_preference() {
if (m_config.loadRelaxed()) {
m_config.loadRelaxed()->deleteLater();
Expand Down Expand Up @@ -153,7 +174,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<bool> bindableAutoDisplayFeature() {
return QBindable<bool>(this, QStringLiteral("autoDisplayFeature"));
return QBindable<bool>(this, "autoDisplayFeature");
}
#endif
Q_INVOKABLE bool autoDisplayFeatureIsDefaultValue() const {
Expand Down Expand Up @@ -185,7 +206,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<bool> bindableFeatureUpdated() {
return QBindable<bool>(this, QStringLiteral("featureUpdated"));
return QBindable<bool>(this, "featureUpdated");
}
#endif
Q_INVOKABLE bool featureUpdatedIsDefaultValue() const {
Expand Down Expand Up @@ -217,7 +238,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<bool> bindableKeyboardsearchDisabled() {
return QBindable<bool>(this, QStringLiteral("keyboardsearchDisabled"));
return QBindable<bool>(this, "keyboardsearchDisabled");
}
#endif
Q_INVOKABLE bool keyboardsearchDisabledIsDefaultValue() const {
Expand Down Expand Up @@ -249,7 +270,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<QString> bindableRules() {
return QBindable<QString>(this, QStringLiteral("rules"));
return QBindable<QString>(this, "rules");
}
#endif
Q_INVOKABLE bool rulesIsDefaultValue() const {
Expand Down Expand Up @@ -281,7 +302,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<qlonglong> bindableThemeType() {
return QBindable<qlonglong>(this, QStringLiteral("themeType"));
return QBindable<qlonglong>(this, "themeType");
}
#endif
Q_INVOKABLE bool themeTypeIsDefaultValue() const {
Expand Down Expand Up @@ -313,7 +334,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<qlonglong> bindableTitlebarHeight() {
return QBindable<qlonglong>(this, QStringLiteral("titlebarHeight"));
return QBindable<qlonglong>(this, "titlebarHeight");
}
#endif
Q_INVOKABLE bool titlebarHeightIsDefaultValue() const {
Expand Down Expand Up @@ -345,7 +366,7 @@
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QBindable<bool> bindableUnderlineShortcut() {
return QBindable<bool>(this, QStringLiteral("underlineShortcut"));
return QBindable<bool>(this, "underlineShortcut");
}
#endif
Q_INVOKABLE bool underlineShortcutIsDefaultValue() const {
Expand Down
60 changes: 47 additions & 13 deletions tools/dconfig2cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ int main(int argc, char *argv[]) {
<< "#include <QProperty>\n"
<< "#endif\n";

headerStream << "#include <DSGApplication>\n";
headerStream << "#include <DConfig>\n\n";
headerStream << "class " << className << " : public QObject {\n";
headerStream << " Q_OBJECT\n\n";
Expand Down Expand Up @@ -249,7 +250,9 @@ int main(int argc, char *argv[]) {
<< " Q_CLASSINFO(\"DConfigFileVersion\", \"" << version <<"\")\n\n"
<< "public:\n"
<< " explicit " << className
<< R"((QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &appId, const QString &subpath, QObject *parent)
<< R"((QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend,
const QString &name, const QString &appId, const QString &subpath,
bool isGeneric, QObject *parent)
: QObject(parent) {
if (!thread->isRunning()) {
qWarning() << QLatin1String("Warning: The provided thread is not running.");
Expand All @@ -259,17 +262,27 @@ int main(int argc, char *argv[]) {
worker->moveToThread(thread);
QMetaObject::invokeMethod(worker, [=, this]() {
DTK_CORE_NAMESPACE::DConfig *config = nullptr;
if (backend) {
if (appId.isNull()) {
config = DTK_CORE_NAMESPACE::DConfig::create(backend, name, subpath, nullptr);
if (isGeneric) {
if (backend) {
config = DTK_CORE_NAMESPACE::DConfig::createGeneric(backend, name, subpath, nullptr);
} else {
config = DTK_CORE_NAMESPACE::DConfig::create(backend, appId, name, subpath, nullptr);
config = DTK_CORE_NAMESPACE::DConfig::createGeneric(name, subpath, nullptr);
}
} else {
if (appId.isNull()) {
config = DTK_CORE_NAMESPACE::DConfig::create(name, subpath, nullptr);
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 {
config = DTK_CORE_NAMESPACE::DConfig::create(appId, name, subpath, nullptr);
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) {
Expand All @@ -290,22 +303,43 @@ int main(int argc, char *argv[]) {
headerStream << " static " << className << "* create(QThread *thread, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* create(const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, nullptr, " << jsonFileString << ", appId, subpath, parent); }\n";
headerStream << " { return new " << className << "(thread, nullptr, " << jsonFileString << ", appId, subpath, false, parent); }\n";
if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* create(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, backend, " << jsonFileString << ", appId, subpath, parent); }\n";
headerStream << " { return new " << className << "(thread, backend, " << jsonFileString << ", appId, subpath, false, parent); }\n";
if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* createByName(QThread *thread, const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* createByName(const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, nullptr, name, appId, subpath, parent); }\n";
headerStream << " { return new " << className << "(thread, nullptr, name, appId, subpath, false, parent); }\n";
if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* createByName(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &appId = {}, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* 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())\n";
headerStream << " { return new " << className << "(thread, backend, name, appId, subpath, parent); }\n";
headerStream << " { return new " << className << "(thread, backend, name, appId, subpath, false, parent); }\n";

if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* createGeneric(QThread *thread, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* createGeneric(const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, nullptr, " << jsonFileString << ", {}, subpath, true, parent); }\n";
if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* create(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* create(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, backend, " << jsonFileString << ", {}, subpath, true, parent); }\n";
if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* createGenericByName(QThread *thread, const QString &name, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* createGenericByName(const QString &name, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, nullptr, name, {}, subpath, true, parent); }\n";
if (parser.isSet(forceRequestThread))
headerStream << " static " << className << "* createGenericByName(QThread *thread, DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath = {}, QObject *parent = nullptr)\n";
else
headerStream << " static " << className << "* createGenericByName(DTK_CORE_NAMESPACE::DConfigBackend *backend, const QString &name, const QString &subpath = {}, QObject *parent = nullptr, QThread *thread = DTK_CORE_NAMESPACE::DConfig::globalThread())\n";
headerStream << " { return new " << className << "(thread, backend, name, {}, subpath, true, parent); }\n";

// Destructor
headerStream << " ~" << className << R"(() {
Expand Down Expand Up @@ -377,7 +411,7 @@ int main(int argc, char *argv[]) {
<< " }\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"
<< " return QBindable<" << property.typeName << ">(this, \"" << property.propertyName << "\");\n"
<< " }\n";
headerStream << "#endif\n";

Expand Down
Loading