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 {
101 };
102 Q_ENUM(Workflow)
103
104 enum class QmlNfcState
105 {
110 };
111 Q_ENUM(QmlNfcState)
112
113 void resetContext(const QSharedPointer<WorkflowContext>& pContext = QSharedPointer<WorkflowContext>());
114
115 [[nodiscard]] Q_INVOKABLE int randomInt(int pLowerBound, int pUpperBound) const;
116
117 [[nodiscard]] QString getStoreUrl() const;
118 [[nodiscard]] QUrl getReleaseNotesUrl() const;
119
120 [[nodiscard]] QmlNfcState getNfcState() const;
121 [[nodiscard]] bool isExtendedLengthApdusUnsupported() const;
122
123 [[nodiscard]] bool isWifiEnabled() const;
124 [[nodiscard]] qreal getScaleFactor() const;
125 void setScaleFactor(qreal pScaleFactor);
126
127 [[nodiscard]] Workflow getCurrentWorkflow() const;
128 [[nodiscard]] int getAvailableReader() const;
129
130 [[nodiscard]] QString getFeedback() const;
131
132 [[nodiscard]] Q_INVOKABLE bool isScreenReaderRunning() const;
133
134 [[nodiscard]] Q_INVOKABLE bool isReaderTypeAvailable(ReaderManagerPlugInType pPlugInType) const;
135
136 Q_INVOKABLE void enableWifi();
137
138 Q_INVOKABLE void setClipboardText(const QString& pText) const;
139 Q_INVOKABLE void showSettings(const Settings& pAction);
140 Q_INVOKABLE void showFeedback(const QString& pMessage, bool pReplaceExisting = false);
141 Q_INVOKABLE void keepScreenOn(bool pActive);
142 [[nodiscard]] Q_INVOKABLE QStringList getLicenseText() const;
143#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
144 [[nodiscard]] Q_INVOKABLE QString onlineHelpUrl(const QString& pHelpSectionName);
145 Q_INVOKABLE void openOnlineHelp(const QString& pHelpSectionName);
146 [[nodiscard]] Q_INVOKABLE QUrl getCustomConfigPath();
147 Q_INVOKABLE void saveEmbeddedConfig(const QUrl& pFilename);
148#endif
149 [[nodiscard]] Q_INVOKABLE QString stripHtmlTags(QString pString) const;
150#ifdef Q_OS_IOS
151 Q_INVOKABLE void showAppStoreRatingDialog();
152#endif
153
154 public Q_SLOTS:
155 Q_INVOKABLE void onShowNextFeedback();
156
157 Q_SIGNALS:
159
162
165
168
170
171 void fireApplicationStateChanged(bool pIsAppInForeground);
172};
173
174
175} // namespace governikus
Definition: ApplicationModel.h:31
Q_INVOKABLE void showFeedback(const QString &pMessage, bool pReplaceExisting=false)
Definition: ApplicationModel.cpp:302
Q_INVOKABLE void openOnlineHelp(const QString &pHelpSectionName)
Definition: ApplicationModel.cpp:410
QString storeUrl
Definition: ApplicationModel.h:35
Q_INVOKABLE QStringList getLicenseText() const
Definition: ApplicationModel.cpp:377
qreal getScaleFactor() const
Definition: ApplicationModel.cpp:191
bool isWifiEnabled() const
Definition: ApplicationModel.cpp:185
Q_INVOKABLE QString stripHtmlTags(QString pString) const
Definition: ApplicationModel.cpp:476
QUrl customConfigPath
Definition: ApplicationModel.h:50
Q_INVOKABLE bool isReaderTypeAvailable(ReaderManagerPlugInType pPlugInType) const
Definition: ApplicationModel.cpp:244
Q_INVOKABLE void saveEmbeddedConfig(const QUrl &pFilename)
Definition: ApplicationModel.cpp:425
Q_INVOKABLE int randomInt(int pLowerBound, int pUpperBound) const
Definition: ApplicationModel.cpp:102
Q_INVOKABLE QUrl getCustomConfigPath()
Definition: ApplicationModel.cpp:416
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:105
QmlNfcState nfcState
Definition: ApplicationModel.h:38
Workflow
Definition: ApplicationModel.h:95
Q_INVOKABLE void keepScreenOn(bool pActive)
Definition: ApplicationModel.cpp:354
bool wifiEnabled
Definition: ApplicationModel.h:42
void resetContext(const QSharedPointer< WorkflowContext > &pContext=QSharedPointer< WorkflowContext >())
Definition: ApplicationModel.cpp:84
QUrl getReleaseNotesUrl() const
Definition: ApplicationModel.cpp:130
QUrl releaseNotesUrl
Definition: ApplicationModel.h:36
Workflow getCurrentWorkflow() const
Definition: ApplicationModel.cpp:209
Q_INVOKABLE void enableWifi()
Definition: ApplicationModel.cpp:468
void onTranslationChanged()
Definition: ApplicationModel.cpp:462
Q_INVOKABLE QString onlineHelpUrl(const QString &pHelpSectionName)
Definition: ApplicationModel.cpp:404
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:284
int getAvailableReader() const
Definition: ApplicationModel.cpp:233
bool isExtendedLengthApdusUnsupported() const
Definition: ApplicationModel.cpp:167
bool extendedLengthApdusUnsupported
Definition: ApplicationModel.h:39
Q_INVOKABLE void setClipboardText(const QString &pText) const
Definition: ApplicationModel.cpp:296
void setScaleFactor(qreal pScaleFactor)
Definition: ApplicationModel.cpp:197
QmlNfcState getNfcState() const
Definition: ApplicationModel.cpp:138
QString getStoreUrl() const
Definition: ApplicationModel.cpp:109
Q_INVOKABLE bool isScreenReaderRunning() const
Definition: ApplicationModel.cpp:261
QString getFeedback() const
Definition: ApplicationModel.cpp:278
Definition: Env.h:46
Definition: WifiInfo.h:22
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16