AusweisApp2
ApplicationModel.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
10 #include "Env.h"
11 #include "ReaderInfo.h"
13 #include "WifiInfo.h"
14 
15 #include <QObject>
16 #include <QQmlEngine>
17 #include <QSharedPointer>
18 #include <QStringList>
19 #include <QTimer>
20 
21 #ifdef Q_OS_IOS
22 Q_FORWARD_DECLARE_OBJC_CLASS(VoiceOverObserver);
23 #endif
24 
25 namespace governikus
26 {
27 
29  : public QObject
30 {
31  Q_OBJECT
32  friend class Env;
33 
34  Q_PROPERTY(QString packageName READ getPackageName CONSTANT)
35  Q_PROPERTY(QUrl releaseNotesUrl READ getReleaseNotesUrl CONSTANT)
36 
37  Q_PROPERTY(bool nfcEnabled READ isNfcEnabled NOTIFY fireNfcEnabledChanged)
38  Q_PROPERTY(bool nfcAvailable READ isNfcAvailable CONSTANT)
39  Q_PROPERTY(bool nfcRunning READ isNfcRunning WRITE setNfcRunning NOTIFY fireNfcRunningChanged)
41 
44  Q_PROPERTY(bool bluetoothAvailable READ isBluetoothAvailable CONSTANT)
46 
47  Q_PROPERTY(qreal scaleFactor READ getScaleFactor WRITE setScaleFactor NOTIFY fireScaleFactorChanged)
48  Q_PROPERTY(bool wifiEnabled READ isWifiEnabled NOTIFY fireWifiEnabledChanged)
49 
50  Q_PROPERTY(QString currentWorkflow READ getCurrentWorkflow NOTIFY fireCurrentWorkflowChanged)
52 
53  Q_PROPERTY(QString feedback READ getFeedback NOTIFY fireFeedbackChanged)
54 
55  QSharedPointer<WorkflowContext> mContext;
56 
57  void onStatusChanged(const ReaderManagerPlugInInfo& pInfo);
58  ReaderManagerPlugInInfo getFirstPlugInInfo(ReaderManagerPlugInType pType) const;
59 
60  private:
61  constexpr static qreal DEFAULT_SCALE_FACTOR = 0.6;
62  qreal mScaleFactor;
63  WifiInfo mWifiInfo;
64  bool mWifiEnabled;
65  bool mBluetoothResponding;
66  QStringList mFeedback;
67  QTimer mFeedbackTimer;
68  const int mFeedbackDisplayLength;
69 #ifdef Q_OS_IOS
70  struct Private
71  {
72  Private();
73  ~Private();
74  VoiceOverObserver* const mObserver;
75  };
76  const QScopedPointer<Private> mPrivate;
77 #endif
78 
79  private Q_SLOTS:
80  void onWifiEnabledChanged();
81 
82  protected:
84  ~ApplicationModel() override = default;
85  static ApplicationModel& getInstance();
86 
87  public:
88  enum class Settings
89  {
94  };
95  Q_ENUM(Settings)
96 
97  void resetContext(const QSharedPointer<WorkflowContext>& pContext = QSharedPointer<WorkflowContext>());
98 
99  QString getPackageName() const;
100  QUrl getReleaseNotesUrl() const;
101 
102  bool isNfcAvailable() const;
103  bool isNfcEnabled() const;
104  bool isNfcRunning() const;
105  void setNfcRunning(bool pRunning);
107 
108  bool isBluetoothAvailable() const;
109  bool isBluetoothResponding() const;
110  bool isBluetoothEnabled() const;
111  void setBluetoothEnabled(bool pEnabled);
112  bool locationPermissionRequired() const;
113 
114  bool isWifiEnabled() const;
115  qreal getScaleFactor() const;
116  void setScaleFactor(qreal pScaleFactor);
117 
118  QString getCurrentWorkflow() const;
119  int getAvailableReader() const;
120 
121  QString getFeedback() const;
122 
123  Q_INVOKABLE bool isScreenReaderRunning() const;
124 
125  Q_INVOKABLE void stopNfcScanWithError(const QString& pError) const;
126 
127  Q_INVOKABLE bool isReaderTypeAvailable(ReaderManagerPlugInType pPlugInType) const;
128 
129  Q_INVOKABLE void enableWifi();
130 
131  Q_INVOKABLE void showSettings(const Settings& pAction);
132  Q_INVOKABLE void showSettings(const QString& pAction);
133  Q_INVOKABLE void showFeedback(const QString& pMessage, bool pReplaceExisting = false);
134  Q_INVOKABLE void keepScreenOn(bool pActive);
135 #if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
136  Q_INVOKABLE QString onlineHelpUrl(const QString& pHelpSectionName);
137  Q_INVOKABLE void openOnlineHelp(const QString& pHelpSectionName);
138 #endif
139  Q_INVOKABLE QString stripHtmlTags(QString pString) const;
140 #ifdef Q_OS_IOS
141  Q_INVOKABLE void showAppStoreRatingDialog();
142 #endif
143 
144  public Q_SLOTS:
145  Q_INVOKABLE void onShowNextFeedback();
146 
147  Q_SIGNALS:
151 
155 
158 
161  void fireCertificateRemoved(const QString& pDeviceName);
162 
164 };
165 
166 
167 } // namespace governikus
governikus::ApplicationModel::showSettings
Q_INVOKABLE void showSettings(const Settings &pAction)
Definition: ApplicationModel.cpp:341
AuthContext.h
ReaderManager.h
governikus::ApplicationModel::bluetoothEnabled
bool bluetoothEnabled
Definition: ApplicationModel.h:42
governikus::ApplicationModel::Settings::SETTING_NFC
@ SETTING_NFC
governikus::ApplicationModel::extendedLengthApdusUnsupported
bool extendedLengthApdusUnsupported
Definition: ApplicationModel.h:40
governikus::ApplicationModel::nfcEnabled
bool nfcEnabled
Definition: ApplicationModel.h:37
governikus::WifiInfo
Definition: WifiInfo.h:24
ReaderManagerPlugInInfo.h
governikus::ApplicationModel::isWifiEnabled
bool isWifiEnabled() const
Definition: ApplicationModel.cpp:272
governikus::AuthContext
Definition: AuthContext.h:48
governikus::ApplicationModel::scaleFactor
qreal scaleFactor
Definition: ApplicationModel.h:47
governikus::WifiInfo::isWifiEnabled
bool isWifiEnabled()
Definition: WifiInfo_android.cpp:71
governikus::ApplicationModel::packageName
QString packageName
Definition: ApplicationModel.h:34
governikus::HelpAction::openContextHelp
static void openContextHelp(const QString &pObjectName=QStringLiteral("applicationPage"), bool pWidgetUiHelp=true)
Definition: HelpAction.cpp:145
governikus::ApplicationModel::getFeedback
QString getFeedback() const
Definition: ApplicationModel.cpp:437
VersionNumber.h
governikus::ApplicationModel::stripHtmlTags
Q_INVOKABLE QString stripHtmlTags(QString pString) const
Definition: ApplicationModel.cpp:570
governikus::ApplicationModel::setNfcRunning
void setNfcRunning(bool pRunning)
Definition: ApplicationModel.cpp:178
governikus::ReaderInfo
Definition: ReaderInfo.h:17
AppSettings.h
governikus::ApplicationModel::getReleaseNotesUrl
QUrl getReleaseNotesUrl() const
Definition: ApplicationModel.cpp:126
governikus::ApplicationModel::fireCertificateRemoved
void fireCertificateRemoved(const QString &pDeviceName)
ReaderInfo.h
WifiInfo.h
governikus::ChangePinContext
Definition: ChangePinContext.h:16
SecureStorage.h
HelpAction.h
governikus::ReaderManager::fireReaderAdded
void fireReaderAdded(const QString &pReaderName)
governikus::ReaderInfo::sufficientApduLength
bool sufficientApduLength() const
Definition: ReaderInfo.h:143
governikus::WorkflowContext::fireReaderPlugInTypesChanged
void fireReaderPlugInTypesChanged()
governikus::ApplicationModel::showFeedback
Q_INVOKABLE void showFeedback(const QString &pMessage, bool pReplaceExisting=false)
Definition: ApplicationModel.cpp:455
WorkflowContext.h
governikus::WorkflowContext::fireReaderNameChanged
void fireReaderNameChanged()
governikus::ApplicationModel::Settings::SETTING_BLUETOOTH
@ SETTING_BLUETOOTH
RemoteClient.h
governikus::ApplicationModel::onlineHelpUrl
Q_INVOKABLE QString onlineHelpUrl(const QString &pHelpSectionName)
Definition: ApplicationModel.cpp:532
governikus::ApplicationModel::fireBluetoothEnabledChanged
void fireBluetoothEnabledChanged()
governikus::ApplicationModel::nfcAvailable
bool nfcAvailable
Definition: ApplicationModel.h:38
governikus::ApplicationModel::isBluetoothResponding
bool isBluetoothResponding() const
Definition: ApplicationModel.cpp:227
governikus::WorkflowContext::fireReaderInfoChanged
void fireReaderInfoChanged()
governikus::ApplicationModel::getScaleFactor
qreal getScaleFactor() const
Definition: ApplicationModel.cpp:278
governikus::VersionNumber::isDeveloperVersion
bool isDeveloperVersion() const
Definition: VersionNumber.cpp:40
governikus::Env
Definition: Env.h:39
governikus::ApplicationModel::fireBluetoothRespondingChanged
void fireBluetoothRespondingChanged()
defineSingleton
defineSingleton(ApplicationModel) void ApplicationModel
Definition: ApplicationModel.cpp:45
governikus::ApplicationModel::feedback
QString feedback
Definition: ApplicationModel.h:53
governikus::RemoteClient::fireCertificateRemoved
void fireCertificateRemoved(const QString &pDeviceName)
governikus::ApplicationModel::getCurrentWorkflow
QString getCurrentWorkflow() const
Definition: ApplicationModel.cpp:296
governikus::ApplicationModel::ApplicationModel
ApplicationModel()
Definition: ApplicationModel.cpp:63
PdfExporter.h
governikus::ApplicationModel::bluetoothAvailable
bool bluetoothAvailable
Definition: ApplicationModel.h:44
ChangePinContext.h
governikus::ApplicationModel::keepScreenOn
Q_INVOKABLE void keepScreenOn(bool pActive)
Definition: ApplicationModel.cpp:508
governikus::ApplicationModel::Settings
Settings
Definition: ApplicationModel.h:89
governikus::ApplicationModel::isNfcRunning
bool isNfcRunning() const
Definition: ApplicationModel.cpp:172
governikus::ApplicationModel::Settings::SETTING_NETWORK
@ SETTING_NETWORK
governikus::ApplicationModel::isNfcEnabled
bool isNfcEnabled() const
Definition: ApplicationModel.cpp:160
governikus::ApplicationModel::currentWorkflow
QString currentWorkflow
Definition: ApplicationModel.h:50
governikus::ApplicationModel::fireNfcEnabledChanged
void fireNfcEnabledChanged()
governikus::ApplicationModel::getAvailableReader
int getAvailableReader() const
Definition: ApplicationModel.cpp:314
governikus
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15
governikus::ApplicationModel::fireBluetoothReaderChanged
void fireBluetoothReaderChanged()
BuildHelper.h
governikus::ApplicationModel::fireNfcRunningChanged
void fireNfcRunningChanged()
governikus::WifiInfo::fireWifiEnabledChanged
void fireWifiEnabledChanged(bool pEnabled)
governikus::SelfAuthContext
Definition: SelfAuthContext.h:18
governikus::ApplicationModel::setScaleFactor
void setScaleFactor(qreal pScaleFactor)
Definition: ApplicationModel.cpp:284
governikus::ApplicationModel::fireAvailableReaderChanged
void fireAvailableReaderChanged()
SelfAuthContext.h
governikus::ApplicationModel::onShowNextFeedback
Q_INVOKABLE void onShowNextFeedback()
Definition: ApplicationModel.cpp:443
governikus::ApplicationModel::isNfcAvailable
bool isNfcAvailable() const
Definition: ApplicationModel.cpp:148
governikus::ApplicationModel::getPackageName
QString getPackageName() const
Definition: ApplicationModel.cpp:114
governikus::ApplicationModel::locationPermissionRequired
bool locationPermissionRequired
Definition: ApplicationModel.h:45
governikus::ApplicationModel::isBluetoothAvailable
bool isBluetoothAvailable() const
Definition: ApplicationModel.cpp:221
Env.h
governikus::ApplicationModel::isBluetoothEnabled
bool isBluetoothEnabled() const
Definition: ApplicationModel.cpp:233
governikus::ApplicationModel::stopNfcScanWithError
Q_INVOKABLE void stopNfcScanWithError(const QString &pError) const
Definition: ApplicationModel.cpp:214
governikus::ApplicationModel::bluetoothResponding
bool bluetoothResponding
Definition: ApplicationModel.h:43
governikus::ApplicationModel::isExtendedLengthApdusUnsupported
bool isExtendedLengthApdusUnsupported() const
Definition: ApplicationModel.cpp:195
governikus::VersionNumber::getApplicationVersion
static const VersionNumber & getApplicationVersion()
Definition: VersionNumber.cpp:28
governikus::ApplicationModel::getInstance
static ApplicationModel & getInstance()
Definition: ApplicationModel.cpp:564
governikus::ApplicationModel::resetContext
void resetContext(const QSharedPointer< WorkflowContext > &pContext=QSharedPointer< WorkflowContext >())
Definition: ApplicationModel.cpp:96
governikus::ApplicationModel::setBluetoothEnabled
void setBluetoothEnabled(bool pEnabled)
Definition: ApplicationModel.cpp:239
governikus::ReaderManager::fireReaderPropertiesUpdated
void fireReaderPropertiesUpdated(const QString &pReaderName)
governikus::ApplicationModel::releaseNotesUrl
QUrl releaseNotesUrl
Definition: ApplicationModel.h:35
ApplicationModel.h
governikus::ApplicationModel::fireReaderPropertiesUpdated
void fireReaderPropertiesUpdated()
governikus::ReaderFilter
Definition: ReaderFilter.h:21
governikus::ReaderManager::fireStatusChanged
void fireStatusChanged(const ReaderManagerPlugInInfo &pInfo)
governikus::ApplicationModel::nfcRunning
bool nfcRunning
Definition: ApplicationModel.h:39
governikus::ReaderManager::fireReaderRemoved
void fireReaderRemoved(const QString &pReaderName)
governikus::ApplicationModel::Settings::SETTING_WIFI
@ SETTING_WIFI
governikus::ApplicationModel::fireCurrentWorkflowChanged
void fireCurrentWorkflowChanged()
governikus::ApplicationModel::enableWifi
Q_INVOKABLE void enableWifi()
Definition: ApplicationModel.cpp:554
governikus::ApplicationModel::fireFeedbackChanged
void fireFeedbackChanged()
governikus::ApplicationModel::fireScaleFactorChanged
void fireScaleFactorChanged()
governikus::ApplicationModel::wifiEnabled
bool wifiEnabled
Definition: ApplicationModel.h:48
governikus::ApplicationModel::availableReader
int availableReader
Definition: ApplicationModel.h:51
governikus::ApplicationModel::isReaderTypeAvailable
Q_INVOKABLE bool isReaderTypeAvailable(ReaderManagerPlugInType pPlugInType) const
Definition: ApplicationModel.cpp:325
governikus::HelpAction::getOnlineUrl
static QString getOnlineUrl(const QString &pObjectName=QString(), bool pWidgetUiHelp=true)
Definition: HelpAction.cpp:128
governikus::ApplicationModel::isScreenReaderRunning
Q_INVOKABLE bool isScreenReaderRunning() const
Definition: ApplicationModel.cpp:421
governikus::ApplicationModel::fireWifiEnabledChanged
void fireWifiEnabledChanged()
governikus::ApplicationModel::~ApplicationModel
~ApplicationModel() override=default
SingletonHelper.h
governikus::ApplicationModel::openOnlineHelp
Q_INVOKABLE void openOnlineHelp(const QString &pHelpSectionName)
Definition: ApplicationModel.cpp:538
governikus::ApplicationModel
Definition: ApplicationModel.h:30