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