mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 05:37:29 +02:00
add migration code
This commit is contained in:
@@ -55,8 +55,8 @@ SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QVariantH
|
|||||||
|
|
||||||
// Register the updater with the account
|
// Register the updater with the account
|
||||||
const QString spotifyId = settings.value( "spotifyId" ).toString();
|
const QString spotifyId = settings.value( "spotifyId" ).toString();
|
||||||
const QString latestRev = settings.value( "%1/latestrev" ).toString();
|
const QString latestRev = settings.value( "latestrev" ).toString();
|
||||||
const bool sync = settings.value( "%1/sync" ).toBool();
|
const bool sync = settings.value( "sync" ).toBool();
|
||||||
|
|
||||||
Q_ASSERT( !spotifyId.isEmpty() );
|
Q_ASSERT( !spotifyId.isEmpty() );
|
||||||
SpotifyPlaylistUpdater* updater = new SpotifyPlaylistUpdater( m_account.data(), latestRev, spotifyId, pl );
|
SpotifyPlaylistUpdater* updater = new SpotifyPlaylistUpdater( m_account.data(), latestRev, spotifyId, pl );
|
||||||
|
@@ -486,7 +486,32 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
|
|||||||
else if ( oldVersion == 9 )
|
else if ( oldVersion == 9 )
|
||||||
{
|
{
|
||||||
// Upgrade single-updater-per-playlist to list-per-playlist
|
// Upgrade single-updater-per-playlist to list-per-playlist
|
||||||
|
beginGroup( "playlistupdaters" );
|
||||||
|
const QStringList playlists = childGroups();
|
||||||
|
|
||||||
|
PlaylistUpdaterInterface::SerializedUpdaters updaters;
|
||||||
|
foreach ( const QString& playlist, playlists )
|
||||||
|
{
|
||||||
|
beginGroup( playlist );
|
||||||
|
const QString type = value( "type" ).toString();
|
||||||
|
|
||||||
|
QVariantHash extraData;
|
||||||
|
foreach ( const QString& key, childKeys() )
|
||||||
|
{
|
||||||
|
if ( key == "type" )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
extraData[ key ] = value( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
updaters[ playlist ] = PlaylistUpdaterInterface::SerializedUpdater( type, extraData );
|
||||||
|
|
||||||
|
endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
endGroup();
|
||||||
|
|
||||||
|
setPlaylistUpdaters( updaters );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1223,14 +1248,14 @@ TomahawkSettings::setImportXspfPath( const QString& path )
|
|||||||
PlaylistUpdaterInterface::SerializedUpdaters
|
PlaylistUpdaterInterface::SerializedUpdaters
|
||||||
TomahawkSettings::playlistUpdaters() const
|
TomahawkSettings::playlistUpdaters() const
|
||||||
{
|
{
|
||||||
return value( "playlistupdaters" ).value< PlaylistUpdaterInterface::SerializedUpdaters >();
|
return value( "playlist/updaters" ).value< PlaylistUpdaterInterface::SerializedUpdaters >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkSettings::setPlaylistUpdaters( const PlaylistUpdaterInterface::SerializedUpdaters& updaters )
|
TomahawkSettings::setPlaylistUpdaters( const PlaylistUpdaterInterface::SerializedUpdaters& updaters )
|
||||||
{
|
{
|
||||||
setValue( "playlistupdaters", QVariant::fromValue< PlaylistUpdaterInterface::SerializedUpdaters >( updaters ) );
|
setValue( "playlist/updaters", QVariant::fromValue< PlaylistUpdaterInterface::SerializedUpdaters >( updaters ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user