mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 17:44:01 -07:00
Add a selection combobox for sorting logic.
This commit is contained in:
parent
b8e2a31d2c
commit
d98bca8be8
2 changed files with 28 additions and 4 deletions
|
|
@ -202,9 +202,18 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
|
||||||
minDeckSizeLabel = new QLabel(navigationContainer);
|
minDeckSizeLabel = new QLabel(navigationContainer);
|
||||||
|
|
||||||
minDeckSizeSpin = new QSpinBox(navigationContainer);
|
minDeckSizeSpin = new QSpinBox(navigationContainer);
|
||||||
|
minDeckSizeSpin->setSpecialValueText(tr("Disabled"));
|
||||||
minDeckSizeSpin->setRange(0, 200);
|
minDeckSizeSpin->setRange(0, 200);
|
||||||
minDeckSizeSpin->setValue(0);
|
minDeckSizeSpin->setValue(0);
|
||||||
|
|
||||||
|
// Size logic
|
||||||
|
minDeckSizeLogicCombo = new QComboBox(navigationContainer);
|
||||||
|
minDeckSizeLogicCombo->addItems({"Exact", "≥", "≤"}); // Exact = unset, ≥ = GTE, ≤ = LTE
|
||||||
|
minDeckSizeLogicCombo->setCurrentIndex(1); // default GTE
|
||||||
|
|
||||||
|
connect(minDeckSizeSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, [this]() { doSearch(); });
|
||||||
|
connect(minDeckSizeLogicCombo, &QComboBox::currentTextChanged, this, [this]() { doSearch(); });
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
pageLabel = new QLabel(navigationContainer);
|
pageLabel = new QLabel(navigationContainer);
|
||||||
|
|
||||||
|
|
@ -261,9 +270,10 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
|
||||||
// Card size settings
|
// Card size settings
|
||||||
navigationLayout->addWidget(settingsButton);
|
navigationLayout->addWidget(settingsButton);
|
||||||
|
|
||||||
// Page size
|
// Min. # of cards in deck
|
||||||
navigationLayout->addWidget(minDeckSizeLabel);
|
navigationLayout->addWidget(minDeckSizeLabel);
|
||||||
navigationLayout->addWidget(minDeckSizeSpin);
|
navigationLayout->addWidget(minDeckSizeSpin);
|
||||||
|
navigationLayout->addWidget(minDeckSizeLogicCombo);
|
||||||
|
|
||||||
// Page number
|
// Page number
|
||||||
navigationLayout->addWidget(pageLabel);
|
navigationLayout->addWidget(pageLabel);
|
||||||
|
|
@ -383,9 +393,22 @@ QString TabArchidekt::buildSearchUrl()
|
||||||
// Min deck size
|
// Min deck size
|
||||||
if (minDeckSizeSpin->value() != 0) {
|
if (minDeckSizeSpin->value() != 0) {
|
||||||
query.addQueryItem("size", QString::number(minDeckSizeSpin->value()));
|
query.addQueryItem("size", QString::number(minDeckSizeSpin->value()));
|
||||||
query.addQueryItem("sizeLogic", QString("GTE"));
|
|
||||||
|
QString logic = "GTE"; // default
|
||||||
|
QString selected = minDeckSizeLogicCombo->currentText();
|
||||||
|
if (selected == "≥")
|
||||||
|
logic = "GTE";
|
||||||
|
else if (selected == "≤")
|
||||||
|
logic = "LTE";
|
||||||
|
else
|
||||||
|
logic = ""; // Exact = unset
|
||||||
|
|
||||||
|
if (!logic.isEmpty()) {
|
||||||
|
query.addQueryItem("sizeLogic", logic);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// build final URL
|
// build final URL
|
||||||
QUrl url("https://archidekt.com/api/decks/v3/");
|
QUrl url("https://archidekt.com/api/decks/v3/");
|
||||||
url.setQuery(query);
|
url.setQuery(query);
|
||||||
|
|
|
||||||
|
|
@ -226,8 +226,9 @@ private:
|
||||||
// Minimum Cards in Deck
|
// Minimum Cards in Deck
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
QLabel *minDeckSizeLabel; ///< Label for minimum number of cards per deck
|
QLabel *minDeckSizeLabel; ///< Label for minimum number of cards per deck
|
||||||
QSpinBox *minDeckSizeSpin; ///< Spinner to select minimum deck size
|
QSpinBox *minDeckSizeSpin; ///< Spinner to select minimum deck size
|
||||||
|
QComboBox *minDeckSizeLogicCombo; ///< Combo box for the size logic to apply
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// Pagination
|
// Pagination
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue