Fix Bad Gameplay (#3034)

This commit is contained in:
Zach H 2018-01-19 20:34:14 -05:00 committed by GitHub
parent d1b95aad16
commit bc52882ac4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 805 additions and 1302 deletions

View file

@ -30,97 +30,90 @@ class ServerInfo_User;
class GameReplay;
class DeckList;
class CloseButton : public QAbstractButton
{
class CloseButton : public QAbstractButton {
Q_OBJECT
public:
explicit CloseButton(QWidget *parent = nullptr);
QSize sizeHint() const override;
inline QSize minimumSizeHint() const override { return sizeHint(); }
protected:
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
public:
CloseButton(QWidget *parent = 0);
QSize sizeHint() const;
inline QSize minimumSizeHint() const { return sizeHint(); }
protected:
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
void paintEvent(QPaintEvent *event);
};
class TabSupervisor : public QTabWidget, public UserlistProxy
{
class TabSupervisor : public QTabWidget, public UserlistProxy {
Q_OBJECT
private:
ServerInfo_User *userInfo;
AbstractClient *client;
QList<AbstractClient *> localClients;
TabServer *tabServer;
TabUserLists *tabUserLists;
TabDeckStorage *tabDeckStorage;
TabReplays *tabReplays;
TabAdmin *tabAdmin;
TabLog *tabLog;
QMap<int, TabRoom *> roomTabs;
QMap<int, TabGame *> gameTabs;
QList<TabGame *> replayTabs;
QMap<QString, TabMessage *> messageTabs;
QList<TabDeckEditor *> deckEditorTabs;
int myAddTab(Tab *tab);
void addCloseButtonToTab(Tab *tab, int tabIndex);
QString sanitizeTabName(QString dirty) const;
QString sanitizeHtml(QString dirty) const;
bool isLocalGame;
public:
explicit TabSupervisor(AbstractClient *_client, QWidget *parent = nullptr);
~TabSupervisor() override;
void retranslateUi();
void start(const ServerInfo_User &userInfo);
void startLocal(const QList<AbstractClient *> &_clients);
void stop();
bool getIsLocalGame() const { return isLocalGame; }
int getGameCount() const { return gameTabs.size(); }
TabUserLists *getUserListsTab() const { return tabUserLists; }
ServerInfo_User *getUserInfo() const { return userInfo; }
AbstractClient *getClient() const;
const QMap<int, TabRoom *> &getRoomTabs() const { return roomTabs; }
bool getAdminLocked() const;
bool closeRequest();
bool isOwnUserRegistered() const override;
QString getOwnUsername() const override;
bool isUserBuddy(const QString &userName) const override;
bool isUserIgnored(const QString &userName) const override;
const ServerInfo_User* getOnlineUser(const QString &userName) const override;
signals:
void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>());
void localGameEnded();
void adminLockChanged(bool lock);
void showWindowIfHidden();
public slots:
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
void openReplay(GameReplay *replay);
void maximizeMainWindow();
private slots:
void closeButtonPressed();
void updateCurrent(int index);
void updatePingTime(int value, int max);
void gameJoined(const Event_GameJoined &event);
void localGameJoined(const Event_GameJoined &event);
void gameLeft(TabGame *tab);
void addRoomTab(const ServerInfo_Room &info, bool setCurrent);
void roomLeft(TabRoom *tab);
TabMessage *addMessageTab(const QString &userName, bool focus);
void replayLeft(TabGame *tab);
void processUserLeft(const QString &userName);
void processUserJoined(const ServerInfo_User &userInfo);
void talkLeft(TabMessage *tab);
void deckEditorClosed(TabDeckEditor *tab);
void tabUserEvent(bool globalEvent);
void updateTabText(Tab *tab, const QString &newTabText);
void processRoomEvent(const RoomEvent &event);
void processGameEventContainer(const GameEventContainer &cont);
void processUserMessageEvent(const Event_UserMessage &event);
void processNotifyUserEvent(const Event_NotifyUser &event);
private:
ServerInfo_User *userInfo;
AbstractClient *client;
QList<AbstractClient *> localClients;
TabServer *tabServer;
TabUserLists *tabUserLists;
TabDeckStorage *tabDeckStorage;
TabReplays *tabReplays;
TabAdmin *tabAdmin;
TabLog *tabLog;
QMap<int, TabRoom *> roomTabs;
QMap<int, TabGame *> gameTabs;
QList<TabGame *> replayTabs;
QMap<QString, TabMessage *> messageTabs;
QList<TabDeckEditor *> deckEditorTabs;
int myAddTab(Tab *tab);
void addCloseButtonToTab(Tab *tab, int tabIndex);
QString sanitizeTabName(QString dirty) const;
QString sanitizeHtml(QString dirty) const;
bool isLocalGame;
public:
TabSupervisor(AbstractClient *_client, QWidget *parent = 0);
~TabSupervisor();
void retranslateUi();
void start(const ServerInfo_User &userInfo);
void startLocal(const QList<AbstractClient *> &_clients);
void stop();
bool getIsLocalGame() const { return isLocalGame; }
int getGameCount() const { return gameTabs.size(); }
TabUserLists *getUserListsTab() const { return tabUserLists; }
ServerInfo_User *getUserInfo() const { return userInfo; }
AbstractClient *getClient() const;
const QMap<int, TabRoom *> &getRoomTabs() const { return roomTabs; }
bool getAdminLocked() const;
bool closeRequest();
bool isOwnUserRegistered() const;
QString getOwnUsername() const;
bool isUserBuddy(const QString &userName) const;
bool isUserIgnored(const QString &userName) const;
const ServerInfo_User* getOnlineUser(const QString &userName) const;
signals:
void setMenu(const QList<QMenu *> &newMenuList = QList<QMenu *>());
void localGameEnded();
void adminLockChanged(bool lock);
void showWindowIfHidden();
public slots:
TabDeckEditor *addDeckEditorTab(const DeckLoader *deckToOpen);
void openReplay(GameReplay *replay);
void maximizeMainWindow();
private slots:
void closeButtonPressed();
void updateCurrent(int index);
void updatePingTime(int value, int max);
void gameJoined(const Event_GameJoined &event);
void localGameJoined(const Event_GameJoined &event);
void gameLeft(TabGame *tab);
void addRoomTab(const ServerInfo_Room &info, bool setCurrent);
void roomLeft(TabRoom *tab);
TabMessage *addMessageTab(const QString &userName, bool focus);
void replayLeft(TabGame *tab);
void processUserLeft(const QString &userName);
void processUserJoined(const ServerInfo_User &userInfo);
void talkLeft(TabMessage *tab);
void deckEditorClosed(TabDeckEditor *tab);
void tabUserEvent(bool globalEvent);
void updateTabText(Tab *tab, const QString &newTabText);
void processRoomEvent(const RoomEvent &event);
void processGameEventContainer(const GameEventContainer &cont);
void processUserMessageEvent(const Event_UserMessage &event);
void processNotifyUserEvent(const Event_NotifyUser &event);
};
#endif