]> git.sesse.net Git - vlc/commitdiff
Qt: playlist: move zoom button to top bar
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 8 Sep 2011 04:09:21 +0000 (06:09 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 8 Sep 2011 04:36:42 +0000 (06:36 +0200)
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.hpp

index e10a11bc1c4dcfe7790a53beb940164027290f24..65e6ce54e8c478f6c46f1bccb417d4e5e393d7cb 100644 (file)
@@ -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" );
index 0e8a69742e5a4a09a0258f02992e978accfc04e2..af72e591face8567f99bd5ed8b830cd7f0eca0d7 100644 (file)
@@ -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 )
index 9857051f1f07a3ba0a94d233e58db5ed6fa64810..6b936a0c8bddeede81b9303f3c06b32abb5a8b67 100644 (file)
@@ -69,7 +69,6 @@ public:
            VIEW_COUNT };
 
     int currentViewIndex() const;
-    int getScrollBarsSize() const;
 
 protected:
     PLModel *model;