mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Auto upgrade old spotify to new spotify
This commit is contained in:
parent
35706f16f7
commit
cb85c767de
@ -44,7 +44,7 @@ public:
|
||||
|
||||
// Used to create a new resolver from a script on disk, either chosen by
|
||||
// the user, or installed from synchrotron
|
||||
virtual bool acceptsPath( const QString& path ) const { return true; } // This is the catch-all filesystem account
|
||||
virtual bool acceptsPath( const QString& ) const { return true; } // This is the catch-all filesystem account
|
||||
virtual Account* createFromPath( const QString& path );
|
||||
|
||||
// Internal use
|
||||
|
@ -361,6 +361,41 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
|
||||
|
||||
setValue( "accounts/allaccounts", accounts );
|
||||
}
|
||||
else if ( oldVersion == 7 )
|
||||
{
|
||||
// Upgrade spotify resolver to standalone account, if one exists
|
||||
beginGroup( "accounts" );
|
||||
QStringList allAccounts = value( "allaccounts" ).toStringList();
|
||||
foreach ( const QString& account, allAccounts )
|
||||
{
|
||||
if ( account.startsWith( "resolveraccount_" ) && value( QString( "%1/accountfriendlyname" ).arg( account ) ).toString() == "spotify_tomahawkresolver" )
|
||||
{
|
||||
// This is a spotify resolver, convert!
|
||||
const QVariantHash configuration = value( QString( "%1/configuration" ).arg( account ) ).toHash();
|
||||
const bool enabled = value( QString( "%1/enabled" ).arg( account ) ).toBool();
|
||||
const bool autoconnect = value( QString( "%1/autoconnect" ).arg( account ) ).toBool();
|
||||
|
||||
qDebug() << "Migrating Spotify resolver from legacy resolver type, path is:" << configuration[ "path" ].toString();
|
||||
|
||||
remove( account );
|
||||
|
||||
// Create new account
|
||||
QString newAccount = account;
|
||||
newAccount.replace( "resolveraccount_", "spotifyaccount_" );
|
||||
beginGroup( newAccount );
|
||||
setValue( "enabled", enabled );
|
||||
setValue( "autoconnect", autoconnect );
|
||||
setValue( "types", QStringList() << "ResolverType" );
|
||||
setValue( "configuration", configuration );
|
||||
endGroup();
|
||||
|
||||
allAccounts.replace( allAccounts.indexOf( account ), newAccount );
|
||||
}
|
||||
}
|
||||
|
||||
setValue( "allaccounts", allAccounts );
|
||||
endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
#define TOMAHAWK_SETTINGS_VERSION 7
|
||||
#define TOMAHAWK_SETTINGS_VERSION 8
|
||||
|
||||
/**
|
||||
* Convenience wrapper around QSettings for tomahawk-specific config
|
||||
|
Loading…
x
Reference in New Issue
Block a user