|
Wavelength
Privacy-focused, cross-platform, and open-source communication application
|
A custom QToolBar serving as the main navigation bar for the application. More...
#include <navbar.h>
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. | |
| CyberpunkButton * | create_button_ |
| Button to trigger the creation of a new wavelength. | |
| CyberpunkButton * | join_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. | |
| NetworkStatusWidget * | network_status_ |
| Widget displaying the current network connection status. | |
| CyberpunkButton * | settings_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. | |
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.
|
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.
| parent | Optional parent widget. |
|
overrideprotected |
Overridden context menu event handler. Ignores the event to prevent the default toolbar context menu from appearing.
| event | The context menu event. |
|
signal |
Emitted when the "Generate Wavelength" button is clicked.
|
signal |
Emitted when the "Merge Wavelength" button is clicked.
|
slot |
Plays a predefined click sound effect. Triggered when any of the main action buttons are clicked.
|
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.
| inChat | True to enter chat mode, false to return to normal mode. |
|
signal |
Emitted when the "Settings" button is clicked.
|
private |
Container widget holding the action buttons (Create, Join, Settings).
|
private |
Sound effect played when action buttons are clicked.
|
private |
Decorative label element placed at the far right in normal mode.
|
private |
Button to trigger the creation of a new wavelength.
|
private |
Button to trigger joining an existing wavelength.
|
private |
Container widget holding the left corner element and the logo label.
|
private |
Label displaying the "WAVELENGTH" logo text with glow effect.
|
private |
The main horizontal layout managing all elements within the Navbar.
|
private |
Widget displaying the current network connection status.
|
private |
Button to open the application settings.
|
private |
Spacer item used to push elements apart in the main layout (left side).
|
private |
Spacer item used to push elements apart in the main layout (right side). Its stretch factor changes in chat mode.