Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
propertyhelper.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_VIEWMODEL_PROPERTYHELPER
20#define JELLYFIN_VIEWMODEL_PROPERTYHELPER
21
22// Jellyfin Forward Read/Write Property
23#define JF_FWD_RW_PROP(type, propName, propSetName, obj) \
24 public: \
25 Q_PROPERTY(type propName READ propName WRITE set##propSetName NOTIFY propName##Changed) \
26 type propName() const { return obj.propName(); } \
27 void set##propSetName(type newValue) { \
28 obj.set##propSetName( newValue ); \
29 emit propName##Changed(); \
30 } \
31 Q_SIGNALS: \
32 void propName##Changed();
33
34// Jellyfin Forward Read Property
35#define JF_FWD_R_PROP(type, propName, propSetName, obj) \
36 public: \
37 Q_PROPERTY(type propName READ propName NOTIFY propName##Changed) \
38 type propName() const { return obj.propName(); } \
39 signals: \
40 void propName##Changed(type newValue);
41#endif // JELLYFIN_VIEWMODEL_PROPERTYHELPER