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

A widget for configuring Wavelength-specific settings, primarily the preferred start frequency. More...

#include <wavelength_settings_widget.h>

Inheritance diagram for WavelengthSettingsWidget:
Collaboration diagram for WavelengthSettingsWidget:

Public Member Functions

void LoadSettings () const
 Loads the current preferred start frequency from WavelengthConfig and updates the UI elements. Converts the stored frequency (in Hz) to an appropriate unit (Hz, kHz, MHz) for display.
 
void SaveSettings ()
 Validates the frequency input and saves the preferred start frequency back to WavelengthConfig. Converts the user input (value and unit) back to Hz before saving. Displays warnings if input is invalid.
 
 WavelengthSettingsWidget (QWidget *parent=nullptr)
 Constructs the WavelengthSettingsWidget. Initializes the UI, loads the current preferred frequency from WavelengthConfig.
 
 ~WavelengthSettingsWidget () override=default
 Default destructor.
 

Private Member Functions

void SetupUi ()
 Creates and arranges all the UI elements (labels, inputs, layouts) for the widget. Sets up the frequency value input field with a validator and the unit selection combo box.
 
bool ValidateFrequencyInput (double &hz)
 Validates the frequency value and unit entered by the user. Checks if the value is a positive number, within the unit's limit (<= 999.9), and if the resulting frequency in Hz is within the global limits (>= 130 Hz, <= 999.9 MHz). Displays warning messages for invalid input.
 

Private Attributes

WavelengthConfigconfig_
 Pointer to the WavelengthConfig singleton instance.
 
QComboBox * frequency_unit_combo_
 Combo box for selecting the unit (Hz, kHz, MHz) of the preferred frequency.
 
QLineEdit * frequency_value_edit_
 Input field for the numerical value of the preferred frequency.
 
QComboBox * language_combo_
 Combo box for selecting the application language.
 
TranslationManagertranslator_
 Pointer to the TranslationManager singleton instance.
 

Detailed Description

A widget for configuring Wavelength-specific settings, primarily the preferred start frequency.

This widget provides UI elements (line edit, combo box) to allow the user to set their preferred starting frequency when searching for available wavelengths. It includes input validation to ensure the frequency is within acceptable limits (130 Hz to 999.9 MHz). It interacts with the WavelengthConfig singleton to load and save this setting.

Constructor & Destructor Documentation

◆ WavelengthSettingsWidget()

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

Constructs the WavelengthSettingsWidget. Initializes the UI, loads the current preferred frequency from WavelengthConfig.

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

◆ ~WavelengthSettingsWidget()

WavelengthSettingsWidget::~WavelengthSettingsWidget ( )
overridedefault

Default destructor.

Member Function Documentation

◆ LoadSettings()

void WavelengthSettingsWidget::LoadSettings ( ) const

Loads the current preferred start frequency from WavelengthConfig and updates the UI elements. Converts the stored frequency (in Hz) to an appropriate unit (Hz, kHz, MHz) for display.

Here is the caller graph for this function:

◆ SaveSettings()

void WavelengthSettingsWidget::SaveSettings ( )

Validates the frequency input and saves the preferred start frequency back to WavelengthConfig. Converts the user input (value and unit) back to Hz before saving. Displays warnings if input is invalid.

Here is the call graph for this function:

◆ SetupUi()

void WavelengthSettingsWidget::SetupUi ( )
private

Creates and arranges all the UI elements (labels, inputs, layouts) for the widget. Sets up the frequency value input field with a validator and the unit selection combo box.

Here is the caller graph for this function:

◆ ValidateFrequencyInput()

bool WavelengthSettingsWidget::ValidateFrequencyInput ( double & hz)
private

Validates the frequency value and unit entered by the user. Checks if the value is a positive number, within the unit's limit (<= 999.9), and if the resulting frequency in Hz is within the global limits (>= 130 Hz, <= 999.9 MHz). Displays warning messages for invalid input.

Parameters
[out]hzThe validated frequency converted to Hertz if validation succeeds.
Returns
True if the input is valid, false otherwise.
Here is the caller graph for this function:

Member Data Documentation

◆ config_

WavelengthConfig* WavelengthSettingsWidget::config_
private

Pointer to the WavelengthConfig singleton instance.

◆ frequency_unit_combo_

QComboBox* WavelengthSettingsWidget::frequency_unit_combo_
private

Combo box for selecting the unit (Hz, kHz, MHz) of the preferred frequency.

◆ frequency_value_edit_

QLineEdit* WavelengthSettingsWidget::frequency_value_edit_
private

Input field for the numerical value of the preferred frequency.

◆ language_combo_

QComboBox* WavelengthSettingsWidget::language_combo_
private

Combo box for selecting the application language.

◆ translator_

TranslationManager* WavelengthSettingsWidget::translator_
private

Pointer to the TranslationManager singleton instance.


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