1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Rename playlist if title changes when updating from XSPF

This commit is contained in:
Leo Franchi
2012-09-19 15:44:07 -04:00
parent 1487f7a64a
commit 4a7c2fd2b4
4 changed files with 17 additions and 1 deletions

View File

@@ -112,6 +112,14 @@ XspfUpdater::updateNow()
void void
XspfUpdater::playlistLoaded( const QList<Tomahawk::query_ptr>& newEntries ) XspfUpdater::playlistLoaded( const QList<Tomahawk::query_ptr>& newEntries )
{ {
XSPFLoader* loader = qobject_cast< XSPFLoader* >( sender() );
if ( loader )
{
const QString newTitle = loader->title();
if ( newTitle != playlist()->title() )
playlist()->rename( newTitle );
}
QList< query_ptr > tracks; QList< query_ptr > tracks;
foreach ( const plentry_ptr ple, playlist()->entries() ) foreach ( const plentry_ptr ple, playlist()->entries() )
tracks << ple->query(); tracks << ple->query();

View File

@@ -33,7 +33,7 @@ class DLLEXPORT XspfUpdater : public PlaylistUpdaterInterface
{ {
Q_OBJECT Q_OBJECT
public: public:
XspfUpdater( const playlist_ptr& pl, int interval, bool autoUpdate, const QString& xspfUrl ); XspfUpdater( const playlist_ptr& pl, int interval /* ms */, bool autoUpdate, const QString& xspfUrl );
virtual ~XspfUpdater(); virtual ~XspfUpdater();

View File

@@ -89,6 +89,13 @@ XSPFLoader::entries() const
} }
QString
XSPFLoader::title() const
{
return m_title;
}
void void
XSPFLoader::load( const QUrl& url ) XSPFLoader::load( const QUrl& url )
{ {

View File

@@ -45,6 +45,7 @@ public:
virtual ~XSPFLoader(); virtual ~XSPFLoader();
QList< Tomahawk::query_ptr > entries() const; QList< Tomahawk::query_ptr > entries() const;
QString title() const;
void setOverrideTitle( const QString& newTitle ); void setOverrideTitle( const QString& newTitle );
void setAutoResolveTracks( bool autoResolve ) { m_autoResolve = autoResolve; } void setAutoResolveTracks( bool autoResolve ) { m_autoResolve = autoResolve; }