30
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Videolist content widget
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef VIDEOLISTWIDGET_H
|
|
20 |
#define VIDEOLISTWIDGET_H
|
|
21 |
|
|
22 |
#include <hbview.h>
|
|
23 |
#include <hblistview.h>
|
34
|
24 |
#include <qmap.h>
|
40
|
25 |
#include <qpointer.h>
|
30
|
26 |
#include <mpxitemid.h>
|
39
|
27 |
#include "videoservices.h"
|
34
|
28 |
#include "videocollectioncommon.h"
|
30
|
29 |
|
|
30 |
class VideoSortFilterProxyModel;
|
34
|
31 |
class VideoServices;
|
|
32 |
class VideoCollectionUiLoader;
|
30
|
33 |
class HbAction;
|
|
34 |
class HbMenu;
|
|
35 |
class QTimer;
|
|
36 |
class QItemSelection;
|
|
37 |
class VideoServices;
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Widget for displaying all videos, either using list- or grid view.
|
|
41 |
* Widget contains 2 widgets to be used for different orientation in the stacked layout.
|
|
42 |
*
|
|
43 |
* Depending on the orientation and it's change, corresponding view is set active.
|
|
44 |
*
|
|
45 |
*/
|
|
46 |
class VideoListWidget : public HbListView
|
|
47 |
{
|
|
48 |
Q_OBJECT
|
|
49 |
Q_DISABLE_COPY(VideoListWidget)
|
34
|
50 |
|
30
|
51 |
public:
|
|
52 |
|
|
53 |
|
|
54 |
/**
|
|
55 |
* Contructor.
|
34
|
56 |
* @param uiloader
|
30
|
57 |
* @param parent parent of this widget
|
|
58 |
*/
|
34
|
59 |
VideoListWidget(VideoCollectionUiLoader *uiLoader, HbView *parent = 0);
|
30
|
60 |
|
|
61 |
/**
|
|
62 |
* Destructor.
|
|
63 |
*
|
|
64 |
*/
|
|
65 |
virtual ~VideoListWidget();
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Method creates colleciton wrapper, grid and list views,
|
|
69 |
* layout and activates correct view based on the current orientation
|
|
70 |
*
|
|
71 |
* @param model Model for this list view.
|
41
|
72 |
* @param isService, flag indicating app service status
|
39
|
73 |
* @param level presetted level for the widget
|
30
|
74 |
* @return int 0 initialization ok, < 0 if fails.
|
|
75 |
*/
|
39
|
76 |
int initialize(VideoSortFilterProxyModel &model,
|
41
|
77 |
bool isService = false,
|
39
|
78 |
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid);
|
30
|
79 |
|
|
80 |
/**
|
|
81 |
* Method enables and displays current active view
|
|
82 |
*
|
|
83 |
* @return int 0 initialization ok, < 0 if fails.
|
|
84 |
*/
|
|
85 |
int activate();
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Method enables and displays current active view
|
|
89 |
*
|
|
90 |
* @return int 0 initialization ok, < 0 if fails.
|
|
91 |
*/
|
34
|
92 |
int activate(VideoCollectionCommon::TCollectionLevels level);
|
30
|
93 |
|
|
94 |
/**
|
|
95 |
* Method disables and hides current active view
|
|
96 |
*
|
|
97 |
*/
|
|
98 |
void deactivate();
|
34
|
99 |
|
30
|
100 |
/**
|
34
|
101 |
* returns current level provided by activate
|
|
102 |
*
|
|
103 |
* @return TCollectionLevels
|
30
|
104 |
*/
|
34
|
105 |
VideoCollectionCommon::TCollectionLevels getLevel();
|
30
|
106 |
|
|
107 |
/**
|
|
108 |
* returns widget's model
|
|
109 |
*
|
|
110 |
* @return VideoSortFilterProxyModel*
|
|
111 |
*/
|
40
|
112 |
VideoSortFilterProxyModel* getModel();
|
30
|
113 |
|
34
|
114 |
public:
|
30
|
115 |
|
|
116 |
/**
|
|
117 |
* Called by the fw when some item is tapped. Method check that
|
|
118 |
* index is valid and calls open item for collectionwrapper to
|
|
119 |
* open media object throught collection.
|
|
120 |
*
|
|
121 |
* @param midelIndex, item's index
|
|
122 |
*/
|
|
123 |
void emitActivated (const QModelIndex &modelIndex);
|
34
|
124 |
|
|
125 |
/**
|
|
126 |
* Overwritten from Abstractitemview.
|
|
127 |
* Sets local selection mode variable value used locally in checks.
|
|
128 |
* If provided value is mode provided by HbAbstractitemview sets
|
|
129 |
* it as view selection mode othervise NoSelection is setted
|
|
130 |
*
|
|
131 |
* @param mode
|
|
132 |
*/
|
|
133 |
void setSelectionMode(int mode);
|
44
|
134 |
|
|
135 |
protected:
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Derived from HbListView. Starts fetching thumbnails when rows are inserted.
|
|
139 |
*
|
|
140 |
* @param parent
|
|
141 |
* @param start
|
|
142 |
* @param end
|
|
143 |
*/
|
|
144 |
void rowsInserted(const QModelIndex &parent, int start, int end);
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Derived from HbListView. Starts fetching thumbnails when rows are removed.
|
|
148 |
*
|
|
149 |
* @param parent
|
|
150 |
* @param start
|
|
151 |
* @param end
|
|
152 |
*/
|
|
153 |
void rowsRemoved(const QModelIndex &parent, int start, int end);
|
30
|
154 |
|
|
155 |
signals:
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Command signal.
|
|
159 |
*
|
|
160 |
* @param int command id
|
|
161 |
*/
|
|
162 |
void command(int);
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Signals collection view's state. Used to indicate
|
|
166 |
* view incase some collection item is opened
|
|
167 |
*
|
|
168 |
* @param true if opened, false if closed.
|
|
169 |
* @param optional name string
|
|
170 |
*/
|
41
|
171 |
void collectionOpened(bool, const QString&, const TMPXItemId&);
|
30
|
172 |
|
|
173 |
/**
|
|
174 |
* signal is connected to service's itemSelected -slot
|
|
175 |
*/
|
|
176 |
void fileUri(const QString&);
|
|
177 |
|
37
|
178 |
public slots:
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Signaled by HbInputDialog when it's closed.
|
|
182 |
*/
|
|
183 |
void renameDialogFinished(HbAction *action);
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Signaled by HbMessageBox when it's closed.
|
|
187 |
*/
|
44
|
188 |
void deleteItemDialogFinished(int action);
|
37
|
189 |
|
|
190 |
/**
|
|
191 |
* Signaled by HbMessageBox when it's closed.
|
|
192 |
*/
|
44
|
193 |
void removeCollectionDialogFinished(int action);
|
39
|
194 |
|
|
195 |
/**
|
|
196 |
* called or signaled when delayed initialization is reauired for the widget
|
|
197 |
*
|
|
198 |
*/
|
|
199 |
void doDelayedsSlot();
|
37
|
200 |
|
30
|
201 |
protected slots:
|
36
|
202 |
|
30
|
203 |
/**
|
36
|
204 |
* Signaled by the fw when item is long pressed.
|
|
205 |
* Popup menu for the particular item is opened.
|
30
|
206 |
* Saves current selected item's index to mCurrentIndex
|
|
207 |
*/
|
36
|
208 |
void longPressedSlot(HbAbstractViewItem *item, const QPointF &point);
|
|
209 |
|
30
|
210 |
private slots:
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Signaled for one item deletion.
|
|
214 |
*
|
|
215 |
*/
|
|
216 |
void deleteItemSlot();
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Signaled for item rename.
|
|
220 |
*
|
|
221 |
*/
|
|
222 |
void renameSlot();
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Signaled to add an item into a collection.
|
|
226 |
*
|
|
227 |
*/
|
|
228 |
void addToCollectionSlot();
|
35
|
229 |
|
|
230 |
/**
|
|
231 |
* Signaled to remove a particular video from collection
|
|
232 |
*/
|
|
233 |
void removeFromCollectionSlot();
|
30
|
234 |
|
|
235 |
/**
|
34
|
236 |
* Signaled to remove a user created collection.
|
|
237 |
*
|
|
238 |
*/
|
|
239 |
void removeCollectionSlot();
|
|
240 |
|
|
241 |
/**
|
30
|
242 |
* Signaled when details will be selected from the videolist's
|
|
243 |
* context menu. Maps mCurrentIndex to model's source index and
|
|
244 |
* calls collection wrapper to open details
|
|
245 |
*
|
|
246 |
*/
|
|
247 |
void openDetailsSlot();
|
|
248 |
|
|
249 |
/**
|
36
|
250 |
* Signaled when item's default functionality is initialized from context menu.
|
|
251 |
* Calls emitActivated for actually axecuting the functionality
|
30
|
252 |
*/
|
36
|
253 |
void openItemSlot();
|
37
|
254 |
|
|
255 |
/**
|
|
256 |
* Signaled when item's play functionality is initialized from context menu.
|
|
257 |
* Calls doActivateItem for actually executing the functionality.
|
|
258 |
*/
|
|
259 |
void playItemSlot();
|
30
|
260 |
|
|
261 |
/**
|
|
262 |
* Signaled when stepping back from collection in collection view
|
|
263 |
*
|
|
264 |
*/
|
|
265 |
void back();
|
41
|
266 |
|
|
267 |
/**
|
|
268 |
* connected to navi -quit action triggered signal.
|
|
269 |
* Signals fileUri with empty path for servicing to be completed
|
|
270 |
*/
|
|
271 |
void endVideoFecthingSlot();
|
30
|
272 |
|
|
273 |
/**
|
34
|
274 |
* Signaled when view scrolling starts, pauses thumbnail creation.
|
|
275 |
*
|
|
276 |
*/
|
|
277 |
void scrollingStartedSlot();
|
|
278 |
|
|
279 |
/**
|
30
|
280 |
* Signaled when view scrolling ends, initiates thumbnail fetching
|
34
|
281 |
* at index of first visible item and enables creation of thumbnails.
|
30
|
282 |
*
|
|
283 |
*/
|
|
284 |
void scrollingEndedSlot();
|
|
285 |
|
|
286 |
/**
|
|
287 |
* Signaled when view scroll position changes, initiates timer to
|
|
288 |
* fetch thumbnails at index of first visible item.
|
34
|
289 |
*
|
|
290 |
* @param newPosition scroll position
|
|
291 |
*
|
30
|
292 |
*/
|
|
293 |
void scrollPositionChangedSlot(const QPointF &newPosition);
|
|
294 |
|
34
|
295 |
/**
|
|
296 |
* Signaled when scroll position timer triggers. Starts fetching thumbnails
|
|
297 |
* for visible items.
|
|
298 |
*
|
|
299 |
*/
|
|
300 |
void scrollPositionTimerSlot();
|
|
301 |
|
|
302 |
/**
|
|
303 |
* Fetches thumbnails for the visible items.
|
|
304 |
*
|
|
305 |
*/
|
|
306 |
void fetchThumbnailsForVisibleItems();
|
41
|
307 |
|
30
|
308 |
private:
|
|
309 |
|
|
310 |
enum TContextActionIds
|
|
311 |
{
|
35
|
312 |
EActionDelete = 1,
|
30
|
313 |
EActionDetails,
|
35
|
314 |
EActionRemove,
|
|
315 |
EActionAddToCollection,
|
|
316 |
EActionRemoveCollection,
|
30
|
317 |
EActionRename,
|
36
|
318 |
EActionPlay,
|
37
|
319 |
EActionOpen,
|
|
320 |
EActionAttach
|
30
|
321 |
};
|
|
322 |
|
|
323 |
/**
|
|
324 |
* Method creates popup menu for list items.
|
|
325 |
*
|
|
326 |
*/
|
|
327 |
void createContextMenu();
|
|
328 |
|
|
329 |
/**
|
|
330 |
* Method sets correct popup menu for specific list items.
|
|
331 |
*
|
|
332 |
*/
|
34
|
333 |
void setContextMenu();
|
36
|
334 |
|
|
335 |
/**
|
41
|
336 |
* Method sets correct popup menu for service.
|
36
|
337 |
*/
|
41
|
338 |
void setServiceContextMenu();
|
30
|
339 |
|
|
340 |
/**
|
|
341 |
* Method connects signals needed by the widget
|
|
342 |
*
|
|
343 |
* @return int 0 if connect ok, < 0 if connect fails
|
|
344 |
*/
|
|
345 |
int connectSignals();
|
|
346 |
|
|
347 |
/**
|
|
348 |
* Method disconnects signals needed by the widget
|
|
349 |
*
|
|
350 |
*/
|
|
351 |
void disConnectSignals();
|
36
|
352 |
|
|
353 |
/**
|
|
354 |
* Set navigation action.
|
|
355 |
*/
|
|
356 |
void setNavigationAction();
|
|
357 |
|
|
358 |
/**
|
37
|
359 |
* Does the actual emitActivated functionality. Called from either emitActivated or
|
|
360 |
* openItemSlot.
|
|
361 |
*
|
|
362 |
* @param index Index of the item.
|
|
363 |
*/
|
|
364 |
void doEmitActivated (const QModelIndex &index);
|
|
365 |
|
|
366 |
/**
|
36
|
367 |
* handles single item activation. Either from
|
|
368 |
* user's single tap or from default action at context menu.
|
|
369 |
*
|
|
370 |
* @param index of item
|
|
371 |
*/
|
|
372 |
void doActivateItem(const QModelIndex &index);
|
30
|
373 |
|
|
374 |
private:
|
|
375 |
|
|
376 |
/**
|
|
377 |
* Provided model
|
|
378 |
* Not own.
|
|
379 |
*/
|
40
|
380 |
QPointer<VideoSortFilterProxyModel> mModel;
|
30
|
381 |
|
|
382 |
/**
|
41
|
383 |
* pointer to videoservices instance. If exists,
|
|
384 |
* app has started as service.
|
30
|
385 |
*/
|
|
386 |
VideoServices* mVideoServices;
|
|
387 |
|
|
388 |
/**
|
|
389 |
* map containing pointers to main menu actions
|
|
390 |
*/
|
|
391 |
QMap<TContextActionIds, HbAction*> mContextMenuActions;
|
|
392 |
|
|
393 |
/**
|
|
394 |
* current level indicating content currently showing:
|
|
395 |
* category or videos
|
|
396 |
*/
|
34
|
397 |
VideoCollectionCommon::TCollectionLevels mCurrentLevel;
|
30
|
398 |
|
|
399 |
/**
|
|
400 |
* True if signals have been connected
|
|
401 |
*/
|
|
402 |
bool mSignalsConnected;
|
|
403 |
|
|
404 |
/**
|
36
|
405 |
* Navigation softkey action.
|
30
|
406 |
*/
|
36
|
407 |
HbAction *mNavKeyAction;
|
30
|
408 |
|
|
409 |
/**
|
|
410 |
* Item sensitive context menu
|
|
411 |
*/
|
|
412 |
HbMenu *mContextMenu;
|
34
|
413 |
|
30
|
414 |
/**
|
34
|
415 |
* loacal selection mode
|
|
416 |
*/
|
|
417 |
int mSelectionMode;
|
30
|
418 |
|
|
419 |
/**
|
|
420 |
* Timer used to report thumbnail fetches class index of
|
|
421 |
* first visible item when view is scrolling.
|
|
422 |
*/
|
|
423 |
QTimer *mScrollPositionTimer;
|
34
|
424 |
|
|
425 |
/**
|
|
426 |
* ui loade object, not owned
|
|
427 |
*/
|
|
428 |
VideoCollectionUiLoader *mUiLoader;
|
39
|
429 |
|
|
430 |
/**
|
|
431 |
* Service being provided
|
|
432 |
*/
|
|
433 |
VideoServices::TVideoService mService;
|
30
|
434 |
};
|
|
435 |
|
|
436 |
#endif // VIDEOLISTWIDGET_H
|