AusweisApp2
AppController.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "EnumHelper.h"
10 #include "UIPlugIn.h"
11 #include "WorkflowRequest.h"
12 
13 #include <QAbstractNativeEventFilter>
14 #include <QAuthenticator>
15 #include <QNetworkProxy>
16 #include <QSharedPointer>
17 
18 class test_AppController;
19 
20 namespace governikus
21 {
22 class WorkflowController;
23 class CommandLineParser;
24 
25 class AppController final
26  : public QObject
27  , public QAbstractNativeEventFilter
28 {
29  Q_OBJECT
30  Q_DISABLE_COPY(AppController)
31  friend class ::test_AppController;
32  friend int initApp(int&, char**);
33  friend class CommandLineParser;
34 
35  private:
36  static bool cShowUi;
37  QSharedPointer<WorkflowRequest> mActiveWorkflow;
38  QSharedPointer<WorkflowRequest> mWaitingRequest;
39  bool mShutdownRunning;
40  const UIPlugIn* mUiDomination;
41  bool mRestartApplication;
42  int mExitCode;
43 
44  [[nodiscard]] bool canStartNewWorkflow() const;
45  void completeShutdown();
46  void waitForNetworkConnections(const std::function<void()>& pExitFunc);
47 
48  public:
49  AppController();
50 
51  bool eventFilter(QObject* pObj, QEvent* pEvent) override;
52 
53 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
54  bool nativeEventFilter(const QByteArray& pEventType, void* pMessage, qintptr* pResult) override;
55 #else
56  bool nativeEventFilter(const QByteArray& pEventType, void* pMessage, long* pResult) override;
57 #endif
58 
59  void start();
60 
61  [[nodiscard]] bool shouldApplicationRestart() const;
62 
63  Q_SIGNALS:
65  void fireStarted();
66  void fireShutdown();
67  void fireWorkflowStarted(QSharedPointer<WorkflowContext> pContext);
68  void fireWorkflowFinished(QSharedPointer<WorkflowContext> pContext);
69  void fireShowUi(UiModule pModule);
70  void fireHideUi();
71  void fireShowUserInformation(const QString& pInformationMessage);
73  void fireProxyAuthenticationRequired(const QNetworkProxy& pProxy, QAuthenticator* pAuthenticator);
75  void fireUiDomination(const UIPlugIn* pUi, const QString& pInformation, bool pAccepted);
77 
78  private Q_SLOTS:
79  void doShutdown(int pExitCode = EXIT_SUCCESS);
80  void onUiPlugin(const UIPlugIn* pPlugin);
81  void onWorkflowFinished();
82  void onWorkflowRequested(const QSharedPointer<WorkflowRequest>& pRequest);
83  void onCloseReminderFinished(bool pDontRemindAgain);
84  void onLanguageChanged();
85  void onUiDominationRequested(const UIPlugIn* pUi, const QString& pInformation);
86  void onUiDominationRelease();
87  void onRestartApplicationRequested();
88 
89  private:
90  bool startNewWorkflow(const QSharedPointer<WorkflowRequest>& pRequest);
91  static void clearCacheFolders();
92 
93 };
94 
95 } // namespace governikus
Definition: AppController.h:28
bool nativeEventFilter(const QByteArray &pEventType, void *pMessage, qintptr *pResult) override
Definition: AppController.cpp:495
bool shouldApplicationRestart() const
Definition: AppController.cpp:174
void fireWorkflowStarted(QSharedPointer< WorkflowContext > pContext)
void fireWorkflowFinished(QSharedPointer< WorkflowContext > pContext)
void fireProxyAuthenticationRequired(const QNetworkProxy &pProxy, QAuthenticator *pAuthenticator)
void fireShowUserInformation(const QString &pInformationMessage)
void start()
Definition: AppController.cpp:110
friend int initApp(int &, char **)
bool eventFilter(QObject *pObj, QEvent *pEvent) override
Definition: AppController.cpp:81
void fireShowUi(UiModule pModule)
void fireUiDomination(const UIPlugIn *pUi, const QString &pInformation, bool pAccepted)
Definition: CommandLineParser.h:16
Definition: WorkflowRequest.h:25
Implementation of GeneralAuthenticate response APDUs.
Definition: CommandApdu.h:16