1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-26 15:25:04 +02:00

* Let Track detach from TrackData when changing metadata.

This commit is contained in:
Christian Muehlhaeuser
2013-09-03 20:50:59 +02:00
parent 6fb25fc68b
commit 8d6b02a9a7
2 changed files with 56 additions and 3 deletions

View File

@@ -128,12 +128,63 @@ Track::~Track()
}
void
Track::setArtist( const QString& artist )
{
Q_D( Track );
d->artistPtr = artist_ptr();
d->trackData = TrackData::get( 0, artist, track() );
init();
emit updated();
}
void
Track::setAlbum( const QString& album )
{
Q_D( Track );
d->albumPtr = album_ptr();
d->album = album;
updateSortNames();
emit updated();
}
void
Track::setTrack( const QString& track )
{
Q_D( Track );
d->trackData = TrackData::get( 0, artist(), track );
init();
emit updated();
}
void
Track::setAlbumPos( unsigned int albumpos )
{
Q_D( Track );
d->albumpos = albumpos;
emit updated();
}
void
Track::setAttributes( const QVariantMap& map )
{
Q_D( Track );
d->trackData->setAttributes( map );
emit attributesLoaded();
}

View File

@@ -53,11 +53,12 @@ public:
virtual ~Track();
// void setArtist( const QString& artist ) { m_artist = artist; updateSortNames(); }
void setArtist( const QString& artist );
void setAlbum( const QString& album );
// void setTrack( const QString& track ) { m_track = track; updateSortNames(); }
void setTrack( const QString& track );
void setAlbumPos( unsigned int albumpos );
// void setDuration( int duration ) { m_duration = duration; }
// void setAlbumPos( unsigned int albumpos ) { m_albumpos = albumpos; }
// void setDiscNumber( unsigned int discnumber ) { m_discnumber = discnumber; }
// void setComposer( const QString& composer ) { m_composer = composer; updateSortNames(); }
@@ -97,6 +98,7 @@ public:
void loadAttributes();
QVariantMap attributes() const;
void setAttributes( const QVariantMap& map );
void loadStats();
QList< Tomahawk::PlaybackLog > playbackHistory( const Tomahawk::source_ptr& source = Tomahawk::source_ptr() ) const;