diff --git a/cockatrice/src/dlg_create_token.cpp b/cockatrice/src/dlg_create_token.cpp index ff852c48..8210d950 100644 --- a/cockatrice/src/dlg_create_token.cpp +++ b/cockatrice/src/dlg_create_token.cpp @@ -10,10 +10,12 @@ #include #include #include + #include "decklist.h" #include "dlg_create_token.h" #include "carddatabasemodel.h" #include "main.h" +#include "settingscache.h" DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent) : QDialog(parent), predefinedTokens(_predefinedTokens) @@ -136,7 +138,8 @@ void DlgCreateToken::tokenSelectionChanged(const QModelIndex ¤t, const QMo const QString cardColor = cardInfo->getColors().isEmpty() ? QString() : (cardInfo->getColors().size() > 1 ? QString("m") : cardInfo->getColors().first()); colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString)); ptEdit->setText(cardInfo->getPowTough()); - annotationEdit->setText(cardInfo->getText()); + if(settingsCache->getAnnotateTokens()) + annotationEdit->setText(cardInfo->getText()); } void DlgCreateToken::actChooseTokenFromAll(bool checked) diff --git a/cockatrice/src/dlg_settings.cpp b/cockatrice/src/dlg_settings.cpp index dc7bcdc7..86a0fd4a 100644 --- a/cockatrice/src/dlg_settings.cpp +++ b/cockatrice/src/dlg_settings.cpp @@ -482,12 +482,16 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage() playToStackCheckBox.setChecked(settingsCache->getPlayToStack()); connect(&playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int))); - + + annotateTokensCheckBox.setChecked(settingsCache->getAnnotateTokens()); + connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setAnnotateTokens(int))); + QGridLayout *generalGrid = new QGridLayout; generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0); generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0); generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0); generalGrid->addWidget(&playToStackCheckBox, 3, 0); + generalGrid->addWidget(&annotateTokensCheckBox, 4, 0); generalGroupBox = new QGroupBox; generalGroupBox->setLayout(generalGrid); @@ -519,6 +523,7 @@ void UserInterfaceSettingsPage::retranslateUi() specNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar for game events while you are spectating")); 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")); + annotateTokensCheckBox.setText(tr("Annotate card text on tokens")); animationGroupBox->setTitle(tr("Animation settings")); tapAnimationCheckBox.setText(tr("&Tap/untap animation")); } diff --git a/cockatrice/src/dlg_settings.h b/cockatrice/src/dlg_settings.h index 002d40b1..5b2f06e5 100644 --- a/cockatrice/src/dlg_settings.h +++ b/cockatrice/src/dlg_settings.h @@ -127,6 +127,7 @@ private: QCheckBox specNotificationsEnabledCheckBox; QCheckBox doubleClickToPlayCheckBox; QCheckBox playToStackCheckBox; + QCheckBox annotateTokensCheckBox; QCheckBox tapAnimationCheckBox; QGroupBox *generalGroupBox; QGroupBox *animationGroupBox; diff --git a/cockatrice/src/player.cpp b/cockatrice/src/player.cpp index 3a1d49ab..53261019 100644 --- a/cockatrice/src/player.cpp +++ b/cockatrice/src/player.cpp @@ -1075,7 +1075,7 @@ void Player::actCreatePredefinedToken() lastTokenName = cardInfo->getName(); lastTokenColor = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().first().toLower(); lastTokenPT = cardInfo->getPowTough(); - lastTokenAnnotation = cardInfo->getText(); + lastTokenAnnotation = settingsCache->getAnnotateTokens() ? cardInfo->getText() : ""; lastTokenTableRow = table->clampValidTableRow(2 - cardInfo->getTableRow()); lastTokenDestroy = true; aCreateAnotherToken->setEnabled(true); @@ -1100,6 +1100,7 @@ void Player::actCreateRelatedCard() cmd.set_card_name(cardInfo->getName().toStdString()); cmd.set_color(cardInfo->getColors().isEmpty() ? QString().toStdString() : cardInfo->getColors().first().toLower().toStdString()); cmd.set_pt(cardInfo->getPowTough().toStdString()); + cmd.set_annotation(settingsCache->getAnnotateTokens() ? cardInfo->getText().toStdString() : QString().toStdString()); cmd.set_destroy_on_zone_change(true); cmd.set_target_zone(sourceCard->getZone()->getName().toStdString()); cmd.set_target_card_id(sourceCard->getId()); diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 454e9c51..202a0356 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -46,6 +46,7 @@ SettingsCache::SettingsCache() spectatorNotificationsEnabled = settings->value("interface/specnotificationsenabled", false).toBool(); doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool(); playToStack = settings->value("interface/playtostack", false).toBool(); + annotateTokens = settings->value("interface/annotatetokens", false).toBool(); cardInfoMinimized = settings->value("interface/cardinfominimized", 0).toInt(); tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray(); displayCardNames = settings->value("cards/displaycardnames", true).toBool(); @@ -251,6 +252,12 @@ void SettingsCache::setPlayToStack(int _playToStack) settings->setValue("interface/playtostack", playToStack); } +void SettingsCache::setAnnotateTokens(int _annotateTokens) +{ + annotateTokens = _annotateTokens; + settings->setValue("interface/annotatetokens", annotateTokens); +} + void SettingsCache::setCardInfoMinimized(int _cardInfoMinimized) { cardInfoMinimized = _cardInfoMinimized; diff --git a/cockatrice/src/settingscache.h b/cockatrice/src/settingscache.h index fa6155a8..c838f74e 100644 --- a/cockatrice/src/settingscache.h +++ b/cockatrice/src/settingscache.h @@ -55,6 +55,7 @@ private: bool spectatorNotificationsEnabled; bool doubleClickToPlay; bool playToStack; + bool annotateTokens; int cardInfoMinimized; QByteArray tabGameSplitterSizes; bool displayCardNames; @@ -106,6 +107,7 @@ public: bool getDoubleClickToPlay() const { return doubleClickToPlay; } bool getPlayToStack() const { return playToStack; } + bool getAnnotateTokens() const { return annotateTokens; } int getCardInfoMinimized() const { return cardInfoMinimized; } QByteArray getTabGameSplitterSizes() const { return tabGameSplitterSizes; } bool getDisplayCardNames() const { return displayCardNames; } @@ -161,6 +163,7 @@ public slots: void setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled); void setDoubleClickToPlay(int _doubleClickToPlay); void setPlayToStack(int _playToStack); + void setAnnotateTokens(int _annotateTokens); void setCardInfoMinimized(int _cardInfoMinimized); void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes); void setDisplayCardNames(int _displayCardNames);