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

The main view for configuring application settings. More...

#include <settings_view.h>

Inheritance diagram for SettingsView:
Collaboration diagram for SettingsView:

Signals

void backToMainView ()
 Emitted when the user clicks the "BACK" button, requesting a return to the previous view.
 
void settingsChanged ()
 Emitted when settings are saved or restored to defaults, indicating that other parts of the application might need to update based on the new configuration.
 

Public Member Functions

void SetDebugMode (bool enabled)
 Enables or disables the debug mode for the CLASSIFIED tab. When enabled, the security layers are bypassed, granting immediate access to classified features.
 
 SettingsView (QWidget *parent=nullptr)
 Constructs the SettingsView. Initializes the UI, sets up all tabs including the security layers for the CLASSIFIED tab, connects signals and slots for UI interaction, and starts a timer for updating the displayed time.
 
 ~SettingsView () override
 Destructor. Stops the refresh timer and cleans up the SystemOverrideManager.
 

Protected Member Functions

void showEvent (QShowEvent *event) override
 Overridden show event handler. Loads settings from the configuration and resets the CLASSIFIED tab's security layers every time the view becomes visible.
 

Private Types

enum  SecurityLayerIndex {
  FingerprintIndex = 0 , HandprintIndex , SecurityCodeIndex , SecurityQuestionIndex ,
  RetinaScanIndex , VoiceRecognitionIndex , TypingTestIndex , SnakeGameIndex ,
  AccessGrantedIndex
}
 Enum defining the order and indices of the security layers within the stack. More...
 

Private Slots

void HandleBackButton ()
 Handles the click event of the "BACK" button. Resets the CLASSIFIED tab's security layers and emits the backToMainView() signal.
 
void RestoreDefaults ()
 Restores all settings across all tabs to their default values. Prompts the user for confirmation before proceeding. Reloads settings into the UI and emits settingsChanged().
 
void SaveSettings ()
 Saves all current settings from the various tabs to the WavelengthConfig object and persists them. Displays a confirmation message. Emits settingsChanged().
 
void SwitchToTab (int tab_index)
 Switches the visible tab content based on the clicked tab button. Updates the active state of tab buttons and sets the current index of the QStackedWidget. Resets the CLASSIFIED tab if it's selected.
 

Private Member Functions

void CreateHeaderPanel ()
 Creates the header panel containing the view title, session ID, and current time labels.
 
void LoadSettingsFromRegistry () const
 Loads settings from the WavelengthConfig object into the UI elements of all tabs. Delegates loading to the individual tab widgets (LoadSettings methods).
 
void ResetSecurityLayers ()
 Resets all security layers in the CLASSIFIED tab to their initial state. Calls Reset() on each layer. If debug mode is enabled, it bypasses the layers and shows the final classified features widget directly. Otherwise, it sets the first layer (Fingerprint) as active and initializes it.
 
void SetupClassifiedTab ()
 Creates and configures the "CLASSIFIED" tab. Sets up the stacked widget containing all the security layers (Fingerprint, Handprint, etc.) and the final "Access Granted" widget with the system override button. Connects signals for layer completion to advance through the sequence.
 
void SetupNextSecurityLayer ()
 Advances to the next security layer in the CLASSIFIED tab sequence. Updates the current_layer_index_, sets the active widget in the security_layers_stack_, and calls Initialize() on the newly activated layer.
 
void SetupUi ()
 Creates and arranges the main UI elements of the SettingsView. Sets up the main layout, header panel, tab bar, stacked widget for tab content, and the bottom action buttons panel.
 

Private Attributes

QWidget * access_granted_widget_
 Widget displayed after successfully completing all security layers. Contains classified features.
 
NetworkSettingsWidgetadvanced_tab_widget_
 Widget for configuring network settings (relay server, timeouts).
 
AppearanceSettingsWidgetappearance_tab_widget_
 Widget for configuring appearance settings (colors, etc.).
 
CyberButtonback_button_
 Button to navigate back to the previous view.
 
QWidget * classified_features_widget_
 Widget containing the classified features (currently just the override button). Same as access_granted_widget_.
 
WavelengthConfigconfig_
 Pointer to the WavelengthConfig singleton instance.
 
SecurityLayerIndex current_layer_index_
 Index of the currently active security layer in the CLASSIFIED tab sequence.
 
bool debug_mode_enabled_
 Flag indicating if debug mode is enabled (bypasses security layers).
 
CyberButtondefaults_button_
 Button to restore default settings.
 
FingerprintLayerfingerprint_layer_
 Security layer simulating fingerprint scanning.
 
HandprintLayerhandprint_layer_
 Security layer simulating handprint scanning.
 
QPushButton * override_button_
 Button within the classified features widget to initiate the system override sequence.
 
QTimer * refresh_timer_
 Timer used to periodically update the time_label_.
 
RetinaScanLayerretina_scan_layer_
 Security layer simulating a retina scan.
 
CyberButtonsave_button_
 Button to save the current settings.
 
SecurityCodeLayersecurity_code_layer_
 Security layer requiring a 4-character code entry.
 
QStackedWidget * security_layers_stack_
 Stacked widget holding all the security layers and the final access granted widget.
 
SecurityQuestionLayersecurity_question_layer_
 Security layer simulating a security question challenge.
 
QLabel * session_label_
 Label displaying a randomly generated session ID.
 
ShortcutsSettingsWidgetshortcuts_tab_widget_ {}
 Widget for configuring keyboard shortcuts.
 
SnakeGameLayersnake_game_layer_
 Security layer implementing a Snake game challenge.
 
SystemOverrideManagersystem_override_manager_
 Manages the system override sequence (wallpaper change, window minimize, input blocking, etc.).
 
QWidget * tab_bar_
 Container widget for the horizontal row of tab buttons.
 
QList< TabButton * > tab_buttons_
 List of buttons used for switching between settings tabs.
 
QStackedWidget * tab_content_
 Stacked widget holding the content widgets for each settings tab.
 
QLabel * time_label_
 Label displaying the current time, updated periodically.
 
QLabel * title_label_
 Label displaying the main title "SYSTEM SETTINGS".
 
TranslationManagertranslator_
 Pointer to the TranslationManager singleton instance for UI translations.
 
TypingTestLayertyping_test_layer_
 Security layer implementing a typing verification test.
 
VoiceRecognitionLayervoice_recognition_layer_
 Security layer simulating voice recognition.
 
WavelengthSettingsWidgetwavelength_tab_widget_
 Widget for configuring Wavelength-specific settings (e.g., preferred frequency).
 

Detailed Description

The main view for configuring application settings.

This widget provides a tabbed interface for accessing different settings categories: Wavelength, Appearance, Network, Shortcuts, and a special "CLASSIFIED" tab. The CLASSIFIED tab requires passing through a sequence of security layers (mini-games/challenges) to access hidden features, including a system override function. It interacts with WavelengthConfig to load/save settings and provides buttons for saving, restoring defaults, and returning to the main application view.

Member Enumeration Documentation

◆ SecurityLayerIndex

Enum defining the order and indices of the security layers within the stack.

Enumerator
FingerprintIndex 
HandprintIndex 
SecurityCodeIndex 
SecurityQuestionIndex 
RetinaScanIndex 
VoiceRecognitionIndex 
TypingTestIndex 
SnakeGameIndex 
AccessGrantedIndex 

Constructor & Destructor Documentation

◆ SettingsView()

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

Constructs the SettingsView. Initializes the UI, sets up all tabs including the security layers for the CLASSIFIED tab, connects signals and slots for UI interaction, and starts a timer for updating the displayed time.

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

◆ ~SettingsView()

SettingsView::~SettingsView ( )
override

Destructor. Stops the refresh timer and cleans up the SystemOverrideManager.

Member Function Documentation

◆ backToMainView

void SettingsView::backToMainView ( )
signal

Emitted when the user clicks the "BACK" button, requesting a return to the previous view.

Here is the caller graph for this function:

◆ CreateHeaderPanel()

void SettingsView::CreateHeaderPanel ( )
private

Creates the header panel containing the view title, session ID, and current time labels.

Here is the caller graph for this function:

◆ HandleBackButton

void SettingsView::HandleBackButton ( )
privateslot

Handles the click event of the "BACK" button. Resets the CLASSIFIED tab's security layers and emits the backToMainView() signal.

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

◆ LoadSettingsFromRegistry()

void SettingsView::LoadSettingsFromRegistry ( ) const
private

Loads settings from the WavelengthConfig object into the UI elements of all tabs. Delegates loading to the individual tab widgets (LoadSettings methods).

Here is the caller graph for this function:

◆ ResetSecurityLayers()

void SettingsView::ResetSecurityLayers ( )
private

Resets all security layers in the CLASSIFIED tab to their initial state. Calls Reset() on each layer. If debug mode is enabled, it bypasses the layers and shows the final classified features widget directly. Otherwise, it sets the first layer (Fingerprint) as active and initializes it.

Here is the caller graph for this function:

◆ RestoreDefaults

void SettingsView::RestoreDefaults ( )
privateslot

Restores all settings across all tabs to their default values. Prompts the user for confirmation before proceeding. Reloads settings into the UI and emits settingsChanged().

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

◆ SaveSettings

void SettingsView::SaveSettings ( )
privateslot

Saves all current settings from the various tabs to the WavelengthConfig object and persists them. Displays a confirmation message. Emits settingsChanged().

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

◆ SetDebugMode()

void SettingsView::SetDebugMode ( bool enabled)

Enables or disables the debug mode for the CLASSIFIED tab. When enabled, the security layers are bypassed, granting immediate access to classified features.

Parameters
enabledTrue to enable debug mode, false to disable.
Here is the call graph for this function:

◆ settingsChanged

void SettingsView::settingsChanged ( )
signal

Emitted when settings are saved or restored to defaults, indicating that other parts of the application might need to update based on the new configuration.

Here is the caller graph for this function:

◆ SetupClassifiedTab()

void SettingsView::SetupClassifiedTab ( )
private

Creates and configures the "CLASSIFIED" tab. Sets up the stacked widget containing all the security layers (Fingerprint, Handprint, etc.) and the final "Access Granted" widget with the system override button. Connects signals for layer completion to advance through the sequence.

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

◆ SetupNextSecurityLayer()

void SettingsView::SetupNextSecurityLayer ( )
private

Advances to the next security layer in the CLASSIFIED tab sequence. Updates the current_layer_index_, sets the active widget in the security_layers_stack_, and calls Initialize() on the newly activated layer.

Deprecated
Logic is now mostly handled within the connect statements in SetupClassifiedTab.

◆ SetupUi()

void SettingsView::SetupUi ( )
private

Creates and arranges the main UI elements of the SettingsView. Sets up the main layout, header panel, tab bar, stacked widget for tab content, and the bottom action buttons panel.

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

◆ showEvent()

void SettingsView::showEvent ( QShowEvent * event)
overrideprotected

Overridden show event handler. Loads settings from the configuration and resets the CLASSIFIED tab's security layers every time the view becomes visible.

Parameters
eventThe show event.
Here is the call graph for this function:

◆ SwitchToTab

void SettingsView::SwitchToTab ( int tab_index)
privateslot

Switches the visible tab content based on the clicked tab button. Updates the active state of tab buttons and sets the current index of the QStackedWidget. Resets the CLASSIFIED tab if it's selected.

Parameters
tab_indexThe index of the tab to switch to.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ access_granted_widget_

QWidget* SettingsView::access_granted_widget_
private

Widget displayed after successfully completing all security layers. Contains classified features.

◆ advanced_tab_widget_

NetworkSettingsWidget* SettingsView::advanced_tab_widget_
private

Widget for configuring network settings (relay server, timeouts).

◆ appearance_tab_widget_

AppearanceSettingsWidget* SettingsView::appearance_tab_widget_
private

Widget for configuring appearance settings (colors, etc.).

◆ back_button_

CyberButton* SettingsView::back_button_
private

Button to navigate back to the previous view.

◆ classified_features_widget_

QWidget* SettingsView::classified_features_widget_
private

Widget containing the classified features (currently just the override button). Same as access_granted_widget_.

◆ config_

WavelengthConfig* SettingsView::config_
private

Pointer to the WavelengthConfig singleton instance.

◆ current_layer_index_

SecurityLayerIndex SettingsView::current_layer_index_
private

Index of the currently active security layer in the CLASSIFIED tab sequence.

◆ debug_mode_enabled_

bool SettingsView::debug_mode_enabled_
private

Flag indicating if debug mode is enabled (bypasses security layers).

◆ defaults_button_

CyberButton* SettingsView::defaults_button_
private

Button to restore default settings.

◆ fingerprint_layer_

FingerprintLayer* SettingsView::fingerprint_layer_
private

Security layer simulating fingerprint scanning.

◆ handprint_layer_

HandprintLayer* SettingsView::handprint_layer_
private

Security layer simulating handprint scanning.

◆ override_button_

QPushButton* SettingsView::override_button_
private

Button within the classified features widget to initiate the system override sequence.

◆ refresh_timer_

QTimer* SettingsView::refresh_timer_
private

Timer used to periodically update the time_label_.

◆ retina_scan_layer_

RetinaScanLayer* SettingsView::retina_scan_layer_
private

Security layer simulating a retina scan.

◆ save_button_

CyberButton* SettingsView::save_button_
private

Button to save the current settings.

◆ security_code_layer_

SecurityCodeLayer* SettingsView::security_code_layer_
private

Security layer requiring a 4-character code entry.

◆ security_layers_stack_

QStackedWidget* SettingsView::security_layers_stack_
private

Stacked widget holding all the security layers and the final access granted widget.

◆ security_question_layer_

SecurityQuestionLayer* SettingsView::security_question_layer_
private

Security layer simulating a security question challenge.

◆ session_label_

QLabel* SettingsView::session_label_
private

Label displaying a randomly generated session ID.

◆ shortcuts_tab_widget_

ShortcutsSettingsWidget* SettingsView::shortcuts_tab_widget_ {}
private

Widget for configuring keyboard shortcuts.

◆ snake_game_layer_

SnakeGameLayer* SettingsView::snake_game_layer_
private

Security layer implementing a Snake game challenge.

◆ system_override_manager_

SystemOverrideManager* SettingsView::system_override_manager_
private

Manages the system override sequence (wallpaper change, window minimize, input blocking, etc.).

◆ tab_bar_

QWidget* SettingsView::tab_bar_
private

Container widget for the horizontal row of tab buttons.

◆ tab_buttons_

QList<TabButton *> SettingsView::tab_buttons_
private

List of buttons used for switching between settings tabs.

◆ tab_content_

QStackedWidget* SettingsView::tab_content_
private

Stacked widget holding the content widgets for each settings tab.

◆ time_label_

QLabel* SettingsView::time_label_
private

Label displaying the current time, updated periodically.

◆ title_label_

QLabel* SettingsView::title_label_
private

Label displaying the main title "SYSTEM SETTINGS".

◆ translator_

TranslationManager* SettingsView::translator_
private

Pointer to the TranslationManager singleton instance for UI translations.

◆ typing_test_layer_

TypingTestLayer* SettingsView::typing_test_layer_
private

Security layer implementing a typing verification test.

◆ voice_recognition_layer_

VoiceRecognitionLayer* SettingsView::voice_recognition_layer_
private

Security layer simulating voice recognition.

◆ wavelength_tab_widget_

WavelengthSettingsWidget* SettingsView::wavelength_tab_widget_
private

Widget for configuring Wavelength-specific settings (e.g., preferred frequency).


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