diff options
Diffstat (limited to 'framework/settings/resourcelistmodel.cpp')
-rw-r--r-- | framework/settings/resourcelistmodel.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/framework/settings/resourcelistmodel.cpp b/framework/settings/resourcelistmodel.cpp deleted file mode 100644 index 27063ebc..00000000 --- a/framework/settings/resourcelistmodel.cpp +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #include "resourcelistmodel.h" | ||
2 | |||
3 | #include <sink/store.h> | ||
4 | |||
5 | ResourceListModel::ResourceListModel(QObject *parent) : QIdentityProxyModel() | ||
6 | { | ||
7 | Sink::Query query; | ||
8 | query.syncOnDemand = false; | ||
9 | query.processAll = false; | ||
10 | query.liveQuery = true; | ||
11 | query.requestedProperties << "type"; | ||
12 | m_model = Sink::Store::loadModel<Sink::ApplicationDomain::SinkResource>(query); | ||
13 | } | ||
14 | |||
15 | ResourceListModel::~ResourceListModel() | ||
16 | { | ||
17 | |||
18 | } | ||
19 | |||
20 | QHash< int, QByteArray > ResourceListModel::roleNames() const | ||
21 | { | ||
22 | QHash<int, QByteArray> roles; | ||
23 | |||
24 | roles[Type] = "type"; | ||
25 | roles[Id] = "id"; | ||
26 | |||
27 | return roles; | ||
28 | } | ||
29 | |||
30 | QVariant ResourceListModel::data(const QModelIndex& index, int role) const | ||
31 | { | ||
32 | auto srcIdx = mapToSource(index); | ||
33 | switch (role) { | ||
34 | case Id: | ||
35 | return srcIdx.data(Sink::Store::DomainObjectBaseRole).value<Sink::ApplicationDomain::ApplicationDomainType::Ptr>()->identifier(); | ||
36 | case Type: | ||
37 | return srcIdx.sibling(srcIdx.row(), 0).data(Qt::DisplayRole).toString(); | ||
38 | } | ||
39 | |||
40 | return QIdentityProxyModel::data(index, role); | ||
41 | } | ||
42 | |||