|
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: VideoThumbnailData singleton class definition |
|
15 */ |
|
16 |
|
17 #ifndef __VIDEOTHUMBNAILDATA_H__ |
|
18 #define __VIDEOTHUMBNAILDATA_H__ |
|
19 |
|
20 // INCLUDES |
|
21 #include <qobject.h> |
|
22 #include <qicon.h> |
|
23 #include <qpointer.h> |
|
24 #include <mpxitemid.h> |
|
25 |
|
26 #include "videocollectionexport.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class VideoThumbnailDataPrivate; |
|
30 class VideoSortFilterProxyModel; |
|
31 |
|
32 // CLASS DECLARATIONS |
|
33 |
|
34 class VIDEOCOLLECTION_DLL_EXPORT VideoThumbnailData : public QObject |
|
35 { |
|
36 /** |
|
37 * Defined to be able to use signals and slots. |
|
38 */ |
|
39 Q_OBJECT |
|
40 |
|
41 /** |
|
42 * disable copy-constructor and assignment operator |
|
43 */ |
|
44 Q_DISABLE_COPY(VideoThumbnailData) |
|
45 |
|
46 public: |
|
47 |
|
48 /* |
|
49 * Thumbnail fetch priorities. |
|
50 */ |
|
51 enum VideoThumbnailPriority |
|
52 { |
|
53 VideoThumbnailPriorityLow = 2000, |
|
54 VideoThumbnailPriorityMedium = 3000, |
|
55 VideoThumbnailPriorityHigh = 5000 |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Returns singleton instance for this class. |
|
60 * |
|
61 * @return The singleton instance. |
|
62 * |
|
63 */ |
|
64 static VideoThumbnailData &instance(); |
|
65 |
|
66 /** |
|
67 * Method removes thumbnail data from the local repository. |
|
68 * |
|
69 * @param mediaId id for media whose thumbnail is to be removed |
|
70 * |
|
71 * @return bool: true if item removed correctly, false if not. |
|
72 * |
|
73 */ |
|
74 bool removeThumbnail(const TMPXItemId &mediaId); |
|
75 |
|
76 /** |
|
77 * Method returns a pointer to video's thumbnail. |
|
78 * |
|
79 * If thumbnail fetching is ongoing or not yet started, pointer to default |
|
80 * thumbnail is returned. |
|
81 * |
|
82 * @param mediaId media id for which to get thumbnail |
|
83 * @param tnData reference to thumbnail data where data is occupied |
|
84 * |
|
85 * @return QIcon* thumbnail pointer |
|
86 * |
|
87 */ |
|
88 const QIcon* getThumbnail(const TMPXItemId &mediaId); |
|
89 |
|
90 /** |
|
91 * Starts background thumbnail fetching, the model used for the background fetching |
|
92 * is also changed. |
|
93 * |
|
94 * @param model model of the items for the fetching. |
|
95 * @param fetchIndex index where to start the background thumbnail fetching. |
|
96 * |
|
97 */ |
|
98 void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex); |
|
99 |
|
100 /** |
|
101 * Enables or disables thumbnail background fetching. Default is enabled. |
|
102 * |
|
103 * @param enable true enables and false disables thumbnail background fetching. |
|
104 */ |
|
105 void enableBackgroundFetching(bool enable); |
|
106 |
|
107 /** |
|
108 * Enables or disables thumbnail creation. Default is enabled. Thumbnails |
|
109 * that have been already generated are fetched still. |
|
110 * |
|
111 * @param enable true enables and false disables thumbnail creation. |
|
112 */ |
|
113 void enableThumbnailCreation(bool enable); |
|
114 |
|
115 /** |
|
116 * Returns background fetching enabled status. |
|
117 * |
|
118 * @return bool: true if background fetching is enabled, otherwise false. |
|
119 */ |
|
120 bool backgroundFetchingEnabled(); |
|
121 |
|
122 /** |
|
123 * Frees allocated data for thumbnails and cancels ongoing fetches. |
|
124 * |
|
125 */ |
|
126 void freeThumbnailData(); |
|
127 |
|
128 signals: |
|
129 |
|
130 /** |
|
131 * This signal is emitted from thumbnailReadySlot, when |
|
132 * |
|
133 * @param mediaIds: media ids of the videos whose thumbnail is ready. |
|
134 * |
|
135 */ |
|
136 void thumbnailsFetched(QList<TMPXItemId>& mediaIds); |
|
137 |
|
138 private: |
|
139 |
|
140 /** |
|
141 * Default constructor |
|
142 */ |
|
143 VideoThumbnailData(); |
|
144 |
|
145 /** |
|
146 * Destructor |
|
147 */ |
|
148 ~VideoThumbnailData(); |
|
149 |
|
150 /** |
|
151 * Private implementation. |
|
152 */ |
|
153 QPointer<VideoThumbnailDataPrivate> const d_ptr; |
|
154 }; |
|
155 |
|
156 #endif // __VIDEOTHUMBNAILDATA_H__ |
|
157 |
|
158 // End of file |