|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
A widget for configuring the application's appearance settings. More...
#include <appearance_settings_widget.h>
Public Member Functions | |
| AppearanceSettingsWidget (QWidget *parent=nullptr) | |
| Constructs the AppearanceSettingsWidget. Initializes the UI, loads current settings from WavelengthConfig, and connects signals for UI interaction and config updates. | |
| void | LoadSettings () |
| Loads the current appearance settings from WavelengthConfig and updates the UI elements. | |
| void | SaveSettings () const |
| Saves the currently selected settings back to WavelengthConfig. Note: In the current implementation, settings are saved immediately upon change, so this method primarily ensures consistency if called externally. | |
| ~AppearanceSettingsWidget () override=default | |
| Default destructor. | |
Private Slots | |
| void | ChooseBackgroundColor () |
| Opens a QColorDialog to allow the user to select the background color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | ChooseBlobColor () |
| Opens a QColorDialog to allow the user to select the blob color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | ChooseGridColor () |
| Opens a QColorDialog to allow the user to select the grid color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | ChooseStreamColor () |
| Opens a QColorDialog to allow the user to select the stream color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | ChooseTitleBorderColor () |
| Opens a QColorDialog to allow the user to select the title border color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | ChooseTitleGlowColor () |
| Opens a QColorDialog to allow the user to select the title glow color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | ChooseTitleTextColor () |
| Opens a QColorDialog to allow the user to select the title text color. Updates the local preview and immediately saves the selected color to WavelengthConfig. | |
| void | GridSpacingChanged (int value) |
| Slot triggered when the grid spacing spin box value changes. Immediately saves the new spacing value to WavelengthConfig. | |
| void | SelectRecentColor (const QColor &color) const |
| Slot triggered when a recent color button is clicked. Adds the selected color back to the top of the recent colors list in WavelengthConfig. | |
| void | UpdateRecentColorsUI () |
| Updates the UI section displaying recently used colors. Clears the existing recent color buttons and recreates them based on the current list from WavelengthConfig. Triggered by WavelengthConfig::recentColorsChanged. | |
Private Member Functions | |
| void | SetupUi () |
| Creates and arranges all the UI elements (labels, previews, spin boxes, layouts) for the widget. | |
Static Private Member Functions | |
| static void | UpdateColorPreview (QWidget *preview_widget, const QColor &color) |
| Static utility function to update the background color of a ClickableColorPreview widget. | |
Private Attributes | |
| QWidget * | bg_color_preview_ |
| Clickable preview widget for the background color. | |
| QWidget * | blob_color_preview_ |
| Clickable preview widget for the blob color. | |
| QWidget * | grid_color_preview_ |
| Clickable preview widget for the grid color. | |
| QSpinBox * | grid_spacing_spin_box_ |
| Spin box for adjusting the grid spacing. | |
| WavelengthConfig * | m_config |
| Pointer to the WavelengthConfig singleton instance. | |
| QList< QPushButton * > | recent_color_buttons_ |
| List storing pointers to the dynamically created recent color buttons. | |
| QHBoxLayout * | recent_colors_layout_ |
| Horizontal layout containing the recent color preview buttons. | |
| QColor | selected_background_color_ |
| Currently selected background color. | |
| QColor | selected_blob_color_ |
| Currently selected blob color. | |
| QColor | selected_grid_color_ |
| Currently selected grid color. | |
| int | selected_grid_spacing_ |
| Currently selected grid spacing value. | |
| QColor | selected_stream_color_ |
| Currently selected stream color. | |
| QColor | selected_title_border_color_ |
| Currently selected title border color. | |
| QColor | selected_title_glow_color_ |
| Currently selected title glow color. | |
| QColor | selected_title_text_color_ |
| Currently selected title text color. | |
| QWidget * | stream_color_preview_ |
| Clickable preview widget for the stream color. | |
| QWidget * | title_border_color_preview_ |
| Clickable preview widget for the title border color. | |
| QWidget * | title_glow_color_preview_ |
| Clickable preview widget for the title glow color. | |
| QWidget * | title_text_color_preview_ |
| Clickable preview widget for the title text color. | |
| TranslationManager * | translator_ = nullptr |
| Pointer to the translation manager for handling UI translations. | |
A widget for configuring the application's appearance settings.
This widget provides UI elements (color previews, spin boxes) to allow the user to customize various visual aspects of the application, such as background color, blob color, stream color, grid appearance, and title bar styling. It interacts with the WavelengthConfig singleton to load and save these settings. Changes made via the UI are immediately applied to the WavelengthConfig, triggering updates in other parts of the application that listen to config changes.
|
explicit |
Constructs the AppearanceSettingsWidget. Initializes the UI, loads current settings from WavelengthConfig, and connects signals for UI interaction and config updates.
| parent | Optional parent widget. |
|
overridedefault |
Default destructor.
|
privateslot |
Opens a QColorDialog to allow the user to select the background color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Opens a QColorDialog to allow the user to select the blob color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Opens a QColorDialog to allow the user to select the grid color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Opens a QColorDialog to allow the user to select the stream color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Opens a QColorDialog to allow the user to select the title border color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Opens a QColorDialog to allow the user to select the title glow color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Opens a QColorDialog to allow the user to select the title text color. Updates the local preview and immediately saves the selected color to WavelengthConfig.
|
privateslot |
Slot triggered when the grid spacing spin box value changes. Immediately saves the new spacing value to WavelengthConfig.
| value | The new grid spacing value in pixels. |
| void AppearanceSettingsWidget::LoadSettings | ( | ) |
Loads the current appearance settings from WavelengthConfig and updates the UI elements.
| void AppearanceSettingsWidget::SaveSettings | ( | ) | const |
Saves the currently selected settings back to WavelengthConfig. Note: In the current implementation, settings are saved immediately upon change, so this method primarily ensures consistency if called externally.
|
privateslot |
Slot triggered when a recent color button is clicked. Adds the selected color back to the top of the recent colors list in WavelengthConfig.
| color | The color that was clicked. |
|
private |
Creates and arranges all the UI elements (labels, previews, spin boxes, layouts) for the widget.
|
staticprivate |
Static utility function to update the background color of a ClickableColorPreview widget.
| preview_widget | Pointer to the QWidget (expected to be a ClickableColorPreview). |
| color | The new color to set. |
|
privateslot |
Updates the UI section displaying recently used colors. Clears the existing recent color buttons and recreates them based on the current list from WavelengthConfig. Triggered by WavelengthConfig::recentColorsChanged.
|
private |
Clickable preview widget for the background color.
|
private |
Clickable preview widget for the blob color.
|
private |
Clickable preview widget for the grid color.
|
private |
Spin box for adjusting the grid spacing.
|
private |
Pointer to the WavelengthConfig singleton instance.
|
private |
List storing pointers to the dynamically created recent color buttons.
|
private |
Horizontal layout containing the recent color preview buttons.
|
private |
Currently selected background color.
|
private |
Currently selected blob color.
|
private |
Currently selected grid color.
|
private |
Currently selected grid spacing value.
|
private |
Currently selected stream color.
|
private |
Currently selected title border color.
|
private |
Currently selected title glow color.
|
private |
Currently selected title text color.
|
private |
Clickable preview widget for the stream color.
|
private |
Clickable preview widget for the title border color.
|
private |
Clickable preview widget for the title glow color.
|
private |
Clickable preview widget for the title text color.
|
private |
Pointer to the translation manager for handling UI translations.