|
YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
|
Widget representing one video stream cell in the frontend. More...
#include <frontend/include/widgets/stream_cell.hpp>


Classes | |
| struct | line_instance |
| Instance of a persistent (saved) line to be rendered on the stream. More... | |
| struct | event_instance |
| Instance of a transient visual event marker. More... | |
| struct | hit_info |
| Hit info attached to a line highlight. More... | |
Signals | |
| void | request_close (const QString &name) |
| Emitted when the user requests closing this stream cell. | |
| void | request_focus (const QString &name) |
| Emitted when the user requests focusing/enlarging this cell. | |
| void | frame_ready (const QString &stream_name, const QImage &image) |
| Emitted whenever a new frame image becomes available. | |
Public Member Functions | |
| stream_cell (const QString &name, QWidget *parent=nullptr) | |
| Construct a stream cell. | |
| const QString & | get_name () const |
| Get logical name of this stream cell. | |
| bool | is_active () const |
| Check whether this cell is currently active (focused). | |
| std::vector< QPointF > | draft_points_pct () const |
| Get current draft polyline points (percentage coordinates). | |
| bool | draft_closed () const |
| Get whether current draft line is closed. | |
| QString | draft_name () const |
| Get current draft line name. | |
| QColor | draft_color () const |
| Get current draft line color. | |
| bool | is_draft_preview () const |
| Check whether the draft is in preview-only mode. | |
| void | set_active (bool val) |
| Set active (focused) state. | |
| void | set_drawing_enabled (bool on) |
| Enable or disable interactive drawing on this cell. | |
| void | set_draft_params (const QString &name, const QColor &color, bool closed) |
| Set draft line parameters (name, color, closed flag). | |
| void | set_draft_points_pct (const std::vector< QPointF > &pts) |
| Replace current draft points (percentage coordinates). | |
| void | clear_draft () |
| Clear all draft data (points, hover point, preview flag). | |
| void | set_persistent_lines (const std::vector< line_instance > &lines) |
| Replace all persistent lines. | |
| void | add_persistent_line (const line_instance &line) |
| Append a persistent line to the list. | |
| void | clear_persistent_lines () |
| Remove all persistent lines. | |
| void | set_draft_preview (bool on) |
| Enable or disable draft preview mode. | |
| void | set_labels_enabled (bool on) |
| Enable or disable rendering of persistent line labels. | |
| void | set_source (const QUrl &source) |
| Set media player source. | |
| void | set_loop (bool on) |
| Enable or disable looping for file-based playback. | |
| void | set_camera_id (const QByteArray &id) |
| Switch to camera input by device id. | |
| void | add_event (const QPointF &pos_pct, const QColor &color) |
| Add a transient event marker. | |
| void | set_repaint_interval_ms (int ms) |
| Set minimum repaint interval for video frame updates. | |
| void | highlight_line (const QString &line_name) |
| Highlight a persistent line by name. | |
| void | highlight_line_at (const QString &line_name, const QPointF &pos_pct) |
| Highlight a line and record a hit position for spatial falloff. | |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *event) override |
| Paint handler. | |
| void | mousePressEvent (QMouseEvent *event) override |
| Mouse press handler for drawing draft points. | |
| void | mouseMoveEvent (QMouseEvent *event) override |
| Mouse move handler for hover updates while drawing. | |
| void | leaveEvent (QEvent *event) override |
| Leave handler to clear hover state. | |
| void | keyPressEvent (QKeyEvent *event) override |
| Key press handler for draft undo. | |
Private Slots | |
| void | on_frame_changed (const QVideoFrame &frame) |
| Slot called when the video sink receives a new frame. | |
| void | on_media_status_changed (QMediaPlayer::MediaStatus status) |
| Slot called on media status changes. | |
| void | on_player_error (QMediaPlayer::Error error, const QString &error_string) |
| Slot called when media player errors occur. | |
| void | on_camera_error (QCamera::Error error) |
| Slot called on camera errors. | |
Private Member Functions | |
| void | build_ui () |
| Build child UI widgets (buttons, sink/player connections). | |
| void | update_icon () |
| Update focus button icon/tooltip based on active state. | |
| void | draw_poly_with_points (QPainter &p, const std::vector< QPointF > &pts_pct, const QColor &color, bool closed, Qt::PenStyle style, qreal width) const |
| Draw a polyline/polygon with point markers. | |
| void | draw_persistent (QPainter &p) const |
| Draw all persistent lines and their labels/highlights. | |
| void | draw_draft (QPainter &p) const |
| Draw the draft line (if any). | |
| void | draw_hover_point (QPainter &p) const |
| Draw hover point indicator (if any). | |
| void | draw_hover_coords (QPainter &p) const |
| Draw hover coordinate text (if enabled). | |
| void | draw_preview_segment (QPainter &p) const |
| Draw preview segment from last draft point to hover point. | |
| void | draw_stream_name (QPainter &p) const |
| Draw stream name overlay at top-left. | |
| QPointF | label_pos_px (const line_instance &l) const |
| Compute label anchor position for a line in pixel coordinates. | |
| QPointF | to_pct (const QPointF &pos_px) const |
| Convert pixel position to percentage coordinates. | |
| QPointF | to_px (const QPointF &pos_pct) const |
| Convert percentage coordinates to pixel position. | |
| void | draw_events (QPainter &p) |
| Draw transient events and prune expired ones. | |
Private Attributes | |
| QString | name |
| Logical stream name. | |
| QPushButton * | close_btn { nullptr } |
| UI close button (top-right). | |
| QPushButton * | focus_btn { nullptr } |
| UI focus/enlarge button (top-right). | |
| QLabel * | name_label { nullptr } |
| Optional name label (unused in current implementation). | |
| bool | active { false } |
| Whether the cell is focused/active. | |
| bool | drawing_enabled { false } |
| Whether interactive drawing is enabled. | |
| bool | draft_preview { false } |
| Whether draft line is shown in preview mode. | |
| bool | labels_enabled { true } |
| Whether persistent line labels are shown when active. | |
| QString | draft_line_name |
| Draft line name. | |
| QColor | draft_line_color { Qt::red } |
| Draft line color. | |
| bool | draft_line_closed { false } |
| Draft line closed flag. | |
| std::vector< QPointF > | draft_line_points_pct |
| Draft polyline points in percentage coordinates. | |
| std::optional< QPointF > | hover_point_pct |
| Current hover position in percentage coordinates. | |
| std::vector< line_instance > | persistent_lines |
| Persisted lines to render. | |
| QMediaPlayer * | player { nullptr } |
| Media player for file/URL sources. | |
| QVideoSink * | sink { nullptr } |
| Video sink feeding decoded frames into the widget. | |
| QImage | last_frame |
| Most recent received frame as an image. | |
| bool | loop_enabled { true } |
| Whether playback looping is enabled. | |
| QString | last_error |
| Last error string to display when no frame is available. | |
| QCamera * | camera { nullptr } |
| Active camera (if using live input). | |
| QMediaCaptureSession * | session { nullptr } |
| Capture session binding camera to sink. | |
| QByteArray | camera_id |
| Selected camera id. | |
| QVector< event_instance > | events |
| Transient events currently displayed. | |
| QElapsedTimer | repaint_timer |
| Timer throttling repaint frequency. | |
| int | repaint_interval_ms { 66 } |
| Minimum repaint interval in ms. | |
| QHash< QString, QDateTime > | line_highlights |
| Line highlight timestamps by line name. | |
| int | line_highlight_ttl_ms { 2500 } |
| Highlight time-to-live in ms. | |
| QHash< QString, hit_info > | line_hits |
| Optional hit positions per line name. | |
Widget representing one video stream cell in the frontend.
A stream cell is a self-contained view of a video source that can be:
Coordinate system:
Interaction:
Rendering:
Definition at line 75 of file stream_cell.hpp.
|
explicit |
Construct a stream cell.
| name | Logical stream name displayed in the widget. |
| parent | Optional parent widget. |
Definition at line 18 of file stream_cell.cpp.
References build_ui(), close_btn, focus_btn, and name_label.

| void stream_cell::add_event | ( | const QPointF & | pos_pct, |
| const QColor & | color ) |
Add a transient event marker.
| pos_pct | Event position in percentage coordinates. |
| color | Event color. |
Definition at line 183 of file stream_cell.cpp.
| void stream_cell::add_persistent_line | ( | const line_instance & | line | ) |
Append a persistent line to the list.
| line | Line instance to add. |
Definition at line 100 of file stream_cell.cpp.
|
private |
Build child UI widgets (buttons, sink/player connections).
Definition at line 329 of file stream_cell.cpp.
References close_btn, focus_btn, and update_icon().
Referenced by stream_cell().


| void stream_cell::clear_draft | ( | ) |
Clear all draft data (points, hover point, preview flag).
Definition at line 86 of file stream_cell.cpp.
References draft_preview.
Referenced by controller::apply_added_line(), controller::apply_template_preview(), controller::on_active_edit_mode_changed(), controller::on_active_stream_selected(), and set_active().

| void stream_cell::clear_persistent_lines | ( | ) |
Remove all persistent lines.
Definition at line 105 of file stream_cell.cpp.
|
nodiscard |
Get whether current draft line is closed.
Definition at line 42 of file stream_cell.cpp.
References draft_line_closed.
|
nodiscard |
|
nodiscard |
Get current draft line name.
Definition at line 44 of file stream_cell.cpp.
|
nodiscard |
Get current draft polyline points (percentage coordinates).
Definition at line 38 of file stream_cell.cpp.
|
private |
Draw the draft line (if any).
Definition at line 573 of file stream_cell.cpp.
Referenced by paintEvent().

|
private |
Draw transient events and prune expired ones.
Definition at line 673 of file stream_cell.cpp.
Referenced by paintEvent().

|
private |
Draw hover coordinate text (if enabled).
Definition at line 597 of file stream_cell.cpp.
Referenced by paintEvent().

|
private |
Draw hover point indicator (if any).
Definition at line 584 of file stream_cell.cpp.
Referenced by paintEvent().

|
private |
Draw all persistent lines and their labels/highlights.
Definition at line 471 of file stream_cell.cpp.
Referenced by paintEvent().

|
private |
Draw a polyline/polygon with point markers.
Points are given in percentage coordinates and projected to widget space.
| p | Painter to draw with. |
| pts_pct | Points in percentage coordinates. |
| color | Stroke color. |
| closed | Whether to draw polygon instead of polyline. |
| style | Pen style. |
| width | Pen width in pixels. |
Definition at line 441 of file stream_cell.cpp.
|
private |
Draw preview segment from last draft point to hover point.
Definition at line 611 of file stream_cell.cpp.
Referenced by paintEvent().

|
private |
Draw stream name overlay at top-left.
Definition at line 633 of file stream_cell.cpp.
Referenced by paintEvent().

|
signal |
Emitted whenever a new frame image becomes available.
Useful for forwarding frames to backend processing or snapshots.
| stream_name | Name of the stream. |
| image | Converted QImage representing the latest frame. |
|
nodiscard |
Get logical name of this stream cell.
Definition at line 34 of file stream_cell.cpp.
Referenced by board::set_active_stream().

| void stream_cell::highlight_line | ( | const QString & | line_name | ) |
Highlight a persistent line by name.
Triggers a temporal highlight animation (thicker/alpha pulse).
| line_name | Name of the line to highlight. |
Definition at line 200 of file stream_cell.cpp.
| void stream_cell::highlight_line_at | ( | const QString & | line_name, |
| const QPointF & | pos_pct ) |
Highlight a line and record a hit position for spatial falloff.
The highlight animation will concentrate around pos_pct if the line supports segment-wise highlighting.
| line_name | Name of the line to highlight. |
| pos_pct | Hit position in percentage coordinates. |
Definition at line 208 of file stream_cell.cpp.
| bool stream_cell::is_active | ( | ) | const |
Check whether this cell is currently active (focused).
Definition at line 36 of file stream_cell.cpp.
References active.
| bool stream_cell::is_draft_preview | ( | ) | const |
Check whether the draft is in preview-only mode.
Preview mode means draft is shown but not necessarily editable.
Definition at line 48 of file stream_cell.cpp.
References draft_preview.
|
overrideprotected |
Key press handler for draft undo.
Definition at line 305 of file stream_cell.cpp.
References active, and drawing_enabled.
|
private |
Compute label anchor position for a line in pixel coordinates.
Uses first or last point depending on closed flag.
Definition at line 643 of file stream_cell.cpp.
|
overrideprotected |
Leave handler to clear hover state.
Definition at line 299 of file stream_cell.cpp.
|
overrideprotected |
Mouse move handler for hover updates while drawing.
Definition at line 288 of file stream_cell.cpp.
References active, and drawing_enabled.
|
overrideprotected |
Mouse press handler for drawing draft points.
Definition at line 265 of file stream_cell.cpp.
References active, close_btn, drawing_enabled, and focus_btn.
|
privateslot |
Slot called on camera errors.
Stores camera error string and triggers a repaint.
Definition at line 768 of file stream_cell.cpp.
|
privateslot |
Slot called when the video sink receives a new frame.
Converts the frame to QImage, emits frame_ready, and schedules repaint respecting repaint_interval_ms.
Definition at line 714 of file stream_cell.cpp.
|
privateslot |
Slot called on media status changes.
Used to implement looping on end-of-media when enabled.
Definition at line 743 of file stream_cell.cpp.
References loop_enabled.
|
privateslot |
Slot called when media player errors occur.
Stores the error string and triggers a repaint.
Definition at line 760 of file stream_cell.cpp.
|
overrideprotected |
Paint handler.
Draws:
Definition at line 223 of file stream_cell.cpp.
References draw_draft(), draw_events(), draw_hover_coords(), draw_hover_point(), draw_persistent(), draw_preview_segment(), draw_stream_name(), and line_highlight_ttl_ms.

|
signal |
Emitted when the user requests closing this stream cell.
Typically triggered by clicking the close button.
| name | Stream cell name. |
|
signal |
Emitted when the user requests focusing/enlarging this cell.
Typically triggered by clicking the focus button.
| name | Stream cell name. |
| void stream_cell::set_active | ( | bool | val | ) |
Set active (focused) state.
Deactivating a cell automatically disables drawing and clears draft.
| val | New active state. |
Definition at line 50 of file stream_cell.cpp.
References active, clear_draft(), set_drawing_enabled(), and update_icon().
Referenced by board::clear_active(), board::set_active_stream(), and board::take_active_cell().


| void stream_cell::set_camera_id | ( | const QByteArray & | id | ) |
Switch to camera input by device id.
Stops any previous player/camera, creates capture session if needed, finds a matching camera device by id, and starts capture.
| id | Camera device id returned by Qt multimedia. |
Definition at line 137 of file stream_cell.cpp.
| void stream_cell::set_draft_params | ( | const QString & | name, |
| const QColor & | color, | ||
| bool | closed ) |
Set draft line parameters (name, color, closed flag).
Does not modify draft points.
| name | Draft line name. |
| color | Draft line color. |
| closed | Draft line closed flag. |
Definition at line 72 of file stream_cell.cpp.
References draft_line_closed.
| void stream_cell::set_draft_points_pct | ( | const std::vector< QPointF > & | pts | ) |
Replace current draft points (percentage coordinates).
| pts | New draft points. |
Definition at line 81 of file stream_cell.cpp.
| void stream_cell::set_draft_preview | ( | bool | on | ) |
Enable or disable draft preview mode.
| on | True to enable preview. |
Definition at line 110 of file stream_cell.cpp.
References draft_preview.
| void stream_cell::set_drawing_enabled | ( | bool | on | ) |
Enable or disable interactive drawing on this cell.
Enabling drawing also enables mouse tracking to receive hover updates.
| on | True to enable drawing. |
Definition at line 63 of file stream_cell.cpp.
References drawing_enabled.
Referenced by controller::on_active_edit_mode_changed(), controller::on_active_stream_selected(), and set_active().

| void stream_cell::set_labels_enabled | ( | bool | on | ) |
Enable or disable rendering of persistent line labels.
Labels are only shown when the cell is active.
| on | True to enable labels. |
Definition at line 115 of file stream_cell.cpp.
References labels_enabled.
Referenced by controller::on_active_labels_enabled_changed(), and controller::on_active_stream_selected().

| void stream_cell::set_loop | ( | bool | on | ) |
Enable or disable looping for file-based playback.
| on | True to loop on end-of-media. |
Definition at line 135 of file stream_cell.cpp.
References loop_enabled.
Referenced by controller::handle_show_stream_changed().

| void stream_cell::set_persistent_lines | ( | const std::vector< line_instance > & | lines | ) |
Replace all persistent lines.
| lines | New list of persistent line instances. |
Definition at line 93 of file stream_cell.cpp.
| void stream_cell::set_repaint_interval_ms | ( | int | ms | ) |
Set minimum repaint interval for video frame updates.
Frames arriving faster than this interval will be coalesced.
| ms | Interval in milliseconds (> 0). |
Definition at line 193 of file stream_cell.cpp.
References repaint_interval_ms.
| void stream_cell::set_source | ( | const QUrl & | source | ) |
Set media player source.
If a media player is available, switches it to source and starts playback.
| source | URL of local file or network stream. |
Definition at line 123 of file stream_cell.cpp.
|
private |
Convert pixel position to percentage coordinates.
Definition at line 653 of file stream_cell.cpp.
|
private |
Convert percentage coordinates to pixel position.
Definition at line 669 of file stream_cell.cpp.
|
private |
Update focus button icon/tooltip based on active state.
Definition at line 400 of file stream_cell.cpp.
References active, and focus_btn.
Referenced by build_ui(), and set_active().

|
private |
Whether the cell is focused/active.
Definition at line 465 of file stream_cell.hpp.
Referenced by is_active(), keyPressEvent(), mouseMoveEvent(), mousePressEvent(), set_active(), and update_icon().
|
private |
Active camera (if using live input).
Definition at line 500 of file stream_cell.hpp.
|
private |
Selected camera id.
Definition at line 504 of file stream_cell.hpp.
|
private |
UI close button (top-right).
Definition at line 458 of file stream_cell.hpp.
Referenced by build_ui(), mousePressEvent(), and stream_cell().
|
private |
Draft line closed flag.
Definition at line 479 of file stream_cell.hpp.
Referenced by draft_closed(), and set_draft_params().
|
private |
|
private |
Draft line name.
Definition at line 475 of file stream_cell.hpp.
|
private |
Draft polyline points in percentage coordinates.
Definition at line 481 of file stream_cell.hpp.
|
private |
Whether draft line is shown in preview mode.
Definition at line 470 of file stream_cell.hpp.
Referenced by clear_draft(), is_draft_preview(), and set_draft_preview().
|
private |
Whether interactive drawing is enabled.
Definition at line 468 of file stream_cell.hpp.
Referenced by keyPressEvent(), mouseMoveEvent(), mousePressEvent(), and set_drawing_enabled().
|
private |
Transient events currently displayed.
Definition at line 507 of file stream_cell.hpp.
|
private |
UI focus/enlarge button (top-right).
Definition at line 460 of file stream_cell.hpp.
Referenced by build_ui(), mousePressEvent(), stream_cell(), and update_icon().
|
private |
Current hover position in percentage coordinates.
Definition at line 483 of file stream_cell.hpp.
|
private |
Whether persistent line labels are shown when active.
Definition at line 472 of file stream_cell.hpp.
Referenced by set_labels_enabled().
|
private |
Last error string to display when no frame is available.
Definition at line 497 of file stream_cell.hpp.
|
private |
Most recent received frame as an image.
Definition at line 493 of file stream_cell.hpp.
|
private |
Highlight time-to-live in ms.
Definition at line 522 of file stream_cell.hpp.
Referenced by paintEvent().
|
private |
Line highlight timestamps by line name.
Used to animate highlight effects for a fixed TTL.
Definition at line 519 of file stream_cell.hpp.
|
private |
Optional hit positions per line name.
Definition at line 537 of file stream_cell.hpp.
|
private |
Whether playback looping is enabled.
Definition at line 495 of file stream_cell.hpp.
Referenced by on_media_status_changed(), and set_loop().
|
private |
Logical stream name.
Definition at line 455 of file stream_cell.hpp.
|
private |
Optional name label (unused in current implementation).
Definition at line 462 of file stream_cell.hpp.
Referenced by stream_cell().
|
private |
Persisted lines to render.
Definition at line 486 of file stream_cell.hpp.
|
private |
|
private |
Minimum repaint interval in ms.
Definition at line 512 of file stream_cell.hpp.
Referenced by set_repaint_interval_ms().
|
private |
Timer throttling repaint frequency.
Definition at line 510 of file stream_cell.hpp.
|
private |
Capture session binding camera to sink.
Definition at line 502 of file stream_cell.hpp.
|
private |
Video sink feeding decoded frames into the widget.
Definition at line 491 of file stream_cell.hpp.