mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 02:09:48 +01:00
* Update FlexibleView's header when playlist gets changed.
This commit is contained in:
parent
de9aa6f1fd
commit
f924fd380c
@ -24,6 +24,7 @@
|
||||
|
||||
#include "playlist/FlexibleHeader.h"
|
||||
#include "playlist/PlayableModel.h"
|
||||
#include "playlist/PlaylistModel.h"
|
||||
#include "playlist/TrackView.h"
|
||||
#include "playlist/GridView.h"
|
||||
#include "playlist/PlaylistLargeItemDelegate.h"
|
||||
@ -187,9 +188,21 @@ FlexibleView::setPlayableModel( PlayableModel* model )
|
||||
m_detailedView->proxyModel()->sort( -1 );
|
||||
m_gridView->proxyModel()->sort( -1 );
|
||||
|
||||
m_header->setPixmap( m_pixmap );
|
||||
m_header->setCaption( model->title() );
|
||||
m_header->setDescription( model->description() );
|
||||
onModelChanged();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleView::setPlaylistModel( PlaylistModel* model )
|
||||
{
|
||||
if ( m_model )
|
||||
{
|
||||
disconnect( m_model, SIGNAL( changed() ), this, SLOT( onModelChanged() ) );
|
||||
}
|
||||
|
||||
setPlayableModel( model );
|
||||
|
||||
connect( model, SIGNAL( changed() ), SLOT( onModelChanged() ), Qt::UniqueConnection );
|
||||
}
|
||||
|
||||
|
||||
@ -292,6 +305,15 @@ FlexibleView::setPixmap( const QPixmap& pixmap )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleView::onModelChanged()
|
||||
{
|
||||
m_header->setPixmap( m_pixmap );
|
||||
m_header->setCaption( m_model->title() );
|
||||
m_header->setDescription( m_model->description() );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleView::onWidgetDestroyed( QWidget* widget )
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ class QStackedWidget;
|
||||
class GridView;
|
||||
class TrackView;
|
||||
class PlayableModel;
|
||||
class PlaylistModel;
|
||||
class FlexibleHeader;
|
||||
class FlexibleViewInterface;
|
||||
|
||||
@ -62,8 +63,10 @@ public:
|
||||
void setDetailedView( TrackView* view );
|
||||
void setGridView( GridView* view );
|
||||
|
||||
void setPixmap( const QPixmap& pixmap );
|
||||
void setPlayableModel( PlayableModel* model );
|
||||
void setPlaylistModel( PlaylistModel* model );
|
||||
|
||||
void setPixmap( const QPixmap& pixmap );
|
||||
void setEmptyTip( const QString& tip );
|
||||
|
||||
public slots:
|
||||
@ -75,6 +78,7 @@ signals:
|
||||
void destroyed( QWidget* widget );
|
||||
|
||||
private slots:
|
||||
void onModelChanged();
|
||||
void onWidgetDestroyed( QWidget* widget );
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user