ADTF Qt5
Loading...
Searching...
No Matches
adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS > Class Template Reference

#include <qt_ui_service.h>

Inherits SERVICEBASECLASS, adtf::ui::ant::cQtWindow, and adtf::ui::riddler::IQtXSystem::IWindowState.

Public Member Functions

 qt_ui_service ()
 
 ~qt_ui_service () override=default
 DTOR.
 
tResult ServiceInit () override
 
tResult ServiceShutdown () override
 
QString GetStateIdentifier () const override
 Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".
 
void OnLoadState (const QString &strStateFolder) override
 
void OnSaveState (const QString &strStateFolder) const override
 

Protected Member Functions

void EnableWindowState ()
 Enables the Window state callbacks. We recommend to use this only within your services CTOR.
 
- Protected Member Functions inherited from adtf::ui::ant::cQtWindow
 cQtWindow ()=default
 default CTOR
 
virtual ~cQtWindow ()=default
 default DTOR
 
virtual QWidget * CreateView ()=0
 
virtual void ReleaseView ()=0
 
tResult Create (const char *strWindowID, QWidget &oParentWidget) override
 Callback which in called within the applications main th thread to create a window.
 
tResult Destroy (QWidget &) override
 Callback which in called within the applications main th thread to deliver a destroy message to the windows implementation.
 
tResult OnIdle () override
 
tResult OnTimer () override
 
- Protected Member Functions inherited from adtf::ui::riddler::IQtXSystem::IWindowState
 ~IWindowState ()=default
 protected DTOR
 

Additional Inherited Members

- Protected Attributes inherited from adtf::ui::ant::cQtWindow
adtf::base::property_variable< adtf::util::cString > m_strTitle
 title property variable will be set while window creating
 

Detailed Description

template<typename SERVICEBASECLASS>
class adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >

Implementation template which implements a IQtXSystem::IWindow and a IQtXSystem::IWindowState interface and creates a window on the adtf::ui::riddler::IQtXSystem while initializing.

Template Parameters
SERVICEBASECLASSa adtf::system::ant::cADTFService implementation. The ServiceInit and ServiceShutdown method will be override.

Constructor & Destructor Documentation

◆ qt_ui_service()

template<typename SERVICEBASECLASS>
adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::qt_ui_service ( )
inline

default CTOR This will register the common property "title" to the services IConfiguration

Member Function Documentation

◆ EnableWindowState()

template<typename SERVICEBASECLASS>
void adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::EnableWindowState ( )
inlineprotected

Enables the Window state callbacks. We recommend to use this only within your services CTOR.

See also
adtf::ui::riddler::IQtXSystem::IWindowState

◆ GetStateIdentifier()

template<typename SERVICEBASECLASS>
QString adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::GetStateIdentifier ( ) const
inlineoverridevirtual

Get the State Identifier for the Window State callbacks "OnLoadState" and "OnSaveState".

Returns
QString The unique identifier for the Window state call.
Remarks
qt_ui_service will return the set cADTFService::GetOID() (object identifier)
See also
adtf::ui::riddler::IQtXSystem::IWindowState

Implements adtf::ui::riddler::IQtXSystem::IWindowState.

◆ OnLoadState()

template<typename SERVICEBASECLASS>
void adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::OnLoadState ( const QString & strStateFolder)
inlineoverridevirtual

Callback function to load the internal window state from the given folder strStateFolder. We recommend to use QSettings to save and load a UI View Settings file.

void cMyFilter::OnLoadState(const QString& strStateFolder)
{
const auto strUISettingsFile = strStateFolder + "/my_ui_view.settings";
if (QFileInfo(strLayoutFile).exists())
{
QSettings oSettings(strUISettingsFile, QSettings::IniFormat);
oSettings.beginGroup("my_window");
// read your state from the UI View Settings as created within OnSaveState
oSettings.endGroup();
}
else
{
if (!is_window_state_folder_on_runlevel_change(strStateFolder))
{
THROW_ERROR_DESC(ERR_INVALID_FILE, "UI View Settings file not found: %s",
strLayoutFile.toStdString().c_str());
}
}
}
Parameters
[in]strStateFolderThe folder to save the UI View Settings files to.
Remarks
If no UI View Settings file is found you may throw ERR_INVALID_FILE, unless the state folder was recently created, while initializing the very first time on runlevel changes.
throw ERR_CANCEL to indicate the loading was cancelled on purpose.
This callback will be only served if EnableWindowState call is made before!

Implements adtf::ui::riddler::IQtXSystem::IWindowState.

◆ OnSaveState()

template<typename SERVICEBASECLASS>
void adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::OnSaveState ( const QString & strStateFolder) const
inlineoverridevirtual

Callback function to save the internal window state to the given folder strStateFolder. We recommend to use QSettings to save and load a UI View Settings file.

void cMyFilter::OnSaveState(const QString& strStateFolder) const
{
QSettings oSettings(strStateFolder + "/my_ui_view.settings", QSettings::IniFormat);
oSettings.beginGroup("my_window");
// save your window state to the UI View Settings file.
oSettings.endGroup();
}
Parameters
[in]strStateFolderThe folder to save the UI View Settings files to.
Remarks
You may throw within a tResult to indicate an error during saving. An ERR_CANCLED indicates the saving was cancelled on purpose.
This callback will be only served if EnableWindowState call is made before!

Implements adtf::ui::riddler::IQtXSystem::IWindowState.

◆ ServiceInit()

template<typename SERVICEBASECLASS>
tResult adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::ServiceInit ( )
inlineoverride

Override ServiceInit method of the service to create a window.

Returns
Standard Return Code. Returning an error will result in breaking intializing of system.
Remarks
Use EnableWindowState within the services CTOR to activate window state callbacks
See also
adtf::ui::riddler::IQtXSystem::IWindowState

◆ ServiceShutdown()

template<typename SERVICEBASECLASS>
tResult adtf::ui::riddler::qt_ui_service< SERVICEBASECLASS >::ServiceShutdown ( )
inlineoverride

Override ServiceShutdown method of the service to destroy a window.

Returns
Standard Return Code. Error code will only be logged. Breaking shutdown is not possible.

The documentation for this class was generated from the following file: