ADTF Qt5
Loading...
Searching...
No Matches
qt_ui_service.h
Go to the documentation of this file.
1
7
8/*
9 * This file depends on Qt which is licensed under LGPLv3.
10 * See ADTF_DIR/3rdparty/qt5 and doc/license for detailed information.
11 */
12#pragma once
13#include "qtxsystem_intf.h"
14#include "xsystem_qtwindow.h"
15
16#include <adtf_utils.h>
17#include <adtfucom3/adtf_ucom3.h>
18#include <adtfstreaming3/graph_element_editors.h>
19#include <adtfsystemsdk/adtf_service.h>
20
21namespace adtf
22{
23namespace ui
24{
25namespace ant
26{
33template<typename SERVICEBASECLASS>
34class qt_ui_service : public SERVICEBASECLASS, public cQtWindow
35{
37 adtf::ucom::object_ptr<adtf::ui::ant::IQtXSystem> m_pXSystem;
38
39public:
43 {
44 m_strTitle.SetDescription("Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
45 SERVICEBASECLASS::RegisterPropertyVariable("title", m_strTitle);
46 }
47
48 ~qt_ui_service() = default;
54 tResult ServiceInit() override
55 {
56 RETURN_IF_FAILED(_runtime->GetObject(m_pXSystem));
57 adtf::util::cString strTitle = m_strTitle;
58 if (strTitle.IsEmpty())
59 {
60 strTitle = SERVICEBASECLASS::GetOID();
61 m_strTitle = strTitle;
62 }
63 return m_pXSystem->CreateWindow(*this);
64 }
65
70 tResult ServiceShutdown() override
71 {
72 RETURN_IF_POINTER_NULL(m_pXSystem);
73 return m_pXSystem->DestroyWindow(*this);
74 }
75};
76
81} // namespace ant
82
83namespace riddler
84{
85
94template<typename SERVICEBASECLASS>
95class qt_ui_service : public SERVICEBASECLASS, public ant::cQtWindow, public IQtXSystem::IWindowState
96{
97public:
101 {
102 m_strTitle.SetDescription("Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
103 SERVICEBASECLASS::RegisterPropertyVariable("title", m_strTitle);
104 }
105
106 ~qt_ui_service() override = default;
107
113 tResult ServiceInit() override
114 {
115 RETURN_IF_FAILED(_runtime->GetObject(m_pXSystem));
116 if ((*m_strTitle).IsEmpty())
117 {
118 m_strTitle = SERVICEBASECLASS::GetOID();
119 }
120
121 const uint32_t ui32Flags = m_bWindowStateEnabled ? IQtXSystem::eWindowCreationFlags::WCF_HasWindowState :
123 // create without layouter reference
124 return m_pXSystem->CreateWindow(*this, ui32Flags);
125 }
126
129 tResult ServiceShutdown() override
130 {
131 RETURN_IF_POINTER_NULL(m_pXSystem);
132 return m_pXSystem->DestroyWindow(*this);
133 }
134
142 QString GetStateIdentifier() const override
143 {
144 return SERVICEBASECLASS::GetOID();
145 }
146
151 void OnLoadState([[maybe_unused]] const QString& strStateFolder) override
152 {
153 }
154
159 void OnSaveState([[maybe_unused]] const QString& strStateFolder) const override
160 {
161 }
162
163protected:
171 {
172 m_bWindowStateEnabled = true;
173 }
174
175private:
177 adtf::ucom::object_ptr<adtf::ui::riddler::IQtXSystem> m_pXSystem;
179 bool m_bWindowStateEnabled = false;
180};
181
182} // namespace riddler
183
184namespace spider
185{
186
209template<typename SERVICEBASECLASS, typename QTWINDOWBASECLASS = spider::cQtWindow>
210class qt_ui_service : public SERVICEBASECLASS, public QTWINDOWBASECLASS
211{
212public:
216 {
217 QTWINDOWBASECLASS::m_strTitle.SetDescription(
218 "Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
219 SERVICEBASECLASS::RegisterPropertyVariable("title", QTWINDOWBASECLASS::m_strTitle);
220 }
221
222 ~qt_ui_service() override = default;
223
229 tResult ServiceInit() override
230 {
231 RETURN_IF_FAILED(_runtime->GetObject(m_pXSystem));
232 if ((*QTWINDOWBASECLASS::m_strTitle).IsEmpty())
233 {
234 QTWINDOWBASECLASS::m_strTitle = SERVICEBASECLASS::GetOID();
235 }
236 uint32_t ui32CreationFlags = 0;
237 if constexpr (std::is_base_of_v<adtf::ui::v0::cQtWindow, QTWINDOWBASECLASS>)
238 {
239 ui32CreationFlags = QTWINDOWBASECLASS::IsWindowStateEnabled() ?
242 }
243 else
244 {
245 ui32CreationFlags = QTWINDOWBASECLASS::GetWindowCreationFlags();
246 }
247 // create without layouter reference
248 return m_pXSystem->CreateWindow(*this, ui32CreationFlags);
249 }
250
253 tResult ServiceShutdown() override
254 {
255 RETURN_IF_POINTER_NULL(m_pXSystem);
256 return m_pXSystem->DestroyWindow(*this);
257 }
258
266 QString GetStateIdentifier() const
267 {
268 return SERVICEBASECLASS::GetOID();
269 }
270
275 QString GetHelpLink() const
276 {
277 return adtf::streaming::spider::get_help_link((base::ant::IConfiguration&) *this).c_str();
278 }
279
280private:
282 adtf::ucom::object_ptr<adtf::ui::spider::IQtXSystem> m_pXSystem;
283};
284
290
291} // namespace spider
292
293namespace v0
294{
295
298
299} // namespace v0
300
301namespace v1
302{
303
310
311} // namespace v0
312
313using v1::cQtUIService;
315
316} // namespace ui
317} // namespace adtf
Definition xsystem_qtwindow.h:40
cQtWindow()=default
default CTOR
adtf::base::property_variable< adtf::util::cString > m_strTitle
title property variable will be set while window creating
Definition xsystem_qtwindow.h:94
Definition qt_ui_service.h:35
qt_ui_service()
Definition qt_ui_service.h:42
tResult ServiceShutdown() override
Definition qt_ui_service.h:70
tResult ServiceInit() override
Definition qt_ui_service.h:54
@ WCF_None
no flag set.
Definition qtxsystem_intf.h:176
@ WCF_HasWindowState
Enable the window state calls for IQtXSystem::IWindowState.
Definition qtxsystem_intf.h:185
qt_ui_service()
Definition qt_ui_service.h:215
Definition qtxsystem_intf.h:252
tResult ServiceInit() override
Definition qt_ui_service.h:113
void OnLoadState(const QString &strStateFolder) override
Definition qt_ui_service.h:151
tResult ServiceShutdown() override
Definition qt_ui_service.h:129
qt_ui_service()
Definition qt_ui_service.h:100
void OnSaveState(const QString &strStateFolder) const override
Definition qt_ui_service.h:159
~qt_ui_service() override=default
DTOR.
void EnableWindowState()
Enables the Window state callbacks. We recommend to use this only within your services CTOR.
Definition qt_ui_service.h:170
QString GetStateIdentifier() const override
Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
Definition qt_ui_service.h:142
Definition qt_ui_service.h:211
tResult ServiceShutdown() override
Definition qt_ui_service.h:253
tResult ServiceInit() override
Definition qt_ui_service.h:229
qt_ui_service()
Definition qt_ui_service.h:215
QString GetHelpLink() const
Definition qt_ui_service.h:275
QString GetStateIdentifier() const
Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
Definition qt_ui_service.h:266
~qt_ui_service() override=default
DTOR.
Legacy version namespace for all functionality of the ADTF UI SDK taken over from ADTF v3....
Definition qt_ui_filter.h:27
qt_ui_service< adtf::system::ant::cADTFService > cQtUIService
Definition qt_ui_service.h:80
Legacy version namespace for all functionality of the ADTF UI SDK taken over from ADTF v3....
Definition qt_ui_filter.h:119
qt_ui_service< adtf::system::ant::cADTFService, spider::cQtWindow > cQtUIService
Definition qt_ui_service.h:289
Namespace for all ui classes and interfaces provided since v1.0.0.
Definition adtfui_pkg.h:13
v0::qt_ui_service< adtf::system::ant::cADTFService, v1::cQtWindow > cQtUIService
Definition qt_ui_service.h:309
Namespace for the ADTF UI SDK.
Definition adtfui_pkg.h:13
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtfui_pkg.h:13