mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
Reset AlbumPlaylistInterface when associated collection changes.
This commit is contained in:
@@ -49,6 +49,10 @@ AlbumPlaylistInterface::AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk
|
||||
, m_album( QPointer< Tomahawk::Album >( album ) )
|
||||
, 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
|
||||
AlbumPlaylistInterface::indexOfResult( const Tomahawk::result_ptr& result ) const
|
||||
{
|
||||
|
@@ -69,6 +69,8 @@ private slots:
|
||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||
void infoSystemFinished( const QString& infoId );
|
||||
|
||||
void onCollectionChanged();
|
||||
|
||||
private:
|
||||
QList< Tomahawk::query_ptr > m_queries;
|
||||
mutable result_ptr m_currentItem;
|
||||
|
@@ -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
|
||||
PlaylistInterface::finishLoading()
|
||||
{
|
||||
|
@@ -108,6 +108,7 @@ signals:
|
||||
|
||||
protected slots:
|
||||
virtual void onItemsChanged();
|
||||
void startLoading();
|
||||
void finishLoading();
|
||||
void onQueryResolved();
|
||||
|
||||
|
Reference in New Issue
Block a user