mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-23 22:25:11 +02:00
emit rename signal and update spotify playlistname
This commit is contained in:
@@ -220,7 +220,7 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
||||
{
|
||||
const QString plid = msg.value( "id" ).toString();
|
||||
// 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 ) );
|
||||
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
if ( !m_updaters.contains( plid ) )
|
||||
|
@@ -84,6 +84,7 @@ SpotifyPlaylistUpdater::init()
|
||||
|
||||
connect( playlist().data(), SIGNAL( tracksInserted( QList<Tomahawk::plentry_ptr>, int ) ), this, SLOT( tomahawkTracksInserted( QList<Tomahawk::plentry_ptr>, int ) ) );
|
||||
connect( playlist().data(), SIGNAL( tracksRemoved( QList<Tomahawk::query_ptr> ) ), this, SLOT( tomahawkTracksRemoved( QList<Tomahawk::query_ptr> ) ) );
|
||||
connect( playlist().data(), SIGNAL( renamed(const QString&, const QString& ) ), this, SLOT( tomahawkPlaylistRenamed( const QString&, const QString& ) ) );
|
||||
// TODO reorders in a playlist
|
||||
}
|
||||
|
||||
@@ -231,6 +232,19 @@ SpotifyPlaylistUpdater::spotifyPlaylistRenamed( const QString title, const QStri
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
SpotifyPlaylistUpdater::tomahawkPlaylistRenamed(const QString &newT, const QString &oldT)
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
QVariantMap msg;
|
||||
msg[ "_msgtype" ] = "playlistRenamed";
|
||||
msg[ "oldrev" ] = m_latestRev;
|
||||
msg[ "newTitle" ] = newT;
|
||||
msg[ "oldTitle" ] = oldT;
|
||||
msg[ "playlistid" ] = m_spotifyId;
|
||||
m_spotify.data()->sendMessage( msg, this, "onPlaylistRename" );
|
||||
}
|
||||
|
||||
void
|
||||
SpotifyPlaylistUpdater::spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev )
|
||||
{
|
||||
|
@@ -61,7 +61,7 @@ protected:
|
||||
private slots:
|
||||
void tomahawkTracksInserted( const QList<Tomahawk::plentry_ptr>& ,int );
|
||||
void tomahawkTracksRemoved( const QList<Tomahawk::query_ptr>& );
|
||||
|
||||
void tomahawkPlaylistRenamed( const QString&, const QString&);
|
||||
// SpotifyResolver message handlers, all take msgtype, msg as argument
|
||||
void onTracksInsertedReturn( const QString& msgType, const QVariantMap& msg );
|
||||
void onTracksRemovedReturn( const QString& msgType, const QVariantMap& msg );
|
||||
|
@@ -248,6 +248,18 @@ Playlist::rename( const QString& title )
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd) );
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::setTitle( const QString& title )
|
||||
{
|
||||
if( title == m_title )
|
||||
return;
|
||||
|
||||
const QString oldTitle = m_title;
|
||||
const QString newTitle = title;
|
||||
m_title = title;
|
||||
emit changed();
|
||||
emit renamed( newTitle, oldTitle );
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::reportCreated( const playlist_ptr& self )
|
||||
|
@@ -178,12 +178,12 @@ public:
|
||||
// maybe friend QObjectHelper and make them private?
|
||||
explicit Playlist( const source_ptr& author );
|
||||
void setCurrentrevision( const QString& s ) { m_currentrevision = s; }
|
||||
void setTitle( const QString& s ) { m_title = s; emit changed(); }
|
||||
void setInfo( const QString& s ) { m_info = s; }
|
||||
void setCreator( const QString& s ) { m_creator = s; }
|
||||
void setGuid( const QString& s ) { m_guid = s; }
|
||||
void setShared( bool b ) { m_shared = b; }
|
||||
void setCreatedOn( uint createdOn ) { m_createdOn = createdOn; }
|
||||
void setTitle( const QString& s );
|
||||
// </IGNORE>
|
||||
|
||||
|
||||
@@ -202,6 +202,7 @@ signals:
|
||||
|
||||
/// renamed etc.
|
||||
void changed();
|
||||
void renamed( const QString&, const QString& );
|
||||
|
||||
/**
|
||||
* delete command is scheduled but not completed. Do not call remove() again once this
|
||||
|
Reference in New Issue
Block a user