readjusted position of 'move to' menu in card context menu; fixed logMoveCard

This commit is contained in:
Max-Wilhelm Bruker 2011-03-07 19:11:06 +01:00
parent 64c3c0984e
commit af8e498ab2
4 changed files with 24 additions and 18 deletions

View file

@ -156,6 +156,12 @@ void CardItem::updateCardMenu()
if (revealedCard)
cardMenu->addAction(aHide);
else if (owner->getLocal()) {
moveMenu->clear();
moveMenu->addAction(aMoveToTopLibrary);
moveMenu->addAction(aMoveToBottomLibrary);
moveMenu->addAction(aMoveToGraveyard);
moveMenu->addAction(aMoveToExile);
if (zone) {
if (zone->getName() == "table") {
cardMenu->addAction(aTap);
@ -171,6 +177,7 @@ void CardItem::updateCardMenu()
cardMenu->addAction(aSetAnnotation);
cardMenu->addSeparator();
cardMenu->addAction(aClone);
cardMenu->addMenu(moveMenu);
for (int i = 0; i < aAddCounter.size(); ++i) {
cardMenu->addSeparator();
@ -181,15 +188,10 @@ void CardItem::updateCardMenu()
cardMenu->addSeparator();
} else {
cardMenu->addAction(aPlay);
cardMenu->addMenu(moveMenu);
}
}
moveMenu->clear();
moveMenu->addAction(aMoveToTopLibrary);
moveMenu->addAction(aMoveToBottomLibrary);
moveMenu->addAction(aMoveToGraveyard);
moveMenu->addAction(aMoveToExile);
cardMenu->addMenu(moveMenu);
} else
cardMenu->addMenu(moveMenu);
}
}

View file

@ -25,6 +25,12 @@ DlgCreateGame::DlgCreateGame(AbstractClient *_client, int _roomId, const QMap<in
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()) {
@ -67,13 +73,10 @@ DlgCreateGame::DlgCreateGame(AbstractClient *_client, int _roomId, const QMap<in
spectatorsGroupBox->setLayout(spectatorsLayout);
QGridLayout *grid = new QGridLayout;
grid->addWidget(descriptionLabel, 0, 0);
grid->addWidget(descriptionEdit, 0, 1);
grid->addWidget(maxPlayersLabel, 1, 0);
grid->addWidget(maxPlayersEdit, 1, 1);
grid->addWidget(gameTypeGroupBox, 2, 0, 1, 2);
grid->addWidget(joinRestrictionsGroupBox, 3, 0, 1, 2);
grid->addWidget(spectatorsGroupBox, 4, 0, 1, 2);
grid->addLayout(generalGrid, 0, 0);
grid->addWidget(spectatorsGroupBox, 1, 0);
grid->addWidget(joinRestrictionsGroupBox, 0, 1);
grid->addWidget(gameTypeGroupBox, 1, 1);
okButton = new QPushButton(tr("&OK"));
okButton->setDefault(true);

View file

@ -189,7 +189,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
QString targetName = attributes.targetZone->getName();
if (((startName == "table") && (targetName == "table") && (attributes.startZone == attributes.targetZone)) || ((startName == "hand") && (targetName == "hand")))
return;
QString cardName = attributes.card->getName();
QString cardName = attributes.cardName;
QPair<QString, QString> temp = getFromStr(attributes.startZone, cardName, attributes.oldX);
bool cardNameContainsStartZone = false;
if (!temp.first.isEmpty()) {
@ -225,7 +225,7 @@ void MessageLogWidget::doMoveCard(LogMoveCard &attributes)
else if (targetName == "deck") {
if (attributes.newX == -1)
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.");
else if (attributes.newX == 0)
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)
{
LogMoveCard attributes = {player, card, startZone, oldX, targetZone, newX};
LogMoveCard attributes = {player, card, card->getName(), startZone, oldX, targetZone, newX};
if (currentContext == MessageContext_MoveCard)
moveCardQueue.append(attributes);
else

View file

@ -17,6 +17,7 @@ class CardItem;
struct LogMoveCard {
Player *player;
CardItem *card;
QString cardName;
CardZone *startZone;
int oldX;
CardZone *targetZone;