Commit 6296dd70 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: try to enable PL/ML switching

This still needs a lot of fixing
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent fb0efa32
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "components/playlist/standardpanel.hpp" #include "components/playlist/standardpanel.hpp"
#include "components/playlist/vlc_model.hpp" /* VLCModel */
#include "components/playlist/playlist_model.hpp" /* PLModel */ #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/views.hpp" /* 3 views */
...@@ -314,7 +315,6 @@ void StandardPLPanel::createTreeView() ...@@ -314,7 +315,6 @@ void StandardPLPanel::createTreeView()
treeView->setContextMenuPolicy( Qt::CustomContextMenu ); treeView->setContextMenuPolicy( Qt::CustomContextMenu );
/* setModel after setSortingEnabled(true), or the model will sort immediately! */ /* setModel after setSortingEnabled(true), or the model will sort immediately! */
treeView->setModel( model );
getSettings()->beginGroup("Playlist"); getSettings()->beginGroup("Playlist");
...@@ -352,8 +352,20 @@ void StandardPLPanel::createTreeView() ...@@ -352,8 +352,20 @@ void StandardPLPanel::createTreeView()
viewStack->addWidget( treeView ); 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 ) void StandardPLPanel::showView( int i_view )
{ {
switch( i_view ) switch( i_view )
{ {
case TREE_VIEW: case TREE_VIEW:
...@@ -387,6 +399,8 @@ void StandardPLPanel::showView( int i_view ) ...@@ -387,6 +399,8 @@ void StandardPLPanel::showView( int i_view )
default: return; default: return;
} }
changeModel( false );
viewStack->setCurrentWidget( currentView ); viewStack->setCurrentWidget( currentView );
browseInto(); browseInto();
gotoPlayingItem(); gotoPlayingItem();
......
...@@ -70,6 +70,7 @@ public: ...@@ -70,6 +70,7 @@ public:
const int currentViewIndex(); const int currentViewIndex();
protected: protected:
PLModel *model; PLModel *model;
...@@ -98,6 +99,7 @@ private: ...@@ -98,6 +99,7 @@ private:
void createIconView(); void createIconView();
void createListView(); void createListView();
void createCoverView(); void createCoverView();
void changeModel ( bool b_ml );
bool eventFilter ( QObject * watched, QEvent * event ); bool eventFilter ( QObject * watched, QEvent * event );
public slots: public slots:
......
...@@ -287,7 +287,6 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent ) ...@@ -287,7 +287,6 @@ PlIconView::PlIconView( PLModel *model, QWidget *parent ) : QListView( parent )
{ {
PlIconViewItemDelegate *delegate = new PlIconViewItemDelegate( this ); PlIconViewItemDelegate *delegate = new PlIconViewItemDelegate( this );
setModel( model );
setViewMode( QListView::IconMode ); setViewMode( QListView::IconMode );
setMovement( QListView::Static ); setMovement( QListView::Static );
setResizeMode( QListView::Adjust ); setResizeMode( QListView::Adjust );
...@@ -316,7 +315,6 @@ void PlIconView::dragMoveEvent ( QDragMoveEvent * event ) ...@@ -316,7 +315,6 @@ void PlIconView::dragMoveEvent ( QDragMoveEvent * event )
PlListView::PlListView( PLModel *model, QWidget *parent ) : QListView( parent ) PlListView::PlListView( PLModel *model, QWidget *parent ) : QListView( parent )
{ {
setModel( model );
setViewMode( QListView::ListMode ); setViewMode( QListView::ListMode );
setUniformItemSizes( true ); setUniformItemSizes( true );
setSelectionMode( QAbstractItemView::ExtendedSelection ); setSelectionMode( QAbstractItemView::ExtendedSelection );
...@@ -383,8 +381,6 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie ...@@ -383,8 +381,6 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie
picFlow->setSlideSize(QSize(128,128)); picFlow->setSlideSize(QSize(128,128));
layout->addWidget( picFlow ); layout->addWidget( picFlow );
setSelectionMode( QAbstractItemView::SingleSelection ); setSelectionMode( QAbstractItemView::SingleSelection );
setModel( p_model );
} }
int PicFlowView::horizontalOffset() const int PicFlowView::horizontalOffset() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment