mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
* Fix removing source from SuperCollection if it goes offline.
This commit is contained in:
@@ -108,7 +108,7 @@ Jabber_p::doJabberRecv()
|
||||
void
|
||||
Jabber_p::disconnect()
|
||||
{
|
||||
if(m_client)
|
||||
if ( m_client )
|
||||
{
|
||||
m_client->disconnect();
|
||||
}
|
||||
|
@@ -12,6 +12,8 @@ CollectionFlatModel::CollectionFlatModel( QObject* parent )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
m_rootItem = new PlItem( 0, this );
|
||||
|
||||
connect( &APP->sourcelist(), SIGNAL( sourceRemoved( Tomahawk::source_ptr ) ), SLOT( onSourceOffline( Tomahawk::source_ptr ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -174,3 +176,15 @@ CollectionFlatModel::onDataChanged()
|
||||
// emit itemSizeChanged( p->index );
|
||||
emit dataChanged( p->index, p->index.sibling( p->index.row(), columnCount() - 1 ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CollectionFlatModel::onSourceOffline( const Tomahawk::source_ptr& src )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( m_collectionIndex.contains( src->collection() ) )
|
||||
{
|
||||
removeCollection( src->collection() );
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,8 @@ private slots:
|
||||
void onTracksAdded( const QList<QVariant>& tracks, const Tomahawk::collection_ptr& collection );
|
||||
void onTracksAddingFinished( const Tomahawk::collection_ptr& collection );
|
||||
|
||||
void onSourceOffline( const Tomahawk::source_ptr& src );
|
||||
|
||||
private:
|
||||
QMap< Tomahawk::collection_ptr, PlItem* > m_collectionIndex;
|
||||
QMap< Tomahawk::collection_ptr, QPair< int, int > > m_collectionRows;
|
||||
|
@@ -11,6 +11,8 @@ CollectionModel::CollectionModel( QObject* parent )
|
||||
: QAbstractItemModel( parent )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
connect( &APP->sourcelist(), SIGNAL( sourceRemoved( Tomahawk::source_ptr ) ), SLOT( onSourceOffline( Tomahawk::source_ptr ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -242,3 +244,15 @@ CollectionModel::onTracksAddingFinished( const Tomahawk::collection_ptr& /* coll
|
||||
qDebug() << "Finished loading tracks";
|
||||
emit loadingFinished();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CollectionModel::onSourceOffline( Tomahawk::source_ptr src )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( m_collectionIndex.contains( src->collection() ) )
|
||||
{
|
||||
removeCollection( src->collection() );
|
||||
}
|
||||
}
|
||||
|
@@ -63,6 +63,8 @@ private slots:
|
||||
void onTracksAdded( const QList<QVariant>& tracks, const Tomahawk::collection_ptr& collection );
|
||||
void onTracksAddingFinished( const Tomahawk::collection_ptr& collection );
|
||||
|
||||
void onSourceOffline( Tomahawk::source_ptr src );
|
||||
|
||||
private:
|
||||
QMap< Tomahawk::collection_ptr, PlItem* > m_collectionIndex;
|
||||
};
|
||||
|
@@ -66,18 +66,9 @@ void
|
||||
SourceTreeView::onSourceOffline( Tomahawk::source_ptr src )
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
if ( APP->playlistManager()->superCollections().contains( src->collection() ) )
|
||||
{
|
||||
qDebug() << "Removing source from active view";
|
||||
APP->playlistManager()->show( src->collection() );
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "not removing source from active view (not active)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||
{
|
||||
|
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>EchoChamber</string>
|
||||
<string>Tomahawk</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
Reference in New Issue
Block a user