mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 19:18:55 -07:00
Fix merge & relative path for portable build
This commit is contained in:
commit
4125d690fa
33 changed files with 1556 additions and 581 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "pb/event_server_shutdown.pb.h"
|
||||
#include "pb/event_connection_closed.pb.h"
|
||||
#include "pb/event_user_message.pb.h"
|
||||
#include "pb/event_notify_user.pb.h"
|
||||
#include "pb/event_list_rooms.pb.h"
|
||||
#include "pb/event_add_to_list.pb.h"
|
||||
#include "pb/event_remove_from_list.pb.h"
|
||||
|
|
@ -40,6 +41,7 @@ AbstractClient::AbstractClient(QObject *parent)
|
|||
qRegisterMetaType<Event_ListRooms>("Event_ListRooms");
|
||||
qRegisterMetaType<Event_GameJoined>("Event_GameJoined");
|
||||
qRegisterMetaType<Event_UserMessage>("Event_UserMessage");
|
||||
qRegisterMetaType<Event_NotifyUser>("Event_NotifyUser");
|
||||
qRegisterMetaType<ServerInfo_User>("ServerInfo_User");
|
||||
qRegisterMetaType<QList<ServerInfo_User> >("QList<ServerInfo_User>");
|
||||
qRegisterMetaType<Event_ReplayAdded>("Event_ReplayAdded");
|
||||
|
|
@ -75,6 +77,7 @@ void AbstractClient::processProtocolItem(const ServerMessage &item)
|
|||
case SessionEvent::SERVER_SHUTDOWN: emit serverShutdownEventReceived(event.GetExtension(Event_ServerShutdown::ext)); break;
|
||||
case SessionEvent::CONNECTION_CLOSED: emit connectionClosedEventReceived(event.GetExtension(Event_ConnectionClosed::ext)); break;
|
||||
case SessionEvent::USER_MESSAGE: emit userMessageEventReceived(event.GetExtension(Event_UserMessage::ext)); break;
|
||||
case SessionEvent::NOTIFY_USER: emit notifyUserEventReceived(event.GetExtension(Event_NotifyUser::ext)); break;
|
||||
case SessionEvent::LIST_ROOMS: emit listRoomsEventReceived(event.GetExtension(Event_ListRooms::ext)); break;
|
||||
case SessionEvent::ADD_TO_LIST: emit addToListEventReceived(event.GetExtension(Event_AddToList::ext)); break;
|
||||
case SessionEvent::REMOVE_FROM_LIST: emit removeFromListEventReceived(event.GetExtension(Event_RemoveFromList::ext)); break;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class Event_ServerMessage;
|
|||
class Event_ListRooms;
|
||||
class Event_GameJoined;
|
||||
class Event_UserMessage;
|
||||
class Event_NotifyUser;
|
||||
class Event_ConnectionClosed;
|
||||
class Event_ServerShutdown;
|
||||
class Event_ReplayAdded;
|
||||
|
|
@ -56,6 +57,7 @@ signals:
|
|||
void listRoomsEventReceived(const Event_ListRooms &event);
|
||||
void gameJoinedEventReceived(const Event_GameJoined &event);
|
||||
void userMessageEventReceived(const Event_UserMessage &event);
|
||||
void notifyUserEventReceived(const Event_NotifyUser &event);
|
||||
void userInfoChanged(const ServerInfo_User &userInfo);
|
||||
void buddyListReceived(const QList<ServerInfo_User> &buddyList);
|
||||
void ignoreListReceived(const QList<ServerInfo_User> &ignoreList);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
void DlgCreateGame::sharedCtor()
|
||||
{
|
||||
rememberGameSettings = new QCheckBox(tr("Re&member settings"));
|
||||
descriptionLabel = new QLabel(tr("&Description:"));
|
||||
descriptionEdit = new QLineEdit;
|
||||
descriptionLabel->setBuddy(descriptionEdit);
|
||||
|
|
@ -38,6 +39,7 @@ void DlgCreateGame::sharedCtor()
|
|||
generalGrid->addWidget(descriptionEdit, 0, 1);
|
||||
generalGrid->addWidget(maxPlayersLabel, 1, 0);
|
||||
generalGrid->addWidget(maxPlayersEdit, 1, 1);
|
||||
generalGrid->addWidget(rememberGameSettings, 2, 0);
|
||||
|
||||
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||
|
|
@ -111,15 +113,26 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
|||
{
|
||||
sharedCtor();
|
||||
|
||||
rememberGameSettings->setChecked(settingsCache->getRememberGameSettings());
|
||||
descriptionEdit->setText(settingsCache->getGameDescription());
|
||||
maxPlayersEdit->setValue(settingsCache->getMaxPlayers());
|
||||
onlyBuddiesCheckBox->setChecked(settingsCache->getOnlyBuddies());
|
||||
onlyRegisteredCheckBox->setChecked(settingsCache->getOnlyRegistered());
|
||||
if (room && room->getUserInfo()->user_level() & ServerInfo_User::IsRegistered)
|
||||
{
|
||||
onlyRegisteredCheckBox->setChecked(settingsCache->getOnlyRegistered());
|
||||
} else {
|
||||
onlyBuddiesCheckBox->setEnabled(false);
|
||||
onlyRegisteredCheckBox->setEnabled(false);
|
||||
}
|
||||
spectatorsAllowedCheckBox->setChecked(settingsCache->getSpectatorsAllowed());
|
||||
spectatorsNeedPasswordCheckBox->setChecked(settingsCache->getSpectatorsNeedPassword());
|
||||
spectatorsCanTalkCheckBox->setChecked(settingsCache->getSpectatorsCanTalk());
|
||||
spectatorsSeeEverythingCheckBox->setChecked(settingsCache->getSpectatorsCanSeeEverything());
|
||||
|
||||
if (!rememberGameSettings->isChecked()){
|
||||
actReset();
|
||||
}
|
||||
|
||||
clearButton = new QPushButton(tr("&Clear"));
|
||||
buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||
buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
|
||||
|
|
@ -134,6 +147,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
|||
{
|
||||
sharedCtor();
|
||||
|
||||
rememberGameSettings->setEnabled(false);
|
||||
descriptionEdit->setEnabled(false);
|
||||
maxPlayersEdit->setEnabled(false);
|
||||
passwordEdit->setEnabled(false);
|
||||
|
|
@ -197,15 +211,6 @@ descriptionEdit->setFocus();
|
|||
|
||||
void DlgCreateGame::actOK()
|
||||
{
|
||||
settingsCache->setGameDescription(descriptionEdit->text());
|
||||
settingsCache->setMaxPlayers(maxPlayersEdit->value());
|
||||
settingsCache->setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||
settingsCache->setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||
|
||||
Command_CreateGame cmd;
|
||||
cmd.set_description(descriptionEdit->text().simplified().toStdString());
|
||||
cmd.set_password(passwordEdit->text().toStdString());
|
||||
|
|
@ -227,7 +232,18 @@ void DlgCreateGame::actOK()
|
|||
}
|
||||
}
|
||||
|
||||
settingsCache->setGameTypes(gameTypes);
|
||||
settingsCache->setRememberGameSettings(rememberGameSettings->isChecked());
|
||||
if (rememberGameSettings->isChecked()){
|
||||
settingsCache->setGameDescription(descriptionEdit->text());
|
||||
settingsCache->setMaxPlayers(maxPlayersEdit->value());
|
||||
settingsCache->setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||
settingsCache->setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||
settingsCache->setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||
settingsCache->setGameTypes(gameTypes);
|
||||
}
|
||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
||||
room->sendRoomCommand(pend);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ private:
|
|||
QCheckBox *spectatorsAllowedCheckBox, *spectatorsNeedPasswordCheckBox, *spectatorsCanTalkCheckBox, *spectatorsSeeEverythingCheckBox;
|
||||
QDialogButtonBox *buttonBox;
|
||||
QPushButton *clearButton;
|
||||
QCheckBox *rememberGameSettings;
|
||||
|
||||
void sharedCtor();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ DlgEditUser::DlgEditUser(QWidget *parent, QString email, int gender, QString cou
|
|||
foreach(QString c, countries)
|
||||
{
|
||||
countryEdit->addItem(QPixmap(":/resources/countries/" + c + ".svg"), c);
|
||||
if(c == country)
|
||||
if (c == country)
|
||||
countryEdit->setCurrentIndex(i);
|
||||
|
||||
++i;
|
||||
|
|
|
|||
|
|
@ -58,9 +58,7 @@ DlgRegister::DlgRegister(QWidget *parent)
|
|||
countryEdit->setCurrentIndex(0);
|
||||
QStringList countries = settingsCache->getCountries();
|
||||
foreach(QString c, countries)
|
||||
{
|
||||
countryEdit->addItem(QPixmap(":/resources/countries/" + c + ".svg"), c);
|
||||
}
|
||||
|
||||
realnameLabel = new QLabel(tr("Real name:"));
|
||||
realnameEdit = new QLineEdit();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public:
|
|||
QString getPassword() const { return passwordEdit->text(); }
|
||||
QString getEmail() const { return emailEdit->text(); }
|
||||
int getGender() const { return genderEdit->currentIndex() - 1; }
|
||||
QString getCountry() const { return genderEdit->currentIndex() == 0 ? "" : countryEdit->currentText(); }
|
||||
QString getCountry() const { return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText(); }
|
||||
QString getRealName() const { return realnameEdit->text(); }
|
||||
private slots:
|
||||
void actOk();
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countr
|
|||
if (pmCache.contains(key))
|
||||
return pmCache.value(key);
|
||||
|
||||
QSvgRenderer svg(QString(":/resources/countries/" + countryCode + ".svg"));
|
||||
QSvgRenderer svg(QString(":/resources/countries/" + countryCode.toLower() + ".svg"));
|
||||
int width = (int) round(height * (double) svg.defaultSize().width() / (double) svg.defaultSize().height());
|
||||
QPixmap pixmap(width, height);
|
||||
pixmap.fill(Qt::transparent);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "pb/event_server_identification.pb.h"
|
||||
#include "settingscache.h"
|
||||
#include "main.h"
|
||||
#include "version_string.h"
|
||||
|
||||
static const unsigned int protocolVersion = 14;
|
||||
|
||||
|
|
@ -112,6 +113,7 @@ void RemoteClient::doLogin()
|
|||
cmdLogin.set_user_name(userName.toStdString());
|
||||
cmdLogin.set_password(password.toStdString());
|
||||
cmdLogin.set_clientid(settingsCache->getClientID().toStdString());
|
||||
cmdLogin.set_clientver(VERSION_STRING);
|
||||
PendingCommand *pend = prepareSessionCommand(cmdLogin);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(loginResponse(Response)));
|
||||
sendCommand(pend);
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ SettingsCache::SettingsCache()
|
|||
spectatorsNeedPassword = settings->value("game/spectatorsneedpassword", false).toBool();
|
||||
spectatorsCanTalk = settings->value("game/spectatorscantalk", false).toBool();
|
||||
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
||||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||
clientID = settings->value("personal/clientid", "notset").toString();
|
||||
}
|
||||
|
||||
|
|
@ -646,3 +647,9 @@ void SettingsCache::setSpectatorsCanSeeEverything(const bool _spectatorsCanSeeEv
|
|||
spectatorsCanSeeEverything = _spectatorsCanSeeEverything;
|
||||
settings->setValue("game/spectatorscanseeeverything", spectatorsCanSeeEverything);
|
||||
}
|
||||
|
||||
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
||||
{
|
||||
rememberGameSettings = _rememberGameSettings;
|
||||
settings->setValue("game/remembergamesettings", rememberGameSettings);
|
||||
}
|
||||
|
|
@ -115,6 +115,8 @@ private:
|
|||
bool spectatorsCanSeeEverything;
|
||||
int keepalive;
|
||||
void translateLegacySettings();
|
||||
bool rememberGameSettings;
|
||||
|
||||
public:
|
||||
SettingsCache();
|
||||
QString getSettingsPath();
|
||||
|
|
@ -187,6 +189,7 @@ public:
|
|||
bool getSpectatorsNeedPassword() const { return spectatorsNeedPassword; }
|
||||
bool getSpectatorsCanTalk() const { return spectatorsCanTalk; }
|
||||
bool getSpectatorsCanSeeEverything() const { return spectatorsCanSeeEverything; }
|
||||
bool getRememberGameSettings() const { return rememberGameSettings; }
|
||||
int getKeepAlive() const { return keepalive; }
|
||||
void setClientID(QString clientID);
|
||||
QString getClientID() { return clientID; }
|
||||
|
|
@ -260,6 +263,7 @@ public slots:
|
|||
void setSpectatorsNeedPassword(const bool _spectatorsNeedPassword);
|
||||
void setSpectatorsCanTalk(const bool _spectatorsCanTalk);
|
||||
void setSpectatorsCanSeeEverything(const bool _spectatorsCanSeeEverything);
|
||||
void setRememberGameSettings(const bool _rememberGameSettings);
|
||||
};
|
||||
|
||||
extern SettingsCache *settingsCache;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QMessageBox>
|
||||
#include <QApplication>
|
||||
#include "tab_supervisor.h"
|
||||
#include "abstractclient.h"
|
||||
|
|
@ -13,14 +16,12 @@
|
|||
#include "pixmapgenerator.h"
|
||||
#include "userlist.h"
|
||||
#include "settingscache.h"
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "pb/room_commands.pb.h"
|
||||
#include "pb/room_event.pb.h"
|
||||
#include "pb/game_event_container.pb.h"
|
||||
#include "pb/event_user_message.pb.h"
|
||||
#include "pb/event_notify_user.pb.h"
|
||||
#include "pb/event_game_joined.pb.h"
|
||||
#include "pb/serverinfo_user.pb.h"
|
||||
#include "pb/serverinfo_room.pb.h"
|
||||
|
|
@ -90,6 +91,7 @@ TabSupervisor::TabSupervisor(AbstractClient *_client, QWidget *parent)
|
|||
connect(client, SIGNAL(gameJoinedEventReceived(const Event_GameJoined &)), this, SLOT(gameJoined(const Event_GameJoined &)));
|
||||
connect(client, SIGNAL(userMessageEventReceived(const Event_UserMessage &)), this, SLOT(processUserMessageEvent(const Event_UserMessage &)));
|
||||
connect(client, SIGNAL(maxPingTime(int, int)), this, SLOT(updatePingTime(int, int)));
|
||||
connect(client, SIGNAL(notifyUserEventReceived(const Event_NotifyUser &)), this, SLOT(processNotifyUserEvent(const Event_NotifyUser &)));
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
@ -559,3 +561,13 @@ bool TabSupervisor::getAdminLocked() const
|
|||
return true;
|
||||
return tabAdmin->getLocked();
|
||||
}
|
||||
|
||||
void TabSupervisor::processNotifyUserEvent(const Event_NotifyUser &event)
|
||||
{
|
||||
switch ((Event_NotifyUser::NotificationType) event.type()) {
|
||||
case Event_NotifyUser::PROMOTED: QMessageBox::information(this, tr("Promotion"), tr("You have been promoted to moderator. Please log out and back in for changes to take effect.")); break;
|
||||
default: ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class RoomEvent;
|
|||
class GameEventContainer;
|
||||
class Event_GameJoined;
|
||||
class Event_UserMessage;
|
||||
class Event_NotifyUser;
|
||||
class ServerInfo_Room;
|
||||
class ServerInfo_User;
|
||||
class GameReplay;
|
||||
|
|
@ -105,6 +106,7 @@ private slots:
|
|||
void processRoomEvent(const RoomEvent &event);
|
||||
void processGameEventContainer(const GameEventContainer &cont);
|
||||
void processUserMessageEvent(const Event_UserMessage &event);
|
||||
void processNotifyUserEvent(const Event_NotifyUser &event);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include "user_context_menu.h"
|
||||
#include "tab_supervisor.h"
|
||||
#include "tab_userlists.h"
|
||||
|
|
@ -31,6 +32,8 @@ UserContextMenu::UserContextMenu(const TabSupervisor *_tabSupervisor, QWidget *p
|
|||
aRemoveFromIgnoreList = new QAction(QString(), this);
|
||||
aKick = new QAction(QString(), this);
|
||||
aBan = new QAction(QString(), this);
|
||||
aPromoteToMod = new QAction(QString(), this);
|
||||
aDemoteFromMod = new QAction(QString(), this);
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
|
@ -46,6 +49,8 @@ void UserContextMenu::retranslateUi()
|
|||
aRemoveFromIgnoreList->setText(tr("Remove from &ignore list"));
|
||||
aKick->setText(tr("Kick from &game"));
|
||||
aBan->setText(tr("Ban from &server"));
|
||||
aPromoteToMod->setText(tr("&Promote user to moderator"));
|
||||
aDemoteFromMod->setText(tr("Dem&ote user from moderator"));
|
||||
}
|
||||
|
||||
void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandContainer &commandContainer)
|
||||
|
|
@ -89,6 +94,27 @@ void UserContextMenu::banUser_processUserInfoResponse(const Response &r)
|
|||
dlg->show();
|
||||
}
|
||||
|
||||
void UserContextMenu::adjustMod_processUserResponse(const Response &resp, const CommandContainer &commandContainer)
|
||||
{
|
||||
|
||||
const Command_AdjustMod &cmd = commandContainer.admin_command(0).GetExtension(Command_AdjustMod::ext);
|
||||
|
||||
if (resp.response_code() == Response::RespOk) {
|
||||
if (cmd.should_be_mod()) {
|
||||
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Success"), tr("Successfully promoted user."));
|
||||
} else {
|
||||
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Success"), tr("Successfully demoted user."));
|
||||
}
|
||||
|
||||
} else {
|
||||
if (cmd.should_be_mod()) {
|
||||
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Failed"), tr("Failed to promote user."));
|
||||
} else {
|
||||
QMessageBox::information(static_cast<QWidget *>(parent()), tr("Failed"), tr("Failed to demote user."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UserContextMenu::banUser_dialogFinished()
|
||||
{
|
||||
BanDialog *dlg = static_cast<BanDialog *>(sender());
|
||||
|
|
@ -132,6 +158,14 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
if (!tabSupervisor->getAdminLocked()) {
|
||||
menu->addSeparator();
|
||||
menu->addAction(aBan);
|
||||
|
||||
menu->addSeparator();
|
||||
if (userLevel.testFlag(ServerInfo_User::IsModerator) && (tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin)) {
|
||||
menu->addAction(aDemoteFromMod);
|
||||
|
||||
} else if (userLevel.testFlag(ServerInfo_User::IsRegistered) && (tabSupervisor->getUserInfo()->user_level() & ServerInfo_User::IsAdmin)) {
|
||||
menu->addAction(aPromoteToMod);
|
||||
}
|
||||
}
|
||||
bool anotherUser = userName != QString::fromStdString(tabSupervisor->getUserInfo()->name());
|
||||
aDetails->setEnabled(online);
|
||||
|
|
@ -143,6 +177,8 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
aRemoveFromIgnoreList->setEnabled(anotherUser);
|
||||
aKick->setEnabled(anotherUser);
|
||||
aBan->setEnabled(anotherUser);
|
||||
aPromoteToMod->setEnabled(anotherUser);
|
||||
aDemoteFromMod->setEnabled(anotherUser);
|
||||
|
||||
QAction *actionClicked = menu->exec(pos);
|
||||
if (actionClicked == aDetails) {
|
||||
|
|
@ -186,6 +222,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
} else if (actionClicked == aKick) {
|
||||
Command_KickFromGame cmd;
|
||||
cmd.set_player_id(playerId);
|
||||
|
||||
game->sendGameCommand(cmd);
|
||||
} else if (actionClicked == aBan) {
|
||||
Command_GetUserInfo cmd;
|
||||
|
|
@ -193,7 +230,14 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(banUser_processUserInfoResponse(Response)));
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aPromoteToMod || actionClicked == aDemoteFromMod) {
|
||||
Command_AdjustMod cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
cmd.set_should_be_mod(actionClicked == aPromoteToMod);
|
||||
|
||||
PendingCommand *pend = client->prepareAdminCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(adjustMod_processUserResponse(Response, CommandContainer)));
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,12 @@ private:
|
|||
QAction *aAddToIgnoreList, *aRemoveFromIgnoreList;
|
||||
QAction *aKick;
|
||||
QAction *aBan;
|
||||
QAction *aPromoteToMod, *aDemoteFromMod;
|
||||
signals:
|
||||
void openMessageDialog(const QString &userName, bool focus);
|
||||
private slots:
|
||||
void banUser_processUserInfoResponse(const Response &resp);
|
||||
void adjustMod_processUserResponse(const Response &resp, const CommandContainer &commandContainer);
|
||||
void banUser_dialogFinished();
|
||||
void gamesOfUserReceived(const Response &resp, const CommandContainer &commandContainer);
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@
|
|||
#include <QSystemTrayIcon>
|
||||
#include <QApplication>
|
||||
#if QT_VERSION < 0x050000
|
||||
// for Qt::escape()
|
||||
#include <QtGui/qtextdocument.h>
|
||||
#include <QtGui/qtextdocument.h> // for Qt::escape()
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
|
|
@ -47,7 +46,6 @@
|
|||
#include "localclient.h"
|
||||
#include "settingscache.h"
|
||||
#include "tab_game.h"
|
||||
|
||||
#include "version_string.h"
|
||||
|
||||
#include "pb/game_replay.pb.h"
|
||||
|
|
@ -55,6 +53,14 @@
|
|||
#include "pb/event_connection_closed.pb.h"
|
||||
#include "pb/event_server_shutdown.pb.h"
|
||||
|
||||
#define GITHUB_CONTRIBUTORS_URL "https://github.com/Cockatrice/Cockatrice/graphs/contributors?type=c"
|
||||
#define GITHUB_CONTRIBUTE_URL "https://github.com/Cockatrice/Cockatrice#cockatrice"
|
||||
#define GITHUB_TRANSLATOR_RECOGNIZE_URL "https://github.com/Cockatrice/Cockatrice/wiki/Translators"
|
||||
#define GITHUB_TRANSLATOR_FAQ_URL "https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ"
|
||||
#define GITHUB_ISSUES_URL "https://github.com/Cockatrice/Cockatrice/issues"
|
||||
#define GITHUB_TROUBLESHOOTING_URL "https://github.com/Cockatrice/Cockatrice/wiki/Troubleshooting"
|
||||
#define GITHUB_FAQ_URL "https://github.com/Cockatrice/Cockatrice/wiki/Frequently-Asked-Questions"
|
||||
|
||||
const QString MainWindow::appName = "Cockatrice";
|
||||
|
||||
void MainWindow::updateTabMenu(const QList<QMenu *> &newMenuList)
|
||||
|
|
@ -71,7 +77,7 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even
|
|||
client->disconnectFromServer();
|
||||
QString reasonStr;
|
||||
switch (event.reason()) {
|
||||
case Event_ConnectionClosed::USER_LIMIT_REACHED: reasonStr = tr("The server has reached its maximum user capacity, please check back later."); break;
|
||||
case Event_ConnectionClosed::USER_LIMIT_REACHED: reasonStr = tr("The server has reached its maximum user capacity, please check back later."); break;
|
||||
case Event_ConnectionClosed::TOO_MANY_CONNECTIONS: reasonStr = tr("There are too many concurrent connections from your address."); break;
|
||||
case Event_ConnectionClosed::BANNED: {
|
||||
reasonStr = tr("Banned by moderator");
|
||||
|
|
@ -85,6 +91,7 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even
|
|||
}
|
||||
case Event_ConnectionClosed::SERVER_SHUTDOWN: reasonStr = tr("Scheduled server shutdown."); break;
|
||||
case Event_ConnectionClosed::USERNAMEINVALID: reasonStr = tr("Invalid username."); break;
|
||||
case Event_ConnectionClosed::LOGGEDINELSEWERE: reasonStr = tr("You have been logged out due to logging in at another location."); break;
|
||||
default: reasonStr = QString::fromStdString(event.reason_str());
|
||||
}
|
||||
QMessageBox::critical(this, tr("Connection closed"), tr("The server has terminated your connection.\nReason: %1").arg(reasonStr));
|
||||
|
|
@ -268,15 +275,15 @@ void MainWindow::actAbout()
|
|||
+ "<br><br><b>" + tr("Project Manager:") + "</b><br>Gavin Bisesi<br><br>"
|
||||
+ "<b>" + tr("Past Project Managers:") + "</b><br>Max-Wilhelm Bruker<br>Marcus Schütz<br><br>"
|
||||
+ "<b>" + tr("Developers:") + "</b><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice/graphs/contributors?type=c'>" + tr("Our Developers") + "</a><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice#cockatrice'>" + tr("Help Develop!") + "</a><br><br>"
|
||||
+ "<a href='" + GITHUB_CONTRIBUTORS_URL + "'>" + tr("Our Developers") + "</a><br>"
|
||||
+ "<a href='" + GITHUB_CONTRIBUTE_URL + "'>" + tr("Help Develop!") + "</a><br><br>"
|
||||
+ "<b>" + tr("Translators:") + "</b><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice/wiki/Translators'>" + tr("Recognition Page") + "</a><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ'>" + tr("Help Translate!") + "</a><br><br>"
|
||||
+ "<a href='" + GITHUB_TRANSLATOR_RECOGNIZE_URL + "'>" + tr("Recognition Page") + "</a><br>"
|
||||
+ "<a href='" + GITHUB_TRANSLATOR_FAQ_URL + "'>" + tr("Help Translate!") + "</a><br><br>"
|
||||
+ "<b>" + tr("Support:") + "</b><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice/issues'>" + tr("Report an Issue") + "</a><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice/wiki/Troubleshooting'>" + tr("Troubleshooting") + "</a><br>"
|
||||
+ "<a href='https://github.com/Cockatrice/Cockatrice/wiki/Frequently-Asked-Questions'>" + tr("F.A.Q.") + "</a><br>"
|
||||
+ "<a href='" + GITHUB_ISSUES_URL + "'>" + tr("Report an Issue") + "</a><br>"
|
||||
+ "<a href='" + GITHUB_TROUBLESHOOTING_URL + "'>" + tr("Troubleshooting") + "</a><br>"
|
||||
+ "<a href='" + GITHUB_FAQ_URL + "'>" + tr("F.A.Q.") + "</a><br>"
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue