diff --git a/src/jabber/jabber_p.cpp b/src/jabber/jabber_p.cpp index 0890dac2c..9ba1a9dc0 100644 --- a/src/jabber/jabber_p.cpp +++ b/src/jabber/jabber_p.cpp @@ -108,7 +108,7 @@ Jabber_p::doJabberRecv() void Jabber_p::disconnect() { - if(m_client) + if ( m_client ) { m_client->disconnect(); } diff --git a/src/playlist/collectionflatmodel.cpp b/src/playlist/collectionflatmodel.cpp index 16361de1f..b74703deb 100644 --- a/src/playlist/collectionflatmodel.cpp +++ b/src/playlist/collectionflatmodel.cpp @@ -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() ); + } +} diff --git a/src/playlist/collectionflatmodel.h b/src/playlist/collectionflatmodel.h index 02647f34b..c5bb5b2fe 100644 --- a/src/playlist/collectionflatmodel.h +++ b/src/playlist/collectionflatmodel.h @@ -47,6 +47,8 @@ private slots: void onTracksAdded( const QList& 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; diff --git a/src/playlist/collectionmodel.cpp b/src/playlist/collectionmodel.cpp index 7bfd392b8..841b8da9c 100644 --- a/src/playlist/collectionmodel.cpp +++ b/src/playlist/collectionmodel.cpp @@ -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() ); + } +} diff --git a/src/playlist/collectionmodel.h b/src/playlist/collectionmodel.h index 97ba9b7fb..a7afde6d9 100644 --- a/src/playlist/collectionmodel.h +++ b/src/playlist/collectionmodel.h @@ -63,6 +63,8 @@ private slots: void onTracksAdded( const QList& 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; }; diff --git a/src/sourcetree/sourcetreeview.cpp b/src/sourcetree/sourcetreeview.cpp index 4774f304f..9a568a077 100644 --- a/src/sourcetree/sourcetreeview.cpp +++ b/src/sourcetree/sourcetreeview.cpp @@ -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 ) { diff --git a/src/tomahawkwindow.ui b/src/tomahawkwindow.ui index 7cb72bd69..5bfce6469 100644 --- a/src/tomahawkwindow.ui +++ b/src/tomahawkwindow.ui @@ -11,7 +11,7 @@ - EchoChamber + Tomahawk