mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Chat works!
This commit is contained in:
parent
1baa188067
commit
64aa68cd26
28 changed files with 714 additions and 424 deletions
62
cockatrice/src/tab_supervisor.cpp
Normal file
62
cockatrice/src/tab_supervisor.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
#include "tab_supervisor.h"
|
||||
#include "client.h"
|
||||
#include "tab_server.h"
|
||||
#include "tab_chatchannel.h"
|
||||
#include "tab_game.h"
|
||||
#include "protocol_items.h"
|
||||
|
||||
TabSupervisor:: TabSupervisor(QWidget *parent)
|
||||
: QTabWidget(parent), client(0), tabServer(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TabSupervisor::retranslateUi()
|
||||
{
|
||||
if (tabServer)
|
||||
setTabText(0, tr("Server"));
|
||||
}
|
||||
|
||||
void TabSupervisor::start(Client *_client)
|
||||
{
|
||||
client = _client;
|
||||
connect(client, SIGNAL(chatEventReceived(ChatEvent *)), this, SLOT(processChatEvent(ChatEvent *)));
|
||||
connect(client, SIGNAL(gameEventReceived(GameEvent *)), this, SLOT(processGameEvent(GameEvent *)));
|
||||
|
||||
tabServer = new TabServer(client);
|
||||
connect(tabServer, SIGNAL(gameJoined(int)), this, SLOT(addGameTab(int)));
|
||||
connect(tabServer, SIGNAL(chatChannelJoined(const QString &)), this, SLOT(addChatChannelTab(const QString &)));
|
||||
|
||||
addTab(tabServer, QString());
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void TabSupervisor::stop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TabSupervisor::addGameTab(int gameId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TabSupervisor::addChatChannelTab(const QString &channelName)
|
||||
{
|
||||
TabChatChannel *tab = new TabChatChannel(client, channelName);
|
||||
addTab(tab, channelName);
|
||||
chatChannelTabs.insert(channelName, tab);
|
||||
}
|
||||
|
||||
void TabSupervisor::processChatEvent(ChatEvent *event)
|
||||
{
|
||||
TabChatChannel *tab = chatChannelTabs.value(event->getChannel(), 0);
|
||||
if (tab)
|
||||
tab->processChatEvent(event);
|
||||
}
|
||||
|
||||
void TabSupervisor::processGameEvent(GameEvent *event)
|
||||
{
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue