mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 10:33:54 -07:00
Merge remote-tracking branch 'origin/master' into show-password-games-by-default
This commit is contained in:
commit
86b92a25de
21 changed files with 216 additions and 165 deletions
|
|
@ -32,7 +32,7 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
|
|||
QString data(reply->readAll());
|
||||
reply->deleteLater();
|
||||
|
||||
QRegExp rx("id=\"deckstats_deck_url\" value=\"([^\"]+)\"");
|
||||
QRegExp rx("<meta property=\"og:url\" content=\"([^\"]+)\"/>");
|
||||
if (!rx.indexIn(data)) {
|
||||
QMessageBox::critical(0, tr("Error"), tr("The reply from the server could not be parsed."));
|
||||
deleteLater();
|
||||
|
|
@ -53,11 +53,13 @@ void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
|||
#if QT_VERSION < 0x050000
|
||||
QUrl params;
|
||||
params.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
params.addQueryItem("decktitle", deck->getName());
|
||||
data->append(params.encodedQuery());
|
||||
#else
|
||||
QUrl params;
|
||||
QUrlQuery urlQuery;
|
||||
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
urlQuery.addQueryItem("decktitle", deck->getName());
|
||||
params.setQuery(urlQuery);
|
||||
data->append(params.query(QUrl::EncodeReserved));
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ void DlgCreateGame::sharedCtor()
|
|||
maxPlayersEdit->setMaximum(100);
|
||||
maxPlayersEdit->setValue(2);
|
||||
maxPlayersLabel->setBuddy(maxPlayersEdit);
|
||||
|
||||
|
||||
QGridLayout *generalGrid = new QGridLayout;
|
||||
generalGrid->addWidget(descriptionLabel, 0, 0);
|
||||
generalGrid->addWidget(descriptionEdit, 0, 1);
|
||||
generalGrid->addWidget(maxPlayersLabel, 1, 0);
|
||||
generalGrid->addWidget(maxPlayersEdit, 1, 1);
|
||||
|
||||
|
||||
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||
while (gameTypeIterator.hasNext()) {
|
||||
|
|
@ -48,7 +48,7 @@ void DlgCreateGame::sharedCtor()
|
|||
}
|
||||
QGroupBox *gameTypeGroupBox = new QGroupBox(tr("Game type"));
|
||||
gameTypeGroupBox->setLayout(gameTypeLayout);
|
||||
|
||||
|
||||
passwordLabel = new QLabel(tr("&Password:"));
|
||||
passwordEdit = new QLineEdit;
|
||||
passwordLabel->setBuddy(passwordEdit);
|
||||
|
|
@ -60,18 +60,18 @@ void DlgCreateGame::sharedCtor()
|
|||
onlyRegisteredCheckBox->setChecked(true);
|
||||
} else {
|
||||
onlyBuddiesCheckBox->setEnabled(false);
|
||||
onlyRegisteredCheckBox->setEnabled(false);
|
||||
onlyRegisteredCheckBox->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
QGridLayout *joinRestrictionsLayout = new QGridLayout;
|
||||
joinRestrictionsLayout->addWidget(passwordLabel, 0, 0);
|
||||
joinRestrictionsLayout->addWidget(passwordEdit, 0, 1);
|
||||
joinRestrictionsLayout->addWidget(onlyBuddiesCheckBox, 1, 0, 1, 2);
|
||||
joinRestrictionsLayout->addWidget(onlyRegisteredCheckBox, 2, 0, 1, 2);
|
||||
|
||||
|
||||
QGroupBox *joinRestrictionsGroupBox = new QGroupBox(tr("Joining restrictions"));
|
||||
joinRestrictionsGroupBox->setLayout(joinRestrictionsLayout);
|
||||
|
||||
|
||||
spectatorsAllowedCheckBox = new QCheckBox(tr("&Spectators allowed"));
|
||||
spectatorsAllowedCheckBox->setChecked(true);
|
||||
connect(spectatorsAllowedCheckBox, SIGNAL(stateChanged(int)), this, SLOT(spectatorsAllowedChanged(int)));
|
||||
|
|
@ -94,7 +94,7 @@ void DlgCreateGame::sharedCtor()
|
|||
|
||||
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addLayout(grid);
|
||||
mainLayout->addWidget(buttonBox);
|
||||
|
|
@ -108,10 +108,10 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
|||
: QDialog(parent), room(_room), gameTypes(_gameTypes)
|
||||
{
|
||||
sharedCtor();
|
||||
|
||||
|
||||
buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOK()));
|
||||
|
||||
|
||||
setWindowTitle(tr("Create game"));
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
|||
: QDialog(parent), room(0), gameTypes(_gameTypes)
|
||||
{
|
||||
sharedCtor();
|
||||
|
||||
|
||||
descriptionEdit->setEnabled(false);
|
||||
maxPlayersEdit->setEnabled(false);
|
||||
passwordEdit->setEnabled(false);
|
||||
|
|
@ -129,7 +129,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
|||
spectatorsNeedPasswordCheckBox->setEnabled(false);
|
||||
spectatorsCanTalkCheckBox->setEnabled(false);
|
||||
spectatorsSeeEverythingCheckBox->setEnabled(false);
|
||||
|
||||
|
||||
descriptionEdit->setText(QString::fromStdString(gameInfo.description()));
|
||||
maxPlayersEdit->setValue(gameInfo.max_players());
|
||||
onlyBuddiesCheckBox->setChecked(gameInfo.only_buddies());
|
||||
|
|
@ -138,29 +138,29 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
|||
spectatorsNeedPasswordCheckBox->setChecked(gameInfo.spectators_need_password());
|
||||
spectatorsCanTalkCheckBox->setChecked(gameInfo.spectators_can_chat());
|
||||
spectatorsSeeEverythingCheckBox->setChecked(gameInfo.spectators_omniscient());
|
||||
|
||||
|
||||
QSet<int> types;
|
||||
for (int i = 0; i < gameInfo.game_types_size(); ++i)
|
||||
types.insert(gameInfo.game_types(i));
|
||||
|
||||
|
||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||
while (gameTypeIterator.hasNext()) {
|
||||
gameTypeIterator.next();
|
||||
|
||||
|
||||
QCheckBox *gameTypeCheckBox = gameTypeCheckBoxes.value(gameTypeIterator.key());
|
||||
gameTypeCheckBox->setEnabled(false);
|
||||
gameTypeCheckBox->setChecked(types.contains(gameTypeIterator.key()));
|
||||
}
|
||||
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
|
||||
|
||||
setWindowTitle(tr("Game information"));
|
||||
}
|
||||
|
||||
void DlgCreateGame::actOK()
|
||||
{
|
||||
Command_CreateGame cmd;
|
||||
cmd.set_description(descriptionEdit->text().toStdString());
|
||||
cmd.set_description(descriptionEdit->text().simplified().toStdString());
|
||||
cmd.set_password(passwordEdit->text().toStdString());
|
||||
cmd.set_max_players(maxPlayersEdit->value());
|
||||
cmd.set_only_buddies(onlyBuddiesCheckBox->isChecked());
|
||||
|
|
@ -169,18 +169,18 @@ void DlgCreateGame::actOK()
|
|||
cmd.set_spectators_need_password(spectatorsNeedPasswordCheckBox->isChecked());
|
||||
cmd.set_spectators_can_talk(spectatorsCanTalkCheckBox->isChecked());
|
||||
cmd.set_spectators_see_everything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||
|
||||
|
||||
QMapIterator<int, QCheckBox *> gameTypeCheckBoxIterator(gameTypeCheckBoxes);
|
||||
while (gameTypeCheckBoxIterator.hasNext()) {
|
||||
gameTypeCheckBoxIterator.next();
|
||||
if (gameTypeCheckBoxIterator.value()->isChecked())
|
||||
cmd.add_game_type_ids(gameTypeCheckBoxIterator.key());
|
||||
}
|
||||
|
||||
|
||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
||||
room->sendRoomCommand(pend);
|
||||
|
||||
|
||||
buttonBox->setEnabled(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
#include "pb/serverinfo_game.pb.h"
|
||||
#include "pb/response.pb.h"
|
||||
|
||||
GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QWidget *parent)
|
||||
GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, const bool restoresettings, QWidget *parent)
|
||||
: QGroupBox(parent), client(_client), tabSupervisor(_tabSupervisor), room(_room)
|
||||
{
|
||||
gameListView = new QTreeView;
|
||||
|
|
@ -36,7 +36,8 @@ GameSelector::GameSelector(AbstractClient *_client, const TabSupervisor *_tabSup
|
|||
if (room)
|
||||
gameTypeMap = gameListModel->getGameTypes().value(room->getRoomId());
|
||||
|
||||
gameListProxyModel->loadFilterParameters(gameTypeMap);
|
||||
if (restoresettings)
|
||||
gameListProxyModel->loadFilterParameters(gameTypeMap);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
gameListView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ private:
|
|||
QPushButton *filterButton, *clearFilterButton, *createButton, *joinButton, *spectateButton;
|
||||
GameTypeMap gameTypeMap;
|
||||
public:
|
||||
GameSelector(AbstractClient *_client, const TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, QWidget *parent = 0);
|
||||
GameSelector(AbstractClient *_client, const TabSupervisor *_tabSupervisor, TabRoom *_room, const QMap<int, QString> &_rooms, const QMap<int, GameTypeMap> &_gameTypes, const bool restoresettings, QWidget *parent = 0);
|
||||
void retranslateUi();
|
||||
void processGameInfo(const ServerInfo_Game &info);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -298,7 +298,6 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
|
|||
unavailableGamesVisible = settings.value("unavailable_games_visible", false).toBool();
|
||||
passwordProtectedGamesHidden = settings.value("password_protected_games_hidden", false).toBool();
|
||||
gameNameFilter = settings.value("game_name_filter", "").toString();
|
||||
creatorNameFilter = settings.value("creator_name_filter", "").toString();
|
||||
maxPlayersFilterMin = settings.value("min_players", 1).toInt();
|
||||
maxPlayersFilterMax = settings.value("max_players", DEFAULT_MAX_PLAYERS_MAX).toInt();
|
||||
|
||||
|
|
@ -324,8 +323,7 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
|
|||
passwordProtectedGamesHidden
|
||||
);
|
||||
settings.setValue("game_name_filter", gameNameFilter);
|
||||
settings.setValue("creator_name_filter", creatorNameFilter);
|
||||
|
||||
|
||||
QMapIterator<int, QString> gameTypeIterator(allGameTypes);
|
||||
while (gameTypeIterator.hasNext()) {
|
||||
gameTypeIterator.next();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ SettingsCache::SettingsCache()
|
|||
tapAnimation = settings->value("cards/tapanimation", true).toBool();
|
||||
chatMention = settings->value("chat/mention", true).toBool();
|
||||
chatMentionForeground = settings->value("chat/mentionforeground", true).toBool();
|
||||
chatMentionColor = settings->value("chat/mentioncolor", "C21F2F").toString();
|
||||
chatMentionColor = settings->value("chat/mentioncolor", "A6120D").toString();
|
||||
|
||||
zoneViewSortByName = settings->value("zoneview/sortbyname", true).toBool();
|
||||
zoneViewSortByType = settings->value("zoneview/sortbytype", true).toBool();
|
||||
|
|
|
|||
|
|
@ -276,8 +276,8 @@ TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
|
|||
deckEditToolBar->addAction(aAddCard);
|
||||
deckEditToolBar->addAction(aAddCardToSideboard);
|
||||
deckEditToolBar->addAction(aRemoveCard);
|
||||
deckEditToolBar->addAction(aIncrement);
|
||||
deckEditToolBar->addAction(aDecrement);
|
||||
deckEditToolBar->addAction(aIncrement);
|
||||
deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
|
||||
retranslateUi();
|
||||
|
|
|
|||
|
|
@ -885,6 +885,7 @@ void TabGame::startGame(bool resuming)
|
|||
gameInfo.set_started(true);
|
||||
static_cast<GameScene *>(gameView->scene())->rearrange();
|
||||
gameView->show();
|
||||
sayEdit->setFocus();
|
||||
}
|
||||
|
||||
void TabGame::stopGame()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, c
|
|||
chatView = new ChatView(tabSupervisor, 0, true);
|
||||
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
|
||||
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
|
||||
sayEdit = new QLineEdit;
|
||||
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
|
||||
|
||||
|
|
@ -43,6 +44,11 @@ TabMessage::~TabMessage()
|
|||
delete otherUserInfo;
|
||||
}
|
||||
|
||||
void TabMessage::addMentionTag(QString mentionTag) {
|
||||
sayEdit->insert(mentionTag + " ");
|
||||
sayEdit->setFocus();
|
||||
}
|
||||
|
||||
void TabMessage::retranslateUi()
|
||||
{
|
||||
messageMenu->setTitle(tr("Personal &talk"));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ private slots:
|
|||
void sendMessage();
|
||||
void actLeave();
|
||||
void messageSent(const Response &response);
|
||||
void addMentionTag(QString mentionTag);
|
||||
public:
|
||||
TabMessage(TabSupervisor *_tabSupervisor, AbstractClient *_client, const ServerInfo_User &_ownUserInfo, const ServerInfo_User &_otherUserInfo);
|
||||
~TabMessage();
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
const int gameTypeListSize = info.gametype_list_size();
|
||||
for (int i = 0; i < gameTypeListSize; ++i)
|
||||
gameTypes.insert(info.gametype_list(i).game_type_id(), QString::fromStdString(info.gametype_list(i).description()));
|
||||
|
||||
|
||||
QMap<int, GameTypeMap> tempMap;
|
||||
tempMap.insert(info.room_id(), gameTypes);
|
||||
gameSelector = new GameSelector(client, tabSupervisor, this, QMap<int, QString>(), tempMap);
|
||||
gameSelector = new GameSelector(client, tabSupervisor, this, QMap<int, QString>(), tempMap, true);
|
||||
userList = new UserList(tabSupervisor, client, UserList::RoomList);
|
||||
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
|
||||
|
||||
|
||||
chatView = new ChatView(tabSupervisor, 0, true);
|
||||
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
|
||||
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
|
||||
|
|
@ -50,7 +50,7 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
sayEdit = new QLineEdit;
|
||||
sayLabel->setBuddy(sayEdit);
|
||||
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
|
||||
|
||||
|
||||
QMenu *chatSettingsMenu = new QMenu(this);
|
||||
|
||||
aClearChat = chatSettingsMenu->addAction(QString());
|
||||
|
|
@ -60,32 +60,32 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
|
||||
aOpenChatSettings = chatSettingsMenu->addAction(QString());
|
||||
connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings()));
|
||||
|
||||
|
||||
QToolButton *chatSettingsButton = new QToolButton;
|
||||
chatSettingsButton->setIcon(QIcon(":/resources/icon_settings.svg"));
|
||||
chatSettingsButton->setMenu(chatSettingsMenu);
|
||||
chatSettingsButton->setPopupMode(QToolButton::InstantPopup);
|
||||
|
||||
|
||||
QHBoxLayout *sayHbox = new QHBoxLayout;
|
||||
sayHbox->addWidget(sayLabel);
|
||||
sayHbox->addWidget(sayEdit);
|
||||
sayHbox->addWidget(chatSettingsButton);
|
||||
|
||||
|
||||
QVBoxLayout *chatVbox = new QVBoxLayout;
|
||||
chatVbox->addWidget(chatView);
|
||||
chatVbox->addLayout(sayHbox);
|
||||
|
||||
|
||||
chatGroupBox = new QGroupBox;
|
||||
chatGroupBox->setLayout(chatVbox);
|
||||
|
||||
|
||||
QSplitter *splitter = new QSplitter(Qt::Vertical);
|
||||
splitter->addWidget(gameSelector);
|
||||
splitter->addWidget(chatGroupBox);
|
||||
|
||||
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
hbox->addWidget(splitter, 3);
|
||||
hbox->addWidget(userList, 1);
|
||||
|
||||
|
||||
aLeaveRoom = new QAction(this);
|
||||
connect(aLeaveRoom, SIGNAL(triggered()), this, SLOT(actLeaveRoom()));
|
||||
|
||||
|
|
@ -95,12 +95,12 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
|
||||
retranslateUi();
|
||||
setLayout(hbox);
|
||||
|
||||
|
||||
const int userListSize = info.user_list_size();
|
||||
for (int i = 0; i < userListSize; ++i)
|
||||
userList->processUserInfo(info.user_list(i), true);
|
||||
userList->sortItems();
|
||||
|
||||
|
||||
const int gameListSize = info.game_list_size();
|
||||
for (int i = 0; i < gameListSize; ++i)
|
||||
gameSelector->processGameInfo(info.game_list(i));
|
||||
|
|
@ -147,10 +147,10 @@ void TabRoom::sendMessage()
|
|||
{
|
||||
if (sayEdit->text().isEmpty())
|
||||
return;
|
||||
|
||||
|
||||
Command_RoomSay cmd;
|
||||
cmd.set_message(sayEdit->text().toStdString());
|
||||
|
||||
|
||||
PendingCommand *pend = prepareRoomCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(sayFinished(const Response &)));
|
||||
sendRoomCommand(pend);
|
||||
|
|
|
|||
|
|
@ -371,7 +371,16 @@ TabMessage *TabSupervisor::addMessageTab(const QString &receiverName, bool focus
|
|||
otherUser = twi->getUserInfo();
|
||||
else
|
||||
otherUser.set_name(receiverName.toStdString());
|
||||
TabMessage *tab = new TabMessage(this, client, *userInfo, otherUser);
|
||||
|
||||
TabMessage *tab;
|
||||
tab = messageTabs.value(QString::fromStdString(otherUser.name()));
|
||||
if (tab) {
|
||||
if (focus)
|
||||
setCurrentWidget(tab);
|
||||
return tab;
|
||||
}
|
||||
|
||||
tab = new TabMessage(this, client, *userInfo, otherUser);
|
||||
connect(tab, SIGNAL(talkClosing(TabMessage *)), this, SLOT(talkLeft(TabMessage *)));
|
||||
int tabIndex = myAddTab(tab);
|
||||
addCloseButtonToTab(tab, tabIndex);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ UserContextMenu::UserContextMenu(const TabSupervisor *_tabSupervisor, QWidget *p
|
|||
aRemoveFromIgnoreList = new QAction(QString(), this);
|
||||
aKick = new QAction(QString(), this);
|
||||
aBan = new QAction(QString(), this);
|
||||
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandCon
|
|||
{
|
||||
const Response_GetGamesOfUser &response = resp.GetExtension(Response_GetGamesOfUser::ext);
|
||||
const Command_GetGamesOfUser &cmd = commandContainer.session_command(0).GetExtension(Command_GetGamesOfUser::ext);
|
||||
|
||||
|
||||
QMap<int, GameTypeMap> gameTypeMap;
|
||||
QMap<int, QString> roomMap;
|
||||
const int roomListSize = response.room_list_size();
|
||||
|
|
@ -67,12 +67,12 @@ void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandCon
|
|||
}
|
||||
gameTypeMap.insert(roomInfo.room_id(), tempMap);
|
||||
}
|
||||
|
||||
GameSelector *selector = new GameSelector(client, tabSupervisor, 0, roomMap, gameTypeMap);
|
||||
|
||||
GameSelector *selector = new GameSelector(client, tabSupervisor, 0, roomMap, gameTypeMap, false);
|
||||
const int gameListSize = response.game_list_size();
|
||||
for (int i = 0; i < gameListSize; ++i)
|
||||
selector->processGameInfo(response.game_list(i));
|
||||
|
||||
|
||||
selector->setWindowTitle(tr("%1's games").arg(QString::fromStdString(cmd.user_name())));
|
||||
selector->setAttribute(Qt::WA_DeleteOnClose);
|
||||
selector->show();
|
||||
|
|
@ -81,7 +81,7 @@ void UserContextMenu::gamesOfUserReceived(const Response &resp, const CommandCon
|
|||
void UserContextMenu::banUser_processUserInfoResponse(const Response &r)
|
||||
{
|
||||
const Response_GetUserInfo &response = r.GetExtension(Response_GetUserInfo::ext);
|
||||
|
||||
|
||||
// The dialog needs to be non-modal in order to not block the event queue of the client.
|
||||
BanDialog *dlg = new BanDialog(response.user_info(), static_cast<QWidget *>(parent()));
|
||||
connect(dlg, SIGNAL(accepted()), this, SLOT(banUser_dialogFinished()));
|
||||
|
|
@ -91,21 +91,21 @@ void UserContextMenu::banUser_processUserInfoResponse(const Response &r)
|
|||
void UserContextMenu::banUser_dialogFinished()
|
||||
{
|
||||
BanDialog *dlg = static_cast<BanDialog *>(sender());
|
||||
|
||||
|
||||
Command_BanFromServer cmd;
|
||||
cmd.set_user_name(dlg->getBanName().toStdString());
|
||||
cmd.set_address(dlg->getBanIP().toStdString());
|
||||
cmd.set_minutes(dlg->getMinutes());
|
||||
cmd.set_reason(dlg->getReason().toStdString());
|
||||
cmd.set_visible_reason(dlg->getVisibleReason().toStdString());
|
||||
|
||||
|
||||
client->sendCommand(client->prepareModeratorCommand(cmd));
|
||||
}
|
||||
|
||||
void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName, UserLevelFlags userLevel, bool online, int playerId)
|
||||
{
|
||||
aUserName->setText(userName);
|
||||
|
||||
|
||||
QMenu *menu = new QMenu(static_cast<QWidget *>(parent()));
|
||||
menu->addAction(aUserName);
|
||||
menu->addSeparator();
|
||||
|
|
@ -141,7 +141,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
aRemoveFromIgnoreList->setEnabled(anotherUser);
|
||||
aKick->setEnabled(anotherUser);
|
||||
aBan->setEnabled(anotherUser);
|
||||
|
||||
|
||||
QAction *actionClicked = menu->exec(pos);
|
||||
if (actionClicked == aDetails) {
|
||||
UserInfoBox *infoWidget = new UserInfoBox(client, true, static_cast<QWidget *>(parent()), Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
|
||||
|
|
@ -152,34 +152,34 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
else if (actionClicked == aShowGames) {
|
||||
Command_GetGamesOfUser cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(gamesOfUserReceived(Response, CommandContainer)));
|
||||
|
||||
|
||||
client->sendCommand(pend);
|
||||
} else if (actionClicked == aAddToBuddyList) {
|
||||
Command_AddToList cmd;
|
||||
cmd.set_list("buddy");
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
|
||||
client->sendCommand(client->prepareSessionCommand(cmd));
|
||||
} else if (actionClicked == aRemoveFromBuddyList) {
|
||||
Command_RemoveFromList cmd;
|
||||
cmd.set_list("buddy");
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
|
||||
client->sendCommand(client->prepareSessionCommand(cmd));
|
||||
} else if (actionClicked == aAddToIgnoreList) {
|
||||
Command_AddToList cmd;
|
||||
cmd.set_list("ignore");
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
|
||||
client->sendCommand(client->prepareSessionCommand(cmd));
|
||||
} else if (actionClicked == aRemoveFromIgnoreList) {
|
||||
Command_RemoveFromList cmd;
|
||||
cmd.set_list("ignore");
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
|
||||
client->sendCommand(client->prepareSessionCommand(cmd));
|
||||
} else if (actionClicked == aKick) {
|
||||
Command_KickFromGame cmd;
|
||||
|
|
@ -188,12 +188,12 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
|
|||
} else if (actionClicked == aBan) {
|
||||
Command_GetUserInfo cmd;
|
||||
cmd.set_user_name(userName.toStdString());
|
||||
|
||||
|
||||
PendingCommand *pend = client->prepareSessionCommand(cmd);
|
||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(banUser_processUserInfoResponse(Response)));
|
||||
|
||||
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
||||
|
||||
delete menu;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,18 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
|
|||
realNameLabel2.setText(QString::fromStdString(user.real_name()));
|
||||
genderLabel2.setPixmap(GenderPixmapGenerator::generatePixmap(15, user.gender()));
|
||||
QString country = QString::fromStdString(user.country());
|
||||
countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country));
|
||||
countryLabel3.setText(QString("(%1)").arg(country.toUpper()));
|
||||
|
||||
if (country.length() != 0)
|
||||
{
|
||||
countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country));
|
||||
countryLabel3.setText(QString("(%1)").arg(country.toUpper()));
|
||||
}
|
||||
else
|
||||
{
|
||||
countryLabel2.setText("");
|
||||
countryLabel3.setText("");
|
||||
}
|
||||
|
||||
userLevelLabel2.setPixmap(UserLevelPixmapGenerator::generatePixmap(15, userLevel, false));
|
||||
QString userLevelText;
|
||||
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue