[VDD] Shuffle some widgets around, label things.

Took 31 minutes

Took 5 seconds
This commit is contained in:
Lukas Brübach 2026-01-13 07:47:55 +01:00
parent 13d906f0cf
commit 19db58b28f
7 changed files with 79 additions and 24 deletions

View file

@ -2,6 +2,7 @@
#include "../../../filters/filter_tree_model.h"
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
#include <QTimer>
@ -14,6 +15,10 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
: QWidget(parent), filterModel(_filterModel)
{
allFormatsWithCount = CardDatabaseManager::query()->getAllFormatsWithCount();
int maxValue = std::numeric_limits<int>::min();
for (int value : allFormatsWithCount) {
maxValue = std::max(maxValue, value);
}
setMinimumWidth(300);
setMaximumHeight(300);
@ -26,12 +31,23 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
layout->addWidget(flowWidget);
// Create a container for the threshold control
auto *thresholdLayout = new QHBoxLayout();
thresholdLayout->setContentsMargins(0, 0, 0, 0);
thresholdLabel = new QLabel(this);
thresholdLayout->addWidget(thresholdLabel);
// Create the spinbox
spinBox = new QSpinBox(this);
spinBox->setMinimum(1);
spinBox->setMaximum(getMaxMainTypeCount()); // Set the max value dynamically
spinBox->setMaximum(maxValue); // Set the max value dynamically
spinBox->setValue(150);
layout->addWidget(spinBox);
thresholdLayout->addWidget(spinBox);
thresholdLayout->addStretch();
layout->addLayout(thresholdLayout);
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
&VisualDatabaseDisplayFormatLegalityFilterWidget::updateFormatButtonsVisibility);
@ -53,6 +69,8 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
void VisualDatabaseDisplayFormatLegalityFilterWidget::retranslateUi()
{
thresholdLabel->setText(tr("Show formats with at least:"));
spinBox->setSuffix(tr(" cards"));
spinBox->setToolTip(tr("Do not display formats with less than this amount of cards in the database"));
toggleButton->setToolTip(tr("Filter mode (AND/OR/NOT conjunctions of filters)"));
}

View file

@ -4,6 +4,7 @@
#include "../../../filters/filter_tree_model.h"
#include "../general/layout_containers/flow_widget.h"
#include <QLabel>
#include <QMap>
#include <QPushButton>
#include <QSpinBox>
@ -29,9 +30,11 @@ public:
private:
FilterTreeModel *filterModel;
QMap<QString, int> allFormatsWithCount;
QSpinBox *spinBox;
QVBoxLayout *layout;
FlowWidget *flowWidget;
QLabel *thresholdLabel;
QSpinBox *spinBox;
QPushButton *toggleButton; // Mode switch button
QMap<QString, bool> activeFormats; // Track active filters

View file

@ -2,6 +2,7 @@
#include "../../../filters/filter_tree_model.h"
#include <QLabel>
#include <QPushButton>
#include <QSpinBox>
#include <QTimer>
@ -26,12 +27,23 @@ VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWi
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
layout->addWidget(flowWidget);
// Create a container for the threshold control
auto *thresholdLayout = new QHBoxLayout();
thresholdLayout->setContentsMargins(0, 0, 0, 0);
thresholdLabel = new QLabel(this);
thresholdLayout->addWidget(thresholdLabel);
// Create the spinbox
spinBox = new QSpinBox(this);
spinBox->setMinimum(1);
spinBox->setMaximum(getMaxMainTypeCount()); // Set the max value dynamically
spinBox->setMaximum(getMaxMainTypeCount());
spinBox->setValue(150);
layout->addWidget(spinBox);
thresholdLayout->addWidget(spinBox);
thresholdLayout->addStretch();
layout->addLayout(thresholdLayout);
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
&VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeButtonsVisibility);
@ -52,6 +64,8 @@ VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWi
void VisualDatabaseDisplayMainTypeFilterWidget::retranslateUi()
{
thresholdLabel->setText(tr("Show main types with at least:"));
spinBox->setSuffix(tr(" cards"));
spinBox->setToolTip(tr("Do not display card main-types with less than this amount of cards in the database"));
toggleButton->setToolTip(tr("Filter mode (AND/OR/NOT conjunctions of filters)"));
}

View file

@ -10,6 +10,7 @@
#include "../../../filters/filter_tree_model.h"
#include "../general/layout_containers/flow_widget.h"
#include <QLabel>
#include <QMap>
#include <QPushButton>
#include <QSpinBox>
@ -34,9 +35,11 @@ public:
private:
FilterTreeModel *filterModel;
QMap<QString, int> allMainCardTypesWithCount;
QSpinBox *spinBox;
QVBoxLayout *layout;
FlowWidget *flowWidget;
QLabel *thresholdLabel;
QSpinBox *spinBox;
QPushButton *toggleButton; // Mode switch button
QMap<QString, bool> activeMainTypes; // Track active filters

View file

@ -51,14 +51,6 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
layout = new QVBoxLayout(this);
setLayout(layout);
recentSetsSettingsWidget = new VisualDatabaseDisplayRecentSetFilterSettingsWidget(this);
layout->addWidget(recentSetsSettingsWidget);
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged, this,
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsAmountChanged, this,
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
searchBox = new QLineEdit(this);
searchBox->setPlaceholderText(tr("Search sets..."));
layout->addWidget(searchBox);
@ -68,6 +60,14 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
layout->addWidget(flowWidget);
recentSetsSettingsWidget = new VisualDatabaseDisplayRecentSetFilterSettingsWidget(this);
layout->addWidget(recentSetsSettingsWidget);
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsEnabledChanged, this,
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
connect(&SettingsCache::instance(), &SettingsCache::visualDatabaseDisplayFilterToMostRecentSetsAmountChanged, this,
&VisualDatabaseDisplaySetFilterWidget::filterToRecentSets);
// Create the toggle button for Exact Match/Includes mode
toggleButton = new QPushButton(this);
toggleButton->setCheckable(true);

View file

@ -2,6 +2,7 @@
#include "../../../filters/filter_tree_model.h"
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QSpinBox>
@ -20,15 +21,6 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
layout = new QVBoxLayout(this);
setLayout(layout);
// Create and setup the spinbox
spinBox = new QSpinBox(this);
spinBox->setMinimum(1);
spinBox->setMaximum(getMaxSubTypeCount());
spinBox->setValue(150);
layout->addWidget(spinBox);
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
&VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeButtonsVisibility);
// Create search box
searchBox = new QLineEdit(this);
searchBox->setPlaceholderText(tr("Search subtypes..."));
@ -40,6 +32,26 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
flowWidget->setMaximumHeight(300);
layout->addWidget(flowWidget);
// Create a container for the threshold control
auto *thresholdLayout = new QHBoxLayout();
thresholdLayout->setContentsMargins(0, 0, 0, 0);
thresholdLabel = new QLabel(this);
thresholdLayout->addWidget(thresholdLabel);
// Create the spinbox
spinBox = new QSpinBox(this);
spinBox->setMinimum(1);
spinBox->setMaximum(getMaxSubTypeCount());
spinBox->setValue(150);
thresholdLayout->addWidget(spinBox);
thresholdLayout->addStretch();
layout->addLayout(thresholdLayout);
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
&VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeButtonsVisibility);
// Toggle button setup (Exact Match / Includes mode)
toggleButton = new QPushButton(this);
toggleButton->setCheckable(true);
@ -57,6 +69,8 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
void VisualDatabaseDisplaySubTypeFilterWidget::retranslateUi()
{
thresholdLabel->setText(tr("Show sub types with at least:"));
spinBox->setSuffix(tr(" cards"));
spinBox->setToolTip(tr("Do not display card sub-types with less than this amount of cards in the database"));
toggleButton->setToolTip(tr("Filter mode (AND/OR/NOT conjunctions of filters)"));
}

View file

@ -10,6 +10,7 @@
#include "../../../filters/filter_tree_model.h"
#include "../general/layout_containers/flow_widget.h"
#include <QLabel>
#include <QMap>
#include <QPushButton>
#include <QSpinBox>
@ -33,10 +34,12 @@ public:
private:
FilterTreeModel *filterModel;
QMap<QString, int> allSubCardTypesWithCount;
QSpinBox *spinBox;
QVBoxLayout *layout;
QLineEdit *searchBox;
FlowWidget *flowWidget;
QLabel *thresholdLabel;
QSpinBox *spinBox;
QPushButton *toggleButton; // Mode switch button
QMap<QString, bool> activeSubTypes; // Track active filters