AusweisApp2
NotificationModel.h
gehe zur Dokumentation dieser Datei
1 /*
2  * \copyright Copyright (c) 2019-2022 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  NotificationModel();
48  ~NotificationModel() override = default;
49  QString getLastType() const;
50 
51  private Q_SLOTS:
52  void onNewLogMsg(const QString& pMsg, const QString& pCategoryName);
53 
54  public:
55  int rowCount(const QModelIndex& pIndex) const override;
56  QVariant data(const QModelIndex& pIndex, int pRole) const override;
57  QHash<int, QByteArray> roleNames() const override;
58 
59  Q_SIGNALS:
60  void fireLastTypeChanged();
61 };
62 
63 } // namespace governikus
QHash< int, QByteArray > roleNames() const override
Definition: NotificationModel.cpp:81
QVariant data(const QModelIndex &pIndex, int pRole) const override
Definition: NotificationModel.cpp:60
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:14
Definition: NotificationModel.h:21
QString lastType
Definition: NotificationModel.h:28
Definition: Env.h:43
#define TYPE(x)
int rowCount(const QModelIndex &pIndex) const override
Definition: NotificationModel.cpp:53