mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
First part of more threadsafety, mostly for liblastfm2's qnam
This commit is contained in:
@@ -45,6 +45,7 @@ EchoNestPlugin::~EchoNestPlugin()
|
|||||||
void
|
void
|
||||||
EchoNestPlugin::namChangedSlot()
|
EchoNestPlugin::namChangedSlot()
|
||||||
{
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
Echonest::Config::instance()->setNetworkAccessManager( m_infoSystemWorker->nam() );
|
Echonest::Config::instance()->setNetworkAccessManager( m_infoSystemWorker->nam() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,6 +52,8 @@ LastFmPlugin::LastFmPlugin( InfoSystemWorker* parent )
|
|||||||
supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying;
|
supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying;
|
||||||
parent->registerInfoTypes( this, supportedGetTypes, supportedPushTypes );
|
parent->registerInfoTypes( this, supportedGetTypes, supportedPushTypes );
|
||||||
|
|
||||||
|
connect( parent, SIGNAL( namChanged() ), SLOT( namChangedSlot() ) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Your API Key is 7194b85b6d1f424fe1668173a78c0c4a
|
Your API Key is 7194b85b6d1f424fe1668173a78c0c4a
|
||||||
Your secret is ba80f1df6d27ae63e9cb1d33ccf2052f
|
Your secret is ba80f1df6d27ae63e9cb1d33ccf2052f
|
||||||
@@ -96,6 +98,14 @@ LastFmPlugin::~LastFmPlugin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LastFmPlugin::namChangedSlot()
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
lastfm::setNetworkAccessManager( m_infoSystemWorker->nam() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData )
|
LastFmPlugin::dataError( const QString &caller, const Tomahawk::InfoSystem::InfoType type, const QVariant &input, const Tomahawk::InfoSystem::InfoCustomData &customData )
|
||||||
{
|
{
|
||||||
|
@@ -51,6 +51,8 @@ public slots:
|
|||||||
void coverArtReturned();
|
void coverArtReturned();
|
||||||
void artistImagesReturned();
|
void artistImagesReturned();
|
||||||
|
|
||||||
|
void namChangedSlot();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void getInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
|
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 );
|
virtual void notInCacheSlot( const Tomahawk::InfoSystem::InfoCriteriaHash criteria, const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input, const Tomahawk::InfoSystem::InfoCustomData customData );
|
||||||
|
@@ -66,7 +66,6 @@ InfoSystem::InfoSystem(QObject *parent)
|
|||||||
m_infoSystemWorkerThreadController->start();
|
m_infoSystemWorkerThreadController->start();
|
||||||
|
|
||||||
QMetaObject::invokeMethod( m_worker, "init", Qt::QueuedConnection );
|
QMetaObject::invokeMethod( m_worker, "init", Qt::QueuedConnection );
|
||||||
QMetaObject::invokeMethod( m_worker, "newNam", Qt::QueuedConnection );
|
|
||||||
|
|
||||||
connect( TomahawkSettings::instance(), SIGNAL( changed() ), m_worker, SLOT( newNam() ) );
|
connect( TomahawkSettings::instance(), SIGNAL( changed() ), m_worker, SLOT( newNam() ) );
|
||||||
|
|
||||||
|
@@ -91,6 +91,8 @@ void InfoSystemWorker::init()
|
|||||||
SLOT( updateCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) )
|
SLOT( updateCacheSlot( Tomahawk::InfoSystem::InfoCriteriaHash, qint64, Tomahawk::InfoSystem::InfoType, QVariant ) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod( this, "newNam" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +164,8 @@ InfoSystemWorker::nam() const
|
|||||||
void
|
void
|
||||||
InfoSystemWorker::newNam()
|
InfoSystemWorker::newNam()
|
||||||
{
|
{
|
||||||
QNetworkAccessManager *newNam = new QNetworkAccessManager( this );
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
QNetworkAccessManager *newNam = new QNetworkAccessManager();
|
||||||
if ( m_nam )
|
if ( m_nam )
|
||||||
{
|
{
|
||||||
delete m_nam;
|
delete m_nam;
|
||||||
|
@@ -244,8 +244,6 @@ TomahawkApp::init()
|
|||||||
else
|
else
|
||||||
TomahawkUtils::setProxy( new QNetworkProxy( QNetworkProxy::NoProxy ) );
|
TomahawkUtils::setProxy( new QNetworkProxy( QNetworkProxy::NoProxy ) );
|
||||||
|
|
||||||
m_infoSystem->newNam();
|
|
||||||
|
|
||||||
Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
|
Echonest::Config::instance()->setAPIKey( "JRIHWEP6GPOER2QQ6" );
|
||||||
Echonest::Config::instance()->setNetworkAccessManager( TomahawkUtils::nam() );
|
Echonest::Config::instance()->setNetworkAccessManager( TomahawkUtils::nam() );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user