mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Merge remote-tracking branch 'upstream/master'
Some tabs to spaces, and maybe fixed to work with Qt 5. Conflicts: cockatrice/src/deckstats_interface.cpp common/decklist.cpp common/decklist.h oracle/src/oracleimporter.cpp
This commit is contained in:
commit
359882917a
98 changed files with 5371 additions and 4720 deletions
|
|
@ -7,6 +7,10 @@
|
|||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
#include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
DeckStatsInterface::DeckStatsInterface(
|
||||
CardDatabase &_cardDatabase,
|
||||
QObject *parent
|
||||
|
|
@ -41,16 +45,28 @@ void DeckStatsInterface::queryFinished(QNetworkReply *reply)
|
|||
deleteLater();
|
||||
}
|
||||
|
||||
void DeckStatsInterface::analyzeDeck(DeckList *deck)
|
||||
void DeckStatsInterface::getAnalyzeRequestData(DeckList *deck, QByteArray *data)
|
||||
{
|
||||
QUrl params;
|
||||
|
||||
DeckList deckWithoutTokens;
|
||||
copyDeckWithoutTokens(*deck, deckWithoutTokens);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
QUrl params;
|
||||
params.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
data->append(params.encodedQuery());
|
||||
#else
|
||||
QUrl params;
|
||||
QUrlQuery urlQuery;
|
||||
urlQuery.addQueryItem("deck", deckWithoutTokens.writeToString_Plain());
|
||||
params.setQuery(urlQuery);
|
||||
data->append(params.query(QUrl::EncodeReserved));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DeckStatsInterface::analyzeDeck(DeckList *deck)
|
||||
{
|
||||
QByteArray data;
|
||||
data.append(params.encodedQuery());
|
||||
getAnalyzeRequestData(deck, &data);
|
||||
|
||||
QNetworkRequest request(QUrl("http://deckstats.net/index.php"));
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue