]> git.sesse.net Git - vlc/commitdiff
Qt: remove the zoom slider and put it on the menu
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 20 Oct 2011 17:07:41 +0000 (19:07 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 21 Oct 2011 13:26:00 +0000 (15:26 +0200)
This isn't one of the most used function, so, it shouldn't be that
visible in the interface.

modules/gui/qt4/components/playlist/ml_model.cpp
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.hpp

index b8486b77d0f34103e6f4b6df6464f994606c80e8..3aae7ddb59ed66c3ee0fd3dabe9c843c2652d4da 100644 (file)
@@ -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();
index 2337ed91337fa71ca5ea27d541225a8f8703dc61..019bad47eb8ea5911f9a60b1feb180213d26c8cd 100644 (file)
@@ -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 ) );
index 7200cffb91c7250f24cd3f8ff9226f16180b79a3..8f5da1847e55040f8cb488d10fa31d28dc263f61 100644 (file)
@@ -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()
 {
index 9b6e195795419b2a8b0466c0daf0b283d75630b9..a1cf54070e17a39e9a88d83cfda232e09e60e781 100644 (file)
@@ -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