mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Added logs tab to allow moderators the ability to review log history/details
This commit is contained in:
parent
e68b8b314a
commit
62ffcde6bd
15 changed files with 581 additions and 18 deletions
336
cockatrice/src/tab_logs.cpp
Normal file
336
cockatrice/src/tab_logs.cpp
Normal file
|
|
@ -0,0 +1,336 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QGroupBox>
|
||||
#include <QMessageBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QSpinBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
#include <QRadioButton>
|
||||
#include "tab_logs.h"
|
||||
#include "abstractclient.h"
|
||||
#include "window_sets.h"
|
||||
#include "pending_command.h"
|
||||
#include "pb/moderator_commands.pb.h"
|
||||
#include "pb/response_viewlog_history.pb.h"
|
||||
|
||||
#include <QtGui>
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QtWidgets>
|
||||
#endif
|
||||
|
||||
TabLog::TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent)
|
||||
: Tab(_tabSupervisor, parent), client(_client)
|
||||
{
|
||||
MainWindow = new QMainWindow;
|
||||
createDock();
|
||||
restartLayout();
|
||||
clearClicked();
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
TabLog::~TabLog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TabLog::retranslateUi()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TabLog::getClicked()
|
||||
{
|
||||
if (findUsername->text().isEmpty() && findIPAddress->text().isEmpty() && findGameName->text().isEmpty() && findGameID->text().isEmpty() && findMessage->text().isEmpty()) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("You must select at least one filter."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!lastHour->isChecked() && !today->isChecked() && !pastDays->isChecked()){
|
||||
pastDays->setChecked(true);
|
||||
pastXDays->setValue(20);
|
||||
}
|
||||
|
||||
if (pastDays->isChecked() && pastXDays->value() == 0) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("You have to select a valid number of days to locate."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mainRoom->isChecked() && !gameRoom->isChecked() && !privateChat->isChecked()) {
|
||||
mainRoom->setChecked(true);
|
||||
gameRoom->setChecked(true);
|
||||
privateChat->setChecked(true);
|
||||
}
|
||||
|
||||
if (maximumResults->value() == 0)
|
||||
maximumResults->setValue(1000);
|
||||
|
||||
int dateRange;
|
||||
if (lastHour->isChecked())
|
||||
dateRange = 1;
|
||||
|
||||
if (today->isChecked())
|
||||
dateRange = 24;
|
||||
|
||||
if (pastDays->isChecked())
|
||||
dateRange = pastXDays->value() * 24;
|
||||
|
||||
Command_ViewLogHistory cmd;
|
||||
cmd.set_user_name(findUsername->text().toStdString());
|
||||
cmd.set_ip_address(findIPAddress->text().toStdString());
|
||||
cmd.set_game_name(findGameName->text().toStdString());
|
||||
cmd.set_game_id(findGameID->text().toStdString());
|
||||
cmd.set_message(findMessage->text().toStdString());
|
||||
if (mainRoom->isChecked()) { cmd.add_log_location("room"); };
|
||||
if (gameRoom->isChecked()) { cmd.add_log_location("game"); };
|
||||
if (privateChat->isChecked()) { cmd.add_log_location("chat"); };
|
||||
cmd.set_date_range(dateRange);
|
||||
cmd.set_maximum_results(maximumResults->value());
|
||||
PendingCommand *pend = client->prepareModeratorCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(viewLogHistory_processResponse(Response)));
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
||||
void TabLog::clearClicked()
|
||||
{
|
||||
findUsername->clear();
|
||||
findIPAddress->clear();
|
||||
findGameName->clear();
|
||||
findGameID->clear();
|
||||
findMessage->clear();
|
||||
pastXDays->clear();
|
||||
maximumResults->clear();
|
||||
mainRoom->setChecked(false);
|
||||
gameRoom->setChecked(false);
|
||||
privateChat->setChecked(false);
|
||||
pastDays->setAutoExclusive(false);
|
||||
pastDays->setChecked(false);
|
||||
today->setAutoExclusive(false);
|
||||
today->setChecked(false);
|
||||
lastHour->setAutoExclusive(false);
|
||||
lastHour->setChecked(false);
|
||||
pastDays->setAutoExclusive(true);
|
||||
today->setAutoExclusive(true);
|
||||
lastHour->setAutoExclusive(true);
|
||||
}
|
||||
|
||||
void TabLog::createDock()
|
||||
{
|
||||
|
||||
labelFindUserName = new QLabel(tr("Username: "));
|
||||
findUsername = new QLineEdit("");
|
||||
findUsername->setAlignment(Qt::AlignCenter);
|
||||
labelFindIPAddress = new QLabel(tr("IP Address: "));
|
||||
findIPAddress = new QLineEdit("");
|
||||
findIPAddress->setAlignment(Qt::AlignCenter);
|
||||
labelFindGameName = new QLabel(tr("Game Name: "));
|
||||
findGameName = new QLineEdit("");
|
||||
findGameName->setAlignment(Qt::AlignCenter);
|
||||
labelFindGameID = new QLabel(tr("GameID: "));
|
||||
findGameID = new QLineEdit("");
|
||||
findGameID->setAlignment(Qt::AlignCenter);
|
||||
labelMessage = new QLabel(tr("Message: "));
|
||||
findMessage = new QLineEdit("");
|
||||
findMessage->setAlignment(Qt::AlignCenter);
|
||||
|
||||
mainRoom = new QCheckBox(tr("Main Room"));
|
||||
gameRoom = new QCheckBox(tr("Game Room"));
|
||||
privateChat = new QCheckBox(tr("Private Chat"));
|
||||
|
||||
pastDays = new QRadioButton(tr("Past X Days: "));
|
||||
today = new QRadioButton(tr("Today"));
|
||||
lastHour = new QRadioButton(tr("Last Hour"));
|
||||
pastXDays = new QSpinBox;
|
||||
pastXDays->setMaximum(20);
|
||||
|
||||
|
||||
labelMaximum = new QLabel(tr("Maximum Results: "));
|
||||
maximumResults = new QSpinBox;
|
||||
maximumResults->setMaximum(1000);
|
||||
|
||||
labelDescription = new QLabel(tr("At least one filter is required.\nThe more information you put in, the more specific your results will be."));
|
||||
|
||||
getButton = new QPushButton(tr("Get User Logs"));
|
||||
getButton->setAutoDefault(true);
|
||||
connect(getButton, SIGNAL(clicked()), this, SLOT(getClicked()));
|
||||
|
||||
clearButton = new QPushButton(tr("Clear Filters"));
|
||||
clearButton->setAutoDefault(true);
|
||||
connect(clearButton, SIGNAL(clicked()), this, SLOT(clearClicked()));
|
||||
|
||||
criteriaGrid = new QGridLayout;
|
||||
criteriaGrid->addWidget(labelFindUserName, 0, 0);
|
||||
criteriaGrid->addWidget(findUsername, 0, 1);
|
||||
criteriaGrid->addWidget(labelFindIPAddress, 1, 0);
|
||||
criteriaGrid->addWidget(findIPAddress, 1, 1);
|
||||
criteriaGrid->addWidget(labelFindGameName, 2, 0);
|
||||
criteriaGrid->addWidget(findGameName, 2, 1);
|
||||
criteriaGrid->addWidget(labelFindGameID, 3, 0);
|
||||
criteriaGrid->addWidget(findGameID, 3, 1);
|
||||
criteriaGrid->addWidget(labelMessage, 4, 0);
|
||||
criteriaGrid->addWidget(findMessage, 4, 1);
|
||||
|
||||
criteriaGroupBox = new QGroupBox(tr("Filters"));
|
||||
criteriaGroupBox->setLayout(criteriaGrid);
|
||||
criteriaGroupBox->setFixedSize(500,300);
|
||||
|
||||
locationGrid = new QGridLayout;
|
||||
locationGrid->addWidget(mainRoom, 0, 0);
|
||||
locationGrid->addWidget(gameRoom, 0, 1);
|
||||
locationGrid->addWidget(privateChat, 0, 2);
|
||||
|
||||
locationGroupBox = new QGroupBox(tr("Log Locations"));
|
||||
locationGroupBox->setLayout(locationGrid);
|
||||
|
||||
rangeGrid = new QGridLayout;
|
||||
rangeGrid->addWidget(pastDays, 0, 0);
|
||||
rangeGrid->addWidget(pastXDays, 0, 1);
|
||||
rangeGrid->addWidget(today, 0, 2);
|
||||
rangeGrid->addWidget(lastHour, 0, 3);
|
||||
|
||||
rangeGroupBox = new QGroupBox(tr("Date Range"));
|
||||
rangeGroupBox->setLayout(rangeGrid);
|
||||
|
||||
maxResultsGrid = new QGridLayout;
|
||||
maxResultsGrid->addWidget(labelMaximum, 0, 0);
|
||||
maxResultsGrid->addWidget(maximumResults, 0, 1);
|
||||
|
||||
maxResultsGroupBox = new QGroupBox(tr("Maximum Results"));
|
||||
maxResultsGroupBox->setLayout(maxResultsGrid);
|
||||
|
||||
descriptionGrid = new QGridLayout;
|
||||
descriptionGrid->addWidget(labelDescription, 0, 0);
|
||||
|
||||
descriptionGroupBox = new QGroupBox(tr(""));
|
||||
descriptionGroupBox->setLayout(descriptionGrid);
|
||||
|
||||
buttonGrid = new QGridLayout;
|
||||
buttonGrid->addWidget(getButton, 0, 0);
|
||||
buttonGrid->addWidget(clearButton, 0, 1);
|
||||
|
||||
buttonGroupBox = new QGroupBox(tr(""));
|
||||
buttonGroupBox->setLayout(buttonGrid);
|
||||
|
||||
mainLayout = new QVBoxLayout(MainWindow);
|
||||
mainLayout->addWidget(criteriaGroupBox);
|
||||
mainLayout->addWidget(locationGroupBox);
|
||||
mainLayout->addWidget(rangeGroupBox);
|
||||
mainLayout->addWidget(maxResultsGroupBox);
|
||||
mainLayout->addWidget(descriptionGroupBox);
|
||||
mainLayout->addWidget(buttonGroupBox);
|
||||
mainLayout->setAlignment(Qt::AlignCenter);
|
||||
|
||||
searchDockContents = new QWidget(MainWindow);
|
||||
searchDockContents->setLayout(mainLayout);
|
||||
|
||||
searchDock = new QDockWidget(MainWindow);
|
||||
searchDock->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
|
||||
searchDock->setWidget(searchDockContents);
|
||||
|
||||
QVBoxLayout *mainVLayoutContent = new QVBoxLayout;
|
||||
QHBoxLayout *mainHLayoutContent = new QHBoxLayout;
|
||||
mainHLayoutContent->addWidget(MainWindow);
|
||||
mainHLayoutContent->addLayout(mainVLayoutContent);
|
||||
setLayout(mainHLayoutContent);
|
||||
}
|
||||
|
||||
void TabLog::viewLogHistory_processResponse(const Response &resp)
|
||||
{
|
||||
const Response_ViewLogHistory &response = resp.GetExtension(Response_ViewLogHistory::ext);
|
||||
if (resp.response_code() == Response::RespOk) {
|
||||
|
||||
if (response.log_message_size() > 0) {
|
||||
|
||||
int j = 0;
|
||||
QTableWidget *roomTable = new QTableWidget();
|
||||
roomTable->setWindowTitle(tr("Room Logs"));
|
||||
roomTable->setRowCount(response.log_message_size());
|
||||
roomTable->setColumnCount(6);
|
||||
roomTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
roomTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
||||
|
||||
int k = 0;
|
||||
QTableWidget *gameTable = new QTableWidget();
|
||||
gameTable->setWindowTitle(tr("Game Logs"));
|
||||
gameTable->setRowCount(response.log_message_size());
|
||||
gameTable->setColumnCount(6);
|
||||
gameTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
gameTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
||||
|
||||
int l = 0;
|
||||
QTableWidget *chatTable = new QTableWidget();
|
||||
chatTable->setWindowTitle(tr("Chat Logs"));
|
||||
chatTable->setRowCount(response.log_message_size());
|
||||
chatTable->setColumnCount(6);
|
||||
chatTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
chatTable->setHorizontalHeaderLabels(QString(tr("Time;SenderName;SenderIP;Message;TargetID;TargetName")).split(";"));
|
||||
|
||||
ServerInfo_ChatMessage message; for (int i = 0; i < response.log_message_size(); ++i) {
|
||||
message = response.log_message(i);
|
||||
if (QString::fromStdString(message.target_type()) == "room") {
|
||||
roomTable->setItem(j, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
||||
roomTable->setItem(j, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
||||
roomTable->setItem(j, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
||||
roomTable->setItem(j, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
||||
roomTable->setItem(j, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
||||
roomTable->setItem(j, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
||||
++j;
|
||||
}
|
||||
|
||||
if (QString::fromStdString(message.target_type()) == "game") {
|
||||
gameTable->setItem(k, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
||||
gameTable->setItem(k, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
||||
gameTable->setItem(k, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
||||
gameTable->setItem(k, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
||||
gameTable->setItem(k, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
||||
gameTable->setItem(k, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
||||
++k;
|
||||
}
|
||||
|
||||
if (QString::fromStdString(message.target_type()) == "chat") {
|
||||
chatTable->setItem(l, 0, new QTableWidgetItem(QString::fromStdString(message.time())));
|
||||
chatTable->setItem(l, 1, new QTableWidgetItem(QString::fromStdString(message.sender_name())));
|
||||
chatTable->setItem(l, 2, new QTableWidgetItem(QString::fromStdString(message.sender_ip())));
|
||||
chatTable->setItem(l, 3, new QTableWidgetItem(QString::fromStdString(message.message())));
|
||||
chatTable->setItem(l, 4, new QTableWidgetItem(QString::fromStdString(message.target_id())));
|
||||
chatTable->setItem(l, 5, new QTableWidgetItem(QString::fromStdString(message.target_name())));
|
||||
++l;
|
||||
}
|
||||
}
|
||||
|
||||
roomTable->setRowCount(j);
|
||||
roomTable->resizeColumnsToContents();
|
||||
gameTable->setRowCount(k);
|
||||
gameTable->resizeColumnsToContents();
|
||||
chatTable->setRowCount(l);
|
||||
chatTable->resizeColumnsToContents();
|
||||
|
||||
if (mainRoom->isChecked()) {
|
||||
roomTable->resize(600, 200);
|
||||
roomTable->show();
|
||||
}
|
||||
|
||||
if (gameRoom->isChecked()) {
|
||||
gameTable->resize(600, 200);
|
||||
gameTable->show();
|
||||
}
|
||||
|
||||
if (privateChat->isChecked()) {
|
||||
chatTable->resize(600, 200);
|
||||
chatTable->show();
|
||||
}
|
||||
|
||||
} else
|
||||
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Message History"), tr("There is no messages for the selected iilters."));
|
||||
|
||||
} else
|
||||
QMessageBox::critical(static_cast<QWidget *>(parent()), tr("Message History"), tr("Failed to collecting message history information."));
|
||||
}
|
||||
|
||||
void TabLog::restartLayout()
|
||||
{
|
||||
searchDock->setFloating(false);
|
||||
MainWindow->addDockWidget(Qt::TopDockWidgetArea, searchDock);
|
||||
searchDock->setVisible(true);
|
||||
}
|
||||
57
cockatrice/src/tab_logs.h
Normal file
57
cockatrice/src/tab_logs.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#ifndef TAB_LOG_H
|
||||
#define TAB_LOG_H
|
||||
|
||||
#include "tab.h"
|
||||
#include <QDialog>
|
||||
|
||||
class AbstractClient;
|
||||
|
||||
class QGroupBox;
|
||||
class QPushButton;
|
||||
class QSpinBox;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QRadioButton;
|
||||
class QLabel;
|
||||
class QDockWidget;
|
||||
class QWidget;
|
||||
class QGridLayout;
|
||||
class CommandContainer;
|
||||
class Response;
|
||||
class AbstractClient;
|
||||
class QMainWindow;
|
||||
|
||||
class TabLog : public Tab {
|
||||
Q_OBJECT
|
||||
private:
|
||||
AbstractClient *client;
|
||||
QLabel *labelFindUserName, *labelFindIPAddress, *labelFindGameName, *labelFindGameID, *labelMessage, *labelMaximum, *labelDescription;
|
||||
QLineEdit *findUsername, *findIPAddress, *findGameName, *findGameID, *findMessage;
|
||||
QCheckBox *mainRoom, *gameRoom, *privateChat;
|
||||
QRadioButton *pastDays, *today, *lastHour;
|
||||
QSpinBox *maximumResults, *pastXDays;
|
||||
QDockWidget *searchDock;
|
||||
QWidget *searchDockContents;
|
||||
QPushButton *getButton, *clearButton;
|
||||
QGridLayout *criteriaGrid, *locationGrid, *rangeGrid, *maxResultsGrid, *descriptionGrid, *buttonGrid;
|
||||
QGroupBox *criteriaGroupBox, *locationGroupBox, *rangeGroupBox, *maxResultsGroupBox, *descriptionGroupBox, *buttonGroupBox;
|
||||
QVBoxLayout *mainLayout;
|
||||
QMainWindow *MainWindow;
|
||||
|
||||
void createDock();
|
||||
signals:
|
||||
|
||||
private slots:
|
||||
void getClicked();
|
||||
void clearClicked();
|
||||
void viewLogHistory_processResponse(const Response &resp);
|
||||
void restartLayout();
|
||||
|
||||
public:
|
||||
TabLog(TabSupervisor *_tabSupervisor, AbstractClient *_client, QWidget *parent = 0);
|
||||
~TabLog();
|
||||
void retranslateUi();
|
||||
QString getTabText() const { return tr("Logs"); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
#include "tab_message.h"
|
||||
#include "tab_userlists.h"
|
||||
#include "tab_deck_editor.h"
|
||||
#include "tab_logs.h"
|
||||
#include "pixmapgenerator.h"
|
||||
#include "userlist.h"
|
||||
#include "settingscache.h"
|
||||
|
|
@ -79,7 +80,7 @@ void CloseButton::paintEvent(QPaintEvent * /*event*/)
|
|||
}
|
||||
|
||||
TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent)
|
||||
: QTabWidget(parent), userInfo(0), client(_client), tabServer(0), tabUserLists(0), tabDeckStorage(0), tabReplays(0), tabAdmin(0)
|
||||
: QTabWidget(parent), userInfo(0), client(_client), tabServer(0), tabUserLists(0), tabDeckStorage(0), tabReplays(0), tabAdmin(0), tabLog(0)
|
||||
{
|
||||
setElideMode(Qt::ElideRight);
|
||||
setMovable(true);
|
||||
|
|
@ -109,6 +110,7 @@ void TabSupervisor::retranslateUi()
|
|||
tabs.append(tabDeckStorage);
|
||||
tabs.append(tabAdmin);
|
||||
tabs.append(tabUserLists);
|
||||
tabs.append(tabLog);
|
||||
QMapIterator<int, TabRoom *> roomIterator(roomTabs);
|
||||
while (roomIterator.hasNext())
|
||||
tabs.append(roomIterator.next().value());
|
||||
|
|
@ -183,42 +185,54 @@ int TabSupervisor::myAddTab(Tab *tab)
|
|||
return idx;
|
||||
}
|
||||
|
||||
void TabSupervisor::start(const ServerInfo_User &_userInfo)
|
||||
{
|
||||
void TabSupervisor::start(const ServerInfo_User &_userInfo) {
|
||||
isLocalGame = false;
|
||||
userInfo = new ServerInfo_User(_userInfo);
|
||||
|
||||
|
||||
tabServer = new TabServer(this, client);
|
||||
connect(tabServer, SIGNAL(roomJoined(const ServerInfo_Room &, bool)), this, SLOT(addRoomTab(const ServerInfo_Room &, bool)));
|
||||
connect(tabServer, SIGNAL(roomJoined(
|
||||
const ServerInfo_Room &, bool)), this, SLOT(addRoomTab(
|
||||
const ServerInfo_Room &, bool)));
|
||||
myAddTab(tabServer);
|
||||
|
||||
|
||||
tabUserLists = new TabUserLists(this, client, *userInfo);
|
||||
connect(tabUserLists, SIGNAL(openMessageDialog(const QString &, bool)), this, SLOT(addMessageTab(const QString &, bool)));
|
||||
connect(tabUserLists, SIGNAL(openMessageDialog(
|
||||
const QString &, bool)), this, SLOT(addMessageTab(
|
||||
const QString &, bool)));
|
||||
connect(tabUserLists, SIGNAL(userJoined(ServerInfo_User)), this, SLOT(processUserJoined(ServerInfo_User)));
|
||||
connect(tabUserLists, SIGNAL(userLeft(const QString &)), this, SLOT(processUserLeft(const QString &)));
|
||||
connect(tabUserLists, SIGNAL(userLeft(
|
||||
const QString &)), this, SLOT(processUserLeft(
|
||||
const QString &)));
|
||||
myAddTab(tabUserLists);
|
||||
|
||||
|
||||
updatePingTime(0, -1);
|
||||
|
||||
|
||||
if (userInfo->user_level() & ServerInfo_User::IsRegistered) {
|
||||
tabDeckStorage = new TabDeckStorage(this, client);
|
||||
connect(tabDeckStorage, SIGNAL(openDeckEditor(const DeckLoader *)), this, SLOT(addDeckEditorTab(const DeckLoader *)));
|
||||
connect(tabDeckStorage, SIGNAL(openDeckEditor(
|
||||
const DeckLoader *)), this, SLOT(addDeckEditorTab(
|
||||
const DeckLoader *)));
|
||||
myAddTab(tabDeckStorage);
|
||||
|
||||
|
||||
tabReplays = new TabReplays(this, client);
|
||||
connect(tabReplays, SIGNAL(openReplay(GameReplay *)), this, SLOT(openReplay(GameReplay *)));
|
||||
connect(tabReplays, SIGNAL(openReplay(GameReplay * )), this, SLOT(openReplay(GameReplay * )));
|
||||
myAddTab(tabReplays);
|
||||
} else {
|
||||
tabDeckStorage = 0;
|
||||
tabReplays = 0;
|
||||
}
|
||||
|
||||
|
||||
if (userInfo->user_level() & ServerInfo_User::IsModerator) {
|
||||
tabAdmin = new TabAdmin(this, client, (userInfo->user_level() & ServerInfo_User::IsAdmin));
|
||||
connect(tabAdmin, SIGNAL(adminLockChanged(bool)), this, SIGNAL(adminLockChanged(bool)));
|
||||
myAddTab(tabAdmin);
|
||||
} else
|
||||
|
||||
tabLog = new TabLog(this, client);
|
||||
myAddTab(tabLog);
|
||||
} else {
|
||||
tabAdmin = 0;
|
||||
tabLog = 0;
|
||||
}
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
@ -229,6 +243,7 @@ void TabSupervisor::startLocal(const QList<AbstractClient *> &_clients)
|
|||
tabDeckStorage = 0;
|
||||
tabReplays = 0;
|
||||
tabAdmin = 0;
|
||||
tabLog = 0;
|
||||
isLocalGame = true;
|
||||
userInfo = new ServerInfo_User;
|
||||
localClients = _clients;
|
||||
|
|
@ -259,12 +274,15 @@ void TabSupervisor::stop()
|
|||
tabReplays->deleteLater();
|
||||
if (tabAdmin)
|
||||
tabAdmin->deleteLater();
|
||||
if (tabLog)
|
||||
tabLog->deleteLater();
|
||||
}
|
||||
tabUserLists = 0;
|
||||
tabServer = 0;
|
||||
tabDeckStorage = 0;
|
||||
tabReplays = 0;
|
||||
tabAdmin = 0;
|
||||
tabLog = 0;
|
||||
|
||||
QMapIterator<int, TabRoom *> roomIterator(roomTabs);
|
||||
while (roomIterator.hasNext())
|
||||
|
|
@ -280,7 +298,7 @@ void TabSupervisor::stop()
|
|||
while (replayIterator.hasNext())
|
||||
replayIterator.next()->deleteLater();
|
||||
replayTabs.clear();
|
||||
|
||||
|
||||
delete userInfo;
|
||||
userInfo = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class TabAdmin;
|
|||
class TabMessage;
|
||||
class TabUserLists;
|
||||
class TabDeckEditor;
|
||||
class TabLog;
|
||||
class RoomEvent;
|
||||
class GameEventContainer;
|
||||
class Event_GameJoined;
|
||||
|
|
@ -51,6 +52,7 @@ private:
|
|||
TabDeckStorage *tabDeckStorage;
|
||||
TabReplays *tabReplays;
|
||||
TabAdmin *tabAdmin;
|
||||
TabLog *tabLog;
|
||||
QMap<int, TabRoom *> roomTabs;
|
||||
QMap<int, TabGame *> gameTabs;
|
||||
QList<TabGame *> replayTabs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue