AusweisApp2
Lade ...
Suche ...
Keine Treffer
ApplicationModel.h
gehe zur Dokumentation dieser Datei
1
9#pragma once
10
11#include "Env.h"
13#include "WifiInfo.h"
15
16#include <QObject>
17#include <QQmlEngine>
18#include <QSharedPointer>
19#include <QStringList>
20#include <QTimer>
21
22#ifdef Q_OS_IOS
23Q_FORWARD_DECLARE_OBJC_CLASS(VoiceOverObserver);
24#endif
25
26namespace governikus
27{
28
30 : public QObject
31{
32 Q_OBJECT
33 friend class Env;
34
35 Q_PROPERTY(QString storeUrl READ getStoreUrl NOTIFY fireStoreUrlChanged)
36 Q_PROPERTY(QUrl releaseNotesUrl READ getReleaseNotesUrl CONSTANT)
37
40
41 Q_PROPERTY(qreal scaleFactor READ getScaleFactor WRITE setScaleFactor NOTIFY fireScaleFactorChanged)
42 Q_PROPERTY(bool wifiEnabled READ isWifiEnabled NOTIFY fireWifiEnabledChanged)
43
46
47 Q_PROPERTY(QString feedback READ getFeedback NOTIFY fireFeedbackChanged)
48
49#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
50 Q_PROPERTY(QUrl customConfigPath READ getCustomConfigPath CONSTANT)
51#endif
52
53 private:
54 QSharedPointer<WorkflowContext> mContext;
55 constexpr static qreal DEFAULT_SCALE_FACTOR = 0.6;
56 qreal mScaleFactor;
57 WifiInfo mWifiInfo;
58 bool mWifiEnabled;
59 QStringList mFeedback;
60 QTimer mFeedbackTimer;
61 const int mFeedbackDisplayLength;
62 bool mIsAppInForeground;
63#ifdef Q_OS_IOS
64 struct Private
65 {
66 Private();
67 ~Private();
68 VoiceOverObserver* const mObserver;
69 };
70 const QScopedPointer<Private> mPrivate;
71#endif
72
74 ~ApplicationModel() override = default;
75 void onStatusChanged(const ReaderManagerPlugInInfo& pInfo);
76
77 private Q_SLOTS:
78 void onApplicationStateChanged(Qt::ApplicationState pState);
79 void onWifiEnabledChanged();
80
81 public Q_SLOTS:
83
84 public:
85 enum class Settings
86 {
91 };
92 Q_ENUM(Settings)
93
94 enum class Workflow
95 {
102 };
103 Q_ENUM(Workflow)
104
105 enum class QmlNfcState
106 {
111 };
112 Q_ENUM(QmlNfcState)
113
114 void resetContext(const QSharedPointer<WorkflowContext>& pContext = QSharedPointer<WorkflowContext>());
115
116 [[nodiscard]] Q_INVOKABLE int randomInt(int pLowerBound, int pUpperBound) const;
117
118 [[nodiscard]] QString getStoreUrl() const;
119 [[nodiscard]] QUrl getReleaseNotesUrl() const;
120
121 [[nodiscard]] QmlNfcState getNfcState() const;
122 [[nodiscard]] bool isExtendedLengthApdusUnsupported() const;
123
124 [[nodiscard]] bool isWifiEnabled() const;
125 [[nodiscard]] qreal getScaleFactor() const;
126 void setScaleFactor(qreal pScaleFactor);
127
128 [[nodiscard]] Workflow getCurrentWorkflow() const;
129 [[nodiscard]] int getAvailableReader() const;
130
131 [[nodiscard]] QString getFeedback() const;
132
133 [[nodiscard]] Q_INVOKABLE bool isScreenReaderRunning() const;
134
135 [[nodiscard]] Q_INVOKABLE bool isReaderTypeAvailable(ReaderManagerPlugInType pPlugInType) const;
136
137 Q_INVOKABLE void enableWifi();
138
139 Q_INVOKABLE void setClipboardText(const QString& pText) const;
140 Q_INVOKABLE void showSettings(const Settings& pAction);
141 Q_INVOKABLE void showFeedback(const QString& pMessage, bool pReplaceExisting = false);
142 Q_INVOKABLE void keepScreenOn(bool pActive);
143 [[nodiscard]] Q_INVOKABLE QStringList getLicenseText() const;
144#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
145 [[nodiscard]] Q_INVOKABLE QString onlineHelpUrl(const QString& pHelpSectionName);
146 Q_INVOKABLE void openOnlineHelp(const QString& pHelpSectionName);
147 [[nodiscard]] Q_INVOKABLE QUrl getCustomConfigPath();
148 Q_INVOKABLE void saveEmbeddedConfig(const QUrl& pFilename);
149#endif
150 [[nodiscard]] Q_INVOKABLE QString stripHtmlTags(QString pString) const;
151#ifdef Q_OS_IOS
152 Q_INVOKABLE void showAppStoreRatingDialog();
153#endif
154
155 public Q_SLOTS:
156 Q_INVOKABLE void onShowNextFeedback();
157
158 Q_SIGNALS:
160
163
166
169
171
172 void fireApplicationStateChanged(bool pIsAppInForeground);
173};
174
175
176} // namespace governikus
Definition: ApplicationModel.h:31
Q_INVOKABLE void showFeedback(const QString &pMessage, bool pReplaceExisting=false)
Definition: ApplicationModel.cpp:307
Q_INVOKABLE void openOnlineHelp(const QString &pHelpSectionName)
Definition: ApplicationModel.cpp:415
QString storeUrl
Definition: ApplicationModel.h:35
Q_INVOKABLE QStringList getLicenseText() const
Definition: ApplicationModel.cpp:382
qreal getScaleFactor() const
Definition: ApplicationModel.cpp:192
bool isWifiEnabled() const
Definition: ApplicationModel.cpp:186
Q_INVOKABLE QString stripHtmlTags(QString pString) const
Definition: ApplicationModel.cpp:481
QUrl customConfigPath
Definition: ApplicationModel.h:50
Q_INVOKABLE bool isReaderTypeAvailable(ReaderManagerPlugInType pPlugInType) const
Definition: ApplicationModel.cpp:249
Q_INVOKABLE void saveEmbeddedConfig(const QUrl &pFilename)
Definition: ApplicationModel.cpp:430
Q_INVOKABLE int randomInt(int pLowerBound, int pUpperBound) const
Definition: ApplicationModel.cpp:103
Q_INVOKABLE QUrl getCustomConfigPath()
Definition: ApplicationModel.cpp:421
Settings
Definition: ApplicationModel.h:86
QString feedback
Definition: ApplicationModel.h:47
void fireApplicationStateChanged(bool pIsAppInForeground)
qreal scaleFactor
Definition: ApplicationModel.h:41
QmlNfcState
Definition: ApplicationModel.h:106
QmlNfcState nfcState
Definition: ApplicationModel.h:38
Workflow
Definition: ApplicationModel.h:95
Q_INVOKABLE void keepScreenOn(bool pActive)
Definition: ApplicationModel.cpp:359
bool wifiEnabled
Definition: ApplicationModel.h:42
void resetContext(const QSharedPointer< WorkflowContext > &pContext=QSharedPointer< WorkflowContext >())
Definition: ApplicationModel.cpp:85
QUrl getReleaseNotesUrl() const
Definition: ApplicationModel.cpp:131
QUrl releaseNotesUrl
Definition: ApplicationModel.h:36
Workflow getCurrentWorkflow() const
Definition: ApplicationModel.cpp:210
Q_INVOKABLE void enableWifi()
Definition: ApplicationModel.cpp:473
void onTranslationChanged()
Definition: ApplicationModel.cpp:467
Q_INVOKABLE QString onlineHelpUrl(const QString &pHelpSectionName)
Definition: ApplicationModel.cpp:409
int availableReader
Definition: ApplicationModel.h:45
Q_INVOKABLE void showSettings(const Settings &pAction)
Definition: ApplicationModel_android.cpp:40
Workflow currentWorkflow
Definition: ApplicationModel.h:44
Q_INVOKABLE void onShowNextFeedback()
Definition: ApplicationModel.cpp:289
int getAvailableReader() const
Definition: ApplicationModel.cpp:238
bool isExtendedLengthApdusUnsupported() const
Definition: ApplicationModel.cpp:168
bool extendedLengthApdusUnsupported
Definition: ApplicationModel.h:39
Q_INVOKABLE void setClipboardText(const QString &pText) const
Definition: ApplicationModel.cpp:301
void setScaleFactor(qreal pScaleFactor)
Definition: ApplicationModel.cpp:198
QmlNfcState getNfcState() const
Definition: ApplicationModel.cpp:139
QString getStoreUrl() const
Definition: ApplicationModel.cpp:110
Q_INVOKABLE bool isScreenReaderRunning() const
Definition: ApplicationModel.cpp:266
QString getFeedback() const
Definition: ApplicationModel.cpp:283
Definition: Env.h:46
Definition: WifiInfo.h:22
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16