diff --git a/src/accounts/twitter/CMakeLists.txt b/src/accounts/twitter/CMakeLists.txt index 80587ad75..007ee0f6a 100644 --- a/src/accounts/twitter/CMakeLists.txt +++ b/src/accounts/twitter/CMakeLists.txt @@ -9,27 +9,35 @@ add_definitions( -DDLLEXPORT_PRO ) set( twitterAccountSources twitteraccount.cpp twitterconfigwidget.cpp - tomahawkoauthtwitter.cpp ) set( twitterAccountHeaders twitteraccount.h twitterconfigwidget.h - tomahawkoauthtwitter.h ) set( twitterAccountUI twitterconfigwidget.ui ) +set( tomahawkOAuthTwitterSources + tomahawkoauthtwitter.cpp +) + +set( tomahawkOAuthTwitterHeaders + tomahawkoauthtwitter.h +) + include_directories( . ${CMAKE_CURRENT_BINARY_DIR} .. ${QT_INCLUDE_DIR} ${QTWEETLIB_INCLUDE_DIR} ) -qt4_add_resources( RC_SRCS "resources.qrc" ) +qt4_wrap_cpp( tomahawkOAuthTwitterMoc ${tomahawkOAuthTwitterSources} ) +add_library( tomahawk_oauth_twitter SHARED ${tomahawkOAuthTwitterSources} ${tomahawkOAuthTwitterMoc} ) qt4_wrap_cpp( twitterAccountMoc ${twitterAccountHeaders} ) qt4_wrap_ui( twitterAccountUI_H ${twitterAccountUI} ) +qt4_add_resources( RC_SRCS "resources.qrc" ) add_library( tomahawk_account_twitter SHARED ${twitterAccountUI_H} ${twitterAccountSources} ${twitterAccountMoc} ${RC_SRCS} ) IF( WIN32 ) @@ -40,7 +48,15 @@ SET( OS_SPECIFIC_LINK_LIBRARIES ) ENDIF( WIN32 ) +target_link_libraries( tomahawk_oauth_twitter + ${TOMAHAWK_LIBRARIES} + ${QTWEETLIB_LIBRARIES} + ${QT_LIBRARIES} + ${OS_SPECIFIC_LINK_LIBRARIES} +) + target_link_libraries( tomahawk_account_twitter + tomahawk_oauth_twitter ${TOMAHAWK_LIBRARIES} ${QTWEETLIB_LIBRARIES} ${QT_LIBRARIES} @@ -51,4 +67,5 @@ IF( APPLE ) # SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" ) ENDIF( APPLE ) +install( TARGETS tomahawk_oauth_twitter DESTINATION lib${LIB_SUFFIX} ) install( TARGETS tomahawk_account_twitter DESTINATION lib${LIB_SUFFIX} ) diff --git a/src/diagnosticsdialog.cpp b/src/diagnosticsdialog.cpp index 565032f8c..3d0f8e631 100644 --- a/src/diagnosticsdialog.cpp +++ b/src/diagnosticsdialog.cpp @@ -115,9 +115,9 @@ void DiagnosticsDialog::updateLogView() } log.append( QString(" %2 (%1): %3 (%4)\n") - .arg(sip->name()) + .arg(sip->account()->accountServiceName()) .arg(sip->friendlyName()) - .arg(sip->accountName()) + .arg(sip->account()->accountFriendlyName()) .arg(stateString) ); diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp index 307e6d569..ef56af80f 100644 --- a/src/settingsdialog.cpp +++ b/src/settingsdialog.cpp @@ -128,7 +128,7 @@ SettingsDialog::SettingsDialog( QWidget *parent ) connect( Servent::instance(), SIGNAL( ready() ), this, SLOT( serventReady() ) ); } - setupSipButtons(); + //setupSipButtons(); ui->staticHostName->setText( s->externalHostname() ); ui->staticPort->setValue( s->externalPort() ); @@ -309,7 +309,7 @@ SettingsDialog::createIcons() connect( ui->listWidget, SIGNAL( currentItemChanged( QListWidgetItem*, QListWidgetItem* ) ), SLOT( changePage( QListWidgetItem*, QListWidgetItem* ) ) ); } - +/* void SettingsDialog::setupSipButtons() { @@ -329,7 +329,7 @@ SettingsDialog::setupSipButtons() connect( ui->removeSipButton, SIGNAL( clicked( bool ) ), this, SLOT( sipPluginDeleted( bool ) ) ); } - +*/ void SettingsDialog::changePage( QListWidgetItem* current, QListWidgetItem* previous ) @@ -599,7 +599,7 @@ SettingsDialog::resolverConfigClosed( int value ) } } - +/* void SettingsDialog::sipItemClicked( const QModelIndex& item ) { @@ -814,7 +814,7 @@ SettingsDialog::sipPluginDeleted( bool ) } } } - +*/ ProxyDialog::ProxyDialog( QWidget *parent ) : QDialog( parent ) diff --git a/src/settingsdialog.h b/src/settingsdialog.h index 834ef3880..ef2d53eee 100644 --- a/src/settingsdialog.h +++ b/src/settingsdialog.h @@ -89,6 +89,7 @@ private slots: #endif void openResolverConfig( const QString& ); + /* void sipItemClicked ( const QModelIndex& ); void openSipConfig( SipPlugin* ); void factoryActionTriggered ( bool ); @@ -96,21 +97,22 @@ private slots: void sipContextMenuRequest( const QPoint& ); void sipPluginDeleted( bool ); void sipPluginRowDeleted( bool ); - - void updateScanOptionsView(); - + */ // dialog slots void resolverConfigClosed( int value ); + /* void sipConfigClosed( int value ); void sipCreateConfigClosed( int value ); - + */ + void updateScanOptionsView(); + void changePage( QListWidgetItem*, QListWidgetItem* ); void serventReady(); private: void createIcons(); - void setupSipButtons(); - void handleSipPluginAdded( SipPlugin* p, bool added ); + //void setupSipButtons(); + //void handleSipPluginAdded( SipPlugin* p, bool added ); Ui_StackedSettingsDialog* ui; diff --git a/src/sip/twitter/CMakeLists.txt b/src/sip/twitter/CMakeLists.txt index cac93c6b7..97ee49188 100644 --- a/src/sip/twitter/CMakeLists.txt +++ b/src/sip/twitter/CMakeLists.txt @@ -32,6 +32,8 @@ SET( OS_SPECIFIC_LINK_LIBRARIES ENDIF( WIN32 ) target_link_libraries( tomahawk_siptwitter + tomahawk_oauth_twitter + tomahawk_account_twitter ${TOMAHAWK_LIBRARIES} ${QTWEETLIB_LIBRARIES} ${QT_LIBRARIES} diff --git a/src/sip/twitter/twittersip.cpp b/src/sip/twitter/twittersip.cpp index 0a316f41b..7dcd1b2af 100644 --- a/src/sip/twitter/twittersip.cpp +++ b/src/sip/twitter/twittersip.cpp @@ -37,6 +37,7 @@ #include #include "utils/logger.h" +#include "accounts/twitter/tomahawkoauthtwitter.h" static QString s_gotTomahawkRegex = QString( "^(@[a-zA-Z0-9]+ )?(Got Tomahawk\\?) (\\{[a-fA-F0-9\\-]+\\}) (.*)$" ); @@ -92,13 +93,19 @@ TwitterSipPlugin::connectionState() const } +void TwitterSipPlugin::checkSettings() +{ + //TODO/FIXME: check status and enable/disable? +} + + bool TwitterSipPlugin::connectPlugin() { qDebug() << Q_FUNC_INFO; if ( !m_account->enabled() ) - return; + return false; m_cachedPeers = m_configuration[ "cachedPeers" ].toHash(); QStringList peerList = m_cachedPeers.keys(); @@ -134,7 +141,7 @@ TwitterSipPlugin::refreshTwitterAuth() Q_ASSERT( TomahawkUtils::nam() != 0 ); qDebug() << Q_FUNC_INFO << " with nam " << TomahawkUtils::nam(); - m_twitterAuth = QWeakPointer( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) ); + m_twitterAuth = QWeakPointer< TomahawkOAuthTwitter >( new TomahawkOAuthTwitter( TomahawkUtils::nam(), this ) ); if( m_twitterAuth.isNull() ) return false; @@ -191,7 +198,7 @@ TwitterSipPlugin::connectAuthVerifyReply( const QTweetUser &user ) m_isAuthed = true; if ( !m_twitterAuth.isNull() ) { - m_configuration[ "screenName" ] = user.screenName; + m_configuration[ "screenName" ] = user.screenName(); syncConfig(); m_friendsTimeline = QWeakPointer( new QTweetFriendsTimeline( m_twitterAuth.data(), this ) ); m_mentions = QWeakPointer( new QTweetMentions( m_twitterAuth.data(), this ) ); diff --git a/src/sip/twitter/twittersip.h b/src/sip/twitter/twittersip.h index b3f314d29..65b7ef9f0 100644 --- a/src/sip/twitter/twittersip.h +++ b/src/sip/twitter/twittersip.h @@ -72,6 +72,8 @@ public slots: Q_UNUSED( msg ); } + void checkSettings(); + private slots: void connectAuthVerifyReply( const QTweetUser &user ); void checkTimerFired(); @@ -90,16 +92,11 @@ private slots: void fetchAvatar( const QString &screenName ); void avatarUserDataSlot( const QTweetUser &user ); void profilePicReply(); - + private: inline void syncConfig() { m_account->setCredentials( m_credentials ); m_account->setConfiguration( m_configuration ); m_account->syncConfig(); } bool refreshTwitterAuth(); void parseGotTomahawk( const QRegExp ®ex, const QString &screenName, const QString &text ); - // handle per-plugin config - QString twitterOAuthToken() const; - void setTwitterOAuthToken( const QString& oauthtoken ); - QString twitterOAuthTokenSecret() const; - void setTwitterOAuthTokenSecret( const QString& oauthtokensecret ); QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth; QWeakPointer< QTweetFriendsTimeline > m_friendsTimeline;