mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* Fix removing source from SuperCollection if it goes offline.
This commit is contained in:
@@ -12,6 +12,8 @@ CollectionFlatModel::CollectionFlatModel( QObject* parent )
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
m_rootItem = new PlItem( 0, this );
|
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 itemSizeChanged( p->index );
|
||||||
emit dataChanged( p->index, p->index.sibling( p->index.row(), columnCount() - 1 ) );
|
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 onTracksAdded( const QList<QVariant>& tracks, const Tomahawk::collection_ptr& collection );
|
||||||
void onTracksAddingFinished( const Tomahawk::collection_ptr& collection );
|
void onTracksAddingFinished( const Tomahawk::collection_ptr& collection );
|
||||||
|
|
||||||
|
void onSourceOffline( const Tomahawk::source_ptr& src );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap< Tomahawk::collection_ptr, PlItem* > m_collectionIndex;
|
QMap< Tomahawk::collection_ptr, PlItem* > m_collectionIndex;
|
||||||
QMap< Tomahawk::collection_ptr, QPair< int, int > > m_collectionRows;
|
QMap< Tomahawk::collection_ptr, QPair< int, int > > m_collectionRows;
|
||||||
|
@@ -11,6 +11,8 @@ CollectionModel::CollectionModel( QObject* parent )
|
|||||||
: QAbstractItemModel( parent )
|
: QAbstractItemModel( parent )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
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";
|
qDebug() << "Finished loading tracks";
|
||||||
emit loadingFinished();
|
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 onTracksAdded( const QList<QVariant>& tracks, const Tomahawk::collection_ptr& collection );
|
||||||
void onTracksAddingFinished( const Tomahawk::collection_ptr& collection );
|
void onTracksAddingFinished( const Tomahawk::collection_ptr& collection );
|
||||||
|
|
||||||
|
void onSourceOffline( Tomahawk::source_ptr src );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap< Tomahawk::collection_ptr, PlItem* > m_collectionIndex;
|
QMap< Tomahawk::collection_ptr, PlItem* > m_collectionIndex;
|
||||||
};
|
};
|
||||||
|
@@ -66,17 +66,8 @@ void
|
|||||||
SourceTreeView::onSourceOffline( Tomahawk::source_ptr src )
|
SourceTreeView::onSourceOffline( Tomahawk::source_ptr src )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
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
|
void
|
||||||
SourceTreeView::onItemActivated( const QModelIndex& index )
|
SourceTreeView::onItemActivated( const QModelIndex& index )
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>EchoChamber</string>
|
<string>Tomahawk</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
Reference in New Issue
Block a user