Commit a4f1bc2b authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

Qt: implement playlist empty button

Close #4999
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent b19aaff6
...@@ -112,6 +112,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) ...@@ -112,6 +112,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
layout->addLayout( topbarLayout, 0, 1 ); layout->addLayout( topbarLayout, 0, 1 );
topbarLayout->setSpacing( 10 ); topbarLayout->setSpacing( 10 );
/* Button to clear playlist */
QToolButton *clearPlaylistButton = new QToolButton( this );
clearPlaylistButton->setIcon( style()->standardIcon( QStyle::SP_TrashIcon ) );
clearPlaylistButton->setToolTip( qtr("Clear playlist") );
topbarLayout->addWidget( clearPlaylistButton );
CONNECT( clearPlaylistButton, clicked(), this, clearPlaylist() );
/* 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 ) );
...@@ -249,6 +256,19 @@ void PlaylistWidget::changeView( const QModelIndex& index ) ...@@ -249,6 +256,19 @@ void PlaylistWidget::changeView( const QModelIndex& index )
viewActions[i]->setChecked(true); viewActions[i]->setChecked(true);
} }
void PlaylistWidget::clearPlaylist()
{
PLModel *model = PLModel::getPLModel( p_intf );
if( model->rowCount() < 1 ) return;
QModelIndexList* l = new QModelIndexList();
for( int i = 0; i < model->rowCount(); i++)
{
QModelIndex indexrecord = model->index( i, 0, QModelIndex() );
l->append( indexrecord );
}
model->doDelete(*l);
}
#include <QSignalMapper> #include <QSignalMapper>
#include <QMenu> #include <QMenu>
#include <QPainter> #include <QPainter>
......
...@@ -75,6 +75,7 @@ protected: ...@@ -75,6 +75,7 @@ protected:
virtual void closeEvent( QCloseEvent * ); virtual void closeEvent( QCloseEvent * );
private slots: private slots:
void changeView( const QModelIndex& index ); void changeView( const QModelIndex& index );
void clearPlaylist();
}; };
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
......
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