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

A custom QToolBar serving as the main navigation bar for the application. More...

#include <navbar.h>

Inheritance diagram for Navbar:
Collaboration diagram for Navbar:

Public Slots

void PlayClickSound () const
 Plays a predefined click sound effect. Triggered when any of the main action buttons are clicked.
 
void SetChatMode (bool inChat) const
 Switches the Navbar layout between normal mode and chat mode. In chat mode, the action buttons and right corner element are hidden, and the network status widget is aligned to the right. In normal mode, all elements are visible and the network status widget is centered.
 

Signals

void createWavelengthClicked ()
 Emitted when the "Generate Wavelength" button is clicked.
 
void joinWavelengthClicked ()
 Emitted when the "Merge Wavelength" button is clicked.
 
void settingsClicked ()
 Emitted when the "Settings" button is clicked.
 

Public Member Functions

 Navbar (QWidget *parent=nullptr)
 Constructs the Navbar. Initializes the toolbar's appearance and behavior (non-movable, non-floatable), sets up the layout, creates and styles the logo, network status widget, action buttons, and corner decorative elements. Connects button signals and initializes the click sound effect.
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) override
 Overridden context menu event handler. Ignores the event to prevent the default toolbar context menu from appearing.
 

Private Attributes

QWidget * buttons_container_
 Container widget holding the action buttons (Create, Join, Settings).
 
QSoundEffect * click_sound_
 Sound effect played when action buttons are clicked.
 
QLabel * corner_element_
 Decorative label element placed at the far right in normal mode.
 
CyberpunkButtoncreate_button_
 Button to trigger the creation of a new wavelength.
 
CyberpunkButtonjoin_button_
 Button to trigger joining an existing wavelength.
 
QWidget * logo_container_
 Container widget holding the left corner element and the logo label.
 
QLabel * logo_label_
 Label displaying the "WAVELENGTH" logo text with glow effect.
 
QHBoxLayout * main_layout_
 The main horizontal layout managing all elements within the Navbar.
 
NetworkStatusWidgetnetwork_status_
 Widget displaying the current network connection status.
 
CyberpunkButtonsettings_button_
 Button to open the application settings.
 
QSpacerItem * spacer1_
 Spacer item used to push elements apart in the main layout (left side).
 
QSpacerItem * spacer2_
 Spacer item used to push elements apart in the main layout (right side). Its stretch factor changes in chat mode.
 

Detailed Description

A custom QToolBar serving as the main navigation bar for the application.

This Navbar displays the application logo, network status, and action buttons ("Generate Wavelength", "Merge Wavelength", "Settings"). It features a cyberpunk aesthetic with custom styling and glow effects on the logo and buttons. The layout dynamically adjusts when entering/exiting a chat mode using SetChatMode, hiding the action buttons and repositioning the network status widget. It also plays a click sound when buttons are pressed.

Constructor & Destructor Documentation

◆ Navbar()

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

Constructs the Navbar. Initializes the toolbar's appearance and behavior (non-movable, non-floatable), sets up the layout, creates and styles the logo, network status widget, action buttons, and corner decorative elements. Connects button signals and initializes the click sound effect.

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

Member Function Documentation

◆ contextMenuEvent()

void Navbar::contextMenuEvent ( QContextMenuEvent * event)
overrideprotected

Overridden context menu event handler. Ignores the event to prevent the default toolbar context menu from appearing.

Parameters
eventThe context menu event.

◆ createWavelengthClicked

void Navbar::createWavelengthClicked ( )
signal

Emitted when the "Generate Wavelength" button is clicked.

Here is the caller graph for this function:

◆ joinWavelengthClicked

void Navbar::joinWavelengthClicked ( )
signal

Emitted when the "Merge Wavelength" button is clicked.

Here is the caller graph for this function:

◆ PlayClickSound

void Navbar::PlayClickSound ( ) const
slot

Plays a predefined click sound effect. Triggered when any of the main action buttons are clicked.

Here is the caller graph for this function:

◆ SetChatMode

void Navbar::SetChatMode ( bool inChat) const
slot

Switches the Navbar layout between normal mode and chat mode. In chat mode, the action buttons and right corner element are hidden, and the network status widget is aligned to the right. In normal mode, all elements are visible and the network status widget is centered.

Parameters
inChatTrue to enter chat mode, false to return to normal mode.

◆ settingsClicked

void Navbar::settingsClicked ( )
signal

Emitted when the "Settings" button is clicked.

Here is the caller graph for this function:

Member Data Documentation

◆ buttons_container_

QWidget* Navbar::buttons_container_
private

Container widget holding the action buttons (Create, Join, Settings).

◆ click_sound_

QSoundEffect* Navbar::click_sound_
private

Sound effect played when action buttons are clicked.

◆ corner_element_

QLabel* Navbar::corner_element_
private

Decorative label element placed at the far right in normal mode.

◆ create_button_

CyberpunkButton* Navbar::create_button_
private

Button to trigger the creation of a new wavelength.

◆ join_button_

CyberpunkButton* Navbar::join_button_
private

Button to trigger joining an existing wavelength.

◆ logo_container_

QWidget* Navbar::logo_container_
private

Container widget holding the left corner element and the logo label.

◆ logo_label_

QLabel* Navbar::logo_label_
private

Label displaying the "WAVELENGTH" logo text with glow effect.

◆ main_layout_

QHBoxLayout* Navbar::main_layout_
private

The main horizontal layout managing all elements within the Navbar.

◆ network_status_

NetworkStatusWidget* Navbar::network_status_
private

Widget displaying the current network connection status.

◆ settings_button_

CyberpunkButton* Navbar::settings_button_
private

Button to open the application settings.

◆ spacer1_

QSpacerItem* Navbar::spacer1_
private

Spacer item used to push elements apart in the main layout (left side).

◆ spacer2_

QSpacerItem* Navbar::spacer2_
private

Spacer item used to push elements apart in the main layout (right side). Its stretch factor changes in chat mode.


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