1 #ifndef GAMESELECTOR_H 2 #define GAMESELECTOR_H 3 4 #include "gametypemap.h" 5 6 #include <QGroupBox> 7 #include <common/pb/event_add_to_list.pb.h> 8 #include <common/pb/event_remove_from_list.pb.h> 9 10 class QTreeView; 11 class GamesModel; 12 class GamesProxyModel; 13 class QPushButton; 14 class QCheckBox; 15 class QLabel; 16 class AbstractClient; 17 class TabSupervisor; 18 class TabRoom; 19 class ServerInfo_Game; 20 class Response; 21 22 class GameSelector : public QGroupBox 23 { 24 Q_OBJECT 25 private slots: 26 void actSetFilter(); 27 void actClearFilter(); 28 void actCreate(); 29 void actJoin(); 30 void actSelectedGameChanged(const QModelIndex ¤t, const QModelIndex &previous); 31 void checkResponse(const Response &response); 32 33 void ignoreListReceived(const QList<ServerInfo_User> &_ignoreList); 34 void processAddToListEvent(const Event_AddToList &event); 35 void processRemoveFromListEvent(const Event_RemoveFromList &event); 36 signals: 37 void gameJoined(int gameId); 38 39 private: 40 AbstractClient *client; 41 const TabSupervisor *tabSupervisor; 42 TabRoom *room; 43 44 QTreeView *gameListView; 45 GamesModel *gameListModel; 46 GamesProxyModel *gameListProxyModel; 47 QPushButton *filterButton, *clearFilterButton, *createButton, *joinButton, *spectateButton; 48 const bool showFilters; 49 GameTypeMap gameTypeMap; 50 51 void updateTitle(); 52 53 public: 54 GameSelector(AbstractClient *_client, 55 const TabSupervisor *_tabSupervisor, 56 TabRoom *_room, 57 const QMap<int, QString> &_rooms, 58 const QMap<int, GameTypeMap> &_gameTypes, 59 const bool restoresettings, 60 const bool _showfilters, 61 QWidget *parent = nullptr); 62 void retranslateUi(); 63 void processGameInfo(const ServerInfo_Game &info); 64 }; 65 66 #endif 67