mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
69 lines
2.1 KiB
C++
69 lines
2.1 KiB
C++
#ifndef TAB_EDHREC_MAIN_H
|
|
#define TAB_EDHREC_MAIN_H
|
|
|
|
#include "../../../../game/cards/card_database.h"
|
|
#include "../../../ui/widgets/cards/card_size_widget.h"
|
|
#include "../../../ui/widgets/general/layout_containers/flow_widget.h"
|
|
#include "../../../ui/widgets/quick_settings/settings_button_widget.h"
|
|
#include "../../tab.h"
|
|
#include "display/commander/edhrec_commander_api_response_display_widget.h"
|
|
|
|
#include <QHBoxLayout>
|
|
#include <QLineEdit>
|
|
#include <QNetworkAccessManager>
|
|
#include <QPushButton>
|
|
|
|
class TabEdhRecMain : public Tab
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit TabEdhRecMain(TabSupervisor *_tabSupervisor);
|
|
|
|
void retranslateUi() override;
|
|
void doSearch();
|
|
QString getTabText() const override
|
|
{
|
|
auto cardName = cardToQuery.isNull() ? QString() : cardToQuery->getName();
|
|
return tr("EDHRec: ") + cardName;
|
|
}
|
|
|
|
CardSizeWidget *getCardSizeSlider()
|
|
{
|
|
return cardSizeSlider;
|
|
}
|
|
|
|
QNetworkAccessManager *networkManager;
|
|
|
|
public slots:
|
|
void processApiJson(QNetworkReply *reply);
|
|
void processCommanderResponse(QJsonObject reply, QString responseUrl = "");
|
|
void processTopCardsResponse(QJsonObject reply);
|
|
void processTopTagsResponse(QJsonObject reply);
|
|
void processTopCommandersResponse(QJsonObject reply);
|
|
void processAverageDeckResponse(QJsonObject reply);
|
|
void prettyPrintJson(const QJsonValue &value, int indentLevel);
|
|
void setCard(CardInfoPtr _cardToQuery, bool isCommander = false);
|
|
void actNavigatePage(QString url);
|
|
void getTopCards();
|
|
void getTopCommanders();
|
|
void getTopTags();
|
|
|
|
private:
|
|
QWidget *container;
|
|
QWidget *navigationContainer;
|
|
QWidget *currentPageDisplay;
|
|
QVBoxLayout *mainLayout;
|
|
QHBoxLayout *navigationLayout;
|
|
QVBoxLayout *currentPageLayout;
|
|
QPushButton *cardsPushButton;
|
|
QPushButton *topCommandersPushButton;
|
|
QPushButton *tagsPushButton;
|
|
QLineEdit *searchBar;
|
|
QPushButton *searchPushButton;
|
|
SettingsButtonWidget *settingsButton;
|
|
CardSizeWidget *cardSizeSlider;
|
|
CardInfoPtr cardToQuery;
|
|
EdhrecCommanderApiResponseDisplayWidget *displayWidget;
|
|
};
|
|
|
|
#endif // TAB_EDHREC_MAIN_H
|