Commit b5a3f485 authored by Scott Wheeler's avatar Scott Wheeler

Make the Tree View almost work again. It still seems to save and restore

generated playlists, which isn't desirable.

svn path=/trunk/kdemultimedia/juk/; revision=317523
parent 3d2155a3
......@@ -17,6 +17,7 @@
#include "dynamicplaylist.h"
#include "collectionlist.h"
#include "playlistcollection.h"
// TODO: this current updates even when things are just played in the watched
// playlists. There should be different update types and this should only
......@@ -44,11 +45,16 @@ private:
DynamicPlaylist::DynamicPlaylist(const PlaylistList &playlists,
PlaylistCollection *collection,
const QString &name,
const QString &iconName) :
Playlist(collection, name, iconName),
const QString &iconName,
bool setupPlaylist) :
Playlist(collection, true),
m_playlists(playlists),
m_dirty(true)
{
if(setupPlaylist)
collection->setupPlaylist(this, iconName);
setName(name);
setSorting(columns() + 1);
for(PlaylistList::ConstIterator it = playlists.begin(); it != playlists.end(); ++it)
......
......@@ -32,7 +32,8 @@ public:
DynamicPlaylist(const PlaylistList &lists,
PlaylistCollection *collection,
const QString &name = QString::null,
const QString &iconName = "midi");
const QString &iconName = "midi",
bool setupPlaylist = true);
virtual ~DynamicPlaylist();
......
......@@ -54,9 +54,11 @@ public:
const QString &name = QString::null, const QString &iconName = "midi");
Playlist(PlaylistCollection *collection, const QFileInfo &playlistFile,
const QString &iconName = "midi");
/**
* This constructor should just be used for creating playlists from the Playlist
* cache.
* This constructor should generally only be used either by the cache
* restoration methods or by subclasses that want to handle calls to
* PlaylistCollection::setupPlaylist() differently.
*/
Playlist(PlaylistCollection *collection, bool delaySetup);
......
......@@ -188,10 +188,14 @@ Playlist *PlaylistBox::currentPlaylist() const
void PlaylistBox::setupPlaylist(Playlist *playlist, const QString &iconName)
{
PlaylistCollection::setupPlaylist(playlist, iconName);
new Item(this, iconName, playlist->name(), playlist);
}
void PlaylistBox::setupPlaylist(Playlist *playlist, const QString &iconName, Item *parentItem)
{
PlaylistCollection::setupPlaylist(playlist, iconName);
new Item(parentItem, iconName, playlist->name(), playlist);
}
////////////////////////////////////////////////////////////////////////////////
// PlaylistBox private methods
......
......@@ -45,9 +45,11 @@ class PlaylistBox : public KListView, public PlaylistCollection
public:
class Item;
friend class Item;
typedef QValueList<Item *> ItemList;
friend class Item;
friend class TreeViewMode;
PlaylistBox(QWidget *parent, QWidgetStack *playlistStack,
const QString &name = QString::null);
......@@ -66,6 +68,7 @@ public slots:
protected:
virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
virtual void setupPlaylist(Playlist *playlist, const QString &iconName, Item *parentItem);
signals:
void signalCollectionInitialized();
......
......@@ -38,6 +38,7 @@ class PlaylistCollection : public PlaylistInterface
{
friend class Playlist;
friend class CollectionList;
friend class DynamicPlaylist;
public:
PlaylistCollection(QWidgetStack *playlistStack);
......
......@@ -27,8 +27,9 @@
SearchPlaylist::SearchPlaylist(PlaylistCollection *collection,
const PlaylistSearch &search,
const QString &name) :
DynamicPlaylist(search.playlists(), collection, name, "find"),
const QString &name,
bool setupPlaylist) :
DynamicPlaylist(search.playlists(), collection, name, "find", setupPlaylist),
m_search(search)
{
......
......@@ -24,7 +24,8 @@ class SearchPlaylist : public DynamicPlaylist
public:
SearchPlaylist(PlaylistCollection *collection,
const PlaylistSearch &search = PlaylistSearch(),
const QString &name = QString::null);
const QString &name = QString::null,
bool setupPlaylist = true);
PlaylistSearch playlistSearch() const { return m_search; }
void setPlaylistSearch(const PlaylistSearch &s, bool update = true);
......
......@@ -312,7 +312,8 @@ void TreeViewMode::setupCategory(const QString &searchCategory, const QStringLis
playlists.append(collection);
PlaylistSearch s(playlists, components, PlaylistSearch::MatchAny, false);
new SearchPlaylist(playlistBox(), s, *it);
SearchPlaylist *p = new SearchPlaylist(playlistBox(), s, *it, false);
playlistBox()->setupPlaylist(p, "midi", m_searchCategories[searchCategory]);
static int i = 0;
if(++i % 5 == 0)
......
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