mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 10:03:26 -08:00
* Fix deck analysis request lifetime, result URLs and form encoding [skip ci] * Preserve unknown cards in deck analysis exports * Share deck analysis URL validation and drop the unused request latch Both analysis interfaces carried a copy of normalizeAnalysisUrl; move it to one header next to them. They are constructed per analysis and analyzeDeck is called once, so the analysisStarted latch was unreachable; remove it from both. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
/**
|
|
* @file tapped_out_interface.h
|
|
* @ingroup ApiInterfaces
|
|
*/
|
|
//! \todo Document this file.
|
|
|
|
#ifndef TAPPEDOUT_INTERFACE_H
|
|
#define TAPPEDOUT_INTERFACE_H
|
|
|
|
#include <QLoggingCategory>
|
|
#include <QObject>
|
|
#include <qtmetamacros.h>
|
|
|
|
inline Q_LOGGING_CATEGORY(TappedOutInterfaceLog, "tapped_out_interface");
|
|
|
|
class QByteArray;
|
|
class QString;
|
|
class QNetworkAccessManager;
|
|
class QNetworkReply;
|
|
class DeckList;
|
|
|
|
/**
|
|
* TappedOutInterface exists in order to support the "Analyze on TappedOut" feature.
|
|
* An http POST request is sent and the result is retrieved from the reply. Parsing
|
|
* logic is implemented in TappedOutInterface::queryFinished().
|
|
*/
|
|
|
|
class TappedOutInterface : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
QNetworkAccessManager *manager;
|
|
bool replyHandled = false;
|
|
void showError(const QString &message);
|
|
|
|
void copyDeckSplitMainAndSide(const DeckList &source, DeckList &mainboard, DeckList &sideboard);
|
|
private slots:
|
|
void queryFinished(QNetworkReply *reply);
|
|
void getAnalyzeRequestData(const DeckList &deck, QByteArray &data);
|
|
|
|
public:
|
|
explicit TappedOutInterface(QObject *parent = nullptr);
|
|
void analyzeDeck(const DeckList &deck);
|
|
};
|
|
|
|
#endif
|