Show current counter value on "set counter" dialog (#3650)

* fix point 10 of issue #655

* clanfigyism
This commit is contained in:
ctrlaltca 2019-03-11 00:33:19 +01:00 committed by ebbit1q
parent 6f95556632
commit 2d8f01b2e9

View file

@ -2855,8 +2855,14 @@ void Player::actCardCounterTrigger()
case 11: { // set counter with dialog
bool ok;
dialogSemaphore = true;
int number =
QInputDialog::getInt(nullptr, tr("Set counters"), tr("Number:"), 0, 0, MAX_COUNTERS_ON_CARD, 1, &ok);
int oldValue = 0;
if (scene()->selectedItems().size() == 1) {
auto *card = static_cast<CardItem *>(scene()->selectedItems().first());
oldValue = card->getCounters().value(counterId, 0);
}
int number = QInputDialog::getInt(nullptr, tr("Set counters"), tr("Number:"), oldValue, 0,
MAX_COUNTERS_ON_CARD, 1, &ok);
dialogSemaphore = false;
if (clearCardsToDelete() || !ok) {
return;