Sayonara Player
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Preferences::Base Class Referenceabstract

Abstract Interface you should use when creating a preferences item. More...

#include <PreferenceWidget.h>

Inheritance diagram for Preferences::Base:
Gui::Widget Gui::WidgetTemplate< QWidget > Gui::WidgetTemplateParent GUI_BroadcastPreferences GUI_CoverPreferences GUI_EnginePreferences GUI_LanguagePreferences GUI_LastFmPreferences GUI_LibraryPreferences GUI_NotificationPreferences GUI_PlayerPreferences GUI_PlaylistPreferences GUI_ProxyPreferences GUI_RemoteControlPreferences GUI_SearchPreferences GUI_ShortcutPreferences GUI_StreamPreferences GUI_StreamRecorderPreferences GUI_UiPreferences

Signals

void sigShown ()
 
void sigClosed ()
 

Public Member Functions

 Base (const QString &identifier)
 Standard constructor. More...
 
QString identifier () const
 return the unique identifier More...
 
virtual bool isUiInitialized () const final
 checks if ui has already been initialized. More...
 
virtual QAction * action () final
 get action with translated text More...
 
virtual QString actionName () const =0
 has to be implemented and should return the translated action text More...
 
virtual bool commit ()=0
 This method is called, when OK or apply is pressed. So all settings should be written there.
 
virtual void revert ()=0
 This method is called, when cancel is clicked. So the gui should be re-initialized when this method is called. This method should also be called in the init_ui() method.
 
virtual void initUi ()=0
 call setup_parent(this) here.
initialize compoenents and connections here.
After calling setup_parent(this), the preference Dialog is ready to use, language_changed() is called automatically
 
virtual void retranslate ()=0
 call the Qt retranslateUi method here
 
virtual bool hasError () const
 indicates if there was an error on the settings page like an invalid expression or combination of settings More...
 
virtual QString errorString () const
 A closer description of the error. More...
 
Dialog * boxIntoDialog ()
 

Protected Member Functions

template<typename W , typename UiClass >
void setupParent (W *widget, UiClass **ui)
 Sets up the Preference dialog. After this method, the dialog is "ready to use"
This method should be the first to be called when calling init_ui() More...
 
virtual void languageChanged () override final
 automatically called when language has changed. When overriding this method. Overriding this method should look like this: void GUI_FontConfig::language_changed()
{
translate_action();

More...
 
void translationAction ()
 Sets the new translated action name.
 
void showEvent (QShowEvent *e) override
 shows the widget and automatically calls init_ui() More...
 
void closeEvent (QCloseEvent *e) override
 
virtual void skinChanged ()
 

Protected Attributes

Dialog * mBoxedDialog =nullptr
 

Detailed Description

Abstract Interface you should use when creating a preferences item.

For methods to be implemented see also PreferenceInterface. If you wish to subclass, reimplement void get_action_name() and void init_ui().
In every function that makes use of the widgets call bool is_ui_initialized() first.
Call setup_parent(this) in init_ui() first.
If you wish to reimplement void language_changed(), call PreferenceWidgetInterface::language_changed at the end.

Constructor & Destructor Documentation

◆ Base()

Preferences::Base::Base ( const QString &  identifier)
explicit

Standard constructor.

Parameters
parent

Member Function Documentation

◆ action()

virtual QAction* Preferences::Base::action ( )
finalvirtual

get action with translated text

Returns

◆ actionName()

virtual QString Preferences::Base::actionName ( ) const
pure virtual

◆ errorString()

virtual QString Preferences::Base::errorString ( ) const
virtual

◆ hasError()

virtual bool Preferences::Base::hasError ( ) const
virtual

indicates if there was an error on the settings page like an invalid expression or combination of settings

Returns

Reimplemented in GUI_RemoteControlPreferences, and GUI_BroadcastPreferences.

◆ identifier()

QString Preferences::Base::identifier ( ) const

return the unique identifier

Returns

◆ isUiInitialized()

virtual bool Preferences::Base::isUiInitialized ( ) const
finalvirtual

checks if ui has already been initialized.

Returns
false, if the widget has never been activated before, true else

◆ languageChanged()

virtual void Preferences::Base::languageChanged ( )
finaloverrideprotectedvirtual

automatically called when language has changed. When overriding this method. Overriding this method should look like this: void GUI_FontConfig::language_changed()
{
translate_action();

if(!is_ui_initialized()){
return;
}

retranslateUi(this);
PreferenceWidgetInterface::language_changed();
}

Reimplemented from Gui::WidgetTemplateParent.

◆ setupParent()

template<typename W , typename UiClass >
void Preferences::Base::setupParent ( W *  widget,
UiClass **  ui 
)
inlineprotected

Sets up the Preference dialog. After this method, the dialog is "ready to use"
This method should be the first to be called when calling init_ui()

Parameters
widgetshould always be "this"

◆ showEvent()

void Preferences::Base::showEvent ( QShowEvent *  e)
overrideprotectedvirtual

shows the widget and automatically calls init_ui()

Parameters
e

Reimplemented from Gui::Widget.