[vlc-devel] commit: Qt: playlist code cosmetics (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Dec 4 07:21:47 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Nov 30 00:26:43 2009 +0100| [157f43b782ab86168054ce21de3ff60cbc6867e6] | committer: Jean-Baptiste Kempf 

Qt: playlist code cosmetics

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=157f43b782ab86168054ce21de3ff60cbc6867e6
---

 .../gui/qt4/components/playlist/standardpanel.cpp  |   40 ++++++++++----------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index adee404..d6d89fe 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -55,27 +55,32 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
                                   playlist_item_t *p_root ):
                                   QWidget( _parent ), p_intf( _p_intf )
 {
-    model = new PLModel( p_playlist, p_intf, p_root, this );
-
-    QVBoxLayout *layout = new QVBoxLayout();
+    QVBoxLayout *layout = new QVBoxLayout( this );
     layout->setSpacing( 0 ); layout->setMargin( 0 );
 
+    model = new PLModel( p_playlist, p_intf, p_root, this );
+
     /* Create and configure the QTreeView */
     view = new QVLCTreeView;
     view->setModel( model );
+
     view->setIconSize( QSize( 20, 20 ) );
     view->setAlternatingRowColors( true );
     view->setAnimated( true );
+    view->setUniformRowHeights( true );
+    view->setSortingEnabled( true );
+    view->header()->setSortIndicator( -1 , Qt::AscendingOrder );
+    view->header()->setSortIndicatorShown( true );
+    view->header()->setClickable( true );
+    view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
+
     view->setSelectionBehavior( QAbstractItemView::SelectRows );
     view->setSelectionMode( QAbstractItemView::ExtendedSelection );
     view->setDragEnabled( true );
     view->setAcceptDrops( true );
     view->setDropIndicatorShown( true );
-    view->header()->setSortIndicator( -1 , Qt::AscendingOrder );
-    view->setUniformRowHeights( true );
-    view->setSortingEnabled( true );
-
 
+    /* Saved Settings */
     getSettings()->beginGroup("Playlist");
     if( getSettings()->contains( "headerStateV2" ) )
     {
@@ -84,17 +89,13 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     }
     else
     {
-        int m, c;
-        for( m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ )
+        for( int m = 1, c = 0; m != COLUMN_END; m <<= 1, c++ )
         {
             view->setColumnHidden( c, !( m & COLUMN_DEFAULT ) );
             if( m == COLUMN_TITLE ) view->header()->resizeSection( c, 200 );
             else if( m == COLUMN_DURATION ) view->header()->resizeSection( c, 80 );
         }
     }
-    view->header()->setSortIndicatorShown( true );
-    view->header()->setClickable( true );
-    view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
     getSettings()->endGroup();
 
     /* Connections for the TreeView */
@@ -149,12 +150,18 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     layout->addWidget( view );
     layout->addLayout( buttons );
 //    layout->addWidget( bar );
-    setLayout( layout );
 
     selectColumnsSigMapper = new QSignalMapper( this );
     CONNECT( selectColumnsSigMapper, mapped( int ), this, toggleColumnShown( int ) );
 }
 
+StandardPLPanel::~StandardPLPanel()
+{
+    getSettings()->beginGroup("Playlist");
+    getSettings()->setValue( "headerStateV2", view->header()->saveState() );
+    getSettings()->endGroup();
+}
+
 void StandardPLPanel::gotoPlayingItem()
 {
     view->scrollTo( model->currentIndex() );
@@ -292,10 +299,3 @@ void StandardPLPanel::deleteSelection()
     model->doDelete( list );
 }
 
-StandardPLPanel::~StandardPLPanel()
-{
-    getSettings()->beginGroup("Playlist");
-    getSettings()->setValue( "headerStateV2", view->header()->saveState() );
-    getSettings()->endGroup();
-}
-




More information about the vlc-devel mailing list