|
YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
|
Scrollable grid of stream thumbnails. More...
#include <frontend/include/widgets/grid_view.hpp>


Signals | |
| void | stream_closed (const QString &name) |
| Emitted after a stream cell was closed and removed. | |
| void | stream_enlarge (const QString &name) |
| Emitted when a stream cell requests focus/enlargement. | |
Public Member Functions | |
| grid_view (QWidget *parent=nullptr) | |
| Construct an empty grid view. | |
| bool | has_stream (const QString &name) const |
| Check whether a stream with given name exists in the grid. | |
| QStringList | stream_names () const |
| Get names of all streams currently in the grid. | |
| void | add_stream (const QString &name) |
| Add a new stream cell to the grid. | |
| void | remove_stream (const QString &name) |
| Remove a stream cell from the grid. | |
| stream_cell * | take_stream_cell (const QString &name) |
| Detach a stream cell from the grid without deleting it. | |
| void | put_stream_cell (stream_cell *cell) |
| Return a previously taken cell back into the grid. | |
| stream_cell * | peek_stream_cell (const QString &name) const |
| Get a pointer to a cell without removing it. | |
Private Member Functions | |
| void | rebuild_layout () |
| Recompute and rebuild the grid layout. | |
| void | close_requested (const QString &name) |
| Internal handler for stream_cell::request_close. | |
| void | enlarge_requested (const QString &name) |
| Internal handler for stream_cell::request_focus. | |
Private Attributes | |
| QScrollArea * | scroll |
| Scroll area wrapping the grid container. | |
| QWidget * | grid_container |
| Widget that owns the grid layout and all tiles. | |
| QGridLayout * | grid_layout |
| Grid layout arranging tiles. | |
| QMap< QString, stream_cell * > | tiles |
| Map of stream name to corresponding tile widget. | |
Scrollable grid of stream thumbnails.
Responsibilities:
Ownership model:
Threading:
Definition at line 44 of file grid_view.hpp.
|
explicit |
Construct an empty grid view.
Creates an internal QScrollArea with a container widget holding a QGridLayout. The scroll area is configured for horizontal scrolling when needed and no vertical scrollbar (layout expands horizontally).
| parent | Optional parent widget. |
Definition at line 13 of file grid_view.cpp.
References grid_layout, and scroll.
Referenced by controller::setup_grid_connections().

| void grid_view::add_stream | ( | const QString & | name | ) |
Add a new stream cell to the grid.
If name is empty or already present, the call is ignored. The created cell is connected to internal handlers and the layout is rebuilt.
| name | Logical stream name. |
Definition at line 40 of file grid_view.cpp.
References kMinTileH, kMinTileW, and rebuild_layout().
Referenced by controller::handle_show_stream_changed().


|
private |
Internal handler for stream_cell::request_close.
Removes the stream and emits stream_closed.
| name | Stream name. |
Definition at line 116 of file grid_view.cpp.
|
private |
Internal handler for stream_cell::request_focus.
Emits stream_enlarge.
| name | Stream name. |
Definition at line 121 of file grid_view.cpp.
| bool grid_view::has_stream | ( | const QString & | name | ) | const |
Check whether a stream with given name exists in the grid.
| name | Stream name. |
Definition at line 34 of file grid_view.cpp.
| stream_cell * grid_view::peek_stream_cell | ( | const QString & | name | ) | const |
Get a pointer to a cell without removing it.
| name | Stream name. |
Definition at line 108 of file grid_view.cpp.
Referenced by controller::handle_show_stream_changed(), and controller::tile_for_stream_name().

| void grid_view::put_stream_cell | ( | stream_cell * | cell | ) |
Return a previously taken cell back into the grid.
The cell is reparented to the grid container, inserted by its name, shown, and the layout is rebuilt. If a cell with the same name already exists, the call is ignored.
| cell | Cell to put back. |
Definition at line 91 of file grid_view.cpp.
References rebuild_layout().
Referenced by board::clear_active(), and board::set_active_stream().


|
private |
Recompute and rebuild the grid layout.
Clears existing layout items, hides widgets during rebuild, and places all current tiles into a grid with approximately sqrt(n) columns, stretched equally.
If there are no tiles, the widget hides itself.
Definition at line 127 of file grid_view.cpp.
References ceil_div(), and grid_layout.
Referenced by add_stream(), put_stream_cell(), remove_stream(), and take_stream_cell().


| void grid_view::remove_stream | ( | const QString & | name | ) |
Remove a stream cell from the grid.
If no such stream exists, this is a no-op. Otherwise the cell is removed from the layout and scheduled for deletion with deleteLater().
| name | Logical stream name. |
Definition at line 60 of file grid_view.cpp.
References grid_layout, and rebuild_layout().
Referenced by controller::handle_show_stream_changed().


|
signal |
Emitted after a stream cell was closed and removed.
Triggered by the close button in a cell.
| name | Name of the closed stream. |
|
signal |
Emitted when a stream cell requests focus/enlargement.
Triggered by the focus/enlarge button in a cell.
| name | Name of the stream to enlarge. |
Referenced by controller::setup_grid_connections().

| QStringList grid_view::stream_names | ( | ) | const |
Get names of all streams currently in the grid.
Definition at line 38 of file grid_view.cpp.
| stream_cell * grid_view::take_stream_cell | ( | const QString & | name | ) |
Detach a stream cell from the grid without deleting it.
This is used when a stream becomes "active" elsewhere. The cell is:
Layout is rebuilt afterwards.
| name | Stream name to take. |
Definition at line 75 of file grid_view.cpp.
References grid_layout, and rebuild_layout().
Referenced by board::set_active_stream().


|
private |
Widget that owns the grid layout and all tiles.
Definition at line 183 of file grid_view.hpp.
|
private |
Grid layout arranging tiles.
Definition at line 186 of file grid_view.hpp.
Referenced by grid_view(), rebuild_layout(), remove_stream(), and take_stream_cell().
|
private |
Scroll area wrapping the grid container.
Definition at line 180 of file grid_view.hpp.
Referenced by grid_view().
|
private |
Map of stream name to corresponding tile widget.
Definition at line 189 of file grid_view.hpp.