1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

Let ViewPages decide if they need a PageItem

This commit is contained in:
Uwe L. Korn 2014-07-13 19:22:23 +01:00
parent 479afff627
commit fabbe65461
2 changed files with 11 additions and 0 deletions

View File

@ -72,6 +72,12 @@ public:
virtual bool jumpToCurrentTrack() = 0;
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
* restart of Tomahawk until the user selects it to be removed.

View File

@ -338,6 +338,11 @@ SourcesModel::appendGroups()
void
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 );
beginInsertRows( parentIndex, rowCount( parentIndex ), rowCount( parentIndex ) );
GenericPageItem* pageItem = new GenericPageItem( this, m_browse, page->title(), page->pixmap(),