Commit 96b1f07d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: new view mode for the playlist in an IconList like mode.

parent ddc08774
......@@ -53,7 +53,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
playlist_item_t *p_root ):
QWidget( _parent ), p_intf( _p_intf )
{
QGridLayout *layout = new QGridLayout( this );
layout = new QGridLayout( this );
layout->setSpacing( 0 ); layout->setMargin( 0 );
setMinimumWidth( 300 );
......@@ -62,6 +62,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
/* Create and configure the QTreeView */
view = new QVLCTreeView;
view->setModel( model );
view2 = NULL;
view->setIconSize( QSize( 20, 20 ) );
view->setAlternatingRowColors( true );
......@@ -134,6 +135,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
BUTTONACT( addButton, popupAdd() );
layout->addWidget( addButton, 0, 3 );
QPushButton *viewButton = new QPushButton( this );
viewButton->setIcon( QIcon( ":/buttons/playlist/playlist_add" ) );
layout->addWidget( viewButton, 0, 2 );
BUTTONACT( viewButton, toggleView() );
/* Finish the layout */
layout->addWidget( view, 1, 0, 1, -1 );
......@@ -287,3 +293,26 @@ void StandardPLPanel::deleteSelection()
model->doDelete( list );
}
void StandardPLPanel::toggleView()
{
if( view && view->isVisible() )
{
if( view2 == NULL )
{
view2 = new QListView;
view2->setModel( model );
view2->setViewMode( QListView::IconMode );
view2->setMovement( QListView::Snap );
layout->addWidget( view2, 1, 0, 1, -1 );
}
view->hide();
view2->show();
}
else
{
view2->hide();
view->show();
}
}
......@@ -39,6 +39,7 @@
class QSignalMapper;
class QTreeView;
class QListView;
class PLModel;
class QPushButton;
class QKeyEvent;
......@@ -59,10 +60,15 @@ protected:
PLModel *model;
private:
intf_thread_t *p_intf;
QWidget *parent;
QLabel *title;
QTreeView *view;
QWidget *parent;
QLabel *title;
QPushButton *addButton;
QGridLayout *layout;
QTreeView *view;
QListView *view2;
int currentRootId;
QSignalMapper *selectColumnsSigMapper;
......@@ -78,6 +84,7 @@ private slots:
void popupAdd();
void popupSelectColumn( QPoint );
void toggleColumnShown( int );
void toggleView();
};
#endif
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