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