21 #include <QAbstractListModel> |
21 #include <QAbstractListModel> |
22 #include <QItemSelection> |
22 #include <QItemSelection> |
23 #include <QStringList> |
23 #include <QStringList> |
24 #include <hbicon> |
24 #include <hbicon> |
25 #include <thumbnailmanager_qt.h> |
25 #include <thumbnailmanager_qt.h> |
|
26 #include <QImage> |
|
27 #include <QList> |
|
28 #include "buffermanager.h" |
|
29 #include "hgtestdefs.h" |
26 |
30 |
27 class HgWidgetTestAlbumArtManager; |
31 class HgWidgetTestAlbumArtManager; |
|
32 class ThumbnailManager; |
28 |
33 |
29 |
34 |
30 class HgWidgetTestDataModel : public QAbstractListModel |
35 class HgWidgetTestDataModel : public QAbstractListModel, public AbstractDataProvider |
31 { |
36 { |
32 Q_OBJECT |
37 Q_OBJECT |
33 |
38 |
34 public: |
39 public: |
35 |
40 |
36 explicit HgWidgetTestDataModel(QObject *parent=0); |
41 explicit HgWidgetTestDataModel(QObject *parent=0); |
37 virtual ~HgWidgetTestDataModel(); |
42 virtual ~HgWidgetTestDataModel(); |
38 |
43 |
39 void setThumbnailSize(ThumbnailManager::ThumbnailSize size); |
44 void setThumbnailSize(ThumbnailManager::ThumbnailSize size); |
40 |
45 void setBuffer(int buffer, int treshhold); |
|
46 |
41 int rowCount(const QModelIndex &parent=QModelIndex()) const; |
47 int rowCount(const QModelIndex &parent=QModelIndex()) const; |
42 QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; |
48 QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; |
43 bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole); |
49 bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole); |
44 |
50 |
45 void refreshModel(); |
51 void refreshModel(); |
46 |
52 |
47 void remove(const QItemSelection &selection); |
53 void remove(const QItemSelection &selection); |
48 void move(const QItemSelection &selection, const QModelIndex &target); |
54 void move(const QItemSelection &selection, const QModelIndex &target); |
49 void add(const QModelIndex &target, int count); |
55 void add(const QModelIndex &target, int count); |
|
56 void reset(); |
|
57 |
|
58 HgTestImageType imageDataType() const; |
|
59 void setImageDataType(HgTestImageType type); |
50 |
60 |
51 enum ImageType{TypeQIcon, TypeHbIcon, TypeQImage}; |
|
52 |
|
53 void setImageDataType(ImageType type); |
|
54 |
|
55 void enableLowResImages(bool enabled); |
61 void enableLowResImages(bool enabled); |
56 bool lowResImagesEnabled() const; |
62 bool lowResImagesEnabled() const; |
|
63 |
|
64 public slots: |
|
65 void thumbnailReady( QPixmap , void* , int, int ); |
57 |
66 |
58 private: |
67 private: |
59 |
68 |
60 void init(); |
69 void init(); |
|
70 void getNextThumbnail(); |
61 |
71 |
62 public slots: |
72 public slots: |
63 |
73 |
64 void updateAlbumArt( int index ); |
74 void updateAlbumArt( int index ); |
65 void albumCacheReady(); |
75 void albumCacheReady(); |
66 |
76 |
67 private: |
77 private: |
|
78 |
|
79 void release(int start, int end); |
|
80 void request(int start, int end, requestsOrder order); |
|
81 |
|
82 private: |
68 |
83 |
69 HgWidgetTestAlbumArtManager *mAlbumArtManager; // Own |
|
70 bool mCachingInProgress; |
84 bool mCachingInProgress; |
71 QStringList mFiles; |
85 QStringList mFiles; |
72 ImageType mImageType; |
86 HgTestImageType mImageType; |
73 HbIcon mHbIcon; |
87 HbIcon mHbIcon; |
74 QIcon mQIcon; |
88 QIcon mQIcon; |
75 QImage mDefaultIcon; |
89 QImage mDefaultIcon; |
76 QList<bool> mVisibility; |
90 QList<bool> mVisibility; |
77 bool mUseLowResImages; |
91 bool mUseLowResImages; |
|
92 QList<QImage> mImages; |
|
93 BufferManager *mBufferManager; |
|
94 |
|
95 ThumbnailManager* mWrapper; |
|
96 QStringList mWaitingThumbnails; |
|
97 bool mThumbnailRequestPending; |
|
98 int mThumbnailRequestIndex; |
|
99 int mThumbnailRequestID; |
|
100 |
78 }; |
101 }; |
79 |
102 |
80 #endif // HgWidgetTestDataModel_H |
103 #endif // HgWidgetTestDataModel_H |
81 |
104 |