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:
Waleed Khan 2014-07-20 14:40:18 -04:00
commit 359882917a
98 changed files with 5371 additions and 4720 deletions

View file

@ -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");