diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp index 17530036da0f3e0d92d2c01e29dd18f13ea1c775..aab6879171e76c070e0f098a6301bb3615d17f14 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -28,8 +28,9 @@ #include "components/playlist/standardpanel.hpp" +#include "components/playlist/vlc_model.hpp" /* VLCModel */ #include "components/playlist/playlist_model.hpp" /* PLModel */ -#include "components/playlist/ml_model.hpp" /* MLModel */ +#include "components/playlist/ml_model.hpp" /* MLModel */ #include "components/playlist/views.hpp" /* 3 views */ #include "components/playlist/selector.hpp" /* PLSelector */ #include "menus.hpp" /* Popup */ @@ -314,7 +315,6 @@ void StandardPLPanel::createTreeView() treeView->setContextMenuPolicy( Qt::CustomContextMenu ); /* setModel after setSortingEnabled(true), or the model will sort immediately! */ - treeView->setModel( model ); getSettings()->beginGroup("Playlist"); @@ -352,8 +352,20 @@ void StandardPLPanel::createTreeView() viewStack->addWidget( treeView ); } +void StandardPLPanel::changeModel( bool b_ml ) +{ + VLCModel *mod; + if( b_ml ) + mod = mlmodel; + else + mod = model; + if( currentView->model() != mod ) + currentView->setModel( mod ); +} + void StandardPLPanel::showView( int i_view ) { + switch( i_view ) { case TREE_VIEW: @@ -387,6 +399,8 @@ void StandardPLPanel::showView( int i_view ) default: return; } + changeModel( false ); + viewStack->setCurrentWidget( currentView ); browseInto(); gotoPlayingItem(); diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp index bb88172e7415051f617e37ae6f654454db25a0cd..bfbc8f61417f3dfa4c916541fd23f0e0a9e381bb 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.hpp +++ b/modules/gui/qt4/components/playlist/standardpanel.hpp @@ -70,6 +70,7 @@ public: const int currentViewIndex(); + protected: PLModel *model; @@ -98,6 +99,7 @@ private: void createIconView(); void createListView(); void createCoverView(); + void changeModel ( bool b_ml ); bool eventFilter ( QObject * watched, QEvent * event ); public slots: diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp index bb7d5adf1afe71f76b5c425a4d71f81513ccd011..70aa3dd80646d57139320d61e024268835fd9bc1 100644 --- a/modules/gui/qt4/components/playlist/views.cpp +++ b/modules/gui/qt4/components/playlist/views.cpp @@ -287,7 +287,6 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent ) { PlIconViewItemDelegate *delegate = new PlIconViewItemDelegate( this ); - setModel( model ); setViewMode( QListView::IconMode ); setMovement( QListView::Static ); setResizeMode( QListView::Adjust ); @@ -316,7 +315,6 @@ void PlIconView::dragMoveEvent ( QDragMoveEvent * event ) PlListView::PlListView( PLModel *model, QWidget *parent ) : QListView( parent ) { - setModel( model ); setViewMode( QListView::ListMode ); setUniformItemSizes( true ); setSelectionMode( QAbstractItemView::ExtendedSelection ); @@ -383,8 +381,6 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie picFlow->setSlideSize(QSize(128,128)); layout->addWidget( picFlow ); setSelectionMode( QAbstractItemView::SingleSelection ); - setModel( p_model ); - } int PicFlowView::horizontalOffset() const