Refresh on filter change.

This commit is contained in:
Brübach, Lukas 2025-11-25 12:07:50 +01:00
parent 90a64c4853
commit f2ed09e944
3 changed files with 10 additions and 29 deletions

View file

@ -34,13 +34,13 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
container = new QWidget(this); container = new QWidget(this);
mainLayout = new QVBoxLayout(container); mainLayout = new QVBoxLayout(container);
mainLayout->setContentsMargins(0, 0, 0, 1); mainLayout->setContentsMargins(0, 0, 0, 0);
container->setLayout(mainLayout); container->setLayout(mainLayout);
navigationContainer = new QWidget(container); navigationContainer = new QWidget(container);
navigationContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); navigationContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
navigationLayout = new QHBoxLayout(navigationContainer); navigationLayout = new QHBoxLayout(navigationContainer);
navigationLayout->setSpacing(5); navigationLayout->setSpacing(3);
navigationContainer->setLayout(navigationLayout); navigationContainer->setLayout(navigationLayout);
// Colors // Colors
@ -53,12 +53,13 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
manaSymbol->setFixedWidth(25); manaSymbol->setFixedWidth(25);
colorLayout->addWidget(manaSymbol); colorLayout->addWidget(manaSymbol);
connect(manaSymbol, &ManaSymbolWidget::colorToggled, this, [=](QChar c, bool active) { connect(manaSymbol, &ManaSymbolWidget::colorToggled, this, [this](QChar c, bool active) {
if (active) { if (active) {
activeColors.insert(c); activeColors.insert(c);
} else { } else {
activeColors.remove(c); activeColors.remove(c);
} }
doSearch();
}); });
} }
@ -79,6 +80,7 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
for (int i = 0; i < formatNames.size(); ++i) { for (int i = 0; i < formatNames.size(); ++i) {
QCheckBox *formatCheckBox = new QCheckBox(formatNames[i], navigationContainer); QCheckBox *formatCheckBox = new QCheckBox(formatNames[i], navigationContainer);
connect(formatCheckBox, &QCheckBox::clicked, this, [this]() { doSearch(); });
formatChecks << formatCheckBox; formatChecks << formatCheckBox;
formatSettingsWidget->addSettingsWidget(formatCheckBox); formatSettingsWidget->addSettingsWidget(formatCheckBox);
} }
@ -210,28 +212,7 @@ QString TabArchidekt::buildSearchUrl()
// colors // colors
QStringList selectedColors; QStringList selectedColors;
for (QChar c : activeColors) { for (QChar c : activeColors) {
switch (c.unicode()) { selectedColors.append(c);
case 'W':
selectedColors << "White";
break;
case 'U':
selectedColors << "Blue";
break;
case 'B':
selectedColors << "Black";
break;
case 'G':
selectedColors << "Green";
break;
case 'R':
selectedColors << "Red";
break;
case 'C':
selectedColors << "Colorless";
break;
default:
break;
}
} }
if (!selectedColors.isEmpty()) if (!selectedColors.isEmpty())