[vlc-commits] Qt: remove the zoom slider and put it on the menu

Jean-Baptiste Kempf git at videolan.org
Fri Oct 21 15:30:48 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Oct 20 19:07:41 2011 +0200| [69863bd612acc31188fa55c713e0c9dc329eb909] | committer: Jean-Baptiste Kempf

Qt: remove the zoom slider and put it on the menu

This isn't one of the most used function, so, it shouldn't be that
visible in the interface.

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

 modules/gui/qt4/components/playlist/ml_model.cpp   |    4 +-
 modules/gui/qt4/components/playlist/playlist.cpp   |    9 -------
 .../gui/qt4/components/playlist/playlist_model.cpp |   24 +++++++++++++++++++-
 .../gui/qt4/components/playlist/playlist_model.hpp |   11 +-------
 4 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/ml_model.cpp b/modules/gui/qt4/components/playlist/ml_model.cpp
index b8486b7..3aae7dd 100644
--- a/modules/gui/qt4/components/playlist/ml_model.cpp
+++ b/modules/gui/qt4/components/playlist/ml_model.cpp
@@ -270,9 +270,9 @@ QVariant MLModel::data( const QModelIndex &index, const int role ) const
             QVariant tmp = it->data( index.column() );
             return tmp;
         }
-        else if( role == VLCModel::IsLeafNodeRole )
+        else if( role == IsLeafNodeRole )
             return QVariant( true );
-        else if( role == VLCModel::IsCurrentsParentNodeRole )
+        else if( role == IsCurrentsParentNodeRole )
             return QVariant( false );
     }
     return QVariant();
diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 2337ed9..019bad4 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -157,15 +157,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
     CONNECT( mainView, viewChanged( const QModelIndex& ),
              this, changeView( const QModelIndex &) );
 
-    /* Zoom */
-    QSlider *zoomSlider = new QSlider( Qt::Horizontal, this );
-    zoomSlider->setRange( -10, 10);
-    zoomSlider->setPageStep( 3 );
-    zoomSlider->setValue( model->getZoom() );
-    zoomSlider->setToolTip( qtr("Zoom playlist") );
-    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 ),
               mainView, setRoot( playlist_item_t *, bool ) );
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 7200cff..8f5da18 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -380,7 +380,10 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
     {
         return QVariant( QBrush( Qt::gray ) );
     }
-    else if( role == IsCurrentRole ) return QVariant( isCurrent( index ) );
+    else if( role == IsCurrentRole )
+    {
+        return QVariant( isCurrent( index ) );
+    }
     else if( role == IsLeafNodeRole )
     {
         QVariant isLeaf;
@@ -977,6 +980,12 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
     }
     menu.addMenu( sortingMenu );
 
+    /* Zoom */
+    QMenu *zoomMenu = new QMenu( qtr( "Display size" ) );
+    zoomMenu->addAction( qtr( "Increase" ), this, SLOT( increaseZoom() ) );
+    zoomMenu->addAction( qtr( "Decrease" ), this, SLOT( decreaseZoom() ) );
+    menu.addMenu( zoomMenu );
+
     /* Store the current selected item for popup*() methods */
     current_selection = list;
 
@@ -1103,6 +1112,19 @@ void PLModel::popupSort( int column )
           column > 0 ? Qt::AscendingOrder : Qt::DescendingOrder );
 }
 
+/* */
+void PLModel::increaseZoom()
+{
+    i_zoom++;
+    emit layoutChanged();
+}
+
+void PLModel::decreaseZoom()
+{
+    i_zoom--;
+    emit layoutChanged();
+}
+
 /******************* Drag and Drop helper class ******************/
 PlMimeData::~PlMimeData()
 {
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 9b6e195..a1cf540 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -113,10 +113,6 @@ public:
             return static_cast<PLItem*>( index.internalPointer() );
         else return rootItem;
     }
-    int getZoom() const
-    {
-        return i_zoom;
-    }
 
 signals:
     void currentChanged( const QModelIndex& );
@@ -124,11 +120,6 @@ signals:
 
 public slots:
     virtual void activateItem( const QModelIndex &index );
-    void changeZoom( const int zoom )
-    {
-        i_zoom = zoom;
-        emit layoutChanged();
-    }
 
 private:
     /* General */
@@ -198,6 +189,8 @@ private slots:
     void processItemRemoval( int i_id );
     void processItemAppend( int item, int parent );
     void activateItem( playlist_item_t *p_item );
+    void increaseZoom();
+    void decreaseZoom();
 };
 
 class PlMimeData : public QMimeData



More information about the vlc-commits mailing list