diff --git a/src/libtomahawk/infosystem/infoplugins/echonestplugin.cpp b/src/libtomahawk/infosystem/infoplugins/echonestplugin.cpp index 26bb30217..73e540b85 100644 --- a/src/libtomahawk/infosystem/infoplugins/echonestplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/echonestplugin.cpp @@ -45,6 +45,7 @@ EchoNestPlugin::~EchoNestPlugin() void EchoNestPlugin::namChangedSlot() { + qDebug() << Q_FUNC_INFO; Echonest::Config::instance()->setNetworkAccessManager( m_infoSystemWorker->nam() ); } diff --git a/src/libtomahawk/infosystem/infoplugins/lastfmplugin.cpp b/src/libtomahawk/infosystem/infoplugins/lastfmplugin.cpp index ece3764d2..a9c29c5fe 100644 --- a/src/libtomahawk/infosystem/infoplugins/lastfmplugin.cpp +++ b/src/libtomahawk/infosystem/infoplugins/lastfmplugin.cpp @@ -52,6 +52,8 @@ LastFmPlugin::LastFmPlugin( InfoSystemWorker* parent ) supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying; parent->registerInfoTypes( this, supportedGetTypes, supportedPushTypes ); + connect( parent, SIGNAL( namChanged() ), SLOT( namChangedSlot() ) ); + /* Your API Key is 7194b85b6d1f424fe1668173a78c0c4a Your secret is ba80f1df6d27ae63e9cb1d33ccf2052f @@ -96,6 +98,14 @@ LastFmPlugin::~LastFmPlugin() } +void +LastFmPlugin::namChangedSlot() +{ + qDebug() << Q_FUNC_INFO; + lastfm::setNetworkAccessManager( m_infoSystemWorker->nam() ); +} + + void LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData ) { diff --git a/src/libtomahawk/infosystem/infoplugins/lastfmplugin.h b/src/libtomahawk/infosystem/infoplugins/lastfmplugin.h index c393c9b00..62b345b28 100644 --- a/src/libtomahawk/infosystem/infoplugins/lastfmplugin.h +++ b/src/libtomahawk/infosystem/infoplugins/lastfmplugin.h @@ -51,6 +51,8 @@ public slots: void coverArtReturned(); void artistImagesReturned(); + void namChangedSlot(); + protected slots: virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData ); diff --git a/src/libtomahawk/infosystem/infosystem.cpp b/src/libtomahawk/infosystem/infosystem.cpp index 218d3fe4e..c59c9ec45 100644 --- a/src/libtomahawk/infosystem/infosystem.cpp +++ b/src/libtomahawk/infosystem/infosystem.cpp @@ -66,7 +66,6 @@ InfoSystem::InfoSystem(QObject *parent) m_infoSystemWorkerThreadController->start(); QMetaObject::invokeMethod( m_worker, "init", Qt::QueuedConnection ); - QMetaObject::invokeMethod( m_worker, "newNam", Qt::QueuedConnection ); connect( TomahawkSettings::instance(), SIGNAL( changed() ), m_worker, SLOT( newNam() ) ); diff --git a/src/libtomahawk/infosystem/infosystemworker.cpp b/src/libtomahawk/infosystem/infosystemworker.cpp index 332e95820..c70cbe019 100644 --- a/src/libtomahawk/infosystem/infosystemworker.cpp +++ b/src/libtomahawk/infosystem/infosystemworker.cpp @@ -91,6 +91,8 @@ void InfoSystemWorker::init() SLOT( updateCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) ) ); } + + QMetaObject::invokeMethod( this, "newNam" ); } @@ -162,7 +164,8 @@ InfoSystemWorker::nam() const void InfoSystemWorker::newNam() { - QNetworkAccessManager *newNam = new QNetworkAccessManager( this ); + qDebug() << Q_FUNC_INFO; + QNetworkAccessManager *newNam = new QNetworkAccessManager(); if ( m_nam ) { delete m_nam; diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 5f0da76d8..da56f7b6d 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -244,8 +244,6 @@ TomahawkApp::init() else TomahawkUtils::setProxy( new QNetworkProxy( QNetworkProxy::NoProxy ) ); - m_infoSystem->newNam(); - Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" ); Echonest::Config::instance()->setNetworkAccessManager( TomahawkUtils::nam() );