mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Let ViewPages decide if they need a PageItem
This commit is contained in:
@@ -72,6 +72,12 @@ public:
|
|||||||
virtual bool jumpToCurrentTrack() = 0;
|
virtual bool jumpToCurrentTrack() = 0;
|
||||||
|
|
||||||
virtual bool isTemporaryPage() const { return false; }
|
virtual bool isTemporaryPage() const { return false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should we add a row in the SourceTreeView for this page.
|
||||||
|
*/
|
||||||
|
virtual bool addPageItem() const { return true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This page is actually a constant page that will be shown on every
|
* This page is actually a constant page that will be shown on every
|
||||||
* restart of Tomahawk until the user selects it to be removed.
|
* restart of Tomahawk until the user selects it to be removed.
|
||||||
|
@@ -338,6 +338,11 @@ SourcesModel::appendGroups()
|
|||||||
void
|
void
|
||||||
SourcesModel::appendPageItem( const QString& name, ViewPage* page, int sortValue )
|
SourcesModel::appendPageItem( const QString& name, ViewPage* page, int sortValue )
|
||||||
{
|
{
|
||||||
|
// If there should be no page item, there is nothing to do for us here.
|
||||||
|
if ( !page->addPageItem() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex parentIndex = indexFromItem( m_browse );
|
QModelIndex parentIndex = indexFromItem( m_browse );
|
||||||
beginInsertRows( parentIndex, rowCount( parentIndex ), rowCount( parentIndex ) );
|
beginInsertRows( parentIndex, rowCount( parentIndex ), rowCount( parentIndex ) );
|
||||||
GenericPageItem* pageItem = new GenericPageItem( this, m_browse, page->title(), page->pixmap(),
|
GenericPageItem* pageItem = new GenericPageItem( this, m_browse, page->title(), page->pixmap(),
|
||||||
|
Reference in New Issue
Block a user