1 /***************************************************************************
3 copyright : (C) 2003 - 2004 by Scott Wheeler
4 email : wheeler@kde.org
5 ***************************************************************************/
7 /***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 ***************************************************************************/
16 #ifndef DYNAMICPLAYLIST_H
17 #define DYNAMICPLAYLIST_H
24 * A Playlist that is a union of other playlists that is created dynamically.
27 class DynamicPlaylist
: public Playlist
32 * Creates a dynamic playlist based on lists.
34 DynamicPlaylist(const PlaylistList
&lists
,
35 PlaylistCollection
*collection
,
36 const QString
&name
= QString(),
37 const QString
&iconName
= "midi",
38 bool setupPlaylist
= true,
39 bool synchronizePlaying
= false);
41 virtual ~DynamicPlaylist();
43 virtual bool canReload() const { return false; }
45 void setPlaylists(const PlaylistList
&playlists
);
49 * Reimplemented so that it will reload all of the playlists that are
50 * associated with the dynamic list.
52 virtual void slotReload();
53 void slotSetDirty() { m_dirty
= true; }
56 * This is called when lowering the widget from the widget stack so that
57 * it can synchronize the playing item with the one that playlist it was
60 void lower(QWidget
*top
= 0);
64 * Returns true if this list's items need to be updated the next time it's
67 bool dirty() const { return m_dirty
; }
70 * Return a list of the items in this playlist. For example in a search
71 * list this should return only the matched items. By default it returns
72 * all of the items in the playlists associated with this dynamic list.
74 virtual PlaylistItemList
items();
77 * Reimplemented from QWidget. Here it updates the list of items (when
78 * appropriate) as the widget is shown.
80 virtual void showEvent(QShowEvent
*e
);
82 virtual void paintEvent(QPaintEvent
*e
);
85 * Updates the items (unconditionally). This should be reimplemented in
86 * subclasses to refresh the items in the dynamic list (i.e. running a
89 virtual void updateItems();
91 bool synchronizePlaying() const;
95 * Checks to see if the current list of items is "dirty" and if so updates
96 * this dynamic playlist's items to be in sync with the lists that it is a
99 void checkUpdateItems();
102 void slotUpdateItems();
105 QList
<PlaylistObserver
*> m_observers
;
106 PlaylistItemList m_siblings
;
107 PlaylistList m_playlists
;
109 bool m_synchronizePlaying
;
114 // vim: set et sw=4 tw=0 sta: