mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 18:44:30 +02:00
Don't replicate so much of TrackView's API in ContextView.
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
#include "widgets/CaptionLabel.h"
|
#include "widgets/CaptionLabel.h"
|
||||||
#include "widgets/FilterHeader.h"
|
|
||||||
#include "playlist/PlayableModel.h"
|
#include "playlist/PlayableModel.h"
|
||||||
#include "playlist/PlaylistModel.h"
|
#include "playlist/PlaylistModel.h"
|
||||||
#include "playlist/TrackView.h"
|
#include "playlist/TrackView.h"
|
||||||
@@ -43,7 +42,6 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
ContextView::ContextView( QWidget* parent, const QString& caption )
|
ContextView::ContextView( QWidget* parent, const QString& caption )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
// , m_header( new FilterHeader( this ) )
|
|
||||||
, m_trackView( new TrackView() )
|
, m_trackView( new TrackView() )
|
||||||
, m_model( 0 )
|
, m_model( 0 )
|
||||||
, m_temporary( false )
|
, 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
|
Tomahawk::playlistinterface_ptr
|
||||||
ContextView::playlistInterface() const
|
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
|
void
|
||||||
ContextView::onModelChanged()
|
ContextView::onModelChanged()
|
||||||
{
|
{
|
||||||
// m_header->setPixmap( m_pixmap );
|
|
||||||
// m_header->setCaption( m_model->title() );
|
|
||||||
// m_header->setDescription( m_model->description() );
|
|
||||||
|
|
||||||
if ( m_model->isReadOnly() )
|
if ( m_model->isReadOnly() )
|
||||||
setEmptyTip( tr( "This playlist is currently empty." ) );
|
setEmptyTip( tr( "This playlist is currently empty." ) );
|
||||||
else
|
else
|
||||||
setEmptyTip( tr( "This playlist is currently empty. Add some tracks to it and enjoy the music!" ) );
|
setEmptyTip( tr( "This playlist is currently empty. Add some tracks to it and enjoy the music!" ) );
|
||||||
|
|
||||||
|
emit modelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -53,13 +53,7 @@ public:
|
|||||||
TrackView* trackView() const { return m_trackView; }
|
TrackView* trackView() const { return m_trackView; }
|
||||||
|
|
||||||
void setCaption( const QString& caption );
|
void setCaption( const QString& caption );
|
||||||
|
|
||||||
void setGuid( const QString& guid );
|
void setGuid( const QString& guid );
|
||||||
|
|
||||||
void setPlayableModel( PlayableModel* model );
|
|
||||||
void setPlaylistModel( PlaylistModel* model );
|
|
||||||
|
|
||||||
void setPixmap( const QPixmap& pixmap );
|
|
||||||
void setEmptyTip( const QString& tip );
|
void setEmptyTip( const QString& tip );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -70,6 +64,7 @@ signals:
|
|||||||
void closeClicked();
|
void closeClicked();
|
||||||
void destroyed( QWidget* widget );
|
void destroyed( QWidget* widget );
|
||||||
void pixmapChanged( const QPixmap& pixmap );
|
void pixmapChanged( const QPixmap& pixmap );
|
||||||
|
void modelChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onModelChanged();
|
void onModelChanged();
|
||||||
@@ -79,17 +74,12 @@ private slots:
|
|||||||
void onCoverUpdated();
|
void onCoverUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FilterHeader* m_header;
|
|
||||||
QPixmap m_pixmap;
|
|
||||||
CaptionLabel* m_captionLabel;
|
CaptionLabel* m_captionLabel;
|
||||||
|
|
||||||
TrackView* m_trackView;
|
TrackView* m_trackView;
|
||||||
|
|
||||||
PlayableModel* m_model;
|
PlayableModel* m_model;
|
||||||
QStackedWidget* m_stack;
|
|
||||||
|
|
||||||
|
QPixmap m_pixmap;
|
||||||
Tomahawk::query_ptr m_query;
|
Tomahawk::query_ptr m_query;
|
||||||
|
|
||||||
bool m_temporary;
|
bool m_temporary;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user