This commit is contained in:
Lukas Brübach 2025-01-22 14:54:08 +01:00
parent 280d1aca26
commit 042bfdac0a
10 changed files with 30 additions and 20 deletions

View file

@ -1,6 +1,7 @@
#include "edhrec_commander_api_response_average_deck_statistics.h" #include "edhrec_commander_api_response_average_deck_statistics.h"
void EdhrecCommanderApiResponseAverageDeckStatistics::fromJson(const QJsonObject &json) { void EdhrecCommanderApiResponseAverageDeckStatistics::fromJson(const QJsonObject &json)
{
creature = json.value("creature").toInt(0); creature = json.value("creature").toInt(0);
instant = json.value("instant").toInt(0); instant = json.value("instant").toInt(0);
sorcery = json.value("sorcery").toInt(0); sorcery = json.value("sorcery").toInt(0);

View file

@ -1,10 +1,14 @@
#include "edhrec_commander_api_response_card_details.h" #include "edhrec_commander_api_response_card_details.h"
#include <QDebug> #include <QDebug>
EdhrecCommanderApiResponseCardDetails::EdhrecCommanderApiResponseCardDetails() EdhrecCommanderApiResponseCardDetails::EdhrecCommanderApiResponseCardDetails()
: synergy(0.0), inclusion(0), numDecks(0), potentialDecks(0) {} : synergy(0.0), inclusion(0), numDecks(0), potentialDecks(0)
{
}
void EdhrecCommanderApiResponseCardDetails::fromJson(const QJsonObject &json) { void EdhrecCommanderApiResponseCardDetails::fromJson(const QJsonObject &json)
{
// Parse the fields from the JSON object // Parse the fields from the JSON object
name = json.value("name").toString(); name = json.value("name").toString();
sanitized = json.value("sanitized").toString(); sanitized = json.value("sanitized").toString();
@ -17,7 +21,8 @@ void EdhrecCommanderApiResponseCardDetails::fromJson(const QJsonObject &json) {
potentialDecks = json.value("potential_decks").toInt(0); potentialDecks = json.value("potential_decks").toInt(0);
} }
void EdhrecCommanderApiResponseCardDetails::debugPrint() const { void EdhrecCommanderApiResponseCardDetails::debugPrint() const
{
// Print out all the fields for debugging // Print out all the fields for debugging
qDebug() << "Name:" << name; qDebug() << "Name:" << name;
qDebug() << "Sanitized:" << sanitized; qDebug() << "Sanitized:" << sanitized;

View file

@ -1,4 +1,5 @@
#include "edhrec_commander_api_response_card_list.h" #include "edhrec_commander_api_response_card_list.h"
#include <QDebug> #include <QDebug>
EdhrecCommanderApiResponseCardList::EdhrecCommanderApiResponseCardList() EdhrecCommanderApiResponseCardList::EdhrecCommanderApiResponseCardList()

View file

@ -1,6 +1,7 @@
#include "edhrec_commander_api_response_commander_details.h" #include "edhrec_commander_api_response_commander_details.h"
void EdhrecCommanderApiResponseCommanderDetails::fromJson(const QJsonObject &json) { void EdhrecCommanderApiResponseCommanderDetails::fromJson(const QJsonObject &json)
{
// Parse card-related data // Parse card-related data
aetherhubUri = json.value("aetherhub_uri").toString(); aetherhubUri = json.value("aetherhub_uri").toString();
archidektUri = json.value("archidekt_uri").toString(); archidektUri = json.value("archidekt_uri").toString();
@ -44,7 +45,8 @@ void EdhrecCommanderApiResponseCommanderDetails::fromJson(const QJsonObject &jso
url = json.value("url").toString(); url = json.value("url").toString();
} }
void EdhrecCommanderApiResponseCommanderDetails::debugPrint() const { void EdhrecCommanderApiResponseCommanderDetails::debugPrint() const
{
qDebug() << "Card Data:"; qDebug() << "Card Data:";
qDebug() << "Aetherhub URI:" << aetherhubUri; qDebug() << "Aetherhub URI:" << aetherhubUri;
qDebug() << "Archidekt URI:" << archidektUri; qDebug() << "Archidekt URI:" << archidektUri;

View file

@ -1,4 +1,5 @@
#include "edhrec_commander_api_response_card_details_display_widget.h" #include "edhrec_commander_api_response_card_details_display_widget.h"
#include "../../../../game/cards/card_database_manager.h" #include "../../../../game/cards/card_database_manager.h"
EdhrecCommanderApiResponseCardDetailsDisplayWidget::EdhrecCommanderApiResponseCardDetailsDisplayWidget( EdhrecCommanderApiResponseCardDetailsDisplayWidget::EdhrecCommanderApiResponseCardDetailsDisplayWidget(

View file

@ -5,14 +5,15 @@
#include "api_response/edhrec_commander_api_response_card_details.h" #include "api_response/edhrec_commander_api_response_card_details.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QWidget>
#include <QLabel> #include <QLabel>
#include <QWidget>
class EdhrecCommanderApiResponseCardDetailsDisplayWidget : public QWidget class EdhrecCommanderApiResponseCardDetailsDisplayWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit EdhrecCommanderApiResponseCardDetailsDisplayWidget(QWidget *parent, explicit EdhrecCommanderApiResponseCardDetailsDisplayWidget(
QWidget *parent,
const EdhrecCommanderApiResponseCardDetails &_toDisplay); const EdhrecCommanderApiResponseCardDetails &_toDisplay);
private: private:

View file

@ -31,7 +31,8 @@ EdhrecCommanderApiResponseDisplayWidget::EdhrecCommanderApiResponseDisplayWidget
QStringList widgetNames; QStringList widgetNames;
// Add commander details // Add commander details
auto commanderPicture = new EdhrecCommanderResponseCommanderDetailsDisplayWidget(this, response.container.getCommanderDetails()); auto commanderPicture =
new EdhrecCommanderResponseCommanderDetailsDisplayWidget(this, response.container.getCommanderDetails());
cardDisplayLayout->addWidget(commanderPicture); cardDisplayLayout->addWidget(commanderPicture);
widgetNames.append("Commander Details"); widgetNames.append("Commander Details");

View file

@ -6,8 +6,6 @@
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QWidget> #include <QWidget>
#include <qscrollarea.h> #include <qscrollarea.h>
#include <QLoggingCategory>
inline Q_LOGGING_CATEGORY(FlowWidgetLog, "flow_widget"); inline Q_LOGGING_CATEGORY(FlowWidgetLog, "flow_widget");
inline Q_LOGGING_CATEGORY(FlowWidgetSizeLog, "flow_widget.size"); inline Q_LOGGING_CATEGORY(FlowWidgetSizeLog, "flow_widget.size");