Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
qobjectsettingswrapper.h
Go to the documentation of this file.
1/*
2 * Sailfin: a Jellyfin client written using Qt
3 * Copyright (C) 2021 Chris Josten and the Sailfin Contributors
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19#ifndef JELLYFIN_QOBJECTSETTINGSWRAPPER_H
20#define JELLYFIN_QOBJECTSETTINGSWRAPPER_H
21
22
23#if USE_MLITE
24#include <MDConfGroup>
25namespace Jellyfin {
26using QObjectSettingsWrapper = MDConfGroup;
27} // NS Jellyfin
28#else
29
30/***************************************************************************
31** Copyright (C) 2014 Jolla Mobile <andrew.den.exter@jollamobile.com>
32**
33** This library is free software; you can redistribute it and/or
34** modify it under the terms of the GNU Lesser General Public
35** License version 2.1 as published by the Free Software Foundation
36** and appearing in the file LICENSE.LGPL included in the packaging
37** of this file.
38**
39****************************************************************************/
40
41#include <QMetaType>
42#include <QObject>
43#include <QScopedPointer>
44#include <QVariant>
45
46namespace Jellyfin {
47class QObjectSettingsWrapperPrivate;
48
53class QObjectSettingsWrapper : public QObject {
54 Q_OBJECT
55 Q_DECLARE_PRIVATE(QObjectSettingsWrapper)
56 Q_PROPERTY(bool synchronous READ isSynchronous WRITE setSynchronous NOTIFY synchronousChanged);
57 Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged);
59public:
64
65 explicit QObjectSettingsWrapper(QObject *parent = nullptr, BindOption option = DontBindProperties);
66 explicit QObjectSettingsWrapper(const QString &path, QObject *parent = nullptr, BindOption option = DontBindProperties);
68
69 bool isSynchronous() const;
70 void setSynchronous(bool synchronous);
71
72 QString path() const;
73 void setPath(const QString &path);
74
77
78 Q_INVOKABLE QVariant value(const QString &key,
79 const QVariant &defaultValue = QVariant(),
80 int typeHint = QMetaType::UnknownType) const;
81 Q_INVOKABLE void setValue(const QString &key, const QVariant &value);
82signals:
86public slots:
87 void sync();
88 void clear();
89protected:
90 void resolveMetaObject(int propertyOffset = -1);
91private slots:
92 void propertyChanged();
93private:
94 QScopedPointer<QObjectSettingsWrapperPrivate> d_ptr;
95};
96
97} // NS Jellyfin
98#endif
99
100#endif // JELLYFIN_QOBJECTSETTINGSWRAPPER_H
Almost-API reimplementation of https://github.com/sailfishos/mlite/blob/master/src/mdconfgroup....
Definition qobjectsettingswrapper.h:53
bool synchronous
Definition qobjectsettingswrapper.h:56
QObjectSettingsWrapper(QObject *parent=nullptr, BindOption option=DontBindProperties)
Definition qobjectsettingswrapper.cpp:59
Jellyfin::QObjectSettingsWrapper * scope
Definition qobjectsettingswrapper.h:58
QString path
Definition qobjectsettingswrapper.h:57
void resolveMetaObject(int propertyOffset=-1)
Definition qobjectsettingswrapper.cpp:170
BindOption
Definition qobjectsettingswrapper.h:60
@ DontBindProperties
Definition qobjectsettingswrapper.h:61
@ BindProperties
Definition qobjectsettingswrapper.h:62
void sync()
Definition qobjectsettingswrapper.cpp:160
void setSynchronous(bool synchronous)
Definition qobjectsettingswrapper.cpp:86
Q_INVOKABLE void setValue(const QString &key, const QVariant &value)
Definition qobjectsettingswrapper.cpp:150
virtual ~QObjectSettingsWrapper()
Definition qobjectsettingswrapper.cpp:80
void setPath(const QString &path)
Definition qobjectsettingswrapper.cpp:91
void setScope(QObjectSettingsWrapper *scope)
Definition qobjectsettingswrapper.cpp:120
Q_INVOKABLE QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), int typeHint=QMetaType::UnknownType) const
Definition qobjectsettingswrapper.cpp:140
bool isSynchronous() const
Definition qobjectsettingswrapper.cpp:82
void clear()
Definition qobjectsettingswrapper.cpp:164