layout->addLayout( topbarLayout, 0, 1 );
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 */
QToolButton *viewButton = new QToolButton( this );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
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);
+ PLModel::getPLModel( p_intf )->clearPlaylist();
}
#include <QSignalMapper>
#include <QMenu>
rebuild();
}
+void PLModel::clearPlaylist()
+{
+ if( rowCount() < 1 ) return;
+
+ QModelIndexList l;
+ for( int i = 0; i < rowCount(); i++)
+ {
+ QModelIndex indexrecord = index( i, 0, QModelIndex() );
+ l.append( indexrecord );
+ }
+ doDelete(l);
+}
+
/*********** Popup *********/
bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QModelIndexList &list )
{
}
menu.addSeparator();
+
+ menu.addAction( QIcon( ":/toolbar/clear" ), qtr("Clear playlist"),
+ this, SLOT( clearPlaylist() ) );
+
/* Playlist sorting */
if( !sortingMenu )
{