1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 17:14:00 +02:00

Reset AlbumPlaylistInterface when associated collection changes.

This commit is contained in:
Christian Muehlhaeuser
2015-04-13 05:37:20 +02:00
parent 6914b7a45d
commit bef28bcd87
4 changed files with 33 additions and 0 deletions

View File

@@ -49,6 +49,10 @@ AlbumPlaylistInterface::AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk
, m_album( QPointer< Tomahawk::Album >( album ) ) , m_album( QPointer< Tomahawk::Album >( album ) )
, m_lastQueryTimestamp( 0 ) , m_lastQueryTimestamp( 0 )
{ {
if ( m_collection )
{
connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
}
} }
@@ -317,6 +321,19 @@ AlbumPlaylistInterface::onTracksLoaded( const QList< query_ptr >& tracks )
} }
void
AlbumPlaylistInterface::onCollectionChanged()
{
// tDebug() << Q_FUNC_INFO << m_album->name();
if ( m_mode == Tomahawk::DatabaseMode )
{
startLoading();
m_databaseLoaded = false;
m_queries.clear();
}
}
qint64 qint64
AlbumPlaylistInterface::indexOfResult( const Tomahawk::result_ptr& result ) const AlbumPlaylistInterface::indexOfResult( const Tomahawk::result_ptr& result ) const
{ {

View File

@@ -69,6 +69,8 @@ private slots:
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ); void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( const QString& infoId ); void infoSystemFinished( const QString& infoId );
void onCollectionChanged();
private: private:
QList< Tomahawk::query_ptr > m_queries; QList< Tomahawk::query_ptr > m_queries;
mutable result_ptr m_currentItem; mutable result_ptr m_currentItem;

View File

@@ -249,6 +249,19 @@ PlaylistInterface::setCurrentIndex( qint64 index )
} }
void
PlaylistInterface::startLoading()
{
foreach ( const Tomahawk::query_ptr& query, tracks() )
{
disconnect( query.data(), SIGNAL( playableStateChanged( bool ) ), this, SLOT( onItemsChanged() ) );
disconnect( query.data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( onQueryResolved() ) );
}
m_finished = false;
}
void void
PlaylistInterface::finishLoading() PlaylistInterface::finishLoading()
{ {

View File

@@ -108,6 +108,7 @@ signals:
protected slots: protected slots:
virtual void onItemsChanged(); virtual void onItemsChanged();
void startLoading();
void finishLoading(); void finishLoading();
void onQueryResolved(); void onQueryResolved();