diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-24 22:15:18 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-24 22:15:18 +0100 |
commit | 9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a (patch) | |
tree | 41fef7daac9e5ae64d61452a3f38c82243d29fdd /common/modelresult.h | |
parent | 84d70933c0cd0987d5fee5a78f413fec82bb1288 (diff) | |
download | sink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.tar.gz sink-9ea268a6d0f4054c31b2729ecd6cfcc9d07a2d6a.zip |
Implemented notification support in the model.
This will allow us to fold things like progress and sync status directly
into the model. Usecases are mail download progress and folder sync
progress.
Ideally we would also solve the resource/account state through this.
Diffstat (limited to 'common/modelresult.h')
-rw-r--r-- | common/modelresult.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/common/modelresult.h b/common/modelresult.h index f30a8e1..cc263cf 100644 --- a/common/modelresult.h +++ b/common/modelresult.h | |||
@@ -30,15 +30,23 @@ | |||
30 | #include "resultprovider.h" | 30 | #include "resultprovider.h" |
31 | #include "threadboundary.h" | 31 | #include "threadboundary.h" |
32 | 32 | ||
33 | namespace Sink { | ||
34 | class Notifier; | ||
35 | } | ||
36 | |||
33 | template <class T, class Ptr> | 37 | template <class T, class Ptr> |
34 | class ModelResult : public QAbstractItemModel | 38 | class ModelResult : public QAbstractItemModel |
35 | { | 39 | { |
36 | public: | 40 | public: |
41 | //Update the copy in store.h as well if you modify this | ||
37 | enum Roles | 42 | enum Roles |
38 | { | 43 | { |
39 | DomainObjectRole = Qt::UserRole + 1, | 44 | DomainObjectRole = Qt::UserRole + 1, |
40 | ChildrenFetchedRole, | 45 | ChildrenFetchedRole, |
41 | DomainObjectBaseRole | 46 | DomainObjectBaseRole, |
47 | StatusRole, //ApplicationDomain::SyncStatus | ||
48 | WarningRole, //ApplicationDomain::Warning, only if status == warning || status == error | ||
49 | ProgressRole //ApplicationDomain::Progress | ||
42 | }; | 50 | }; |
43 | 51 | ||
44 | ModelResult(const Sink::Query &query, const QList<QByteArray> &propertyColumns, const Sink::Log::Context &); | 52 | ModelResult(const Sink::Query &query, const QList<QByteArray> &propertyColumns, const Sink::Log::Context &); |
@@ -77,9 +85,11 @@ private: | |||
77 | QSet<qint64 /* entity id */> mEntityChildrenFetched; | 85 | QSet<qint64 /* entity id */> mEntityChildrenFetched; |
78 | QSet<qint64 /* entity id */> mEntityChildrenFetchComplete; | 86 | QSet<qint64 /* entity id */> mEntityChildrenFetchComplete; |
79 | QSet<qint64 /* entity id */> mEntityAllChildrenFetched; | 87 | QSet<qint64 /* entity id */> mEntityAllChildrenFetched; |
88 | QMap<qint64 /* entity id */, int /* Status */> mEntityStatus; | ||
80 | QList<QByteArray> mPropertyColumns; | 89 | QList<QByteArray> mPropertyColumns; |
81 | Sink::Query mQuery; | 90 | Sink::Query mQuery; |
82 | std::function<void(const Ptr &)> loadEntities; | 91 | std::function<void(const Ptr &)> loadEntities; |
83 | typename Sink::ResultEmitter<Ptr>::Ptr mEmitter; | 92 | typename Sink::ResultEmitter<Ptr>::Ptr mEmitter; |
84 | async::ThreadBoundary threadBoundary; | 93 | async::ThreadBoundary threadBoundary; |
94 | QScopedPointer<Sink::Notifier> mNotifier; | ||
85 | }; | 95 | }; |