ADTF  3.18.2
qt_ui_filter.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>
19 #include <adtffiltersdk/filter.h>
20 
21 namespace adtf
22 {
23 namespace ui
24 {
25 namespace ant
26 {
32 template<typename FILTERBASECLASS>
33 class qt_ui_filter : public FILTERBASECLASS,
34  public cQtWindow
35 {
38 public:
42  {
43  m_strTitle.SetDescription("Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
44  FILTERBASECLASS::RegisterPropertyVariable("title", m_strTitle);
45  }
47  ~qt_ui_filter() = default;
48 
55  tResult Init(typename FILTERBASECLASS::tInitStage eStage) override
56  {
57  RETURN_IF_FAILED(FILTERBASECLASS::Init(eStage));
58  if (eStage == FILTERBASECLASS::tInitStage::StagePostConnect)
59  {
62  if (strTitle.IsEmpty())
63  {
65  }
66  RETURN_IF_FAILED(m_pXSystem->CreateWindow(*this));
67  }
69  }
76  tResult Shutdown(typename FILTERBASECLASS::tInitStage eStage) override
77  {
78  if (eStage == FILTERBASECLASS::tInitStage::StagePostConnect)
79  {
80  if (m_pXSystem)
81  {
82  m_pXSystem->DestroyWindow(*this);
83  }
84  }
85  return (FILTERBASECLASS::Shutdown(eStage));
86  }
87 };
88 
99 }
100 
101 namespace flash
102 {
103 
110 }
111 
112 namespace riddler
113 {
114 
123 template<typename FILTERBASECLASS>
124 class qt_ui_filter : public FILTERBASECLASS,
125  public ant::cQtWindow,
127 {
128 public:
132  {
133  m_strTitle.SetDescription("Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
134  FILTERBASECLASS::RegisterPropertyVariable("title", m_strTitle);
135  }
137  ~qt_ui_filter() = default;
138 
144  tResult Init(typename FILTERBASECLASS::tInitStage eStage) override
145  {
146  RETURN_IF_FAILED(FILTERBASECLASS::Init(eStage));
147  if (eStage == FILTERBASECLASS::tInitStage::StagePostConnect)
148  {
150  adtf::util::cString strTitle = m_strTitle;
151  if (strTitle.IsEmpty())
152  {
154  }
155  const uint32_t ui32Flags = m_bWindowStateEnabled ? IQtXSystem::eWindowCreationFlags::WCF_HasWindowState :
156  IQtXSystem::eWindowCreationFlags::WCF_None;
157  RETURN_IF_FAILED(m_pXSystem->CreateWindow(*this, ui32Flags));
158  }
160  }
164  tResult Shutdown(typename FILTERBASECLASS::tInitStage eStage) override
165  {
166  if (eStage == FILTERBASECLASS::tInitStage::StagePostConnect)
167  {
168  if (m_pXSystem)
169  {
170  m_pXSystem->DestroyWindow(*this);
171  }
172  }
173  return (FILTERBASECLASS::Shutdown(eStage));
174  }
175 
183  QString GetStateIdentifier() const override
184  {
186  }
191  void OnLoadState([[maybe_unused]] const QString& strStateFolder) override
192  {
193  }
194 
199  void OnSaveState([[maybe_unused]] const QString& strStateFolder) const override
200  {
201  }
202 
203 protected:
211  {
212  m_bWindowStateEnabled = true;
213  }
214 
215 private:
219  bool m_bWindowStateEnabled = false;
220 };
227 
228 } // namespace riddler
229 
230 
231 namespace spider
232 {
233 
255 template<typename FILTERBASECLASS, typename QTWINDOWBASECLASS = spider::cQtWindow>
256 class qt_ui_filter : public FILTERBASECLASS,
257  public QTWINDOWBASECLASS
258 {
259 public:
263  {
264  QTWINDOWBASECLASS::m_strTitle.SetDescription(
265  "Window title which will be used at runtime within Qt5 ADTF XSystem UI Service.");
266  FILTERBASECLASS::RegisterPropertyVariable("title", QTWINDOWBASECLASS::m_strTitle);
267  }
269  ~qt_ui_filter() = default;
270 
276  tResult Init(typename FILTERBASECLASS::tInitStage eStage) override
277  {
278  RETURN_IF_FAILED(FILTERBASECLASS::Init(eStage));
279  if (eStage == FILTERBASECLASS::tInitStage::StagePostConnect)
280  {
282  if ((*QTWINDOWBASECLASS::m_strTitle).IsEmpty())
283  {
284  QTWINDOWBASECLASS::m_strTitle = ::adtf::streaming::get_named_graph_object_full_name(*this);
285  }
286  const uint32_t ui32Flags = QTWINDOWBASECLASS::IsWindowStateEnabled() ?
287  IQtXSystem::eWindowCreationFlags::WCF_HasWindowState :
288  IQtXSystem::eWindowCreationFlags::WCF_None;
289  RETURN_IF_FAILED(m_pXSystem->CreateWindow(*this, ui32Flags));
290  }
292  }
296  tResult Shutdown(typename FILTERBASECLASS::tInitStage eStage) override
297  {
298  if (eStage == FILTERBASECLASS::tInitStage::StagePostConnect)
299  {
300  if (m_pXSystem)
301  {
302  m_pXSystem->DestroyWindow(*this);
303  }
304  }
305  return (FILTERBASECLASS::Shutdown(eStage));
306  }
307 
315  QString GetStateIdentifier() const
316  {
318  }
319 
324  QString GetHelpLink() const
325  {
327  }
328 
329 private:
332 };
339 
340 } // namespace spider
341 
342 
344 using spider::cQtUIFilter;
346 
347 }
348 }
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_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
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 windows on a IQtXSystem wh...
Definition: qt_ui_filter.h:35
adtf::ucom::object_ptr< adtf::ui::ant::IQtXSystem > m_pXSystem
The XSystem reference.
Definition: qt_ui_filter.h:37
tResult Init(typename FILTERBASECLASS::tInitStage eStage) override
Override init method of the filter.
Definition: qt_ui_filter.h:55
~qt_ui_filter()=default
DTOR.
tResult Shutdown(typename FILTERBASECLASS::tInitStage eStage) override
Override shutdon method of the filter.
Definition: qt_ui_filter.h:76
qt_ui_filter()
default CTOR This will register the common property "title" to the filters IConfiguration
Definition: qt_ui_filter.h:41
Window state callback interface.
Implementation template which implements a IQtXSystem::IWindow and a IQtXSystem::IWindowState interfa...
Definition: qt_ui_filter.h:127
void OnSaveState([[maybe_unused]] const QString &strStateFolder) const override
Callback function to save the internal window state to the given folder strStateFolder.
Definition: qt_ui_filter.h:199
adtf::ucom::object_ptr< adtf::ui::riddler::IQtXSystem > m_pXSystem
The XSystem reference.
Definition: qt_ui_filter.h:217
bool m_bWindowStateEnabled
State for enabled window state.
Definition: qt_ui_filter.h:219
QString GetStateIdentifier() const override
Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
Definition: qt_ui_filter.h:183
void OnLoadState([[maybe_unused]] const QString &strStateFolder) override
Callback function to load the internal window state from the given folder strStateFolder.
Definition: qt_ui_filter.h:191
tResult Init(typename FILTERBASECLASS::tInitStage eStage) override
Override init method of the filter.
Definition: qt_ui_filter.h:144
void EnableWindowState()
Enables the Window state callbacks.
Definition: qt_ui_filter.h:210
tResult Shutdown(typename FILTERBASECLASS::tInitStage eStage) override
Override shutdon method of the filter.
Definition: qt_ui_filter.h:164
qt_ui_filter()
default CTOR This will register the common property "title" to the filters IConfiguration
Definition: qt_ui_filter.h:131
Implementation template which implements a filter that derives from.
Definition: qt_ui_filter.h:258
adtf::ucom::object_ptr< adtf::ui::spider::IQtXSystem > m_pXSystem
The XSystem reference.
Definition: qt_ui_filter.h:331
QString GetStateIdentifier() const
Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
Definition: qt_ui_filter.h:315
tResult Init(typename FILTERBASECLASS::tInitStage eStage) override
Override init method of the filter.
Definition: qt_ui_filter.h:276
QString GetHelpLink() const
Returns a filesystem help link to the windows documentation page.
Definition: qt_ui_filter.h:324
tResult Shutdown(typename FILTERBASECLASS::tInitStage eStage) override
Override shutdon method of the filter.
Definition: qt_ui_filter.h:296
qt_ui_filter()
default CTOR This will register the common property "title" to the filters IConfiguration
Definition: qt_ui_filter.h:262
Copyright © Audi Electronics Venture GmbH.
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
adtf_util::cString get_named_graph_object_full_name(const INamedGraphObject &oGraphObject)
Helper function to retrieve a full qualified unique name of an object registered in IFilterGraph.
std::string get_help_link(base::ant::IConfiguration &oConfig)
Get the link to the corresponding help/documentation set by hollow::set_help_link.
ant::qt_ui_filter< adtf::filter::flash::cFilter > cQtUIFilter
Basic UI Filter implementation.
Definition: qt_ui_filter.h:108
riddler::qt_ui_filter< adtf::filter::hollow::cFilter > cQtUIFilter
Basic UI Filter implementation.
Definition: qt_ui_filter.h:225
qt_ui_filter< adtf::filter::hollow::cFilter, cQtWindow > cQtUIFilter
Basic UI Filter implementation.
Definition: qt_ui_filter.h:337
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.