mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
Move stub page adding from appendGroups to SourcesModel ctor
This commit is contained in:
@@ -58,6 +58,10 @@ SourcesModel::SourcesModel( QObject* parent )
|
|||||||
m_rootItem = new SourceTreeItem( this, 0, Invalid );
|
m_rootItem = new SourceTreeItem( this, 0, Invalid );
|
||||||
|
|
||||||
appendGroups();
|
appendGroups();
|
||||||
|
|
||||||
|
// Add stub page
|
||||||
|
appendPageItem( ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ), "Stub Page", "stub");
|
||||||
|
|
||||||
onSourcesAdded( SourceList::instance()->sources() );
|
onSourcesAdded( SourceList::instance()->sources() );
|
||||||
|
|
||||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ),
|
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ),
|
||||||
@@ -292,56 +296,48 @@ SourcesModel::appendGroups()
|
|||||||
{
|
{
|
||||||
beginInsertRows( QModelIndex(), rowCount(), rowCount() + 4 );
|
beginInsertRows( QModelIndex(), rowCount(), rowCount() + 4 );
|
||||||
|
|
||||||
GroupItem* browse = new GroupItem( this, m_rootItem, tr( "Browse" ), 0 );
|
m_browse = new GroupItem( this, m_rootItem, tr( "Browse" ), 0 );
|
||||||
new HistoryItem( this, m_rootItem, tr( "Search History" ), 1 );
|
new HistoryItem( this, m_rootItem, tr( "Search History" ), 1 );
|
||||||
// new SourceTreeItem( this, m_rootItem, SourcesModel::Divider, 2 );
|
// new SourceTreeItem( this, m_rootItem, SourcesModel::Divider, 2 );
|
||||||
m_myMusicGroup = new GroupItem( this, m_rootItem, tr( "My Music" ), 3 );
|
m_myMusicGroup = new GroupItem( this, m_rootItem, tr( "My Music" ), 3 );
|
||||||
|
|
||||||
GenericPageItem* dashboard = new GenericPageItem( this, browse, tr( "Dashboard" ), ImageRegistry::instance()->icon( RESPATH "images/dashboard.svg" ),
|
GenericPageItem* dashboard = new GenericPageItem( this, m_browse, tr( "Dashboard" ), ImageRegistry::instance()->icon( RESPATH "images/dashboard.svg" ),
|
||||||
boost::bind( &ViewManager::showDashboard, ViewManager::instance() ),
|
boost::bind( &ViewManager::showDashboard, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::dashboard, ViewManager::instance() ) );
|
boost::bind( &ViewManager::dashboard, ViewManager::instance() ) );
|
||||||
dashboard->setSortValue( 0 );
|
dashboard->setSortValue( 0 );
|
||||||
|
|
||||||
// super collection
|
// super collection
|
||||||
GenericPageItem* sc = new GenericPageItem( this, browse, tr( "SuperCollection" ), ImageRegistry::instance()->icon( RESPATH "images/supercollection.svg" ),
|
GenericPageItem* sc = new GenericPageItem( this, m_browse, tr( "SuperCollection" ), ImageRegistry::instance()->icon( RESPATH "images/supercollection.svg" ),
|
||||||
boost::bind( &ViewManager::showSuperCollection, ViewManager::instance() ),
|
boost::bind( &ViewManager::showSuperCollection, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::superCollectionView, ViewManager::instance() ) );
|
boost::bind( &ViewManager::superCollectionView, ViewManager::instance() ) );
|
||||||
sc->setSortValue( 1 );
|
sc->setSortValue( 1 );
|
||||||
|
|
||||||
// browse section
|
// browse section
|
||||||
LovedTracksItem* loved = new LovedTracksItem( this, browse );
|
LovedTracksItem* loved = new LovedTracksItem( this, m_browse );
|
||||||
loved->setSortValue( 2 );
|
loved->setSortValue( 2 );
|
||||||
|
|
||||||
GenericPageItem* networkActivity = new GenericPageItem( this, browse, tr( "Network Activity" ), TomahawkUtils::defaultPixmap( TomahawkUtils::NetworkActivity, TomahawkUtils::Original ),
|
GenericPageItem* networkActivity = new GenericPageItem( this, m_browse, tr( "Network Activity" ), TomahawkUtils::defaultPixmap( TomahawkUtils::NetworkActivity, TomahawkUtils::Original ),
|
||||||
boost::bind( &ViewManager::showNetworkActivityPage, ViewManager::instance() ),
|
boost::bind( &ViewManager::showNetworkActivityPage, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::networkActivityWidget, ViewManager::instance() ) );
|
boost::bind( &ViewManager::networkActivityWidget, ViewManager::instance() ) );
|
||||||
networkActivity->setSortValue( 3 );
|
networkActivity->setSortValue( 3 );
|
||||||
|
|
||||||
GenericPageItem* recent = new GenericPageItem( this, browse, tr( "Recently Played" ), ImageRegistry::instance()->icon( RESPATH "images/recently-played.svg" ),
|
GenericPageItem* recent = new GenericPageItem( this, m_browse, tr( "Recently Played" ), ImageRegistry::instance()->icon( RESPATH "images/recently-played.svg" ),
|
||||||
boost::bind( &ViewManager::showRecentPlaysPage, ViewManager::instance() ),
|
boost::bind( &ViewManager::showRecentPlaysPage, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::recentPlaysWidget, ViewManager::instance() ) );
|
boost::bind( &ViewManager::recentPlaysWidget, ViewManager::instance() ) );
|
||||||
recent->setSortValue( 4 );
|
recent->setSortValue( 4 );
|
||||||
|
|
||||||
GenericPageItem* hot = new GenericPageItem( this, browse, tr( "Charts" ), ImageRegistry::instance()->icon( RESPATH "images/charts.svg" ),
|
GenericPageItem* hot = new GenericPageItem( this, m_browse, tr( "Charts" ), ImageRegistry::instance()->icon( RESPATH "images/charts.svg" ),
|
||||||
boost::bind( &ViewManager::showWhatsHotPage, ViewManager::instance() ),
|
boost::bind( &ViewManager::showWhatsHotPage, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::whatsHotWidget, ViewManager::instance() ) );
|
boost::bind( &ViewManager::whatsHotWidget, ViewManager::instance() ) );
|
||||||
hot->setSortValue( 5 );
|
hot->setSortValue( 5 );
|
||||||
|
|
||||||
GenericPageItem* newReleases = new GenericPageItem( this, browse, tr( "New Releases" ), ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ),
|
GenericPageItem* newReleases = new GenericPageItem( this, m_browse, tr( "New Releases" ), ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ),
|
||||||
boost::bind( &ViewManager::showNewReleasesPage, ViewManager::instance() ),
|
boost::bind( &ViewManager::showNewReleasesPage, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::newReleasesWidget, ViewManager::instance() ) );
|
boost::bind( &ViewManager::newReleasesWidget, ViewManager::instance() ) );
|
||||||
newReleases->setSortValue( 6 );
|
newReleases->setSortValue( 6 );
|
||||||
|
|
||||||
|
|
||||||
GenericPageItem* stub = new GenericPageItem( this, browse, tr( "Stub page" ), ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ),
|
InboxItem* inbox = new InboxItem( this, m_browse );
|
||||||
boost::bind( &ViewManager::showDynamicPage, ViewManager::instance(), QString( "stub" )),
|
|
||||||
boost::bind( &ViewManager::dynamicPageWidget, ViewManager::instance(), QString( "stub" ) ) );
|
|
||||||
|
|
||||||
stub->setSortValue( 7 );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InboxItem* inbox = new InboxItem( this, browse );
|
|
||||||
inbox->setSortValue( 7 );
|
inbox->setSortValue( 7 );
|
||||||
|
|
||||||
m_collectionsGroup = new GroupItem( this, m_rootItem, tr( "Friends" ), 4 );
|
m_collectionsGroup = new GroupItem( this, m_rootItem, tr( "Friends" ), 4 );
|
||||||
@@ -351,6 +347,18 @@ SourcesModel::appendGroups()
|
|||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SourcesModel::appendPageItem( const QIcon& pageIcon, const QString& pageTitle, const QString& pageName )
|
||||||
|
{
|
||||||
|
|
||||||
|
// beginInsertRows();
|
||||||
|
GenericPageItem* pageItem = new GenericPageItem( this, m_browse, pageTitle, pageIcon,
|
||||||
|
boost::bind( &ViewManager::showDynamicPage, ViewManager::instance(), pageName ),
|
||||||
|
boost::bind( &ViewManager::dynamicPageWidget, ViewManager::instance(), pageName ) );
|
||||||
|
m_browse;
|
||||||
|
// endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourcesModel::appendItem( const Tomahawk::source_ptr& source )
|
SourcesModel::appendItem( const Tomahawk::source_ptr& source )
|
||||||
|
@@ -103,6 +103,11 @@ public:
|
|||||||
|
|
||||||
void appendGroups();
|
void appendGroups();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pageIcon and pageTitle are visible in the source tree, pageName is the internal name in the ViewManager
|
||||||
|
*/
|
||||||
|
void appendPageItem( const QIcon& pageIcon, const QString& pageTitle, const QString& pageName );
|
||||||
|
|
||||||
void appendItem( const Tomahawk::source_ptr& source );
|
void appendItem( const Tomahawk::source_ptr& source );
|
||||||
bool removeItem( const Tomahawk::source_ptr& source );
|
bool removeItem( const Tomahawk::source_ptr& source );
|
||||||
|
|
||||||
@@ -152,6 +157,7 @@ private:
|
|||||||
SourceTreeItem* activatePlaylistPage( Tomahawk::ViewPage* p, SourceTreeItem* i );
|
SourceTreeItem* activatePlaylistPage( Tomahawk::ViewPage* p, SourceTreeItem* i );
|
||||||
|
|
||||||
SourceTreeItem* m_rootItem;
|
SourceTreeItem* m_rootItem;
|
||||||
|
GroupItem* m_browse;
|
||||||
GroupItem* m_collectionsGroup;
|
GroupItem* m_collectionsGroup;
|
||||||
GroupItem* m_myMusicGroup;
|
GroupItem* m_myMusicGroup;
|
||||||
GroupItem* m_cloudGroup;
|
GroupItem* m_cloudGroup;
|
||||||
|
Reference in New Issue
Block a user