mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-16 19:14:06 +02:00
* Fix loading spinner being stuck in certain cases.
This commit is contained in:
@@ -44,6 +44,7 @@ CollectionFlatModel::headerData( int section, Qt::Orientation orientation, int r
|
|||||||
return TrackModel::headerData( section, orientation, role );
|
return TrackModel::headerData( section, orientation, role );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CollectionFlatModel::addCollections( const QList< collection_ptr >& collections )
|
CollectionFlatModel::addCollections( const QList< collection_ptr >& collections )
|
||||||
{
|
{
|
||||||
@@ -184,13 +185,14 @@ CollectionFlatModel::onTracksAdded( const QList<Tomahawk::query_ptr>& tracks )
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << tracks.count() << rowCount( QModelIndex() );
|
qDebug() << Q_FUNC_INFO << tracks.count() << rowCount( QModelIndex() );
|
||||||
|
|
||||||
if( !m_loadingCollections.isEmpty() && sender() && qobject_cast< Collection* >( sender() ) ) { // we are keeping track and are called as a slot
|
if( !m_loadingCollections.isEmpty() && sender() && qobject_cast< Collection* >( sender() ) )
|
||||||
|
{
|
||||||
|
// we are keeping track and are called as a slot
|
||||||
m_loadingCollections.removeAll( qobject_cast< Collection* >( sender() ) );
|
m_loadingCollections.removeAll( qobject_cast< Collection* >( sender() ) );
|
||||||
|
|
||||||
if( m_loadingCollections.isEmpty() )
|
|
||||||
emit doneLoadingCollections();
|
|
||||||
}
|
}
|
||||||
|
if( m_loadingCollections.isEmpty() )
|
||||||
|
emit doneLoadingCollections();
|
||||||
|
|
||||||
bool kickOff = m_tracksToAdd.isEmpty();
|
bool kickOff = m_tracksToAdd.isEmpty();
|
||||||
m_tracksToAdd << tracks;
|
m_tracksToAdd << tracks;
|
||||||
|
|
||||||
|
@@ -35,7 +35,7 @@ public:
|
|||||||
QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
|
QVariant headerData( int section, Qt::Orientation orientation, int role ) const;
|
||||||
|
|
||||||
void addCollections( const QList< Tomahawk::collection_ptr >& collections );
|
void addCollections( const QList< Tomahawk::collection_ptr >& collections );
|
||||||
|
|
||||||
void addCollection( const Tomahawk::collection_ptr& collection );
|
void addCollection( const Tomahawk::collection_ptr& collection );
|
||||||
void removeCollection( const Tomahawk::collection_ptr& collection );
|
void removeCollection( const Tomahawk::collection_ptr& collection );
|
||||||
|
|
||||||
@@ -50,6 +50,7 @@ signals:
|
|||||||
void itemSizeChanged( const QModelIndex& index );
|
void itemSizeChanged( const QModelIndex& index );
|
||||||
|
|
||||||
void doneLoadingCollections();
|
void doneLoadingCollections();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDataChanged();
|
void onDataChanged();
|
||||||
|
|
||||||
|
@@ -255,10 +255,10 @@ PlaylistManager::show( const Tomahawk::collection_ptr& collection )
|
|||||||
view->setModel( model );
|
view->setModel( model );
|
||||||
view->setFrameShape( QFrame::NoFrame );
|
view->setFrameShape( QFrame::NoFrame );
|
||||||
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
|
||||||
model->addCollection( collection );
|
|
||||||
|
|
||||||
m_loadingSpinner->fadeIn();
|
m_loadingSpinner->fadeIn();
|
||||||
connect( model, SIGNAL( doneLoadingCollections() ), m_loadingSpinner, SLOT( fadeOut() ) );
|
connect( model, SIGNAL( doneLoadingCollections() ), m_loadingSpinner, SLOT( fadeOut() ) );
|
||||||
|
model->addCollection( collection );
|
||||||
|
|
||||||
m_collectionViews.insert( collection, view );
|
m_collectionViews.insert( collection, view );
|
||||||
}
|
}
|
||||||
@@ -339,18 +339,23 @@ PlaylistManager::showSuperCollection()
|
|||||||
QList< collection_ptr > toAdd;
|
QList< collection_ptr > toAdd;
|
||||||
foreach( const Tomahawk::source_ptr& source, SourceList::instance()->sources() )
|
foreach( const Tomahawk::source_ptr& source, SourceList::instance()->sources() )
|
||||||
{
|
{
|
||||||
|
bool addedStuff = false;
|
||||||
if ( !m_superCollections.contains( source->collection() ) )
|
if ( !m_superCollections.contains( source->collection() ) )
|
||||||
{
|
{
|
||||||
m_superCollections.append( source->collection() );
|
m_superCollections.append( source->collection() );
|
||||||
toAdd << source->collection();
|
toAdd << source->collection();
|
||||||
m_superAlbumModel->addCollection( source->collection() );
|
m_superAlbumModel->addCollection( source->collection() );
|
||||||
|
addedStuff = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( addedStuff )
|
||||||
|
m_loadingSpinner->fadeIn();
|
||||||
|
|
||||||
m_superCollectionFlatModel->setTitle( tr( "All available tracks" ) );
|
m_superCollectionFlatModel->setTitle( tr( "All available tracks" ) );
|
||||||
m_superAlbumModel->setTitle( tr( "All available albums" ) );
|
m_superAlbumModel->setTitle( tr( "All available albums" ) );
|
||||||
}
|
}
|
||||||
m_superCollectionFlatModel->addCollections( toAdd );
|
m_superCollectionFlatModel->addCollections( toAdd );
|
||||||
|
|
||||||
if ( m_currentMode == 0 )
|
if ( m_currentMode == 0 )
|
||||||
{
|
{
|
||||||
setPage( m_superCollectionView );
|
setPage( m_superCollectionView );
|
||||||
@@ -359,9 +364,7 @@ PlaylistManager::showSuperCollection()
|
|||||||
{
|
{
|
||||||
setPage( m_superAlbumView );
|
setPage( m_superAlbumView );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_loadingSpinner->fadeIn();
|
|
||||||
|
|
||||||
emit numSourcesChanged( m_superCollections.count() );
|
emit numSourcesChanged( m_superCollections.count() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user