23 #ifndef PREFERENCEINTERFACE_H
24 #define PREFERENCEINTERFACE_H
30 #include <QCloseEvent>
33 #include "GUI/Helper/SayonaraWidget/SayonaraDialog.h"
34 #include "GUI/Helper/SayonaraWidget/SayonaraWidget.h"
58 this->setText(text +
"...");
59 connect(
this, &QAction::triggered, preference_interface, &QWidget::show);
94 widget->setupUi(widget);
96 _is_initialized =
true;
98 widget->language_changed();
125 this->setWindowTitle(new_name);
135 this->
get_action()->setText(new_name +
"...");
155 if(!_geometry.isEmpty()){
156 this->restoreGeometry(_geometry);
181 _is_initialized =
false;
191 return _is_initialized;
208 _action->setText(name +
"...");
233 #endif // PREFERENCEINTERFACE_H
virtual void init_ui()=0
call setup_parent(this) here. initialize compoenents and connections here. After calling setup_parent...
void language_changed()
automatically called when language has changed. When overriding this method. Overriding this method s...
Definition: PreferenceInterface.h:116
Template class for implementing preference dialogs and preference widgets.
Definition: PreferenceInterface.h:70
virtual QAction * get_action() final
get action with translated text
Definition: PreferenceInterface.h:199
PreferenceInterface(QWidget *parent=nullptr)
Standard constructor.
Definition: PreferenceInterface.h:178
virtual void revert()=0
This method is called, when cancel is clicked. So the gui should be re-initialized when this method i...
virtual void commit()=0
This method is called, when OK or apply is pressed. So all settings should be written there...
virtual bool is_ui_initialized() const final
checks if ui has already been initialized.
Definition: PreferenceInterface.h:189
The action, which is used to access the Preference.
Definition: PreferenceInterface.h:44
void closeEvent(QCloseEvent *e) override
closes the widget
Definition: PreferenceInterface.h:166
virtual QString get_action_name() const =0
has to be implemented and should return the translated action text
void showEvent(QShowEvent *e) override
shows the widget and automatically calls init_ui()
Definition: PreferenceInterface.h:146
void setup_parent(W *widget)
Sets up the Preference dialog. After this method, the dialog is "ready to use" This method should be ...
Definition: PreferenceInterface.h:92
void translate_action()
Sets the new translated action name.
Definition: PreferenceInterface.h:132
PreferenceAction(const QString &text, QWidget *preference_interface)
PreferenceAction Create QAction object, which is automatically connected to the show event of the und...
Definition: PreferenceInterface.h:55