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

@ -19,6 +19,7 @@
#include <QAbstractTableModel>
#include <QHash>
#include <QVariant>
#include <QIcon>
#include <QMimeData>
#include <QSettings>
#include <QUrl>
@ -514,3 +515,23 @@ PlaylistModel::get_all_id ()
{
return m_plist;
}
void
PlaylistModel::removeRows (QModelIndexList index_list)
{
QList<uint32_t> idlist;
for (int i = 0; i < index_list.size (); ++i) {
QModelIndex idx = index_list.at(i);
if (idx.column () != 0)
continue;
idlist.append (idx.row ());
}
qSort (idlist);
/* Update of m_plist is done in handle_change through server notification */
for (int i = idlist.size () - 1; i >= 0; --i){
m_client->playlist ()->removeEntry (idlist.at(i));
}
}

View file

@ -111,6 +111,8 @@ class PlaylistModel : public QAbstractItemModel
void set_playlist (const QString &);
void removeRows (QModelIndexList);
protected:
XClient *m_client;
QList < unsigned int > m_plist;