AusweisApp2
ReaderModel.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
10 #include "SortedReaderModel.h"
11 
12 #include <QAbstractTableModel>
13 #include <QHash>
14 #include <QSet>
15 #include <QTime>
16 #include <QVector>
17 
18 
19 namespace governikus
20 {
21 
23  : public QAbstractListModel
24 {
25  Q_OBJECT
26 
29  Q_PROPERTY(SortedReaderModel * sortedModel READ getSortedModel CONSTANT)
30 
31  private:
32  QSet<const ReaderConfigurationInfo> mKnownDrivers;
33  QVector<ReaderConfigurationInfo> mConnectedReaders;
34  QTime mConnectedReadersUpdateTime;
35  SortedReaderModel mSortedModel;
36 
37  [[nodiscard]] QString getStatus(const ReaderConfigurationInfo& pReaderConfigurationInfo) const;
38  void collectReaderData();
39 
40  [[nodiscard]] bool indexIsValid(const QModelIndex& pIndex) const;
41 
42  [[nodiscard]] QUrl getReaderImageUrl(const QModelIndex& pIndex) const;
43 
44  public:
45  enum UserRoles
46  {
47  READER_NAME = Qt::UserRole + 1,
54  };
55  explicit ReaderModel(QObject* pParent = nullptr);
56 
57  [[nodiscard]] int rowCount(const QModelIndex& pParent = QModelIndex()) const override;
58  [[nodiscard]] QVariant data(const QModelIndex& pIndex, int pRole = Qt::DisplayRole) const override;
59  [[nodiscard]] QHash<int, QByteArray> roleNames() const override;
60 
61  [[nodiscard]] QString getHTMLDescription(const QModelIndex& pIndex) const;
62  [[nodiscard]] QString getEmptyListDescriptionString() const;
63  [[nodiscard]] bool isSupportedReader(const QModelIndex& pIndex) const;
64  [[nodiscard]] bool isInstalledReader(const QModelIndex& pIndex) const;
65  [[nodiscard]] QString getLastUpdatedInformation() const;
66 
67  [[nodiscard]] SortedReaderModel* getSortedModel();
68 
69  private Q_SLOTS:
70  void onUpdateContent();
71 
72  public Q_SLOTS:
73  void onTranslationChanged();
74 
75  Q_SIGNALS:
77 };
78 
79 
80 } // namespace governikus
Definition: ReaderConfigurationInfo.h:19
Definition: ReaderModel.h:24
QVariant data(const QModelIndex &pIndex, int pRole=Qt::DisplayRole) const override
Definition: ReaderModel.cpp:121
ReaderModel(QObject *pParent=nullptr)
Definition: ReaderModel.cpp:23
QString getLastUpdatedInformation() const
Definition: ReaderModel.cpp:251
QString getHTMLDescription(const QModelIndex &pIndex) const
Definition: ReaderModel.cpp:173
QString lastUpdatedInformation
Definition: ReaderModel.h:28
int rowCount(const QModelIndex &pParent=QModelIndex()) const override
Definition: ReaderModel.cpp:115
QString emptyListDescriptionString
Definition: ReaderModel.h:27
bool isInstalledReader(const QModelIndex &pIndex) const
Definition: ReaderModel.cpp:239
bool isSupportedReader(const QModelIndex &pIndex) const
Definition: ReaderModel.cpp:227
UserRoles
Definition: ReaderModel.h:46
@ READER_NAME
Definition: ReaderModel.h:47
@ READER_STATUS
Definition: ReaderModel.h:48
@ READER_HTML_DESCRIPTION
Definition: ReaderModel.h:50
@ READER_SUPPORTED
Definition: ReaderModel.h:53
@ READER_IMAGE_PATH
Definition: ReaderModel.h:49
@ READER_DRIVER_URL
Definition: ReaderModel.h:51
@ READER_INSTALLED
Definition: ReaderModel.h:52
SortedReaderModel * getSortedModel()
Definition: ReaderModel.cpp:264
QHash< int, QByteArray > roleNames() const override
Definition: ReaderModel.cpp:155
QString getEmptyListDescriptionString() const
Definition: ReaderModel.cpp:216
SortedReaderModel * sortedModel
Definition: ReaderModel.h:29
void onTranslationChanged()
Definition: ReaderModel.cpp:109
Definition: SortedReaderModel.h:14
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16