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