ACF $AcfVersion:0$
CApplicationCompBase.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QtGlobal>
7#include <QtCore/QTimer>
8#if QT_VERSION >= 0x050000
9#include <QtWidgets/QApplication>
10#else
11#include <QtGui/QApplication>
12#endif
13
14// ACF includes
16#include <imod/TModelWrap.h>
18#include <ibase/IApplication.h>
22#include <iqtgui/IGuiObject.h>
23
24
25namespace iqtgui
26{
27
28
35 public QObject,
37 virtual public ibase::IApplication
38{
39 Q_OBJECT
40public:
42
43 I_BEGIN_BASE_COMPONENT(CApplicationCompBase);
44 I_REGISTER_INTERFACE(ibase::IApplication);
45 I_REGISTER_SUBELEMENT(RuntimeStatus);
46 I_REGISTER_SUBELEMENT_INTERFACE(RuntimeStatus, ibase::IRuntimeStatusProvider, ExtractRuntimeStatus);
47 I_REGISTER_SUBELEMENT_INTERFACE(RuntimeStatus, imod::IModel, ExtractRuntimeStatus);
48 I_REGISTER_SUBELEMENT_INTERFACE(RuntimeStatus, istd::IChangeable, ExtractRuntimeStatus);
49 I_ASSIGN(m_splashScreenCompPtr, "SplashScreen", "Splash screen shown before application is launched", false, "SplashScreen");
50 I_ASSIGN(m_applicationInfoCompPtr, "ApplicationInfo", "Application info used to set main window title", false, "ApplicationInfo");
51 I_ASSIGN(m_translationManagerCompPtr, "TranslationManager", "Translation manager", false, "TranslationManager");
52 I_ASSIGN(m_splashTimeAttrPtr, "SplashTime", "Minimal time splash screen will be shown", true, 2);
53 I_ASSIGN(m_styleSheetAttrPtr, "StyleSheet", "Style sheet for the GUI", false, "");
54 I_ASSIGN(m_iconPathAttrPtr, "IconPath", "file path for the application icon", true, ":/Icons/AcfLogo");
55 I_ASSIGN(m_titleFormatAttrPtr, "TitleFormat", "Describe format of title bar, tags:\n\t$(CompanyName) - name of company\n\t$(ProductName) - product name\n\t$(AppName) - application name\n\t$(AppSubName) - application sub name\n\t$(AppType) - type of application\n\t$(Version) - main application version", true, "$(AppName)");
56 I_ASSIGN_MULTI_0(m_componentsToInitializeCompPtr, "ComponentsToInitialize", "List of components to be initialized after creation of the application instance (QCoreApplication) and after the event loop was started", false);
57 I_ASSIGN_MULTI_0(m_componentsToPreInitializeCompPtr, "ComponentsToPreInitialize", "List of components to be initialized after creation of the application instance (QCoreApplication) but before the loop was started", false);
58 I_END_COMPONENT;
59
61
62 // reimplemented (ibase::IApplication)
63 virtual bool InitializeApplication(int argc, char** argv) override;
64 virtual QStringList GetApplicationArguments() const override;
65
66protected:
67 QApplication* GetQtApplication() const;
73
74 // reimplemented (icomp::CComponentBase)
75 virtual void OnComponentCreated() override;
76
77private:
78 class RuntimeStatus: public ibase::IRuntimeStatusProvider
79 {
80 public:
81 RuntimeStatus();
82
83 void SetRuntimeStatus(IRuntimeStatusProvider::RuntimeStatus runtimeStatus);
84
85 // reimplemented (ibase::IRuntimeStatusProvider)
86 virtual IRuntimeStatusProvider::RuntimeStatus GetRuntimeStatus() const override;
87
88 private:
89 IRuntimeStatusProvider::RuntimeStatus m_status;
90 };
91
92 // static template methods for sub element access
93 template <class InterfaceType>
94 static InterfaceType* ExtractRuntimeStatus(CApplicationCompBase& component)
95 {
96 return &component.m_runtimeStatus;
97 }
98
99protected:
101
102 I_REF(IGuiObject, m_splashScreenCompPtr);
103 I_REF(ibase::IApplicationInfo, m_applicationInfoCompPtr);
104 I_REF(iqt::ITranslationManager, m_translationManagerCompPtr);
105 I_ATTR(double, m_splashTimeAttrPtr);
106 I_ATTR(QString, m_styleSheetAttrPtr);
107 I_ATTR(QString, m_iconPathAttrPtr);
108 I_ATTR(QString, m_titleFormatAttrPtr);
109 I_MULTIREF(istd::IPolymorphic, m_componentsToInitializeCompPtr);
110 I_MULTIREF(istd::IPolymorphic, m_componentsToPreInitializeCompPtr);
111
114
116
118
119 QByteArray m_appStyle;
121
123};
124
125
126} // namespace iqtgui
127
128
129
Interface for the main entry point of a component-based application.
This interface provides some information about the application.
Provider of the run-time status.
Base class for component implementation.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:24
Common interface for the localization manager.
Standard component for a Qt based GUI application.
istd::TDelPtr< QApplication > m_applicationPtr
QApplication * GetQtApplication() const
virtual void OnComponentCreated() override
imod::TModelWrap< RuntimeStatus > m_runtimeStatus
istd::CGeneralTimeStamp m_splashScreenTimer
virtual bool InitializeApplication(int argc, char **argv) override
Initialize the application object.
virtual QStringList GetApplicationArguments() const override
Get the command line arguments of this application.
Common interface for GUI objects used in ACF component context.
Definition IGuiObject.h:133
A general time stamp implementation.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
Base interface for all used interfaces and implementations.
Pointer wrapper providing automatic deleting pointed object during destruction.
Definition TDelPtr.h:21
Standard GUI specific interfaces and components based on Qt.