From 5d7725e2380904e6d15515d7c019243b41411f44 Mon Sep 17 00:00:00 2001 From: bluesky <379865549@qq.com> Date: Sun, 4 Dec 2022 10:31:28 +0800 Subject: [PATCH] docs: add docs for settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 给gsettingsbackend添加文档注释 Log: add docs Task: deepin-community/coding-quarter#26 --- .../backend/gsettingsbackend.zh_CN.dox | 27 +++++++++++++++++++ src/settings/backend/gsettingsbackend.cpp | 21 +++++++++------ 2 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 docs/settings/backend/gsettingsbackend.zh_CN.dox diff --git a/docs/settings/backend/gsettingsbackend.zh_CN.dox b/docs/settings/backend/gsettingsbackend.zh_CN.dox new file mode 100644 index 00000000..0e78bfce --- /dev/null +++ b/docs/settings/backend/gsettingsbackend.zh_CN.dox @@ -0,0 +1,27 @@ +/*! +@~chinese +@file include/settings/backend/gsettingsbackend.h +@ingroup dsettings + +@class Dtk::Core::GSettingsBackend gsettingsbackend.h +@brief DSettings的存储后端使用gsettings +@details 你可以从libdtkcore-bin中找到此工具, 使用/usr/lib/x86_64-linux-gnu/libdtk-/DCore/bin/dtk-settings -h 获取帮助 + +@fn Dtk::Core::GSettingsBackend::GSettingsBackend(DSettings *settings, QObject *parent = nullptr) +@brief GSettingsBackend构造函数 + +@fn virtual QStringList Dtk::Core::GSettingsBackend::keys() const +@brief gsettings的全部键值 +@return 返回gsettings的全部键值 + +@fn virtual QVariant Dtk::Core::GSettingsBackend::getOption(const QString &key) const +@brief 根据`key`获取值 +@return 返回键对应的值 + +@fn virtual void Dtk::Core::GSettingsBackend::doSetOption(const QString &key, const QVariant &value) +@brief 设置`key`对应的值 + +@fn virtual void Dtk::Core::GSettingsBackend::doSync() +@brief 触发DSettings将选项同步到存储 + +*/ \ No newline at end of file diff --git a/src/settings/backend/gsettingsbackend.cpp b/src/settings/backend/gsettingsbackend.cpp index efc2873e..76c644f3 100644 --- a/src/settings/backend/gsettingsbackend.cpp +++ b/src/settings/backend/gsettingsbackend.cpp @@ -54,9 +54,10 @@ class GSettingsBackendPrivate }; /*! - \class Dtk::Core::GSettingsBackend +@~english + @class Dtk::Core::GSettingsBackend \inmodule dtkcore - \brief Storage backend of DSettings use gsettings. + @brief Storage backend of DSettings use gsettings. You should generate gsetting schema with /usr/lib/x86_64-linux-gnu/libdtk-$$VERSION/DCore/bin/dtk-settings. @@ -94,8 +95,9 @@ GSettingsBackend::~GSettingsBackend() } /*! - \brief List all gsettings keys. - \return Return all gsettings keys. +@~english + @brief List all gsettings keys. + @return Return all gsettings keys. */ QStringList GSettingsBackend::keys() const { @@ -104,8 +106,9 @@ QStringList GSettingsBackend::keys() const } /*! - \brief Get value of key. - \return Return the value of the given \a key. +@~english + @brief Get value of key. + @return Return the value of the given \a key. */ QVariant GSettingsBackend::getOption(const QString &key) const { @@ -114,7 +117,8 @@ QVariant GSettingsBackend::getOption(const QString &key) const } /*! - \brief Set value to gsettings +@~english + @brief Set value to gsettings Use the \a key to save the \a value. */ void GSettingsBackend::doSetOption(const QString &key, const QVariant &value) @@ -127,7 +131,8 @@ void GSettingsBackend::doSetOption(const QString &key, const QVariant &value) } /*! - \brief Trigger DSettings to sync option to storage. +@~english + @brief Trigger DSettings to sync option to storage. */ void GSettingsBackend::doSync() {