From 69863bd612acc31188fa55c713e0c9dc329eb909 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Thu, 20 Oct 2011 19:07:41 +0200 Subject: [PATCH] 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. --- .../gui/qt4/components/playlist/ml_model.cpp | 4 ++-- .../gui/qt4/components/playlist/playlist.cpp | 9 ------- .../components/playlist/playlist_model.cpp | 24 ++++++++++++++++++- .../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 b8486b77d0..3aae7ddb59 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 2337ed9133..019bad47eb 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 7200cffb91..8f5da1847e 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 9b6e195795..a1cf54070e 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( 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 -- 2.39.2