1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-02-22 19:05:05 +01: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()
elseif(SUBDIRECTORY STREQUAL "twitter")
if(QTWEETLIB_FOUND AND BUILD_GUI)
# add_subdirectory( twitter )
add_subdirectory( twitter )
endif()
else()
add_subdirectory( ${SUBDIRECTORY} )

View File

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

View File

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

View File

@ -50,7 +50,7 @@ public:
QString factoryId() const { return "twitteraccount"; }
QString description() const { return tr( "Connect to your Twitter followers." ); }
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() );
};
@ -73,7 +73,7 @@ public:
Tomahawk::InfoSystem::InfoPluginPtr infoPlugin();
SipPlugin* sipPlugin();
QWidget* configurationWidget() { return m_configWidget.data(); }
AccountConfigWidget* configurationWidget() { return m_configWidget.data(); }
QWidget* aclWidget() { return 0; }
bool refreshTwitterAuth();
@ -94,7 +94,7 @@ private:
bool m_isAuthenticating;
QPointer< TomahawkOAuthTwitter > m_twitterAuth;
QPointer< TwitterConfigWidget > m_configWidget;
QPointer< TwitterSipPlugin > m_twitterSipPlugin;
// QPointer< TwitterSipPlugin > m_twitterSipPlugin;
QPointer< Tomahawk::InfoSystem::TwitterInfoPlugin > m_twitterInfoPlugin;
// for settings access

View File

@ -43,7 +43,7 @@ namespace Accounts
{
TwitterConfigWidget::TwitterConfigWidget( TwitterAccount* account, QWidget *parent ) :
QWidget( parent ),
AccountConfigWidget( parent ),
m_ui( new Ui::TwitterConfigWidget ),
m_account( account )
{
@ -294,4 +294,4 @@ TwitterConfigWidget::postGotTomahawkStatusUpdateError( QTweetNetBase::ErrorCode
}
}
}

View File

@ -27,7 +27,7 @@
#include <QTweetLib/qtweetuser.h>
#include <QTweetLib/qtweetnetbase.h>
#include <QWidget>
#include "accounts/AccountConfigWidget.h"
namespace Ui
{
@ -43,7 +43,7 @@ namespace Accounts
class TwitterAccount;
class ACCOUNTDLLEXPORT TwitterConfigWidget : public QWidget
class ACCOUNTDLLEXPORT TwitterConfigWidget : public AccountConfigWidget
{
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 ) );
int count = idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
.value< QList< Tomahawk::Accounts::Account* > >().count();
QList< AccountWidget* > entryAccounts;
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 )
.value< QList< Tomahawk::Accounts::Account* > >().isEmpty() )
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;

View File

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