From f40500452b1278ffe49c4714dfc93889958b8b3f Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 5 May 2012 16:59:09 +0200 Subject: [PATCH] * Added query/track pages. --- src/libtomahawk/ViewManager.cpp | 20 ++++++++++++++++++++ src/libtomahawk/ViewManager.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index 56a57df17..983e4bbe1 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -51,6 +51,7 @@ #include "widgets/infowidgets/SourceInfoWidget.h" #include "widgets/infowidgets/ArtistInfoWidget.h" #include "widgets/infowidgets/AlbumInfoWidget.h" +#include "widgets/infowidgets/TrackInfoWidget.h" #include "widgets/NewPlaylistWidget.h" #include "widgets/AnimatedSplitter.h" @@ -256,6 +257,25 @@ ViewManager::show( const Tomahawk::album_ptr& album, Tomahawk::ModelMode initial } +Tomahawk::ViewPage* +ViewManager::show( const Tomahawk::query_ptr& query ) +{ + TrackInfoWidget* swidget; + if ( !m_trackViews.contains( query ) || m_trackViews.value( query ).isNull() ) + { + swidget = new TrackInfoWidget( query ); + m_trackViews.insert( query, swidget ); + } + else + { + swidget = m_trackViews.value( query ).data(); + } + + setPage( swidget ); + return swidget; +} + + Tomahawk::ViewPage* ViewManager::show( const Tomahawk::collection_ptr& collection ) { diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index f84511476..31d86012e 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -55,6 +55,7 @@ class TrackView; class SourceInfoWidget; class InfoBar; class TopBar; +class TrackInfoWidget; class WelcomeWidget; class WhatsHotWidget; class QPushButton; @@ -151,6 +152,7 @@ public slots: Tomahawk::ViewPage* show( const Tomahawk::dynplaylist_ptr& playlist ); Tomahawk::ViewPage* show( const Tomahawk::artist_ptr& artist ); Tomahawk::ViewPage* show( const Tomahawk::album_ptr& album, Tomahawk::ModelMode withInitialMode = Tomahawk::InfoSystemMode ); + Tomahawk::ViewPage* show( const Tomahawk::query_ptr& query ); Tomahawk::ViewPage* show( const Tomahawk::collection_ptr& collection ); Tomahawk::ViewPage* show( const Tomahawk::source_ptr& source ); @@ -217,6 +219,7 @@ private: QHash< Tomahawk::collection_ptr, QWeakPointer > m_collectionAlbumViews; QHash< Tomahawk::artist_ptr, QWeakPointer > m_artistViews; QHash< Tomahawk::album_ptr, QWeakPointer > m_albumViews; + QHash< Tomahawk::query_ptr, QWeakPointer > m_trackViews; QHash< Tomahawk::playlist_ptr, QWeakPointer > m_playlistViews; QHash< Tomahawk::source_ptr, QWeakPointer > m_sourceViews;