Changeset View
Changeset View
Standalone View
Standalone View
src/browsers/CollectionTreeItemModelBase.h
Show All 31 Lines | |||||
32 | #include <QPixmap> | 32 | #include <QPixmap> | ||
33 | #include <QSet> | 33 | #include <QSet> | ||
34 | 34 | | |||
35 | namespace Collections | 35 | namespace Collections | ||
36 | { | 36 | { | ||
37 | class Collection; | 37 | class Collection; | ||
38 | } | 38 | } | ||
39 | class CollectionTreeItem; | 39 | class CollectionTreeItem; | ||
40 | class QMutex; | ||||
40 | class QTimeLine; | 41 | class QTimeLine; | ||
42 | class TrackLoaderJob; | ||||
41 | 43 | | |||
42 | typedef QPair<Collections::Collection*, CollectionTreeItem* > CollectionRoot; | 44 | typedef QPair<Collections::Collection*, CollectionTreeItem* > CollectionRoot; | ||
43 | 45 | | |||
44 | /** | 46 | /** | ||
45 | @author Nikolaj Hald Nielsen <nhn@kde.org> | 47 | @author Nikolaj Hald Nielsen <nhn@kde.org> | ||
46 | */ | 48 | */ | ||
47 | class AMAROK_EXPORT CollectionTreeItemModelBase : public QAbstractItemModel | 49 | class AMAROK_EXPORT CollectionTreeItemModelBase : public QAbstractItemModel | ||
48 | { | 50 | { | ||
49 | Q_OBJECT | 51 | Q_OBJECT | ||
50 | 52 | | |||
53 | friend class TrackLoaderJob; | ||||
54 | | ||||
51 | public: | 55 | public: | ||
52 | CollectionTreeItemModelBase(); | 56 | CollectionTreeItemModelBase(); | ||
53 | virtual ~CollectionTreeItemModelBase(); | 57 | virtual ~CollectionTreeItemModelBase(); | ||
54 | 58 | | |||
55 | virtual Qt::ItemFlags flags(const QModelIndex &index) const; | 59 | virtual Qt::ItemFlags flags(const QModelIndex &index) const; | ||
56 | virtual QVariant headerData(int section, Qt::Orientation orientation, | 60 | virtual QVariant headerData(int section, Qt::Orientation orientation, | ||
57 | int role = Qt::DisplayRole) const; | 61 | int role = Qt::DisplayRole) const; | ||
58 | virtual QModelIndex index(int row, int column, | 62 | virtual QModelIndex index(int row, int column, | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | 119 | public Q_SLOTS: | |||
137 | void slotExpanded( const QModelIndex &index ); | 141 | void slotExpanded( const QModelIndex &index ); | ||
138 | 142 | | |||
139 | private: | 143 | private: | ||
140 | void handleSpecialQueryResult( CollectionTreeItem::Type type, Collections::QueryMaker *qm, const Meta::DataList &dataList ); | 144 | void handleSpecialQueryResult( CollectionTreeItem::Type type, Collections::QueryMaker *qm, const Meta::DataList &dataList ); | ||
141 | void handleNormalQueryResult( Collections::QueryMaker *qm, const Meta::DataList &dataList ); | 145 | void handleNormalQueryResult( Collections::QueryMaker *qm, const Meta::DataList &dataList ); | ||
142 | 146 | | |||
143 | Collections::QueryMaker::QueryType mapCategoryToQueryType( int levelType ) const; | 147 | Collections::QueryMaker::QueryType mapCategoryToQueryType( int levelType ) const; | ||
144 | 148 | | |||
149 | /** | ||||
150 | * This function is thread-safe | ||||
151 | */ | ||||
152 | void tracksLoaded( Meta::AlbumPtr album, const QModelIndex &index, const Meta::TrackList &tracks ); | ||||
153 | | ||||
154 | QMutex *m_loadingAlbumsMutex; | ||||
155 | QHash<Meta::Album *, int> m_years; | ||||
156 | mutable QSet<Meta::AlbumPtr> m_loadingAlbums; | ||||
157 | | ||||
145 | protected: | 158 | protected: | ||
146 | /** Adds the query maker to the running queries and connects the slots */ | 159 | /** Adds the query maker to the running queries and connects the slots */ | ||
147 | void addQueryMaker( CollectionTreeItem* item, | 160 | void addQueryMaker( CollectionTreeItem* item, | ||
148 | Collections::QueryMaker *qm ) const; | 161 | Collections::QueryMaker *qm ) const; | ||
149 | 162 | | |||
150 | virtual void populateChildren(const Meta::DataList &dataList, CollectionTreeItem *parent, const QModelIndex &parentIndex ); | 163 | virtual void populateChildren(const Meta::DataList &dataList, CollectionTreeItem *parent, const QModelIndex &parentIndex ); | ||
151 | virtual void updateHeaderText(); | 164 | virtual void updateHeaderText(); | ||
152 | 165 | | |||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |