Implement removing of items in the Playlist

This commit is contained in:
Thomas Frauendorfer 2007-10-17 14:11:45 +02:00
parent eef3e53bd9
commit 0cf6c18de4
5 changed files with 44 additions and 3 deletions

View file

@ -1,4 +1,4 @@
// TODO might not need those
// TODO might not need those two
#include <xmmsclient/xmmsclient++.h>
#include "XMMSHandler.h"
@ -119,6 +119,18 @@ PlaylistView::invertSelection () {
QItemSelectionModel::NoUpdate);
}
void
PlaylistView::cropSelected () {
invertSelection ();
removeSelected ();
selectAll ();
}
void
PlaylistView::removeSelected () {
qobject_cast<PlaylistModel *> (model ())->removeRows (selectedIndexes ());
}
void
PlaylistView::setModel (QAbstractItemModel *model) {
QListView::setModel (model);
@ -144,6 +156,7 @@ PlaylistView::contextMenuEvent (QContextMenuEvent *e)
qm.addAction (a);
a = new QAction (tr ("Remove selected"), this);
connect (a, SIGNAL (triggered ()), this, SLOT (removeSelected ()));
qm.addAction (a);
qm.addSeparator ();
@ -222,7 +235,6 @@ PlaylistView::mouseDoubleClickEvent (QMouseEvent *event)
XMMSHandler &xmmsh = XMMSHandler::getInstance ();
xmmsh.requestTrackChange (index.row());
// TODO check for status first.
if (m_status == XMMS_PLAYBACK_STATUS_STOP ||
m_status == XMMS_PLAYBACK_STATUS_PAUSE) {
xmmsh.play ();