mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 08:03:54 -07:00
new files
This commit is contained in:
parent
7921b5f82d
commit
58e803c3e7
10 changed files with 452 additions and 0 deletions
60
cockatrice/src/abstractclient.h
Normal file
60
cockatrice/src/abstractclient.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#ifndef ABSTRACTCLIENT_H
|
||||
#define ABSTRACTCLIENT_H
|
||||
|
||||
#include <QObject>
|
||||
#include "protocol_datastructures.h"
|
||||
|
||||
class Command;
|
||||
class CommandContainer;
|
||||
class ProtocolItem;
|
||||
class ProtocolResponse;
|
||||
class TopLevelProtocolItem;
|
||||
class CommandContainer;
|
||||
class ChatEvent;
|
||||
class GameEventContainer;
|
||||
class Event_ListGames;
|
||||
class Event_ServerMessage;
|
||||
class Event_ListChatChannels;
|
||||
class Event_GameJoined;
|
||||
|
||||
enum ClientStatus {
|
||||
StatusDisconnected,
|
||||
StatusDisconnecting,
|
||||
StatusConnecting,
|
||||
StatusAwaitingWelcome,
|
||||
StatusLoggingIn,
|
||||
StatusLoggedIn,
|
||||
};
|
||||
|
||||
class AbstractClient : public QObject {
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void statusChanged(ClientStatus _status);
|
||||
void serverError(ResponseCode resp);
|
||||
|
||||
// Chat events
|
||||
void chatEventReceived(ChatEvent *event);
|
||||
// Game events
|
||||
void gameEventContainerReceived(GameEventContainer *event);
|
||||
// Generic events
|
||||
void listGamesEventReceived(Event_ListGames *event);
|
||||
void serverMessageEventReceived(Event_ServerMessage *event);
|
||||
void listChatChannelsEventReceived(Event_ListChatChannels *event);
|
||||
void gameJoinedEventReceived(Event_GameJoined *event);
|
||||
protected slots:
|
||||
void processProtocolItem(ProtocolItem *item);
|
||||
protected:
|
||||
QMap<int, CommandContainer *> pendingCommands;
|
||||
ClientStatus status;
|
||||
QString userName, password;
|
||||
void setStatus(ClientStatus _status);
|
||||
public:
|
||||
AbstractClient(QObject *parent = 0);
|
||||
~AbstractClient();
|
||||
|
||||
ClientStatus getStatus() const { return status; }
|
||||
virtual void sendCommand(Command *cmd);
|
||||
virtual void sendCommandContainer(CommandContainer *cont) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue