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

Handles and processes window events (move, resize) for the Blob animation. More...

#include <blob_event_handler.h>

Inheritance diagram for BlobEventHandler:
Collaboration diagram for BlobEventHandler:

Signals

void eventsReEnabled ()
 Emitted when event processing is re-enabled after being disabled.
 
void movementSampleAdded (const QPointF &position, qint64 timestamp)
 Emitted periodically during window movement to provide samples for velocity calculation. This signal is emitted less frequently than raw move events but potentially more often than windowMoved.
 
void resizeStateRequested ()
 Emitted during a resize event to request a specific "resizing" state in the Blob animation.
 
void significantResizeDetected (const QSize &old_size, const QSize &new_size)
 Emitted when a significant resize event is detected after throttling.
 
void stateResetTimerRequested ()
 Emitted after a resize event to request resetting any temporary state timers.
 
void windowMoved (const QPointF &new_position, qint64 timestamp)
 Emitted when a significant window move event is detected after throttling.
 

Public Member Functions

bool AreEventsEnabled () const
 Checks if event processing is currently enabled.
 
 BlobEventHandler (QWidget *parent_widget)
 Constructs a BlobEventHandler. Installs an event filter on the parent widget's window.
 
void DisableEvents ()
 Disables event processing. Filtered events will be ignored until EnableEvents() is called.
 
void EnableEvents ()
 Enables event processing. Emits the eventsReEnabled() signal.
 
bool eventFilter (QObject *watched, QEvent *event) override
 Filters events installed on the parent widget's window. Specifically, intercepts and handles QEvent::Move events via HandleMoveEvent.
 
bool IsInTransition () const
 Checks if a visual transition is currently marked as in progress.
 
bool ProcessResizeEvent (const QResizeEvent *event)
 Processes a resize event for the parent widget. Applies throttling and checks for significant size changes before emitting signals.
 
void SetTransitionInProgress (const bool inProgress)
 Sets the flag indicating whether a visual transition is in progress. When true, event processing might be skipped or handled differently.
 
 ~BlobEventHandler () override
 Destructor. Removes the event filter from the parent widget's window.
 

Private Slots

void onEventReEnableTimeout ()
 Slot connected to the event_re_enable_timer_'s timeout signal. Calls EnableEvents() to re-enable event processing.
 

Private Member Functions

void HandleMoveEvent (const QMoveEvent *move_event)
 Handles the logic for processing QMoveEvent received by the event filter. Applies throttling based on distance and time delta before emitting signals.
 

Private Attributes

QTimer event_re_enable_timer_
 Timer used for delayed re-enabling of events.
 
bool events_enabled_
 Flag indicating whether event processing is currently enabled.
 
bool is_resizing_ = false
 Flag indicating if the window is currently being resized (used to potentially ignore move events during resize).
 
qint64 last_processed_move_time_
 Timestamp (ms since epoch) of the last processed move event.
 
QPointF last_processed_position_
 Stores the last window position that was processed after throttling.
 
QWidget * parent_widget_
 Pointer to the parent widget whose window events are monitored.
 
bool transition_in_progress_
 Flag indicating if a visual transition (e.g., animation) is in progress, potentially suppressing event handling.
 

Detailed Description

Handles and processes window events (move, resize) for the Blob animation.

This class filters events for a parent widget's window. It applies throttling and significance checks to avoid excessive processing, especially during rapid movements or resizing. It emits signals when significant events are detected, allowing other components to react appropriately. It also manages to enable/disable event processing, useful during transitions or animations.

Constructor & Destructor Documentation

◆ BlobEventHandler()

BlobEventHandler::BlobEventHandler ( QWidget * parent_widget)
explicit

Constructs a BlobEventHandler. Installs an event filter on the parent widget's window.

Parameters
parent_widgetThe widget whose window events will be monitored.
Here is the call graph for this function:

◆ ~BlobEventHandler()

BlobEventHandler::~BlobEventHandler ( )
override

Destructor. Removes the event filter from the parent widget's window.

Member Function Documentation

◆ AreEventsEnabled()

bool BlobEventHandler::AreEventsEnabled ( ) const
inline

Checks if event processing is currently enabled.

Returns
True if events are enabled, false otherwise.

◆ DisableEvents()

void BlobEventHandler::DisableEvents ( )

Disables event processing. Filtered events will be ignored until EnableEvents() is called.

◆ EnableEvents()

void BlobEventHandler::EnableEvents ( )

Enables event processing. Emits the eventsReEnabled() signal.

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

◆ eventFilter()

bool BlobEventHandler::eventFilter ( QObject * watched,
QEvent * event )
override

Filters events installed on the parent widget's window. Specifically, intercepts and handles QEvent::Move events via HandleMoveEvent.

Parameters
watchedThe object being watched (should be the parent widget's window).
eventThe event being processed.
Returns
True if the event was handled, false otherwise.
Here is the call graph for this function:

◆ eventsReEnabled

void BlobEventHandler::eventsReEnabled ( )
signal

Emitted when event processing is re-enabled after being disabled.

Here is the caller graph for this function:

◆ HandleMoveEvent()

void BlobEventHandler::HandleMoveEvent ( const QMoveEvent * move_event)
private

Handles the logic for processing QMoveEvent received by the event filter. Applies throttling based on distance and time delta before emitting signals.

Parameters
move_eventThe QMoveEvent to handle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsInTransition()

bool BlobEventHandler::IsInTransition ( ) const
inline

Checks if a visual transition is currently marked as in progress.

Returns
True if a transition is in progress, false otherwise.

◆ movementSampleAdded

void BlobEventHandler::movementSampleAdded ( const QPointF & position,
qint64 timestamp )
signal

Emitted periodically during window movement to provide samples for velocity calculation. This signal is emitted less frequently than raw move events but potentially more often than windowMoved.

Parameters
positionThe window position at the time of sampling.
timestampThe timestamp (ms since epoch) of the sample.
Here is the caller graph for this function:

◆ onEventReEnableTimeout

void BlobEventHandler::onEventReEnableTimeout ( )
privateslot

Slot connected to the event_re_enable_timer_'s timeout signal. Calls EnableEvents() to re-enable event processing.

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

◆ ProcessResizeEvent()

bool BlobEventHandler::ProcessResizeEvent ( const QResizeEvent * event)

Processes a resize event for the parent widget. Applies throttling and checks for significant size changes before emitting signals.

Parameters
eventThe QResizeEvent received by the parent widget.
Returns
True if the event was considered significant and processed, false otherwise.
Here is the call graph for this function:

◆ resizeStateRequested

void BlobEventHandler::resizeStateRequested ( )
signal

Emitted during a resize event to request a specific "resizing" state in the Blob animation.

Here is the caller graph for this function:

◆ SetTransitionInProgress()

void BlobEventHandler::SetTransitionInProgress ( const bool inProgress)
inline

Sets the flag indicating whether a visual transition is in progress. When true, event processing might be skipped or handled differently.

Parameters
inProgressTrue if a transition is starting, false if it's ending.

◆ significantResizeDetected

void BlobEventHandler::significantResizeDetected ( const QSize & old_size,
const QSize & new_size )
signal

Emitted when a significant resize event is detected after throttling.

Parameters
old_sizeThe size of the widget before the resize.
new_sizeThe size of the widget after the resize.
Here is the caller graph for this function:

◆ stateResetTimerRequested

void BlobEventHandler::stateResetTimerRequested ( )
signal

Emitted after a resize event to request resetting any temporary state timers.

Here is the caller graph for this function:

◆ windowMoved

void BlobEventHandler::windowMoved ( const QPointF & new_position,
qint64 timestamp )
signal

Emitted when a significant window move event is detected after throttling.

Parameters
new_positionThe new position of the window's top-left corner.
timestampThe timestamp (ms since epoch) when the event was processed.
Here is the caller graph for this function:

Member Data Documentation

◆ event_re_enable_timer_

QTimer BlobEventHandler::event_re_enable_timer_
private

Timer used for delayed re-enabling of events.

◆ events_enabled_

bool BlobEventHandler::events_enabled_
private

Flag indicating whether event processing is currently enabled.

◆ is_resizing_

bool BlobEventHandler::is_resizing_ = false
private

Flag indicating if the window is currently being resized (used to potentially ignore move events during resize).

◆ last_processed_move_time_

qint64 BlobEventHandler::last_processed_move_time_
private

Timestamp (ms since epoch) of the last processed move event.

◆ last_processed_position_

QPointF BlobEventHandler::last_processed_position_
private

Stores the last window position that was processed after throttling.

◆ parent_widget_

QWidget* BlobEventHandler::parent_widget_
private

Pointer to the parent widget whose window events are monitored.

◆ transition_in_progress_

bool BlobEventHandler::transition_in_progress_
private

Flag indicating if a visual transition (e.g., animation) is in progress, potentially suppressing event handling.


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