Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
tab_archidekt.h
Go to the documentation of this file.
1#ifndef COCKATRICE_TAB_ARCHIDEKT_H
2#define COCKATRICE_TAB_ARCHIDEKT_H
3
4#include "../../interface/widgets/cards/card_size_widget.h"
5#include "../../interface/widgets/quick_settings/settings_button_widget.h"
6#include "../../tab.h"
7
8#include <QCheckBox>
9#include <QComboBox>
10#include <QHBoxLayout>
11#include <QLineEdit>
12#include <QNetworkAccessManager>
13#include <QPushButton>
14#include <QSpinBox>
15#include <QString>
17
19inline QString archidektApiLink = "https://archidekt.com/api/decks/v3/?name=";
20
28class TabArchidekt : public Tab
29{
30 Q_OBJECT
31public:
39 explicit TabArchidekt(TabSupervisor *_tabSupervisor);
40
47 void retranslateUi() override;
48
68 QString buildSearchUrl();
69
76 QString getTabText() const override
77 {
78 auto cardName = cardToQuery.isNull() ? QString() : cardToQuery->getName();
79 return tr("Archidekt: ") + cardName;
80 }
81
92
94 QNetworkAccessManager *networkManager;
95
96public slots:
103 void doSearch();
104 void doSearchImmediate();
112 void processApiJson(QNetworkReply *reply);
113
120 void processTopDecksResponse(QJsonObject reply);
121
128 void processDeckResponse(QJsonObject reply);
129
135 void prettyPrintJson(const QJsonValue &value, int indentLevel);
136
143 void actNavigatePage(QString url);
144
150 void getTopDecks();
151
152private:
154
155 // ---------------------------------------------------------------------
156 // Layout Containers
157 // ---------------------------------------------------------------------
158
159 QWidget *container;
160 QVBoxLayout *mainLayout;
162 QHBoxLayout *navigationLayout;
164 QVBoxLayout *currentPageLayout;
165
166 // ---------------------------------------------------------------------
167 // Sorting Controls
168 // ---------------------------------------------------------------------
169
170 QComboBox *orderByCombo;
171 QPushButton *orderDirButton;
172
173 // ---------------------------------------------------------------------
174 // Color Filters
175 // ---------------------------------------------------------------------
176
177 QSet<QChar> activeColors;
178 QCheckBox *logicalAndCheck;
179
180 // ---------------------------------------------------------------------
181 // Format Filters
182 // ---------------------------------------------------------------------
183
184 QLabel *formatLabel;
186 QVector<QCheckBox *> formatChecks;
187
188 // ---------------------------------------------------------------------
189 // EDH Bracket / Package Toggle
190 // ---------------------------------------------------------------------
191
192 QComboBox *edhBracketCombo;
193 QCheckBox *packagesCheck;
194
195 // ---------------------------------------------------------------------
196 // Basic Search Fields
197 // ---------------------------------------------------------------------
198
199 QLineEdit *nameField;
200 QLineEdit *ownerField;
201
202 // ---------------------------------------------------------------------
203 // Card Filters
204 // ---------------------------------------------------------------------
205
206 QLineEdit *cardsField;
207 QLineEdit *commandersField;
208
209 // ---------------------------------------------------------------------
210 // Deck Tag
211 // ---------------------------------------------------------------------
212
213 QLineEdit *deckTagNameField;
214
215 // ---------------------------------------------------------------------
216 // Search Trigger
217 // ---------------------------------------------------------------------
218
219 QPushButton *searchPushButton;
220
221 // ---------------------------------------------------------------------
222 // UI Settings (Card Size)
223 // ---------------------------------------------------------------------
224
227
228 // ---------------------------------------------------------------------
229 // Minimum Cards in Deck
230 // ---------------------------------------------------------------------
231
233 QSpinBox *minDeckSizeSpin;
235
236 // ---------------------------------------------------------------------
237 // Pagination
238 // ---------------------------------------------------------------------
239
240 QLabel *pageLabel;
241 QSpinBox *pageSpin;
242
243 // ---------------------------------------------------------------------
244 // Optional Context
245 // ---------------------------------------------------------------------
246
248};
249
250#endif // COCKATRICE_TAB_ARCHIDEKT_H
QSharedPointer< CardInfo > CardInfoPtr
Definition card_info.cpp:20
A widget for adjusting card sizes using a slider.
Definition card_size_widget.h:21
Definition settings_button_widget.h:17
QWidget * container
Root container for the entire tab.
Definition tab_archidekt.h:159
QVBoxLayout * mainLayout
Outer vertical layout containing navigation and page display.
Definition tab_archidekt.h:160
QHBoxLayout * navigationLayout
Layout for horizontal arrangement of filter widgets.
Definition tab_archidekt.h:162
SettingsButtonWidget * settingsButton
Container for additional UI settings.
Definition tab_archidekt.h:225
QVector< QCheckBox * > formatChecks
Individual checkboxes for each format.
Definition tab_archidekt.h:186
QLabel * minDeckSizeLabel
Label for minimum number of cards per deck.
Definition tab_archidekt.h:232
QTimer * searchDebounceTimer
Timer to debounce search requests by spin-boxes etc.
Definition tab_archidekt.h:153
QSpinBox * minDeckSizeSpin
Spinner to select minimum deck size.
Definition tab_archidekt.h:233
QComboBox * orderByCombo
Dropdown for selecting the sort field.
Definition tab_archidekt.h:170
CardSizeWidget * getCardSizeSlider()
Get the card size slider widget.
Definition tab_archidekt.h:88
QCheckBox * logicalAndCheck
Require ALL selected colors instead of ANY.
Definition tab_archidekt.h:178
QPushButton * orderDirButton
Toggle button for ascending/descending sort.
Definition tab_archidekt.h:171
CardInfoPtr cardToQuery
Optional pre-selected card for initial filtering.
Definition tab_archidekt.h:247
void retranslateUi() override
Update all UI text to reflect the current language or translation.
Definition tab_archidekt.cpp:298
QCheckBox * packagesCheck
Toggle for searching card packages instead of full decks.
Definition tab_archidekt.h:193
QWidget * navigationContainer
Container for all navigation/filter controls.
Definition tab_archidekt.h:161
QLabel * pageLabel
Label for current page selection.
Definition tab_archidekt.h:240
QLineEdit * cardsField
Input for cards included in the deck (comma-separated)
Definition tab_archidekt.h:206
QComboBox * minDeckSizeLogicCombo
Combo box for the size logic to apply.
Definition tab_archidekt.h:234
QVBoxLayout * currentPageLayout
Layout for deck display widgets.
Definition tab_archidekt.h:164
SettingsButtonWidget * formatSettingsWidget
Collapsible widget containing format checkboxes.
Definition tab_archidekt.h:185
QWidget * currentPageDisplay
Widget containing the currently displayed deck(s)
Definition tab_archidekt.h:163
void processApiJson(QNetworkReply *reply)
Process a network reply containing JSON data.
Definition tab_archidekt.cpp:444
void prettyPrintJson(const QJsonValue &value, int indentLevel)
Pretty-print a QJsonValue for debugging.
Definition tab_archidekt.cpp:537
QString buildSearchUrl()
Construct the search URL from all current filters.
Definition tab_archidekt.cpp:306
CardSizeWidget * cardSizeSlider
Slider to adjust card size in results.
Definition tab_archidekt.h:226
QSpinBox * pageSpin
Spinner to select the page number for results.
Definition tab_archidekt.h:241
void actNavigatePage(QString url)
Navigate to a specified page URL.
Definition tab_archidekt.cpp:432
QComboBox * edhBracketCombo
Dropdown for EDH bracket selection.
Definition tab_archidekt.h:192
QLineEdit * ownerField
Input for owner name filter.
Definition tab_archidekt.h:200
void doSearch()
Trigger a search using the current filters.
Definition tab_archidekt.cpp:420
QLineEdit * nameField
Input for deck name filter.
Definition tab_archidekt.h:199
QSet< QChar > activeColors
Set of currently active mana colors.
Definition tab_archidekt.h:177
QLabel * formatLabel
Label displaying "Formats".
Definition tab_archidekt.h:184
QNetworkAccessManager * networkManager
Network manager for handling API requests.
Definition tab_archidekt.h:94
void processDeckResponse(QJsonObject reply)
Handle a JSON response for a single deck.
Definition tab_archidekt.cpp:507
QString getTabText() const override
Retrieve the tab display text.
Definition tab_archidekt.h:76
QLineEdit * commandersField
Input for commander cards (comma-separated)
Definition tab_archidekt.h:207
void doSearchImmediate()
Definition tab_archidekt.cpp:425
void getTopDecks()
Fetch top decks from the Archidekt API.
Definition tab_archidekt.cpp:438
void processTopDecksResponse(QJsonObject reply)
Handle a JSON response containing multiple decks.
Definition tab_archidekt.cpp:478
QPushButton * searchPushButton
Button to trigger the search manually.
Definition tab_archidekt.h:219
TabArchidekt(TabSupervisor *_tabSupervisor)
Construct a new TabArchidekt object.
Definition tab_archidekt.cpp:26
QLineEdit * deckTagNameField
Input for deck tag filtering.
Definition tab_archidekt.h:213
Definition tab_supervisor.h:83
Tab(TabSupervisor *_tabSupervisor)
Definition tab.cpp:11
TODO: Document this.
QString archidektApiLink
Definition tab_archidekt.h:19