|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HGWIDGETTESTDATAMODEL_H |
|
19 #define HGWIDGETTESTDATAMODEL_H |
|
20 |
|
21 #include <QAbstractListModel> |
|
22 #include <QItemSelection> |
|
23 #include <QStringList> |
|
24 #include <hbicon> |
|
25 #include <thumbnailmanager_qt.h> |
|
26 |
|
27 class HgWidgetTestAlbumArtManager; |
|
28 |
|
29 |
|
30 class HgWidgetTestDataModel : public QAbstractListModel |
|
31 { |
|
32 Q_OBJECT |
|
33 |
|
34 public: |
|
35 |
|
36 explicit HgWidgetTestDataModel(QObject *parent=0); |
|
37 virtual ~HgWidgetTestDataModel(); |
|
38 |
|
39 void setThumbnailSize(ThumbnailManager::ThumbnailSize size); |
|
40 |
|
41 int rowCount(const QModelIndex &parent=QModelIndex()) const; |
|
42 QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const; |
|
43 bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole); |
|
44 |
|
45 void refreshModel(); |
|
46 |
|
47 void remove(const QItemSelection &selection); |
|
48 void move(const QItemSelection &selection, const QModelIndex &target); |
|
49 void add(const QModelIndex &target, int count); |
|
50 |
|
51 enum ImageType{TypeQIcon, TypeHbIcon, TypeQImage}; |
|
52 |
|
53 void setImageDataType(ImageType type); |
|
54 |
|
55 void enableLowResImages(bool enabled); |
|
56 bool lowResImagesEnabled() const; |
|
57 |
|
58 private: |
|
59 |
|
60 void init(); |
|
61 |
|
62 public slots: |
|
63 |
|
64 void updateAlbumArt( int index ); |
|
65 void albumCacheReady(); |
|
66 |
|
67 private: |
|
68 |
|
69 HgWidgetTestAlbumArtManager *mAlbumArtManager; // Own |
|
70 bool mCachingInProgress; |
|
71 QStringList mFiles; |
|
72 ImageType mImageType; |
|
73 HbIcon mHbIcon; |
|
74 QIcon mQIcon; |
|
75 QImage mDefaultIcon; |
|
76 QList<bool> mVisibility; |
|
77 bool mUseLowResImages; |
|
78 }; |
|
79 |
|
80 #endif // HgWidgetTestDataModel_H |
|
81 |