Skip to content

Commit

Permalink
Remove QJson usage from Accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
xhochy committed Apr 14, 2014
1 parent cb6651f commit 463cfd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
9 changes: 3 additions & 6 deletions src/libtomahawk/accounts/CredentialsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/libtomahawk/accounts/ResolverAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
#include "TomahawkSettings.h"
#include "TomahawkVersion.h"

#include "qjson/parser.h"

#include <QFile>
#include <QFileInfo>
#include <QDir>
Expand Down Expand Up @@ -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 )
{
Expand Down
8 changes: 2 additions & 6 deletions src/libtomahawk/accounts/spotify/SpotifyInfoPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "utils/Logger.h"
#include "utils/NetworkAccessManager.h"

#include <qjson/parser.h>

using namespace Tomahawk;
using namespace Tomahawk::InfoSystem;

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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" ) )
{
Expand Down

0 comments on commit 463cfd0

Please sign in to comment.