Cockatrice/cockatrice/src/game/player/player_list_widget.h
BruebachL f8c4f774cf
[Documentation] Sort *every* file into a doxygen group. (#6198)
* Sort *every* file into a doxygen group.

Took 7 hours 9 minutes

Took 18 seconds

Took 2 minutes

* Lint some ingroup definitions.

Took 10 minutes


Took 2 seconds

* Just include the groups in the Doxyfile in this commit.

Took 3 minutes

* Update some group comments so they link!

Took 14 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2025-09-30 12:13:32 +02:00

71 lines
1.9 KiB
C++

/**
* @file player_list_widget.h
* @ingroup GameWidgets
* @brief TODO: Document this.
*/
#ifndef PLAYERLISTWIDGET_H
#define PLAYERLISTWIDGET_H
#include "player.h"
#include <QIcon>
#include <QMap>
#include <QStyledItemDelegate>
#include <QTreeWidget>
class ServerInfo_PlayerProperties;
class TabSupervisor;
class AbstractClient;
class AbstractGame;
class UserContextMenu;
class PlayerListItemDelegate : public QStyledItemDelegate
{
public:
explicit PlayerListItemDelegate(QObject *parent);
bool editorEvent(QEvent *event,
QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index) override;
};
class PlayerListTWI : public QTreeWidgetItem
{
public:
PlayerListTWI();
bool operator<(const QTreeWidgetItem &other) const override;
};
class PlayerListWidget : public QTreeWidget
{
Q_OBJECT
private:
PlayerListItemDelegate *itemDelegate;
QMap<int, QTreeWidgetItem *> players;
TabSupervisor *tabSupervisor;
AbstractClient *client;
AbstractGame *game;
UserContextMenu *userContextMenu;
QIcon readyIcon, notReadyIcon, concededIcon, playerIcon, judgeIcon, spectatorIcon, lockIcon;
bool gameStarted;
signals:
void openMessageDialog(const QString &userName, bool focus);
public:
PlayerListWidget(TabSupervisor *_tabSupervisor,
AbstractClient *_client,
AbstractGame *_game,
QWidget *parent = nullptr);
void retranslateUi();
void setActivePlayer(int playerId);
void setGameStarted(bool _gameStarted, bool resuming);
void showContextMenu(const QPoint &pos, const QModelIndex &index);
public slots:
void addPlayer(const ServerInfo_PlayerProperties &player);
void removePlayer(int playerId);
void updatePlayerProperties(const ServerInfo_PlayerProperties &prop, int playerId = -1);
};
#endif