|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
The main view for configuring application settings. More...
#include <settings_view.h>
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. | |
| NetworkSettingsWidget * | advanced_tab_widget_ |
| Widget for configuring network settings (relay server, timeouts). | |
| AppearanceSettingsWidget * | appearance_tab_widget_ |
| Widget for configuring appearance settings (colors, etc.). | |
| CyberButton * | back_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_. | |
| WavelengthConfig * | config_ |
| 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). | |
| CyberButton * | defaults_button_ |
| Button to restore default settings. | |
| FingerprintLayer * | fingerprint_layer_ |
| Security layer simulating fingerprint scanning. | |
| HandprintLayer * | handprint_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_. | |
| RetinaScanLayer * | retina_scan_layer_ |
| Security layer simulating a retina scan. | |
| CyberButton * | save_button_ |
| Button to save the current settings. | |
| SecurityCodeLayer * | security_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. | |
| SecurityQuestionLayer * | security_question_layer_ |
| Security layer simulating a security question challenge. | |
| QLabel * | session_label_ |
| Label displaying a randomly generated session ID. | |
| ShortcutsSettingsWidget * | shortcuts_tab_widget_ {} |
| Widget for configuring keyboard shortcuts. | |
| SnakeGameLayer * | snake_game_layer_ |
| Security layer implementing a Snake game challenge. | |
| SystemOverrideManager * | system_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". | |
| TranslationManager * | translator_ |
| Pointer to the TranslationManager singleton instance for UI translations. | |
| TypingTestLayer * | typing_test_layer_ |
| Security layer implementing a typing verification test. | |
| VoiceRecognitionLayer * | voice_recognition_layer_ |
| Security layer simulating voice recognition. | |
| WavelengthSettingsWidget * | wavelength_tab_widget_ |
| Widget for configuring Wavelength-specific settings (e.g., preferred frequency). | |
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.
|
private |
|
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.
| parent | Optional parent widget. |
|
override |
Destructor. Stops the refresh timer and cleans up the SystemOverrideManager.
|
signal |
Emitted when the user clicks the "BACK" button, requesting a return to the previous view.
|
private |
Creates the header panel containing the view title, session ID, and current time labels.
|
privateslot |
Handles the click event of the "BACK" button. Resets the CLASSIFIED tab's security layers and emits the backToMainView() signal.
|
private |
Loads settings from the WavelengthConfig object into the UI elements of all tabs. Delegates loading to the individual tab widgets (LoadSettings methods).
|
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.
|
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().
|
privateslot |
Saves all current settings from the various tabs to the WavelengthConfig object and persists them. Displays a confirmation message. Emits settingsChanged().
| 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.
| enabled | True to enable debug mode, false to disable. |
|
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.
|
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.
|
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.
|
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.
|
overrideprotected |
Overridden show event handler. Loads settings from the configuration and resets the CLASSIFIED tab's security layers every time the view becomes visible.
| event | The show event. |
|
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.
| tab_index | The index of the tab to switch to. |
|
private |
Widget displayed after successfully completing all security layers. Contains classified features.
|
private |
Widget for configuring network settings (relay server, timeouts).
|
private |
Widget for configuring appearance settings (colors, etc.).
|
private |
Button to navigate back to the previous view.
|
private |
Widget containing the classified features (currently just the override button). Same as access_granted_widget_.
|
private |
Pointer to the WavelengthConfig singleton instance.
|
private |
Index of the currently active security layer in the CLASSIFIED tab sequence.
|
private |
Flag indicating if debug mode is enabled (bypasses security layers).
|
private |
Button to restore default settings.
|
private |
Security layer simulating fingerprint scanning.
|
private |
Security layer simulating handprint scanning.
|
private |
Button within the classified features widget to initiate the system override sequence.
|
private |
Timer used to periodically update the time_label_.
|
private |
Security layer simulating a retina scan.
|
private |
Button to save the current settings.
|
private |
Security layer requiring a 4-character code entry.
|
private |
Stacked widget holding all the security layers and the final access granted widget.
|
private |
Security layer simulating a security question challenge.
|
private |
Label displaying a randomly generated session ID.
|
private |
Widget for configuring keyboard shortcuts.
|
private |
Security layer implementing a Snake game challenge.
|
private |
Manages the system override sequence (wallpaper change, window minimize, input blocking, etc.).
|
private |
Container widget for the horizontal row of tab buttons.
|
private |
List of buttons used for switching between settings tabs.
|
private |
Stacked widget holding the content widgets for each settings tab.
|
private |
Label displaying the current time, updated periodically.
|
private |
Label displaying the main title "SYSTEM SETTINGS".
|
private |
Pointer to the TranslationManager singleton instance for UI translations.
|
private |
Security layer implementing a typing verification test.
|
private |
Security layer simulating voice recognition.
|
private |
Widget for configuring Wavelength-specific settings (e.g., preferred frequency).