Sayonara Player
Friends | Public Member Functions | Protected Member Functions | Protected Slots | Protected Attributes | List of all members
PreferenceWidgetInterface Class Referenceabstract

#include <PreferenceWidgetInterface.h>

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.

Friends

class PreferenceInterface< SayonaraDialog >
 

Public Member Functions

 PreferenceWidgetInterface (QWidget *parent=nullptr)
 Standard constructor. More...
 
virtual bool is_ui_initialized () const final
 checks if ui has already been initialized. More...
 
virtual QAction * get_action () final
 get action with translated text More...
 
virtual QString get_action_name () const =0
 has to be implemented and should return the translated action text More...
 
virtual void 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.
 
SayonaraDialogbox_into_dialog ()
 
bool is_dark () const
 Returns, if the current skin is dark. More...
 

Protected Member Functions

virtual void init_ui ()=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
 
void setup_parent (W *widget)
 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...
 
void language_changed ()
 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 translate_action ()
 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
 closes the widget More...
 
QString elide_text (const QString &text, QWidget *widget, int max_lines)
 

Protected Slots

virtual void skin_changed ()
 

Protected Attributes

SayonaraDialog_boxed_dialog =nullptr
 
Settings_settings =nullptr
 

Constructor & Destructor Documentation

PreferenceWidgetInterface::PreferenceWidgetInterface ( QWidget *  parent = nullptr)

Standard constructor.

Parameters
parent

Member Function Documentation

void PreferenceInterface< SayonaraWidget >::closeEvent ( QCloseEvent *  e)
inlineoverrideprotectedinherited

closes the widget

Parameters
e
virtual QAction* PreferenceInterface< SayonaraWidget >::get_action ( )
inlinefinalvirtualinherited

get action with translated text

Returns
virtual QString PreferenceInterface< SayonaraWidget >::get_action_name ( ) const
pure virtualinherited

has to be implemented and should return the translated action text

Returns
translated action name

Implemented in GUI_LastFM, GUI_Shortcuts, GUI_Notifications, GUI_StreamRecorder, GUI_PlayerPreferences, GUI_RemoteControl, GUI_LanguageChooser, GUI_StartupDialog, GUI_FontConfig, and GUI_BroadcastSetup.

bool SayonaraWidgetTemplate< QWidget >::is_dark ( ) const
inlineinherited

Returns, if the current skin is dark.

Returns
true, if dark. false else
virtual bool PreferenceInterface< SayonaraWidget >::is_ui_initialized ( ) const
inlinefinalvirtualinherited

checks if ui has already been initialized.

Returns
false, if the widget has never been activated before, true else
void PreferenceInterface< SayonaraWidget >::language_changed ( )
inlineprotectedvirtualinherited

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 SayonaraWidget.

void PreferenceInterface< SayonaraWidget >::setup_parent ( W *  widget)
inlineprotectedinherited

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"
void PreferenceInterface< SayonaraWidget >::showEvent ( QShowEvent *  e)
inlineoverrideprotectedinherited

shows the widget and automatically calls init_ui()

Parameters
e
Inheritance diagram for PreferenceWidgetInterface:
PreferenceInterface< SayonaraWidget > SayonaraWidget SayonaraWidgetTemplate< QWidget > SayonaraClass GUI_BroadcastSetup GUI_FontConfig GUI_LanguageChooser GUI_LastFM GUI_LibraryPreferences GUI_Notifications GUI_PlayerPreferences GUI_PlaylistPreferences GUI_RemoteControl GUI_Shortcuts GUI_StartupDialog GUI_StreamRecorder