Added a UI option to always play nonlands onto the stack

Previously this behavior only occured for instants and sorceries

Woops, missed a file

Missed some parentheses
This commit is contained in:
skoh-fley 2013-04-16 20:41:28 -07:00
parent 1accaffb70
commit 2727781c0e
5 changed files with 18 additions and 1 deletions

View file

@ -435,8 +435,13 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
doubleClickToPlayCheckBox->setChecked(settingsCache->getDoubleClickToPlay());
connect(doubleClickToPlayCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setDoubleClickToPlay(int)));
playToStackCheckBox = new QCheckBox;
playToStackCheckBox->setChecked(settingsCache->getPlayToStack());
connect(playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
QGridLayout *generalGrid = new QGridLayout;
generalGrid->addWidget(doubleClickToPlayCheckBox, 0, 0);
generalGrid->addWidget(playToStackCheckBox, 1, 0);
generalGroupBox = new QGroupBox;
generalGroupBox->setLayout(generalGrid);
@ -485,6 +490,7 @@ void UserInterfaceSettingsPage::retranslateUi()
{
generalGroupBox->setTitle(tr("General interface settings"));
doubleClickToPlayCheckBox->setText(tr("&Double-click cards to play them (instead of single-click)"));
playToStackCheckBox->setText(tr("&Play all nonlands onto the stack (not the battlefield) by default"));
animationGroupBox->setTitle(tr("Animation settings"));
tapAnimationCheckBox->setText(tr("&Tap/untap animation"));
soundEnabledCheckBox->setText(tr("Enable &sounds"));

View file

@ -82,6 +82,7 @@ signals:
void soundPathChanged();
private:
QCheckBox *doubleClickToPlayCheckBox;
QCheckBox *playToStackCheckBox;
QCheckBox *tapAnimationCheckBox;
QCheckBox *soundEnabledCheckBox;
QLabel *soundPathLabel;

View file

@ -1513,7 +1513,7 @@ void Player::playCard(CardItem *c, bool faceDown, bool tapped)
cardToMove->set_card_id(c->getId());
CardInfo *ci = c->getInfo();
if (ci->getTableRow() == 3) {
if ((!settingsCache->getPlayToStack() && ci->getTableRow() == 3) || (settingsCache->getPlayToStack() && ci->getTableRow() != 0)) {
cmd.set_target_zone("stack");
cmd.set_x(0);
cmd.set_y(0);

View file

@ -22,6 +22,7 @@ SettingsCache::SettingsCache()
mainWindowGeometry = settings->value("interface/main_window_geometry").toByteArray();
picDownload = settings->value("personal/picturedownload", true).toBool();
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
playToStack = settings->value("interface/playtostack", false).toBool();
cardInfoMinimized = settings->value("interface/cardinfominimized", 0).toInt();
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
@ -129,6 +130,12 @@ void SettingsCache::setDoubleClickToPlay(int _doubleClickToPlay)
settings->setValue("interface/doubleclicktoplay", doubleClickToPlay);
}
void SettingsCache::setPlayToStack(int _playToStack)
{
playToStack = _playToStack;
settings->setValue("interface/playtostack", playToStack);
}
void SettingsCache::setCardInfoMinimized(int _cardInfoMinimized)
{
cardInfoMinimized = _cardInfoMinimized;

View file

@ -34,6 +34,7 @@ private:
QString handBgPath, stackBgPath, tableBgPath, playerBgPath, cardBackPicturePath;
bool picDownload;
bool doubleClickToPlay;
bool playToStack;
int cardInfoMinimized;
QByteArray tabGameSplitterSizes;
bool displayCardNames;
@ -62,6 +63,7 @@ public:
QString getCardBackPicturePath() const { return cardBackPicturePath; }
bool getPicDownload() const { return picDownload; }
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
bool getPlayToStack() const { return playToStack; }
int getCardInfoMinimized() const { return cardInfoMinimized; }
QByteArray getTabGameSplitterSizes() const { return tabGameSplitterSizes; }
bool getDisplayCardNames() const { return displayCardNames; }
@ -90,6 +92,7 @@ public slots:
void setCardBackPicturePath(const QString &_cardBackPicturePath);
void setPicDownload(int _picDownload);
void setDoubleClickToPlay(int _doubleClickToPlay);
void setPlayToStack(int _playToStack);
void setCardInfoMinimized(int _cardInfoMinimized);
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
void setDisplayCardNames(int _displayCardNames);