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

A base class for QDialogs that adds animated transitions for showing and closing. More...

#include <animated_dialog.h>

Inheritance diagram for AnimatedDialog:
Collaboration diagram for AnimatedDialog:

Public Types

enum  AnimationType { kSlideFromBottom , kDigitalMaterialization }
 Enum defining the available animation styles for showing and closing the dialog. More...
 

Signals

void showAnimationFinished ()
 Emitted when the show animation (AnimateShow) has finished.
 

Public Member Functions

 AnimatedDialog (QWidget *parent=nullptr, AnimationType type=kSlideFromBottom)
 Constructs an AnimatedDialog. Sets necessary window flags and attributes for transparency and animation.
 
int GetAnimationDuration () const
 Gets the current duration for the show and close animations.
 
void SetAnimationDuration (const int duration)
 Sets the duration for the show and close animations.
 
 ~AnimatedDialog () override
 Destructor. Ensures the overlay widget is cleaned up.
 

Protected Member Functions

void closeEvent (QCloseEvent *event) override
 Overridden close event handler. Prevents immediate closing, starts the close animation (AnimateClose), and fades out the overlay. The actual QDialog::close() is called when the animation finishes.
 
void showEvent (QShowEvent *event) override
 Overridden show event handler. Creates and shows the overlay widget (if applicable), then starts the show animation (AnimateShow).
 

Protected Attributes

double corner_glow_progress_ = 0.0
 Progress property (0.0 to 1.0) potentially for corner glow effects. Animatable.
 
double digitalization_progress_ = 0.0
 Progress property (0.0 to 1.0) for the digital materialization effect. Animatable.
 

Private Member Functions

void AnimateClose ()
 Initiates and runs the animation sequence for closing the dialog based on animation_type_. Calls QDialog::close() internally when the animation finishes.
 
void AnimateShow ()
 Initiates and runs the animation sequence for showing the dialog based on animation_type_. Handles different animation types like sliding, fading, and digital materialization. Emits showAnimationFinished() upon completion.
 

Private Attributes

AnimationType animation_type_
 The type of animation selected for this dialog instance.
 
bool closing_
 Flag to prevent recursive calls during the animated closing process.
 
int duration_
 Duration of the show/close animations in milliseconds.
 
OverlayWidgetoverlay_
 Pointer to the semi-transparent overlay widget displayed behind the dialog during animation.
 

Detailed Description

A base class for QDialogs that adds animated transitions for showing and closing.

This class provides a framework for different animation types (slide, fade, digital materialization) when the dialog appears or disappears. It handles the creation of an optional overlay widget behind the dialog during the transition. Subclasses (like WavelengthDialog, JoinWavelengthDialog) can leverage specific animation types and properties (e.g., digitalizationProgress).

Member Enumeration Documentation

◆ AnimationType

Enum defining the available animation styles for showing and closing the dialog.

Enumerator
kSlideFromBottom 

Dialog slides in from the bottom and out to the bottom.

kDigitalMaterialization 

Dialog slides in, fades in, and then applies a digital materialization effect (requires specific dialog subclass properties).

Constructor & Destructor Documentation

◆ AnimatedDialog()

AnimatedDialog::AnimatedDialog ( QWidget * parent = nullptr,
AnimationType type = kSlideFromBottom )
explicit

Constructs an AnimatedDialog. Sets necessary window flags and attributes for transparency and animation.

Parameters
parentOptional parent widget.
typeThe type of animation to use for showing and closing.
Here is the caller graph for this function:

◆ ~AnimatedDialog()

AnimatedDialog::~AnimatedDialog ( )
override

Destructor. Ensures the overlay widget is cleaned up.

Member Function Documentation

◆ AnimateClose()

void AnimatedDialog::AnimateClose ( )
private

Initiates and runs the animation sequence for closing the dialog based on animation_type_. Calls QDialog::close() internally when the animation finishes.

Here is the caller graph for this function:

◆ AnimateShow()

void AnimatedDialog::AnimateShow ( )
private

Initiates and runs the animation sequence for showing the dialog based on animation_type_. Handles different animation types like sliding, fading, and digital materialization. Emits showAnimationFinished() upon completion.

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

◆ closeEvent()

void AnimatedDialog::closeEvent ( QCloseEvent * event)
overrideprotected

Overridden close event handler. Prevents immediate closing, starts the close animation (AnimateClose), and fades out the overlay. The actual QDialog::close() is called when the animation finishes.

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

◆ GetAnimationDuration()

int AnimatedDialog::GetAnimationDuration ( ) const
inline

Gets the current duration for the show and close animations.

Returns
Animation duration in milliseconds.

◆ SetAnimationDuration()

void AnimatedDialog::SetAnimationDuration ( const int duration)
inline

Sets the duration for the show and close animations.

Parameters
durationAnimation duration in milliseconds.
Here is the caller graph for this function:

◆ showAnimationFinished

void AnimatedDialog::showAnimationFinished ( )
signal

Emitted when the show animation (AnimateShow) has finished.

Here is the caller graph for this function:

◆ showEvent()

void AnimatedDialog::showEvent ( QShowEvent * event)
overrideprotected

Overridden show event handler. Creates and shows the overlay widget (if applicable), then starts the show animation (AnimateShow).

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

Member Data Documentation

◆ animation_type_

AnimationType AnimatedDialog::animation_type_
private

The type of animation selected for this dialog instance.

◆ closing_

bool AnimatedDialog::closing_
private

Flag to prevent recursive calls during the animated closing process.

◆ corner_glow_progress_

double AnimatedDialog::corner_glow_progress_ = 0.0
protected

Progress property (0.0 to 1.0) potentially for corner glow effects. Animatable.

◆ digitalization_progress_

double AnimatedDialog::digitalization_progress_ = 0.0
protected

Progress property (0.0 to 1.0) for the digital materialization effect. Animatable.

◆ duration_

int AnimatedDialog::duration_
private

Duration of the show/close animations in milliseconds.

◆ overlay_

OverlayWidget* AnimatedDialog::overlay_
private

Pointer to the semi-transparent overlay widget displayed behind the dialog during animation.


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