mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
[VDD] Shuffle some widgets around, label things.
Took 31 minutes Took 5 seconds
This commit is contained in:
parent
13d906f0cf
commit
19db58b28f
7 changed files with 79 additions and 24 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
@ -14,6 +15,10 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
|
||||||
: QWidget(parent), filterModel(_filterModel)
|
: QWidget(parent), filterModel(_filterModel)
|
||||||
{
|
{
|
||||||
allFormatsWithCount = CardDatabaseManager::query()->getAllFormatsWithCount();
|
allFormatsWithCount = CardDatabaseManager::query()->getAllFormatsWithCount();
|
||||||
|
int maxValue = std::numeric_limits<int>::min();
|
||||||
|
for (int value : allFormatsWithCount) {
|
||||||
|
maxValue = std::max(maxValue, value);
|
||||||
|
}
|
||||||
setMinimumWidth(300);
|
setMinimumWidth(300);
|
||||||
setMaximumHeight(300);
|
setMaximumHeight(300);
|
||||||
|
|
||||||
|
|
@ -26,12 +31,23 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
|
||||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||||
layout->addWidget(flowWidget);
|
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
|
// Create the spinbox
|
||||||
spinBox = new QSpinBox(this);
|
spinBox = new QSpinBox(this);
|
||||||
spinBox->setMinimum(1);
|
spinBox->setMinimum(1);
|
||||||
spinBox->setMaximum(getMaxMainTypeCount()); // Set the max value dynamically
|
spinBox->setMaximum(maxValue); // Set the max value dynamically
|
||||||
spinBox->setValue(150);
|
spinBox->setValue(150);
|
||||||
layout->addWidget(spinBox);
|
thresholdLayout->addWidget(spinBox);
|
||||||
|
thresholdLayout->addStretch();
|
||||||
|
|
||||||
|
layout->addLayout(thresholdLayout);
|
||||||
|
|
||||||
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&VisualDatabaseDisplayFormatLegalityFilterWidget::updateFormatButtonsVisibility);
|
&VisualDatabaseDisplayFormatLegalityFilterWidget::updateFormatButtonsVisibility);
|
||||||
|
|
||||||
|
|
@ -53,6 +69,8 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
|
||||||
|
|
||||||
void VisualDatabaseDisplayFormatLegalityFilterWidget::retranslateUi()
|
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"));
|
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)"));
|
toggleButton->setToolTip(tr("Filter mode (AND/OR/NOT conjunctions of filters)"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
#include "../general/layout_containers/flow_widget.h"
|
#include "../general/layout_containers/flow_widget.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
@ -29,9 +30,11 @@ public:
|
||||||
private:
|
private:
|
||||||
FilterTreeModel *filterModel;
|
FilterTreeModel *filterModel;
|
||||||
QMap<QString, int> allFormatsWithCount;
|
QMap<QString, int> allFormatsWithCount;
|
||||||
QSpinBox *spinBox;
|
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
FlowWidget *flowWidget;
|
FlowWidget *flowWidget;
|
||||||
|
QLabel *thresholdLabel;
|
||||||
|
QSpinBox *spinBox;
|
||||||
QPushButton *toggleButton; // Mode switch button
|
QPushButton *toggleButton; // Mode switch button
|
||||||
|
|
||||||
QMap<QString, bool> activeFormats; // Track active filters
|
QMap<QString, bool> activeFormats; // Track active filters
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
@ -26,12 +27,23 @@ VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWi
|
||||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||||
layout->addWidget(flowWidget);
|
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
|
// Create the spinbox
|
||||||
spinBox = new QSpinBox(this);
|
spinBox = new QSpinBox(this);
|
||||||
spinBox->setMinimum(1);
|
spinBox->setMinimum(1);
|
||||||
spinBox->setMaximum(getMaxMainTypeCount()); // Set the max value dynamically
|
spinBox->setMaximum(getMaxMainTypeCount());
|
||||||
spinBox->setValue(150);
|
spinBox->setValue(150);
|
||||||
layout->addWidget(spinBox);
|
thresholdLayout->addWidget(spinBox);
|
||||||
|
thresholdLayout->addStretch();
|
||||||
|
|
||||||
|
layout->addLayout(thresholdLayout);
|
||||||
|
|
||||||
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(spinBox, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeButtonsVisibility);
|
&VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeButtonsVisibility);
|
||||||
|
|
||||||
|
|
@ -52,6 +64,8 @@ VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWi
|
||||||
|
|
||||||
void VisualDatabaseDisplayMainTypeFilterWidget::retranslateUi()
|
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"));
|
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)"));
|
toggleButton->setToolTip(tr("Filter mode (AND/OR/NOT conjunctions of filters)"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
#include "../general/layout_containers/flow_widget.h"
|
#include "../general/layout_containers/flow_widget.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
@ -34,9 +35,11 @@ public:
|
||||||
private:
|
private:
|
||||||
FilterTreeModel *filterModel;
|
FilterTreeModel *filterModel;
|
||||||
QMap<QString, int> allMainCardTypesWithCount;
|
QMap<QString, int> allMainCardTypesWithCount;
|
||||||
QSpinBox *spinBox;
|
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
FlowWidget *flowWidget;
|
FlowWidget *flowWidget;
|
||||||
|
QLabel *thresholdLabel;
|
||||||
|
QSpinBox *spinBox;
|
||||||
QPushButton *toggleButton; // Mode switch button
|
QPushButton *toggleButton; // Mode switch button
|
||||||
|
|
||||||
QMap<QString, bool> activeMainTypes; // Track active filters
|
QMap<QString, bool> activeMainTypes; // Track active filters
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,6 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
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 = new QLineEdit(this);
|
||||||
searchBox->setPlaceholderText(tr("Search sets..."));
|
searchBox->setPlaceholderText(tr("Search sets..."));
|
||||||
layout->addWidget(searchBox);
|
layout->addWidget(searchBox);
|
||||||
|
|
@ -68,6 +60,14 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
|
||||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||||
layout->addWidget(flowWidget);
|
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
|
// Create the toggle button for Exact Match/Includes mode
|
||||||
toggleButton = new QPushButton(this);
|
toggleButton = new QPushButton(this);
|
||||||
toggleButton->setCheckable(true);
|
toggleButton->setCheckable(true);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
@ -20,15 +21,6 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
|
||||||
layout = new QVBoxLayout(this);
|
layout = new QVBoxLayout(this);
|
||||||
setLayout(layout);
|
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
|
// Create search box
|
||||||
searchBox = new QLineEdit(this);
|
searchBox = new QLineEdit(this);
|
||||||
searchBox->setPlaceholderText(tr("Search subtypes..."));
|
searchBox->setPlaceholderText(tr("Search subtypes..."));
|
||||||
|
|
@ -40,6 +32,26 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
|
||||||
flowWidget->setMaximumHeight(300);
|
flowWidget->setMaximumHeight(300);
|
||||||
layout->addWidget(flowWidget);
|
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)
|
// Toggle button setup (Exact Match / Includes mode)
|
||||||
toggleButton = new QPushButton(this);
|
toggleButton = new QPushButton(this);
|
||||||
toggleButton->setCheckable(true);
|
toggleButton->setCheckable(true);
|
||||||
|
|
@ -57,6 +69,8 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
|
||||||
|
|
||||||
void VisualDatabaseDisplaySubTypeFilterWidget::retranslateUi()
|
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"));
|
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)"));
|
toggleButton->setToolTip(tr("Filter mode (AND/OR/NOT conjunctions of filters)"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../../../filters/filter_tree_model.h"
|
#include "../../../filters/filter_tree_model.h"
|
||||||
#include "../general/layout_containers/flow_widget.h"
|
#include "../general/layout_containers/flow_widget.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
|
@ -33,10 +34,12 @@ public:
|
||||||
private:
|
private:
|
||||||
FilterTreeModel *filterModel;
|
FilterTreeModel *filterModel;
|
||||||
QMap<QString, int> allSubCardTypesWithCount;
|
QMap<QString, int> allSubCardTypesWithCount;
|
||||||
QSpinBox *spinBox;
|
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
QLineEdit *searchBox;
|
QLineEdit *searchBox;
|
||||||
FlowWidget *flowWidget;
|
FlowWidget *flowWidget;
|
||||||
|
QLabel *thresholdLabel;
|
||||||
|
QSpinBox *spinBox;
|
||||||
QPushButton *toggleButton; // Mode switch button
|
QPushButton *toggleButton; // Mode switch button
|
||||||
|
|
||||||
QMap<QString, bool> activeSubTypes; // Track active filters
|
QMap<QString, bool> activeSubTypes; // Track active filters
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue