1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-02 02:12:47 +02:00

Switch around when the oauthtwitter gets its nam and add some debug

This commit is contained in:
Jeff Mitchell
2011-05-03 14:18:05 -04:00
parent b42e36a240
commit fe478a0759
5 changed files with 14 additions and 15 deletions

View File

@@ -142,16 +142,18 @@ TwitterPlugin::connectPlugin( bool /*startup*/ )
bool bool
TwitterPlugin::refreshTwitterAuth() TwitterPlugin::refreshTwitterAuth()
{ {
qDebug() << Q_FUNC_INFO << " begin";
if( !m_twitterAuth.isNull() ) if( !m_twitterAuth.isNull() )
delete m_twitterAuth.data(); delete m_twitterAuth.data();
m_twitterAuth = QWeakPointer<TomahawkOAuthTwitter>( new TomahawkOAuthTwitter( this ) );
qDebug() << Q_FUNC_INFO << " with nam " << TomahawkUtils::nam();
m_twitterAuth = QWeakPointer<TomahawkOAuthTwitter>( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) );
if( m_twitterAuth.isNull() ) if( m_twitterAuth.isNull() )
return false; return false;
TomahawkSettings *settings = TomahawkSettings::instance(); TomahawkSettings *settings = TomahawkSettings::instance();
m_twitterAuth.data()->setNetworkAccessManager( TomahawkUtils::nam() );
m_twitterAuth.data()->setOAuthToken( settings->twitterOAuthToken().toLatin1() ); m_twitterAuth.data()->setOAuthToken( settings->twitterOAuthToken().toLatin1() );
m_twitterAuth.data()->setOAuthTokenSecret( settings->twitterOAuthTokenSecret().toLatin1() ); m_twitterAuth.data()->setOAuthTokenSecret( settings->twitterOAuthTokenSecret().toLatin1() );

View File

@@ -94,8 +94,7 @@ void
TwitterConfigWidget::authenticateTwitter() TwitterConfigWidget::authenticateTwitter()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this ); TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this );
twitAuth->setNetworkAccessManager( TomahawkUtils::nam() );
twitAuth->authorizePin(); twitAuth->authorizePin();
TomahawkSettings* s = TomahawkSettings::instance(); TomahawkSettings* s = TomahawkSettings::instance();
@@ -207,8 +206,7 @@ TwitterConfigWidget::startPostGotTomahawkStatus()
emit twitterAuthed( false ); emit twitterAuthed( false );
return; return;
} }
TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this ); TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this );
twitAuth->setNetworkAccessManager( TomahawkUtils::nam() );
twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() ); twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() );
twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() ); twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() );
QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( twitAuth, this ); QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( twitAuth, this );
@@ -227,8 +225,7 @@ TwitterConfigWidget::postGotTomahawkStatusAuthVerifyReply( const QTweetUser &use
} }
TomahawkSettings* s = TomahawkSettings::instance(); TomahawkSettings* s = TomahawkSettings::instance();
s->setTwitterScreenName( user.screenName() ); s->setTwitterScreenName( user.screenName() );
TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( this ); TomahawkOAuthTwitter *twitAuth = new TomahawkOAuthTwitter( TomahawkUtils::nam(), this );
twitAuth->setNetworkAccessManager( TomahawkUtils::nam() );
twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() ); twitAuth->setOAuthToken( s->twitterOAuthToken().toLatin1() );
twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() ); twitAuth->setOAuthTokenSecret( s->twitterOAuthTokenSecret().toLatin1() );
if ( m_postGTtype != "Direct Message" ) if ( m_postGTtype != "Direct Message" )

View File

@@ -206,7 +206,7 @@ lastfm::nam()
NetworkAccessManager* newNam = new NetworkAccessManager(); NetworkAccessManager* newNam = new NetworkAccessManager();
threadNamHash[thread] = newNam; threadNamHash[thread] = newNam;
ourNamHash[thread] = true; ourNamHash[thread] = true;
qDebug() << Q_FUNC_INFO << " returning " << dynamic_cast<QNetworkAccessManager*>(newNam); qDebug() << Q_FUNC_INFO << " returning " << threadNamHash[thread];
return newNam; return newNam;
} }
qDebug() << Q_FUNC_INFO << " found a nam, is " << threadNamHash[thread]; qDebug() << Q_FUNC_INFO << " found a nam, is " << threadNamHash[thread];

View File

@@ -2,8 +2,8 @@
#include <QInputDialog> #include <QInputDialog>
#include <QDebug> #include <QDebug>
TomahawkOAuthTwitter::TomahawkOAuthTwitter( QObject* parent ) TomahawkOAuthTwitter::TomahawkOAuthTwitter( QNetworkAccessManager *nam, QObject* parent )
: OAuthTwitter( parent ) : OAuthTwitter( nam, parent )
{ {
} }

View File

@@ -10,7 +10,7 @@ class QTWEETLIBSHARED_EXPORT TomahawkOAuthTwitter : public OAuthTwitter
Q_OBJECT Q_OBJECT
public: public:
TomahawkOAuthTwitter( QObject *parent = 0 ); TomahawkOAuthTwitter( QNetworkAccessManager *nam, QObject *parent = 0 );
~TomahawkOAuthTwitter() {} ~TomahawkOAuthTwitter() {}