mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-28 11:42:42 +01:00
Add icon() method to ViewPage api and use that and title() for sidebar items
This commit is contained in:
parent
d83c2c3c06
commit
7dbe504a0f
@ -28,6 +28,11 @@ ViewPage::~ViewPage()
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
QIcon ViewPage::icon() const
|
||||
{
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
ViewPage::setFilter( const QString& filter )
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
virtual QWidget* widget() = 0;
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0;
|
||||
|
||||
virtual QIcon icon() const;
|
||||
virtual QString title() const = 0;
|
||||
|
||||
virtual DescriptionType descriptionType() { return TextType; }
|
||||
|
@ -348,13 +348,17 @@ SourcesModel::appendGroups()
|
||||
}
|
||||
|
||||
void
|
||||
SourcesModel::appendPageItem( const QIcon& pageIcon, const QString& pageTitle, const QString& pageName )
|
||||
SourcesModel::appendPageItem( const QString& pageName )
|
||||
{
|
||||
QModelIndex parentIndex = indexFromItem( m_browse );
|
||||
beginInsertRows( parentIndex, rowCount( parentIndex ), rowCount( parentIndex ) );
|
||||
GenericPageItem* pageItem = new GenericPageItem( this, m_browse, pageTitle, pageIcon,
|
||||
boost::bind( &ViewManager::showDynamicPage, ViewManager::instance(), pageName ),
|
||||
boost::bind( &ViewManager::dynamicPageWidget, ViewManager::instance(), pageName ) );
|
||||
GenericPageItem* pageItem = new GenericPageItem( this,
|
||||
m_browse,
|
||||
ViewManager::instance()->dynamicPageWidget( pageName )->title(),
|
||||
ViewManager::instance()->dynamicPageWidget( pageName )->icon(),
|
||||
boost::bind( &ViewManager::showDynamicPage, ViewManager::instance(), pageName ),
|
||||
boost::bind( &ViewManager::dynamicPageWidget, ViewManager::instance(), pageName ) );
|
||||
|
||||
pageItem->setSortValue( rowCount( parentIndex ) );
|
||||
|
||||
endInsertRows();
|
||||
@ -673,9 +677,9 @@ SourcesModel::onWidgetDestroyed( QWidget* w )
|
||||
|
||||
|
||||
void
|
||||
SourcesModel::onViewPageAdded( const QString& name )
|
||||
SourcesModel::onViewPageAdded( const QString& pageName )
|
||||
{
|
||||
appendPageItem( ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ), name, name);
|
||||
appendPageItem( pageName );
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,10 +103,7 @@ public:
|
||||
|
||||
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 appendPageItem( const QString& pageName );
|
||||
|
||||
void appendItem( const Tomahawk::source_ptr& source );
|
||||
bool removeItem( const Tomahawk::source_ptr& source );
|
||||
@ -151,7 +148,7 @@ private slots:
|
||||
|
||||
void onWidgetDestroyed( QWidget* w );
|
||||
|
||||
void onViewPageAdded( const QString& name );
|
||||
void onViewPageAdded( const QString& pageName );
|
||||
|
||||
private:
|
||||
SourceTreeItem* itemFromIndex( const QModelIndex& idx ) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user