1 /******************************************************************************
2 * copyright: (c) 2007 Alexandre Pereira de Oliveira <aleprj@gmail.com> *
3 * (c) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License version 2 *
6 * as published by the Free Software Foundation. *
7 ******************************************************************************/
9 #ifndef COLLECTIONTREEITEM_H
10 #define COLLECTIONTREEITEM_H
12 #include "meta/Meta.h"
13 #include "Collection.h"
20 SortRole
= Qt::UserRole
+ 1,
21 FilterRole
= Qt::UserRole
+ 2
25 class CollectionTreeItem
{
27 CollectionTreeItem( Meta::DataPtr data
, CollectionTreeItem
*parent
);
28 CollectionTreeItem( Collection
*parentCollection
, CollectionTreeItem
*parent
);
29 //this ctor creates a "Various Artists" node. do not use it for anything else
30 CollectionTreeItem( const Meta::DataList
&data
, CollectionTreeItem
*parent
);
32 ~CollectionTreeItem();
34 CollectionTreeItem
* parent() { return m_parent
; }
36 void appendChild(CollectionTreeItem
*child
);
37 void removeChild( int index
);
39 CollectionTreeItem
*child(int row
);
41 int childCount() const { return m_childItems
.count(); }
42 int columnCount() const { return 1; }
44 QVariant
data(int role
) const;
50 bool isDataItem() const;
52 QueryMaker
* queryMaker() const;
54 bool operator<( const CollectionTreeItem
& other
) const;
55 bool childrenLoaded() const { return m_childrenLoaded
; }
56 void setChildrenLoaded( bool childrenLoaded
);
58 const Meta::DataPtr
data() const { return m_data
; }
59 Collection
* parentCollection() const { return m_parentCollection
; }
61 KUrl::List
urls() const;
62 QList
<Meta::TrackPtr
> descendentTracks();
64 bool allDescendentTracksLoaded() const;
68 CollectionTreeItem
*m_parent
;
69 Collection
* m_parentCollection
;
71 QList
<CollectionTreeItem
*> m_childItems
;
72 bool m_childrenLoaded
;
73 bool m_isVariousArtistsNode
;