Provides a widget for displaying, filtering, joining, spectating, and creating games in a room.
More...
#include <game_selector.h>
|
| void | gameJoined (int gameId) |
| | Emitted when a game has been successfully joined.
|
|
| void | actSetFilter () |
| | Opens a dialog to set filters for the game list.
|
| void | actClearFilter () |
| | Clears all filters applied to the game list.
|
| void | actCreate () |
| | Opens the dialog to create a new game in the current room.
|
| void | actJoin () |
| | Joins the currently selected game as a player.
|
| void | actJoinAsJudge () |
| | Joins the currently selected game as a judge.
|
| void | actJoinAsSpectator () |
| | Joins the currently selected game as a spectator.
|
| void | actJoinAsJudgeSpectator () |
| void | customContextMenu (const QPoint &point) |
| | Shows the custom context menu for a game when right-clicked.
|
| void | actSelectedGameChanged (const QModelIndex ¤t, const QModelIndex &previous) |
| | Slot called when the selected game changes.
|
| void | checkResponse (const Response &response) |
| | Processes server responses for join or spectate commands.
|
| void | ignoreListReceived (const QList< ServerInfo_User > &_ignoreList) |
| | Refreshes the game list when the ignore list is received from the server.
|
| void | processAddToListEvent (const Event_AddToList &event) |
| | Processes events where a user is added to a list (e.g., ignore or buddy).
|
| void | processRemoveFromListEvent (const Event_RemoveFromList &event) |
| | Processes events where a user is removed from a list (e.g., ignore or buddy).
|
|
| void | updateTitle () |
| | Updates the widget title to reflect the current number of displayed games.
|
| void | disableButtons () |
| | Disables create/join/spectate buttons.
|
| void | enableButtons () |
| | Enables buttons for the currently selected game.
|
| void | enableButtonsForIndex (const QModelIndex ¤t) |
| | Enables buttons for a specific game index.
|
| void | joinGame (bool asSpectator=false, bool asJudge=false) |
| | Performs the join or spectate action for the currently selected game.
|
Provides a widget for displaying, filtering, joining, spectating, and creating games in a room.
The GameSelector displays all available games in a QTreeView. It supports filtering, creating, joining, spectating, and viewing game details. Integrates with TabSupervisor and TabRoom for room and game management.
◆ GameSelector()
| GameSelector::GameSelector |
( |
AbstractClient * | _client, |
|
|
TabSupervisor * | _tabSupervisor, |
|
|
TabRoom * | _room, |
|
|
const QMap< int, QString > & | _rooms, |
|
|
const QMap< int, GameTypeMap > & | _gameTypes, |
|
|
const bool | restoresettings, |
|
|
const bool | _showfilters, |
|
|
QWidget * | parent = nullptr ) |
Constructs a GameSelector widget.
- Parameters
-
| _client | The network client used to communicate with the server. |
| _tabSupervisor | Reference to TabSupervisor for managing tabs and rooms. |
| _room | Pointer to the current room; nullptr if no room is selected. |
| _rooms | Map of room IDs to room names. |
| _gameTypes | Map of room IDs to their available game types. |
| restoresettings | Whether to restore filter settings from previous sessions. |
| _showfilters | Whether to display filter buttons. |
| parent | Parent QWidget. |
◆ actClearFilter
| void GameSelector::actClearFilter |
( |
| ) |
|
|
privateslot |
Clears all filters applied to the game list.
Resets the proxy model to show all games.
◆ actCreate
| void GameSelector::actCreate |
( |
| ) |
|
|
privateslot |
Opens the dialog to create a new game in the current room.
◆ actJoin
| void GameSelector::actJoin |
( |
| ) |
|
|
privateslot |
Joins the currently selected game as a player.
◆ actJoinAsJudge
| void GameSelector::actJoinAsJudge |
( |
| ) |
|
|
privateslot |
Joins the currently selected game as a judge.
◆ actJoinAsJudgeSpectator
| void GameSelector::actJoinAsJudgeSpectator |
( |
| ) |
|
|
privateslot |
◆ actJoinAsSpectator
| void GameSelector::actJoinAsSpectator |
( |
| ) |
|
|
privateslot |
Joins the currently selected game as a spectator.
◆ actSelectedGameChanged
| void GameSelector::actSelectedGameChanged |
( |
const QModelIndex & | current, |
|
|
const QModelIndex & | previous ) |
|
privateslot |
Slot called when the selected game changes.
- Parameters
-
| current | The currently selected index. |
| previous | The previously selected index. |
Updates the enabled/disabled state of buttons depending on the selected game.
◆ actSetFilter
| void GameSelector::actSetFilter |
( |
| ) |
|
|
privateslot |
Opens a dialog to set filters for the game list.
Updates the proxy model with selected filter parameters and refreshes the displayed game list.
◆ checkResponse
| void GameSelector::checkResponse |
( |
const Response & | response | ) |
|
|
privateslot |
Processes server responses for join or spectate commands.
- Parameters
-
| response | The response from the server. |
Displays error messages for failed join/spectate attempts.
◆ customContextMenu
| void GameSelector::customContextMenu |
( |
const QPoint & | point | ) |
|
|
privateslot |
Shows the custom context menu for a game when right-clicked.
- Parameters
-
| point | The point at which the context menu is requested. |
◆ disableButtons()
| void GameSelector::disableButtons |
( |
| ) |
|
|
private |
Disables create/join/spectate buttons.
◆ enableButtons()
| void GameSelector::enableButtons |
( |
| ) |
|
|
private |
Enables buttons for the currently selected game.
◆ enableButtonsForIndex()
| void GameSelector::enableButtonsForIndex |
( |
const QModelIndex & | current | ) |
|
|
private |
Enables buttons for a specific game index.
- Parameters
-
| current | The index of the currently selected game. |
◆ gameJoined
| void GameSelector::gameJoined |
( |
int | gameId | ) |
|
|
signal |
Emitted when a game has been successfully joined.
- Parameters
-
| gameId | The ID of the joined game. |
◆ ignoreListReceived
| void GameSelector::ignoreListReceived |
( |
const QList< ServerInfo_User > & | _ignoreList | ) |
|
|
privateslot |
Refreshes the game list when the ignore list is received from the server.
- Parameters
-
| _ignoreList | The list of users being ignored. |
◆ joinGame()
| void GameSelector::joinGame |
( |
bool | asSpectator = false, |
|
|
bool | asJudge = false ) |
|
private |
Performs the join or spectate action for the currently selected game.
- Parameters
-
| asSpectator | True to join as a spectator, false to join as a player. |
| asJudge | True to join as a judge, false to join as a player. |
Handles password prompts, overrides, and sending the join command to the server.
◆ processAddToListEvent
| void GameSelector::processAddToListEvent |
( |
const Event_AddToList & | event | ) |
|
|
privateslot |
Processes events where a user is added to a list (e.g., ignore or buddy).
- Parameters
-
| event | The event information. |
◆ processGameInfo()
| void GameSelector::processGameInfo |
( |
const ServerInfo_Game & | info | ) |
|
Updates or adds a game entry in the list.
- Parameters
-
| info | The ServerInfo_Game object containing information about the game to update. |
◆ processRemoveFromListEvent
| void GameSelector::processRemoveFromListEvent |
( |
const Event_RemoveFromList & | event | ) |
|
|
privateslot |
Processes events where a user is removed from a list (e.g., ignore or buddy).
- Parameters
-
| event | The event information. |
◆ retranslateUi()
| void GameSelector::retranslateUi |
( |
| ) |
|
Updates UI text for translation/localization.
◆ updateTitle()
| void GameSelector::updateTitle |
( |
| ) |
|
|
private |
Updates the widget title to reflect the current number of displayed games.
Shows the number of visible games versus total games if filters are enabled.
◆ clearFilterButton
| QPushButton* GameSelector::clearFilterButton |
|
private |
Button to clear active filters.
◆ client
The network client used to communicate with the server.
◆ createButton
| QPushButton* GameSelector::createButton |
|
private |
Button to create a new game (only if room is set).
◆ filterButton
| QPushButton* GameSelector::filterButton |
|
private |
Button to open the filter dialog.
◆ gameListModel
Model containing all games.
◆ gameListProxyModel
Proxy model for filtering and sorting the game list.
◆ gameListView
| QTreeView* GameSelector::gameListView |
|
private |
View widget for displaying the game list.
◆ gameTypeMap
Mapping of game types for the current room.
◆ joinAsJudgeButton
| QPushButton* GameSelector::joinAsJudgeButton |
|
private |
Button to join the selected game as a judge.
◆ joinAsJudgeSpectatorButton
| QPushButton* GameSelector::joinAsJudgeSpectatorButton |
|
private |
Button to join the selected game as a spectating judge.
◆ joinButton
| QPushButton* GameSelector::joinButton |
|
private |
Button to join the selected game.
◆ quickFilterToolBar
◆ room
◆ showFilters
| const bool GameSelector::showFilters |
|
private |
Determines whether filter buttons are displayed.
◆ spectateButton
| QPushButton* GameSelector::spectateButton |
|
private |
Button to spectate the selected game.
◆ tabSupervisor
The documentation for this class was generated from the following files: