Commit 48e75218 authored by Scott Wheeler's avatar Scott Wheeler

Added genre support to inline editing. Also added "Remove files" to the

RMB menu and did some associated cleanups.

svn path=/trunk/kdemultimedia/juk/; revision=202821
parent cab5098c
......@@ -39,7 +39,8 @@
#include "collectionlist.h"
#include "playlistsplitter.h"
#include "playlistbox.h"
#include <tag.h>
#include "tag.h"
#include "genrelistlist.h"
////////////////////////////////////////////////////////////////////////////////
// public members
......@@ -440,6 +441,7 @@ void Playlist::setup()
setRenameable(PlaylistItem::TrackColumn, true);
setRenameable(PlaylistItem::ArtistColumn, true);
setRenameable(PlaylistItem::AlbumColumn, true);
setRenameable(PlaylistItem::GenreColumn, true);
setAllColumnsShowFocus(true);
setSelectionMode(QListView::Extended);
......@@ -451,7 +453,8 @@ void Playlist::setup()
setSorting(1);
rmbMenu = new QPopupMenu(this);
rmbMenu->insertItem(SmallIcon("edittool"), i18n("Edit"), this, SLOT(renameTag()));
rmbEditID = rmbMenu->insertItem(SmallIcon("edittool"), i18n("Edit"), this, SLOT(renameTag()));
rmbMenu->insertItem(SmallIcon("editdelete"), i18n("Remove from disk"), this, SLOT(removeSelectedItems()));
connect(this, SIGNAL(selectionChanged()), this, SLOT(emitSelected()));
connect(this, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(emitDoubleClicked(QListViewItem *)));
......@@ -484,11 +487,19 @@ void Playlist::emitDoubleClicked(QListViewItem *)
void Playlist::showRMBMenu(QListViewItem *item, const QPoint &point, int column)
{
if(item && (column == PlaylistItem::TrackColumn || column == PlaylistItem::ArtistColumn || column == PlaylistItem::AlbumColumn))
{
rmbMenu->popup(point);
currentColumn = column;
}
if(!item)
return;
bool showEdit =
(column == PlaylistItem::TrackColumn) ||
(column == PlaylistItem::ArtistColumn) ||
(column == PlaylistItem::AlbumColumn) ||
(column == PlaylistItem::GenreColumn);
rmbMenu->setItemVisible(rmbEditID, showEdit);
rmbMenu->popup(point);
currentColumn = column;
}
void Playlist::renameTag()
......@@ -507,6 +518,13 @@ void Playlist::renameTag()
case PlaylistItem::AlbumColumn:
edit->completionObject()->setItems(list->albums());
break;
case PlaylistItem::GenreColumn:
QStringList genreStrings;
GenreList genres = GenreListList::ID3v1List();
for(GenreList::Iterator it = genres.begin(); it != genres.end(); ++it)
genreStrings.append(*it);
edit->completionObject()->setItems(genreStrings);
break;
}
edit->setCompletionMode(KGlobalSettings::CompletionAuto);
......@@ -531,6 +549,9 @@ void Playlist::applyTags(QListViewItem *item, const QString &text, int column)
case PlaylistItem::AlbumColumn:
i->tag()->setAlbum(text);
break;
case PlaylistItem::GenreColumn:
i->tag()->setGenre(text);
break;
}
i->tag()->save();
......
......@@ -70,15 +70,10 @@ public:
* Returns a list of the currently selected items.
*/
PlaylistItemList selectedItems() const;
/**
* Remove the currently selected items from the playlist.
*/
void removeSelectedItems() { remove(selectedItems()); };
/**
* Remove \a items from the playlist. This will ignore items that are not
* actually in the list.
* Remove \a items from the playlist and disk. This will ignore items that
* are not actually in the list.
*/
void remove(const PlaylistItemList &items);
......@@ -127,6 +122,12 @@ public:
PlaylistItem *nextItem(PlaylistItem *current, bool random = false);
PlaylistItem *previousItem(PlaylistItem *current, bool random = false);
public slots:
/**
* Remove the currently selected items from the playlist and disk.
*/
void removeSelectedItems() { remove(selectedItems()); };
protected:
virtual QDragObject *dragObject();
virtual void contentsDropEvent(QDropEvent *e);
......@@ -197,6 +198,8 @@ private:
QString playlistName;
PlaylistSplitter *splitter;
PlaylistBoxItem *boxItem;
int rmbEditID;
};
#endif
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