Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
roomview.h
1#ifndef CAVOKE_CLIENT_ROOMVIEW_H
2#define CAVOKE_CLIENT_ROOMVIEW_H
3
4#include <QMainWindow>
5#include "entities/gameinfo.h"
6#include "entities/role.h"
7#include "entities/roominfo.h"
8#include "entities/sessioninfo.h"
9#include "entities/validationresult.h"
10
11namespace Ui {
12class RoomView;
13}
14
15class RoomView : public QMainWindow {
16 Q_OBJECT
17public:
18 enum class CreatingSessionStatus {
19 UNKNOWN,
20 WAIT_FOR_THE_HOST,
21 NOW_YOU_CAN_JOIN,
22 YOU_CAN_CREATE
23 };
24 explicit RoomView(QWidget *parent = nullptr);
25 ~RoomView();
26
27public slots:
28 void updateRoomInfo(const RoomInfo &roomInfo);
29 void updateSessionInfo(const SessionInfo &sessionInfo); // Temporary
30 void clear();
31 void gotGamesListUpdate(const std::vector<GameInfo> &newGamesList);
32
33signals:
34 void createdSession(const QString &gameId);
35 void joinedSession(const QString &sessionId);
36 void requestedSessionUpdate(const QString &sessionId);
37 void shownStartView();
38 void leftRoom();
39
40private slots:
41 void updateStatus(CreatingSessionStatus newStatus);
42 void on_backButton_clicked();
43 void on_joinSessionButton_clicked();
44 void on_createSessionButton_clicked();
45
46private:
47 Ui::RoomView *ui;
48 const std::map<CreatingSessionStatus, QString> STATUS = {
49 {CreatingSessionStatus::UNKNOWN, "Unknown"},
50 {CreatingSessionStatus::WAIT_FOR_THE_HOST,
51 "Wait for the host to create a session"},
52 {CreatingSessionStatus::NOW_YOU_CAN_JOIN,
53 "Now you can join the session!"},
54 {CreatingSessionStatus::YOU_CAN_CREATE, "You can create a session"},
55 };
56 QString sessionId;
57 CreatingSessionStatus status = CreatingSessionStatus::UNKNOWN;
58 bool is_host = false; // Wow, this is very cool
59};
60
61#endif // CAVOKE_CLIENT_ROOMVIEW_H