diff --git a/src/libtomahawk/playlist/playlistmodel.cpp b/src/libtomahawk/playlist/playlistmodel.cpp index b2bd84f35..c171f2cb1 100644 --- a/src/libtomahawk/playlist/playlistmodel.cpp +++ b/src/libtomahawk/playlist/playlistmodel.cpp @@ -99,7 +99,6 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn int c = rowCount( QModelIndex() ); qDebug() << "Starting loading" << playlist->title(); - emit loadingStarted(); emit beginInsertRows( QModelIndex(), c, c + entries.count() - 1 ); m_waitingForResolved.clear(); diff --git a/src/libtomahawk/viewmanager.h b/src/libtomahawk/viewmanager.h index e3976717c..e8a68f67b 100644 --- a/src/libtomahawk/viewmanager.h +++ b/src/libtomahawk/viewmanager.h @@ -26,6 +26,7 @@ #include "collection.h" #include "playlistinterface.h" #include "viewpage.h" +#include "widgets/welcomewidget.h" #include "dllmacro.h" @@ -85,7 +86,7 @@ public: Tomahawk::ViewPage* show( Tomahawk::ViewPage* page ); - WelcomeWidget* welcomeWidget() const { return m_welcomeWidget; } + Tomahawk::ViewPage* welcomeWidget() const { return m_welcomeWidget; } ArtistView* superCollectionView() const { return m_superCollectionView; } /// Get the view page for the given item. Not pretty... diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp index 5240b9a2b..c27123944 100644 --- a/src/libtomahawk/widgets/welcomewidget.cpp +++ b/src/libtomahawk/widgets/welcomewidget.cpp @@ -19,6 +19,7 @@ #include "welcomewidget.h" #include "ui_welcomewidget.h" +#include "audio/audioengine.h" #include "utils/tomahawkutils.h" #include "viewmanager.h" @@ -56,6 +57,7 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) ); connect( ui->playlistWidget, SIGNAL( itemActivated( QListWidgetItem* ) ), SLOT( onPlaylistActivated( QListWidgetItem* ) ) ); + connect( AudioEngine::instance() ,SIGNAL( playlistChanged( PlaylistInterface* ) ), this, SLOT( updatePlaylists() ), Qt::QueuedConnection ); } diff --git a/src/sourcetree/items/genericpageitems.cpp b/src/sourcetree/items/genericpageitems.cpp index f4ae25279..47f05605d 100644 --- a/src/sourcetree/items/genericpageitems.cpp +++ b/src/sourcetree/items/genericpageitems.cpp @@ -22,13 +22,15 @@ using namespace Tomahawk; /// Generic page item -GenericPageItem::GenericPageItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, const QIcon& icon, boost::function< ViewPage* () > func ) +GenericPageItem::GenericPageItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, const QIcon& icon, boost::function< ViewPage* () > show, boost::function< ViewPage* () > get ) : SourceTreeItem( model, parent, SourcesModel::GenericPage ) , m_icon( icon ) , m_text( text ) - , m_func( func ) + , m_show( show ) + , m_get( get ) { - + if( ViewPage* p = m_get() ) + model->linkSourceItemToPage( this, p ); } GenericPageItem::~GenericPageItem() @@ -39,7 +41,7 @@ GenericPageItem::~GenericPageItem() void GenericPageItem::activate() { - ViewPage* p = m_func(); + ViewPage* p = m_show(); model()->linkSourceItemToPage( this, p ); } diff --git a/src/sourcetree/items/genericpageitems.h b/src/sourcetree/items/genericpageitems.h index 6507d1142..1c0e954e4 100644 --- a/src/sourcetree/items/genericpageitems.h +++ b/src/sourcetree/items/genericpageitems.h @@ -27,7 +27,8 @@ class GenericPageItem : public SourceTreeItem { Q_OBJECT public: - GenericPageItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, const QIcon& icon, boost::function func ); + // takes 2 function pointers: show: called when wanting to show the desired view page. get: called to get the view page from ViewManager if it exists + GenericPageItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, const QIcon& icon, boost::function show, boost::function get ); virtual ~GenericPageItem(); virtual QString text() const; @@ -41,7 +42,8 @@ signals: private: QIcon m_icon; QString m_text; - boost::function< Tomahawk::ViewPage*() > m_func; + boost::function< Tomahawk::ViewPage*() > m_show; + boost::function< Tomahawk::ViewPage*() > m_get; }; #endif diff --git a/src/sourcetree/sourcesmodel.cpp b/src/sourcetree/sourcesmodel.cpp index a95d8e12d..eedb5ecdf 100644 --- a/src/sourcetree/sourcesmodel.cpp +++ b/src/sourcetree/sourcesmodel.cpp @@ -44,7 +44,10 @@ SourcesModel::SourcesModel( QObject* parent ) appendItem( source_ptr() ); // add misc children of root node - GenericPageItem* recent = new GenericPageItem( this, m_rootItem->children().at( 0 ), tr( "Recently Played" ), QIcon( RESPATH "images/recently-played.png" ), boost::bind( &ViewManager::showWelcomePage, ViewManager::instance() ) ); + GenericPageItem* recent = new GenericPageItem( this, m_rootItem->children().at( 0 ), tr( "Recently Played" ), QIcon( RESPATH "images/recently-played.png" ), + boost::bind( &ViewManager::showWelcomePage, ViewManager::instance() ), + boost::bind( &ViewManager::welcomeWidget, ViewManager::instance() ) + ); onSourcesAdded( SourceList::instance()->sources() );