more buddy list & ignore list code
This commit is contained in:
parent
7a7b686e67
commit
9e34c9c985
22 changed files with 278 additions and 174 deletions
|
@ -58,6 +58,7 @@ HEADERS += src/abstractcounter.h \
|
||||||
src/tab_deck_storage.h \
|
src/tab_deck_storage.h \
|
||||||
src/tab_supervisor.h \
|
src/tab_supervisor.h \
|
||||||
src/tab_admin.h \
|
src/tab_admin.h \
|
||||||
|
src/tab_userlists.h \
|
||||||
src/chatview.h \
|
src/chatview.h \
|
||||||
src/userlist.h \
|
src/userlist.h \
|
||||||
src/userinfobox.h \
|
src/userinfobox.h \
|
||||||
|
@ -140,6 +141,7 @@ SOURCES += src/abstractcounter.cpp \
|
||||||
src/tab_deck_storage.cpp \
|
src/tab_deck_storage.cpp \
|
||||||
src/tab_supervisor.cpp \
|
src/tab_supervisor.cpp \
|
||||||
src/tab_admin.cpp \
|
src/tab_admin.cpp \
|
||||||
|
src/tab_userlists.cpp \
|
||||||
src/chatview.cpp \
|
src/chatview.cpp \
|
||||||
src/userlist.cpp \
|
src/userlist.cpp \
|
||||||
src/userinfobox.cpp \
|
src/userinfobox.cpp \
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
|
class TabSupervisor;
|
||||||
|
|
||||||
class Tab : public QWidget {
|
class Tab : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -11,11 +12,12 @@ signals:
|
||||||
void userEvent();
|
void userEvent();
|
||||||
protected:
|
protected:
|
||||||
QMenu *tabMenu;
|
QMenu *tabMenu;
|
||||||
|
TabSupervisor *tabSupervisor;
|
||||||
private:
|
private:
|
||||||
bool contentsChanged;
|
bool contentsChanged;
|
||||||
public:
|
public:
|
||||||
Tab(QWidget *parent = 0)
|
Tab(TabSupervisor *_tabSupervisor, QWidget *parent = 0)
|
||||||
: QWidget(parent), tabMenu(0), contentsChanged(false) { }
|
: QWidget(parent), tabMenu(0), tabSupervisor(_tabSupervisor), contentsChanged(false) { }
|
||||||
QMenu *getTabMenu() const { return tabMenu; }
|
QMenu *getTabMenu() const { return tabMenu; }
|
||||||
bool getContentsChanged() const { return contentsChanged; }
|
bool getContentsChanged() const { return contentsChanged; }
|
||||||
void setContentsChanged(bool _contentsChanged) { contentsChanged = _contentsChanged; }
|
void setContentsChanged(bool _contentsChanged) { contentsChanged = _contentsChanged; }
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
#include "protocol_items.h"
|
#include "protocol_items.h"
|
||||||
|
|
||||||
TabAdmin::TabAdmin(AbstractClient *_client, QWidget *parent)
|
TabAdmin::TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||||
: Tab(parent), client(_client)
|
: Tab(_tabSupervisor, parent), client(_client)
|
||||||
{
|
{
|
||||||
updateServerMessageButton = new QPushButton;
|
updateServerMessageButton = new QPushButton;
|
||||||
connect(updateServerMessageButton, SIGNAL(clicked()), this, SLOT(actUpdateServerMessage()));
|
connect(updateServerMessageButton, SIGNAL(clicked()), this, SLOT(actUpdateServerMessage()));
|
||||||
|
|
|
@ -21,7 +21,7 @@ private slots:
|
||||||
void actUnlock();
|
void actUnlock();
|
||||||
void actLock();
|
void actLock();
|
||||||
public:
|
public:
|
||||||
TabAdmin(AbstractClient *_client, QWidget *parent = 0);
|
TabAdmin(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = 0);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
QString getTabText() const { return tr("Administration"); }
|
QString getTabText() const { return tr("Administration"); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "window_deckeditor.h"
|
#include "window_deckeditor.h"
|
||||||
#include "settingscache.h"
|
#include "settingscache.h"
|
||||||
|
|
||||||
TabDeckStorage::TabDeckStorage(AbstractClient *_client)
|
TabDeckStorage::TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_client)
|
||||||
: Tab(), client(_client)
|
: Tab(_tabSupervisor), client(_client)
|
||||||
{
|
{
|
||||||
localDirModel = new QFileSystemModel(this);
|
localDirModel = new QFileSystemModel(this);
|
||||||
localDirModel->setRootPath(settingsCache->getDeckPath());
|
localDirModel->setRootPath(settingsCache->getDeckPath());
|
||||||
|
|
|
@ -45,7 +45,7 @@ private slots:
|
||||||
void actDelete();
|
void actDelete();
|
||||||
void deleteFinished(ResponseCode resp);
|
void deleteFinished(ResponseCode resp);
|
||||||
public:
|
public:
|
||||||
TabDeckStorage(AbstractClient *_client);
|
TabDeckStorage(TabSupervisor *_tabSupervisor, AbstractClient *_client);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
QString getTabText() const { return tr("Deck storage"); }
|
QString getTabText() const { return tr("Deck storage"); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -159,8 +159,8 @@ void DeckViewContainer::setDeck(DeckList *deck)
|
||||||
readyStartButton->setEnabled(true);
|
readyStartButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabGame::TabGame(QList<AbstractClient *> &_clients, int _gameId, const QString &_gameDescription, int _localPlayerId, bool _spectator, bool _spectatorsCanTalk, bool _spectatorsSeeEverything, bool _resuming)
|
TabGame::TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_clients, int _gameId, const QString &_gameDescription, int _localPlayerId, bool _spectator, bool _spectatorsCanTalk, bool _spectatorsSeeEverything, bool _resuming)
|
||||||
: Tab(), clients(_clients), gameId(_gameId), gameDescription(_gameDescription), localPlayerId(_localPlayerId), spectator(_spectator), spectatorsCanTalk(_spectatorsCanTalk), spectatorsSeeEverything(_spectatorsSeeEverything), started(false), resuming(_resuming), currentPhase(-1), infoPopup(0)
|
: Tab(_tabSupervisor), clients(_clients), gameId(_gameId), gameDescription(_gameDescription), localPlayerId(_localPlayerId), spectator(_spectator), spectatorsCanTalk(_spectatorsCanTalk), spectatorsSeeEverything(_spectatorsSeeEverything), started(false), resuming(_resuming), currentPhase(-1), infoPopup(0)
|
||||||
{
|
{
|
||||||
phasesToolbar = new PhasesToolbar;
|
phasesToolbar = new PhasesToolbar;
|
||||||
phasesToolbar->hide();
|
phasesToolbar->hide();
|
||||||
|
|
|
@ -153,7 +153,7 @@ private slots:
|
||||||
void actNextPhase();
|
void actNextPhase();
|
||||||
void actNextTurn();
|
void actNextTurn();
|
||||||
public:
|
public:
|
||||||
TabGame(QList<AbstractClient *> &_clients, int _gameId, const QString &_gameDescription, int _localPlayerId, bool _spectator, bool _spectatorsCanTalk, bool _spectatorsSeeEverything, bool _resuming);
|
TabGame(TabSupervisor *_tabSupervisor, QList<AbstractClient *> &_clients, int _gameId, const QString &_gameDescription, int _localPlayerId, bool _spectator, bool _spectatorsCanTalk, bool _spectatorsSeeEverything, bool _resuming);
|
||||||
~TabGame();
|
~TabGame();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
const QMap<int, Player *> &getPlayers() const { return players; }
|
const QMap<int, Player *> &getPlayers() const { return players; }
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#include "protocol_items.h"
|
#include "protocol_items.h"
|
||||||
#include "chatview.h"
|
#include "chatview.h"
|
||||||
|
|
||||||
TabMessage::TabMessage(AbstractClient *_client, const QString &_ownName, const QString &_userName)
|
TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, const QString &_ownName, const QString &_userName)
|
||||||
: Tab(), client(_client), userName(_userName), userOnline(true)
|
: Tab(_tabSupervisor), client(_client), userName(_userName), userOnline(true)
|
||||||
{
|
{
|
||||||
chatView = new ChatView(_ownName);
|
chatView = new ChatView(_ownName);
|
||||||
sayEdit = new QLineEdit;
|
sayEdit = new QLineEdit;
|
||||||
|
|
|
@ -25,7 +25,7 @@ private slots:
|
||||||
void sendMessage();
|
void sendMessage();
|
||||||
void actLeave();
|
void actLeave();
|
||||||
public:
|
public:
|
||||||
TabMessage(AbstractClient *_client, const QString &_ownName, const QString &_userName);
|
TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, const QString &_ownName, const QString &_userName);
|
||||||
~TabMessage();
|
~TabMessage();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
QString getUserName() const { return userName; }
|
QString getUserName() const { return userName; }
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "dlg_creategame.h"
|
#include "dlg_creategame.h"
|
||||||
|
#include "tab_supervisor.h"
|
||||||
#include "tab_room.h"
|
#include "tab_room.h"
|
||||||
#include "userlist.h"
|
#include "userlist.h"
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
|
@ -122,15 +123,15 @@ void GameSelector::processGameInfo(ServerInfo_Game *info)
|
||||||
gameListModel->updateGameList(info);
|
gameListModel->updateGameList(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
TabRoom::TabRoom(AbstractClient *_client, const QString &_ownName, ServerInfo_Room *info)
|
TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, const QString &_ownName, ServerInfo_Room *info)
|
||||||
: Tab(), client(_client), roomId(info->getRoomId()), roomName(info->getName()), ownName(_ownName)
|
: Tab(_tabSupervisor), client(_client), roomId(info->getRoomId()), roomName(info->getName()), ownName(_ownName)
|
||||||
{
|
{
|
||||||
const QList<ServerInfo_GameType *> gameTypeList = info->getGameTypeList();
|
const QList<ServerInfo_GameType *> gameTypeList = info->getGameTypeList();
|
||||||
for (int i = 0; i < gameTypeList.size(); ++i)
|
for (int i = 0; i < gameTypeList.size(); ++i)
|
||||||
gameTypes.insert(gameTypeList[i]->getGameTypeId(), gameTypeList[i]->getDescription());
|
gameTypes.insert(gameTypeList[i]->getGameTypeId(), gameTypeList[i]->getDescription());
|
||||||
|
|
||||||
gameSelector = new GameSelector(client, this);
|
gameSelector = new GameSelector(client, this);
|
||||||
userList = new UserList(client, false);
|
userList = new UserList(tabSupervisor->getUserListsTab(), client, UserList::RoomList);
|
||||||
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
|
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
|
||||||
|
|
||||||
chatView = new ChatView(ownName);
|
chatView = new ChatView(ownName);
|
||||||
|
@ -169,7 +170,7 @@ TabRoom::TabRoom(AbstractClient *_client, const QString &_ownName, ServerInfo_Ro
|
||||||
|
|
||||||
const QList<ServerInfo_User *> users = info->getUserList();
|
const QList<ServerInfo_User *> users = info->getUserList();
|
||||||
for (int i = 0; i < users.size(); ++i)
|
for (int i = 0; i < users.size(); ++i)
|
||||||
userList->processUserInfo(users[i]);
|
userList->processUserInfo(users[i], true);
|
||||||
userList->sortItems();
|
userList->sortItems();
|
||||||
|
|
||||||
const QList<ServerInfo_Game *> games = info->getGameList();
|
const QList<ServerInfo_Game *> games = info->getGameList();
|
||||||
|
@ -233,7 +234,7 @@ void TabRoom::processListGamesEvent(Event_ListGames *event)
|
||||||
|
|
||||||
void TabRoom::processJoinRoomEvent(Event_JoinRoom *event)
|
void TabRoom::processJoinRoomEvent(Event_JoinRoom *event)
|
||||||
{
|
{
|
||||||
userList->processUserInfo(event->getUserInfo());
|
userList->processUserInfo(event->getUserInfo(), true);
|
||||||
userList->sortItems();
|
userList->sortItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ private slots:
|
||||||
void processLeaveRoomEvent(Event_LeaveRoom *event);
|
void processLeaveRoomEvent(Event_LeaveRoom *event);
|
||||||
void processSayEvent(Event_RoomSay *event);
|
void processSayEvent(Event_RoomSay *event);
|
||||||
public:
|
public:
|
||||||
TabRoom(AbstractClient *_client, const QString &_ownName, ServerInfo_Room *info);
|
TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, const QString &_ownName, ServerInfo_Room *info);
|
||||||
~TabRoom();
|
~TabRoom();
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void processRoomEvent(RoomEvent *event);
|
void processRoomEvent(RoomEvent *event);
|
||||||
|
|
|
@ -117,47 +117,27 @@ void RoomSelector::joinFinished(ProtocolResponse *r)
|
||||||
emit roomJoined(resp->getRoomInfo(), static_cast<Command *>(sender())->getExtraData().toBool());
|
emit roomJoined(resp->getRoomInfo(), static_cast<Command *>(sender())->getExtraData().toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
TabServer::TabServer(AbstractClient *_client, ServerInfo_User *userInfo, QWidget *parent)
|
TabServer::TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||||
: Tab(parent), client(_client)
|
: Tab(_tabSupervisor, parent), client(_client)
|
||||||
{
|
{
|
||||||
roomSelector = new RoomSelector(client);
|
roomSelector = new RoomSelector(client);
|
||||||
serverInfoBox = new QTextBrowser;
|
serverInfoBox = new QTextBrowser;
|
||||||
serverInfoBox->setOpenExternalLinks(true);
|
serverInfoBox->setOpenExternalLinks(true);
|
||||||
userInfoBox = new UserInfoBox(_client, false);
|
|
||||||
userInfoBox->updateInfo(userInfo);
|
|
||||||
userList = new UserList(client, true);
|
|
||||||
|
|
||||||
connect(roomSelector, SIGNAL(roomJoined(ServerInfo_Room *, bool)), this, SIGNAL(roomJoined(ServerInfo_Room *, bool)));
|
connect(roomSelector, SIGNAL(roomJoined(ServerInfo_Room *, bool)), this, SIGNAL(roomJoined(ServerInfo_Room *, bool)));
|
||||||
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
|
|
||||||
|
|
||||||
connect(client, SIGNAL(userJoinedEventReceived(Event_UserJoined *)), this, SLOT(processUserJoinedEvent(Event_UserJoined *)));
|
|
||||||
connect(client, SIGNAL(userLeftEventReceived(Event_UserLeft *)), this, SLOT(processUserLeftEvent(Event_UserLeft *)));
|
|
||||||
connect(client, SIGNAL(serverMessageEventReceived(Event_ServerMessage *)), this, SLOT(processServerMessageEvent(Event_ServerMessage *)));
|
connect(client, SIGNAL(serverMessageEventReceived(Event_ServerMessage *)), this, SLOT(processServerMessageEvent(Event_ServerMessage *)));
|
||||||
|
|
||||||
Command_ListUsers *cmd = new Command_ListUsers;
|
|
||||||
connect(cmd, SIGNAL(finished(ProtocolResponse *)), this, SLOT(processListUsersResponse(ProtocolResponse *)));
|
|
||||||
client->sendCommand(cmd);
|
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout;
|
QVBoxLayout *vbox = new QVBoxLayout;
|
||||||
vbox->addWidget(roomSelector);
|
vbox->addWidget(roomSelector);
|
||||||
vbox->addWidget(serverInfoBox);
|
vbox->addWidget(serverInfoBox);
|
||||||
|
|
||||||
QVBoxLayout *vbox2 = new QVBoxLayout;
|
setLayout(vbox);
|
||||||
vbox2->addWidget(userInfoBox);
|
|
||||||
vbox2->addWidget(userList);
|
|
||||||
|
|
||||||
QHBoxLayout *mainLayout = new QHBoxLayout;
|
|
||||||
mainLayout->addLayout(vbox, 3);
|
|
||||||
mainLayout->addLayout(vbox2, 1);
|
|
||||||
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabServer::retranslateUi()
|
void TabServer::retranslateUi()
|
||||||
{
|
{
|
||||||
roomSelector->retranslateUi();
|
roomSelector->retranslateUi();
|
||||||
userInfoBox->retranslateUi();
|
|
||||||
userList->retranslateUi();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabServer::processServerMessageEvent(Event_ServerMessage *event)
|
void TabServer::processServerMessageEvent(Event_ServerMessage *event)
|
||||||
|
@ -165,30 +145,3 @@ void TabServer::processServerMessageEvent(Event_ServerMessage *event)
|
||||||
serverInfoBox->setHtml(event->getMessage());
|
serverInfoBox->setHtml(event->getMessage());
|
||||||
emit userEvent();
|
emit userEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabServer::processListUsersResponse(ProtocolResponse *response)
|
|
||||||
{
|
|
||||||
Response_ListUsers *resp = qobject_cast<Response_ListUsers *>(response);
|
|
||||||
if (!resp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const QList<ServerInfo_User *> &respList = resp->getUserList();
|
|
||||||
for (int i = 0; i < respList.size(); ++i)
|
|
||||||
userList->processUserInfo(respList[i]);
|
|
||||||
|
|
||||||
userList->sortItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabServer::processUserJoinedEvent(Event_UserJoined *event)
|
|
||||||
{
|
|
||||||
userList->processUserInfo(event->getUserInfo());
|
|
||||||
userList->sortItems();
|
|
||||||
|
|
||||||
emit userJoined(event->getUserInfo()->getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void TabServer::processUserLeftEvent(Event_UserLeft *event)
|
|
||||||
{
|
|
||||||
if (userList->deleteUser(event->getUserName()))
|
|
||||||
emit userLeft(event->getUserName());
|
|
||||||
}
|
|
|
@ -11,14 +11,10 @@ class QTextEdit;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class UserList;
|
class UserList;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class UserInfoBox;
|
|
||||||
|
|
||||||
class Event_ListRooms;
|
class Event_ListRooms;
|
||||||
class Event_ServerMessage;
|
class Event_ServerMessage;
|
||||||
class Event_UserJoined;
|
|
||||||
class Event_UserLeft;
|
|
||||||
class ProtocolResponse;
|
class ProtocolResponse;
|
||||||
class ServerInfo_User;
|
|
||||||
class ServerInfo_Room;
|
class ServerInfo_Room;
|
||||||
|
|
||||||
class RoomSelector : public QGroupBox {
|
class RoomSelector : public QGroupBox {
|
||||||
|
@ -44,22 +40,14 @@ class TabServer : public Tab {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
signals:
|
signals:
|
||||||
void roomJoined(ServerInfo_Room *info, bool setCurrent);
|
void roomJoined(ServerInfo_Room *info, bool setCurrent);
|
||||||
void openMessageDialog(const QString &userName, bool focus);
|
|
||||||
void userLeft(const QString &userName);
|
|
||||||
void userJoined(const QString &userName);
|
|
||||||
private slots:
|
private slots:
|
||||||
void processListUsersResponse(ProtocolResponse *response);
|
|
||||||
void processUserJoinedEvent(Event_UserJoined *event);
|
|
||||||
void processUserLeftEvent(Event_UserLeft *event);
|
|
||||||
void processServerMessageEvent(Event_ServerMessage *event);
|
void processServerMessageEvent(Event_ServerMessage *event);
|
||||||
private:
|
private:
|
||||||
AbstractClient *client;
|
AbstractClient *client;
|
||||||
RoomSelector *roomSelector;
|
RoomSelector *roomSelector;
|
||||||
QTextBrowser *serverInfoBox;
|
QTextBrowser *serverInfoBox;
|
||||||
UserList *userList;
|
|
||||||
UserInfoBox *userInfoBox;
|
|
||||||
public:
|
public:
|
||||||
TabServer(AbstractClient *_client, ServerInfo_User *userInfo, QWidget *parent = 0);
|
TabServer(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = 0);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
QString getTabText() const { return tr("Server"); }
|
QString getTabText() const { return tr("Server"); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "tab_deck_storage.h"
|
#include "tab_deck_storage.h"
|
||||||
#include "tab_admin.h"
|
#include "tab_admin.h"
|
||||||
#include "tab_message.h"
|
#include "tab_message.h"
|
||||||
|
#include "tab_userlists.h"
|
||||||
#include "protocol_items.h"
|
#include "protocol_items.h"
|
||||||
#include "pixmapgenerator.h"
|
#include "pixmapgenerator.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -63,22 +64,26 @@ void TabSupervisor::start(AbstractClient *_client, ServerInfo_User *userInfo)
|
||||||
connect(client, SIGNAL(messageEventReceived(Event_Message *)), this, SLOT(processMessageEvent(Event_Message *)));
|
connect(client, SIGNAL(messageEventReceived(Event_Message *)), this, SLOT(processMessageEvent(Event_Message *)));
|
||||||
connect(client, SIGNAL(maxPingTime(int, int)), this, SLOT(updatePingTime(int, int)));
|
connect(client, SIGNAL(maxPingTime(int, int)), this, SLOT(updatePingTime(int, int)));
|
||||||
|
|
||||||
tabServer = new TabServer(client, userInfo);
|
tabServer = new TabServer(this, client);
|
||||||
connect(tabServer, SIGNAL(roomJoined(ServerInfo_Room *, bool)), this, SLOT(addRoomTab(ServerInfo_Room *, bool)));
|
connect(tabServer, SIGNAL(roomJoined(ServerInfo_Room *, bool)), this, SLOT(addRoomTab(ServerInfo_Room *, bool)));
|
||||||
connect(tabServer, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
|
|
||||||
connect(tabServer, SIGNAL(userJoined(const QString &)), this, SLOT(processUserJoined(const QString &)));
|
|
||||||
connect(tabServer, SIGNAL(userLeft(const QString &)), this, SLOT(processUserLeft(const QString &)));
|
|
||||||
myAddTab(tabServer);
|
myAddTab(tabServer);
|
||||||
|
|
||||||
|
tabUserLists = new TabUserLists(this, client, userInfo);
|
||||||
|
connect(tabUserLists, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
|
||||||
|
connect(tabUserLists, SIGNAL(userJoined(const QString &)), this, SLOT(processUserJoined(const QString &)));
|
||||||
|
connect(tabUserLists, SIGNAL(userLeft(const QString &)), this, SLOT(processUserLeft(const QString &)));
|
||||||
|
myAddTab(tabUserLists);
|
||||||
|
|
||||||
updatePingTime(0, -1);
|
updatePingTime(0, -1);
|
||||||
|
|
||||||
if (userInfo->getUserLevel() & ServerInfo_User::IsRegistered) {
|
if (userInfo->getUserLevel() & ServerInfo_User::IsRegistered) {
|
||||||
tabDeckStorage = new TabDeckStorage(client);
|
tabDeckStorage = new TabDeckStorage(this, client);
|
||||||
myAddTab(tabDeckStorage);
|
myAddTab(tabDeckStorage);
|
||||||
} else
|
} else
|
||||||
tabDeckStorage = 0;
|
tabDeckStorage = 0;
|
||||||
|
|
||||||
if (userInfo->getUserLevel() & ServerInfo_User::IsAdmin) {
|
if (userInfo->getUserLevel() & ServerInfo_User::IsAdmin) {
|
||||||
tabAdmin = new TabAdmin(client);
|
tabAdmin = new TabAdmin(this, client);
|
||||||
myAddTab(tabAdmin);
|
myAddTab(tabAdmin);
|
||||||
} else
|
} else
|
||||||
tabAdmin = 0;
|
tabAdmin = 0;
|
||||||
|
@ -148,7 +153,7 @@ void TabSupervisor::updatePingTime(int value, int max)
|
||||||
|
|
||||||
void TabSupervisor::gameJoined(Event_GameJoined *event)
|
void TabSupervisor::gameJoined(Event_GameJoined *event)
|
||||||
{
|
{
|
||||||
TabGame *tab = new TabGame(QList<AbstractClient *>() << client, event->getGameId(), event->getGameDescription(), event->getPlayerId(), event->getSpectator(), event->getSpectatorsCanTalk(), event->getSpectatorsSeeEverything(), event->getResuming());
|
TabGame *tab = new TabGame(this, QList<AbstractClient *>() << client, event->getGameId(), event->getGameDescription(), event->getPlayerId(), event->getSpectator(), event->getSpectatorsCanTalk(), event->getSpectatorsSeeEverything(), event->getResuming());
|
||||||
connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *)));
|
connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *)));
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
gameTabs.insert(event->getGameId(), tab);
|
gameTabs.insert(event->getGameId(), tab);
|
||||||
|
@ -157,7 +162,7 @@ void TabSupervisor::gameJoined(Event_GameJoined *event)
|
||||||
|
|
||||||
void TabSupervisor::localGameJoined(Event_GameJoined *event)
|
void TabSupervisor::localGameJoined(Event_GameJoined *event)
|
||||||
{
|
{
|
||||||
TabGame *tab = new TabGame(localClients, event->getGameId(), event->getGameDescription(), event->getPlayerId(), event->getSpectator(), event->getSpectatorsCanTalk(), event->getSpectatorsSeeEverything(), event->getResuming());
|
TabGame *tab = new TabGame(this, localClients, event->getGameId(), event->getGameDescription(), event->getPlayerId(), event->getSpectator(), event->getSpectatorsCanTalk(), event->getSpectatorsSeeEverything(), event->getResuming());
|
||||||
connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *)));
|
connect(tab, SIGNAL(gameClosing(TabGame *)), this, SLOT(gameLeft(TabGame *)));
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
gameTabs.insert(event->getGameId(), tab);
|
gameTabs.insert(event->getGameId(), tab);
|
||||||
|
@ -182,7 +187,7 @@ void TabSupervisor::gameLeft(TabGame *tab)
|
||||||
|
|
||||||
void TabSupervisor::addRoomTab(ServerInfo_Room *info, bool setCurrent)
|
void TabSupervisor::addRoomTab(ServerInfo_Room *info, bool setCurrent)
|
||||||
{
|
{
|
||||||
TabRoom *tab = new TabRoom(client, userName, info);
|
TabRoom *tab = new TabRoom(this, client, userName, info);
|
||||||
connect(tab, SIGNAL(roomClosing(TabRoom *)), this, SLOT(roomLeft(TabRoom *)));
|
connect(tab, SIGNAL(roomClosing(TabRoom *)), this, SLOT(roomLeft(TabRoom *)));
|
||||||
connect(tab, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
|
connect(tab, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
|
@ -204,7 +209,7 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
|
||||||
if (receiverName == userName)
|
if (receiverName == userName)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
TabMessage *tab = new TabMessage(client, userName, receiverName);
|
TabMessage *tab = new TabMessage(this, client, userName, receiverName);
|
||||||
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
|
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
messageTabs.insert(receiverName, tab);
|
messageTabs.insert(receiverName, tab);
|
||||||
|
|
|
@ -13,6 +13,7 @@ class TabGame;
|
||||||
class TabDeckStorage;
|
class TabDeckStorage;
|
||||||
class TabAdmin;
|
class TabAdmin;
|
||||||
class TabMessage;
|
class TabMessage;
|
||||||
|
class TabUserLists;
|
||||||
class RoomEvent;
|
class RoomEvent;
|
||||||
class GameEventContainer;
|
class GameEventContainer;
|
||||||
class Event_GameJoined;
|
class Event_GameJoined;
|
||||||
|
@ -28,6 +29,7 @@ private:
|
||||||
AbstractClient *client;
|
AbstractClient *client;
|
||||||
QList<AbstractClient *> localClients;
|
QList<AbstractClient *> localClients;
|
||||||
TabServer *tabServer;
|
TabServer *tabServer;
|
||||||
|
TabUserLists *tabUserLists;
|
||||||
TabDeckStorage *tabDeckStorage;
|
TabDeckStorage *tabDeckStorage;
|
||||||
TabAdmin *tabAdmin;
|
TabAdmin *tabAdmin;
|
||||||
QMap<int, TabRoom *> roomTabs;
|
QMap<int, TabRoom *> roomTabs;
|
||||||
|
@ -42,6 +44,7 @@ public:
|
||||||
void startLocal(const QList<AbstractClient *> &_clients);
|
void startLocal(const QList<AbstractClient *> &_clients);
|
||||||
void stop();
|
void stop();
|
||||||
int getGameCount() const { return gameTabs.size(); }
|
int getGameCount() const { return gameTabs.size(); }
|
||||||
|
TabUserLists *getUserListsTab() const { return tabUserLists; }
|
||||||
signals:
|
signals:
|
||||||
void setMenu(QMenu *menu);
|
void setMenu(QMenu *menu);
|
||||||
void localGameEnded();
|
void localGameEnded();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "userlist.h"
|
#include "userlist.h"
|
||||||
|
#include "tab_userlists.h"
|
||||||
#include "abstractclient.h"
|
#include "abstractclient.h"
|
||||||
#include "pixmapgenerator.h"
|
#include "pixmapgenerator.h"
|
||||||
#include "userinfobox.h"
|
#include "userinfobox.h"
|
||||||
|
@ -31,15 +32,20 @@ UserListTWI::UserListTWI()
|
||||||
|
|
||||||
bool UserListTWI::operator<(const QTreeWidgetItem &other) const
|
bool UserListTWI::operator<(const QTreeWidgetItem &other) const
|
||||||
{
|
{
|
||||||
// Equal user level => sort by name
|
// Sort by online/offline
|
||||||
if (data(0, Qt::UserRole) == other.data(0, Qt::UserRole))
|
if (data(0, Qt::UserRole + 1) != other.data(0, Qt::UserRole + 1))
|
||||||
return data(2, Qt::UserRole).toString().toLower() < other.data(2, Qt::UserRole).toString().toLower();
|
return data(0, Qt::UserRole + 1).toBool();
|
||||||
// Else sort by user level
|
|
||||||
return data(0, Qt::UserRole).toInt() > other.data(0, Qt::UserRole).toInt();
|
// Sort by user level
|
||||||
|
if (data(0, Qt::UserRole) != other.data(0, Qt::UserRole))
|
||||||
|
return data(0, Qt::UserRole).toInt() > other.data(0, Qt::UserRole).toInt();
|
||||||
|
|
||||||
|
// Sort by name
|
||||||
|
return data(2, Qt::UserRole).toString().toLower() < other.data(2, Qt::UserRole).toString().toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserList::UserList(AbstractClient *_client, bool _global, QWidget *parent)
|
UserList::UserList(TabUserLists *_tabUserLists, AbstractClient *_client, UserListType _type, QWidget *parent)
|
||||||
: QGroupBox(parent), client(_client), global(_global)
|
: QGroupBox(parent), tabUserLists(_tabUserLists), client(_client), type(_type), onlineCount(0)
|
||||||
{
|
{
|
||||||
itemDelegate = new UserListItemDelegate(this);
|
itemDelegate = new UserListItemDelegate(this);
|
||||||
|
|
||||||
|
@ -62,11 +68,16 @@ UserList::UserList(AbstractClient *_client, bool _global, QWidget *parent)
|
||||||
|
|
||||||
void UserList::retranslateUi()
|
void UserList::retranslateUi()
|
||||||
{
|
{
|
||||||
titleStr = global ? tr("Users online: %1") : tr("Users in this room: %1");
|
switch (type) {
|
||||||
|
case AllUsersList: titleStr = tr("Users online: %1"); break;
|
||||||
|
case RoomList: titleStr = tr("Users in this room: %1"); break;
|
||||||
|
case BuddyList: titleStr = tr("Buddies online: %1 / %2"); break;
|
||||||
|
case IgnoreList: titleStr = tr("Ignored users online: %1 / %2"); break;
|
||||||
|
}
|
||||||
updateCount();
|
updateCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserList::processUserInfo(ServerInfo_User *user)
|
void UserList::processUserInfo(ServerInfo_User *user, bool online)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = 0;
|
QTreeWidgetItem *item = 0;
|
||||||
for (int i = 0; i < userTree->topLevelItemCount(); ++i) {
|
for (int i = 0; i < userTree->topLevelItemCount(); ++i) {
|
||||||
|
@ -86,6 +97,12 @@ void UserList::processUserInfo(ServerInfo_User *user)
|
||||||
item->setIcon(1, QIcon(CountryPixmapGenerator::generatePixmap(12, user->getCountry())));
|
item->setIcon(1, QIcon(CountryPixmapGenerator::generatePixmap(12, user->getCountry())));
|
||||||
item->setData(2, Qt::UserRole, user->getName());
|
item->setData(2, Qt::UserRole, user->getName());
|
||||||
item->setData(2, Qt::DisplayRole, user->getName());
|
item->setData(2, Qt::DisplayRole, user->getName());
|
||||||
|
|
||||||
|
item->setData(0, Qt::UserRole + 1, online);
|
||||||
|
if (online)
|
||||||
|
item->setData(2, Qt::ForegroundRole, QBrush());
|
||||||
|
else
|
||||||
|
item->setData(2, Qt::ForegroundRole, QBrush(Qt::gray));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UserList::deleteUser(const QString &userName)
|
bool UserList::deleteUser(const QString &userName)
|
||||||
|
@ -100,9 +117,37 @@ bool UserList::deleteUser(const QString &userName)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserList::setUserOnline(QTreeWidgetItem *item, bool online)
|
||||||
|
{
|
||||||
|
item->setData(0, Qt::UserRole + 1, online);
|
||||||
|
|
||||||
|
if (online) {
|
||||||
|
item->setData(2, Qt::ForegroundRole, QBrush());
|
||||||
|
++onlineCount;
|
||||||
|
} else {
|
||||||
|
item->setData(2, Qt::ForegroundRole, QBrush(Qt::gray));
|
||||||
|
--onlineCount;
|
||||||
|
}
|
||||||
|
updateCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserList::setUserOnline(const QString &userName, bool online)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < userTree->topLevelItemCount(); ++i) {
|
||||||
|
QTreeWidgetItem *item = userTree->topLevelItem(i);
|
||||||
|
if (item->data(2, Qt::UserRole) == userName) {
|
||||||
|
setUserOnline(item, online);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UserList::updateCount()
|
void UserList::updateCount()
|
||||||
{
|
{
|
||||||
setTitle(titleStr.arg(userTree->topLevelItemCount()));
|
QString str = titleStr;
|
||||||
|
if ((type == BuddyList) || (type == IgnoreList))
|
||||||
|
str = str.arg(onlineCount);
|
||||||
|
setTitle(str.arg(userTree->topLevelItemCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserList::userClicked(QTreeWidgetItem *item, int /*column*/)
|
void UserList::userClicked(QTreeWidgetItem *item, int /*column*/)
|
||||||
|
@ -118,12 +163,25 @@ void UserList::showContextMenu(const QPoint &pos, const QModelIndex &index)
|
||||||
aUserName->setEnabled(false);
|
aUserName->setEnabled(false);
|
||||||
QAction *aDetails = new QAction(tr("User &details"), this);
|
QAction *aDetails = new QAction(tr("User &details"), this);
|
||||||
QAction *aChat = new QAction(tr("Direct &chat"), this);
|
QAction *aChat = new QAction(tr("Direct &chat"), this);
|
||||||
|
QAction *aAddToBuddyList = new QAction(tr("Add to &buddy list"), this);
|
||||||
|
QAction *aRemoveFromBuddyList = new QAction(tr("Remove from &buddy list"), this);
|
||||||
|
QAction *aAddToIgnoreList = new QAction(tr("Remove from &ignore list"), this);
|
||||||
|
QAction *aRemoveFromIgnoreList = new QAction(tr("Remove from &ignore list"), this);
|
||||||
|
|
||||||
QMenu *menu = new QMenu(this);
|
QMenu *menu = new QMenu(this);
|
||||||
menu->addAction(aUserName);
|
menu->addAction(aUserName);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(aDetails);
|
menu->addAction(aDetails);
|
||||||
menu->addAction(aChat);
|
menu->addAction(aChat);
|
||||||
|
menu->addSeparator();
|
||||||
|
if (tabUserLists->getBuddyList()->userInList(userName))
|
||||||
|
menu->addAction(aRemoveFromBuddyList);
|
||||||
|
else
|
||||||
|
menu->addAction(aAddToBuddyList);
|
||||||
|
if (tabUserLists->getIgnoreList()->userInList(userName))
|
||||||
|
menu->addAction(aRemoveFromIgnoreList);
|
||||||
|
else
|
||||||
|
menu->addAction(aAddToIgnoreList);
|
||||||
|
|
||||||
QAction *actionClicked = menu->exec(pos);
|
QAction *actionClicked = menu->exec(pos);
|
||||||
if (actionClicked == aDetails) {
|
if (actionClicked == aDetails) {
|
||||||
|
@ -132,6 +190,14 @@ void UserList::showContextMenu(const QPoint &pos, const QModelIndex &index)
|
||||||
infoWidget->updateInfo(userName);
|
infoWidget->updateInfo(userName);
|
||||||
} else if (actionClicked == aChat)
|
} else if (actionClicked == aChat)
|
||||||
emit openMessageDialog(userName, true);
|
emit openMessageDialog(userName, true);
|
||||||
|
else if (actionClicked == aAddToBuddyList)
|
||||||
|
emit addBuddy(userName);
|
||||||
|
else if (actionClicked == aRemoveFromBuddyList)
|
||||||
|
emit removeBuddy(userName);
|
||||||
|
else if (actionClicked == aAddToIgnoreList)
|
||||||
|
emit addIgnore(userName);
|
||||||
|
else if (actionClicked == aRemoveFromIgnoreList)
|
||||||
|
emit removeIgnore(userName);
|
||||||
|
|
||||||
delete menu;
|
delete menu;
|
||||||
delete aUserName;
|
delete aUserName;
|
||||||
|
@ -139,6 +205,14 @@ void UserList::showContextMenu(const QPoint &pos, const QModelIndex &index)
|
||||||
delete aChat;
|
delete aChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UserList::userInList(const QString &userName) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < userTree->topLevelItemCount(); ++i)
|
||||||
|
if (userTree->topLevelItem(i)->data(2, Qt::UserRole) == userName)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void UserList::sortItems()
|
void UserList::sortItems()
|
||||||
{
|
{
|
||||||
userTree->sortItems(1, Qt::AscendingOrder);
|
userTree->sortItems(1, Qt::AscendingOrder);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
class QTreeWidget;
|
class QTreeWidget;
|
||||||
class ServerInfo_User;
|
class ServerInfo_User;
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
|
class TabUserLists;
|
||||||
|
|
||||||
class UserListItemDelegate : public QStyledItemDelegate {
|
class UserListItemDelegate : public QStyledItemDelegate {
|
||||||
public:
|
public:
|
||||||
|
@ -23,22 +24,33 @@ public:
|
||||||
|
|
||||||
class UserList : public QGroupBox {
|
class UserList : public QGroupBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
enum UserListType { AllUsersList, RoomList, BuddyList, IgnoreList };
|
||||||
private:
|
private:
|
||||||
|
TabUserLists *tabUserLists;
|
||||||
AbstractClient *client;
|
AbstractClient *client;
|
||||||
|
UserListType type;
|
||||||
QTreeWidget *userTree;
|
QTreeWidget *userTree;
|
||||||
UserListItemDelegate *itemDelegate;
|
UserListItemDelegate *itemDelegate;
|
||||||
bool global;
|
int onlineCount;
|
||||||
QString titleStr;
|
QString titleStr;
|
||||||
void updateCount();
|
void updateCount();
|
||||||
|
void setUserOnline(QTreeWidgetItem *user, bool online);
|
||||||
private slots:
|
private slots:
|
||||||
void userClicked(QTreeWidgetItem *item, int column);
|
void userClicked(QTreeWidgetItem *item, int column);
|
||||||
signals:
|
signals:
|
||||||
void openMessageDialog(const QString &userName, bool focus);
|
void openMessageDialog(const QString &userName, bool focus);
|
||||||
|
void addBuddy(const QString &userName);
|
||||||
|
void removeBuddy(const QString &userName);
|
||||||
|
void addIgnore(const QString &userName);
|
||||||
|
void removeIgnore(const QString &userName);
|
||||||
public:
|
public:
|
||||||
UserList(AbstractClient *_client, bool _global, QWidget *parent = 0);
|
UserList(TabUserLists *_tabUserLists, AbstractClient *_client, UserListType _type, QWidget *parent = 0);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void processUserInfo(ServerInfo_User *user);
|
void processUserInfo(ServerInfo_User *user, bool online);
|
||||||
bool deleteUser(const QString &userName);
|
bool deleteUser(const QString &userName);
|
||||||
|
void setUserOnline(const QString &userName, bool online);
|
||||||
|
bool userInList(const QString &userName) const;
|
||||||
void showContextMenu(const QPoint &pos, const QModelIndex &index);
|
void showContextMenu(const QPoint &pos, const QModelIndex &index);
|
||||||
void sortItems();
|
void sortItems();
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,72 +4,76 @@ ItemId_Command_Login = 1002,
|
||||||
ItemId_Command_Message = 1003,
|
ItemId_Command_Message = 1003,
|
||||||
ItemId_Command_ListUsers = 1004,
|
ItemId_Command_ListUsers = 1004,
|
||||||
ItemId_Command_GetUserInfo = 1005,
|
ItemId_Command_GetUserInfo = 1005,
|
||||||
ItemId_Command_DeckList = 1006,
|
ItemId_Command_AddBuddy = 1006,
|
||||||
ItemId_Command_DeckNewDir = 1007,
|
ItemId_Command_RemoveBuddy = 1007,
|
||||||
ItemId_Command_DeckDelDir = 1008,
|
ItemId_Command_AddIgnore = 1008,
|
||||||
ItemId_Command_DeckDel = 1009,
|
ItemId_Command_RemoveIgnore = 1009,
|
||||||
ItemId_Command_DeckDownload = 1010,
|
ItemId_Command_DeckList = 1010,
|
||||||
ItemId_Command_ListRooms = 1011,
|
ItemId_Command_DeckNewDir = 1011,
|
||||||
ItemId_Command_JoinRoom = 1012,
|
ItemId_Command_DeckDelDir = 1012,
|
||||||
ItemId_Command_LeaveRoom = 1013,
|
ItemId_Command_DeckDel = 1013,
|
||||||
ItemId_Command_RoomSay = 1014,
|
ItemId_Command_DeckDownload = 1014,
|
||||||
ItemId_Command_JoinGame = 1015,
|
ItemId_Command_ListRooms = 1015,
|
||||||
ItemId_Command_LeaveGame = 1016,
|
ItemId_Command_JoinRoom = 1016,
|
||||||
ItemId_Command_Say = 1017,
|
ItemId_Command_LeaveRoom = 1017,
|
||||||
ItemId_Command_Shuffle = 1018,
|
ItemId_Command_RoomSay = 1018,
|
||||||
ItemId_Command_Mulligan = 1019,
|
ItemId_Command_JoinGame = 1019,
|
||||||
ItemId_Command_RollDie = 1020,
|
ItemId_Command_LeaveGame = 1020,
|
||||||
ItemId_Command_DrawCards = 1021,
|
ItemId_Command_Say = 1021,
|
||||||
ItemId_Command_UndoDraw = 1022,
|
ItemId_Command_Shuffle = 1022,
|
||||||
ItemId_Command_FlipCard = 1023,
|
ItemId_Command_Mulligan = 1023,
|
||||||
ItemId_Command_AttachCard = 1024,
|
ItemId_Command_RollDie = 1024,
|
||||||
ItemId_Command_CreateToken = 1025,
|
ItemId_Command_DrawCards = 1025,
|
||||||
ItemId_Command_CreateArrow = 1026,
|
ItemId_Command_UndoDraw = 1026,
|
||||||
ItemId_Command_DeleteArrow = 1027,
|
ItemId_Command_FlipCard = 1027,
|
||||||
ItemId_Command_SetCardAttr = 1028,
|
ItemId_Command_AttachCard = 1028,
|
||||||
ItemId_Command_SetCardCounter = 1029,
|
ItemId_Command_CreateToken = 1029,
|
||||||
ItemId_Command_IncCardCounter = 1030,
|
ItemId_Command_CreateArrow = 1030,
|
||||||
ItemId_Command_ReadyStart = 1031,
|
ItemId_Command_DeleteArrow = 1031,
|
||||||
ItemId_Command_Concede = 1032,
|
ItemId_Command_SetCardAttr = 1032,
|
||||||
ItemId_Command_IncCounter = 1033,
|
ItemId_Command_SetCardCounter = 1033,
|
||||||
ItemId_Command_CreateCounter = 1034,
|
ItemId_Command_IncCardCounter = 1034,
|
||||||
ItemId_Command_SetCounter = 1035,
|
ItemId_Command_ReadyStart = 1035,
|
||||||
ItemId_Command_DelCounter = 1036,
|
ItemId_Command_Concede = 1036,
|
||||||
ItemId_Command_NextTurn = 1037,
|
ItemId_Command_IncCounter = 1037,
|
||||||
ItemId_Command_SetActivePhase = 1038,
|
ItemId_Command_CreateCounter = 1038,
|
||||||
ItemId_Command_DumpZone = 1039,
|
ItemId_Command_SetCounter = 1039,
|
||||||
ItemId_Command_StopDumpZone = 1040,
|
ItemId_Command_DelCounter = 1040,
|
||||||
ItemId_Command_RevealCards = 1041,
|
ItemId_Command_NextTurn = 1041,
|
||||||
ItemId_Event_Say = 1042,
|
ItemId_Command_SetActivePhase = 1042,
|
||||||
ItemId_Event_Leave = 1043,
|
ItemId_Command_DumpZone = 1043,
|
||||||
ItemId_Event_GameClosed = 1044,
|
ItemId_Command_StopDumpZone = 1044,
|
||||||
ItemId_Event_Shuffle = 1045,
|
ItemId_Command_RevealCards = 1045,
|
||||||
ItemId_Event_RollDie = 1046,
|
ItemId_Event_Say = 1046,
|
||||||
ItemId_Event_MoveCard = 1047,
|
ItemId_Event_Leave = 1047,
|
||||||
ItemId_Event_FlipCard = 1048,
|
ItemId_Event_GameClosed = 1048,
|
||||||
ItemId_Event_DestroyCard = 1049,
|
ItemId_Event_Shuffle = 1049,
|
||||||
ItemId_Event_AttachCard = 1050,
|
ItemId_Event_RollDie = 1050,
|
||||||
ItemId_Event_CreateToken = 1051,
|
ItemId_Event_MoveCard = 1051,
|
||||||
ItemId_Event_DeleteArrow = 1052,
|
ItemId_Event_FlipCard = 1052,
|
||||||
ItemId_Event_SetCardAttr = 1053,
|
ItemId_Event_DestroyCard = 1053,
|
||||||
ItemId_Event_SetCardCounter = 1054,
|
ItemId_Event_AttachCard = 1054,
|
||||||
ItemId_Event_SetCounter = 1055,
|
ItemId_Event_CreateToken = 1055,
|
||||||
ItemId_Event_DelCounter = 1056,
|
ItemId_Event_DeleteArrow = 1056,
|
||||||
ItemId_Event_SetActivePlayer = 1057,
|
ItemId_Event_SetCardAttr = 1057,
|
||||||
ItemId_Event_SetActivePhase = 1058,
|
ItemId_Event_SetCardCounter = 1058,
|
||||||
ItemId_Event_DumpZone = 1059,
|
ItemId_Event_SetCounter = 1059,
|
||||||
ItemId_Event_StopDumpZone = 1060,
|
ItemId_Event_DelCounter = 1060,
|
||||||
ItemId_Event_ServerMessage = 1061,
|
ItemId_Event_SetActivePlayer = 1061,
|
||||||
ItemId_Event_Message = 1062,
|
ItemId_Event_SetActivePhase = 1062,
|
||||||
ItemId_Event_GameJoined = 1063,
|
ItemId_Event_DumpZone = 1063,
|
||||||
ItemId_Event_UserLeft = 1064,
|
ItemId_Event_StopDumpZone = 1064,
|
||||||
ItemId_Event_LeaveRoom = 1065,
|
ItemId_Event_ServerMessage = 1065,
|
||||||
ItemId_Event_RoomSay = 1066,
|
ItemId_Event_Message = 1066,
|
||||||
ItemId_Context_ReadyStart = 1067,
|
ItemId_Event_GameJoined = 1067,
|
||||||
ItemId_Context_Concede = 1068,
|
ItemId_Event_UserLeft = 1068,
|
||||||
ItemId_Context_DeckSelect = 1069,
|
ItemId_Event_LeaveRoom = 1069,
|
||||||
ItemId_Context_UndoDraw = 1070,
|
ItemId_Event_RoomSay = 1070,
|
||||||
ItemId_Context_MoveCard = 1071,
|
ItemId_Context_ReadyStart = 1071,
|
||||||
ItemId_Command_UpdateServerMessage = 1072,
|
ItemId_Context_Concede = 1072,
|
||||||
ItemId_Other = 1073
|
ItemId_Context_DeckSelect = 1073,
|
||||||
|
ItemId_Context_UndoDraw = 1074,
|
||||||
|
ItemId_Context_MoveCard = 1075,
|
||||||
|
ItemId_Command_UpdateServerMessage = 1076,
|
||||||
|
ItemId_Other = 1077
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,26 @@ Command_GetUserInfo::Command_GetUserInfo(const QString &_userName)
|
||||||
{
|
{
|
||||||
insertItem(new SerializableItem_String("user_name", _userName));
|
insertItem(new SerializableItem_String("user_name", _userName));
|
||||||
}
|
}
|
||||||
|
Command_AddBuddy::Command_AddBuddy(const QString &_userName)
|
||||||
|
: Command("add_buddy")
|
||||||
|
{
|
||||||
|
insertItem(new SerializableItem_String("user_name", _userName));
|
||||||
|
}
|
||||||
|
Command_RemoveBuddy::Command_RemoveBuddy(const QString &_userName)
|
||||||
|
: Command("remove_buddy")
|
||||||
|
{
|
||||||
|
insertItem(new SerializableItem_String("user_name", _userName));
|
||||||
|
}
|
||||||
|
Command_AddIgnore::Command_AddIgnore(const QString &_userName)
|
||||||
|
: Command("add_ignore")
|
||||||
|
{
|
||||||
|
insertItem(new SerializableItem_String("user_name", _userName));
|
||||||
|
}
|
||||||
|
Command_RemoveIgnore::Command_RemoveIgnore(const QString &_userName)
|
||||||
|
: Command("remove_ignore")
|
||||||
|
{
|
||||||
|
insertItem(new SerializableItem_String("user_name", _userName));
|
||||||
|
}
|
||||||
Command_DeckList::Command_DeckList()
|
Command_DeckList::Command_DeckList()
|
||||||
: Command("deck_list")
|
: Command("deck_list")
|
||||||
{
|
{
|
||||||
|
@ -437,6 +457,10 @@ void ProtocolItem::initializeHashAuto()
|
||||||
itemNameHash.insert("cmdmessage", Command_Message::newItem);
|
itemNameHash.insert("cmdmessage", Command_Message::newItem);
|
||||||
itemNameHash.insert("cmdlist_users", Command_ListUsers::newItem);
|
itemNameHash.insert("cmdlist_users", Command_ListUsers::newItem);
|
||||||
itemNameHash.insert("cmdget_user_info", Command_GetUserInfo::newItem);
|
itemNameHash.insert("cmdget_user_info", Command_GetUserInfo::newItem);
|
||||||
|
itemNameHash.insert("cmdadd_buddy", Command_AddBuddy::newItem);
|
||||||
|
itemNameHash.insert("cmdremove_buddy", Command_RemoveBuddy::newItem);
|
||||||
|
itemNameHash.insert("cmdadd_ignore", Command_AddIgnore::newItem);
|
||||||
|
itemNameHash.insert("cmdremove_ignore", Command_RemoveIgnore::newItem);
|
||||||
itemNameHash.insert("cmddeck_list", Command_DeckList::newItem);
|
itemNameHash.insert("cmddeck_list", Command_DeckList::newItem);
|
||||||
itemNameHash.insert("cmddeck_new_dir", Command_DeckNewDir::newItem);
|
itemNameHash.insert("cmddeck_new_dir", Command_DeckNewDir::newItem);
|
||||||
itemNameHash.insert("cmddeck_del_dir", Command_DeckDelDir::newItem);
|
itemNameHash.insert("cmddeck_del_dir", Command_DeckDelDir::newItem);
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
0:message:s,user_name:s,text
|
0:message:s,user_name:s,text
|
||||||
0:list_users
|
0:list_users
|
||||||
0:get_user_info:s,user_name
|
0:get_user_info:s,user_name
|
||||||
|
0:add_buddy:s,user_name
|
||||||
|
0:remove_buddy:s,user_name
|
||||||
|
0:add_ignore:s,user_name
|
||||||
|
0:remove_ignore:s,user_name
|
||||||
0:deck_list
|
0:deck_list
|
||||||
0:deck_new_dir:s,path:s,dir_name
|
0:deck_new_dir:s,path:s,dir_name
|
||||||
0:deck_del_dir:s,path
|
0:deck_del_dir:s,path
|
||||||
|
|
|
@ -43,6 +43,38 @@ public:
|
||||||
static SerializableItem *newItem() { return new Command_GetUserInfo; }
|
static SerializableItem *newItem() { return new Command_GetUserInfo; }
|
||||||
int getItemId() const { return ItemId_Command_GetUserInfo; }
|
int getItemId() const { return ItemId_Command_GetUserInfo; }
|
||||||
};
|
};
|
||||||
|
class Command_AddBuddy : public Command {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Command_AddBuddy(const QString &_userName = QString());
|
||||||
|
QString getUserName() const { return static_cast<SerializableItem_String *>(itemMap.value("user_name"))->getData(); };
|
||||||
|
static SerializableItem *newItem() { return new Command_AddBuddy; }
|
||||||
|
int getItemId() const { return ItemId_Command_AddBuddy; }
|
||||||
|
};
|
||||||
|
class Command_RemoveBuddy : public Command {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Command_RemoveBuddy(const QString &_userName = QString());
|
||||||
|
QString getUserName() const { return static_cast<SerializableItem_String *>(itemMap.value("user_name"))->getData(); };
|
||||||
|
static SerializableItem *newItem() { return new Command_RemoveBuddy; }
|
||||||
|
int getItemId() const { return ItemId_Command_RemoveBuddy; }
|
||||||
|
};
|
||||||
|
class Command_AddIgnore : public Command {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Command_AddIgnore(const QString &_userName = QString());
|
||||||
|
QString getUserName() const { return static_cast<SerializableItem_String *>(itemMap.value("user_name"))->getData(); };
|
||||||
|
static SerializableItem *newItem() { return new Command_AddIgnore; }
|
||||||
|
int getItemId() const { return ItemId_Command_AddIgnore; }
|
||||||
|
};
|
||||||
|
class Command_RemoveIgnore : public Command {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Command_RemoveIgnore(const QString &_userName = QString());
|
||||||
|
QString getUserName() const { return static_cast<SerializableItem_String *>(itemMap.value("user_name"))->getData(); };
|
||||||
|
static SerializableItem *newItem() { return new Command_RemoveIgnore; }
|
||||||
|
int getItemId() const { return ItemId_Command_RemoveIgnore; }
|
||||||
|
};
|
||||||
class Command_DeckList : public Command {
|
class Command_DeckList : public Command {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in a new issue