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 view class definition
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef VIDEOLISTVIEW_H
|
|
19 |
#define VIDEOLISTVIEW_H
|
|
20 |
|
|
21 |
#include <hbview.h>
|
|
22 |
#include <qnamespace.h>
|
34
|
23 |
#include <qabstractitemmodel.h>
|
|
24 |
#include <hbaction.h>
|
|
25 |
|
|
26 |
#include "videohintwidget.h"
|
30
|
27 |
|
|
28 |
class QGraphicsItem;
|
|
29 |
class VideoListWidget;
|
|
30 |
class QActionGroup;
|
|
31 |
class QVariant;
|
|
32 |
class VideoCollectionViewUtils;
|
|
33 |
class VideoSortFilterProxyModel;
|
|
34 |
class VideoCollectionWrapper;
|
|
35 |
class HbStackedWidget;
|
|
36 |
class VideoCollectionUiLoader;
|
|
37 |
class HbGroupBox;
|
|
38 |
class VideoListSelectionDialog;
|
|
39 |
class HbMenu;
|
|
40 |
class VideoServices;
|
36
|
41 |
class TMPXItemId;
|
44
|
42 |
class HbToolBarExtension;
|
|
43 |
class VideoOperatorService;
|
30
|
44 |
|
|
45 |
/**
|
|
46 |
* Class acts as an container for widgets that are used to display different
|
|
47 |
* data: all videos, video collections or video services.
|
|
48 |
*
|
|
49 |
* Class is also responsible to mainatain correct widget active selected by the user's
|
|
50 |
* tap from the toolbar and creating and maintaining main menu commonly used by all widgets.
|
|
51 |
*
|
|
52 |
*/
|
|
53 |
class VideoListView : public HbView
|
|
54 |
{
|
|
55 |
Q_OBJECT
|
|
56 |
|
|
57 |
public:
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Contructor.
|
|
61 |
* @param uiLoader VideoCollectionUiLoader instance for this view
|
|
62 |
* @param parent parent of this view
|
|
63 |
*/
|
|
64 |
VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Destructor.
|
|
68 |
*
|
|
69 |
*/
|
|
70 |
~VideoListView();
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Creates and initializes view objects, toolbar and menu and connects signals
|
|
74 |
*
|
|
75 |
* @return 0 if ok, < 0 if intialisation fails
|
|
76 |
*/
|
|
77 |
int initializeView();
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Activates current widget to be shown, enables menu and connects
|
|
81 |
* orientation change signals.
|
|
82 |
*
|
36
|
83 |
* @param itemId, Id of the widget which is to be activated
|
30
|
84 |
* @return 0 activation ok, < 0 if activation fails
|
|
85 |
*/
|
41
|
86 |
int activateView(TMPXItemId &itemId);
|
30
|
87 |
|
|
88 |
/**
|
|
89 |
* Deactivates current widget, disables menu and disconnects
|
|
90 |
* orientation change signals.
|
|
91 |
*
|
|
92 |
*/
|
|
93 |
void deactivateView();
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Back implementation.
|
|
97 |
* Not used at the moment
|
|
98 |
*
|
|
99 |
*/
|
|
100 |
void back();
|
|
101 |
|
|
102 |
signals:
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Command signal. Should be connected to the
|
|
106 |
* plugin interface's command -signal in order to
|
|
107 |
* get the emitted commands transported uotside plugin.
|
|
108 |
*
|
|
109 |
* @param int command id
|
|
110 |
*/
|
|
111 |
void command(int);
|
35
|
112 |
|
|
113 |
/**
|
|
114 |
* Signaled to do delayed loading of components not loaded initially at start up phase
|
|
115 |
*
|
|
116 |
*/
|
|
117 |
void doDelayeds();
|
37
|
118 |
|
|
119 |
/**
|
|
120 |
* Signaled when view is ready.
|
|
121 |
*/
|
|
122 |
void viewReady();
|
30
|
123 |
|
|
124 |
private slots:
|
|
125 |
|
|
126 |
/**
|
|
127 |
* slot is connected to model's modelReady -signal
|
|
128 |
*/
|
|
129 |
void modelReadySlot();
|
50
|
130 |
|
|
131 |
/**
|
|
132 |
* slot is connected to model's albumListReady -signal
|
|
133 |
*/
|
|
134 |
void albumListReadySlot();
|
|
135 |
|
30
|
136 |
/**
|
35
|
137 |
* slot is connected to plugin's doDelayeds -signal
|
|
138 |
*
|
|
139 |
*/
|
|
140 |
void doDelayedsSlot();
|
|
141 |
|
|
142 |
/**
|
30
|
143 |
* slot is connected to service's titleReady -signal
|
|
144 |
*/
|
|
145 |
void titleReadySlot(const QString& title);
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Slot is connected to model slots informing changes in item count
|
|
149 |
* Method checks the current model state and updates accrodingly
|
|
150 |
*
|
|
151 |
*/
|
|
152 |
void layoutChangedSlot();
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Slot is connected into toolbar's all videos tab's
|
|
156 |
* triggered signal.
|
|
157 |
*
|
|
158 |
* Activates all videos widget by calling changeWidget.
|
|
159 |
*
|
|
160 |
*/
|
35
|
161 |
void openAllVideosViewSlot();
|
30
|
162 |
|
|
163 |
/**
|
|
164 |
* Slot is connected into toolbar's video collection tab's
|
|
165 |
* triggered signal.
|
|
166 |
*
|
|
167 |
* Activates video collection widget by calling changeWidget.
|
|
168 |
*
|
|
169 |
*/
|
|
170 |
void openCollectionViewSlot();
|
34
|
171 |
|
|
172 |
/**
|
44
|
173 |
* Slot is connected into hint widget's button's clicked signal.
|
30
|
174 |
*
|
44
|
175 |
* Activates first operator service.
|
30
|
176 |
*
|
|
177 |
*/
|
44
|
178 |
void openOperatorServiceSlot();
|
30
|
179 |
|
|
180 |
/**
|
|
181 |
* Slot is connected into main menus sort -items
|
35
|
182 |
* Method checks sorting role based on active menu item and initiates sorting
|
30
|
183 |
*
|
|
184 |
*/
|
|
185 |
void startSorting();
|
|
186 |
|
35
|
187 |
/**
|
|
188 |
* Method checks the sorting role and starts sorting
|
|
189 |
*
|
|
190 |
*/
|
|
191 |
void doSorting(int role);
|
|
192 |
|
30
|
193 |
/**
|
|
194 |
* Slot is connected into main menus "delete items" (delete...) signal
|
|
195 |
*
|
|
196 |
* Calls ui utils to show multiple delete dialog for current widget
|
|
197 |
*
|
|
198 |
*/
|
|
199 |
void deleteItemsSlot();
|
|
200 |
|
|
201 |
/**
|
|
202 |
* Slot is connected into main menus "Create new collection..." signal
|
|
203 |
* Shows a selection dialog for creating a new collection
|
|
204 |
*
|
|
205 |
*/
|
|
206 |
void createCollectionSlot();
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Slot is connected into toolbar's "Add videos" signal
|
|
210 |
*
|
|
211 |
*/
|
|
212 |
void addVideosToCollectionSlot();
|
35
|
213 |
|
|
214 |
/**
|
|
215 |
* Slot is connected into toolbar's "remove videos" signal
|
|
216 |
*/
|
|
217 |
void removeVideosFromCollectionSlot();
|
30
|
218 |
|
|
219 |
/**
|
|
220 |
* Slot is connected into main menus aboutToShow -signal
|
|
221 |
*
|
|
222 |
*/
|
|
223 |
void aboutToShowMainMenuSlot();
|
36
|
224 |
|
|
225 |
/**
|
|
226 |
* Prepare menu when videos used through browsing service.
|
|
227 |
*/
|
|
228 |
void prepareBrowseServiceMenu();
|
30
|
229 |
|
|
230 |
/**
|
|
231 |
* Slot is connected into hbInstance's primary window's
|
|
232 |
* aboutToChangeOrientation -signal. This is called when
|
|
233 |
* orientation is to be change.
|
|
234 |
*/
|
|
235 |
void aboutToChangeOrientationSlot();
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Slot is connected into hbInstance's primary window's
|
|
239 |
* aboutToChangeOrientation -signal. This is called when
|
|
240 |
* orientation is changed.
|
|
241 |
*
|
|
242 |
* @param orientation new orientation
|
|
243 |
*/
|
|
244 |
void orientationChangedSlot( Qt::Orientation orientation );
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Slot is connected into viewdollectionwrapper's asyncStatus -signal
|
|
248 |
* If status is failed delete, refiltering is called to model before
|
|
249 |
* error message is shown.
|
|
250 |
*
|
|
251 |
* @param statusCode code of error
|
|
252 |
* @param additional additional data of status
|
|
253 |
*/
|
|
254 |
void handleAsyncStatusSlot(int statusCode, QVariant &additional);
|
|
255 |
|
|
256 |
/**
|
|
257 |
* Slot is connected to videolistwidgets collectionOpened -signal
|
|
258 |
*
|
41
|
259 |
* @param openingCollection
|
30
|
260 |
* @param collection contains the name of the collection opened
|
|
261 |
*/
|
41
|
262 |
void collectionOpenedSlot(bool openingCollection,
|
34
|
263 |
const QString& collection,
|
41
|
264 |
const TMPXItemId &collectionId);
|
37
|
265 |
|
34
|
266 |
/**
|
|
267 |
* Slot which is called when an object has been loaded.
|
|
268 |
*/
|
|
269 |
void objectReadySlot(QObject *object, const QString &name);
|
|
270 |
|
30
|
271 |
// TODO: following can be removed after all implementation ready
|
|
272 |
/**
|
|
273 |
* Slot is connected into item signals that are not yet implemented.
|
|
274 |
* Slot shows "Not yet implemented" note
|
|
275 |
*/
|
|
276 |
void debugNotImplementedYet();
|
|
277 |
|
|
278 |
private:
|
35
|
279 |
/**
|
50
|
280 |
* Convenience method that modelReadySlot and albumListReadySlot calls.
|
|
281 |
*/
|
|
282 |
void modelReady();
|
|
283 |
|
|
284 |
/**
|
30
|
285 |
* Cleans all possibly created objects from this. In some cases there are no quarantees
|
|
286 |
* that they were created correctly, and thus is better to start again from clean slate.
|
|
287 |
*/
|
|
288 |
void cleanup();
|
|
289 |
|
|
290 |
/**
|
|
291 |
* Method creates 3 tabs for the view's toolbar: all videos, collections and Services.
|
|
292 |
* Tabs' icons are loaded and theiur triggered signals are connected into corresponding slots.
|
|
293 |
*
|
|
294 |
* @return 0 creation ok, < 0 creation fails
|
|
295 |
*/
|
|
296 |
int createToolbar();
|
|
297 |
|
|
298 |
/**
|
44
|
299 |
* Loads video services from central respository and creates toolbar buttons for them.
|
|
300 |
*/
|
|
301 |
void createOperatorServicesToolbar();
|
|
302 |
|
|
303 |
/**
|
|
304 |
* Loads video service from Central Repository and stores it into member array.
|
|
305 |
*
|
|
306 |
* @param titleKey CenRep key for service title.
|
|
307 |
* @param iconKey CenRep key for icon resource.
|
|
308 |
* @param uriKey CenRep key for service URI.
|
|
309 |
* @param uidKey CenRep key for service application UID.
|
|
310 |
*/
|
|
311 |
void loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey);
|
|
312 |
|
|
313 |
/**
|
30
|
314 |
* Creates action with given parameters. createActionGroup() must be called successfully
|
|
315 |
* before using this method.
|
|
316 |
*
|
|
317 |
* @param tooltip Tooltip text for the action.
|
|
318 |
* @param icon Filepath for the icon file.
|
|
319 |
* @param actionGroup Actiongroup for created action.
|
|
320 |
* @param slot Slot for the triggered signal of the action.
|
|
321 |
* @return HbAction pointer if creation ok, otherwise 0
|
|
322 |
*/
|
34
|
323 |
HbAction* createAction(QString icon, QActionGroup* actionGroup, const char *slot);
|
30
|
324 |
|
|
325 |
/**
|
|
326 |
* Shows or hides the hint. Only shows the hint if model does not have any
|
|
327 |
* items.
|
|
328 |
*
|
|
329 |
* @param show Set this to false if you want to force hide the hint.
|
|
330 |
*/
|
|
331 |
void showHint(bool show = true);
|
|
332 |
|
|
333 |
/**
|
34
|
334 |
*
|
|
335 |
*/
|
|
336 |
void setHintLevel(VideoHintWidget::HintLevel level);
|
|
337 |
|
|
338 |
/**
|
30
|
339 |
* Updates the sublabel text.
|
|
340 |
*/
|
|
341 |
void updateSubLabel();
|
34
|
342 |
|
|
343 |
/**
|
|
344 |
* Shows or hides a menu action.
|
|
345 |
*/
|
|
346 |
void showAction(bool show, const QString &name);
|
|
347 |
|
|
348 |
/**
|
41
|
349 |
* Activates all videos or collections -list.
|
|
350 |
*
|
|
351 |
* @return int 0 ok
|
34
|
352 |
*/
|
41
|
353 |
int activateMainView();
|
34
|
354 |
|
|
355 |
/**
|
41
|
356 |
* Activate to collection content view when servicing.
|
|
357 |
* Only default collections are supported. If some other
|
|
358 |
* id is provided, all videos -list will be activated
|
|
359 |
*
|
|
360 |
* @param itemId. Id of collection to activate
|
|
361 |
* @return int
|
34
|
362 |
*/
|
36
|
363 |
int activateCollectionContentView(const TMPXItemId &itemId);
|
34
|
364 |
|
30
|
365 |
private:
|
|
366 |
|
|
367 |
/**
|
44
|
368 |
* Actions ids used in main menu and tool bar
|
30
|
369 |
*/
|
|
370 |
enum TViewActionIds
|
|
371 |
{
|
34
|
372 |
ETBActionAllVideos = 10,
|
|
373 |
ETBActionCollections = 11,
|
|
374 |
ETBActionServices = 12,
|
|
375 |
ETBActionAddVideos = 13,
|
35
|
376 |
ETBActionRemoveVideos = 14
|
30
|
377 |
};
|
|
378 |
|
|
379 |
/**
|
44
|
380 |
* Reference to video collection view utils
|
30
|
381 |
*/
|
|
382 |
VideoCollectionViewUtils &mUiUtils;
|
|
383 |
|
|
384 |
/**
|
44
|
385 |
* Reference to videocollectionwrapper
|
30
|
386 |
*/
|
34
|
387 |
VideoCollectionWrapper &mWrapper;
|
30
|
388 |
|
|
389 |
/**
|
|
390 |
* Pointer to the XML UI (DocML) loader, not owned
|
|
391 |
*/
|
|
392 |
VideoCollectionUiLoader* mUiLoader;
|
|
393 |
|
|
394 |
/**
|
|
395 |
* Boolean for knowing when the model is ready.
|
|
396 |
*/
|
|
397 |
bool mModelReady;
|
38
|
398 |
|
|
399 |
/**
|
|
400 |
* Boolean for knowing when the view is ready.
|
|
401 |
*/
|
|
402 |
bool mViewReady;
|
35
|
403 |
|
|
404 |
/**
|
|
405 |
* Hint level for the hint widget.
|
|
406 |
*/
|
|
407 |
VideoHintWidget::HintLevel mHintLevel;
|
30
|
408 |
|
|
409 |
/**
|
44
|
410 |
* Pointer to videoservices instance
|
41
|
411 |
* if exists, app has started as service
|
30
|
412 |
*/
|
|
413 |
VideoServices* mVideoServices;
|
|
414 |
|
|
415 |
/**
|
34
|
416 |
* Currently used list
|
30
|
417 |
*/
|
34
|
418 |
VideoListWidget* mCurrentList;
|
35
|
419 |
|
30
|
420 |
/**
|
|
421 |
* Action group for the toolbar.
|
|
422 |
*/
|
|
423 |
QActionGroup* mToolbarViewsActionGroup;
|
|
424 |
|
|
425 |
/**
|
|
426 |
* Action group for the toolbar.
|
|
427 |
*/
|
|
428 |
QActionGroup* mToolbarCollectionActionGroup;
|
|
429 |
|
|
430 |
/**
|
44
|
431 |
* Map containing toolbar actions
|
30
|
432 |
*/
|
|
433 |
QMap<TViewActionIds, HbAction*> mToolbarActions;
|
|
434 |
|
|
435 |
/**
|
44
|
436 |
* Sorting roles mapped to appropriate actions.
|
30
|
437 |
*/
|
|
438 |
QMap<HbAction*, int> mSortingRoles;
|
|
439 |
|
|
440 |
/**
|
|
441 |
* String containing the name of the currently open collection
|
|
442 |
*/
|
|
443 |
QString mCollectionName;
|
44
|
444 |
|
|
445 |
/**
|
|
446 |
* Toolbar extension for operator services when there's more than
|
|
447 |
* one of them.
|
|
448 |
*/
|
|
449 |
HbToolBarExtension *mToolbarServiceExtension;
|
|
450 |
|
|
451 |
/**
|
|
452 |
* List of operator services.
|
|
453 |
*/
|
|
454 |
QList<VideoOperatorService *> mVideoOperatorServices;
|
30
|
455 |
};
|
|
456 |
|
|
457 |
#endif // VIDEOLISTVIEW_H
|