From c52469ff1f26f721cf8216503b981b5894d15464 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 23 Apr 2013 15:47:46 +0200 Subject: [PATCH] * Added ViewManager::createPageForList( queries ). --- src/libtomahawk/ViewManager.cpp | 22 ++++++++++++++++++++++ src/libtomahawk/ViewManager.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index d40e544a1..b65fc030e 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -161,6 +161,28 @@ ViewManager::createPageForPlaylist( const playlist_ptr& playlist ) } +FlexibleView* +ViewManager::createPageForList( const QString& title, const QList< query_ptr >& queries ) +{ + FlexibleView* view = new FlexibleView(); + PlaylistModel* model = new PlaylistModel(); + + PlaylistView* pv = new PlaylistView(); + view->setDetailedView( pv ); + view->setPixmap( pv->pixmap() ); + view->setEmptyTip( tr( "This playlist is empty!" ) ); + + // We need to set the model on the view before loading the playlist, so spinners & co are connected + view->setPlaylistModel( model ); + pv->setPlaylistModel( model ); + + model->setTitle( title ); + model->appendQueries( queries ); + + return view; +} + + playlist_ptr ViewManager::playlistForPage( ViewPage* page ) const { diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index 339218b94..fb6f08bc6 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -109,6 +109,8 @@ public: // linked to the sidebar. call it right after creating the playlist FlexibleView* createPageForPlaylist( const Tomahawk::playlist_ptr& playlist ); + FlexibleView* createPageForList( const QString& title, const QList< Tomahawk::query_ptr >& queries ); + bool isTomahawkLoaded() const { return m_loaded; } signals: