1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

Remove QJson usage from Accounts

This commit is contained in:
Uwe L. Korn
2014-04-13 22:08:38 +01:00
parent cb6651fba9
commit 463cfd0d5e
3 changed files with 6 additions and 16 deletions

View File

@@ -28,8 +28,7 @@
#else
#include <qt5keychain/keychain.h>
#endif
#include <qjson/serializer.h>
#include <qjson/parser.h>
#include "utils/TomahawkUtils.h"
#endif
#include <QStringList>
@@ -218,9 +217,8 @@ CredentialsManager::setCredentials( const CredentialsStorageKey& csKey, const QV
}
else if ( value.type() == QVariant::Hash )
{
QJson::Serializer serializer;
bool ok;
QByteArray data = serializer.serialize( value.toHash(), &ok );
QByteArray data = TomahawkUtils::toJson( value.toHash(), &ok );
if ( ok )
{
@@ -278,10 +276,9 @@ CredentialsManager::keychainJobFinished( QKeychain::Job* j )
<< readJob->key() << "finished without errors";
QVariant creds;
QJson::Parser parser;
bool ok;
creds = parser.parse( readJob->textData().toLatin1(), &ok );
creds = TomahawkUtils::parseJson( readJob->textData().toLatin1(), &ok );
QVariantMap map = creds.toMap();
QVariantHash hash;

View File

@@ -39,8 +39,6 @@
#include "TomahawkSettings.h"
#include "TomahawkVersion.h"
#include "qjson/parser.h"
#include <QFile>
#include <QFileInfo>
#include <QDir>
@@ -228,9 +226,8 @@ ResolverAccountFactory::metadataFromJsonFile( const QString& path )
QFile metadataFile( path );
if ( metadataFile.open( QIODevice::ReadOnly | QIODevice::Text ) )
{
QJson::Parser parser;
bool ok;
QVariantMap variant = parser.parse( metadataFile.readAll(), &ok ).toMap();
QVariantMap variant = TomahawkUtils::parseJson( metadataFile.readAll(), &ok ).toMap();
if ( ok )
{

View File

@@ -23,8 +23,6 @@
#include "utils/Logger.h"
#include "utils/NetworkAccessManager.h"
#include <qjson/parser.h>
using namespace Tomahawk;
using namespace Tomahawk::InfoSystem;
@@ -206,8 +204,7 @@ SpotifyInfoPlugin::albumIdLookupFinished( QNetworkReply* reply, const InfoReques
if ( reply->error() == QNetworkReply::NoError )
{
QJson::Parser p;
const QVariantMap response = p.parse( reply ).toMap();
const QVariantMap response = TomahawkUtils::parseJson( reply->readAll() ).toMap();
if ( !response.contains( "albums" ) )
{
dataError( requestData );
@@ -254,8 +251,7 @@ SpotifyInfoPlugin::albumContentsLookupFinished( QNetworkReply* reply, const Info
if ( reply->error() == QNetworkReply::NoError )
{
QJson::Parser p;
const QVariantMap response = p.parse( reply ).toMap();
const QVariantMap response = TomahawkUtils::parseJson( reply->readAll() ).toMap();
if ( !response.contains( "album" ) )
{