mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
Warnings.
Took 5 minutes
This commit is contained in:
parent
5f88e874ef
commit
d276cd7cce
2 changed files with 9 additions and 1 deletions
|
|
@ -67,7 +67,7 @@ public:
|
|||
QString collectorNumber = cardData.value("cn").toString();
|
||||
QString providerId = cardData.value("scryfall_id").toString();
|
||||
|
||||
list->setBannerCard(QPair(commanderName, providerId));
|
||||
list->setBannerCard(QPair<QString, QString>(commanderName, providerId));
|
||||
list->addCard(commanderName, DECK_ZONE_MAIN, -1, setName, collectorNumber, providerId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <QEventLoop>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkReply>
|
||||
|
||||
DlgLoadDeckFromWebsite::DlgLoadDeckFromWebsite(QWidget *parent) : QDialog(parent)
|
||||
|
|
@ -58,6 +59,7 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
auto jsonParser = createParserForProvider(info.provider);
|
||||
if (!jsonParser && info.provider != DeckProvider::Deckstats && info.provider != DeckProvider::TappedOut) {
|
||||
qWarning() << "No parser found for provider";
|
||||
QMessageBox::warning(this, tr("Load Deck from Website"), tr("No parser available for this deck provider."));
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
|
@ -71,6 +73,7 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
qWarning() << "Network error:" << reply->errorString();
|
||||
QMessageBox::warning(this, tr("Load Deck from Website"), tr("Network error: %1").arg(reply->errorString()));
|
||||
reply->deleteLater();
|
||||
QDialog::reject();
|
||||
return;
|
||||
|
|
@ -84,6 +87,7 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
QString deckText = QString::fromUtf8(responseData);
|
||||
if (deckText.isEmpty()) {
|
||||
qWarning() << "Response is empty";
|
||||
QMessageBox::warning(this, tr("Load Deck from Website"), tr("Received empty deck data."));
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
|
@ -104,6 +108,8 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
QJsonDocument doc = QJsonDocument::fromJson(responseData, &parseError);
|
||||
if (parseError.error != QJsonParseError::NoError) {
|
||||
qWarning() << "JSON parse error:" << parseError.errorString();
|
||||
QMessageBox::warning(this, tr("Load Deck from Website"),
|
||||
tr("Failed to parse deck data: %1").arg(parseError.errorString()));
|
||||
QDialog::reject();
|
||||
return;
|
||||
}
|
||||
|
|
@ -113,6 +119,8 @@ void DlgLoadDeckFromWebsite::accept()
|
|||
|
||||
} else {
|
||||
qInfo() << "URL not recognized";
|
||||
QMessageBox::warning(this, tr("Load Deck from Website"),
|
||||
tr("The provided URL is not recognized as a valid deck URL."));
|
||||
QDialog::reject();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue