mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 11:38:49 -07:00
Merge branch 'master' into jo-remove-name-filters-from-settings
This commit is contained in:
commit
763d8a7919
267 changed files with 28306 additions and 10990 deletions
|
|
@ -9,10 +9,8 @@
|
|||
#include "pixmapgenerator.h"
|
||||
#include "settingscache.h"
|
||||
#include "main.h"
|
||||
#include "userlist.h"
|
||||
#include "tab_userlists.h"
|
||||
|
||||
const QColor OTHER_USER_MENTION_COLOR = QColor(145, 210, 255); // light blue
|
||||
const QColor MENTION_COLOR = QColor(190, 25, 85); // maroon
|
||||
const QColor OTHER_USER_COLOR = QColor(0, 65, 255); // dark blue
|
||||
|
||||
|
|
@ -32,7 +30,6 @@ ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _sh
|
|||
|
||||
mentionFormatOtherUser.setFontWeight(QFont::Bold);
|
||||
mentionFormatOtherUser.setForeground(Qt::blue);
|
||||
mentionFormatOtherUser.setBackground(QBrush(OTHER_USER_MENTION_COLOR));
|
||||
mentionFormatOtherUser.setAnchor(true);
|
||||
|
||||
viewport()->setCursor(Qt::IBeamCursor);
|
||||
|
|
@ -190,8 +187,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
|||
|
||||
if (settingsCache->getChatMention()) {
|
||||
index = 0;
|
||||
from = 0;
|
||||
while((index = message.indexOf('@', from)) != -1) {
|
||||
while((index = message.indexOf('@')) != -1) {
|
||||
cursor.insertText(message.left(index), defaultFormat);
|
||||
message = message.mid(index);
|
||||
if (message.isEmpty())
|
||||
|
|
@ -209,24 +205,40 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
|
|||
QString userMention = message.left(mentionEndIndex);
|
||||
QString userName = userMention.right(userMention.size()-1).normalized(QString::NormalizationForm_D);
|
||||
QMap<QString, UserListTWI *> userList = tabSupervisor->getUserListsTab()->getAllUsersList()->getUsers();
|
||||
if (userList.contains(userName)) {
|
||||
UserListTWI *vlu = userList.value(userName);
|
||||
mentionFormatOtherUser.setAnchorHref("user://" + QString::number(vlu->getUserInfo().user_level()) + "_" + userName);
|
||||
cursor.insertText("@" + userName, mentionFormatOtherUser);
|
||||
QString correctUserName = getNameFromUserList(userList, userName);
|
||||
if (!correctUserName.isEmpty()) {
|
||||
UserListTWI *vlu = userList.value(correctUserName);
|
||||
mentionFormatOtherUser.setAnchorHref("user://" + QString::number(vlu->getUserInfo().user_level()) + "_" + correctUserName);
|
||||
cursor.insertText("@" + correctUserName, mentionFormatOtherUser);
|
||||
} else
|
||||
cursor.insertText("@" + userName, defaultFormat);
|
||||
message = message.mid(userName.size() + 1);
|
||||
}
|
||||
cursor.setCharFormat(defaultFormat); // reset format after each itteration
|
||||
}
|
||||
}
|
||||
|
||||
if (!message.isEmpty())
|
||||
cursor.insertText(message, defaultFormat);
|
||||
cursor.insertText(message);
|
||||
|
||||
if (atBottom)
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the correct case version of the provided username, if no correct casing version
|
||||
was found then the provided name is not available and will return an empty QString.
|
||||
*/
|
||||
QString ChatView::getNameFromUserList(QMap<QString, UserListTWI *> &userList, QString &userName) {
|
||||
QMap<QString, UserListTWI *>::iterator i;
|
||||
QString lowerUserName = userName.toLower();
|
||||
for (i = userList.begin(); i != userList.end(); ++i) {
|
||||
if (i.key().toLower() == lowerUserName)
|
||||
return i.key();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void ChatView::clearChat() {
|
||||
document()->clear();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <QTextFragment>
|
||||
#include <QTextCursor>
|
||||
#include <QColor>
|
||||
#include "userlist.h"
|
||||
#include "user_level.h"
|
||||
#include "tab_supervisor.h"
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ private:
|
|||
QTextCursor prepareBlock(bool same = false);
|
||||
void appendCardTag(QTextCursor &cursor, const QString &cardName);
|
||||
void appendUrlTag(QTextCursor &cursor, QString url);
|
||||
QString getNameFromUserList(QMap<QString, UserListTWI *> &userList, QString &userName);
|
||||
private slots:
|
||||
void openLink(const QUrl &link);
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ void GameScene::registerAnimationItem(AbstractCardItem *card)
|
|||
{
|
||||
cardsToAnimate.insert(static_cast<CardItem *>(card));
|
||||
if (!animationTimer->isActive())
|
||||
animationTimer->start(15, this);
|
||||
animationTimer->start(10, this);
|
||||
}
|
||||
|
||||
void GameScene::unregisterAnimationItem(AbstractCardItem *card)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
|
|||
case Qt::DisplayRole:
|
||||
return QString::fromStdString(g.description());
|
||||
case Qt::TextAlignmentRole:
|
||||
Qt::AlignLeft;
|
||||
return Qt::AlignLeft;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,14 +245,16 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
|
|||
|
||||
if (local) {
|
||||
handMenu = playerMenu->addMenu(QString());
|
||||
handMenu->addAction(aMulligan);
|
||||
handMenu->addAction(aMoveHandToTopLibrary);
|
||||
handMenu->addAction(aMoveHandToBottomLibrary);
|
||||
handMenu->addAction(aMoveHandToGrave);
|
||||
handMenu->addAction(aMoveHandToRfg);
|
||||
handMenu->addSeparator();
|
||||
playerLists.append(mRevealHand = handMenu->addMenu(QString()));
|
||||
playerLists.append(mRevealRandomHandCard = handMenu->addMenu(QString()));
|
||||
handMenu->addSeparator();
|
||||
handMenu->addAction(aMulligan);
|
||||
handMenu->addSeparator();
|
||||
moveHandMenu = handMenu->addMenu(QString());
|
||||
moveHandMenu->addAction(aMoveHandToTopLibrary);
|
||||
moveHandMenu->addAction(aMoveHandToBottomLibrary);
|
||||
moveHandMenu->addAction(aMoveHandToGrave);
|
||||
moveHandMenu->addAction(aMoveHandToRfg);
|
||||
hand->setMenu(handMenu);
|
||||
|
||||
libraryMenu = playerMenu->addMenu(QString());
|
||||
|
|
@ -268,12 +270,13 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
|
|||
playerLists.append(mRevealLibrary = libraryMenu->addMenu(QString()));
|
||||
playerLists.append(mRevealTopCard = libraryMenu->addMenu(QString()));
|
||||
libraryMenu->addAction(aAlwaysRevealTopCard);
|
||||
libraryMenu->addAction(aOpenDeckInDeckEditor);
|
||||
libraryMenu->addSeparator();
|
||||
libraryMenu->addAction(aMoveTopCardsToGrave);
|
||||
libraryMenu->addAction(aMoveTopCardsToExile);
|
||||
libraryMenu->addAction(aMoveTopCardToBottom);
|
||||
libraryMenu->addAction(aMoveBottomCardToGrave);
|
||||
libraryMenu->addSeparator();
|
||||
libraryMenu->addAction(aOpenDeckInDeckEditor);
|
||||
deck->setMenu(libraryMenu, aDrawCard);
|
||||
} else {
|
||||
handMenu = 0;
|
||||
|
|
@ -290,16 +293,18 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
|
|||
|
||||
if (local) {
|
||||
graveMenu->addSeparator();
|
||||
graveMenu->addAction(aMoveGraveToTopLibrary);
|
||||
graveMenu->addAction(aMoveGraveToBottomLibrary);
|
||||
graveMenu->addAction(aMoveGraveToHand);
|
||||
graveMenu->addAction(aMoveGraveToRfg);
|
||||
moveGraveMenu = graveMenu->addMenu(QString());
|
||||
moveGraveMenu->addAction(aMoveGraveToTopLibrary);
|
||||
moveGraveMenu->addAction(aMoveGraveToBottomLibrary);
|
||||
moveGraveMenu->addAction(aMoveGraveToHand);
|
||||
moveGraveMenu->addAction(aMoveGraveToRfg);
|
||||
|
||||
rfgMenu->addSeparator();
|
||||
rfgMenu->addAction(aMoveRfgToTopLibrary);
|
||||
rfgMenu->addAction(aMoveRfgToBottomLibrary);
|
||||
rfgMenu->addAction(aMoveRfgToHand);
|
||||
rfgMenu->addAction(aMoveRfgToGrave);
|
||||
moveRfgMenu = rfgMenu->addMenu(QString());
|
||||
moveRfgMenu->addAction(aMoveRfgToTopLibrary);
|
||||
moveRfgMenu->addAction(aMoveRfgToBottomLibrary);
|
||||
moveRfgMenu->addAction(aMoveRfgToHand);
|
||||
moveRfgMenu->addAction(aMoveRfgToGrave);
|
||||
|
||||
sbMenu = playerMenu->addMenu(QString());
|
||||
sbMenu->addAction(aViewSideboard);
|
||||
|
|
@ -585,22 +590,28 @@ void Player::retranslateUi()
|
|||
rfgMenu->setTitle(tr("&Exile"));
|
||||
|
||||
if (local) {
|
||||
aMoveHandToTopLibrary->setText(tr("Move to &top of library"));
|
||||
aMoveHandToBottomLibrary->setText(tr("Move to &bottom of library"));
|
||||
aMoveHandToGrave->setText(tr("Move to &graveyard"));
|
||||
aMoveHandToRfg->setText(tr("Move to &exile"));
|
||||
aMoveGraveToTopLibrary->setText(tr("Move to &top of library"));
|
||||
aMoveGraveToBottomLibrary->setText(tr("Move to &bottom of library"));
|
||||
aMoveGraveToHand->setText(tr("Move to &hand"));
|
||||
aMoveGraveToRfg->setText(tr("Move to &exile"));
|
||||
aMoveRfgToTopLibrary->setText(tr("Move to &top of library"));
|
||||
aMoveRfgToBottomLibrary->setText(tr("Move to &bottom of library"));
|
||||
aMoveRfgToHand->setText(tr("Move to &hand"));
|
||||
aMoveRfgToGrave->setText(tr("Move to &graveyard"));
|
||||
moveHandMenu->setTitle(tr("&Move hand to..."));
|
||||
aMoveHandToTopLibrary->setText(tr("&Top of library"));
|
||||
aMoveHandToBottomLibrary->setText(tr("&Bottom of library"));
|
||||
aMoveHandToGrave->setText(tr("&Graveyard"));
|
||||
aMoveHandToRfg->setText(tr("&Exile"));
|
||||
|
||||
moveGraveMenu->setTitle(tr("&Move graveyard to..."));
|
||||
aMoveGraveToTopLibrary->setText(tr("&Top of library"));
|
||||
aMoveGraveToBottomLibrary->setText(tr("&Bottom of library"));
|
||||
aMoveGraveToHand->setText(tr("&Hand"));
|
||||
aMoveGraveToRfg->setText(tr("&Exile"));
|
||||
|
||||
moveRfgMenu->setTitle(tr("&Move exile to..."));
|
||||
aMoveRfgToTopLibrary->setText(tr("&Top of library"));
|
||||
aMoveRfgToBottomLibrary->setText(tr("&Bottom of library"));
|
||||
aMoveRfgToHand->setText(tr("&Hand"));
|
||||
aMoveRfgToGrave->setText(tr("&Graveyard"));
|
||||
|
||||
aViewLibrary->setText(tr("&View library"));
|
||||
aViewTopCards->setText(tr("View &top cards of library..."));
|
||||
mRevealLibrary->setTitle(tr("Reveal &library to"));
|
||||
mRevealTopCard->setTitle(tr("Reveal t&op card to"));
|
||||
mRevealLibrary->setTitle(tr("Reveal &library to..."));
|
||||
mRevealTopCard->setTitle(tr("Reveal t&op card to..."));
|
||||
aAlwaysRevealTopCard->setText(tr("&Always reveal top card"));
|
||||
aOpenDeckInDeckEditor->setText(tr("O&pen deck in deck editor"));
|
||||
aViewSideboard->setText(tr("&View sideboard"));
|
||||
|
|
@ -615,8 +626,8 @@ void Player::retranslateUi()
|
|||
aMoveBottomCardToGrave->setText(tr("Put bottom card &in graveyard"));
|
||||
|
||||
handMenu->setTitle(tr("&Hand"));
|
||||
mRevealHand->setTitle(tr("&Reveal to"));
|
||||
mRevealRandomHandCard->setTitle(tr("Reveal r&andom card to"));
|
||||
mRevealHand->setTitle(tr("&Reveal hand to..."));
|
||||
mRevealRandomHandCard->setTitle(tr("Reveal r&andom card to..."));
|
||||
sbMenu->setTitle(tr("&Sideboard"));
|
||||
libraryMenu->setTitle(tr("&Library"));
|
||||
countersMenu->setTitle(tr("&Counters"));
|
||||
|
|
@ -1900,12 +1911,16 @@ void Player::cardMenuAction()
|
|||
default: ;
|
||||
}
|
||||
}
|
||||
game->sendGameCommand(prepareGameCommand(commandList));
|
||||
if(local)
|
||||
sendGameCommand(prepareGameCommand(commandList));
|
||||
else
|
||||
game->sendGameCommand(prepareGameCommand(commandList));
|
||||
}
|
||||
|
||||
void Player::actIncPT(int deltaP, int deltaT)
|
||||
{
|
||||
QString ptString = "+" + QString::number(deltaP) + "/+" + QString::number(deltaT);
|
||||
int playerid = id;
|
||||
|
||||
QList< const ::google::protobuf::Message * > commandList;
|
||||
QListIterator<QGraphicsItem *> j(scene()->selectedItems());
|
||||
|
|
@ -1917,13 +1932,19 @@ void Player::actIncPT(int deltaP, int deltaT)
|
|||
cmd->set_attribute(AttrPT);
|
||||
cmd->set_attr_value(ptString.toStdString());
|
||||
commandList.append(cmd);
|
||||
|
||||
if(local)
|
||||
playerid=card->getZone()->getPlayer()->getId();
|
||||
}
|
||||
sendGameCommand(prepareGameCommand(commandList));
|
||||
|
||||
game->sendGameCommand(prepareGameCommand(commandList), playerid);
|
||||
}
|
||||
|
||||
void Player::actSetPT()
|
||||
{
|
||||
QString oldPT;
|
||||
int playerid = id;
|
||||
|
||||
QListIterator<QGraphicsItem *> i(scene()->selectedItems());
|
||||
while (i.hasNext()) {
|
||||
CardItem *card = static_cast<CardItem *>(i.next());
|
||||
|
|
@ -1949,8 +1970,12 @@ void Player::actSetPT()
|
|||
cmd->set_attribute(AttrPT);
|
||||
cmd->set_attr_value(pt.toStdString());
|
||||
commandList.append(cmd);
|
||||
|
||||
if(local)
|
||||
playerid=card->getZone()->getPlayer()->getId();
|
||||
}
|
||||
sendGameCommand(prepareGameCommand(commandList));
|
||||
|
||||
game->sendGameCommand(prepareGameCommand(commandList), playerid);
|
||||
}
|
||||
|
||||
void Player::actDrawArrow()
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ private slots:
|
|||
|
||||
private:
|
||||
TabGame *game;
|
||||
QMenu *playerMenu, *handMenu, *graveMenu, *rfgMenu, *libraryMenu, *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu,
|
||||
QMenu *playerMenu, *handMenu, *moveHandMenu, *graveMenu, *moveGraveMenu, *rfgMenu, *moveRfgMenu, *libraryMenu, *sbMenu, *countersMenu, *sayMenu, *createPredefinedTokenMenu,
|
||||
*mRevealLibrary, *mRevealTopCard, *mRevealHand, *mRevealRandomHandCard;
|
||||
QList<QMenu *> playerLists;
|
||||
QList<QAction *> allPlayersActions;
|
||||
|
|
|
|||
|
|
@ -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,33 +60,32 @@ TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerI
|
|||
|
||||
aOpenChatSettings = chatSettingsMenu->addAction(QString());
|
||||
connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings()));
|
||||
|
||||
connect(settingsCache, SIGNAL(ignoreUnregisteredUsersChanged()), this, SLOT(ignoreUnregisteredUsersChanged()));
|
||||
|
||||
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()));
|
||||
|
||||
|
|
@ -96,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));
|
||||
|
|
@ -148,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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void TitleLabel::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||
}
|
||||
|
||||
ZoneViewWidget::ZoneViewWidget(Player *_player, CardZone *_origZone, int numberCards, bool _revealZone, bool _writeableRevealZone, const QList<const ServerInfo_Card *> &cardList)
|
||||
: QGraphicsWidget(0, Qt::Tool | Qt::FramelessWindowHint), player(_player)
|
||||
: QGraphicsWidget(0, Qt::Tool | Qt::FramelessWindowHint), player(_player), canBeShuffled(_origZone->getIsShufflable())
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
|
@ -227,7 +227,8 @@ void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
|||
}
|
||||
if (shuffleCheckBox.isChecked())
|
||||
player->sendGameCommand(Command_Shuffle());
|
||||
settingsCache->setZoneViewShuffle(shuffleCheckBox.isChecked());
|
||||
if (canBeShuffled)
|
||||
settingsCache->setZoneViewShuffle(shuffleCheckBox.isChecked());
|
||||
emit closePressed(this);
|
||||
deleteLater();
|
||||
event->accept();
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ private:
|
|||
QCheckBox shuffleCheckBox;
|
||||
QCheckBox pileViewCheckBox;
|
||||
|
||||
bool canBeShuffled;
|
||||
int extraHeight;
|
||||
Player *player;
|
||||
signals:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue