Skip to content

Commit

Permalink
docs: add docs for settings
Browse files Browse the repository at this point in the history
给gsettingsbackend添加文档注释

Log: add docs

Task: deepin-community/coding-quarter#26
  • Loading branch information
chenchongbiao committed Dec 3, 2022
1 parent 1785a16 commit f822612
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
27 changes: 27 additions & 0 deletions docs/settings/backend/gsettingsbackend.zh_CN.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
@~chinese
@file include/settings/backend/gsettingsbackend.h
@ingroup dsettings

@class Dtk::Core::GSettingsBackend gsettingsbackend.h
@brief DSettings的存储后端使用gsettings
@details 你应该使用/usr/lib/x86_64-linux-gnu/libdtk-$$VERSION/DCore/bin/dtk-settings 生成gsetting模式 <br>你可以从libdtkcore-bin中找到此工具, 使用/usr/lib/x86_64-linux-gnu/libdtk-$$VERSION/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 Dtk::Core::GSettingsBackend::void doSync()
@brief 触发DSettings将选项同步到存储

*/
21 changes: 13 additions & 8 deletions src/settings/backend/gsettingsbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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)
Expand All @@ -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()
{
Expand Down

0 comments on commit f822612

Please sign in to comment.