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);
84 virtual void init_ui()=0;
94 widget->setupUi(widget);
96 _is_initialized =
true;
98 widget->language_changed();
120 if(!is_ui_initialized()){
124 QString new_name = get_action_name();
125 this->setWindowTitle(new_name);
134 QString new_name = this->get_action_name();
135 this->get_action()->setText(new_name +
"...");
149 if(!is_ui_initialized()){
155 if(!_geometry.isEmpty()){
156 this->restoreGeometry(_geometry);
181 _is_initialized =
false;
191 return _is_initialized;
203 QString name = get_action_name();
208 _action->setText(name +
"...");
216 virtual QString get_action_name()
const=0;
222 virtual void commit()=0;
229 virtual void revert()=0;
233 #endif // PREFERENCEINTERFACE_H 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 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
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