mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
Lint.
This commit is contained in:
parent
280d1aca26
commit
042bfdac0a
10 changed files with 30 additions and 20 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
@ -24,13 +25,13 @@ EdhrecCommanderApiResponseCardDetailsDisplayWidget::EdhrecCommanderApiResponseCa
|
||||||
labelColor = QColor(255, 0, 0); // Red
|
labelColor = QColor(255, 0, 0); // Red
|
||||||
} else if (inclusionRate <= 60) {
|
} else if (inclusionRate <= 60) {
|
||||||
int red = 255 - ((inclusionRate - 30) * 2);
|
int red = 255 - ((inclusionRate - 30) * 2);
|
||||||
int green = (inclusionRate - 30) * 4; // Adjust green to make the transition smoother
|
int green = (inclusionRate - 30) * 4; // Adjust green to make the transition smoother
|
||||||
labelColor = QColor(red, green, 0); // purple-ish
|
labelColor = QColor(red, green, 0); // purple-ish
|
||||||
} else if (inclusionRate <= 90) {
|
} else if (inclusionRate <= 90) {
|
||||||
int green = (inclusionRate - 60) * 5; // Increase green
|
int green = (inclusionRate - 60) * 5; // Increase green
|
||||||
labelColor = QColor(100, green, 100); // Green shades
|
labelColor = QColor(100, green, 100); // Green shades
|
||||||
} else {
|
} else {
|
||||||
labelColor = QColor(100, 200, 100); // Dark Green
|
labelColor = QColor(100, 200, 100); // Dark Green
|
||||||
}
|
}
|
||||||
|
|
||||||
label->setStyleSheet(QString("color: %1").arg(labelColor.name()));
|
label->setStyleSheet(QString("color: %1").arg(labelColor.name()));
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ BannerWidget::BannerWidget(QWidget *parent, const QString &text, Qt::Orientation
|
||||||
bannerLabel->setStyleSheet("font-size: 24px; font-weight: bold; color: white;");
|
bannerLabel->setStyleSheet("font-size: 24px; font-weight: bold; color: white;");
|
||||||
|
|
||||||
// Layout to center the banner label
|
// Layout to center the banner label
|
||||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||||
layout->addWidget(bannerLabel);
|
layout->addWidget(bannerLabel);
|
||||||
layout->setContentsMargins(0, 20, 0, 20); // Space for the gradient
|
layout->setContentsMargins(0, 20, 0, 20); // Space for the gradient
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
@ -37,7 +37,7 @@ void BannerWidget::toggleBuddyVisibility() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BannerWidget::paintEvent(QPaintEvent* event)
|
void BannerWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ void BannerWidget::paintEvent(QPaintEvent* event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set neutral gradient colors with calculated transparency
|
// Set neutral gradient colors with calculated transparency
|
||||||
gradient.setColorAt(0, QColor(200, 200, 200, alpha)); // Light grey with alpha
|
gradient.setColorAt(0, QColor(200, 200, 200, alpha)); // Light grey with alpha
|
||||||
gradient.setColorAt(1, QColor(100, 100, 100, alpha / 1.5)); // Darker grey, slightly more transparent
|
gradient.setColorAt(1, QColor(100, 100, 100, alpha / 1.5)); // Darker grey, slightly more transparent
|
||||||
|
|
||||||
// Fill the widget background with the gradient
|
// Fill the widget background with the gradient
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ public:
|
||||||
}
|
}
|
||||||
~MainWindow() override;
|
~MainWindow() override;
|
||||||
|
|
||||||
TabSupervisor* getTabSupervisor() const
|
TabSupervisor *getTabSupervisor() const
|
||||||
{
|
{
|
||||||
return tabSupervisor;
|
return tabSupervisor;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue