mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-11 12:54:10 -07:00
TabArchidekt and Archidekt API integration.
Took 37 seconds Took 4 minutes Took 40 seconds Took 4 minutes
This commit is contained in:
parent
de13c22552
commit
81046cd135
27 changed files with 1516 additions and 2 deletions
|
|
@ -0,0 +1,63 @@
|
|||
#ifndef COCKATRICE_TAB_ARCHIDEKT_H
|
||||
#define COCKATRICE_TAB_ARCHIDEKT_H
|
||||
|
||||
#include "../../interface/widgets/cards/card_size_widget.h"
|
||||
#include "../../interface/widgets/quick_settings/settings_button_widget.h"
|
||||
#include "../../tab.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QPushButton>
|
||||
#include <libcockatrice/card/database/card_database.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
inline QString archidektApiLink = "https://archidekt.com/api/decks/v3/?name=";
|
||||
|
||||
class TabArchidekt : public Tab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TabArchidekt(TabSupervisor *_tabSupervisor);
|
||||
|
||||
void retranslateUi() override;
|
||||
void doSearch();
|
||||
QString getTabText() const override
|
||||
{
|
||||
auto cardName = cardToQuery.isNull() ? QString() : cardToQuery->getName();
|
||||
return tr("Archidekt: ") + cardName;
|
||||
}
|
||||
|
||||
CardSizeWidget *getCardSizeSlider()
|
||||
{
|
||||
return cardSizeSlider;
|
||||
}
|
||||
|
||||
QNetworkAccessManager *networkManager;
|
||||
|
||||
public slots:
|
||||
void processApiJson(QNetworkReply *reply);
|
||||
void processTopDecksResponse(QJsonObject reply);
|
||||
void processDeckResponse(QJsonObject reply);
|
||||
void prettyPrintJson(const QJsonValue &value, int indentLevel);
|
||||
void actNavigatePage(QString url);
|
||||
void getTopDecks();
|
||||
|
||||
private:
|
||||
QWidget *container;
|
||||
QWidget *navigationContainer;
|
||||
QWidget *currentPageDisplay;
|
||||
QVBoxLayout *mainLayout;
|
||||
QHBoxLayout *navigationLayout;
|
||||
QVBoxLayout *currentPageLayout;
|
||||
QPushButton *decksPushButton;
|
||||
QLineEdit *searchBar;
|
||||
QPushButton *searchPushButton;
|
||||
SettingsButtonWidget *settingsButton;
|
||||
CardSizeWidget *cardSizeSlider;
|
||||
CardInfoPtr cardToQuery;
|
||||
};
|
||||
|
||||
|
||||
#endif // COCKATRICE_TAB_ARCHIDEKT_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue