Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
shortcuts_settings_widget.h
Go to the documentation of this file.
1#ifndef SHORTCUTS_SETTINGS_WIDGET_H
2#define SHORTCUTS_SETTINGS_WIDGET_H
3
4#include <QMap>
5#include <QWidget>
6
8class QKeySequenceEdit;
9class QPushButton;
10class QFormLayout;
12
22class ShortcutsSettingsWidget final : public QWidget {
23 Q_OBJECT
24
25public:
31 explicit ShortcutsSettingsWidget(QWidget *parent = nullptr);
32
36 ~ShortcutsSettingsWidget() override = default;
37
41 void LoadSettings() const;
42
47 void SaveSettings() const;
48
49private slots:
55
56private:
61 void SetupUi();
62
68 static QString GetActionDescription(const QString &action_id);
69
73 QFormLayout *form_layout_;
75 QPushButton *restore_button_;
77 QMap<QString, QKeySequenceEdit *> shortcut_edits_;
80};
81
82#endif // SHORTCUTS_SETTINGS_WIDGET_H
WavelengthConfig * config_
Pointer to the WavelengthConfig singleton instance.
Definition shortcuts_settings_widget.h:71
void SetupUi()
Creates and arranges all the UI elements (labels, input fields, layouts, button) for the widget....
Definition shortcuts_settings_widget.cpp:21
void SaveSettings() const
Saves the currently configured shortcuts from the UI (QKeySequenceEdit widgets) back to WavelengthCon...
Definition shortcuts_settings_widget.cpp:158
void LoadSettings() const
Loads the current shortcut settings from WavelengthConfig and updates the UI elements (QKeySequenceEd...
Definition shortcuts_settings_widget.cpp:149
QPushButton * restore_button_
Button to trigger the restoration of default shortcuts.
Definition shortcuts_settings_widget.h:75
QFormLayout * form_layout_
Layout used to arrange the action labels and shortcut edit widgets.
Definition shortcuts_settings_widget.h:73
void RestoreDefaultShortcuts()
Restores all keyboard shortcuts to their default values defined in WavelengthConfig....
Definition shortcuts_settings_widget.cpp:171
QMap< QString, QKeySequenceEdit * > shortcut_edits_
Map storing pointers to the QKeySequenceEdit widgets, keyed by their corresponding action ID.
Definition shortcuts_settings_widget.h:77
ShortcutsSettingsWidget(QWidget *parent=nullptr)
Constructs the ShortcutsSettingsWidget. Initializes the UI, loads current shortcut settings from Wave...
Definition shortcuts_settings_widget.cpp:14
TranslationManager * translator_
Pointer to the TranslationManager for handling UI translations.
Definition shortcuts_settings_widget.h:79
~ShortcutsSettingsWidget() override=default
Default destructor.
static QString GetActionDescription(const QString &action_id)
Static utility function to get a user-friendly description for a given shortcut action ID.
Definition shortcuts_settings_widget.cpp:100
Manages the loading and delivery of translations for applications.
Definition translation_manager.h:15
Manages application configuration settings using a singleton pattern.
Definition wavelength_config.h:36