Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs for settings #182

Merged
merged 1 commit into from
Dec 4, 2022
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
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 你可以从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 void Dtk::Core::GSettingsBackend::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