Commit 69863bd6 authored by Jean-Baptiste Kempf's avatar 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.
parent 2f6eb75c
...@@ -270,9 +270,9 @@ QVariant MLModel::data( const QModelIndex &index, const int role ) const ...@@ -270,9 +270,9 @@ QVariant MLModel::data( const QModelIndex &index, const int role ) const
QVariant tmp = it->data( index.column() ); QVariant tmp = it->data( index.column() );
return tmp; return tmp;
} }
else if( role == VLCModel::IsLeafNodeRole ) else if( role == IsLeafNodeRole )
return QVariant( true ); return QVariant( true );
else if( role == VLCModel::IsCurrentsParentNodeRole ) else if( role == IsCurrentsParentNodeRole )
return QVariant( false ); return QVariant( false );
} }
return QVariant(); return QVariant();
......
...@@ -157,15 +157,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -157,15 +157,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
CONNECT( mainView, viewChanged( const QModelIndex& ), CONNECT( mainView, viewChanged( const QModelIndex& ),
this, changeView( 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 */ /* Connect the activation of the selector to a redefining of the PL */
DCONNECT( selector, categoryActivated( playlist_item_t *, bool ), DCONNECT( selector, categoryActivated( playlist_item_t *, bool ),
mainView, setRoot( playlist_item_t *, bool ) ); mainView, setRoot( playlist_item_t *, bool ) );
......
...@@ -380,7 +380,10 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const ...@@ -380,7 +380,10 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
{ {
return QVariant( QBrush( Qt::gray ) ); 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 ) else if( role == IsLeafNodeRole )
{ {
QVariant isLeaf; QVariant isLeaf;
...@@ -977,6 +980,12 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode ...@@ -977,6 +980,12 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
} }
menu.addMenu( sortingMenu ); 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 */ /* Store the current selected item for popup*() methods */
current_selection = list; current_selection = list;
...@@ -1103,6 +1112,19 @@ void PLModel::popupSort( int column ) ...@@ -1103,6 +1112,19 @@ void PLModel::popupSort( int column )
column > 0 ? Qt::AscendingOrder : Qt::DescendingOrder ); 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 ******************/ /******************* Drag and Drop helper class ******************/
PlMimeData::~PlMimeData() PlMimeData::~PlMimeData()
{ {
......
...@@ -113,10 +113,6 @@ public: ...@@ -113,10 +113,6 @@ public:
return static_cast<PLItem*>( index.internalPointer() ); return static_cast<PLItem*>( index.internalPointer() );
else return rootItem; else return rootItem;
} }
int getZoom() const
{
return i_zoom;
}
signals: signals:
void currentChanged( const QModelIndex& ); void currentChanged( const QModelIndex& );
...@@ -124,11 +120,6 @@ signals: ...@@ -124,11 +120,6 @@ signals:
public slots: public slots:
virtual void activateItem( const QModelIndex &index ); virtual void activateItem( const QModelIndex &index );
void changeZoom( const int zoom )
{
i_zoom = zoom;
emit layoutChanged();
}
private: private:
/* General */ /* General */
...@@ -198,6 +189,8 @@ private slots: ...@@ -198,6 +189,8 @@ private slots:
void processItemRemoval( int i_id ); void processItemRemoval( int i_id );
void processItemAppend( int item, int parent ); void processItemAppend( int item, int parent );
void activateItem( playlist_item_t *p_item ); void activateItem( playlist_item_t *p_item );
void increaseZoom();
void decreaseZoom();
}; };
class PlMimeData : public QMimeData class PlMimeData : public QMimeData
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment