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

@ -10,7 +10,7 @@ ArchidektApiResponseDeckListingsDisplayWidget::ArchidektApiResponseDeckListingsD
: QWidget(parent), cardSizeSlider(_cardSizeSlider) : QWidget(parent), cardSizeSlider(_cardSizeSlider)
{ {
layout = new QHBoxLayout(this); layout = new QHBoxLayout(this);
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout); setLayout(layout);
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded); flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);

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);
} }
@ -143,7 +145,7 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
} }
});*/ });*/
//navigationLayout->addWidget(searchBar); // navigationLayout->addWidget(searchBar);
// Do search button // Do search button
@ -194,7 +196,7 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
void TabArchidekt::retranslateUi() void TabArchidekt::retranslateUi()
{ {
//searchBar->setPlaceholderText(tr("Search for a card ...")); // searchBar->setPlaceholderText(tr("Search for a card ..."));
searchPushButton->setText(tr("Search")); searchPushButton->setText(tr("Search"));
formatLabel->setText(tr("Formats")); formatLabel->setText(tr("Formats"));
pageSizeLabel->setText(tr("Max. Results:")); pageSizeLabel->setText(tr("Max. Results:"));
@ -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())

View file

@ -53,7 +53,7 @@ private:
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
QHBoxLayout *navigationLayout; QHBoxLayout *navigationLayout;
QVBoxLayout *currentPageLayout; QVBoxLayout *currentPageLayout;
//QLineEdit *searchBar; // QLineEdit *searchBar;
QPushButton *searchPushButton; QPushButton *searchPushButton;
// Required / basic fields // Required / basic fields