DtkCore
DTK Core module
dsettingsdconfigbackend.h
1/*
2 * Copyright (C) 2021 Deepin Technology Co., Ltd.
3 *
4 * Author: Wang Fei <[email protected]>
5 *
6 * Maintainer: Wang Fei <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <QObject>
25#include <QScopedPointer>
26
27#include "dsettingsbackend.h"
28
29DCORE_BEGIN_NAMESPACE
30
31class DSettingsDConfigBackendPrivate;
32class LIBDTKCORESHARED_EXPORT DSettingsDConfigBackend : public Dtk::Core::DSettingsBackend
33{
34 Q_OBJECT
35public:
36 explicit DSettingsDConfigBackend(const QString &name, const QString &subpath = QString(), QObject *parent = nullptr);
37 ~DSettingsDConfigBackend() Q_DECL_OVERRIDE;
38
39 virtual QStringList keys() const Q_DECL_OVERRIDE;
40 virtual QVariant getOption(const QString &key) const Q_DECL_OVERRIDE;
41
42protected Q_SLOTS:
43 virtual void doSetOption(const QString &key, const QVariant &value) Q_DECL_OVERRIDE;
44 virtual void doSync() Q_DECL_OVERRIDE;
45
46private:
47 QScopedPointer<DSettingsDConfigBackendPrivate> d_ptr;
48 Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_ptr), DSettingsDConfigBackend)
49};
50
51DCORE_END_NAMESPACE
DSettingsBackend is interface of DSettings storage class.
Definition: dsettingsbackend.h:29
virtual void doSync()=0
do the real sync action.
virtual void doSetOption(const QString &key, const QVariant &value)=0
write key / value to storage.
virtual QVariant getOption(const QString &key) const =0
get value by key.
virtual QStringList keys() const =0
return all key of storage.
Storage DSetttings to an DConfig.
Definition: dsettingsdconfigbackend.h:33