1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 21:57:41 +02:00

* Disable Spotify playlist syncing.

This commit is contained in:
Christian Muehlhaeuser
2014-10-11 03:00:24 +02:00
parent eb2b9ecd76
commit 42cd93bd2e
7 changed files with 96 additions and 91 deletions

View File

@@ -221,7 +221,7 @@ list(APPEND libSources
accounts/spotify/SpotifyAccount.cpp accounts/spotify/SpotifyAccount.cpp
accounts/spotify/SpotifyAccountConfig.cpp accounts/spotify/SpotifyAccountConfig.cpp
accounts/spotify/SpotifyPlaylistUpdater.cpp # accounts/spotify/SpotifyPlaylistUpdater.cpp
accounts/spotify/SpotifyInfoPlugin.cpp accounts/spotify/SpotifyInfoPlugin.cpp
audio/AudioEngine.cpp audio/AudioEngine.cpp

View File

@@ -38,7 +38,7 @@
#include "SourceList.h" #include "SourceList.h"
#include "SpotifyAccountConfig.h" #include "SpotifyAccountConfig.h"
#include "SpotifyInfoPlugin.h" #include "SpotifyInfoPlugin.h"
#include "SpotifyPlaylistUpdater.h" //#include "SpotifyPlaylistUpdater.h"
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "Track.h" #include "Track.h"
@@ -490,7 +490,7 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
action->setVisible( true ); action->setVisible( true );
QList<PlaylistUpdaterInterface*> updaters = playlist->updaters(); /* QList<PlaylistUpdaterInterface*> updaters = playlist->updaters();
foreach ( PlaylistUpdaterInterface* updater, updaters ) foreach ( PlaylistUpdaterInterface* updater, updaters )
{ {
if ( SpotifyPlaylistUpdater* spotifyUpdater = qobject_cast< SpotifyPlaylistUpdater* >( updater ) ) if ( SpotifyPlaylistUpdater* spotifyUpdater = qobject_cast< SpotifyPlaylistUpdater* >( updater ) )
@@ -509,7 +509,7 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
sync = true; sync = true;
} }
} }*/
const ActionType actionType = static_cast< ActionType >( action->data().toInt() ); const ActionType actionType = static_cast< ActionType >( action->data().toInt() );
@@ -583,7 +583,7 @@ SpotifyAccount::aboutToShow( QAction* action, const playlist_ptr& playlist )
} }
SpotifyPlaylistUpdater* /*SpotifyPlaylistUpdater*
SpotifyAccount::getPlaylistUpdater( const playlist_ptr plptr ) SpotifyAccount::getPlaylistUpdater( const playlist_ptr plptr )
{ {
SpotifyPlaylistUpdater* updater = 0; SpotifyPlaylistUpdater* updater = 0;
@@ -602,7 +602,6 @@ SpotifyAccount::getPlaylistUpdater( const playlist_ptr plptr )
SpotifyPlaylistUpdater* SpotifyPlaylistUpdater*
SpotifyAccount::getPlaylistUpdater( QObject *sender ) SpotifyAccount::getPlaylistUpdater( QObject *sender )
{ {
if ( !sender ) if ( !sender )
{ {
tLog() << "uuh noo, null sender!"; tLog() << "uuh noo, null sender!";
@@ -621,7 +620,7 @@ SpotifyAccount::getPlaylistUpdater( QObject *sender )
if ( playlist.isNull() ) if ( playlist.isNull() )
{ {
qWarning() << "Got context menu spotify action " << senderAction->text() << "triggered, but invalid playlist payload!"; qWarning() << "Got context menu spotify action" << senderAction->text() << "triggered, but invalid playlist payload!";
Q_ASSERT( false ); Q_ASSERT( false );
return 0; return 0;
} }
@@ -636,10 +635,10 @@ SpotifyAccount::getPlaylistUpdater( QObject *sender )
} }
} }
return updater; return updater;
} }*/
void /*void
SpotifyAccount::subscribeActionTriggered( QAction* action ) SpotifyAccount::subscribeActionTriggered( QAction* action )
{ {
SpotifyPlaylistUpdater* updater = getPlaylistUpdater( action ); SpotifyPlaylistUpdater* updater = getPlaylistUpdater( action );
@@ -796,17 +795,17 @@ SpotifyAccount::setSubscribedForPlaylist( const playlist_ptr& playlist, bool sub
updater->setSync( subscribed ); updater->setSync( subscribed );
updater->setSubscribedStatus( subscribed ); updater->setSubscribedStatus( subscribed );
} }*/
playlist_ptr /*playlist_ptr
SpotifyAccount::playlistFromAction( QAction* action ) const SpotifyAccount::playlistFromAction( QAction* action ) const
{ {
if ( !action || !m_customActions.contains( action ) ) if ( !action || !m_customActions.contains( action ) )
return playlist_ptr(); return playlist_ptr();
return action->property( "payload" ).value< playlist_ptr >(); return action->property( "payload" ).value< playlist_ptr >();
} }*/
void void
@@ -855,7 +854,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
} }
else if ( msgType == "allPlaylists" ) else if ( msgType == "allPlaylists" )
{ {
const QVariantList playlists = msg.value( "playlists" ).toList(); /* const QVariantList playlists = msg.value( "playlists" ).toList();
qDeleteAll( m_allSpotifyPlaylists.values() ); qDeleteAll( m_allSpotifyPlaylists.values() );
m_allSpotifyPlaylists.clear(); m_allSpotifyPlaylists.clear();
@@ -882,11 +881,11 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
if ( !m_configWidget.isNull() ) if ( !m_configWidget.isNull() )
{ {
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() ); m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() );
} }*/
} }
else if ( msgType == "tracksAdded" ) else if ( msgType == "tracksAdded" )
{ {
const QString plid = msg.value( "playlistid" ).toString(); /* const QString plid = msg.value( "playlistid" ).toString();
// We should already be syncing this playlist if we get updates for it // We should already be syncing this playlist if we get updates for it
// Q_ASSERT( m_updaters.contains( plid ) ); // Q_ASSERT( m_updaters.contains( plid ) );
@@ -913,11 +912,11 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
const QString newRev = msg.value( "revid" ).toString(); const QString newRev = msg.value( "revid" ).toString();
const QString oldRev = msg.value( "oldRev" ).toString(); const QString oldRev = msg.value( "oldRev" ).toString();
updater->spotifyTracksAdded( tracksList, startPos, newRev, oldRev ); updater->spotifyTracksAdded( tracksList, startPos, newRev, oldRev );*/
} }
else if ( msgType == "tracksRemoved" ) else if ( msgType == "tracksRemoved" )
{ {
const QString plid = msg.value( "playlistid" ).toString(); /* const QString plid = msg.value( "playlistid" ).toString();
if ( !m_updaters.contains( plid ) ) if ( !m_updaters.contains( plid ) )
{ {
@@ -951,11 +950,11 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
const QString newRev = msg.value( "revid" ).toString(); const QString newRev = msg.value( "revid" ).toString();
const QString oldRev = msg.value( "oldRev" ).toString(); const QString oldRev = msg.value( "oldRev" ).toString();
updater->spotifyTracksRemoved( tracksList, newRev, oldRev ); updater->spotifyTracksRemoved( tracksList, newRev, oldRev );*/
} }
else if ( msgType == "tracksMoved" ) else if ( msgType == "tracksMoved" )
{ {
const QString plid = msg.value( "playlistid" ).toString(); /* const QString plid = msg.value( "playlistid" ).toString();
// We should already be syncing this playlist if we get updates for it // We should already be syncing this playlist if we get updates for it
// Q_ASSERT( m_updaters.contains( plid ) ); // Q_ASSERT( m_updaters.contains( plid ) );
@@ -976,11 +975,11 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
const QString newRev = msg.value( "revid" ).toString(); const QString newRev = msg.value( "revid" ).toString();
const QString oldRev = msg.value( "oldRev" ).toString(); const QString oldRev = msg.value( "oldRev" ).toString();
updater->spotifyTracksMoved( tracksList, newStartPos, newRev, oldRev ); updater->spotifyTracksMoved( tracksList, newStartPos, newRev, oldRev );*/
} }
else if ( msgType == "starredChanged" ) else if ( msgType == "starredChanged" )
{ {
if ( loveSync() ) /* if ( loveSync() )
{ {
const QVariantList tracksList = msg.value( "tracks" ).toList(); const QVariantList tracksList = msg.value( "tracks" ).toList();
const bool love = msg.value( "starred" ).toBool(); const bool love = msg.value( "starred" ).toBool();
@@ -990,11 +989,11 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
{ {
query->track()->setLoved( love ); query->track()->setLoved( love );
} }
} }*/
} }
else if ( msgType == "playlistMetadataChanged" ) else if ( msgType == "playlistMetadataChanged" )
{ {
const QString plid = msg.value( "id" ).toString(); /* const QString plid = msg.value( "id" ).toString();
// We should already be syncing this playlist if we get updates for it // We should already be syncing this playlist if we get updates for it
//Q_ASSERT( m_updaters.contains( plid ) ); //Q_ASSERT( m_updaters.contains( plid ) );
@@ -1033,7 +1032,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
{ {
tLog() << "Updateing number of subscribers" << subscribers; tLog() << "Updateing number of subscribers" << subscribers;
updater->setSubscribers( subscribers ); updater->setSubscribers( subscribers );
} }*/
} }
else if ( msgType == "spotifyError" ) else if ( msgType == "spotifyError" )
{ {
@@ -1071,7 +1070,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
if ( success ) if ( success )
{ {
createActions(); // createActions();
s_instance = this; s_instance = this;
} }
configurationWidget(); // ensure it's created so we can set the login button configurationWidget(); // ensure it's created so we can set the login button
@@ -1083,13 +1082,13 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
} }
else if ( msgType == "playlistDeleted" ) else if ( msgType == "playlistDeleted" )
{ {
const QString plid = msg.value( "playlistid" ).toString(); /* const QString plid = msg.value( "playlistid" ).toString();
if ( !m_updaters.contains( plid ) ) if ( !m_updaters.contains( plid ) )
return; return;
SpotifyPlaylistUpdater* updater = m_updaters.take( plid ); SpotifyPlaylistUpdater* updater = m_updaters.take( plid );
updater->remove( false ); updater->remove( false );*/
} }
else if ( msgType == "status" ) else if ( msgType == "status" )
{ {
@@ -1117,15 +1116,15 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
void void
SpotifyAccount::clearUser( bool permanentlyDelete ) SpotifyAccount::clearUser( bool permanentlyDelete )
{ {
foreach( SpotifyPlaylistUpdater* updater, m_updaters.values() ) /* foreach( SpotifyPlaylistUpdater* updater, m_updaters.values() )
{ {
if ( permanentlyDelete ) if ( permanentlyDelete )
updater->remove( false ); updater->remove( false );
else else
updater->deleteLater(); updater->deleteLater();
} }*/
m_updaters.clear(); // m_updaters.clear();
qDeleteAll( m_allSpotifyPlaylists.values() ); qDeleteAll( m_allSpotifyPlaylists.values() );
m_allSpotifyPlaylists.clear(); m_allSpotifyPlaylists.clear();
@@ -1133,7 +1132,7 @@ SpotifyAccount::clearUser( bool permanentlyDelete )
m_qidToSlotMap.clear(); m_qidToSlotMap.clear();
m_waitingForCreateReply.clear(); m_waitingForCreateReply.clear();
removeActions(); // removeActions();
} }
@@ -1153,7 +1152,7 @@ SpotifyAccount::configurationWidget()
if ( m_configWidget.isNull() ) if ( m_configWidget.isNull() )
{ {
m_configWidget = QPointer< SpotifyAccountConfig >( new SpotifyAccountConfig( this ) ); m_configWidget = QPointer< SpotifyAccountConfig >( new SpotifyAccountConfig( this ) );
connect( m_configWidget.data(), SIGNAL( login( QString,QString ) ), this, SLOT( login( QString,QString ) ) ); connect( m_configWidget.data(), SIGNAL( login( QString, QString ) ), this, SLOT( login( QString, QString ) ) );
connect( m_configWidget.data(), SIGNAL( logout() ), this, SLOT( logout() ) ); connect( m_configWidget.data(), SIGNAL( logout() ), this, SLOT( logout() ) );
connect( m_configWidget.data(), SIGNAL( updatePrivacy( bool ) ), this, SLOT( privateModeChanged() ) ); connect( m_configWidget.data(), SIGNAL( updatePrivacy( bool ) ), this, SLOT( privateModeChanged() ) );
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() ); m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() );
@@ -1216,7 +1215,7 @@ SpotifyAccount::saveConfig()
setConfiguration( config ); setConfiguration( config );
m_configWidget.data()->saveSettings(); m_configWidget.data()->saveSettings();
foreach ( SpotifyPlaylistInfo* pl, m_allSpotifyPlaylists.values() ) /* foreach ( SpotifyPlaylistInfo* pl, m_allSpotifyPlaylists.values() )
{ {
// tLog( LOGVERBOSE ) << "Checking changed state:" << pl->changed << "name:" << pl->name << "sync" << pl->sync << "starred:" << pl->starContainer; // tLog( LOGVERBOSE ) << "Checking changed state:" << pl->changed << "name:" << pl->name << "sync" << pl->sync << "starred:" << pl->starContainer;
if ( pl->changed ) if ( pl->changed )
@@ -1231,7 +1230,7 @@ SpotifyAccount::saveConfig()
else else
stopPlaylistSync( pl ); stopPlaylistSync( pl );
} }
} }*/
sync(); sync();
if ( !m_configWidget.data()->loggedInManually() && !m_configWidget.data()->username().isEmpty() && !m_configWidget.data()->password().isEmpty() ) if ( !m_configWidget.data()->loggedInManually() && !m_configWidget.data()->username().isEmpty() && !m_configWidget.data()->password().isEmpty() )
@@ -1266,7 +1265,7 @@ SpotifyAccount::logout()
} }
void /*void
SpotifyAccount::startPlaylistSync( SpotifyPlaylistInfo* playlist ) SpotifyAccount::startPlaylistSync( SpotifyPlaylistInfo* playlist )
{ {
if ( !playlist ) if ( !playlist )
@@ -1288,11 +1287,10 @@ SpotifyAccount::startPlaylistSync( SpotifyPlaylistInfo* playlist )
msg[ "_msgtype" ] = "getPlaylist"; msg[ "_msgtype" ] = "getPlaylist";
sendMessage( msg, this, "startPlaylistSyncWithPlaylist" ); sendMessage( msg, this, "startPlaylistSyncWithPlaylist" );
} }
}*/
}
void /*void
SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVariantMap& msg, const QVariant& ) SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVariantMap& msg, const QVariant& )
{ {
Q_UNUSED( msgType ); Q_UNUSED( msgType );
@@ -1307,7 +1305,7 @@ SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVa
QVariantList tracks = msg.value( "tracks" ).toList(); QVariantList tracks = msg.value( "tracks" ).toList();
// create a list of query/plentries directly // create a list of query/plentries directly
QList< query_ptr > queries = SpotifyPlaylistUpdater::variantToQueries( tracks ); QList< query_ptr > queries = SpotifyPlaylistUpdater::variantToQueries( tracks );*/
/** /**
* Begin syncing a playlist. Two options: * Begin syncing a playlist. Two options:
* 1) This is a playlist that has never been synced to tomahawk. Create a new one * 1) This is a playlist that has never been synced to tomahawk. Create a new one
@@ -1316,7 +1314,7 @@ SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVa
* with an inactive SpotifyPlaylistUpdater, so just enable it and bring it up to date by merging current with new * with an inactive SpotifyPlaylistUpdater, so just enable it and bring it up to date by merging current with new
* TODO: show a warning( "Do you want to overwrite with spotify's version?" ) * TODO: show a warning( "Do you want to overwrite with spotify's version?" )
*/ */
if ( m_updaters.contains( id ) ) /* if ( m_updaters.contains( id ) )
{ {
//Q_ASSERT( m_updaters[ id ]->sync() == false ); /// Should have been unchecked/off before, but might not be if the user //Q_ASSERT( m_updaters[ id ]->sync() == false ); /// Should have been unchecked/off before, but might not be if the user
// changed spotify resolver meanwhile, so allow it for now // changed spotify resolver meanwhile, so allow it for now
@@ -1350,10 +1348,10 @@ SpotifyAccount::startPlaylistSyncWithPlaylist( const QString& msgType, const QVa
updater->setCollaborative( collaborative ); updater->setCollaborative( collaborative );
m_updaters[ id ] = updater; m_updaters[ id ] = updater;
} }
} }*/
void /*void
SpotifyAccount::playlistCopyCreated( const QString& msgType, const QVariantMap& msg, const QVariant& ) SpotifyAccount::playlistCopyCreated( const QString& msgType, const QVariantMap& msg, const QVariant& )
{ {
Q_UNUSED( msgType ); Q_UNUSED( msgType );
@@ -1381,10 +1379,10 @@ SpotifyAccount::playlistCopyCreated( const QString& msgType, const QVariantMap&
SpotifyPlaylistInfo *info = new SpotifyPlaylistInfo( title, id, revid, true, false, true ); SpotifyPlaylistInfo *info = new SpotifyPlaylistInfo( title, id, revid, true, false, true );
startPlaylistSync( info ); startPlaylistSync( info );
} }*/
void /*void
SpotifyAccount::playlistCreated( const QString& msgType, const QVariantMap& msg, const QVariant& ) SpotifyAccount::playlistCreated( const QString& msgType, const QVariantMap& msg, const QVariant& )
{ {
Q_UNUSED( msgType ); Q_UNUSED( msgType );
@@ -1413,7 +1411,7 @@ SpotifyAccount::playlistCreated( const QString& msgType, const QVariantMap& msg,
updater->setOwner( true ); updater->setOwner( true );
updater->setSync( true ); updater->setSync( true );
m_updaters[ id ] = updater; m_updaters[ id ] = updater;
} }*/
QString QString
@@ -1437,7 +1435,7 @@ SpotifyAccount::sendMessage( const QVariantMap &m, QObject* obj, const QString&
} }
bool /*bool
SpotifyAccount::hasPlaylist(const QString& plId) SpotifyAccount::hasPlaylist(const QString& plId)
{ {
return m_updaters.contains( plId ); return m_updaters.contains( plId );
@@ -1454,8 +1452,8 @@ SpotifyAccount::playlistForURI(const QString& plId)
void void
SpotifyAccount::registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylistUpdater* updater ) SpotifyAccount::registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylistUpdater* updater )
{ {
m_updaters[ plId ] = updater; // m_updaters[ plId ] = updater;
} }*/
void void
@@ -1472,18 +1470,18 @@ SpotifyAccount::registerPlaylistInfo( SpotifyPlaylistInfo* info )
} }
void /*void
SpotifyAccount::unregisterUpdater( const QString& plid ) SpotifyAccount::unregisterUpdater( const QString& plid )
{ {
m_updaters.remove( plid ); m_updaters.remove( plid );
} }*/
void /*void
SpotifyAccount::fetchFullPlaylist( SpotifyPlaylistInfo* playlist ) SpotifyAccount::fetchFullPlaylist( SpotifyPlaylistInfo* playlist )
{ {
Q_UNUSED( playlist ); Q_UNUSED( playlist );
} }*/
bool bool
@@ -1507,7 +1505,7 @@ SpotifyAccount::persitentPrivacy() const
} }
void /*void
SpotifyAccount::stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontDelete ) SpotifyAccount::stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontDelete )
{ {
if ( !playlist ) if ( !playlist )
@@ -1546,7 +1544,7 @@ SpotifyAccount::stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontD
updater->save(); updater->save();
} }
} }*/
void void
@@ -1559,7 +1557,7 @@ SpotifyAccount::loadPlaylists()
} }
void /*void
SpotifyAccount::setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync ) SpotifyAccount::setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync )
{ {
SpotifyPlaylistInfo* info = m_allSpotifyPlaylists.value( spotifyPlaylistId, 0 ); SpotifyPlaylistInfo* info = m_allSpotifyPlaylists.value( spotifyPlaylistId, 0 );
@@ -1570,10 +1568,10 @@ SpotifyAccount::setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync
if ( !m_configWidget.isNull() ) if ( !m_configWidget.isNull() )
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() ); m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists.values() );
} }*/
void /*void
SpotifyAccount::createActions() SpotifyAccount::createActions()
{ {
if ( !m_customActions.isEmpty() ) if ( !m_customActions.isEmpty() )
@@ -1613,5 +1611,5 @@ SpotifyAccount::removeActions()
ActionCollection::instance()->removeAction( action ); ActionCollection::instance()->removeAction( action );
m_customActions.clear(); m_customActions.clear();
} }*/

View File

@@ -30,7 +30,7 @@
#include <QAction> #include <QAction>
class SpotifyPlaylistUpdater; //class SpotifyPlaylistUpdater;
class QTimer; class QTimer;
class ScriptResolver; class ScriptResolver;
@@ -103,12 +103,12 @@ public:
virtual SipPlugin* sipPlugin( bool ) { return 0; } virtual SipPlugin* sipPlugin( bool ) { return 0; }
virtual bool preventEnabling() const { return m_preventEnabling; } virtual bool preventEnabling() const { return m_preventEnabling; }
bool hasPlaylist( const QString& plId ); // bool hasPlaylist( const QString& plId );
Tomahawk::playlist_ptr playlistForURI( const QString& plId ); // Tomahawk::playlist_ptr playlistForURI( const QString& plId );
void registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylistUpdater* updater ); // void registerUpdaterForPlaylist( const QString& plId, SpotifyPlaylistUpdater* updater );
void registerPlaylistInfo( const QString& name, const QString& plid, const QString &revid, const bool sync, const bool subscribed , const bool owner = false ); void registerPlaylistInfo( const QString& name, const QString& plid, const QString &revid, const bool sync, const bool subscribed , const bool owner = false );
void registerPlaylistInfo( SpotifyPlaylistInfo* info ); void registerPlaylistInfo( SpotifyPlaylistInfo* info );
void unregisterUpdater( const QString& plid ); // void unregisterUpdater( const QString& plid );
bool deleteOnUnsync() const; bool deleteOnUnsync() const;
bool loveSync() const; bool loveSync() const;
@@ -123,10 +123,10 @@ public slots:
QString sendMessage( const QVariantMap& msg, QObject* receiver = 0, const QString& slot = QString(), const QVariant& extraData = QVariant() ); QString sendMessage( const QVariantMap& msg, QObject* receiver = 0, const QString& slot = QString(), const QVariant& extraData = QVariant() );
void aboutToShow( QAction* action, const Tomahawk::playlist_ptr& playlist ); void aboutToShow( QAction* action, const Tomahawk::playlist_ptr& playlist );
void syncActionTriggered( QAction* action ); // void syncActionTriggered( QAction* action );
void subscribeActionTriggered( QAction* action ); // void subscribeActionTriggered( QAction* action );
void atticaLoaded( Attica::Content::List ); void atticaLoaded( Attica::Content::List );
void collaborateActionTriggered( QAction* action ); // void collaborateActionTriggered( QAction* action );
private slots: private slots:
void resolverChanged(); void resolverChanged();
@@ -140,9 +140,9 @@ private slots:
// SpotifyResolver message handlers, all take msgtype, msg as argument // SpotifyResolver message handlers, all take msgtype, msg as argument
// void <here>( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ); // void <here>( const QString& msgType, const QVariantMap& msg, const QVariant& extraData );
void startPlaylistSyncWithPlaylist( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ); // void startPlaylistSyncWithPlaylist( const QString& msgType, const QVariantMap& msg, const QVariant& extraData );
void playlistCreated( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ); // void playlistCreated( const QString& msgType, const QVariantMap& msg, const QVariant& extraData );
void playlistCopyCreated( const QString& msgType, const QVariantMap& msg, const QVariant& extraData ); // void playlistCopyCreated( const QString& msgType, const QVariantMap& msg, const QVariant& extraData );
void delayedInit(); void delayedInit();
void hookupAfterDeletion( bool autoEnable ); void hookupAfterDeletion( bool autoEnable );
@@ -154,18 +154,18 @@ private:
void loadPlaylists(); void loadPlaylists();
void clearUser( bool permanentlyDelete = false ); void clearUser( bool permanentlyDelete = false );
void startPlaylistSync( SpotifyPlaylistInfo* playlist ); /* void startPlaylistSync( SpotifyPlaylistInfo* playlist );
void stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontDelete = false ); void stopPlaylistSync( SpotifyPlaylistInfo* playlist, bool forceDontDelete = false );
void fetchFullPlaylist( SpotifyPlaylistInfo* playlist ); void fetchFullPlaylist( SpotifyPlaylistInfo* playlist );
void setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync ); void setSyncForPlaylist( const QString& spotifyPlaylistId, bool sync );
void setSubscribedForPlaylist( const playlist_ptr& pl, bool subscribed ); void setSubscribedForPlaylist( const playlist_ptr& pl, bool subscribed );*/
void createActions(); // void createActions();
void removeActions(); // void removeActions();
playlist_ptr playlistFromAction( QAction* action ) const; // playlist_ptr playlistFromAction( QAction* action ) const;
SpotifyPlaylistUpdater* getPlaylistUpdater( const playlist_ptr plptr); // SpotifyPlaylistUpdater* getPlaylistUpdater( const playlist_ptr plptr);
SpotifyPlaylistUpdater* getPlaylistUpdater( QObject* sender ); // SpotifyPlaylistUpdater* getPlaylistUpdater( QObject* sender );
static SpotifyAccount* s_instance; static SpotifyAccount* s_instance;
QPointer<SpotifyAccountConfig> m_configWidget; QPointer<SpotifyAccountConfig> m_configWidget;
@@ -178,14 +178,14 @@ private:
// List of synced spotify playlists in config UI // List of synced spotify playlists in config UI
QHash< QString, SpotifyPlaylistInfo* > m_allSpotifyPlaylists; QHash< QString, SpotifyPlaylistInfo* > m_allSpotifyPlaylists;
QHash< QString, SpotifyPlaylistUpdater* > m_updaters; // QHash< QString, SpotifyPlaylistUpdater* > m_updaters;
QHash< QString, playlist_ptr > m_waitingForCreateReply; QHash< QString, playlist_ptr > m_waitingForCreateReply;
bool m_preventEnabling, m_loggedIn; bool m_preventEnabling, m_loggedIn;
SmartPointerList< QAction > m_customActions; SmartPointerList< QAction > m_customActions;
friend class ::SpotifyPlaylistUpdater; // friend class ::SpotifyPlaylistUpdater;
friend class Tomahawk::SpotifyParser; friend class Tomahawk::SpotifyParser;
}; };

View File

@@ -57,7 +57,14 @@ SpotifyAccountConfig::SpotifyAccountConfig( SpotifyAccount *account )
connect( m_ui->selectAllCheckbox, SIGNAL( stateChanged( int ) ), this, SLOT( selectAllPlaylists() ) ); connect( m_ui->selectAllCheckbox, SIGNAL( stateChanged( int ) ), this, SLOT( selectAllPlaylists() ) );
loadFromConfig(); loadFromConfig();
m_playlistsLoading = new AnimatedSpinner( m_ui->playlistList ); m_ui->label->setVisible( false );
m_ui->label_3->setVisible( false );
m_ui->loveSync->setVisible( false );
m_ui->selectAllCheckbox->setVisible( false );
m_ui->deleteOnUnsync->setVisible( false );
m_ui->playlistList->setVisible( false );
// m_playlistsLoading = new AnimatedSpinner( m_ui->playlistList );
} }
@@ -162,6 +169,8 @@ SpotifyAccountConfig::persitentPrivacy() const
void void
SpotifyAccountConfig::setPlaylists( const QList<SpotifyPlaylistInfo *>& playlists ) SpotifyAccountConfig::setPlaylists( const QList<SpotifyPlaylistInfo *>& playlists )
{ {
return;
// User always has at least 1 playlist (starred tracks) // User always has at least 1 playlist (starred tracks)
if ( !playlists.isEmpty() ) if ( !playlists.isEmpty() )
m_playlistsLoading->fadeOut(); m_playlistsLoading->fadeOut();
@@ -193,7 +202,7 @@ SpotifyAccountConfig::doLogin()
m_ui->loginButton->setText( tr( "Logging in..." ) ); m_ui->loginButton->setText( tr( "Logging in..." ) );
m_ui->loginButton->setEnabled( false ); m_ui->loginButton->setEnabled( false );
m_playlistsLoading->fadeIn(); // m_playlistsLoading->fadeIn();
m_loggedInManually = true; m_loggedInManually = true;
emit login( username(), password() ); emit login( username(), password() );
@@ -224,8 +233,8 @@ SpotifyAccountConfig::loginResponse( bool success, const QString& msg, const QSt
} }
else else
{ {
setPlaylists( QList< SpotifyPlaylistInfo* >() ); /* setPlaylists( QList< SpotifyPlaylistInfo* >() );
m_playlistsLoading->fadeOut(); m_playlistsLoading->fadeOut();*/
m_ui->loginButton->setText( tr( "Failed: %1" ).arg( msg ) ); m_ui->loginButton->setText( tr( "Failed: %1" ).arg( msg ) );
m_ui->loginButton->setEnabled( true ); m_ui->loginButton->setEnabled( true );

View File

@@ -408,13 +408,13 @@ SpotifyParser::checkBrowseFinished()
spotifyUsername = creds.value( "username" ).toString(); spotifyUsername = creds.value( "username" ).toString();
} }
if ( spotifyAccountLoggedIn && Accounts::SpotifyAccount::instance()->hasPlaylist( m_browseUri ) ) /* if ( spotifyAccountLoggedIn && Accounts::SpotifyAccount::instance()->hasPlaylist( m_browseUri ) )
{ {
// The playlist is already registered with Tomahawk, so just open it instead of adding another instance. // The playlist is already registered with Tomahawk, so just open it instead of adding another instance.
m_playlist = Accounts::SpotifyAccount::instance()->playlistForURI( m_browseUri ); m_playlist = Accounts::SpotifyAccount::instance()->playlistForURI( m_browseUri );
playlistCreated(); playlistCreated();
} }
else else*/
{ {
m_playlist = Playlist::create( SourceList::instance()->getLocal(), m_playlist = Playlist::create( SourceList::instance()->getLocal(),
uuid(), uuid(),
@@ -426,7 +426,7 @@ SpotifyParser::checkBrowseFinished()
connect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistCreated() ) ); connect( m_playlist.data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistCreated() ) );
if ( spotifyAccountLoggedIn ) /* if ( spotifyAccountLoggedIn )
{ {
SpotifyPlaylistUpdater* updater = new SpotifyPlaylistUpdater( SpotifyPlaylistUpdater* updater = new SpotifyPlaylistUpdater(
Accounts::SpotifyAccount::instance(), m_playlist->currentrevision(), m_browseUri, m_playlist ); Accounts::SpotifyAccount::instance(), m_playlist->currentrevision(), m_browseUri, m_playlist );
@@ -446,8 +446,7 @@ SpotifyParser::checkBrowseFinished()
// On default, set the playlist as subscribed // On default, set the playlist as subscribed
if( !updater->owner() ) if( !updater->owner() )
Accounts::SpotifyAccount::instance()->setSubscribedForPlaylist( m_playlist, true ); Accounts::SpotifyAccount::instance()->setSubscribedForPlaylist( m_playlist, true );
}*/
}
} }
return; return;
} }

View File

@@ -24,7 +24,7 @@
#include "Typedefs.h" #include "Typedefs.h"
#include "Query.h" #include "Query.h"
#include "jobview/JobStatusItem.h" #include "jobview/JobStatusItem.h"
#include "accounts/spotify/SpotifyPlaylistUpdater.h" //#include "accounts/spotify/SpotifyPlaylistUpdater.h"
#include "accounts/spotify/SpotifyAccount.h" #include "accounts/spotify/SpotifyAccount.h"
#include <QObject> #include <QObject>
#include <QSet> #include <QSet>
@@ -40,7 +40,6 @@
class NetworkReply; class NetworkReply;
class SpotifyAccount; class SpotifyAccount;
class SpotifyPlaylistUpdater;
namespace Tomahawk namespace Tomahawk
{ {

View File

@@ -53,7 +53,7 @@
#include "accounts/lastfm/LastFmAccount.h" #include "accounts/lastfm/LastFmAccount.h"
#include "accounts/spotify/SpotifyAccount.h" #include "accounts/spotify/SpotifyAccount.h"
#include "accounts/spotify/SpotifyPlaylistUpdater.h" //#include "accounts/spotify/SpotifyPlaylistUpdater.h"
#include "accounts/AccountManager.h" #include "accounts/AccountManager.h"
#include "audio/AudioEngine.h" #include "audio/AudioEngine.h"
#include "database/Database.h" #include "database/Database.h"
@@ -651,7 +651,7 @@ TomahawkApp::onInfoSystemReady()
Tomahawk::EchonestCatalogSynchronizer::instance(); Tomahawk::EchonestCatalogSynchronizer::instance();
PlaylistUpdaterInterface::registerUpdaterFactory( new XspfUpdaterFactory ); PlaylistUpdaterInterface::registerUpdaterFactory( new XspfUpdaterFactory );
PlaylistUpdaterInterface::registerUpdaterFactory( new SpotifyUpdaterFactory ); // PlaylistUpdaterInterface::registerUpdaterFactory( new SpotifyUpdaterFactory );
// Following work-around/fix taken from Clementine rev. 13e13ccd9a95 and courtesy of David Sansome // Following work-around/fix taken from Clementine rev. 13e13ccd9a95 and courtesy of David Sansome
// A bug in Qt means the wheel_scroll_lines setting gets ignored and replaced // A bug in Qt means the wheel_scroll_lines setting gets ignored and replaced