This commit is contained in:
Lukas Brübach 2025-05-09 04:06:35 +02:00
parent db79534530
commit 3380ee541f
2 changed files with 14 additions and 13 deletions

View file

@ -162,7 +162,7 @@ void DlgGetCardPrices::startCardPriceRequests()
if (excludeLandsCheckBox->isChecked()) {
CardInfoPtr card = CardDatabaseManager::getInstance()->getCard(cardName);
if (!card || card->getMainCardType() == "Land")
if (!card || card->getMainCardType() == "Land")
continue;
}

View file

@ -10,8 +10,8 @@
#include <QMap>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QPushButton>
#include <QProgressBar>
#include <QPushButton>
#include <QStringList>
#include <QTableWidget>
@ -19,20 +19,23 @@ class DeckListModel;
class QLabel;
class QScrollArea;
class CardPriceTableWidgetItem : public QTableWidgetItem {
class CardPriceTableWidgetItem : public QTableWidgetItem
{
public:
// Constructor
CardPriceTableWidgetItem(const QString &text) : QTableWidgetItem(text) {}
CardPriceTableWidgetItem(const QString &text) : QTableWidgetItem(text)
{
}
bool operator<(const QTableWidgetItem &other) const override
{
bool ok1, ok2;
double val1 = text().remove('%').toDouble(&ok1); // Remove '%' and convert to double
double val2 = other.text().remove('%').toDouble(&ok2); // Remove '%' and convert to double
double val1 = text().remove('%').toDouble(&ok1); // Remove '%' and convert to double
double val2 = other.text().remove('%').toDouble(&ok2); // Remove '%' and convert to double
// Handle non-numeric cases gracefully
if (ok1 && ok2) {
return val1 < val2; // Compare as double values
return val1 < val2; // Compare as double values
}
// If conversion to double failed, fallback to string comparison
@ -40,7 +43,6 @@ public:
}
};
class DlgGetCardPrices : public QDialog
{
Q_OBJECT
@ -48,11 +50,11 @@ class DlgGetCardPrices : public QDialog
public:
explicit DlgGetCardPrices(QWidget *parent, DeckListModel *_model);
signals:
void allRequestsFinished();
signals:
void allRequestsFinished();
private slots:
void onCardPriceReply();
private slots:
void onCardPriceReply();
void onAllRequestsFinished();
void actOK();
void onSelectionChanged();
@ -95,7 +97,6 @@ private:
int totalCardsToProcess = 0;
int finishedCardCount = 0;
};
#endif // DLG_GET_CARD_PRICES_H