mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 06:36:55 +02:00
Some more work + debug to try to fix j's issue
This commit is contained in:
@@ -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
|
||||||
AtticaManager::resolverState ( const Content& resolver ) const
|
AtticaManager::resolverState ( const Content& resolver ) const
|
||||||
{
|
{
|
||||||
|
@@ -71,6 +71,8 @@ public:
|
|||||||
bool resolversLoaded() const;
|
bool resolversLoaded() const;
|
||||||
|
|
||||||
Attica::Content::List resolvers() const;
|
Attica::Content::List resolvers() const;
|
||||||
|
Attica::Content resolverForId( const QString& id ) const;
|
||||||
|
|
||||||
ResolverState resolverState( const Attica::Content& resolver ) const;
|
ResolverState resolverState( const Attica::Content& resolver ) const;
|
||||||
QPixmap iconForResolver( const Attica::Content& id ); // Looks up in icon cache
|
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( 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( 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();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,20 +317,24 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
|
|||||||
|
|
||||||
Attica::Content resolver = node->atticaContent;
|
Attica::Content resolver = node->atticaContent;
|
||||||
AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( resolver );
|
AtticaManager::ResolverState state = AtticaManager::instance()->resolverState( resolver );
|
||||||
|
qDebug() << "Attica resolver was checked! Current state is:" << state << "and so..";
|
||||||
if ( state == AtticaManager::Installed && !node->resolverAccount )
|
if ( state == AtticaManager::Installed && !node->resolverAccount )
|
||||||
{
|
{
|
||||||
// Something is wrong, reinstall
|
// Something is wrong, reinstall
|
||||||
|
qDebug() << "Found installed state but no resolver, uninstalling first";
|
||||||
AtticaManager::instance()->uninstallResolver( resolver );
|
AtticaManager::instance()->uninstallResolver( resolver );
|
||||||
state = AtticaManager::Uninstalled;
|
state = AtticaManager::Uninstalled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( state == AtticaManager::Installed )
|
if ( state == AtticaManager::Installed )
|
||||||
{
|
{
|
||||||
|
qDebug() << "Already installed with resolver, just enabling";
|
||||||
acct = node->atticaAccount;
|
acct = node->atticaAccount;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
qDebug() << "Kicked off fetch+install, now waiting";
|
||||||
m_waitingForAtticaInstall.insert( resolver.id() );
|
m_waitingForAtticaInstall.insert( resolver.id() );
|
||||||
|
|
||||||
AtticaManager::instance()->installResolver( resolver );
|
AtticaManager::instance()->installResolver( resolver );
|
||||||
@@ -441,8 +443,15 @@ AccountModel::accountAdded( Account* account )
|
|||||||
}
|
}
|
||||||
else if ( attica && n->atticaContent.id() == attica->atticaId() )
|
else if ( attica && n->atticaContent.id() == attica->atticaId() )
|
||||||
{
|
{
|
||||||
|
|
||||||
n->resolverAccount = attica;
|
n->resolverAccount = attica;
|
||||||
|
n->atticaContent = AtticaManager::instance()->resolverForId( attica->atticaId() );
|
||||||
thisIsTheOne = true;
|
thisIsTheOne = true;
|
||||||
|
|
||||||
|
if ( m_waitingForAtticaInstall.contains( attica->atticaId() ) )
|
||||||
|
AccountManager::instance()->enableAccount( account );
|
||||||
|
|
||||||
|
m_waitingForAtticaInstall.remove( attica->atticaId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( thisIsTheOne )
|
if ( thisIsTheOne )
|
||||||
@@ -605,6 +614,7 @@ AccountModel::atticaInstalled( const QString& atticaId )
|
|||||||
AccountManager::instance()->enableAccount( acct );
|
AccountManager::instance()->enableAccount( acct );
|
||||||
|
|
||||||
node->atticaAccount = acct;
|
node->atticaAccount = acct;
|
||||||
|
node->atticaContent = AtticaManager::instance()->resolverForId( atticaId );
|
||||||
const QModelIndex idx = index( m_accounts.indexOf( node ), 0, QModelIndex() );
|
const QModelIndex idx = index( m_accounts.indexOf( node ), 0, QModelIndex() );
|
||||||
emit dataChanged( idx, idx );
|
emit dataChanged( idx, idx );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user