Sending card name to chat on shift+click (#3106)

This commit is contained in:
Vafthrudnir 2018-02-13 08:50:37 +01:00 committed by Zach H
parent 8084ab605f
commit 11ad677fe8
5 changed files with 16 additions and 3 deletions

View file

@ -271,7 +271,9 @@ void AbstractCardItem::setFaceDown(bool _facedown)
void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event) void AbstractCardItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
if ((event->modifiers() & Qt::ControlModifier)) { if ((event->modifiers() & Qt::AltModifier) && event->button() == Qt::LeftButton) {
emit cardShiftClicked(name);
} else if ((event->modifiers() & Qt::ControlModifier)) {
setSelected(!isSelected()); setSelected(!isSelected());
} else if (!isSelected()) { } else if (!isSelected()) {
scene()->clearSelection(); scene()->clearSelection();

View file

@ -38,6 +38,7 @@ signals:
void deleteCardInfoPopup(QString cardName); void deleteCardInfoPopup(QString cardName);
void updateCardMenu(AbstractCardItem *card); void updateCardMenu(AbstractCardItem *card);
void sigPixmapUpdated(); void sigPixmapUpdated();
void cardShiftClicked(QString cardName);
public: public:
enum enum

View file

@ -368,7 +368,8 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
owner->updateCardMenu(this); owner->updateCardMenu(this);
cardMenu->exec(event->screenPos()); cardMenu->exec(event->screenPos());
} }
} else if ((event->button() == Qt::LeftButton) && !settingsCache->getDoubleClickToPlay()) { } else if ((event->modifiers() != Qt::AltModifier) && (event->button() == Qt::LeftButton) &&
(!settingsCache->getDoubleClickToPlay())) {
bool hideCard = false; bool hideCard = false;
if (zone && zone->getIsView()) { if (zone && zone->getIsView()) {
ZoneViewZone *view = static_cast<ZoneViewZone *>(zone); ZoneViewZone *view = static_cast<ZoneViewZone *>(zone);
@ -388,7 +389,8 @@ void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{ {
if (settingsCache->getDoubleClickToPlay() && event->buttons() == Qt::LeftButton) { if ((event->modifiers() != Qt::AltModifier) && (settingsCache->getDoubleClickToPlay()) &&
(event->buttons() == Qt::LeftButton)) {
if (revealedCard) if (revealedCard)
zone->removeCard(this); zone->removeCard(this);
else else

View file

@ -431,6 +431,12 @@ void TabGame::addMentionTag(QString value)
sayEdit->setFocus(); sayEdit->setFocus();
} }
void TabGame::linkCardToChat(QString cardName)
{
sayEdit->insert("[[" + cardName + "]] ");
sayEdit->setFocus();
}
void TabGame::emitUserEvent() void TabGame::emitUserEvent()
{ {
bool globalEvent = !spectator || settingsCache->getSpectatorNotificationsEnabled(); bool globalEvent = !spectator || settingsCache->getSpectatorNotificationsEnabled();
@ -1224,6 +1230,7 @@ void TabGame::newCardAdded(AbstractCardItem *card)
connect(card, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString))); connect(card, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString))); connect(card, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
connect(card, SIGNAL(updateCardMenu(AbstractCardItem *)), this, SLOT(updateCardMenu(AbstractCardItem *))); connect(card, SIGNAL(updateCardMenu(AbstractCardItem *)), this, SLOT(updateCardMenu(AbstractCardItem *)));
connect(card, SIGNAL(cardShiftClicked(QString)), this, SLOT(linkCardToChat(QString)));
} }
CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) const CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) const

View file

@ -236,6 +236,7 @@ private slots:
void actNextTurn(); void actNextTurn();
void addMentionTag(QString value); void addMentionTag(QString value);
void linkCardToChat(QString cardName);
void commandFinished(const Response &response); void commandFinished(const Response &response);
void refreshShortcuts(); void refreshShortcuts();