From 78621382302e79c66d10f2bdff70a2f1717fc459 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 12 Oct 2014 09:01:30 +0200 Subject: [PATCH] Don't replicate so much of TrackView's API in ContextView. --- src/libtomahawk/playlist/ContextView.cpp | 49 +----------------------- src/libtomahawk/playlist/ContextView.h | 14 +------ 2 files changed, 4 insertions(+), 59 deletions(-) diff --git a/src/libtomahawk/playlist/ContextView.cpp b/src/libtomahawk/playlist/ContextView.cpp index e83e49da5..b28b41b26 100644 --- a/src/libtomahawk/playlist/ContextView.cpp +++ b/src/libtomahawk/playlist/ContextView.cpp @@ -24,7 +24,6 @@ #include "audio/AudioEngine.h" #include "widgets/CaptionLabel.h" -#include "widgets/FilterHeader.h" #include "playlist/PlayableModel.h" #include "playlist/PlaylistModel.h" #include "playlist/TrackView.h" @@ -43,7 +42,6 @@ using namespace Tomahawk; ContextView::ContextView( QWidget* parent, const QString& caption ) : QWidget( parent ) -// , m_header( new FilterHeader( this ) ) , m_trackView( new TrackView() ) , m_model( 0 ) , m_temporary( false ) @@ -169,39 +167,6 @@ ContextView::setGuid( const QString& guid ) } -void -ContextView::setPlayableModel( PlayableModel* model ) -{ - if ( m_model ) - { - delete m_model; - } - - m_model = model; - - m_trackView->setPlayableModel( model ); - m_trackView->setSortingEnabled( false ); - m_trackView->sortByColumn( -1 ); - m_trackView->proxyModel()->sort( -1 ); - - onModelChanged(); -} - - -void -ContextView::setPlaylistModel( PlaylistModel* model ) -{ - if ( m_model ) - { - disconnect( m_model, SIGNAL( changed() ), this, SLOT( onModelChanged() ) ); - } - - setPlayableModel( model ); - - connect( model, SIGNAL( changed() ), SLOT( onModelChanged() ), Qt::UniqueConnection ); -} - - Tomahawk::playlistinterface_ptr ContextView::playlistInterface() const { @@ -257,25 +222,15 @@ ContextView::setEmptyTip( const QString& tip ) } -void -ContextView::setPixmap( const QPixmap& pixmap ) -{ - m_pixmap = pixmap; -// m_header->setPixmap( pixmap ); -} - - void ContextView::onModelChanged() { -// m_header->setPixmap( m_pixmap ); -// m_header->setCaption( m_model->title() ); -// m_header->setDescription( m_model->description() ); - if ( m_model->isReadOnly() ) setEmptyTip( tr( "This playlist is currently empty." ) ); else setEmptyTip( tr( "This playlist is currently empty. Add some tracks to it and enjoy the music!" ) ); + + emit modelChanged(); } diff --git a/src/libtomahawk/playlist/ContextView.h b/src/libtomahawk/playlist/ContextView.h index 33a0848d0..21f36d5df 100644 --- a/src/libtomahawk/playlist/ContextView.h +++ b/src/libtomahawk/playlist/ContextView.h @@ -53,13 +53,7 @@ public: TrackView* trackView() const { return m_trackView; } void setCaption( const QString& caption ); - void setGuid( const QString& guid ); - - void setPlayableModel( PlayableModel* model ); - void setPlaylistModel( PlaylistModel* model ); - - void setPixmap( const QPixmap& pixmap ); void setEmptyTip( const QString& tip ); public slots: @@ -70,6 +64,7 @@ signals: void closeClicked(); void destroyed( QWidget* widget ); void pixmapChanged( const QPixmap& pixmap ); + void modelChanged(); private slots: void onModelChanged(); @@ -79,17 +74,12 @@ private slots: void onCoverUpdated(); private: - FilterHeader* m_header; - QPixmap m_pixmap; CaptionLabel* m_captionLabel; - TrackView* m_trackView; - PlayableModel* m_model; - QStackedWidget* m_stack; + QPixmap m_pixmap; Tomahawk::query_ptr m_query; - bool m_temporary; };