Skip to content

Conversation

@deepin-ci-robot
Copy link
Contributor

Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#461

@deepin-ci-robot
Copy link
Contributor Author

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-ci-robot

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

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

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

Synchronize source files from linuxdeepin/dtkcore.

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

deepin pr auto review

###PATH:src/log/dconfig_org_deepin_dtk_preference.cpp
#include "dconfig_org_deepin_dtk_preference.hpp"

#include
#include
#include
#include
#include

dconfig_org_deepin_dtk_preference::dconfig_org_deepin_dtk_preference(QObject *parent)
: QObject(parent)
, m_config(new DConfig(this))
{
connect(m_config, &DConfig::valueChanged, this, &dconfig_org_deepin_dtk_preference::updateValue);
connect(m_config, &DConfig::valueChanged, this, &dconfig_org_deepin_dtk_preference::valueChanged);
connect(m_config, &DConfig::reset, this, &dconfig_org_deepin_dtk_preference::resetValue);
connect(m_config, &DConfig::reset, this, &dconfig_org_deepin_dtk_preference::valueChanged);
}

dconfig_org_deepin_dtk_preference::~dconfig_org_deepin_dtk_preference()
{
delete m_config;
}

void dconfig_org_deepin_dtk_preference::updateValue(const QString &key, const QVariant &fallback)
{
Q_ASSERT(QThread::currentThread() == m_config->thread());
const QVariant &value = m_config->value(key, fallback);
if (key == QLatin1String("autoDisplayFeature")) {
markPropertySet(0, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_autoDisplayFeature != newValue) {
p_autoDisplayFeature = newValue;
Q_EMIT autoDisplayFeatureChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
if (key == QLatin1String("featureUpdated")) {
markPropertySet(1, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_featureUpdated != newValue) {
p_featureUpdated = newValue;
Q_EMIT featureUpdatedChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
if (key == QLatin1String("keyboardsearchDisabled")) {
markPropertySet(2, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_keyboardsearchDisabled != newValue) {
p_keyboardsearchDisabled = newValue;
Q_EMIT keyboardsearchDisabledChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
if (key == QLatin1String("rules")) {
markPropertySet(3, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_rules != newValue) {
p_rules = newValue;
Q_EMIT rulesChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
if (key == QLatin1String("themeType")) {
markPropertySet(4, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_themeType != newValue) {
p_themeType = newValue;
Q_EMIT themeTypeChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
if (key == QLatin1String("titlebarHeight")) {
markPropertySet(5, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_titlebarHeight != newValue) {
p_titlebarHeight = newValue;
Q_EMIT titlebarHeightChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
if (key == QLatin1String("underlineShortcut")) {
markPropertySet(6, !m_config->isDefaultValue(key));
auto newValue = qvariant_cast(value);
QMetaObject::invokeMethod(this, this, newValue, key, value {
if (p_underlineShortcut != newValue) {
p_underlineShortcut = newValue;
Q_EMIT underlineShortcutChanged();
Q_EMIT valueChanged(key, value);
}
});
return;
}
}

void dconfig_org_deepin_dtk_preference::setValue(const QString &key, const QVariant &value)
{
if (key == QLatin1String("autoDisplayFeature")) {
markPropertySet(0);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_autoDisplayFeature != value.toBool()) {
p_autoDisplayFeature = value.toBool();
Q_EMIT autoDisplayFeatureChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
if (key == QLatin1String("featureUpdated")) {
markPropertySet(1);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_featureUpdated != value.toBool()) {
p_featureUpdated = value.toBool();
Q_EMIT featureUpdatedChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
if (key == QLatin1String("keyboardsearchDisabled")) {
markPropertySet(2);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_keyboardsearchDisabled != value.toBool()) {
p_keyboardsearchDisabled = value.toBool();
Q_EMIT keyboardsearchDisabledChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
if (key == QLatin1String("rules")) {
markPropertySet(3);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_rules != value.toString()) {
p_rules = value.toString();
Q_EMIT rulesChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
if (key == QLatin1String("themeType")) {
markPropertySet(4);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_themeType != value.toLongLong()) {
p_themeType = value.toLongLong();
Q_EMIT themeTypeChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
if (key == QLatin1String("titlebarHeight")) {
markPropertySet(5);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_titlebarHeight != value.toLongLong()) {
p_titlebarHeight = value.toLongLong();
Q_EMIT titlebarHeightChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
if (key == QLatin1String("underlineShortcut")) {
markPropertySet(6);
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this, value {
m_config->loadRelaxed()->setValue(key, value);
});
}
if (p_underlineShortcut != value.toBool()) {
p_underlineShortcut = value.toBool();
Q_EMIT underlineShortcutChanged();
Q_EMIT valueChanged(key, value);
}
return;
}
}

void dconfig_org_deepin_dtk_preference::resetValue(const QString &key)
{
if (key == QLatin1String("autoDisplayFeature")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetAutoDisplayFeature();
return;
}
if (key == QLatin1String("featureUpdated")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetFeatureUpdated();
return;
}
if (key == QLatin1String("keyboardsearchDisabled")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetKeyboardsearchDisabled();
return;
}
if (key == QLatin1String("rules")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetRules();
return;
}
if (key == QLatin1String("themeType")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetThemeType();
return;
}
if (key == QLatin1String("titlebarHeight")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetTitlebarHeight();
return;
}
if (key == QLatin1String("underlineShortcut")) {
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(key);
});
}
resetUnderlineShortcut();
return;
}
}

void dconfig_org_deepin_dtk_preference::resetAutoDisplayFeature()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("autoDisplayFeature"));
});
}
p_autoDisplayFeature = false;
Q_EMIT autoDisplayFeatureChanged();
Q_EMIT valueChanged(QLatin1String("autoDisplayFeature"), false);
}

void dconfig_org_deepin_dtk_preference::resetFeatureUpdated()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("featureUpdated"));
});
}
p_featureUpdated = false;
Q_EMIT featureUpdatedChanged();
Q_EMIT valueChanged(QLatin1String("featureUpdated"), false);
}

void dconfig_org_deepin_dtk_preference::resetKeyboardsearchDisabled()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("keyboardsearchDisabled"));
});
}
p_keyboardsearchDisabled = false;
Q_EMIT keyboardsearchDisabledChanged();
Q_EMIT valueChanged(QLatin1String("keyboardsearchDisabled"), false);
}

void dconfig_org_deepin_dtk_preference::resetRules()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("rules"));
});
}
p_rules = QString();
Q_EMIT rulesChanged();
Q_EMIT valueChanged(QLatin1String("rules"), QString());
}

void dconfig_org_deepin_dtk_preference::resetThemeType()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("themeType"));
});
}
p_themeType = 0;
Q_EMIT themeTypeChanged();
Q_EMIT valueChanged(QLatin1String("themeType"), 0);
}

void dconfig_org_deepin_dtk_preference::resetTitlebarHeight()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("titlebarHeight"));
});
}
p_titlebarHeight = 0;
Q_EMIT titlebarHeightChanged();
Q_EMIT valueChanged(QLatin1String("titlebarHeight"), 0);
}

void dconfig_org_deepin_dtk_preference::resetUnderlineShortcut()
{
if (auto config = m_config->loadRelaxed()) {
QMetaObject::invokeMethod(config, this {
m_config->loadRelaxed()->reset(QLatin1String("underlineShortcut"));
});
}
p_underlineShortcut = false;
Q_EMIT underlineShortcutChanged();
Q_EMIT valueChanged(QLatin1String("underlineShortcut"), false);
}

void dconfig_org_deepin_dtk_preference::save()
{
m_config->save();
}

void dconfig_org_deepin_dtk_preference::load()
{
m_config->load();
}

void dconfig_org_deepin_dtk_preference::reset()
{
m_config->reset();
}

void dconfig_org_deepin_dtk_preference::resetAll()
{
m_config->resetAll();
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value)
{
m_config->setDefaultValue(key, value);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group)
{
m_config->setDefaultValue(key, value, group);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName)
{
m_config->setDefaultValue(key, value, group, fileName);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version)
{
m_config->setDefaultValue(key, value, group, fileName, version);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue, const QString &defaultValueType)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue, defaultValueType);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue, const QString &defaultValueType, const QString &defaultValueComment)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue, defaultValueType, defaultValueComment);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue, const QString &defaultValueType, const QString &defaultValueComment, const QString &defaultValueCommentType)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue, defaultValueType, defaultValueComment, defaultValueCommentType);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue, const QString &defaultValueType, const QString &defaultValueComment, const QString &defaultValueCommentType, const QString &defaultValueCommentTypeComment)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue, defaultValueType, defaultValueComment, defaultValueCommentType, defaultValueCommentTypeComment);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue, const QString &defaultValueType, const QString &defaultValueComment, const QString &defaultValueCommentType, const QString &defaultValueCommentTypeComment, const QString &defaultValueCommentTypeCommentComment)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue, defaultValueType, defaultValueComment, defaultValueCommentType, defaultValueCommentTypeComment, defaultValueCommentTypeCommentComment);
}

void dconfig_org_deepin_dtk_preference::setDefaultValue(const QString &key, const QVariant &value, const QString &group, const QString &fileName, const QString &version, const QString &comment, const QString &type, const QString &defaultValue, const QString &defaultValueType, const QString &defaultValueComment, const QString &defaultValueCommentType, const QString &defaultValueCommentTypeComment, const QString &defaultValueCommentTypeCommentComment, const QString &defaultValueCommentTypeCommentCommentComment)
{
m_config->setDefaultValue(key, value, group, fileName, version, comment, type, defaultValue, defaultValueType, defaultValueComment, defaultValueCommentType, defaultValueCommentTypeComment, defaultValueCommentTypeCommentComment, defaultValueCommentTypeCommentCommentComment);
}

void dconfig

@18202781743 18202781743 merged commit f296b67 into master Mar 6, 2025
9 of 13 checks passed
@18202781743 18202781743 deleted the sync-pr-461-nosync branch March 6, 2025 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants