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

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

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