Fix release tests (#4063)

This commit is contained in:
olegshtch 2020-08-13 17:18:01 +03:00 committed by GitHub
parent 80f613a77a
commit 44297dcd1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 1114 additions and 697 deletions

View file

@ -101,8 +101,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
userInfo = new ServerInfo_User;
userInfo->CopyFrom(info);
connect(settingsCache, SIGNAL(horizontalHandChanged()), this, SLOT(rearrangeZones()));
connect(settingsCache, SIGNAL(handJustificationChanged()), this, SLOT(rearrangeZones()));
connect(&SettingsCache::instance(), SIGNAL(horizontalHandChanged()), this, SLOT(rearrangeZones()));
connect(&SettingsCache::instance(), SIGNAL(handJustificationChanged()), this, SLOT(rearrangeZones()));
playerArea = new PlayerArea(this);
@ -483,7 +483,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
rearrangeZones();
retranslateUi();
connect(&settingsCache->shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
connect(&SettingsCache::instance().shortcuts(), SIGNAL(shortCutChanged()), this, SLOT(refreshShortcuts()));
refreshShortcuts();
}
@ -585,7 +585,7 @@ void Player::playerListActionTriggered()
void Player::rearrangeZones()
{
QPointF base = QPointF(CARD_HEIGHT + counterAreaWidth + 15, 0);
if (settingsCache->getHorizontalHand()) {
if (SettingsCache::instance().getHorizontalHand()) {
if (mirrored) {
if (hand->contentsKnown()) {
handVisible = true;
@ -638,7 +638,7 @@ void Player::updateBoundingRect()
{
prepareGeometryChange();
qreal width = CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
if (settingsCache->getHorizontalHand()) {
if (SettingsCache::instance().getHorizontalHand()) {
qreal handHeight = handVisible ? hand->boundingRect().height() : 0;
bRect = QRectF(0, 0, width + table->boundingRect().width(), table->boundingRect().height() + handHeight);
} else {
@ -788,7 +788,7 @@ void Player::retranslateUi()
void Player::setShortcutsActive()
{
shortcutsActive = true;
ShortcutsSettings &shortcuts = settingsCache->shortcuts();
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
aPlay->setShortcuts(shortcuts.getShortcut("Player/aPlay"));
aTap->setShortcuts(shortcuts.getShortcut("Player/aTap"));
@ -909,10 +909,10 @@ void Player::initSayMenu()
{
sayMenu->clear();
int count = settingsCache->messages().getCount();
int count = SettingsCache::instance().messages().getCount();
for (int i = 0; i < count; ++i) {
auto *newAction = new QAction(settingsCache->messages().getMessageAt(i), this);
auto *newAction = new QAction(SettingsCache::instance().messages().getMessageAt(i), this);
if (i <= 10) {
newAction->setShortcut(QKeySequence("Ctrl+" + QString::number((i + 1) % 10)));
}
@ -1019,7 +1019,7 @@ void Player::actDrawCard()
void Player::actMulligan()
{
int startSize = settingsCache->getStartingHandSize();
int startSize = SettingsCache::instance().getStartingHandSize();
int handSize = zones.value("hand")->getCards().size();
int deckSize = zones.value("deck")->getCards().size() + handSize;
bool ok;
@ -1040,7 +1040,7 @@ void Player::actMulligan()
}
sendGameCommand(cmd);
if (startSize != number) {
settingsCache->setStartingHandSize(number);
SettingsCache::instance().setStartingHandSize(number);
}
}
@ -1439,7 +1439,7 @@ void Player::createCard(const CardItem *sourceCard, const QString &dbCardName, b
}
cmd.set_pt(cardInfo->getPowTough().toStdString());
if (settingsCache->getAnnotateTokens()) {
if (SettingsCache::instance().getAnnotateTokens()) {
cmd.set_annotation(cardInfo->getText().toStdString());
} else {
cmd.set_annotation("");
@ -2140,7 +2140,7 @@ void Player::playCard(CardItem *card, bool faceDown, bool tapped)
}
int tableRow = info->getTableRow();
bool playToStack = settingsCache->getPlayToStack();
bool playToStack = SettingsCache::instance().getPlayToStack();
QString currentZone = card->getZone()->getName();
if (currentZone == "stack" && tableRow == 3) {
cmd.set_target_zone("grave");
@ -3209,7 +3209,7 @@ void Player::addRelatedCardActions(const CardItem *card, QMenu *cardMenu)
if (createRelatedCards) {
if (shortcutsActive) {
createRelatedCards->setShortcut(
settingsCache->shortcuts().getSingleShortcut("Player/aCreateRelatedTokens"));
SettingsCache::instance().shortcuts().getSingleShortcut("Player/aCreateRelatedTokens"));
}
connect(createRelatedCards, SIGNAL(triggered()), this, SLOT(actCreateAllRelatedCards()));
cardMenu->addAction(createRelatedCards);
@ -3239,7 +3239,7 @@ QString Player::getName() const
qreal Player::getMinimumWidth() const
{
qreal result = table->getMinimumWidth() + CARD_HEIGHT + 15 + counterAreaWidth + stack->boundingRect().width();
if (!settingsCache->getHorizontalHand()) {
if (!SettingsCache::instance().getHorizontalHand()) {
result += hand->boundingRect().width();
}
return result;
@ -3275,7 +3275,7 @@ void Player::processSceneSizeChange(int newPlayerWidth)
{
// Extend table (and hand, if horizontal) to accommodate the new player width.
qreal tableWidth = newPlayerWidth - CARD_HEIGHT - 15 - counterAreaWidth - stack->boundingRect().width();
if (!settingsCache->getHorizontalHand()) {
if (!SettingsCache::instance().getHorizontalHand()) {
tableWidth -= hand->boundingRect().width();
}
@ -3292,7 +3292,7 @@ void Player::setLastToken(CardInfoPtr cardInfo)
lastTokenName = cardInfo->getName();
lastTokenColor = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().left(1).toLower();
lastTokenPT = cardInfo->getPowTough();
lastTokenAnnotation = settingsCache->getAnnotateTokens() ? cardInfo->getText() : "";
lastTokenAnnotation = SettingsCache::instance().getAnnotateTokens() ? cardInfo->getText() : "";
lastTokenTableRow = TableZone::clampValidTableRow(2 - cardInfo->getTableRow());
lastTokenDestroy = true;
aCreateAnotherToken->setText(tr("C&reate another %1 token").arg(lastTokenName));