mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
fix migrating when there is already a last.fm account, and hide debug
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
using namespace Accounts;
|
using namespace Accounts;
|
||||||
|
|
||||||
|
#define ACCOUNTMODEL_DEBUG 0
|
||||||
AccountModel::AccountModel( QObject* parent )
|
AccountModel::AccountModel( QObject* parent )
|
||||||
: QAbstractListModel( parent )
|
: QAbstractListModel( parent )
|
||||||
{
|
{
|
||||||
@@ -52,10 +53,11 @@ AccountModel::loadData()
|
|||||||
// Add all factories
|
// Add all factories
|
||||||
QList< AccountFactory* > factories = AccountManager::instance()->factories();
|
QList< AccountFactory* > factories = AccountManager::instance()->factories();
|
||||||
QList< Account* > allAccounts = AccountManager::instance()->accounts();
|
QList< Account* > allAccounts = AccountManager::instance()->accounts();
|
||||||
|
#if ACCOUNTMODEL_DEBUG
|
||||||
qDebug() << "All accounts:";
|
qDebug() << "All accounts:";
|
||||||
foreach ( Account* acct, allAccounts )
|
foreach ( Account* acct, allAccounts )
|
||||||
qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId();
|
qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId();
|
||||||
|
#endif
|
||||||
foreach ( AccountFactory* fac, factories )
|
foreach ( AccountFactory* fac, factories )
|
||||||
{
|
{
|
||||||
if ( !fac->allowUserCreation() )
|
if ( !fac->allowUserCreation() )
|
||||||
@@ -86,11 +88,12 @@ AccountModel::loadData()
|
|||||||
{
|
{
|
||||||
m_accounts << new AccountModelNode( acct );
|
m_accounts << new AccountModelNode( acct );
|
||||||
const int removed = allAccounts.removeAll( acct );
|
const int removed = allAccounts.removeAll( acct );
|
||||||
|
#if ACCOUNTMODEL_DEBUG
|
||||||
qDebug() << "Removed custom account from misc accounts list, found:" << removed;
|
qDebug() << "Removed custom account from misc accounts list, found:" << removed;
|
||||||
qDebug() << "All accounts after remove:";
|
qDebug() << "All accounts after remove:";
|
||||||
foreach ( Account* acct, allAccounts )
|
foreach ( Account* acct, allAccounts )
|
||||||
qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); // All other accounts we haven't dealt with yet
|
qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); // All other accounts we haven't dealt with yet
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -112,10 +115,11 @@ AccountModel::loadData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ACCOUNTMODEL_DEBUG
|
||||||
qDebug() << "All accounts left:";
|
qDebug() << "All accounts left:";
|
||||||
foreach ( Account* acct, allAccounts )
|
foreach ( Account* acct, allAccounts )
|
||||||
qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); // All other accounts we haven't dealt with yet
|
qDebug() << acct->accountFriendlyName() << "\t" << acct->accountId(); // All other accounts we haven't dealt with yet
|
||||||
|
#endif
|
||||||
foreach ( Account* acct, allAccounts )
|
foreach ( Account* acct, allAccounts )
|
||||||
{
|
{
|
||||||
qDebug() << "Resolver is left over:" << acct->accountFriendlyName();
|
qDebug() << "Resolver is left over:" << acct->accountFriendlyName();
|
||||||
|
@@ -288,6 +288,10 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
|
|||||||
|
|
||||||
foreach ( const QString& resolver, allResolvers )
|
foreach ( const QString& resolver, allResolvers )
|
||||||
{
|
{
|
||||||
|
// We handle last.fm resolvers differently.
|
||||||
|
if ( resolver.contains( "lastfm" ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
const QString accountKey = QString( "resolveraccount_%1" ).arg( QUuid::createUuid().toString().mid( 1, 8 ) );
|
const QString accountKey = QString( "resolveraccount_%1" ).arg( QUuid::createUuid().toString().mid( 1, 8 ) );
|
||||||
accounts << accountKey;
|
accounts << accountKey;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user