1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-25 02:09:48 +01:00

First part of more threadsafety, mostly for liblastfm2's qnam

This commit is contained in:
Jeff Mitchell 2011-05-01 02:19:38 -04:00
parent c2b7ea9411
commit 2a4b0b2956
6 changed files with 17 additions and 4 deletions

View File

@ -45,6 +45,7 @@ EchoNestPlugin::~EchoNestPlugin()
void
EchoNestPlugin::namChangedSlot()
{
qDebug() << Q_FUNC_INFO;
Echonest::Config::instance()->setNetworkAccessManager( m_infoSystemWorker->nam() );
}

View File

@ -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 )
{

View File

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

View File

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

View File

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

View File

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