1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 18:04:05 +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

@@ -131,9 +131,9 @@ TwitterPlugin::connectPlugin( bool /*startup*/ )
if ( refreshTwitterAuth() )
{
QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this );
connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) );
credVerifier->verify();
QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this );
connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) );
credVerifier->verify();
}
return true;
@@ -142,16 +142,18 @@ TwitterPlugin::connectPlugin( bool /*startup*/ )
bool
TwitterPlugin::refreshTwitterAuth()
{
qDebug() << Q_FUNC_INFO << " begin";
if( !m_twitterAuth.isNull() )
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() )
return false;
TomahawkSettings *settings = TomahawkSettings::instance();
m_twitterAuth.data()->setNetworkAccessManager( TomahawkUtils::nam() );
m_twitterAuth.data()->setOAuthToken( settings->twitterOAuthToken().toLatin1() );
m_twitterAuth.data()->setOAuthTokenSecret( settings->twitterOAuthTokenSecret().toLatin1() );

View File

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

View File

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

View File

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

View File

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