1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-02 04:10:20 +02:00

Bring back Twitter, but only for social actions.

SIP is disabled.
This commit is contained in:
Teo Mrnjavac
2013-04-01 20:15:52 +02:00
parent 49be0e77cf
commit f134be44b1
9 changed files with 36 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ foreach(SUBDIRECTORY ${SUBDIRECTORIES})
endif() endif()
elseif(SUBDIRECTORY STREQUAL "twitter") elseif(SUBDIRECTORY STREQUAL "twitter")
if(QTWEETLIB_FOUND AND BUILD_GUI) if(QTWEETLIB_FOUND AND BUILD_GUI)
# add_subdirectory( twitter ) add_subdirectory( twitter )
endif() endif()
else() else()
add_subdirectory( ${SUBDIRECTORY} ) add_subdirectory( ${SUBDIRECTORY} )

View File

@@ -9,7 +9,7 @@ tomahawk_add_plugin(twitter
TwitterInfoPlugin.cpp TwitterInfoPlugin.cpp
TwitterConfigWidget.cpp TwitterConfigWidget.cpp
TomahawkOAuthTwitter.cpp TomahawkOAuthTwitter.cpp
sip/TwitterSip.cpp # sip/TwitterSip.cpp
UI UI
TwitterConfigWidget.ui TwitterConfigWidget.ui
LINK_LIBRARIES LINK_LIBRARIES

View File

@@ -23,7 +23,7 @@
#include "accounts/twitter/TomahawkOAuthTwitter.h" #include "accounts/twitter/TomahawkOAuthTwitter.h"
#include "libtomahawk/infosystem/InfoSystem.h" #include "libtomahawk/infosystem/InfoSystem.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "sip/SipPlugin.h" //#include "sip/SipPlugin.h"
#include <QTweetLib/qtweetaccountverifycredentials.h> #include <QTweetLib/qtweetaccountverifycredentials.h>
#include <QTweetLib/qtweetuser.h> #include <QTweetLib/qtweetuser.h>
@@ -51,7 +51,7 @@ TwitterAccount::TwitterAccount( const QString &accountId )
, m_isAuthenticating( false ) , m_isAuthenticating( false )
{ {
setAccountServiceName( "Twitter" ); setAccountServiceName( "Twitter" );
setTypes( AccountTypes( StatusPushType | SipType ) ); setTypes( AccountTypes( StatusPushType ) );
qDebug() << "Got cached peers:" << configuration() << configuration()[ "cachedpeers" ]; qDebug() << "Got cached peers:" << configuration() << configuration()[ "cachedpeers" ];
@@ -86,24 +86,25 @@ TwitterAccount::configDialogAuthedSignalSlot( bool authed )
Account::ConnectionState Account::ConnectionState
TwitterAccount::connectionState() const TwitterAccount::connectionState() const
{ {
if ( m_twitterSipPlugin.isNull() ) // if ( m_twitterSipPlugin.isNull() )
return Account::Disconnected; return Account::Disconnected;
return m_twitterSipPlugin.data()->connectionState(); // return m_twitterSipPlugin.data()->connectionState();
} }
SipPlugin* SipPlugin*
TwitterAccount::sipPlugin() TwitterAccount::sipPlugin()
{ {
if ( m_twitterSipPlugin.isNull() ) // if ( m_twitterSipPlugin.isNull() )
{ // {
qDebug() << "CHECKING:" << configuration() << configuration()[ "cachedpeers" ]; // qDebug() << "CHECKING:" << configuration() << configuration()[ "cachedpeers" ];
m_twitterSipPlugin = QPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) ); // m_twitterSipPlugin = QPointer< TwitterSipPlugin >( new TwitterSipPlugin( this ) );
connect( m_twitterSipPlugin.data(), SIGNAL( stateChanged( Tomahawk::Accounts::Account::ConnectionState ) ), this, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) ); // connect( m_twitterSipPlugin.data(), SIGNAL( stateChanged( Tomahawk::Accounts::Account::ConnectionState ) ), this, SIGNAL( connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState ) ) );
return m_twitterSipPlugin.data(); // return m_twitterSipPlugin.data();
} // }
return m_twitterSipPlugin.data(); // return m_twitterSipPlugin.data();
return 0;
} }
@@ -169,8 +170,8 @@ TwitterAccount::deauthenticate()
{ {
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO;
if ( m_twitterSipPlugin ) // if ( m_twitterSipPlugin )
sipPlugin()->disconnectPlugin(); // sipPlugin()->disconnectPlugin();
if ( m_twitterInfoPlugin ) if ( m_twitterInfoPlugin )
Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( m_twitterInfoPlugin.data() ); Tomahawk::InfoSystem::InfoSystem::instance()->removeInfoPlugin( m_twitterInfoPlugin.data() );
@@ -221,7 +222,7 @@ TwitterAccount::connectAuthVerifyReply( const QTweetUser &user )
setConfiguration( config ); setConfiguration( config );
sync(); sync();
sipPlugin()->connectPlugin(); // sipPlugin()->connectPlugin();
m_isAuthenticated = true; m_isAuthenticated = true;
emit nowAuthenticated( m_twitterAuth, user ); emit nowAuthenticated( m_twitterAuth, user );

View File

@@ -50,7 +50,7 @@ public:
QString factoryId() const { return "twitteraccount"; } QString factoryId() const { return "twitteraccount"; }
QString description() const { return tr( "Connect to your Twitter followers." ); } QString description() const { return tr( "Connect to your Twitter followers." ); }
QPixmap icon() const { return QPixmap( ":/twitter-account/twitter-icon.png" ); } QPixmap icon() const { return QPixmap( ":/twitter-account/twitter-icon.png" ); }
AccountTypes types() const { return AccountTypes( SipType | StatusPushType ); }; AccountTypes types() const { return AccountTypes( StatusPushType ); };
Account* createAccount( const QString& pluginId = QString() ); Account* createAccount( const QString& pluginId = QString() );
}; };
@@ -73,7 +73,7 @@ public:
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin(); Tomahawk::InfoSystem::InfoPluginPtr infoPlugin();
SipPlugin* sipPlugin(); SipPlugin* sipPlugin();
QWidget* configurationWidget() { return m_configWidget.data(); } AccountConfigWidget* configurationWidget() { return m_configWidget.data(); }
QWidget* aclWidget() { return 0; } QWidget* aclWidget() { return 0; }
bool refreshTwitterAuth(); bool refreshTwitterAuth();
@@ -94,7 +94,7 @@ private:
bool m_isAuthenticating; bool m_isAuthenticating;
QPointer< TomahawkOAuthTwitter > m_twitterAuth; QPointer< TomahawkOAuthTwitter > m_twitterAuth;
QPointer< TwitterConfigWidget > m_configWidget; QPointer< TwitterConfigWidget > m_configWidget;
QPointer< TwitterSipPlugin > m_twitterSipPlugin; // QPointer< TwitterSipPlugin > m_twitterSipPlugin;
QPointer< Tomahawk::InfoSystem::TwitterInfoPlugin > m_twitterInfoPlugin; QPointer< Tomahawk::InfoSystem::TwitterInfoPlugin > m_twitterInfoPlugin;
// for settings access // for settings access

View File

@@ -43,7 +43,7 @@ namespace Accounts
{ {
TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *parent ) : TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *parent ) :
QWidget( parent ), AccountConfigWidget( parent ),
m_ui( new Ui::TwitterConfigWidget ), m_ui( new Ui::TwitterConfigWidget ),
m_account( account ) m_account( account )
{ {

View File

@@ -27,7 +27,7 @@
#include <QTweetLib/qtweetuser.h> #include <QTweetLib/qtweetuser.h>
#include <QTweetLib/qtweetnetbase.h> #include <QTweetLib/qtweetnetbase.h>
#include <QWidget> #include "accounts/AccountConfigWidget.h"
namespace Ui namespace Ui
{ {
@@ -43,7 +43,7 @@ namespace Accounts
class TwitterAccount; class TwitterAccount;
class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget class ACCOUNTDLLEXPORT TwitterConfigWidget : public AccountConfigWidget
{ {
Q_OBJECT Q_OBJECT

View File

@@ -138,6 +138,7 @@ AccountListWidget::insertEntries( const QModelIndex& parent, int start, int end
QPersistentModelIndex idx( m_model->index( i, 0, parent ) ); QPersistentModelIndex idx( m_model->index( i, 0, parent ) );
int count = idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole ) int count = idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
.value< QList< Tomahawk::Accounts::Account* > >().count(); .value< QList< Tomahawk::Accounts::Account* > >().count();
QList< AccountWidget* > entryAccounts; QList< AccountWidget* > entryAccounts;
for ( int j = 0; j < count; ++j ) for ( int j = 0; j < count; ++j )
{ {

View File

@@ -47,6 +47,10 @@ AccountModelFactoryProxy::filterAcceptsRow( int sourceRow, const QModelIndex& so
if ( idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole ) if ( idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
.value< QList< Tomahawk::Accounts::Account* > >().isEmpty() ) .value< QList< Tomahawk::Accounts::Account* > >().isEmpty() )
return false; return false;
Tomahawk::Accounts::AccountFactory* factory = qobject_cast< Tomahawk::Accounts::AccountFactory* >( idx.data( Tomahawk::Accounts::AccountModel::AccountData ).value< QObject* >() );
if ( factory && factory->factoryId() == "twitteraccount" )
return false;
} }
return rowType == m_filterRowType; return rowType == m_filterRowType;

View File

@@ -314,10 +314,13 @@ AccountWidget::setupConnections( const QPersistentModelIndex& idx, int accountId
connect( m_inviteEdit, SIGNAL( returnPressed() ), connect( m_inviteEdit, SIGNAL( returnPressed() ),
this, SLOT( sendInvite() ) ); this, SLOT( sendInvite() ) );
if ( account->sipPlugin() )
{
m_inviteEdit->setPlaceholderText( account->sipPlugin()->inviteString() ); m_inviteEdit->setPlaceholderText( account->sipPlugin()->inviteString() );
connect( account->sipPlugin(), SIGNAL( inviteSentSuccess( QString ) ), SLOT( onInviteSentSuccess( QString ) ) ); connect( account->sipPlugin(), SIGNAL( inviteSentSuccess( QString ) ), SLOT( onInviteSentSuccess( QString ) ) );
connect( account->sipPlugin(), SIGNAL( inviteSentFailure( QString ) ), SLOT( onInviteSentFailure( QString ) ) ); connect( account->sipPlugin(), SIGNAL( inviteSentFailure( QString ) ), SLOT( onInviteSentFailure( QString ) ) );
} }
}
} }
void void