mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 19:43:26 -08:00
Renamed Commander to ColorIdentity
This commit is contained in:
parent
9cfc1450cd
commit
b13395eb4d
2 changed files with 22 additions and 20 deletions
|
|
@ -63,7 +63,13 @@ void VisualDatabaseDisplayColorFilterWidget::retranslateUi()
|
||||||
modeComboBox->addItem(tr("Includes"), QVariant::fromValue(FilterMode::Includes));
|
modeComboBox->addItem(tr("Includes"), QVariant::fromValue(FilterMode::Includes));
|
||||||
modeComboBox->addItem(tr("Excludes"), QVariant::fromValue(FilterMode::Excludes));
|
modeComboBox->addItem(tr("Excludes"), QVariant::fromValue(FilterMode::Excludes));
|
||||||
modeComboBox->addItem(tr("Include / Exclude"), QVariant::fromValue(FilterMode::IncludeExclude));
|
modeComboBox->addItem(tr("Include / Exclude"), QVariant::fromValue(FilterMode::IncludeExclude));
|
||||||
modeComboBox->addItem(tr("Commander"), QVariant::fromValue(FilterMode::Commander));
|
modeComboBox->addItem(tr("Color identity"), QVariant::fromValue(FilterMode::ColorIdentity));
|
||||||
|
|
||||||
|
modeComboBox->setItemData(0, tr("Cards being exactly of the selected colors"), Qt::ToolTipRole);
|
||||||
|
modeComboBox->setItemData(1, tr("Cards containing any of the selected colors"), Qt::ToolTipRole);
|
||||||
|
modeComboBox->setItemData(2, tr("Cards containing none of the selected colors"), Qt::ToolTipRole);
|
||||||
|
modeComboBox->setItemData(3, tr("Cards containing any of the selected colors and none of the unselected colors"), Qt::ToolTipRole);
|
||||||
|
modeComboBox->setItemData(4, tr("Cards whose color identity fits within the selected colors"), Qt::ToolTipRole);
|
||||||
|
|
||||||
modeComboBox->setToolTip(tr("How selected and unselected colors are combined in the filter"));
|
modeComboBox->setToolTip(tr("How selected and unselected colors are combined in the filter"));
|
||||||
|
|
||||||
|
|
@ -117,7 +123,7 @@ void VisualDatabaseDisplayColorFilterWidget::addFilter(QChar color)
|
||||||
filterModel->addFilter(new CardFilter(color, CardFilter::Type::TypeOr, CardFilter::Attr::AttrColor));
|
filterModel->addFilter(new CardFilter(color, CardFilter::Type::TypeOr, CardFilter::Attr::AttrColor));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FilterMode::Commander:
|
case FilterMode::ColorIdentity:
|
||||||
removeFilters(filterModel, color, CardFilter::Attr::AttrColorIdentity);
|
removeFilters(filterModel, color, CardFilter::Attr::AttrColorIdentity);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -145,10 +151,9 @@ void VisualDatabaseDisplayColorFilterWidget::removeFilter(QChar color)
|
||||||
filterModel->addFilter(new CardFilter(color, CardFilter::Type::TypeAndNot, CardFilter::Attr::AttrColor));
|
filterModel->addFilter(new CardFilter(color, CardFilter::Type::TypeAndNot, CardFilter::Attr::AttrColor));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FilterMode::Commander:
|
case FilterMode::ColorIdentity:
|
||||||
removeFilters(filterModel, color, CardFilter::Attr::AttrColorIdentity);
|
removeFilters(filterModel, color, CardFilter::Attr::AttrColorIdentity);
|
||||||
filterModel->addFilter(
|
filterModel->addFilter(new CardFilter(color, CardFilter::Type::TypeAndNot, CardFilter::Attr::AttrColorIdentity));
|
||||||
new CardFilter(color, CardFilter::Type::TypeAndNot, CardFilter::Attr::AttrColorIdentity));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -210,41 +215,38 @@ QList<QChar> VisualDatabaseDisplayColorFilterWidget::getActiveColors()
|
||||||
void VisualDatabaseDisplayColorFilterWidget::syncWithFilterModel()
|
void VisualDatabaseDisplayColorFilterWidget::syncWithFilterModel()
|
||||||
{
|
{
|
||||||
QList<const CardFilter *> allColorFilters = filterModel->getFiltersOfType(
|
QList<const CardFilter *> allColorFilters = filterModel->getFiltersOfType(
|
||||||
currentMode == FilterMode::Commander ? CardFilter::Attr::AttrColorIdentity : CardFilter::Attr::AttrColor);
|
currentMode == FilterMode::ColorIdentity
|
||||||
|
? CardFilter::Attr::AttrColorIdentity
|
||||||
|
: CardFilter::Attr::AttrColor);
|
||||||
|
|
||||||
QList<ManaSymbolWidget *> manaSymbolWidgets = findChildren<ManaSymbolWidget *>();
|
QList<ManaSymbolWidget *> manaSymbolWidgets = findChildren<ManaSymbolWidget *>();
|
||||||
|
|
||||||
for (ManaSymbolWidget *manaSymbolWidget : manaSymbolWidgets) {
|
for (ManaSymbolWidget *manaSymbolWidget : manaSymbolWidgets) {
|
||||||
QChar symbol = manaSymbolWidget->getSymbolChar();
|
QChar symbol = manaSymbolWidget->getSymbolChar();
|
||||||
bool found = currentMode == FilterMode::Commander;
|
bool found = currentMode == FilterMode::ColorIdentity;
|
||||||
for (const CardFilter *filter : allColorFilters) {
|
for (const CardFilter *filter : allColorFilters) {
|
||||||
if (symbol == filter->term()) {
|
if (symbol == filter->term()) {
|
||||||
switch (currentMode) {
|
switch (currentMode) {
|
||||||
case FilterMode::ExactMatch:
|
case FilterMode::ExactMatch:
|
||||||
if (filter->type() == CardFilter::Type::TypeAnd) {
|
if (filter->type() == CardFilter::Type::TypeAnd)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case FilterMode::Includes:
|
case FilterMode::Includes:
|
||||||
case FilterMode::IncludeExclude:
|
case FilterMode::IncludeExclude:
|
||||||
if (filter->type() == CardFilter::Type::TypeOr) {
|
if (filter->type() == CardFilter::Type::TypeOr)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case FilterMode::Excludes:
|
case FilterMode::Excludes:
|
||||||
if (filter->type() == CardFilter::Type::TypeAndNot) {
|
if (filter->type() == CardFilter::Type::TypeAndNot)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case FilterMode::Commander:
|
case FilterMode::ColorIdentity:
|
||||||
if (filter->type() == CardFilter::Type::TypeAndNot) {
|
if (filter->type() == CardFilter::Type::TypeAndNot)
|
||||||
found = false;
|
found = false;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (found) {
|
if (found)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,9 @@ enum class FilterMode
|
||||||
{
|
{
|
||||||
ExactMatch, // Only selected colors are included, all others are excluded.
|
ExactMatch, // Only selected colors are included, all others are excluded.
|
||||||
Includes, // Include selected colors (OR condition).
|
Includes, // Include selected colors (OR condition).
|
||||||
Excludes, // Exclude selected colors (OR).
|
Excludes, // Exclude selected colors (AND NOT).
|
||||||
IncludeExclude, // Include selected colors (OR) and exclude unselected colors (AND NOT).
|
IncludeExclude, // Include selected colors (OR) and exclude unselected colors (AND NOT).
|
||||||
Commander // Only include colors in the selected color identity.
|
ColorIdentity // Keep cards whose color identity is a subset of the selected colors (stored as ANDNOT for each unselected color).
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(FilterMode)
|
Q_DECLARE_METATYPE(FilterMode)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue