Commit 7c0bb066 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: playlist: move zoom button to top bar

parent a5f542fb
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
#include <QMenu> #include <QMenu>
#include <QSignalMapper> #include <QSignalMapper>
#include <QSlider> #include <QSlider>
#include <QSpacerItem>
#include <QList>
/********************************************************************** /**********************************************************************
* Playlist Widget. The embedded playlist * Playlist Widget. The embedded playlist
...@@ -112,11 +110,15 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -112,11 +110,15 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
CONNECT( locationBar, invoked( const QModelIndex & ), CONNECT( locationBar, invoked( const QModelIndex & ),
mainView, browseInto( const QModelIndex & ) ); mainView, browseInto( const QModelIndex & ) );
QHBoxLayout *topbarLayout = new QHBoxLayout( this );
layout->addLayout( topbarLayout, 0, 1 );
topbarLayout->setSpacing( 10 );
/* Button to switch views */ /* Button to switch views */
QToolButton *viewButton = new QToolButton( this ); QToolButton *viewButton = new QToolButton( this );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
viewButton->setToolTip( qtr("Change playlistview") ); viewButton->setToolTip( qtr("Change playlistview") );
layout->addWidget( viewButton, 0, 2 ); topbarLayout->addWidget( viewButton );
/* View selection menu */ /* View selection menu */
QSignalMapper *viewSelectionMapper = new QSignalMapper( this ); QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
...@@ -142,7 +144,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -142,7 +144,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
searchEdit = new SearchLineEdit( this ); searchEdit = new SearchLineEdit( this );
searchEdit->setMaximumWidth( 250 ); searchEdit->setMaximumWidth( 250 );
searchEdit->setMinimumWidth( 80 ); searchEdit->setMinimumWidth( 80 );
layout->addWidget( searchEdit, 0, 3 ); topbarLayout->addWidget( searchEdit );
CONNECT( searchEdit, textChanged( const QString& ), CONNECT( searchEdit, textChanged( const QString& ),
mainView, search( const QString& ) ); mainView, search( const QString& ) );
CONNECT( searchEdit, searchDelayedChanged( const QString& ), CONNECT( searchEdit, searchDelayedChanged( const QString& ),
...@@ -150,7 +152,14 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -150,7 +152,14 @@ 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 &) );
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 */ /* 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 ),
...@@ -182,24 +191,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -182,24 +191,6 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
layout->addWidget( split, 1, 0, 1, -1 ); 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 ); setAcceptDrops( true );
setWindowTitle( qtr( "Playlist" ) ); setWindowTitle( qtr( "Playlist" ) );
setWindowRole( "vlc-playlist" ); setWindowRole( "vlc-playlist" );
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include <QStackedLayout> #include <QStackedLayout>
#include <QSignalMapper> #include <QSignalMapper>
#include <QSettings> #include <QSettings>
#include <QScrollBar>
#include <assert.h> #include <assert.h>
...@@ -415,12 +414,6 @@ int StandardPLPanel::currentViewIndex() const ...@@ -415,12 +414,6 @@ int StandardPLPanel::currentViewIndex() const
return PICTUREFLOW_VIEW; 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() void StandardPLPanel::cycleViews()
{ {
if( currentView == iconView ) if( currentView == iconView )
......
...@@ -69,7 +69,6 @@ public: ...@@ -69,7 +69,6 @@ public:
VIEW_COUNT }; VIEW_COUNT };
int currentViewIndex() const; int currentViewIndex() const;
int getScrollBarsSize() const;
protected: protected:
PLModel *model; PLModel *model;
......
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