Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
AppearanceSettingsWidget Class Referencefinal

A widget for configuring the application's appearance settings. More...

#include <appearance_settings_widget.h>

Inheritance diagram for AppearanceSettingsWidget:
Collaboration diagram for AppearanceSettingsWidget:

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.
 
WavelengthConfigm_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.
 
TranslationManagertranslator_ = nullptr
 Pointer to the translation manager for handling UI translations.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AppearanceSettingsWidget()

AppearanceSettingsWidget::AppearanceSettingsWidget ( QWidget * parent = nullptr)
explicit

Constructs the AppearanceSettingsWidget. Initializes the UI, loads current settings from WavelengthConfig, and connects signals for UI interaction and config updates.

Parameters
parentOptional parent widget.
Here is the call graph for this function:

◆ ~AppearanceSettingsWidget()

AppearanceSettingsWidget::~AppearanceSettingsWidget ( )
overridedefault

Default destructor.

Member Function Documentation

◆ ChooseBackgroundColor

void AppearanceSettingsWidget::ChooseBackgroundColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChooseBlobColor

void AppearanceSettingsWidget::ChooseBlobColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChooseGridColor

void AppearanceSettingsWidget::ChooseGridColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChooseStreamColor

void AppearanceSettingsWidget::ChooseStreamColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChooseTitleBorderColor

void AppearanceSettingsWidget::ChooseTitleBorderColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChooseTitleGlowColor

void AppearanceSettingsWidget::ChooseTitleGlowColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ChooseTitleTextColor

void AppearanceSettingsWidget::ChooseTitleTextColor ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GridSpacingChanged

void AppearanceSettingsWidget::GridSpacingChanged ( int value)
privateslot

Slot triggered when the grid spacing spin box value changes. Immediately saves the new spacing value to WavelengthConfig.

Parameters
valueThe new grid spacing value in pixels.
Here is the caller graph for this function:

◆ LoadSettings()

void AppearanceSettingsWidget::LoadSettings ( )

Loads the current appearance settings from WavelengthConfig and updates the UI elements.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveSettings()

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.

◆ SelectRecentColor

void AppearanceSettingsWidget::SelectRecentColor ( const QColor & color) const
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.

Parameters
colorThe color that was clicked.
Here is the caller graph for this function:

◆ SetupUi()

void AppearanceSettingsWidget::SetupUi ( )
private

Creates and arranges all the UI elements (labels, previews, spin boxes, layouts) for the widget.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateColorPreview()

void AppearanceSettingsWidget::UpdateColorPreview ( QWidget * preview_widget,
const QColor & color )
staticprivate

Static utility function to update the background color of a ClickableColorPreview widget.

Parameters
preview_widgetPointer to the QWidget (expected to be a ClickableColorPreview).
colorThe new color to set.
Here is the caller graph for this function:

◆ UpdateRecentColorsUI

void AppearanceSettingsWidget::UpdateRecentColorsUI ( )
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.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bg_color_preview_

QWidget* AppearanceSettingsWidget::bg_color_preview_
private

Clickable preview widget for the background color.

◆ blob_color_preview_

QWidget* AppearanceSettingsWidget::blob_color_preview_
private

Clickable preview widget for the blob color.

◆ grid_color_preview_

QWidget* AppearanceSettingsWidget::grid_color_preview_
private

Clickable preview widget for the grid color.

◆ grid_spacing_spin_box_

QSpinBox* AppearanceSettingsWidget::grid_spacing_spin_box_
private

Spin box for adjusting the grid spacing.

◆ m_config

WavelengthConfig* AppearanceSettingsWidget::m_config
private

Pointer to the WavelengthConfig singleton instance.

◆ recent_color_buttons_

QList<QPushButton *> AppearanceSettingsWidget::recent_color_buttons_
private

List storing pointers to the dynamically created recent color buttons.

◆ recent_colors_layout_

QHBoxLayout* AppearanceSettingsWidget::recent_colors_layout_
private

Horizontal layout containing the recent color preview buttons.

◆ selected_background_color_

QColor AppearanceSettingsWidget::selected_background_color_
private

Currently selected background color.

◆ selected_blob_color_

QColor AppearanceSettingsWidget::selected_blob_color_
private

Currently selected blob color.

◆ selected_grid_color_

QColor AppearanceSettingsWidget::selected_grid_color_
private

Currently selected grid color.

◆ selected_grid_spacing_

int AppearanceSettingsWidget::selected_grid_spacing_
private

Currently selected grid spacing value.

◆ selected_stream_color_

QColor AppearanceSettingsWidget::selected_stream_color_
private

Currently selected stream color.

◆ selected_title_border_color_

QColor AppearanceSettingsWidget::selected_title_border_color_
private

Currently selected title border color.

◆ selected_title_glow_color_

QColor AppearanceSettingsWidget::selected_title_glow_color_
private

Currently selected title glow color.

◆ selected_title_text_color_

QColor AppearanceSettingsWidget::selected_title_text_color_
private

Currently selected title text color.

◆ stream_color_preview_

QWidget* AppearanceSettingsWidget::stream_color_preview_
private

Clickable preview widget for the stream color.

◆ title_border_color_preview_

QWidget* AppearanceSettingsWidget::title_border_color_preview_
private

Clickable preview widget for the title border color.

◆ title_glow_color_preview_

QWidget* AppearanceSettingsWidget::title_glow_color_preview_
private

Clickable preview widget for the title glow color.

◆ title_text_color_preview_

QWidget* AppearanceSettingsWidget::title_text_color_preview_
private

Clickable preview widget for the title text color.

◆ translator_

TranslationManager* AppearanceSettingsWidget::translator_ = nullptr
private

Pointer to the translation manager for handling UI translations.


The documentation for this class was generated from the following files: