mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
Custom item retranslate fix
This commit is contained in:
parent
ba22736def
commit
b3e6ecbef7
2 changed files with 21 additions and 4 deletions
|
|
@ -121,6 +121,10 @@ void VisualDatabaseDisplayColorFilterWidget::retranslateUi()
|
|||
modeComboBox->setItemData(3, tr("Cards being exactly of the selected colors"), Qt::ToolTipRole);
|
||||
modeComboBox->setItemData(4, tr("Cards whose color identity fits within the selected colors"), Qt::ToolTipRole);
|
||||
|
||||
if (currentMode == FilterMode::Custom) {
|
||||
addCustomFilterModeItem();
|
||||
}
|
||||
|
||||
modeComboBox->setToolTip(tr("How selected and unselected colors are combined in the filter"));
|
||||
modeComboBox->setAccessibleName(tr("Color Filter Mode"));
|
||||
|
||||
|
|
@ -135,12 +139,26 @@ void VisualDatabaseDisplayColorFilterWidget::retranslateUi()
|
|||
|
||||
void VisualDatabaseDisplayColorFilterWidget::setFilterMode(FilterMode filterMode)
|
||||
{
|
||||
const int index = modeComboBox->findData(QVariant::fromValue(filterMode));
|
||||
int index = modeComboBox->findData(QVariant::fromValue(filterMode));
|
||||
|
||||
if (index < 0 && filterMode == FilterMode::Custom) {
|
||||
index = modeComboBox->count();
|
||||
addCustomFilterModeItem();
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
modeComboBox->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayColorFilterWidget::addCustomFilterModeItem()
|
||||
{
|
||||
int customIndex = modeComboBox->count();
|
||||
modeComboBox->addItem(tr("Custom"), QVariant::fromValue(FilterMode::Custom));
|
||||
modeComboBox->setItemData(customIndex, tr("Cards matching an unknown combination of color filters"),
|
||||
Qt::ToolTipRole);
|
||||
}
|
||||
|
||||
void VisualDatabaseDisplayColorFilterWidget::handleColorToggled(QChar color, bool active)
|
||||
{
|
||||
if (active) {
|
||||
|
|
@ -277,9 +295,7 @@ void VisualDatabaseDisplayColorFilterWidget::syncWithFilterModel()
|
|||
if (currentMode == FilterMode::Custom) {
|
||||
if (customIndex < 0) {
|
||||
customIndex = modeComboBox->count();
|
||||
modeComboBox->addItem(tr("Custom"), QVariant::fromValue(FilterMode::Custom));
|
||||
modeComboBox->setItemData(customIndex, tr("Cards matching an unknown combination of color filters"),
|
||||
Qt::ToolTipRole);
|
||||
addCustomFilterModeItem();
|
||||
}
|
||||
modeComboBox->setCurrentIndex(customIndex);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ signals:
|
|||
void filterModeChanged(FilterMode filterMode);
|
||||
|
||||
private slots:
|
||||
void addCustomFilterModeItem();
|
||||
void handleColorToggled(QChar color, bool active);
|
||||
void addFilter(QChar color);
|
||||
void removeFilter(QChar color);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue