YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
Loading...
Searching...
No Matches
board Class Referencefinal

Main stream layout widget: grid plus optional focused view. More...

#include <frontend/include/widgets/board.hpp>

Inheritance diagram for board:
Collaboration diagram for board:

Public Member Functions

 board (QWidget *parent=nullptr)
 Construct the board widget.
grid_viewgrid_mode () const
 Access the grid view (thumbnail mode).
stream_cellactive_cell () const
 Get the currently active (focused) stream cell, if any.
void set_active_stream (const QString &name)
 Make a stream active by name.
void clear_active ()
 Clear active mode and return the active cell to the grid.
stream_celltake_active_cell ()
 Detach and return the active cell without putting it back to grid.

Private Attributes

grid_viewgrid
 Grid view holding all non-active stream cells.
QWidget * active_container
 Container widget for the active stream view.
QVBoxLayout * active_layout
 Layout inside active_container.
stream_cellactive_tile
 Currently active stream cell (reparented into active container).

Detailed Description

Main stream layout widget: grid plus optional focused view.

The board maintains two display modes simultaneously:

  • Grid mode: all streams are shown in a grid_view.
  • Active mode: one stream is temporarily taken out of the grid and placed into an enlarged container at the top.

Ownership model:

  • The board owns the grid view and the active container.
  • Stream cells are owned by the grid view most of the time.
  • When a stream becomes active, its cell is reparented into the active container and later returned to the grid (no deletion involved).
Note
The class is final and not intended for subclassing.

Definition at line 40 of file board.hpp.

Constructor & Destructor Documentation

◆ board()

board::board ( QWidget * parent = nullptr)
explicit

Construct the board widget.

Creates:

  • a grid_view for thumbnail layout,
  • an active container (initially hidden) that can host one active cell,
  • an outer vertical layout stacking active container above the grid.
Parameters
parentOptional parent widget.

Definition at line 8 of file board.cpp.

9 : QWidget(parent)
10 , grid(new grid_view(this))
11 , active_container(new QWidget(this))
12 , active_layout(new QVBoxLayout(active_container))
13 , active_tile(nullptr) {
14 active_layout->setContentsMargins(6, 6, 6, 6);
15 active_layout->setSpacing(6);
17
18 auto* outer = new QVBoxLayout(this);
19 outer->setContentsMargins(0, 0, 0, 0);
20 outer->setSpacing(6);
21
22 outer->addWidget(active_container, 3);
23
24 outer->addWidget(grid, 1);
25
26 setLayout(outer);
27 active_container->hide();
28}
QWidget * active_container
Container widget for the active stream view.
Definition board.hpp:108
QVBoxLayout * active_layout
Layout inside active_container.
Definition board.hpp:111
stream_cell * active_tile
Currently active stream cell (reparented into active container).
Definition board.hpp:115
grid_view * grid
Grid view holding all non-active stream cells.
Definition board.hpp:105

References active_layout, active_tile, and grid.

Member Function Documentation

◆ active_cell()

◆ clear_active()

void board::clear_active ( )

Clear active mode and return the active cell to the grid.

If no stream is active, this is a no-op.

Definition at line 66 of file board.cpp.

66 {
67 if (!active_tile || !grid) {
68 return;
69 }
70 active_layout->removeWidget(active_tile);
71 active_tile->set_active(false);
72 grid->put_stream_cell(active_tile);
73 // active_tile->deleteLater();
74 active_tile = nullptr;
75
76 active_container->hide();
77 active_container->updateGeometry();
78}

References active_layout, active_tile, grid, grid_view::put_stream_cell(), and stream_cell::set_active().

Referenced by controller::on_active_stream_selected().

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

◆ grid_mode()

grid_view * board::grid_mode ( ) const

Access the grid view (thumbnail mode).

Returns
Pointer to owned grid_view.

Definition at line 30 of file board.cpp.

30{ return grid; }

References grid.

Referenced by controller::controller().

Here is the caller graph for this function:

◆ set_active_stream()

void board::set_active_stream ( const QString & name)

Make a stream active by name.

If a different stream is already active, it is returned to the grid first. The requested cell is taken from the grid, reparented into the active container, marked active, and enlarged.

If name is empty or not found in grid, the call is ignored.

Parameters
nameName of the stream to focus.

Definition at line 34 of file board.cpp.

34 {
35 if (!grid || name.isEmpty()) {
36 return;
37 }
38 if (active_tile && active_tile->get_name() == name) {
39 return;
40 }
41
42 if (active_tile) {
43 active_layout->removeWidget(active_tile);
44 active_tile->set_active(false);
45 grid->put_stream_cell(active_tile);
46 active_tile = nullptr;
47 }
48
49 stream_cell* cell = grid->take_stream_cell(name);
50 if (!cell) {
51 return;
52 }
53 active_container->show();
54
55 cell->setParent(active_container);
56 cell->set_active(true);
57
58 cell->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
59 cell->show();
60 active_layout->addWidget(cell);
61 active_tile = cell;
62
63 active_container->updateGeometry();
64}
void set_active(bool val)
Set active (focused) state.

References active_layout, active_tile, stream_cell::get_name(), grid, grid_view::put_stream_cell(), stream_cell::set_active(), and grid_view::take_stream_cell().

Referenced by controller::on_active_stream_selected().

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

◆ take_active_cell()

stream_cell * board::take_active_cell ( )

Detach and return the active cell without putting it back to grid.

The returned cell:

  • is removed from the active layout,
  • is marked inactive,
  • remains parented to this board until the caller reparents it.

After this call there is no active stream.

Returns
The previously active cell, or nullptr if none.

Definition at line 80 of file board.cpp.

80 {
81 if (!active_tile) {
82 return nullptr;
83 }
84
85 active_layout->removeWidget(active_tile);
86 active_tile->set_active(false);
87
88 active_container->hide();
89 active_container->updateGeometry();
90
91 stream_cell* out = active_tile;
92 active_tile = nullptr;
93 return out;
94}

References active_layout, active_tile, and stream_cell::set_active().

Referenced by controller::handle_show_stream_changed().

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

Member Data Documentation

◆ active_container

QWidget* board::active_container
private

Container widget for the active stream view.

Definition at line 108 of file board.hpp.

◆ active_layout

QVBoxLayout* board::active_layout
private

Layout inside active_container.

Definition at line 111 of file board.hpp.

Referenced by board(), clear_active(), set_active_stream(), and take_active_cell().

◆ active_tile

stream_cell* board::active_tile
private

Currently active stream cell (reparented into active container).

Definition at line 115 of file board.hpp.

Referenced by active_cell(), board(), clear_active(), set_active_stream(), and take_active_cell().

◆ grid

grid_view* board::grid
private

Grid view holding all non-active stream cells.

Definition at line 105 of file board.hpp.

Referenced by board(), clear_active(), grid_mode(), and set_active_stream().


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