readjusted position of 'move to' menu in card context menu; fixed logMoveCard
This commit is contained in:
parent
64c3c0984e
commit
af8e498ab2
4 changed files with 24 additions and 18 deletions
|
@ -156,6 +156,12 @@ void CardItem::updateCardMenu()
|
||||||
if (revealedCard)
|
if (revealedCard)
|
||||||
cardMenu->addAction(aHide);
|
cardMenu->addAction(aHide);
|
||||||
else if (owner->getLocal()) {
|
else if (owner->getLocal()) {
|
||||||
|
moveMenu->clear();
|
||||||
|
moveMenu->addAction(aMoveToTopLibrary);
|
||||||
|
moveMenu->addAction(aMoveToBottomLibrary);
|
||||||
|
moveMenu->addAction(aMoveToGraveyard);
|
||||||
|
moveMenu->addAction(aMoveToExile);
|
||||||
|
|
||||||
if (zone) {
|
if (zone) {
|
||||||
if (zone->getName() == "table") {
|
if (zone->getName() == "table") {
|
||||||
cardMenu->addAction(aTap);
|
cardMenu->addAction(aTap);
|
||||||
|
@ -171,6 +177,7 @@ void CardItem::updateCardMenu()
|
||||||
cardMenu->addAction(aSetAnnotation);
|
cardMenu->addAction(aSetAnnotation);
|
||||||
cardMenu->addSeparator();
|
cardMenu->addSeparator();
|
||||||
cardMenu->addAction(aClone);
|
cardMenu->addAction(aClone);
|
||||||
|
cardMenu->addMenu(moveMenu);
|
||||||
|
|
||||||
for (int i = 0; i < aAddCounter.size(); ++i) {
|
for (int i = 0; i < aAddCounter.size(); ++i) {
|
||||||
cardMenu->addSeparator();
|
cardMenu->addSeparator();
|
||||||
|
@ -181,15 +188,10 @@ void CardItem::updateCardMenu()
|
||||||
cardMenu->addSeparator();
|
cardMenu->addSeparator();
|
||||||
} else {
|
} else {
|
||||||
cardMenu->addAction(aPlay);
|
cardMenu->addAction(aPlay);
|
||||||
|
cardMenu->addMenu(moveMenu);
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
cardMenu->addMenu(moveMenu);
|
||||||
moveMenu->clear();
|
|
||||||
moveMenu->addAction(aMoveToTopLibrary);
|
|
||||||
moveMenu->addAction(aMoveToBottomLibrary);
|
|
||||||
moveMenu->addAction(aMoveToGraveyard);
|
|
||||||
moveMenu->addAction(aMoveToExile);
|
|
||||||
cardMenu->addMenu(moveMenu);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,12 @@ DlgCreateGame::DlgCreateGame(AbstractClient *_client, int _roomId, const QMap<in
|
||||||
maxPlayersEdit->setValue(2);
|
maxPlayersEdit->setValue(2);
|
||||||
maxPlayersLabel->setBuddy(maxPlayersEdit);
|
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;
|
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
||||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||||
while (gameTypeIterator.hasNext()) {
|
while (gameTypeIterator.hasNext()) {
|
||||||
|
@ -67,13 +73,10 @@ DlgCreateGame::DlgCreateGame(AbstractClient *_client, int _roomId, const QMap<in
|
||||||
spectatorsGroupBox->setLayout(spectatorsLayout);
|
spectatorsGroupBox->setLayout(spectatorsLayout);
|
||||||
|
|
||||||
QGridLayout *grid = new QGridLayout;
|
QGridLayout *grid = new QGridLayout;
|
||||||
grid->addWidget(descriptionLabel, 0, 0);
|
grid->addLayout(generalGrid, 0, 0);
|
||||||
grid->addWidget(descriptionEdit, 0, 1);
|
grid->addWidget(spectatorsGroupBox, 1, 0);
|
||||||
grid->addWidget(maxPlayersLabel, 1, 0);
|
grid->addWidget(joinRestrictionsGroupBox, 0, 1);
|
||||||
grid->addWidget(maxPlayersEdit, 1, 1);
|
grid->addWidget(gameTypeGroupBox, 1, 1);
|
||||||
grid->addWidget(gameTypeGroupBox, 2, 0, 1, 2);
|
|
||||||
grid->addWidget(joinRestrictionsGroupBox, 3, 0, 1, 2);
|
|
||||||
grid->addWidget(spectatorsGroupBox, 4, 0, 1, 2);
|
|
||||||
|
|
||||||
okButton = new QPushButton(tr("&OK"));
|
okButton = new QPushButton(tr("&OK"));
|
||||||
okButton->setDefault(true);
|
okButton->setDefault(true);
|
||||||
|
|
|
@ -189,7 +189,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
|
||||||
QString targetName = attributes.targetZone->getName();
|
QString targetName = attributes.targetZone->getName();
|
||||||
if (((startName == "table") && (targetName == "table") && (attributes.startZone == attributes.targetZone)) || ((startName == "hand") && (targetName == "hand")))
|
if (((startName == "table") && (targetName == "table") && (attributes.startZone == attributes.targetZone)) || ((startName == "hand") && (targetName == "hand")))
|
||||||
return;
|
return;
|
||||||
QString cardName = attributes.card->getName();
|
QString cardName = attributes.cardName;
|
||||||
QPair<QString, QString> temp = getFromStr(attributes.startZone, cardName, attributes.oldX);
|
QPair<QString, QString> temp = getFromStr(attributes.startZone, cardName, attributes.oldX);
|
||||||
bool cardNameContainsStartZone = false;
|
bool cardNameContainsStartZone = false;
|
||||||
if (!temp.first.isEmpty()) {
|
if (!temp.first.isEmpty()) {
|
||||||
|
@ -225,7 +225,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
|
||||||
else if (targetName == "deck") {
|
else if (targetName == "deck") {
|
||||||
if (attributes.newX == -1)
|
if (attributes.newX == -1)
|
||||||
finalStr = tr("%1 puts %2%3 into his library.");
|
finalStr = tr("%1 puts %2%3 into his library.");
|
||||||
else if (attributes.newX == attributes.targetZone->getCards().size())
|
else if (attributes.newX == attributes.targetZone->getCards().size() - 1)
|
||||||
finalStr = tr("%1 puts %2%3 on bottom of his library.");
|
finalStr = tr("%1 puts %2%3 on bottom of his library.");
|
||||||
else if (attributes.newX == 0)
|
else if (attributes.newX == 0)
|
||||||
finalStr = tr("%1 puts %2%3 on top of his library.");
|
finalStr = tr("%1 puts %2%3 on top of his library.");
|
||||||
|
@ -241,7 +241,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
|
||||||
|
|
||||||
void MessageLogWidget::logMoveCard(Player *player, CardItem *card, CardZone *startZone, int oldX, CardZone *targetZone, int newX)
|
void MessageLogWidget::logMoveCard(Player *player, CardItem *card, CardZone *startZone, int oldX, CardZone *targetZone, int newX)
|
||||||
{
|
{
|
||||||
LogMoveCard attributes = {player, card, startZone, oldX, targetZone, newX};
|
LogMoveCard attributes = {player, card, card->getName(), startZone, oldX, targetZone, newX};
|
||||||
if (currentContext == MessageContext_MoveCard)
|
if (currentContext == MessageContext_MoveCard)
|
||||||
moveCardQueue.append(attributes);
|
moveCardQueue.append(attributes);
|
||||||
else
|
else
|
||||||
|
|
|
@ -17,6 +17,7 @@ class CardItem;
|
||||||
struct LogMoveCard {
|
struct LogMoveCard {
|
||||||
Player *player;
|
Player *player;
|
||||||
CardItem *card;
|
CardItem *card;
|
||||||
|
QString cardName;
|
||||||
CardZone *startZone;
|
CardZone *startZone;
|
||||||
int oldX;
|
int oldX;
|
||||||
CardZone *targetZone;
|
CardZone *targetZone;
|
||||||
|
|
Loading…
Reference in a new issue