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
governikus::NotificationModel::getInstance
static NotificationModel & getInstance()
Definition: NotificationModel.cpp:59
LogModel.h
governikus::NotificationModel
Definition: NotificationModel.h:23
governikus::NotificationModel::data
QVariant data(const QModelIndex &pIndex, int pRole) const override
Definition: NotificationModel.cpp:72
LogHandler.h
governikus::NotificationModel::roleNames
QHash< int, QByteArray > roleNames() const override
Definition: NotificationModel.cpp:93
governikus::NotificationModel::lastType
QString lastType
Definition: NotificationModel.h:28
governikus::Env
Definition: Env.h:39
TYPE
#define TYPE(x)
governikus::LogHandler::fireRawLog
void fireRawLog(const QString &pMsg, const QString &pCategoryName)
governikus
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15
governikus::NotificationModel::fireLastTypeChanged
void fireLastTypeChanged()
Env.h
governikus::LogModel::mailLog
Q_INVOKABLE void mailLog(const QString &pEmail=tr("support.ausweisapp2@governikus.de"), const QString &pSubject=tr("Mobile logfile"), const QString &pMsg=tr("<Please describe the error>"))
Definition: LogModel_android.cpp:70
NotificationModel.h
governikus::LogModel::shareLog
Q_INVOKABLE void shareLog(QPoint popupPosition)
popupPosition will be used on an iPad as the origin of the share bubble
Definition: LogModel_android.cpp:115
governikus::NotificationModel::rowCount
int rowCount(const QModelIndex &pIndex) const override
Definition: NotificationModel.cpp:65
defineSingleton
defineSingleton(NotificationModel) QString NotificationModel
Definition: NotificationModel.cpp:16
governikus::LogModel::createLogFileName
static Q_INVOKABLE QString createLogFileName(const QDateTime &pDateTime=QDateTime::currentDateTime())
Definition: LogModel.cpp:260
governikus::NotificationModel::NotificationModel
NotificationModel()
Definition: NotificationModel.cpp:51
SingletonHelper.h