ADTF  3.18.2
qt_ui_service.h
Go to the documentation of this file.
1 
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>
20 
21 namespace adtf
22 {
23 namespace ui
24 {
25 namespace ant
26 {
32 template <typename SERVICEBASECLASS>
33 class qt_ui_service : public SERVICEBASECLASS,
34  public cQtWindow
35 {
38 
39  public:
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  }
48  ~qt_ui_service() = default;
54  tResult ServiceInit() override
55  {
58  if (strTitle.IsEmpty())
59  {
60  strTitle = SERVICEBASECLASS::GetOID();
61  m_strTitle = strTitle;
62  }
63  return m_pXSystem->CreateWindow(*this);
64  }
71  {
73  return m_pXSystem->DestroyWindow(*this);
74  }
75 };
81 }
82 
83 namespace riddler
84 {
85 
94 template<typename SERVICEBASECLASS>
95 class qt_ui_service : public SERVICEBASECLASS,
96  public ant::cQtWindow,
98 {
99  public:
103  {
104  m_strTitle.SetDescription("Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
105  SERVICEBASECLASS::RegisterPropertyVariable("title", m_strTitle);
106  }
108  ~qt_ui_service() override = default;
109 
115  tResult ServiceInit() override
116  {
118  if ((*m_strTitle).IsEmpty())
119  {
120  m_strTitle = SERVICEBASECLASS::GetOID();
121  }
122 
123  const uint32_t ui32Flags = m_bWindowStateEnabled ? IQtXSystem::eWindowCreationFlags::WCF_HasWindowState :
124  IQtXSystem::eWindowCreationFlags::WCF_None;
125  // create without layouter reference
126  return m_pXSystem->CreateWindow(*this, ui32Flags);
127  }
132  {
134  return m_pXSystem->DestroyWindow(*this);
135  }
136 
144  QString GetStateIdentifier() const override
145  {
146  return SERVICEBASECLASS::GetOID();
147  }
148 
153  void OnLoadState([[maybe_unused]] const QString& strStateFolder) override
154  {
155  }
156 
161  void OnSaveState([[maybe_unused]] const QString& strStateFolder) const override
162  {
163  }
164 
165  protected:
173  {
174  m_bWindowStateEnabled = true;
175  }
176 
177  private:
181  bool m_bWindowStateEnabled = false;
182 };
183 
184 } // namespace riddler
185 
186 namespace spider
187 {
188 
210 template<typename SERVICEBASECLASS, typename QTWINDOWBASECLASS = spider::cQtWindow>
211 class qt_ui_service : public SERVICEBASECLASS,
212  public QTWINDOWBASECLASS
213 {
214 
215 public:
219  {
220  QTWINDOWBASECLASS::m_strTitle.SetDescription(
221  "Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
222  SERVICEBASECLASS::RegisterPropertyVariable("title", QTWINDOWBASECLASS::m_strTitle);
223  }
225  ~qt_ui_service() override = default;
226 
232  tResult ServiceInit() override
233  {
235  if ((*QTWINDOWBASECLASS::m_strTitle).IsEmpty())
236  {
237  QTWINDOWBASECLASS::m_strTitle = SERVICEBASECLASS::GetOID();
238  }
239 
240  const uint32_t ui32Flags = QTWINDOWBASECLASS::IsWindowStateEnabled() ?
241  IQtXSystem::eWindowCreationFlags::WCF_HasWindowState :
242  IQtXSystem::eWindowCreationFlags::WCF_None;
243  // create without layouter reference
244  return m_pXSystem->CreateWindow(*this, ui32Flags);
245  }
250  {
252  return m_pXSystem->DestroyWindow(*this);
253  }
254 
262  QString GetStateIdentifier() const
263  {
264  return SERVICEBASECLASS::GetOID();
265  }
266 
271  QString GetHelpLink() const
272  {
274  }
275 
276 private:
279 };
280 
286 
287 } // namespace spider
288 
289 
292 
293 
294 }
295 }
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
ucom Interface to a objects configuration.
virtual tResult GetObject(iobject_ptr< IObject > &pObject, const char *strNameOID) const =0
Get registered object from object registry.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
Basic IWindow implementation.
adtf::base::property_variable< adtf::util::cString > m_strTitle
title property variable will be set while window creating
Implemenation template which implements an IWindow interface and creates a window on the adtf::ui::ri...
Definition: qt_ui_service.h:35
tResult ServiceShutdown() override
Override ServiceShutdown method of the service to destroy a window.
Definition: qt_ui_service.h:70
adtf::ucom::object_ptr< adtf::ui::ant::IQtXSystem > m_pXSystem
The XSystem reference.
Definition: qt_ui_service.h:37
tResult ServiceInit() override
Override ServiceInit method of the service to create a window.
Definition: qt_ui_service.h:54
qt_ui_service()
default CTOR This will register the common property "title" to the services IConfiguration
Definition: qt_ui_service.h:42
Window state callback interface.
Implementation template which implements a IQtXSystem::IWindow and a IQtXSystem::IWindowState interfa...
Definition: qt_ui_service.h:98
tResult ServiceShutdown() override
Override ServiceShutdown method of the service to destroy a window.
void OnSaveState([[maybe_unused]] const QString &strStateFolder) const override
Callback function to save the internal window state to the given folder strStateFolder.
adtf::ucom::object_ptr< adtf::ui::riddler::IQtXSystem > m_pXSystem
The XSystem reference.
bool m_bWindowStateEnabled
State for enabled window state.
QString GetStateIdentifier() const override
Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
void OnLoadState([[maybe_unused]] const QString &strStateFolder) override
Callback function to load the internal window state from the given folder strStateFolder.
~qt_ui_service() override=default
DTOR.
void EnableWindowState()
Enables the Window state callbacks.
tResult ServiceInit() override
Override ServiceInit method of the service to create a window.
qt_ui_service()
default CTOR This will register the common property "title" to the services IConfiguration
Implementation template which implements a service that derives from.
tResult ServiceShutdown() override
Override ServiceShutdown method of the service to destroy a window.
adtf::ucom::object_ptr< adtf::ui::spider::IQtXSystem > m_pXSystem
The XSystem reference.
QString GetStateIdentifier() const
Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
~qt_ui_service() override=default
DTOR.
QString GetHelpLink() const
Returns a filesystem help link to the windows documentation page.
tResult ServiceInit() override
Override ServiceInit method of the service to create a window.
qt_ui_service()
default CTOR This will register the common property "title" to the services IConfiguration
Copyright © Audi Electronics Venture GmbH.
void maybe_unused(T &&)
Mimics C++17 attribute maybe_unused to silence compiler warnings on potentially unused enitities.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
std::string get_help_link(base::ant::IConfiguration &oConfig)
Get the link to the corresponding help/documentation set by hollow::set_help_link.
qt_ui_service< adtf::system::ant::cADTFService, spider::cQtWindow > cQtUIService
UI Service basic implementation for cADTFService.
Namespace for entire ADTF SDK.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.