From 4bd3ff8c1864ff8890ac3c1822835c8fa317318c Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Sun, 16 Jun 2013 19:35:58 +0200 Subject: [PATCH] Add generic page item for new view pages --- src/tomahawk/sourcetree/SourcesModel.cpp | 13 ++++++++++--- src/tomahawk/sourcetree/SourcesModel.h | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/tomahawk/sourcetree/SourcesModel.cpp b/src/tomahawk/sourcetree/SourcesModel.cpp index 2767ab196..56b61b0ab 100644 --- a/src/tomahawk/sourcetree/SourcesModel.cpp +++ b/src/tomahawk/sourcetree/SourcesModel.cpp @@ -59,9 +59,6 @@ SourcesModel::SourcesModel( QObject* parent ) appendGroups(); - // Add stub page - appendPageItem( ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ), "Stub Page", "stub"); - onSourcesAdded( SourceList::instance()->sources() ); connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), @@ -80,6 +77,9 @@ SourcesModel::SourcesModel( QObject* parent ) this, SLOT( onScriptCollectionAdded( Tomahawk::collection_ptr ) ) ); connect( SourceList::instance(), SIGNAL( scriptCollectionRemoved( Tomahawk::collection_ptr ) ), this, SLOT( onScriptCollectionRemoved( Tomahawk::collection_ptr ) ) ); + + + connect( ViewManager::instance(), SIGNAL( viewPageAdded( QString ) ), SLOT( onViewPageAdded( QString ) ) ); } @@ -672,6 +672,13 @@ SourcesModel::onWidgetDestroyed( QWidget* w ) } +void +SourcesModel::onViewPageAdded( const QString& name ) +{ + appendPageItem( ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ), name, name); +} + + void SourcesModel::removeSourceItemLink( SourceTreeItem* item ) { diff --git a/src/tomahawk/sourcetree/SourcesModel.h b/src/tomahawk/sourcetree/SourcesModel.h index 637642003..48172e57d 100644 --- a/src/tomahawk/sourcetree/SourcesModel.h +++ b/src/tomahawk/sourcetree/SourcesModel.h @@ -151,6 +151,8 @@ private slots: void onWidgetDestroyed( QWidget* w ); + void onViewPageAdded( const QString& name ); + private: SourceTreeItem* itemFromIndex( const QModelIndex& idx ) const; int rowForItem( SourceTreeItem* item ) const;