mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
* SourceTreeItem needs to be linked to the correct ViewPage.
This commit is contained in:
@@ -894,13 +894,11 @@ ViewManager::addDynamicPage( Tomahawk::ViewPagePlugin* viewPage, const QString&
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_dynamicPagePlugins.insert( pageId, viewPage );
|
m_dynamicPagePlugins.insert( pageId, viewPage );
|
||||||
|
emit viewPageAdded( pageId, viewPage, viewPage->sortValue() );
|
||||||
// HACK: rather emit the viewpage itself ...
|
|
||||||
emit viewPageAdded( pageId, viewPage->title(), viewPage->pixmap(), viewPage->sortValue() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
/*void
|
||||||
ViewManager::addDynamicPage( const QString& pageName, const QString& text, const QIcon& icon, boost::function<Tomahawk::ViewPage*()> instanceLoader, int sortValue )
|
ViewManager::addDynamicPage( const QString& pageName, const QString& text, const QIcon& icon, boost::function<Tomahawk::ViewPage*()> instanceLoader, int sortValue )
|
||||||
{
|
{
|
||||||
tLog() << Q_FUNC_INFO << "Trying to add" << pageName;
|
tLog() << Q_FUNC_INFO << "Trying to add" << pageName;
|
||||||
@@ -913,7 +911,7 @@ ViewManager::addDynamicPage( const QString& pageName, const QString& text, const
|
|||||||
|
|
||||||
m_dynamicPagesInstanceLoaders.insert( pageName, instanceLoader );
|
m_dynamicPagesInstanceLoaders.insert( pageName, instanceLoader );
|
||||||
emit viewPageAdded( pageName, text, icon, sortValue );
|
emit viewPageAdded( pageName, text, icon, sortValue );
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
ViewPage*
|
ViewPage*
|
||||||
@@ -947,6 +945,7 @@ ViewManager::superCollectionView() const
|
|||||||
return m_superCollectionView;
|
return m_superCollectionView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InboxModel*
|
InboxModel*
|
||||||
ViewManager::inboxModel()
|
ViewManager::inboxModel()
|
||||||
{
|
{
|
||||||
|
@@ -135,7 +135,7 @@ signals:
|
|||||||
void historyBackAvailable( bool avail );
|
void historyBackAvailable( bool avail );
|
||||||
void historyForwardAvailable( bool avail );
|
void historyForwardAvailable( bool avail );
|
||||||
|
|
||||||
void viewPageAdded( const QString& pageName, const QString& text, const QIcon& icon, int sortValue );
|
void viewPageAdded( const QString& pageName, Tomahawk::ViewPage* page, int sortValue );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Tomahawk::ViewPage* showSuperCollection();
|
Tomahawk::ViewPage* showSuperCollection();
|
||||||
@@ -144,7 +144,7 @@ public slots:
|
|||||||
Tomahawk::ViewPage* showRecentPlaysPage();
|
Tomahawk::ViewPage* showRecentPlaysPage();
|
||||||
Tomahawk::ViewPage* showInboxPage();
|
Tomahawk::ViewPage* showInboxPage();
|
||||||
|
|
||||||
void addDynamicPage( const QString& pageName, const QString& text, const QIcon& icon, boost::function< Tomahawk::ViewPage*() > instanceLoader, int sortValue = 0 );
|
// void addDynamicPage( const QString& pageName, const QString& text, const QIcon& icon, boost::function< Tomahawk::ViewPage*() > instanceLoader, int sortValue = 0 );
|
||||||
Tomahawk::ViewPage* showDynamicPage( const QString& pageName );
|
Tomahawk::ViewPage* showDynamicPage( const QString& pageName );
|
||||||
|
|
||||||
void showCurrentTrack();
|
void showCurrentTrack();
|
||||||
|
@@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include "sourcetree/SourcesModel.h"
|
#include "sourcetree/SourcesModel.h"
|
||||||
|
|
||||||
#include "../../viewpages/dashboard/Dashboard.h"
|
|
||||||
|
|
||||||
#include "sourcetree/items/ScriptCollectionItem.h"
|
#include "sourcetree/items/ScriptCollectionItem.h"
|
||||||
#include "sourcetree/items/SourceTreeItem.h"
|
#include "sourcetree/items/SourceTreeItem.h"
|
||||||
#include "sourcetree/items/SourceItem.h"
|
#include "sourcetree/items/SourceItem.h"
|
||||||
@@ -62,9 +60,10 @@ SourcesModel::SourcesModel( QObject* parent )
|
|||||||
{
|
{
|
||||||
m_rootItem = new SourceTreeItem( this, 0, Invalid );
|
m_rootItem = new SourceTreeItem( this, 0, Invalid );
|
||||||
|
|
||||||
connect( ViewManager::instance(), SIGNAL( viewPageAdded( QString, QString, QIcon, int ) ), SLOT( appendPageItem( QString, QString, QIcon, int ) ) );
|
connect( ViewManager::instance(), SIGNAL( viewPageAdded( QString, Tomahawk::ViewPage*, int ) ),
|
||||||
appendGroups();
|
SLOT( appendPageItem( QString, Tomahawk::ViewPage*, int ) ) );
|
||||||
|
|
||||||
|
appendGroups();
|
||||||
onSourcesAdded( SourceList::instance()->sources() );
|
onSourcesAdded( SourceList::instance()->sources() );
|
||||||
|
|
||||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ),
|
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ),
|
||||||
@@ -72,7 +71,7 @@ SourcesModel::SourcesModel( QObject* parent )
|
|||||||
connect( SourceList::instance(), SIGNAL( sourceRemoved( Tomahawk::source_ptr ) ),
|
connect( SourceList::instance(), SIGNAL( sourceRemoved( Tomahawk::source_ptr ) ),
|
||||||
SLOT( onSourceRemoved( Tomahawk::source_ptr ) ) );
|
SLOT( onSourceRemoved( Tomahawk::source_ptr ) ) );
|
||||||
connect( ViewManager::instance(), SIGNAL( viewPageActivated( Tomahawk::ViewPage* ) ),
|
connect( ViewManager::instance(), SIGNAL( viewPageActivated( Tomahawk::ViewPage* ) ),
|
||||||
this, SLOT( viewPageActivated( Tomahawk::ViewPage* ) ) );
|
SLOT( viewPageActivated( Tomahawk::ViewPage* ) ) );
|
||||||
|
|
||||||
foreach ( const collection_ptr& c, SourceList::instance()->scriptCollections() )
|
foreach ( const collection_ptr& c, SourceList::instance()->scriptCollections() )
|
||||||
{
|
{
|
||||||
@@ -304,7 +303,6 @@ SourcesModel::appendGroups()
|
|||||||
// 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 );
|
||||||
|
|
||||||
|
|
||||||
InboxItem* inbox = new InboxItem( this, m_browse );
|
InboxItem* inbox = new InboxItem( this, m_browse );
|
||||||
inbox->setSortValue( 3 );
|
inbox->setSortValue( 3 );
|
||||||
|
|
||||||
@@ -333,7 +331,6 @@ SourcesModel::appendGroups()
|
|||||||
|
|
||||||
|
|
||||||
m_collectionsGroup = new GroupItem( this, m_rootItem, tr( "Friends" ), 4 );
|
m_collectionsGroup = new GroupItem( this, m_rootItem, tr( "Friends" ), 4 );
|
||||||
|
|
||||||
m_cloudGroup = new GroupItem( this, m_rootItem, tr( "Cloud" ), 5 );
|
m_cloudGroup = new GroupItem( this, m_rootItem, tr( "Cloud" ), 5 );
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
@@ -341,19 +338,17 @@ SourcesModel::appendGroups()
|
|||||||
QHash< QString, ViewPagePlugin* > plugins = Tomahawk::Utils::PluginLoader( "viewpage" ).loadPlugins< ViewPagePlugin >();
|
QHash< QString, ViewPagePlugin* > plugins = Tomahawk::Utils::PluginLoader( "viewpage" ).loadPlugins< ViewPagePlugin >();
|
||||||
foreach ( ViewPagePlugin* plugin, plugins.values() )
|
foreach ( ViewPagePlugin* plugin, plugins.values() )
|
||||||
{
|
{
|
||||||
|
|
||||||
ViewManager::instance()->addDynamicPage( plugin );
|
ViewManager::instance()->addDynamicPage( plugin );
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewManager::instance()->showDynamicPage( Tomahawk::Widgets::DASHBOARD_VIEWPAGE_NAME );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SourcesModel::appendPageItem( const QString& name, const QString& text, const QIcon& icon, int sortValue )
|
SourcesModel::appendPageItem( const QString& name, ViewPage* page, int sortValue )
|
||||||
{
|
{
|
||||||
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, text, icon,
|
GenericPageItem* pageItem = new GenericPageItem( this, m_browse, page->title(), page->pixmap(),
|
||||||
boost::bind( &ViewManager::showDynamicPage, ViewManager::instance(), name ),
|
boost::bind( &ViewManager::showDynamicPage, ViewManager::instance(), name ),
|
||||||
boost::bind( &ViewManager::dynamicPageWidget, ViewManager::instance(), name ) );
|
boost::bind( &ViewManager::dynamicPageWidget, ViewManager::instance(), name ) );
|
||||||
if ( sortValue )
|
if ( sortValue )
|
||||||
@@ -366,6 +361,8 @@ SourcesModel::appendPageItem( const QString& name, const QString& text, const QI
|
|||||||
}
|
}
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
|
linkSourceItemToPage( pageItem, page );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -439,7 +436,7 @@ SourcesModel::viewPageActivated( Tomahawk::ViewPage* page )
|
|||||||
if ( m_sourceTreeLinks.contains( page ) )
|
if ( m_sourceTreeLinks.contains( page ) )
|
||||||
{
|
{
|
||||||
Q_ASSERT( m_sourceTreeLinks[ page ] );
|
Q_ASSERT( m_sourceTreeLinks[ page ] );
|
||||||
// qDebug() << "Got view page activated for item:" << m_sourceTreeLinks[ page ]->text();
|
tDebug() << "Got view page activated for item:" << m_sourceTreeLinks[ page ]->text();
|
||||||
QModelIndex idx = indexFromItem( m_sourceTreeLinks[ page ] );
|
QModelIndex idx = indexFromItem( m_sourceTreeLinks[ page ] );
|
||||||
|
|
||||||
if ( !idx.isValid() )
|
if ( !idx.isValid() )
|
||||||
|
@@ -147,9 +147,9 @@ private slots:
|
|||||||
void onWidgetDestroyed( QWidget* w );
|
void onWidgetDestroyed( QWidget* w );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* pageIcon and pageTitle are visible in the source tree, pageName is the internal name in the ViewManager
|
* name is the internal name in the ViewManager
|
||||||
*/
|
*/
|
||||||
void appendPageItem( const QString& name, const QString& text, const QIcon& icon, int sortValue );
|
void appendPageItem( const QString& name, Tomahawk::ViewPage* page, int sortValue );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SourceTreeItem* itemFromIndex( const QModelIndex& idx ) const;
|
SourceTreeItem* itemFromIndex( const QModelIndex& idx ) const;
|
||||||
|
Reference in New Issue
Block a user