mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
Some more work + debug to try to fix j's issue
This commit is contained in:
parent
0b452cc415
commit
e3f4fdfdd8
@ -125,6 +125,20 @@ AtticaManager::resolvers() const
|
||||
}
|
||||
|
||||
|
||||
Content
|
||||
AtticaManager::resolverForId( const QString& id ) const
|
||||
{
|
||||
foreach ( const Attica::Content& c, m_resolvers )
|
||||
{
|
||||
if ( c.id() == id )
|
||||
return c;
|
||||
}
|
||||
|
||||
return Content();
|
||||
}
|
||||
|
||||
|
||||
|
||||
AtticaManager::ResolverState
|
||||
AtticaManager::resolverState ( const Content& resolver ) const
|
||||
{
|
||||
|
@ -71,6 +71,8 @@ public:
|
||||
bool resolversLoaded() const;
|
||||
|
||||
Attica::Content::List resolvers() const;
|
||||
Attica::Content resolverForId( const QString& id ) const;
|
||||
|
||||
ResolverState resolverState( const Attica::Content& resolver ) const;
|
||||
QPixmap iconForResolver( const Attica::Content& id ); // Looks up in icon cache
|
||||
|
||||
|
@ -38,8 +38,6 @@ AccountModel::AccountModel( QObject* parent )
|
||||
connect( AccountManager::instance(), SIGNAL( removed( Tomahawk::Accounts::Account* ) ), this, SLOT( accountRemoved( Tomahawk::Accounts::Account* ) ) );
|
||||
connect( AccountManager::instance(), SIGNAL( stateChanged( Account* ,Accounts::Account::ConnectionState ) ), this, SLOT( accountStateChanged( Account*, Accounts::Account::ConnectionState ) ) );
|
||||
|
||||
connect( AtticaManager::instance(), SIGNAL( resolverInstalled( QString ) ), this, SLOT( atticaInstalled( QString ) ) );
|
||||
|
||||
loadData();
|
||||
}
|
||||
|
||||
@ -319,20 +317,24 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
|
||||
|
||||
Attica::Content resolver = node->atticaContent;
|
||||
AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( resolver );
|
||||
qDebug() << "Attica resolver was checked! Current state is:" << state << "and so..";
|
||||
if ( state == AtticaManager::Installed && !node->resolverAccount )
|
||||
{
|
||||
// Something is wrong, reinstall
|
||||
qDebug() << "Found installed state but no resolver, uninstalling first";
|
||||
AtticaManager::instance()->uninstallResolver( resolver );
|
||||
state = AtticaManager::Uninstalled;
|
||||
}
|
||||
|
||||
if ( state == AtticaManager::Installed )
|
||||
{
|
||||
qDebug() << "Already installed with resolver, just enabling";
|
||||
acct = node->atticaAccount;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Kicked off fetch+install, now waiting";
|
||||
m_waitingForAtticaInstall.insert( resolver.id() );
|
||||
|
||||
AtticaManager::instance()->installResolver( resolver );
|
||||
@ -441,8 +443,15 @@ AccountModel::accountAdded( Account* account )
|
||||
}
|
||||
else if ( attica && n->atticaContent.id() == attica->atticaId() )
|
||||
{
|
||||
|
||||
n->resolverAccount = attica;
|
||||
n->atticaContent = AtticaManager::instance()->resolverForId( attica->atticaId() );
|
||||
thisIsTheOne = true;
|
||||
|
||||
if ( m_waitingForAtticaInstall.contains( attica->atticaId() ) )
|
||||
AccountManager::instance()->enableAccount( account );
|
||||
|
||||
m_waitingForAtticaInstall.remove( attica->atticaId() );
|
||||
}
|
||||
|
||||
if ( thisIsTheOne )
|
||||
@ -605,6 +614,7 @@ AccountModel::atticaInstalled( const QString& atticaId )
|
||||
AccountManager::instance()->enableAccount( acct );
|
||||
|
||||
node->atticaAccount = acct;
|
||||
node->atticaContent = AtticaManager::instance()->resolverForId( atticaId );
|
||||
const QModelIndex idx = index( m_accounts.indexOf( node ), 0, QModelIndex() );
|
||||
emit dataChanged( idx, idx );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user