[vlc-devel] commit: Qt: new view mode for the playlist in an IconList like mode. ( Jean-Baptiste Kempf )
git version control
git at videolan.org
Sat Dec 12 22:49:38 CET 2009
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Dec 12 18:52:08 2009 +0100| [96b1f07d70ff84140eb6f511e67fb7e1ba6cbd51] | committer: Jean-Baptiste Kempf
Qt: new view mode for the playlist in an IconList like mode.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=96b1f07d70ff84140eb6f511e67fb7e1ba6cbd51
---
.../gui/qt4/components/playlist/standardpanel.cpp | 31 +++++++++++++++++++-
.../gui/qt4/components/playlist/standardpanel.hpp | 13 ++++++--
2 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 97b1ad3..9561814 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -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();
+ }
+
+
+}
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index f65ad4a..91540d5 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -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
More information about the vlc-devel
mailing list