AusweisApp2
NotificationModel.h
gehe zur Dokumentation dieser Datei
1 /*
2  * \copyright Copyright (c) 2019-2020 Governikus GmbH & Co. KG, Germany
3  */
4 
5 #pragma once
6 
7 #include "Env.h"
8 
9 #include <QAbstractListModel>
10 #include <QContiguousCache>
11 #include <QHash>
12 #include <QObject>
13 #include <QString>
14 #include <QVariant>
15 
16 class test_NotificationModel;
17 
18 namespace governikus
19 {
20 
22  : public QAbstractListModel
23 {
24  Q_OBJECT
25  friend class Env;
26  friend class ::test_NotificationModel;
27 
28  Q_PROPERTY(QString lastType READ getLastType NOTIFY fireLastTypeChanged)
29 
30  enum UserRoles
31  {
32  TYPE = Qt::UserRole + 1,
33  TIME,
34  TEXT
35  };
36 
37  struct NotificationEntry
38  {
39  QString mType;
40  QString mTime;
41  QString mText;
42  };
43 
44  private:
45  QContiguousCache<NotificationEntry> mNotificationEntries;
46 
47  QString getLastType() const;
48 
49  private Q_SLOTS:
50  void onNewLogMsg(const QString& pMsg, const QString& pCategoryName);
51 
52  protected:
55 
56  public:
57  int rowCount(const QModelIndex& pIndex) const override;
58  QVariant data(const QModelIndex& pIndex, int pRole) const override;
59  QHash<int, QByteArray> roleNames() const override;
60 
61  Q_SIGNALS:
63 };
64 
65 } // namespace governikus
#define TYPE(x)
Definition: Env.h:39
Definition: NotificationModel.h:23
static NotificationModel & getInstance()
Definition: NotificationModel.cpp:59
QHash< int, QByteArray > roleNames() const override
Definition: NotificationModel.cpp:93
NotificationModel()
Definition: NotificationModel.cpp:51
QVariant data(const QModelIndex &pIndex, int pRole) const override
Definition: NotificationModel.cpp:72
QString lastType
Definition: NotificationModel.h:28
int rowCount(const QModelIndex &pIndex) const override
Definition: NotificationModel.cpp:65
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15