Let's not lambda it and slot it instead.

This commit is contained in:
Brübach, Lukas 2025-11-27 12:26:52 +01:00
parent af2502905e
commit ea6fbd09f4
2 changed files with 16 additions and 17 deletions

View file

@ -67,7 +67,7 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
orderDirButton->setCheckable(true); // checked = DESC, unchecked = ASC orderDirButton->setCheckable(true); // checked = DESC, unchecked = ASC
orderDirButton->setChecked(true); orderDirButton->setChecked(true);
connect(orderByCombo, &QComboBox::currentTextChanged, this, [this]() { doSearch(); }); connect(orderByCombo, &QComboBox::currentTextChanged, this, &TabArchidekt::doSearch);
connect(orderDirButton, &QPushButton::clicked, this, [this](bool checked) { connect(orderDirButton, &QPushButton::clicked, this, [this](bool checked) {
orderDirButton->setText(checked ? tr("Desc.") : tr("Asc.")); orderDirButton->setText(checked ? tr("Desc.") : tr("Asc."));
doSearch(); doSearch();
@ -106,7 +106,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(); }); connect(formatCheckBox, &QCheckBox::clicked, this, &TabArchidekt::doSearch);
formatChecks << formatCheckBox; formatChecks << formatCheckBox;
formatSettingsWidget->addSettingsWidget(formatCheckBox); formatSettingsWidget->addSettingsWidget(formatCheckBox);
} }
@ -116,7 +116,7 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
edhBracketCombo->addItem(tr("Any Bracket")); edhBracketCombo->addItem(tr("Any Bracket"));
edhBracketCombo->addItems({"1", "2", "3", "4", "5"}); edhBracketCombo->addItems({"1", "2", "3", "4", "5"});
connect(edhBracketCombo, &QComboBox::currentTextChanged, this, [this]() { doSearch(); }); connect(edhBracketCombo, &QComboBox::currentTextChanged, this, &TabArchidekt::doSearch);
// Search for Card Packages instead of Decks // Search for Card Packages instead of Decks
packagesCheck = new QCheckBox("Packages", navigationContainer); packagesCheck = new QCheckBox("Packages", navigationContainer);
@ -191,13 +191,13 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
deckTagNameField = new QLineEdit(navigationContainer); deckTagNameField = new QLineEdit(navigationContainer);
deckTagNameField->setPlaceholderText("Deck tag"); deckTagNameField->setPlaceholderText("Deck tag");
connect(deckTagNameField, &QLineEdit::textChanged, this, [this]() { doSearch(); }); connect(deckTagNameField, &QLineEdit::textChanged, this, &TabArchidekt::doSearch);
// Search button // Search button
searchPushButton = new QPushButton(navigationContainer); searchPushButton = new QPushButton(navigationContainer);
searchPushButton->setText("Search"); searchPushButton->setText("Search");
connect(searchPushButton, &QPushButton::clicked, this, [this]() { doSearch(); }); connect(searchPushButton, &QPushButton::clicked, this, &TabArchidekt::doSearch);
// Card Size settings // Card Size settings
settingsButton = new SettingsButtonWidget(this); settingsButton = new SettingsButtonWidget(this);
@ -217,8 +217,8 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
minDeckSizeLogicCombo->addItems({"Exact", "", ""}); // Exact = unset, ≥ = GTE, ≤ = LTE minDeckSizeLogicCombo->addItems({"Exact", "", ""}); // Exact = unset, ≥ = GTE, ≤ = LTE
minDeckSizeLogicCombo->setCurrentIndex(1); // default GTE minDeckSizeLogicCombo->setCurrentIndex(1); // default GTE
connect(minDeckSizeSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, [this]() { doSearch(); }); connect(minDeckSizeSpin, QOverload<int>::of(&QSpinBox::valueChanged), this, &TabArchidekt::doSearch);
connect(minDeckSizeLogicCombo, &QComboBox::currentTextChanged, this, [this]() { doSearch(); }); connect(minDeckSizeLogicCombo, &QComboBox::currentTextChanged, this, &TabArchidekt::doSearch);
// Page number // Page number
pageLabel = new QLabel(navigationContainer); pageLabel = new QLabel(navigationContainer);
@ -227,7 +227,7 @@ TabArchidekt::TabArchidekt(TabSupervisor *_tabSupervisor) : Tab(_tabSupervisor)
pageSpin->setRange(1, 9999); pageSpin->setRange(1, 9999);
pageSpin->setValue(1); pageSpin->setValue(1);
connect(pageSpin, &QSpinBox::valueChanged, this, [this]() { doSearch(); }); connect(pageSpin, &QSpinBox::valueChanged, this, &TabArchidekt::doSearch);
// Page display // Page display
currentPageDisplay = new QWidget(container); currentPageDisplay = new QWidget(container);

View file

@ -67,15 +67,6 @@ public:
*/ */
QString buildSearchUrl(); QString buildSearchUrl();
/**
* @brief Trigger a search using the current filters
*
* Sends a network request to the Archidekt API using the URL generated by buildSearchUrl().
* Updates the current page display with results asynchronously.
*/
void doSearch();
void doSearchImmediate();
/** /**
* @brief Retrieve the tab display text * @brief Retrieve the tab display text
* @return QString Human-readable title for the tab * @return QString Human-readable title for the tab
@ -103,6 +94,14 @@ public:
QNetworkAccessManager *networkManager; QNetworkAccessManager *networkManager;
public slots: public slots:
/**
* @brief Trigger a search using the current filters
*
* Sends a network request to the Archidekt API using the URL generated by buildSearchUrl().
* Updates the current page display with results asynchronously.
*/
void doSearch();
void doSearchImmediate();
/** /**
* @brief Process a network reply containing JSON data * @brief Process a network reply containing JSON data
* @param reply QNetworkReply object with the API response * @param reply QNetworkReply object with the API response