[vlc-commits] Qt: playlist: move zoom button to top bar

Francois Cartegnie git at videolan.org
Thu Sep 8 06:44:37 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Sep  8 06:09:21 2011 +0200| [7c0bb066acc9a63f0b84e1991ed8de402218576c] | committer: Francois Cartegnie

Qt: playlist: move zoom button to top bar

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

 modules/gui/qt4/components/playlist/playlist.cpp   |   37 +++++++------------
 .../gui/qt4/components/playlist/standardpanel.cpp  |    7 ----
 .../gui/qt4/components/playlist/standardpanel.hpp  |    1 -
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index e10a11b..65e6ce5 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -41,8 +41,6 @@
 #include <QMenu>
 #include <QSignalMapper>
 #include <QSlider>
-#include <QSpacerItem>
-#include <QList>
 
 /**********************************************************************
  * Playlist Widget. The embedded playlist
@@ -112,11 +110,15 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     CONNECT( locationBar, invoked( const QModelIndex & ),
              mainView, browseInto( const QModelIndex & ) );
 
+    QHBoxLayout *topbarLayout = new QHBoxLayout( this );
+    layout->addLayout( topbarLayout, 0, 1 );
+    topbarLayout->setSpacing( 10 );
+
     /* Button to switch views */
     QToolButton *viewButton = new QToolButton( this );
     viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
     viewButton->setToolTip( qtr("Change playlistview") );
-    layout->addWidget( viewButton, 0, 2 );
+    topbarLayout->addWidget( viewButton );
 
     /* View selection menu */
     QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
@@ -142,7 +144,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     searchEdit = new SearchLineEdit( this );
     searchEdit->setMaximumWidth( 250 );
     searchEdit->setMinimumWidth( 80 );
-    layout->addWidget( searchEdit, 0, 3 );
+    topbarLayout->addWidget( searchEdit );
     CONNECT( searchEdit, textChanged( const QString& ),
              mainView, search( const QString& ) );
     CONNECT( searchEdit, searchDelayedChanged( const QString& ),
@@ -150,7 +152,14 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
 
     CONNECT( mainView, viewChanged( const QModelIndex& ),
              this, changeView( const QModelIndex &) );
-    layout->setColumnStretch( 3, 3 );
+
+    /* Zoom */
+    QSlider *zoomSlider = new QSlider( Qt::Horizontal, this );
+    zoomSlider->setRange( -10, 10);
+    zoomSlider->setPageStep( 3 );
+    zoomSlider->setValue( model->getZoom() );
+    CONNECT( zoomSlider, valueChanged( int ), model, changeZoom( int ) );
+    topbarLayout->addWidget( zoomSlider );
 
     /* Connect the activation of the selector to a redefining of the PL */
     DCONNECT( selector, categoryActivated( playlist_item_t *, bool ),
@@ -182,24 +191,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
 
     layout->addWidget( split, 1, 0, 1, -1 );
 
-    /* Zoom */
-    QSlider *zoomSlider = new QSlider( Qt::Horizontal, this );
-    zoomSlider->setRange( -10, 10);
-    zoomSlider->setPageStep( 3 );
-    zoomSlider->setValue( model->getZoom() );
-    CONNECT( zoomSlider, valueChanged( int ), model, changeZoom( int ) );
-
-    /* pad our zoom slider */
-    QGridLayout *sliderLayout = new QGridLayout;
-    QSpacerItem* sliderSpacer =
-            new QSpacerItem( mainView->getScrollBarsSize(),
-                             mainView->getScrollBarsSize(),
-                            QSizePolicy::Fixed, QSizePolicy::Fixed );
-    sliderLayout->addWidget( zoomSlider, 0, 0, Qt::AlignCenter );
-    sliderLayout->addItem( sliderSpacer, 1, 1, Qt::AlignCenter );
-
-    layout->addLayout( sliderLayout, 1, 3, ( Qt::AlignBottom | Qt::AlignRight ) );
-
     setAcceptDrops( true );
     setWindowTitle( qtr( "Playlist" ) );
     setWindowRole( "vlc-playlist" );
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 0e8a697..af72e59 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -48,7 +48,6 @@
 #include <QStackedLayout>
 #include <QSignalMapper>
 #include <QSettings>
-#include <QScrollBar>
 
 #include <assert.h>
 
@@ -415,12 +414,6 @@ int StandardPLPanel::currentViewIndex() const
         return PICTUREFLOW_VIEW;
 }
 
-int StandardPLPanel::getScrollBarsSize() const
-{
-    /* FIXME: should return a set in case of different widths */
-    return currentView->verticalScrollBar()->sizeHint().width();
-}
-
 void StandardPLPanel::cycleViews()
 {
     if( currentView == iconView )
diff --git a/modules/gui/qt4/components/playlist/standardpanel.hpp b/modules/gui/qt4/components/playlist/standardpanel.hpp
index 9857051..6b936a0 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.hpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.hpp
@@ -69,7 +69,6 @@ public:
            VIEW_COUNT };
 
     int currentViewIndex() const;
-    int getScrollBarsSize() const;
 
 protected:
     PLModel *model;



More information about the vlc-commits mailing list