Add an option to annotate tokens from card text (default off); fix #241
This commit is contained in:
parent
685aa99ad6
commit
68e176cc00
6 changed files with 23 additions and 3 deletions
|
@ -10,10 +10,12 @@
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
#include "decklist.h"
|
#include "decklist.h"
|
||||||
#include "dlg_create_token.h"
|
#include "dlg_create_token.h"
|
||||||
#include "carddatabasemodel.h"
|
#include "carddatabasemodel.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
#include "settingscache.h"
|
||||||
|
|
||||||
DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent)
|
DlgCreateToken::DlgCreateToken(const QStringList &_predefinedTokens, QWidget *parent)
|
||||||
: QDialog(parent), predefinedTokens(_predefinedTokens)
|
: 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());
|
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));
|
colorEdit->setCurrentIndex(colorEdit->findData(cardColor, Qt::UserRole, Qt::MatchFixedString));
|
||||||
ptEdit->setText(cardInfo->getPowTough());
|
ptEdit->setText(cardInfo->getPowTough());
|
||||||
annotationEdit->setText(cardInfo->getText());
|
if(settingsCache->getAnnotateTokens())
|
||||||
|
annotationEdit->setText(cardInfo->getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DlgCreateToken::actChooseTokenFromAll(bool checked)
|
void DlgCreateToken::actChooseTokenFromAll(bool checked)
|
||||||
|
|
|
@ -482,12 +482,16 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
|
|
||||||
playToStackCheckBox.setChecked(settingsCache->getPlayToStack());
|
playToStackCheckBox.setChecked(settingsCache->getPlayToStack());
|
||||||
connect(&playToStackCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setPlayToStack(int)));
|
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;
|
QGridLayout *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
||||||
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
||||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
||||||
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
||||||
|
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
|
||||||
|
|
||||||
generalGroupBox = new QGroupBox;
|
generalGroupBox = new QGroupBox;
|
||||||
generalGroupBox->setLayout(generalGrid);
|
generalGroupBox->setLayout(generalGrid);
|
||||||
|
@ -519,6 +523,7 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||||
specNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar for game events while you are spectating"));
|
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)"));
|
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"));
|
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"));
|
animationGroupBox->setTitle(tr("Animation settings"));
|
||||||
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,7 @@ private:
|
||||||
QCheckBox specNotificationsEnabledCheckBox;
|
QCheckBox specNotificationsEnabledCheckBox;
|
||||||
QCheckBox doubleClickToPlayCheckBox;
|
QCheckBox doubleClickToPlayCheckBox;
|
||||||
QCheckBox playToStackCheckBox;
|
QCheckBox playToStackCheckBox;
|
||||||
|
QCheckBox annotateTokensCheckBox;
|
||||||
QCheckBox tapAnimationCheckBox;
|
QCheckBox tapAnimationCheckBox;
|
||||||
QGroupBox *generalGroupBox;
|
QGroupBox *generalGroupBox;
|
||||||
QGroupBox *animationGroupBox;
|
QGroupBox *animationGroupBox;
|
||||||
|
|
|
@ -1075,7 +1075,7 @@ void Player::actCreatePredefinedToken()
|
||||||
lastTokenName = cardInfo->getName();
|
lastTokenName = cardInfo->getName();
|
||||||
lastTokenColor = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().first().toLower();
|
lastTokenColor = cardInfo->getColors().isEmpty() ? QString() : cardInfo->getColors().first().toLower();
|
||||||
lastTokenPT = cardInfo->getPowTough();
|
lastTokenPT = cardInfo->getPowTough();
|
||||||
lastTokenAnnotation = cardInfo->getText();
|
lastTokenAnnotation = settingsCache->getAnnotateTokens() ? cardInfo->getText() : "";
|
||||||
lastTokenTableRow = table->clampValidTableRow(2 - cardInfo->getTableRow());
|
lastTokenTableRow = table->clampValidTableRow(2 - cardInfo->getTableRow());
|
||||||
lastTokenDestroy = true;
|
lastTokenDestroy = true;
|
||||||
aCreateAnotherToken->setEnabled(true);
|
aCreateAnotherToken->setEnabled(true);
|
||||||
|
@ -1100,6 +1100,7 @@ void Player::actCreateRelatedCard()
|
||||||
cmd.set_card_name(cardInfo->getName().toStdString());
|
cmd.set_card_name(cardInfo->getName().toStdString());
|
||||||
cmd.set_color(cardInfo->getColors().isEmpty() ? QString().toStdString() : cardInfo->getColors().first().toLower().toStdString());
|
cmd.set_color(cardInfo->getColors().isEmpty() ? QString().toStdString() : cardInfo->getColors().first().toLower().toStdString());
|
||||||
cmd.set_pt(cardInfo->getPowTough().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_destroy_on_zone_change(true);
|
||||||
cmd.set_target_zone(sourceCard->getZone()->getName().toStdString());
|
cmd.set_target_zone(sourceCard->getZone()->getName().toStdString());
|
||||||
cmd.set_target_card_id(sourceCard->getId());
|
cmd.set_target_card_id(sourceCard->getId());
|
||||||
|
|
|
@ -46,6 +46,7 @@ SettingsCache::SettingsCache()
|
||||||
spectatorNotificationsEnabled = settings->value("interface/specnotificationsenabled", false).toBool();
|
spectatorNotificationsEnabled = settings->value("interface/specnotificationsenabled", false).toBool();
|
||||||
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
|
doubleClickToPlay = settings->value("interface/doubleclicktoplay", true).toBool();
|
||||||
playToStack = settings->value("interface/playtostack", false).toBool();
|
playToStack = settings->value("interface/playtostack", false).toBool();
|
||||||
|
annotateTokens = settings->value("interface/annotatetokens", false).toBool();
|
||||||
cardInfoMinimized = settings->value("interface/cardinfominimized", 0).toInt();
|
cardInfoMinimized = settings->value("interface/cardinfominimized", 0).toInt();
|
||||||
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
|
tabGameSplitterSizes = settings->value("interface/tabgame_splittersizes").toByteArray();
|
||||||
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
displayCardNames = settings->value("cards/displaycardnames", true).toBool();
|
||||||
|
@ -251,6 +252,12 @@ void SettingsCache::setPlayToStack(int _playToStack)
|
||||||
settings->setValue("interface/playtostack", playToStack);
|
settings->setValue("interface/playtostack", playToStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setAnnotateTokens(int _annotateTokens)
|
||||||
|
{
|
||||||
|
annotateTokens = _annotateTokens;
|
||||||
|
settings->setValue("interface/annotatetokens", annotateTokens);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setCardInfoMinimized(int _cardInfoMinimized)
|
void SettingsCache::setCardInfoMinimized(int _cardInfoMinimized)
|
||||||
{
|
{
|
||||||
cardInfoMinimized = _cardInfoMinimized;
|
cardInfoMinimized = _cardInfoMinimized;
|
||||||
|
|
|
@ -55,6 +55,7 @@ private:
|
||||||
bool spectatorNotificationsEnabled;
|
bool spectatorNotificationsEnabled;
|
||||||
bool doubleClickToPlay;
|
bool doubleClickToPlay;
|
||||||
bool playToStack;
|
bool playToStack;
|
||||||
|
bool annotateTokens;
|
||||||
int cardInfoMinimized;
|
int cardInfoMinimized;
|
||||||
QByteArray tabGameSplitterSizes;
|
QByteArray tabGameSplitterSizes;
|
||||||
bool displayCardNames;
|
bool displayCardNames;
|
||||||
|
@ -106,6 +107,7 @@ public:
|
||||||
|
|
||||||
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
|
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
|
||||||
bool getPlayToStack() const { return playToStack; }
|
bool getPlayToStack() const { return playToStack; }
|
||||||
|
bool getAnnotateTokens() const { return annotateTokens; }
|
||||||
int getCardInfoMinimized() const { return cardInfoMinimized; }
|
int getCardInfoMinimized() const { return cardInfoMinimized; }
|
||||||
QByteArray getTabGameSplitterSizes() const { return tabGameSplitterSizes; }
|
QByteArray getTabGameSplitterSizes() const { return tabGameSplitterSizes; }
|
||||||
bool getDisplayCardNames() const { return displayCardNames; }
|
bool getDisplayCardNames() const { return displayCardNames; }
|
||||||
|
@ -161,6 +163,7 @@ public slots:
|
||||||
void setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled);
|
void setSpectatorNotificationsEnabled(int _spectatorNotificationsEnabled);
|
||||||
void setDoubleClickToPlay(int _doubleClickToPlay);
|
void setDoubleClickToPlay(int _doubleClickToPlay);
|
||||||
void setPlayToStack(int _playToStack);
|
void setPlayToStack(int _playToStack);
|
||||||
|
void setAnnotateTokens(int _annotateTokens);
|
||||||
void setCardInfoMinimized(int _cardInfoMinimized);
|
void setCardInfoMinimized(int _cardInfoMinimized);
|
||||||
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
||||||
void setDisplayCardNames(int _displayCardNames);
|
void setDisplayCardNames(int _displayCardNames);
|
||||||
|
|
Loading…
Reference in a new issue