30
|
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
|
34
|
21 |
#include <qobject.h>
|
|
22 |
#include <qicon.h>
|
|
23 |
#include <qpointer.h>
|
30
|
24 |
#include <mpxitemid.h>
|
|
25 |
|
|
26 |
#include "videocollectionexport.h"
|
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class VideoThumbnailDataPrivate;
|
34
|
30 |
class VideoSortFilterProxyModel;
|
30
|
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(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(TMPXItemId mediaId);
|
|
89 |
|
|
90 |
/**
|
34
|
91 |
* Starts background thumbnail fetching, the model used for the background fetching
|
|
92 |
* is also changed.
|
30
|
93 |
*
|
34
|
94 |
* @param model model of the items for the fetching.
|
30
|
95 |
* @param fetchIndex index where to start the background thumbnail fetching.
|
|
96 |
*
|
|
97 |
*/
|
34
|
98 |
void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
|
30
|
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 |
/**
|
34
|
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 |
/**
|
30
|
116 |
* Frees allocated data for thumbnails and cancels ongoing fetches.
|
|
117 |
*
|
|
118 |
*/
|
|
119 |
void freeThumbnailData();
|
|
120 |
|
|
121 |
signals:
|
|
122 |
|
|
123 |
/**
|
|
124 |
* This signal is emitted from thumbnailReadySlot, when
|
|
125 |
*
|
|
126 |
* @param mediaIds: media ids of the videos whose thumbnail is ready.
|
|
127 |
*
|
|
128 |
*/
|
|
129 |
void thumbnailsFetched(QList<TMPXItemId> mediaIds);
|
|
130 |
|
|
131 |
private:
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Default constructor
|
|
135 |
*/
|
|
136 |
VideoThumbnailData();
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Destructor
|
|
140 |
*/
|
|
141 |
~VideoThumbnailData();
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Private implementation.
|
|
145 |
*/
|
|
146 |
QPointer<VideoThumbnailDataPrivate> const d_ptr;
|
|
147 |
};
|
|
148 |
|
|
149 |
#endif // __VIDEOTHUMBNAILDATA_H__
|
|
150 |
|
|
151 |
// End of file
|