DtkCore
DTK Core module
qsettingbackend.h
1/*
2 * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <QObject>
21#include <QScopedPointer>
22
23#include "dsettingsbackend.h"
24
25DCORE_BEGIN_NAMESPACE
26
27class QSettingBackendPrivate;
28class LIBDTKCORESHARED_EXPORT QSettingBackend : public Dtk::Core::DSettingsBackend
29{
30 Q_OBJECT
31public:
32 explicit QSettingBackend(const QString &filepath, QObject *parent = 0);
34
35 virtual QStringList keys() const Q_DECL_OVERRIDE;
36 virtual QVariant getOption(const QString &key) const Q_DECL_OVERRIDE;
37
38protected Q_SLOTS:
39 virtual void doSetOption(const QString &key, const QVariant &value) Q_DECL_OVERRIDE;
40 virtual void doSync() Q_DECL_OVERRIDE;
41
42private:
43 QScopedPointer<QSettingBackendPrivate> d_ptr;
44 Q_DECLARE_PRIVATE_D(qGetPtrHelper(d_ptr), QSettingBackend)
45};
46
47DCORE_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 QSettings.
Definition: qsettingbackend.h:29