mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Handle case where attica load is super slow
This commit is contained in:
@@ -38,8 +38,9 @@ using namespace Accounts;
|
|||||||
|
|
||||||
AccountModel::AccountModel( QObject* parent )
|
AccountModel::AccountModel( QObject* parent )
|
||||||
: QAbstractListModel( parent )
|
: QAbstractListModel( parent )
|
||||||
|
, m_waitingForAtticaLoaded( true )
|
||||||
{
|
{
|
||||||
connect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( loadData() ) );
|
connect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( atticaLoaded() ) );
|
||||||
connect( AtticaManager::instance(), SIGNAL( startedInstalling( QString ) ), this, SLOT( onStartedInstalling( QString ) ) );
|
connect( AtticaManager::instance(), SIGNAL( startedInstalling( QString ) ), this, SLOT( onStartedInstalling( QString ) ) );
|
||||||
connect( AtticaManager::instance(), SIGNAL( resolverInstalled( QString ) ), this, SLOT( onFinishedInstalling( QString ) ) );
|
connect( AtticaManager::instance(), SIGNAL( resolverInstalled( QString ) ), this, SLOT( onFinishedInstalling( QString ) ) );
|
||||||
connect( AtticaManager::instance(), SIGNAL( resolverInstallationFailed( QString ) ), this, SLOT( resolverInstallFailed( QString ) ) );
|
connect( AtticaManager::instance(), SIGNAL( resolverInstallationFailed( QString ) ), this, SLOT( resolverInstallFailed( QString ) ) );
|
||||||
@@ -51,6 +52,15 @@ AccountModel::AccountModel( QObject* parent )
|
|||||||
loadData();
|
loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AccountModel::atticaLoaded()
|
||||||
|
{
|
||||||
|
m_waitingForAtticaLoaded = false;
|
||||||
|
loadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AccountModel::loadData()
|
AccountModel::loadData()
|
||||||
{
|
{
|
||||||
@@ -644,7 +654,8 @@ AccountModel::accountAdded( Account* account )
|
|||||||
if ( ResolverAccount* resolver = qobject_cast< ResolverAccount* >( account ) )
|
if ( ResolverAccount* resolver = qobject_cast< ResolverAccount* >( account ) )
|
||||||
{
|
{
|
||||||
qDebug() << "Plain old manual resolver added, appending at end";
|
qDebug() << "Plain old manual resolver added, appending at end";
|
||||||
Q_ASSERT( qobject_cast< AtticaResolverAccount* >( account ) == 0 ); // should NOT get attica accounts here, should be caught above
|
if ( !m_waitingForAtticaLoaded )
|
||||||
|
Q_ASSERT( qobject_cast< AtticaResolverAccount* >( account ) == 0 ); // should NOT get attica accounts here, should be caught above
|
||||||
const int count = m_accounts.size();
|
const int count = m_accounts.size();
|
||||||
beginInsertRows( QModelIndex(), count, count );
|
beginInsertRows( QModelIndex(), count, count );
|
||||||
m_accounts << new AccountModelNode( resolver );
|
m_accounts << new AccountModelNode( resolver );
|
||||||
|
@@ -100,6 +100,7 @@ signals:
|
|||||||
void errorInstalling( const QPersistentModelIndex& idx );
|
void errorInstalling( const QPersistentModelIndex& idx );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void atticaLoaded();
|
||||||
void loadData();
|
void loadData();
|
||||||
|
|
||||||
void accountAdded( Tomahawk::Accounts::Account* );
|
void accountAdded( Tomahawk::Accounts::Account* );
|
||||||
@@ -112,6 +113,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QModelIndex indexForAtticaId( const QString& resolverId ) const;
|
QModelIndex indexForAtticaId( const QString& resolverId ) const;
|
||||||
|
|
||||||
|
bool m_waitingForAtticaLoaded;
|
||||||
QList< AccountModelNode* > m_accounts;
|
QList< AccountModelNode* > m_accounts;
|
||||||
QSet< QString > m_waitingForAtticaInstall;
|
QSet< QString > m_waitingForAtticaInstall;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user