Commit d320a857 authored by Scott Wheeler's avatar Scott Wheeler

Acutally use the new DynamicPlaylist class.

svn path=/trunk/kdemultimedia/juk/; revision=224241
parent 8b18925b
......@@ -27,15 +27,17 @@ DynamicPlaylist::DynamicPlaylist(const PlaylistList &playlists, QWidget *parent,
m_playlists(playlists),
m_dirty(true)
{
setSorting(columns() + 1);
for(PlaylistList::ConstIterator it = m_playlists.begin(); it != m_playlists.end(); ++it) {
if(*it) {
connect(*it, SIGNAL(signalDataChanged()), this, SLOT(slotSetDirty()));
connect(*it, SIGNAL(signalNumberOfItemsChanged()), this, SLOT(slotSetDirty()));
connect(*it, SIGNAL(signalNumberOfItemsChanged(Playlist *)), this, SLOT(slotSetDirty()));
}
else
m_playlists.remove(*it);
}
connect(CollectionList::instance(), SIGNAL(collectionChanged()), this, SLOT(slotSetDirty()));
connect(CollectionList::instance(), SIGNAL(signalCollectionChanged()), this, SLOT(slotSetDirty()));
}
////////////////////////////////////////////////////////////////////////////////
......@@ -58,13 +60,25 @@ void DynamicPlaylist::showEvent(QShowEvent *e)
PlaylistItemList newItems = items();
if(m_items != newItems) {
m_items = newItems;
clear();
createItems(m_items);
}
QTimer::singleShot(0, this, SLOT(slotUpdateItems()));
}
m_dirty = false;
}
Playlist::showEvent(e);
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
void DynamicPlaylist::slotUpdateItems()
{
// This should be optimized to check to see which items are already in the
// list and just adding those and removing the ones that aren't.
clear();
createItems(m_items);
}
#include "dynamicplaylist.moc"
......@@ -56,6 +56,9 @@ protected:
protected slots:
void slotSetDirty(bool d = true) { m_dirty = d; }
private slots:
void slotUpdateItems();
private:
PlaylistItemList m_items;
PlaylistList m_playlists;
......
......@@ -25,6 +25,7 @@
#include "playlistsplitter.h"
#include "directorylist.h"
#include "playlistsearch.h"
#include "dynamicplaylist.h"
QStringList *PlaylistSplitter::m_mediaExtensions = 0;
QStringList *PlaylistSplitter::m_listExtensions = 0;
......@@ -636,15 +637,8 @@ void PlaylistSplitter::slotChangePlaylist(const PlaylistList &l)
emit signalPlaylistChanged();
}
else {
m_dynamicList = new Playlist(m_playlistStack, i18n("Dynamic List"));
m_dynamicList = new DynamicPlaylist(l, m_playlistStack, i18n("Dynamic List"));
setupPlaylist(m_dynamicList, true, 0);
// unsorted...
m_dynamicList->setSorting(m_dynamicList->columns() + 1);
for(PlaylistList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if(*it)
m_dynamicList->createItems((*it)->items());
}
}
if(current)
......
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