mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Update FlexibleView's header when playlist gets changed.
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "playlist/FlexibleHeader.h"
|
#include "playlist/FlexibleHeader.h"
|
||||||
#include "playlist/PlayableModel.h"
|
#include "playlist/PlayableModel.h"
|
||||||
|
#include "playlist/PlaylistModel.h"
|
||||||
#include "playlist/TrackView.h"
|
#include "playlist/TrackView.h"
|
||||||
#include "playlist/GridView.h"
|
#include "playlist/GridView.h"
|
||||||
#include "playlist/PlaylistLargeItemDelegate.h"
|
#include "playlist/PlaylistLargeItemDelegate.h"
|
||||||
@@ -187,9 +188,21 @@ FlexibleView::setPlayableModel( PlayableModel* model )
|
|||||||
m_detailedView->proxyModel()->sort( -1 );
|
m_detailedView->proxyModel()->sort( -1 );
|
||||||
m_gridView->proxyModel()->sort( -1 );
|
m_gridView->proxyModel()->sort( -1 );
|
||||||
|
|
||||||
m_header->setPixmap( m_pixmap );
|
onModelChanged();
|
||||||
m_header->setCaption( model->title() );
|
}
|
||||||
m_header->setDescription( model->description() );
|
|
||||||
|
|
||||||
|
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
|
void
|
||||||
FlexibleView::onWidgetDestroyed( QWidget* widget )
|
FlexibleView::onWidgetDestroyed( QWidget* widget )
|
||||||
{
|
{
|
||||||
|
@@ -28,6 +28,7 @@ class QStackedWidget;
|
|||||||
class GridView;
|
class GridView;
|
||||||
class TrackView;
|
class TrackView;
|
||||||
class PlayableModel;
|
class PlayableModel;
|
||||||
|
class PlaylistModel;
|
||||||
class FlexibleHeader;
|
class FlexibleHeader;
|
||||||
class FlexibleViewInterface;
|
class FlexibleViewInterface;
|
||||||
|
|
||||||
@@ -62,8 +63,10 @@ public:
|
|||||||
void setDetailedView( TrackView* view );
|
void setDetailedView( TrackView* view );
|
||||||
void setGridView( GridView* view );
|
void setGridView( GridView* view );
|
||||||
|
|
||||||
void setPixmap( const QPixmap& pixmap );
|
|
||||||
void setPlayableModel( PlayableModel* model );
|
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:
|
||||||
@@ -75,6 +78,7 @@ signals:
|
|||||||
void destroyed( QWidget* widget );
|
void destroyed( QWidget* widget );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void onModelChanged();
|
||||||
void onWidgetDestroyed( QWidget* widget );
|
void onWidgetDestroyed( QWidget* widget );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user