1 | /* |
2 | * BluezQt - Asynchronous Bluez wrapper library |
3 | * |
4 | * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@gmail.com> |
5 | * |
6 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #ifndef DECLARATIVEDEVICESMODEL_H |
10 | #define DECLARATIVEDEVICESMODEL_H |
11 | |
12 | #include <QSortFilterProxyModel> |
13 | #include <qqmlregistration.h> |
14 | |
15 | #include "devicesmodel.h" |
16 | |
17 | class DeclarativeManager; |
18 | |
19 | class DeclarativeDevicesModel : public QSortFilterProxyModel |
20 | { |
21 | Q_OBJECT |
22 | QML_NAMED_ELEMENT(DevicesModelPrivate) |
23 | Q_PROPERTY(DeclarativeManager *manager READ manager WRITE setManager) |
24 | |
25 | public: |
26 | enum DeclarativeDeviceRoles { |
27 | DeviceRole = BluezQt::DevicesModel::LastRole + 1, |
28 | AdapterRole = BluezQt::DevicesModel::LastRole + 2, |
29 | MediaPlayerRole = BluezQt::DevicesModel::LastRole + 3, |
30 | BatteryRole = BluezQt::DevicesModel::LastRole + 4, |
31 | }; |
32 | |
33 | explicit DeclarativeDevicesModel(QObject *parent = nullptr); |
34 | |
35 | DeclarativeManager *manager() const; |
36 | void setManager(DeclarativeManager *manager); |
37 | |
38 | QHash<int, QByteArray> roleNames() const override; |
39 | QVariant data(const QModelIndex &index, int role) const override; |
40 | |
41 | private: |
42 | DeclarativeManager *m_manager; |
43 | BluezQt::DevicesModel *m_model; |
44 | }; |
45 | |
46 | #endif // DECLARATIVEMANAGER_H |
47 | |