A widget that displays another widget (content) with a cyberpunk-themed decryption animation.
More...
#include <attachment_viewer.h>
|
| void | decryptionCounterChanged (int value) |
| | Emitted when the decryptionCounter property changes. Connected to the MaskOverlay's SetRevealProgress slot.
|
| |
| void | viewingFinished () |
| | Emitted when the viewer is closed (either manually or automatically after decryption).
|
| |
|
| | AttachmentViewer (QWidget *parent=nullptr) |
| | Constructs a CyberAttachmentViewer. Initializes the layout, status label, content container, MaskOverlay, animation timer, and applies basic styling. Connects the decryptionCounter property to the MaskOverlay's progress.
|
| |
| int | GetDecryptionCounter () const |
| | Gets the current decryption progress counter (0-100).
|
| |
| void | SetContent (QWidget *content) |
| | Sets the widget to be displayed after the decryption animation. Removes any previous content, adds the new content widget to the layout, hides the content initially, shows and configures the MaskOverlay, resets the decryption state, and updates geometry.
|
| |
| void | SetDecryptionCounter (int counter) |
| | Sets the decryption progress counter (0-100). Updates the internal value, updates the status label text, and emits decryptionCounterChanged.
|
| |
| QSize | sizeHint () const override |
| | Returns the recommended size for the viewer based on its content and layout. Calculates the size needed to accommodate the status label and the content widget's size hint.
|
| |
| void | UpdateContentLayout () |
| | Forces an update of the content layout and geometry. Useful after the content widget's size changes dynamically. Notifies parent widgets.
|
| |
| | ~AttachmentViewer () override |
| | Destructor. Ensures graphics effects are removed from the content widget if set.
|
| |
|
| void | paintEvent (QPaintEvent *event) override |
| | Overridden paint event handler. Draws the custom cyberpunk border and AR markers. Renders the clipped border, decorative lines, corner markers, and status text (SEC level, LOCK status).
|
| |
| void | resizeEvent (QResizeEvent *event) override |
| | Overridden resize event handler. Ensures the MaskOverlay is resized to match the content container's bounds.
|
| |
|
| int | decryptionCounter |
| | Property controlling the decryption progress (0-100). Animatable. Drives the MaskOverlay reveal.
|
| |
|
| void | CloseViewer () |
| | Closes the viewer by emitting the viewingFinished signal.
|
| |
| void | FinishDecryption () |
| | Slot called when the decryption animation finishes. Sets the state to decrypted, updates the status label, stops and hides the MaskOverlay, and makes the actual content widget visible.
|
| |
| void | OnActionButtonClicked () |
| | Slot triggered automatically after a short delay or potentially by a user action (though currently automatic). Initiates the scanning animation if not already decrypted. If decrypted, closes the viewer.
|
| |
| void | StartDecryptionAnimation () |
| | Starts the decryption phase. Updates the status label, ensures the MaskOverlay is visible, and starts a QPropertyAnimation to animate the decryptionCounter property from 0 to 100.
|
| |
| void | StartScanningAnimation () |
| | Starts the visual scanning phase. Updates the status label, ensures the MaskOverlay is visible and animating its scanline. Schedules the start of the decryption animation after a delay.
|
| |
| void | UpdateAnimation () const |
| | Slot called by animation_timer_ (if active) to update visual elements during animation. Adds random glitch characters to the status label text during decryption.
|
| |
| void | UpdateDecryptionStatus () const |
| | Updates the status label text to show the current decryption percentage.
|
| |
A widget that displays another widget (content) with a cyberpunk-themed decryption animation.
This viewer wraps a content widget and initially hides it behind a MaskOverlay. It simulates a scanning and decryption process:
- Initialization: Shows a status label and the MaskOverlay with a moving scanline.
- Scanning: Status label indicates scanning; MaskOverlay continues animating.
- Decryption: Status label shows decryption progress (0-100%); MaskOverlay reveals the content from top to bottom as the decryption progress increases (controlled by the decryptionCounter property).
- Finished: MaskOverlay is hidden, the actual content widget is shown, and the status label indicates completion.
The viewer itself has a cyberpunk-styled border and AR markers drawn in its paintEvent. It manages the lifecycle of the MaskOverlay and the visibility of the content widget.
◆ AttachmentViewer()
| AttachmentViewer::AttachmentViewer |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Constructs a CyberAttachmentViewer. Initializes the layout, status label, content container, MaskOverlay, animation timer, and applies basic styling. Connects the decryptionCounter property to the MaskOverlay's progress.
- Parameters
-
| parent | Optional parent widget. |
◆ ~AttachmentViewer()
| AttachmentViewer::~AttachmentViewer |
( |
| ) |
|
|
override |
Destructor. Ensures graphics effects are removed from the content widget if set.
◆ CloseViewer
| void AttachmentViewer::CloseViewer |
( |
| ) |
|
|
privateslot |
Closes the viewer by emitting the viewingFinished signal.
◆ decryptionCounterChanged
| void AttachmentViewer::decryptionCounterChanged |
( |
int | value | ) |
|
|
signal |
Emitted when the decryptionCounter property changes. Connected to the MaskOverlay's SetRevealProgress slot.
- Parameters
-
| value | The new decryption counter-value (0-100). |
◆ FinishDecryption
| void AttachmentViewer::FinishDecryption |
( |
| ) |
|
|
privateslot |
Slot called when the decryption animation finishes. Sets the state to decrypted, updates the status label, stops and hides the MaskOverlay, and makes the actual content widget visible.
◆ GetDecryptionCounter()
| int AttachmentViewer::GetDecryptionCounter |
( |
| ) |
const |
|
inline |
Gets the current decryption progress counter (0-100).
- Returns
- The decryption counter-value.
◆ OnActionButtonClicked
| void AttachmentViewer::OnActionButtonClicked |
( |
| ) |
|
|
privateslot |
Slot triggered automatically after a short delay or potentially by a user action (though currently automatic). Initiates the scanning animation if not already decrypted. If decrypted, closes the viewer.
◆ paintEvent()
| void AttachmentViewer::paintEvent |
( |
QPaintEvent * | event | ) |
|
|
overrideprotected |
Overridden paint event handler. Draws the custom cyberpunk border and AR markers. Renders the clipped border, decorative lines, corner markers, and status text (SEC level, LOCK status).
- Parameters
-
◆ resizeEvent()
| void AttachmentViewer::resizeEvent |
( |
QResizeEvent * | event | ) |
|
|
overrideprotected |
Overridden resize event handler. Ensures the MaskOverlay is resized to match the content container's bounds.
- Parameters
-
◆ SetContent()
| void AttachmentViewer::SetContent |
( |
QWidget * | content | ) |
|
Sets the widget to be displayed after the decryption animation. Removes any previous content, adds the new content widget to the layout, hides the content initially, shows and configures the MaskOverlay, resets the decryption state, and updates geometry.
- Parameters
-
| content | Pointer to the widget to display. |
◆ SetDecryptionCounter()
| void AttachmentViewer::SetDecryptionCounter |
( |
int | counter | ) |
|
Sets the decryption progress counter (0-100). Updates the internal value, updates the status label text, and emits decryptionCounterChanged.
- Parameters
-
| counter | The new counter-value. |
◆ sizeHint()
| QSize AttachmentViewer::sizeHint |
( |
| ) |
const |
|
override |
Returns the recommended size for the viewer based on its content and layout. Calculates the size needed to accommodate the status label and the content widget's size hint.
- Returns
- The calculated QSize hint.
◆ StartDecryptionAnimation
| void AttachmentViewer::StartDecryptionAnimation |
( |
| ) |
|
|
privateslot |
Starts the decryption phase. Updates the status label, ensures the MaskOverlay is visible, and starts a QPropertyAnimation to animate the decryptionCounter property from 0 to 100.
◆ StartScanningAnimation
| void AttachmentViewer::StartScanningAnimation |
( |
| ) |
|
|
privateslot |
Starts the visual scanning phase. Updates the status label, ensures the MaskOverlay is visible and animating its scanline. Schedules the start of the decryption animation after a delay.
◆ UpdateAnimation
| void AttachmentViewer::UpdateAnimation |
( |
| ) |
const |
|
privateslot |
Slot called by animation_timer_ (if active) to update visual elements during animation. Adds random glitch characters to the status label text during decryption.
◆ UpdateContentLayout()
| void AttachmentViewer::UpdateContentLayout |
( |
| ) |
|
Forces an update of the content layout and geometry. Useful after the content widget's size changes dynamically. Notifies parent widgets.
◆ UpdateDecryptionStatus
| void AttachmentViewer::UpdateDecryptionStatus |
( |
| ) |
const |
|
privateslot |
Updates the status label text to show the current decryption percentage.
◆ viewingFinished
| void AttachmentViewer::viewingFinished |
( |
| ) |
|
|
signal |
Emitted when the viewer is closed (either manually or automatically after decryption).
◆ animation_timer_
| QTimer* AttachmentViewer::animation_timer_ |
|
private |
Timer potentially used for secondary animations (like status label glitches).
◆ content_container_
| QWidget* AttachmentViewer::content_container_ |
|
private |
Container widget holding the content_widget_ and mask_overlay_.
◆ content_layout_
| QVBoxLayout* AttachmentViewer::content_layout_ |
|
private |
Layout for the content_container_.
◆ content_widget_
| QWidget* AttachmentViewer::content_widget_ = nullptr |
|
private |
Pointer to the widget being displayed (e.g., an image viewer).
◆ decryption_counter_
| int AttachmentViewer::decryption_counter_ |
|
private |
Current decryption progress (0-100).
◆ is_decrypted_
| bool AttachmentViewer::is_decrypted_ |
|
private |
Flag indicating if the decryption process has completed.
◆ is_scanning_
| bool AttachmentViewer::is_scanning_ |
|
private |
Flag indicating if the viewer is currently in the "scanning" phase.
◆ layout_
| QVBoxLayout* AttachmentViewer::layout_ |
|
private |
Main layout for the viewer.
◆ mask_overlay_
The overlay widget that handles the scanline and reveal effect.
◆ status_label_
| QLabel* AttachmentViewer::status_label_ |
|
private |
Label displaying status messages (Scanning, Decrypting %, Finished).
◆ translator_
Pointer to the translation manager for handling UI translations.
◆ decryptionCounter
| int AttachmentViewer::decryptionCounter |
|
readwrite |
Property controlling the decryption progress (0-100). Animatable. Drives the MaskOverlay reveal.
The documentation for this class was generated from the following files: