diff --git a/cockatrice/src/dlg_settings.cpp b/cockatrice/src/dlg_settings.cpp index 3406ac14..4aae3cda 100644 --- a/cockatrice/src/dlg_settings.cpp +++ b/cockatrice/src/dlg_settings.cpp @@ -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")); diff --git a/cockatrice/src/dlg_settings.h b/cockatrice/src/dlg_settings.h index b00f7ce1..8cf60e80 100644 --- a/cockatrice/src/dlg_settings.h +++ b/cockatrice/src/dlg_settings.h @@ -82,6 +82,7 @@ signals: void soundPathChanged(); private: QCheckBox *doubleClickToPlayCheckBox; + QCheckBox *playToStackCheckBox; QCheckBox *tapAnimationCheckBox; QCheckBox *soundEnabledCheckBox; QLabel *soundPathLabel; diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 70fa8a6e..976df9e7 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -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); diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 2337e11d..f2f6d5c1 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -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; diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index f07ca94b..7c70be2f 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -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);