1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Don't replicate so much of TrackView's API in ContextView.

This commit is contained in:
Christian Muehlhaeuser
2014-10-12 09:01:30 +02:00
parent 5525853a84
commit 7862138230
2 changed files with 4 additions and 59 deletions

View File

@@ -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();
}

View File

@@ -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;
};