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

Qt: try to enable PL/ML switching



This still needs a lot of fixing
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent fb0efa32
......@@ -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();
......
......@@ -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:
......
......@@ -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
......
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