1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 09:19:41 +01:00

This should hopefully get rid of the messages about parent being in the wrong thread

This commit is contained in:
Jeff Mitchell 2012-04-09 23:52:06 -04:00
parent 4c5855c95d
commit 25fba84b32
6 changed files with 25 additions and 0 deletions

View File

@ -76,6 +76,7 @@ LastFmAccount::LastFmAccount( const QString& accountId )
{
infoPlugin()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
QMetaObject::invokeMethod( infoPlugin(), "init", Qt::QueuedConnection );
}
}

View File

@ -46,7 +46,17 @@ LastFmPlugin::LastFmPlugin( LastFmAccount* account )
{
m_supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages << InfoArtistSimilars << InfoArtistSongs << InfoChart << InfoChartCapabilities;
m_supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying << InfoLove << InfoUnLove;
}
void
LastFmPlugin::init()
{
if ( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread() && thread() != Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() )
{
tDebug() << "Failure: move to the worker thread before running init";
return;
}
// Flush session key cache
// TODO WHY FLUSH
// m_account->setSessionKey( QByteArray() );

View File

@ -49,6 +49,7 @@ public:
virtual ~LastFmPlugin();
public slots:
void init();
void settingsChanged();
void onAuthenticated();

View File

@ -192,6 +192,7 @@ TwitterAccount::connectAuthVerifyReply( const QTweetUser &user )
{
infoPlugin()->moveToThread( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() );
Tomahawk::InfoSystem::InfoSystem::instance()->addInfoPlugin( infoPlugin() );
QMetaObject::invokeMethod( infoPlugin(), "init", Qt::QueuedConnection );
}
m_isAuthenticated = true;

View File

@ -38,7 +38,18 @@ TwitterInfoPlugin::TwitterInfoPlugin( Tomahawk::Accounts::TwitterAccount* accoun
: m_account( account )
{
m_supportedPushTypes << InfoLove;
}
void
TwitterInfoPlugin::init()
{
if ( Tomahawk::InfoSystem::InfoSystem::instance()->workerThread() && thread() != Tomahawk::InfoSystem::InfoSystem::instance()->workerThread().data() )
{
tDebug() << "Failure: move to the worker thread before running init";
return;
}
QVariantHash credentials = m_account->credentials();
if ( credentials[ "oauthtoken" ].toString().isEmpty() || credentials[ "oauthtokensecret" ].toString().isEmpty() )
{

View File

@ -44,6 +44,7 @@ namespace Tomahawk {
virtual ~TwitterInfoPlugin();
public slots:
void init();
void notInCacheSlot( const Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
{
Q_UNUSED( criteria );