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: Videolist view class source code
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
58
|
18 |
// Version : %version: 113.1.8 %
|
36
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <qactiongroup.h>
|
30
|
22 |
#include <hbinstance.h>
|
|
23 |
#include <hbmainwindow.h>
|
|
24 |
#include <hbmessagebox.h>
|
|
25 |
#include <hbstackedwidget.h>
|
|
26 |
#include <hbstackedlayout.h>
|
|
27 |
#include <hblistwidget.h>
|
|
28 |
#include <hbtoolbar.h>
|
|
29 |
#include <hbaction.h>
|
|
30 |
#include <hbmenu.h>
|
|
31 |
#include <hbgroupbox.h>
|
|
32 |
#include <hbpushbutton.h>
|
34
|
33 |
#include <hbinputdialog.h>
|
44
|
34 |
#include <hbparameterlengthlimiter.h>
|
|
35 |
#include <hbtoolbarextension.h>
|
34
|
36 |
#include <vcxmyvideosdefs.h>
|
30
|
37 |
|
|
38 |
#include "videoservices.h"
|
|
39 |
#include "videolistselectiondialog.h"
|
|
40 |
#include "videocollectionviewutils.h"
|
|
41 |
#include "videolistwidget.h"
|
|
42 |
#include "videohintwidget.h"
|
|
43 |
#include "videolistview.h"
|
|
44 |
#include "videocollectioncommon.h"
|
|
45 |
#include "videocollectionwrapper.h"
|
58
|
46 |
#include "videoproxymodelgeneric.h"
|
30
|
47 |
#include "videocollectionuiloader.h"
|
35
|
48 |
#include "mpxhbvideocommondefs.h"
|
44
|
49 |
#include "videooperatorservice.h"
|
|
50 |
#include "videocollectioncenrepdefs.h"
|
36
|
51 |
#include "videocollectiontrace.h"
|
30
|
52 |
|
38
|
53 |
// Object names.
|
|
54 |
const char* const LIST_VIEW_OBJECT_NAME_OPTIONS_MENU = "vc::ListViewOptionsMenu";
|
44
|
55 |
const char* const LIST_VIEW_OBJECT_NAME_TOOLBAR_EXTENSION = "vc::ListViewToolbarExtension";
|
38
|
56 |
|
30
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
// Constructor
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
36
|
61 |
VideoListView::VideoListView( VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent )
|
|
62 |
: HbView( parent )
|
|
63 |
, mUiUtils( VideoCollectionViewUtils::instance() )
|
|
64 |
, mWrapper( VideoCollectionWrapper::instance() )
|
|
65 |
, mUiLoader( uiLoader )
|
|
66 |
, mModelReady( false )
|
38
|
67 |
, mViewReady( false )
|
36
|
68 |
, mHintLevel( VideoHintWidget::AllVideos )
|
|
69 |
, mVideoServices( 0 )
|
|
70 |
, mCurrentList( 0 )
|
|
71 |
, mToolbarViewsActionGroup( 0 )
|
|
72 |
, mToolbarCollectionActionGroup( 0 )
|
44
|
73 |
, mToolbarServiceExtension( 0 )
|
30
|
74 |
{
|
36
|
75 |
FUNC_LOG;
|
30
|
76 |
}
|
|
77 |
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
// Destructor
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
VideoListView::~VideoListView()
|
|
83 |
{
|
36
|
84 |
FUNC_LOG;
|
34
|
85 |
|
35
|
86 |
toolBar()->clearActions();
|
|
87 |
|
30
|
88 |
mToolbarActions.clear();
|
|
89 |
mSortingRoles.clear();
|
|
90 |
|
44
|
91 |
delete mToolbarServiceExtension;
|
|
92 |
mToolbarServiceExtension = 0;
|
|
93 |
|
30
|
94 |
if(mVideoServices)
|
|
95 |
{
|
|
96 |
mVideoServices->decreaseReferenceCount();
|
|
97 |
mVideoServices = 0;
|
|
98 |
}
|
44
|
99 |
|
|
100 |
QList<VideoOperatorService *>::const_iterator iter = mVideoOperatorServices.constBegin();
|
|
101 |
while(iter != mVideoOperatorServices.constEnd())
|
|
102 |
{
|
|
103 |
delete *iter;
|
|
104 |
iter++;
|
|
105 |
}
|
|
106 |
mVideoOperatorServices.clear();
|
30
|
107 |
}
|
|
108 |
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
// initializeView()
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
int VideoListView::initializeView()
|
|
114 |
{
|
36
|
115 |
FUNC_LOG;
|
30
|
116 |
if(!mUiLoader)
|
|
117 |
{
|
34
|
118 |
cleanup();
|
30
|
119 |
return -1;
|
|
120 |
}
|
41
|
121 |
int videoListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary;
|
|
122 |
int collectionListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
|
|
123 |
int collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
|
|
124 |
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos;
|
58
|
125 |
if (mUiUtils.isService())
|
30
|
126 |
{
|
41
|
127 |
INFO("VideoListView::initializeView() initializing service.");
|
30
|
128 |
if (!mVideoServices)
|
|
129 |
{
|
41
|
130 |
mVideoServices = VideoServices::instance();
|
|
131 |
connect(mVideoServices, SIGNAL(titleReady(const QString&)),
|
|
132 |
this, SLOT(titleReadySlot(const QString&)));
|
30
|
133 |
}
|
41
|
134 |
|
30
|
135 |
}
|
41
|
136 |
else
|
39
|
137 |
{
|
41
|
138 |
if(mVideoServices)
|
|
139 |
{
|
|
140 |
disconnect(mVideoServices, SIGNAL(titleReady(const QString&)),
|
|
141 |
this, SLOT(titleReadySlot(const QString&)));
|
|
142 |
mVideoServices->decreaseReferenceCount();
|
|
143 |
mVideoServices = 0;
|
|
144 |
}
|
|
145 |
VideoCollectionViewUtils::getActivityWidgetLevel(level);
|
|
146 |
if(level == VideoCollectionCommon::ELevelCategory)
|
|
147 |
{
|
|
148 |
videoListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
|
|
149 |
collectionListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary;
|
|
150 |
collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
|
|
151 |
}
|
|
152 |
else if(level == VideoCollectionCommon::ELevelDefaultColl ||
|
|
153 |
level == VideoCollectionCommon::ELevelAlbum)
|
|
154 |
{
|
|
155 |
videoListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
|
|
156 |
collectionListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary;
|
|
157 |
collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhasePrimary;
|
|
158 |
}
|
39
|
159 |
}
|
36
|
160 |
// start loading objects and widgets
|
41
|
161 |
QList<VideoCollectionUiLoaderParam> params;
|
|
162 |
|
36
|
163 |
params.append(VideoCollectionUiLoaderParam(
|
41
|
164 |
DOCML_NAME_VC_VIDEOLISTWIDGET,
|
|
165 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
49
|
166 |
DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST,
|
41
|
167 |
true,
|
|
168 |
videoListPhase));
|
|
169 |
|
39
|
170 |
params.append(VideoCollectionUiLoaderParam(
|
41
|
171 |
DOCML_NAME_VC_COLLECTIONWIDGET,
|
|
172 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
173 |
DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST,
|
|
174 |
true,
|
|
175 |
collectionListPhase));
|
|
176 |
|
|
177 |
params.append(VideoCollectionUiLoaderParam(
|
|
178 |
DOCML_NAME_VC_COLLECTIONCONTENTWIDGET,
|
|
179 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
180 |
DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST,
|
|
181 |
true,
|
|
182 |
collectionContentListPhase));
|
|
183 |
|
36
|
184 |
params.append(VideoCollectionUiLoaderParam(
|
|
185 |
DOCML_NAME_OPTIONS_MENU,
|
|
186 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
187 |
true,
|
|
188 |
VideoCollectionUiLoaderParam::LoadPhasePrimary));
|
|
189 |
params.append(VideoCollectionUiLoaderParam(
|
|
190 |
DOCML_NAME_ADD_TO_COLLECTION,
|
|
191 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
192 |
false,
|
|
193 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
194 |
params.append(VideoCollectionUiLoaderParam(
|
|
195 |
DOCML_NAME_CREATE_COLLECTION,
|
|
196 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
197 |
false,
|
|
198 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
199 |
params.append(VideoCollectionUiLoaderParam(
|
|
200 |
DOCML_NAME_DELETE_MULTIPLE,
|
|
201 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
202 |
false,
|
|
203 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
204 |
params.append(VideoCollectionUiLoaderParam(
|
|
205 |
DOCML_NAME_VC_HEADINGBANNER,
|
|
206 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
207 |
true,
|
|
208 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
209 |
params.append(VideoCollectionUiLoaderParam(
|
|
210 |
DOCML_NAME_SORT_MENU,
|
|
211 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
212 |
true,
|
|
213 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
214 |
params.append(VideoCollectionUiLoaderParam(
|
|
215 |
DOCML_NAME_SORT_BY_DATE,
|
|
216 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
217 |
false,
|
|
218 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
219 |
params.append(VideoCollectionUiLoaderParam(
|
|
220 |
DOCML_NAME_SORT_BY_NAME,
|
|
221 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
222 |
false,
|
|
223 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
224 |
params.append(VideoCollectionUiLoaderParam(
|
|
225 |
DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS,
|
|
226 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
227 |
false,
|
|
228 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
229 |
params.append(VideoCollectionUiLoaderParam(
|
|
230 |
DOCML_NAME_SORT_BY_SIZE,
|
|
231 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
232 |
false,
|
41
|
233 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
36
|
234 |
params.append(VideoCollectionUiLoaderParam(
|
|
235 |
DOCML_NAME_DIALOG,
|
|
236 |
DOCML_VIDEOSELECTIONDIALOG_FILE,
|
|
237 |
true,
|
|
238 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
239 |
params.append(VideoCollectionUiLoaderParam(
|
|
240 |
DOCML_NAME_VC_VIDEOHINTWIDGET,
|
|
241 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
242 |
DOCML_VIDEOCOLLECTIONVIEW_SECTION_HINT,
|
|
243 |
true,
|
|
244 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
245 |
params.append(VideoCollectionUiLoaderParam(
|
|
246 |
DOCML_NAME_HINT_BUTTON,
|
|
247 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
248 |
DOCML_VIDEOCOLLECTIONVIEW_SECTION_HINT,
|
|
249 |
true,
|
|
250 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
251 |
params.append(VideoCollectionUiLoaderParam(
|
|
252 |
DOCML_NAME_NO_VIDEOS_LABEL,
|
|
253 |
DOCML_VIDEOCOLLECTIONVIEW_FILE,
|
|
254 |
DOCML_VIDEOCOLLECTIONVIEW_SECTION_HINT,
|
|
255 |
true,
|
|
256 |
VideoCollectionUiLoaderParam::LoadPhaseSecondary));
|
|
257 |
mUiLoader->addData(params,
|
|
258 |
this,
|
|
259 |
SLOT(objectReadySlot(QObject*, const QString&)));
|
|
260 |
mUiLoader->loadPhase(VideoCollectionUiLoaderParam::LoadPhasePrimary);
|
|
261 |
params.clear();
|
34
|
262 |
|
41
|
263 |
// fetch current list right away for main views
|
|
264 |
// for default and user defined collections, currentList
|
|
265 |
// will be setted during activation
|
39
|
266 |
if(videoListPhase == VideoCollectionUiLoaderParam::LoadPhasePrimary)
|
|
267 |
{
|
|
268 |
mCurrentList = mUiLoader->findWidget<VideoListWidget>(
|
41
|
269 |
DOCML_NAME_VC_VIDEOLISTWIDGET );
|
39
|
270 |
}
|
41
|
271 |
else
|
39
|
272 |
{
|
|
273 |
mCurrentList = mUiLoader->findWidget<VideoListWidget>(
|
41
|
274 |
DOCML_NAME_VC_COLLECTIONWIDGET );
|
39
|
275 |
}
|
41
|
276 |
|
30
|
277 |
return 0;
|
|
278 |
}
|
|
279 |
|
|
280 |
// ---------------------------------------------------------------------------
|
|
281 |
// titleReadySlot()
|
|
282 |
// ---------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
void VideoListView::titleReadySlot(const QString& title)
|
|
285 |
{
|
36
|
286 |
FUNC_LOG;
|
30
|
287 |
setTitle(title);
|
|
288 |
}
|
|
289 |
|
|
290 |
// ---------------------------------------------------------------------------
|
|
291 |
// activateView()
|
|
292 |
// ---------------------------------------------------------------------------
|
|
293 |
//
|
41
|
294 |
int VideoListView::activateView( TMPXItemId &itemId)
|
30
|
295 |
{
|
36
|
296 |
FUNC_LOG;
|
|
297 |
|
41
|
298 |
int err = -1;
|
|
299 |
|
36
|
300 |
// activate collection to correct view
|
|
301 |
if (itemId == TMPXItemId::InvalidId())
|
41
|
302 |
{
|
|
303 |
|
|
304 |
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos;
|
|
305 |
if(!mVideoServices)
|
|
306 |
{
|
|
307 |
VideoCollectionViewUtils::getActivityWidgetLevel(level);
|
|
308 |
}
|
|
309 |
if(level == VideoCollectionCommon::ELevelCategory ||
|
|
310 |
level == VideoCollectionCommon::ELevelVideos)
|
|
311 |
{
|
|
312 |
err = activateMainView();
|
|
313 |
}
|
|
314 |
else if(level == VideoCollectionCommon::ELevelDefaultColl ||
|
|
315 |
level == VideoCollectionCommon::ELevelAlbum)
|
|
316 |
{
|
|
317 |
// level is default or user defined collection
|
|
318 |
// see if we have item id
|
|
319 |
VideoCollectionViewUtils::getCollectionActivityData(itemId, mCollectionName);
|
|
320 |
}
|
34
|
321 |
}
|
41
|
322 |
if(itemId != TMPXItemId::InvalidId())
|
34
|
323 |
{
|
36
|
324 |
err = activateCollectionContentView(itemId);
|
30
|
325 |
}
|
34
|
326 |
|
41
|
327 |
if(!err)
|
|
328 |
{
|
|
329 |
|
|
330 |
err = createToolbar();
|
|
331 |
}
|
|
332 |
|
36
|
333 |
// connect signals if everything went ok
|
41
|
334 |
if (!err)
|
35
|
335 |
{
|
36
|
336 |
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
|
|
337 |
mainWnd->setOrientation(Qt::Vertical, false);
|
|
338 |
if (!connect(
|
|
339 |
mainWnd, SIGNAL(aboutToChangeOrientation()),
|
|
340 |
this, SLOT( aboutToChangeOrientationSlot())) ||
|
|
341 |
!connect(
|
|
342 |
mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
|
|
343 |
this, SLOT(orientationChangedSlot(Qt::Orientation))) ||
|
|
344 |
!connect(
|
|
345 |
&mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
|
|
346 |
this, SLOT(handleAsyncStatusSlot(int, QVariant&))) ||
|
|
347 |
!connect(
|
40
|
348 |
mCurrentList->getModel()->sourceModel(), SIGNAL(modelChanged()),
|
36
|
349 |
this, SLOT(layoutChangedSlot())) ||
|
|
350 |
!connect(
|
40
|
351 |
mCurrentList->getModel()->sourceModel(), SIGNAL(modelReady()),
|
50
|
352 |
this, SLOT(modelReadySlot())) ||
|
|
353 |
!connect(
|
|
354 |
mCurrentList->getModel()->sourceModel(), SIGNAL(albumListReady()),
|
|
355 |
this, SLOT(albumListReadySlot())))
|
36
|
356 |
{
|
|
357 |
ERROR(-1, "VideoListView::activateView() failed to connect signals.");
|
|
358 |
// deactivate view so we get rid of dangling connections.
|
|
359 |
deactivateView();
|
|
360 |
err = -1;
|
|
361 |
}
|
35
|
362 |
}
|
41
|
363 |
else
|
|
364 |
{
|
|
365 |
deactivateView();
|
|
366 |
}
|
36
|
367 |
|
|
368 |
return err;
|
35
|
369 |
}
|
|
370 |
|
|
371 |
// ---------------------------------------------------------------------------
|
|
372 |
// doDelayedsSlot
|
|
373 |
// ---------------------------------------------------------------------------
|
|
374 |
//
|
|
375 |
void VideoListView::doDelayedsSlot()
|
|
376 |
{
|
36
|
377 |
FUNC_LOG;
|
|
378 |
mUiLoader->loadPhase(VideoCollectionUiLoaderParam::LoadPhaseSecondary);
|
39
|
379 |
if(mCurrentList)
|
|
380 |
{
|
|
381 |
mCurrentList->doDelayedsSlot();
|
|
382 |
}
|
35
|
383 |
}
|
|
384 |
|
30
|
385 |
// ---------------------------------------------------------------------------
|
|
386 |
// modelReadySlot
|
|
387 |
// ---------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
void VideoListView::modelReadySlot()
|
|
390 |
{
|
36
|
391 |
FUNC_LOG;
|
37
|
392 |
|
50
|
393 |
// check that current list is all videos or collection content.
|
|
394 |
VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel();
|
|
395 |
if(level != VideoCollectionCommon::ELevelCategory)
|
37
|
396 |
{
|
50
|
397 |
modelReady();
|
37
|
398 |
}
|
50
|
399 |
}
|
|
400 |
|
|
401 |
// ---------------------------------------------------------------------------
|
|
402 |
// albumListReadySlot
|
|
403 |
// ---------------------------------------------------------------------------
|
|
404 |
//
|
|
405 |
void VideoListView::albumListReadySlot()
|
|
406 |
{
|
|
407 |
FUNC_LOG;
|
34
|
408 |
|
50
|
409 |
// check that current list is category list.
|
|
410 |
VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel();
|
|
411 |
if(level == VideoCollectionCommon::ELevelCategory)
|
|
412 |
{
|
|
413 |
modelReady();
|
|
414 |
}
|
30
|
415 |
}
|
|
416 |
|
|
417 |
// ---------------------------------------------------------------------------
|
|
418 |
// layoutChangedSlot
|
|
419 |
// ---------------------------------------------------------------------------
|
|
420 |
//
|
|
421 |
void VideoListView::layoutChangedSlot()
|
|
422 |
{
|
36
|
423 |
FUNC_LOG;
|
38
|
424 |
// Note that showHint should be executed before updateSubLabel as it
|
|
425 |
// can modify the mModelReady flag.
|
|
426 |
showHint();
|
30
|
427 |
updateSubLabel();
|
|
428 |
}
|
|
429 |
|
|
430 |
// ---------------------------------------------------------------------------
|
|
431 |
// deactivateView()
|
|
432 |
// ---------------------------------------------------------------------------
|
|
433 |
//
|
|
434 |
void VideoListView::deactivateView()
|
|
435 |
{
|
36
|
436 |
FUNC_LOG;
|
30
|
437 |
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
|
34
|
438 |
|
|
439 |
mainWnd->unsetOrientation();
|
|
440 |
|
30
|
441 |
disconnect(mainWnd, SIGNAL(aboutToChangeOrientation()),
|
|
442 |
this, SLOT(aboutToChangeOrientationSlot()));
|
|
443 |
|
|
444 |
disconnect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
|
|
445 |
this, SLOT(orientationChangedSlot(Qt::Orientation)));
|
|
446 |
|
34
|
447 |
disconnect(&mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
|
30
|
448 |
this, SLOT(handleAsyncStatusSlot(int, QVariant&)));
|
34
|
449 |
|
|
450 |
HbMenu *menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
|
38
|
451 |
if(menu)
|
34
|
452 |
{
|
38
|
453 |
menu->setObjectName(LIST_VIEW_OBJECT_NAME_OPTIONS_MENU);
|
34
|
454 |
menu->hide();
|
|
455 |
}
|
40
|
456 |
|
|
457 |
if(mCurrentList && mCurrentList->getModel() && mCurrentList->getModel()->sourceModel())
|
34
|
458 |
{
|
40
|
459 |
disconnect(mCurrentList->getModel()->sourceModel(),
|
34
|
460 |
SIGNAL(modelChanged()),
|
|
461 |
this, SLOT(layoutChangedSlot()));
|
40
|
462 |
disconnect(mCurrentList->getModel()->sourceModel(),
|
34
|
463 |
SIGNAL(modelReady()),
|
|
464 |
this, SLOT(modelReadySlot()));
|
30
|
465 |
|
34
|
466 |
showHint(false);
|
41
|
467 |
if(!mVideoServices)
|
|
468 |
{
|
|
469 |
VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel();
|
|
470 |
VideoCollectionViewUtils::setWidgetActivityLevel(level);
|
|
471 |
}
|
34
|
472 |
mCurrentList->deactivate();
|
30
|
473 |
}
|
|
474 |
}
|
|
475 |
|
|
476 |
// ---------------------------------------------------------------------------
|
|
477 |
// back()
|
|
478 |
// ---------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
void VideoListView::back()
|
|
481 |
{
|
36
|
482 |
FUNC_LOG;
|
30
|
483 |
}
|
|
484 |
|
|
485 |
// ---------------------------------------------------------------------------
|
50
|
486 |
// modelReady()
|
|
487 |
// ---------------------------------------------------------------------------
|
|
488 |
//
|
|
489 |
void VideoListView::modelReady()
|
|
490 |
{
|
|
491 |
FUNC_LOG;
|
|
492 |
|
|
493 |
// if mViewReady is false, then it means that this is the first time
|
|
494 |
// modelReady or albumListReady signal fires. Signaling that view is ready.
|
|
495 |
if(!mViewReady)
|
|
496 |
{
|
|
497 |
mViewReady = true;
|
|
498 |
emit viewReady();
|
|
499 |
}
|
|
500 |
|
|
501 |
mModelReady = true;
|
|
502 |
|
|
503 |
// since the reset signal arrives after
|
|
504 |
// layout changed, need to make sure that
|
|
505 |
// view is updated in case needed
|
|
506 |
layoutChangedSlot();
|
|
507 |
}
|
|
508 |
|
|
509 |
// ---------------------------------------------------------------------------
|
30
|
510 |
// cleanup()
|
|
511 |
// ---------------------------------------------------------------------------
|
|
512 |
//
|
|
513 |
void VideoListView::cleanup()
|
|
514 |
{
|
36
|
515 |
FUNC_LOG;
|
30
|
516 |
delete mToolbarViewsActionGroup;
|
|
517 |
mToolbarViewsActionGroup = 0;
|
|
518 |
|
|
519 |
delete mToolbarCollectionActionGroup;
|
|
520 |
mToolbarCollectionActionGroup = 0;
|
|
521 |
|
34
|
522 |
mCurrentList = 0;
|
30
|
523 |
}
|
|
524 |
|
|
525 |
// ---------------------------------------------------------------------------
|
|
526 |
// createToolbar()
|
|
527 |
// Creates toolbar, toolbar actions and toolbar icons
|
|
528 |
// ---------------------------------------------------------------------------
|
|
529 |
//
|
|
530 |
int VideoListView::createToolbar()
|
|
531 |
{
|
36
|
532 |
FUNC_LOG;
|
38
|
533 |
|
|
534 |
// Create actiongroup and add all actions to it. This ensures that only one is
|
30
|
535 |
// active at certain moment.
|
|
536 |
if(!mToolbarViewsActionGroup && !mToolbarCollectionActionGroup)
|
|
537 |
{
|
|
538 |
mToolbarViewsActionGroup = new QActionGroup(this);
|
|
539 |
mToolbarCollectionActionGroup = new QActionGroup(this);
|
|
540 |
|
|
541 |
// create toolbar item actions
|
|
542 |
|
|
543 |
// All Videos tab
|
38
|
544 |
mToolbarActions[ETBActionAllVideos] = createAction("qtg_mono_video",
|
30
|
545 |
mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot()));
|
|
546 |
|
|
547 |
// Collections tab
|
35
|
548 |
mToolbarActions[ETBActionCollections] = createAction("qtg_mono_video_collection",
|
30
|
549 |
mToolbarViewsActionGroup, SLOT(openCollectionViewSlot()));
|
|
550 |
|
41
|
551 |
if (!mVideoServices)
|
30
|
552 |
{
|
44
|
553 |
// Create services button or toolbar extension depending how many operator
|
|
554 |
// services are configured.
|
|
555 |
createOperatorServicesToolbar();
|
|
556 |
|
30
|
557 |
// Add Videos tab
|
35
|
558 |
mToolbarActions[ETBActionAddVideos] =
|
|
559 |
createAction("qtg_mono_add_to_video_collection",
|
30
|
560 |
mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot()));
|
|
561 |
|
|
562 |
// Remove Videos tab
|
35
|
563 |
mToolbarActions[ETBActionRemoveVideos] =
|
36
|
564 |
createAction("qtg_mono_remove_from_video_collection",
|
35
|
565 |
mToolbarCollectionActionGroup, SLOT(removeVideosFromCollectionSlot()));
|
30
|
566 |
}
|
|
567 |
|
|
568 |
HbToolBar *bar = toolBar(); // First call to toolBar() creates the object, so on failure it could return 0.
|
|
569 |
|
|
570 |
if( !bar
|
|
571 |
|| !mToolbarActions[ETBActionAllVideos]
|
|
572 |
|| !mToolbarActions[ETBActionCollections]
|
44
|
573 |
|| ( !mVideoServices && (!mToolbarActions[ETBActionAddVideos]
|
|
574 |
|| !mToolbarActions[ETBActionRemoveVideos])))
|
30
|
575 |
{
|
36
|
576 |
ERROR(-1, "VideoListView::createToolbar() failed to create all actions or the toolbar.");
|
30
|
577 |
delete mToolbarActions[ETBActionAllVideos];
|
|
578 |
delete mToolbarActions[ETBActionCollections];
|
|
579 |
delete mToolbarActions[ETBActionAddVideos];
|
|
580 |
delete mToolbarActions[ETBActionRemoveVideos];
|
|
581 |
return -1;
|
|
582 |
}
|
|
583 |
|
|
584 |
// Collection view actions are not checkable
|
|
585 |
mToolbarActions[ETBActionAllVideos]->setCheckable(true);
|
|
586 |
mToolbarActions[ETBActionCollections]->setCheckable(true);
|
|
587 |
|
44
|
588 |
if(!mVideoServices && mToolbarActions[ETBActionServices])
|
30
|
589 |
{
|
35
|
590 |
mToolbarActions[ETBActionServices]->setCheckable(false);
|
30
|
591 |
}
|
41
|
592 |
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos;
|
|
593 |
if(mCurrentList)
|
|
594 |
{
|
|
595 |
level = mCurrentList->getLevel();
|
|
596 |
}
|
|
597 |
if(level == VideoCollectionCommon::ELevelCategory)
|
39
|
598 |
{
|
|
599 |
mToolbarActions[ETBActionCollections]->setChecked(true);
|
41
|
600 |
bar->addActions(mToolbarViewsActionGroup->actions());
|
39
|
601 |
}
|
41
|
602 |
else if(level == VideoCollectionCommon::ELevelVideos )
|
39
|
603 |
{
|
|
604 |
mToolbarActions[ETBActionAllVideos]->setChecked(true);
|
41
|
605 |
bar->addActions(mToolbarViewsActionGroup->actions());
|
39
|
606 |
}
|
41
|
607 |
else if(level == VideoCollectionCommon::ELevelAlbum)
|
|
608 |
{
|
|
609 |
bar->addActions(mToolbarCollectionActionGroup->actions());
|
58
|
610 |
if(!mModelReady)
|
|
611 |
{
|
|
612 |
// if model not ready yet toolbuttons should not be
|
|
613 |
// visible, after model responds visibility will be updated
|
|
614 |
mToolbarActions[ETBActionAddVideos]->setVisible(false);
|
|
615 |
mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
|
|
616 |
}
|
41
|
617 |
}
|
44
|
618 |
|
|
619 |
if(mToolbarServiceExtension && (level == VideoCollectionCommon::ELevelCategory
|
|
620 |
|| level == VideoCollectionCommon::ELevelVideos))
|
|
621 |
{
|
|
622 |
HbAction *action = bar->addExtension(mToolbarServiceExtension);
|
|
623 |
HbIcon icon("qtg_mono_video_services");
|
|
624 |
action->setIcon(icon);
|
|
625 |
}
|
30
|
626 |
}
|
|
627 |
|
|
628 |
return 0;
|
|
629 |
}
|
|
630 |
|
|
631 |
// ---------------------------------------------------------------------------
|
44
|
632 |
// createOperatorServicesToolbar()
|
|
633 |
// ---------------------------------------------------------------------------
|
|
634 |
//
|
|
635 |
void VideoListView::createOperatorServicesToolbar()
|
|
636 |
{
|
|
637 |
FUNC_LOG;
|
|
638 |
if(mVideoOperatorServices.count() > 0)
|
|
639 |
{
|
|
640 |
return;
|
|
641 |
}
|
|
642 |
|
|
643 |
// Load services.
|
|
644 |
|
|
645 |
loadOperatorService(KVideoCollectionViewCenrepServiceItem1Title, KVideoCollectionViewCenrepServiceItem1ToolbarIconPath,
|
|
646 |
KVideoCollectionViewCenrepServiceItem1Url, KVideoCollectionViewCenrepServiceItem1Uid);
|
|
647 |
|
|
648 |
loadOperatorService(KVideoCollectionViewCenrepServiceItem2Title, KVideoCollectionViewCenrepServiceItem2ToolbarIconPath,
|
|
649 |
KVideoCollectionViewCenrepServiceItem2Url, KVideoCollectionViewCenrepServiceItem2Uid);
|
|
650 |
|
|
651 |
loadOperatorService(KVideoCollectionViewCenrepServiceItem3Title, KVideoCollectionViewCenrepServiceItem3ToolbarIconPath,
|
|
652 |
KVideoCollectionViewCenrepServiceItem3Url, KVideoCollectionViewCenrepServiceItem3Uid);
|
|
653 |
|
|
654 |
loadOperatorService(KVideoCollectionViewCenrepServiceItem4Title, KVideoCollectionViewCenrepServiceItem4ToolbarIconPath,
|
|
655 |
KVideoCollectionViewCenrepServiceItem4Url, KVideoCollectionViewCenrepServiceItem4Uid);
|
|
656 |
|
|
657 |
loadOperatorService(KVideoCollectionViewCenrepServiceItem5Title, KVideoCollectionViewCenrepServiceItem5ToolbarIconPath,
|
|
658 |
KVideoCollectionViewCenrepServiceItem5Url, KVideoCollectionViewCenrepServiceItem5Uid);
|
|
659 |
|
|
660 |
loadOperatorService(KVideoCollectionViewCenrepServiceItem6Title, KVideoCollectionViewCenrepServiceItem6ToolbarIconPath,
|
|
661 |
KVideoCollectionViewCenrepServiceItem6Url, KVideoCollectionViewCenrepServiceItem6Uid);
|
|
662 |
|
|
663 |
// Create toolbar extension when there's multiple services.
|
|
664 |
if(mVideoOperatorServices.count() > 1 && !mToolbarServiceExtension)
|
|
665 |
{
|
|
666 |
mToolbarServiceExtension = new HbToolBarExtension();
|
|
667 |
mToolbarServiceExtension->setObjectName(LIST_VIEW_OBJECT_NAME_TOOLBAR_EXTENSION);
|
|
668 |
|
|
669 |
QList<VideoOperatorService *>::const_iterator iter = mVideoOperatorServices.constBegin();
|
|
670 |
while(iter != mVideoOperatorServices.constEnd())
|
|
671 |
{
|
|
672 |
HbIcon icon((*iter)->iconResource());
|
|
673 |
HbAction *action = mToolbarServiceExtension->addAction(icon, (*iter)->title(),
|
|
674 |
(*iter), SLOT(launchService()));
|
|
675 |
action->setObjectName((*iter)->title());
|
|
676 |
iter++;
|
|
677 |
}
|
|
678 |
}
|
|
679 |
|
|
680 |
// Add toolbar button when there's only one service.
|
|
681 |
if(mVideoOperatorServices.count() == 1)
|
|
682 |
{
|
|
683 |
VideoOperatorService *service = mVideoOperatorServices[0];
|
|
684 |
mToolbarActions[ETBActionServices] = createAction(service->iconResource(),
|
|
685 |
mToolbarViewsActionGroup, 0 /*do not connect to any slot*/);
|
|
686 |
connect(mToolbarActions[ETBActionServices], SIGNAL(triggered()), service, SLOT(launchService()));
|
|
687 |
}
|
|
688 |
}
|
|
689 |
|
|
690 |
// ---------------------------------------------------------------------------
|
|
691 |
// loadOperatorService()
|
|
692 |
// ---------------------------------------------------------------------------
|
|
693 |
//
|
|
694 |
void VideoListView::loadOperatorService(int titleKey, int iconKey, int uriKey, int uidKey)
|
|
695 |
{
|
|
696 |
FUNC_LOG;
|
|
697 |
VideoOperatorService *service = new VideoOperatorService();
|
|
698 |
if(service->load(titleKey, iconKey, uriKey, uidKey))
|
|
699 |
{
|
|
700 |
mVideoOperatorServices.append(service);
|
|
701 |
}
|
|
702 |
else
|
|
703 |
{
|
|
704 |
// Load failed, delete service data.
|
|
705 |
delete service;
|
|
706 |
}
|
|
707 |
}
|
|
708 |
|
|
709 |
// ---------------------------------------------------------------------------
|
30
|
710 |
// createAction()
|
|
711 |
// ---------------------------------------------------------------------------
|
|
712 |
//
|
34
|
713 |
HbAction* VideoListView::createAction(QString icon,
|
30
|
714 |
QActionGroup* actionGroup, const char *slot)
|
|
715 |
{
|
36
|
716 |
FUNC_LOG;
|
30
|
717 |
HbAction* action = new HbAction(actionGroup);
|
|
718 |
|
|
719 |
HbIcon hbIcon(icon);
|
|
720 |
action->setIcon(hbIcon);
|
|
721 |
|
44
|
722 |
if(slot)
|
|
723 |
{
|
|
724 |
if(!connect(action, SIGNAL(triggered()), this, slot)) {
|
|
725 |
// actiongroup deletion deletes this also.
|
|
726 |
// return 0 tells that there was a problem in creation to caller.
|
|
727 |
delete action;
|
|
728 |
return 0;
|
|
729 |
}
|
30
|
730 |
}
|
44
|
731 |
|
30
|
732 |
return action;
|
|
733 |
}
|
|
734 |
|
|
735 |
// ---------------------------------------------------------------------------
|
|
736 |
// showHint
|
|
737 |
// ---------------------------------------------------------------------------
|
|
738 |
//
|
|
739 |
void VideoListView::showHint(bool show)
|
|
740 |
{
|
36
|
741 |
FUNC_LOG;
|
34
|
742 |
if(!mCurrentList)
|
30
|
743 |
{
|
34
|
744 |
return;
|
30
|
745 |
}
|
34
|
746 |
|
58
|
747 |
VideoProxyModelGeneric *model = mCurrentList->getModel();
|
36
|
748 |
|
40
|
749 |
if(!model || (!mModelReady && model->rowCount() == 0))
|
38
|
750 |
{
|
|
751 |
return;
|
|
752 |
}
|
|
753 |
|
|
754 |
mModelReady = true;
|
|
755 |
|
|
756 |
// decide if the hintwidget needs to be shown or not.
|
40
|
757 |
show = show && model->rowCount() == 0;
|
38
|
758 |
|
|
759 |
// If show is false, then hint widget is fetched only if it exists. If
|
|
760 |
// show is true then hint widget is also created and prepared if it does not exists.
|
34
|
761 |
VideoHintWidget *hintWidget =
|
|
762 |
mUiLoader->findWidget<VideoHintWidget>(
|
38
|
763 |
DOCML_NAME_VC_VIDEOHINTWIDGET, show);
|
|
764 |
|
35
|
765 |
if (hintWidget)
|
|
766 |
{
|
|
767 |
hintWidget->setLevel(mHintLevel);
|
38
|
768 |
if (show)
|
36
|
769 |
{
|
38
|
770 |
hintWidget->activate();
|
36
|
771 |
bool showHintBtns = (mCurrentList->getLevel() != VideoCollectionCommon::ELevelDefaultColl);
|
|
772 |
hintWidget->setButtonShown(showHintBtns);
|
|
773 |
}
|
|
774 |
else
|
34
|
775 |
{
|
38
|
776 |
hintWidget->deactivate();
|
34
|
777 |
hintWidget->setButtonShown(true);
|
|
778 |
}
|
36
|
779 |
}
|
|
780 |
|
41
|
781 |
if (mToolbarViewsActionGroup && mToolbarCollectionActionGroup && !mVideoServices)
|
30
|
782 |
{
|
58
|
783 |
mToolbarActions[ETBActionAddVideos]->setVisible(true);
|
36
|
784 |
if (show)
|
|
785 |
{
|
37
|
786 |
mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
|
36
|
787 |
}
|
37
|
788 |
else if(mToolbarActions[ETBActionRemoveVideos]->isVisible() == false)
|
|
789 |
{
|
|
790 |
mToolbarActions[ETBActionRemoveVideos]->setVisible(true);
|
|
791 |
}
|
34
|
792 |
}
|
36
|
793 |
|
|
794 |
// prepare sublabel
|
|
795 |
HbGroupBox *subLabel =
|
|
796 |
mUiLoader->findWidget<HbGroupBox>(
|
|
797 |
DOCML_NAME_VC_HEADINGBANNER);
|
34
|
798 |
if (subLabel)
|
|
799 |
{
|
|
800 |
if (show &&
|
|
801 |
mCurrentList->getLevel() == VideoCollectionCommon::ELevelVideos)
|
30
|
802 |
{
|
34
|
803 |
subLabel->hide();
|
|
804 |
}
|
36
|
805 |
else
|
34
|
806 |
{
|
|
807 |
subLabel->show();
|
30
|
808 |
}
|
|
809 |
}
|
|
810 |
}
|
|
811 |
|
|
812 |
// ---------------------------------------------------------------------------
|
34
|
813 |
// setHintLevel
|
|
814 |
// ---------------------------------------------------------------------------
|
|
815 |
//
|
|
816 |
void VideoListView::setHintLevel(VideoHintWidget::HintLevel level)
|
|
817 |
{
|
36
|
818 |
FUNC_LOG;
|
35
|
819 |
mHintLevel = level;
|
34
|
820 |
}
|
|
821 |
|
|
822 |
// ---------------------------------------------------------------------------
|
30
|
823 |
// updateSubLabel
|
|
824 |
// ---------------------------------------------------------------------------
|
|
825 |
//
|
|
826 |
void VideoListView::updateSubLabel()
|
|
827 |
{
|
36
|
828 |
FUNC_LOG;
|
58
|
829 |
VideoProxyModelGeneric *model = 0;
|
34
|
830 |
if(mCurrentList)
|
|
831 |
{
|
40
|
832 |
model = mCurrentList->getModel();
|
34
|
833 |
}
|
|
834 |
|
38
|
835 |
if (model && mModelReady)
|
30
|
836 |
{
|
34
|
837 |
int itemCount = model->rowCount();
|
|
838 |
|
|
839 |
HbGroupBox *subLabel =
|
|
840 |
mUiLoader->findWidget<HbGroupBox>(
|
|
841 |
DOCML_NAME_VC_HEADINGBANNER);
|
35
|
842 |
|
36
|
843 |
if(subLabel && mCurrentList)
|
34
|
844 |
{
|
36
|
845 |
if (mCurrentList->getLevel() == VideoCollectionCommon::ELevelVideos)
|
35
|
846 |
{
|
36
|
847 |
// no need to update sublabel if there are no items in videolist
|
|
848 |
// hint widget is shown instead
|
|
849 |
if (itemCount)
|
|
850 |
{
|
|
851 |
subLabel->setHeading(hbTrId("txt_videos_subtitle_ln_videos", itemCount));
|
|
852 |
}
|
35
|
853 |
}
|
36
|
854 |
else if (mCurrentList->getLevel() == VideoCollectionCommon::ELevelCategory)
|
35
|
855 |
{
|
|
856 |
subLabel->setHeading(hbTrId("txt_videos_subtitle_ln_collections", itemCount));
|
|
857 |
}
|
36
|
858 |
else
|
35
|
859 |
{
|
44
|
860 |
QString text = HbParameterLengthLimiter(hbTrId("txt_videos_subtitle_1_l2")).arg(mCollectionName).arg(itemCount);
|
|
861 |
subLabel->setHeading(text);
|
35
|
862 |
}
|
34
|
863 |
}
|
|
864 |
}
|
|
865 |
}
|
30
|
866 |
|
34
|
867 |
// ---------------------------------------------------------------------------
|
|
868 |
// showAction()
|
|
869 |
// ---------------------------------------------------------------------------
|
|
870 |
//
|
|
871 |
void VideoListView::showAction(bool show, const QString &name)
|
|
872 |
{
|
36
|
873 |
FUNC_LOG;
|
34
|
874 |
HbAction *action = mUiLoader->findObject<HbAction>(name);
|
|
875 |
if (!action)
|
|
876 |
{
|
|
877 |
// must be menu widget
|
|
878 |
HbMenu *menu = mUiLoader->findWidget<HbMenu>(name);
|
|
879 |
if (menu)
|
30
|
880 |
{
|
34
|
881 |
action = menu->menuAction();
|
30
|
882 |
}
|
34
|
883 |
}
|
|
884 |
|
|
885 |
// hide or show action
|
|
886 |
if (action)
|
|
887 |
{
|
|
888 |
action->setVisible(show);
|
|
889 |
}
|
|
890 |
}
|
|
891 |
|
|
892 |
// ---------------------------------------------------------------------------
|
41
|
893 |
// activateMainView()
|
34
|
894 |
// ---------------------------------------------------------------------------
|
|
895 |
//
|
41
|
896 |
int VideoListView::activateMainView()
|
34
|
897 |
{
|
36
|
898 |
FUNC_LOG;
|
39
|
899 |
|
|
900 |
if(!mCurrentList)
|
|
901 |
{
|
|
902 |
return -1;
|
|
903 |
}
|
|
904 |
|
41
|
905 |
int result = mCurrentList->activate();
|
39
|
906 |
if(result < 0)
|
34
|
907 |
{
|
39
|
908 |
ERROR(result, "VideoListView::activateVideosView() failed to activate.");
|
|
909 |
return -1;
|
34
|
910 |
}
|
41
|
911 |
|
36
|
912 |
return 0;
|
34
|
913 |
}
|
|
914 |
|
|
915 |
// ---------------------------------------------------------------------------
|
36
|
916 |
// activateCollectionContentView()
|
34
|
917 |
// ---------------------------------------------------------------------------
|
|
918 |
//
|
36
|
919 |
int VideoListView::activateCollectionContentView(const TMPXItemId &itemId)
|
34
|
920 |
{
|
36
|
921 |
FUNC_LOG;
|
41
|
922 |
|
|
923 |
// resolve collection name if possible
|
|
924 |
if(itemId.iId2 == KVcxMvcMediaTypeCategory && mCollectionName.isEmpty())
|
34
|
925 |
{
|
41
|
926 |
if (itemId.iId1 == KVcxMvcCategoryIdDownloads)
|
|
927 |
{
|
|
928 |
mCollectionName = hbTrId("txt_videos_dblist_downloaded");
|
|
929 |
}
|
|
930 |
else if(itemId.iId1 == KVcxMvcCategoryIdCaptured)
|
|
931 |
{
|
|
932 |
mCollectionName = hbTrId("txt_videos_dblist_captured");
|
|
933 |
}
|
|
934 |
else
|
30
|
935 |
{
|
41
|
936 |
// only downloads and captured are supported in default collections
|
|
937 |
ERROR(-1, "VideoListView::activateVideosView() invalid defauld collection.");
|
|
938 |
return -1;
|
30
|
939 |
}
|
41
|
940 |
}
|
|
941 |
// at this point activation will fail if there's no collection name available
|
|
942 |
if(mCollectionName.isEmpty())
|
|
943 |
{
|
|
944 |
ERROR(-1, "VideoListView::activateVideosView() no collection name, cannot proceed.");
|
|
945 |
return -1;
|
36
|
946 |
}
|
41
|
947 |
|
|
948 |
// if current list at this point is already collection content,
|
|
949 |
// no need to init again, just activate
|
|
950 |
if(mCurrentList &&
|
|
951 |
(mCurrentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl ||
|
|
952 |
mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum))
|
36
|
953 |
{
|
41
|
954 |
|
|
955 |
return mCurrentList->activate();
|
|
956 |
}
|
|
957 |
// no currentlist, or currentlist differs, create and initialize all over
|
|
958 |
collectionOpenedSlot(true, mCollectionName, itemId);
|
|
959 |
|
|
960 |
if((!mCurrentList || !mCurrentList->getModel()) ||
|
|
961 |
(mCurrentList->getLevel() != VideoCollectionCommon::ELevelDefaultColl &&
|
|
962 |
mCurrentList->getLevel() != VideoCollectionCommon::ELevelAlbum ))
|
|
963 |
{
|
|
964 |
ERROR(-1, "VideoListView::activateVideosView() failed to init and activate collection.");
|
|
965 |
return -1;
|
30
|
966 |
}
|
34
|
967 |
|
41
|
968 |
// if we're servicing, need to fetch sorting role from client
|
|
969 |
// in normal use, sorting has set already at uiloader
|
|
970 |
|
|
971 |
if (mVideoServices)
|
|
972 |
{
|
|
973 |
// TODO: service sorting roles needs to be defined somewhere
|
|
974 |
int sortRole = mVideoServices->sortRole();
|
|
975 |
if(sortRole == 2)
|
|
976 |
{
|
|
977 |
sortRole = VideoCollectionCommon::KeyTitle;
|
|
978 |
}
|
|
979 |
else if(sortRole == 3)
|
|
980 |
{
|
|
981 |
sortRole = VideoCollectionCommon::KeySizeValue;
|
|
982 |
}
|
|
983 |
else
|
|
984 |
{
|
|
985 |
// default
|
|
986 |
sortRole = VideoCollectionCommon::KeyDateTime;
|
|
987 |
}
|
|
988 |
mCurrentList->getModel()->doSorting(sortRole, Qt::AscendingOrder);
|
|
989 |
}
|
|
990 |
|
|
991 |
return 0;
|
30
|
992 |
}
|
|
993 |
|
|
994 |
// ---------------------------------------------------------------------------
|
|
995 |
// openAllVideosViewSlot()
|
|
996 |
// ---------------------------------------------------------------------------
|
|
997 |
//
|
|
998 |
void VideoListView::openAllVideosViewSlot()
|
|
999 |
{
|
36
|
1000 |
FUNC_LOG;
|
34
|
1001 |
VideoListWidget *videoListWidget =
|
|
1002 |
mUiLoader->findWidget<VideoListWidget>(
|
|
1003 |
DOCML_NAME_VC_VIDEOLISTWIDGET);
|
35
|
1004 |
|
34
|
1005 |
if (mCurrentList &&
|
|
1006 |
videoListWidget &&
|
|
1007 |
mCurrentList != videoListWidget)
|
|
1008 |
{
|
|
1009 |
// deactivate old list
|
|
1010 |
mCurrentList->deactivate();
|
|
1011 |
|
|
1012 |
// activate all videos list
|
|
1013 |
mCurrentList = videoListWidget;
|
|
1014 |
mCurrentList->activate(VideoCollectionCommon::ELevelVideos);
|
|
1015 |
|
|
1016 |
setHintLevel(VideoHintWidget::AllVideos);
|
38
|
1017 |
|
|
1018 |
// update the sublabel, as in most cases the data is already up to date.
|
|
1019 |
updateSubLabel();
|
34
|
1020 |
}
|
30
|
1021 |
}
|
|
1022 |
|
|
1023 |
// ---------------------------------------------------------------------------
|
|
1024 |
// openCollectionViewSlot()
|
|
1025 |
// ---------------------------------------------------------------------------
|
|
1026 |
//
|
|
1027 |
void VideoListView::openCollectionViewSlot()
|
|
1028 |
{
|
36
|
1029 |
FUNC_LOG;
|
34
|
1030 |
VideoListWidget *collectionWidget =
|
|
1031 |
mUiLoader->findWidget<VideoListWidget>(
|
|
1032 |
DOCML_NAME_VC_COLLECTIONWIDGET);
|
35
|
1033 |
|
34
|
1034 |
if (mCurrentList &&
|
|
1035 |
mCurrentList != collectionWidget)
|
|
1036 |
{
|
|
1037 |
// deactivate all videos widget
|
|
1038 |
mCurrentList->deactivate();
|
|
1039 |
|
|
1040 |
// activate video collection widget
|
|
1041 |
mCurrentList = collectionWidget;
|
39
|
1042 |
mCurrentList->activate(VideoCollectionCommon::ELevelCategory);
|
36
|
1043 |
|
38
|
1044 |
// the collection view is not empty, so we should hide the hint in advance.
|
34
|
1045 |
showHint(false);
|
38
|
1046 |
|
|
1047 |
// also update the sublabel immediatelly, as the data is up to date almost always.
|
|
1048 |
updateSubLabel();
|
34
|
1049 |
}
|
|
1050 |
}
|
|
1051 |
|
|
1052 |
// ---------------------------------------------------------------------------
|
44
|
1053 |
// openOperatorServiceSlot()
|
30
|
1054 |
// ---------------------------------------------------------------------------
|
|
1055 |
//
|
44
|
1056 |
void VideoListView::openOperatorServiceSlot()
|
30
|
1057 |
{
|
36
|
1058 |
FUNC_LOG;
|
44
|
1059 |
|
|
1060 |
if(mVideoOperatorServices.count() > 0)
|
|
1061 |
{
|
|
1062 |
mVideoOperatorServices[0]->launchService();
|
|
1063 |
}
|
30
|
1064 |
}
|
|
1065 |
|
|
1066 |
// ---------------------------------------------------------------------------
|
|
1067 |
// startSorting()
|
|
1068 |
// ---------------------------------------------------------------------------
|
|
1069 |
//
|
|
1070 |
void VideoListView::startSorting()
|
|
1071 |
{
|
36
|
1072 |
FUNC_LOG;
|
34
|
1073 |
HbMenu *optionsMenu =
|
|
1074 |
mUiLoader->findWidget<HbMenu>(
|
|
1075 |
DOCML_NAME_OPTIONS_MENU);
|
36
|
1076 |
if (optionsMenu && mCurrentList)
|
30
|
1077 |
{
|
34
|
1078 |
// get sorting role from active action
|
36
|
1079 |
HbAction* action = optionsMenu->activeAction();
|
|
1080 |
HbMenu* sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
|
|
1081 |
if(action == sortMenu->menuAction()) // make sure that active action is the sort menu.
|
|
1082 |
{
|
|
1083 |
HbAction* action = sortMenu->activeAction();
|
|
1084 |
if(action)
|
|
1085 |
{
|
|
1086 |
doSorting(mSortingRoles[action]);
|
|
1087 |
}
|
|
1088 |
}
|
35
|
1089 |
}
|
|
1090 |
}
|
30
|
1091 |
|
35
|
1092 |
// ---------------------------------------------------------------------------
|
|
1093 |
// doSorting()
|
|
1094 |
// ---------------------------------------------------------------------------
|
|
1095 |
//
|
|
1096 |
void VideoListView::doSorting(int role)
|
|
1097 |
{
|
36
|
1098 |
FUNC_LOG;
|
40
|
1099 |
if(!mCurrentList || !mCurrentList->getModel())
|
|
1100 |
{
|
|
1101 |
// no list or model, cannot sort
|
|
1102 |
return;
|
|
1103 |
}
|
35
|
1104 |
// sort model
|
|
1105 |
Qt::SortOrder order(Qt::AscendingOrder);
|
58
|
1106 |
VideoProxyModelGeneric *model = mCurrentList->getModel();
|
40
|
1107 |
if(model->sortRole() == role && model->sortOrder() == Qt::AscendingOrder)
|
35
|
1108 |
{
|
|
1109 |
order = Qt::DescendingOrder;
|
|
1110 |
}
|
40
|
1111 |
model->doSorting(role, order);
|
|
1112 |
|
41
|
1113 |
// for video related sorting, all videos list and collection content
|
|
1114 |
// list, sorting orders are same all the time
|
|
1115 |
VideoListWidget *anotherVideosList = 0;
|
|
1116 |
VideoCollectionCommon::TCollectionLevels level = mCurrentList->getLevel();
|
|
1117 |
if (level == VideoCollectionCommon::ELevelDefaultColl ||
|
|
1118 |
level == VideoCollectionCommon::ELevelAlbum)
|
36
|
1119 |
{
|
41
|
1120 |
anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
|
36
|
1121 |
}
|
41
|
1122 |
else if(level == VideoCollectionCommon::ELevelVideos)
|
|
1123 |
{
|
|
1124 |
anotherVideosList = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
|
|
1125 |
}
|
|
1126 |
if(anotherVideosList && anotherVideosList->getModel())
|
|
1127 |
{
|
|
1128 |
anotherVideosList->getModel()->doSorting(role, order);
|
|
1129 |
}
|
36
|
1130 |
|
37
|
1131 |
// save sorting values only if the application is not started as a service
|
41
|
1132 |
if (!mVideoServices)
|
37
|
1133 |
{
|
|
1134 |
// save sorting values
|
|
1135 |
mUiUtils.saveSortingValues(role, order, mCurrentList->getLevel());
|
|
1136 |
}
|
30
|
1137 |
}
|
|
1138 |
|
|
1139 |
// -------------------------------------------------------------------------------------------------
|
|
1140 |
// aboutToChangeOrientationSlot()
|
|
1141 |
// hide all items in the window during orientation change
|
|
1142 |
// -------------------------------------------------------------------------------------------------
|
|
1143 |
//
|
|
1144 |
void VideoListView::aboutToChangeOrientationSlot()
|
|
1145 |
{
|
36
|
1146 |
FUNC_LOG;
|
30
|
1147 |
// this method is required for changing from to mediawall
|
|
1148 |
}
|
|
1149 |
|
|
1150 |
// -------------------------------------------------------------------------------------------------
|
|
1151 |
// orientationChangedSlot()
|
|
1152 |
// orientation changed, items can be put back to visible after view has handled the change
|
|
1153 |
// -------------------------------------------------------------------------------------------------
|
|
1154 |
//
|
|
1155 |
void VideoListView::orientationChangedSlot( Qt::Orientation orientation )
|
|
1156 |
{
|
36
|
1157 |
FUNC_LOG;
|
30
|
1158 |
// this method is required for changing from to mediawall
|
|
1159 |
|
|
1160 |
// in landscape we need to hide the title and the toolbar. (also required for the mediawall?)
|
|
1161 |
// TODO: how about the feature where the toolbar comes visible if screen is tapped?
|
|
1162 |
this->setItemVisible(Hb::AllItems, orientation == Qt::Vertical);
|
|
1163 |
}
|
|
1164 |
|
|
1165 |
// -------------------------------------------------------------------------------------------------
|
|
1166 |
// deleteItemsSlot
|
|
1167 |
// -------------------------------------------------------------------------------------------------
|
|
1168 |
//
|
|
1169 |
void VideoListView::deleteItemsSlot()
|
|
1170 |
{
|
36
|
1171 |
FUNC_LOG;
|
35
|
1172 |
|
34
|
1173 |
VideoListSelectionDialog *dialog =
|
|
1174 |
mUiLoader->findWidget<VideoListSelectionDialog>(
|
|
1175 |
DOCML_NAME_DIALOG);
|
|
1176 |
if (dialog)
|
30
|
1177 |
{
|
40
|
1178 |
TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem();
|
34
|
1179 |
dialog->setupContent(VideoListSelectionDialog::EDeleteVideos, collectionId);
|
|
1180 |
dialog->exec();
|
30
|
1181 |
}
|
|
1182 |
}
|
|
1183 |
|
|
1184 |
// -------------------------------------------------------------------------------------------------
|
|
1185 |
// createCollectionSlot
|
|
1186 |
// -------------------------------------------------------------------------------------------------
|
|
1187 |
//
|
|
1188 |
void VideoListView::createCollectionSlot()
|
|
1189 |
{
|
36
|
1190 |
FUNC_LOG;
|
40
|
1191 |
|
|
1192 |
VideoListSelectionDialog *dialog =
|
|
1193 |
mUiLoader->findWidget<VideoListSelectionDialog>(
|
|
1194 |
DOCML_NAME_DIALOG);
|
|
1195 |
if (!dialog)
|
34
|
1196 |
{
|
40
|
1197 |
// fatal: no selection dialog
|
34
|
1198 |
return;
|
|
1199 |
}
|
|
1200 |
|
40
|
1201 |
dialog->setupContent(VideoListSelectionDialog::ECreateCollection, TMPXItemId::InvalidId());
|
|
1202 |
dialog->exec();
|
30
|
1203 |
}
|
|
1204 |
|
|
1205 |
// -------------------------------------------------------------------------------------------------
|
|
1206 |
// addVideosToCollectionSlot
|
|
1207 |
// -------------------------------------------------------------------------------------------------
|
|
1208 |
//
|
|
1209 |
void VideoListView::addVideosToCollectionSlot()
|
|
1210 |
{
|
36
|
1211 |
FUNC_LOG;
|
40
|
1212 |
if(!mCurrentList || !mCurrentList->getModel())
|
34
|
1213 |
{
|
|
1214 |
return;
|
|
1215 |
}
|
35
|
1216 |
|
34
|
1217 |
VideoListSelectionDialog *dialog =
|
|
1218 |
mUiLoader->findWidget<VideoListSelectionDialog>(
|
|
1219 |
DOCML_NAME_DIALOG);
|
35
|
1220 |
if (!dialog)
|
34
|
1221 |
{
|
35
|
1222 |
// fatal: no selection dialog
|
|
1223 |
return;
|
|
1224 |
}
|
|
1225 |
if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum)
|
|
1226 |
{
|
|
1227 |
// album is opened, do not proceed in case it already have same amount
|
|
1228 |
// of videos than all videos view.
|
|
1229 |
VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>(
|
|
1230 |
DOCML_NAME_VC_VIDEOLISTWIDGET);
|
40
|
1231 |
if(allVideos && allVideos->getModel())
|
34
|
1232 |
{
|
40
|
1233 |
int count = allVideos->getModel()->rowCount();
|
|
1234 |
if(count == mCurrentList->getModel()->rowCount())
|
34
|
1235 |
{
|
35
|
1236 |
if(count)
|
34
|
1237 |
{
|
|
1238 |
QVariant emptyAdditional;
|
|
1239 |
mUiUtils.showStatusMsgSlot(
|
|
1240 |
VideoCollectionCommon::statusAllVideosAlreadyInCollection,
|
|
1241 |
emptyAdditional);
|
35
|
1242 |
}
|
|
1243 |
return;
|
|
1244 |
}
|
34
|
1245 |
}
|
35
|
1246 |
}
|
40
|
1247 |
TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem();
|
35
|
1248 |
dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId);
|
|
1249 |
dialog->exec();
|
|
1250 |
}
|
|
1251 |
|
|
1252 |
// -------------------------------------------------------------------------------------------------
|
|
1253 |
// removeVideosFromCollectionSlot
|
|
1254 |
// -------------------------------------------------------------------------------------------------
|
|
1255 |
//
|
|
1256 |
void VideoListView::removeVideosFromCollectionSlot()
|
|
1257 |
{
|
36
|
1258 |
FUNC_LOG;
|
40
|
1259 |
if(!mCurrentList || !mCurrentList->getModel())
|
35
|
1260 |
{
|
|
1261 |
return;
|
|
1262 |
}
|
|
1263 |
// not allowed if for some reason current widget
|
|
1264 |
// is all videos or collection or there are no items
|
|
1265 |
if(mCurrentList->getLevel() < VideoCollectionCommon::ELevelDefaultColl ||
|
40
|
1266 |
!mCurrentList->getModel()->rowCount())
|
35
|
1267 |
{
|
|
1268 |
return;
|
|
1269 |
}
|
|
1270 |
|
|
1271 |
VideoListSelectionDialog *dialog =
|
|
1272 |
mUiLoader->findWidget<VideoListSelectionDialog>(
|
|
1273 |
DOCML_NAME_DIALOG);
|
|
1274 |
if (!dialog)
|
|
1275 |
{
|
36
|
1276 |
ERROR(-1, "VideoListView::removeVideosFromCollectionSlot() failed to load selection dialog.");
|
35
|
1277 |
return;
|
|
1278 |
}
|
40
|
1279 |
TMPXItemId collectionId = mCurrentList->getModel()->getOpenItem();
|
35
|
1280 |
if(collectionId != TMPXItemId::InvalidId() && collectionId.iId2 != KVcxMvcMediaTypeVideo)
|
|
1281 |
{
|
|
1282 |
dialog->setupContent(VideoListSelectionDialog::ERemoveFromCollection, collectionId);
|
34
|
1283 |
dialog->exec();
|
|
1284 |
}
|
30
|
1285 |
}
|
|
1286 |
|
|
1287 |
// -------------------------------------------------------------------------------------------------
|
|
1288 |
// aboutToShowMainMenuSlot
|
|
1289 |
// -------------------------------------------------------------------------------------------------
|
|
1290 |
//
|
|
1291 |
void VideoListView::aboutToShowMainMenuSlot()
|
|
1292 |
{
|
41
|
1293 |
if (mVideoServices &&
|
36
|
1294 |
mVideoServices->currentService() == VideoServices::EBrowse)
|
|
1295 |
{
|
|
1296 |
prepareBrowseServiceMenu();
|
|
1297 |
return;
|
|
1298 |
}
|
|
1299 |
|
34
|
1300 |
if (!mCurrentList ||
|
|
1301 |
!mToolbarViewsActionGroup ||
|
|
1302 |
!mToolbarCollectionActionGroup)
|
30
|
1303 |
{
|
|
1304 |
return;
|
|
1305 |
}
|
34
|
1306 |
|
|
1307 |
// hide all actions by default
|
|
1308 |
showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
|
|
1309 |
showAction(false, DOCML_NAME_CREATE_COLLECTION);
|
|
1310 |
showAction(false, DOCML_NAME_DELETE_MULTIPLE);
|
|
1311 |
showAction(false, DOCML_NAME_SORT_BY_DATE);
|
|
1312 |
showAction(false, DOCML_NAME_SORT_BY_NAME);
|
|
1313 |
showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
|
|
1314 |
showAction(false, DOCML_NAME_SORT_BY_SIZE);
|
|
1315 |
showAction(false, DOCML_NAME_SORT_MENU);
|
55
|
1316 |
|
|
1317 |
HbAction *firstAction = (HbAction*)(toolBar()->actions().first());
|
|
1318 |
|
|
1319 |
bool isCollectionsView = mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
|
|
1320 |
firstAction == mToolbarActions[ETBActionAllVideos];
|
34
|
1321 |
|
55
|
1322 |
// Create collection action is shown even when there's no videos.
|
|
1323 |
if(isCollectionsView && !mVideoServices)
|
|
1324 |
{
|
|
1325 |
showAction(true, DOCML_NAME_CREATE_COLLECTION);
|
|
1326 |
}
|
|
1327 |
|
|
1328 |
// No other actions shown if there's no videos.
|
58
|
1329 |
VideoProxyModelGeneric *model = mCurrentList->getModel();
|
40
|
1330 |
if (!model || !model->rowCount())
|
30
|
1331 |
{
|
|
1332 |
return;
|
|
1333 |
}
|
34
|
1334 |
|
|
1335 |
// get current sorting values
|
|
1336 |
int role;
|
|
1337 |
Qt::SortOrder order;
|
40
|
1338 |
model->getSorting(role, order);
|
30
|
1339 |
|
|
1340 |
if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] &&
|
|
1341 |
firstAction == mToolbarActions[ETBActionAllVideos])
|
|
1342 |
{
|
34
|
1343 |
showAction(true, DOCML_NAME_SORT_MENU);
|
|
1344 |
showAction(true, DOCML_NAME_SORT_BY_DATE);
|
|
1345 |
showAction(true, DOCML_NAME_SORT_BY_NAME);
|
|
1346 |
showAction(true, DOCML_NAME_SORT_BY_SIZE);
|
30
|
1347 |
|
36
|
1348 |
HbAction* action = mSortingRoles.key(role);
|
|
1349 |
if (action)
|
|
1350 |
{
|
|
1351 |
action->setChecked(true);
|
|
1352 |
}
|
|
1353 |
|
41
|
1354 |
if (!mVideoServices)
|
30
|
1355 |
{
|
34
|
1356 |
showAction(true, DOCML_NAME_ADD_TO_COLLECTION);
|
|
1357 |
showAction(true, DOCML_NAME_DELETE_MULTIPLE);
|
30
|
1358 |
}
|
|
1359 |
}
|
55
|
1360 |
else if(isCollectionsView)
|
30
|
1361 |
{
|
34
|
1362 |
showAction(true, DOCML_NAME_SORT_MENU);
|
|
1363 |
showAction(true, DOCML_NAME_SORT_BY_NAME);
|
36
|
1364 |
showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
|
34
|
1365 |
|
36
|
1366 |
HbAction* action = mSortingRoles.key(role);
|
|
1367 |
if (action)
|
|
1368 |
{
|
|
1369 |
action->setChecked(true);
|
|
1370 |
}
|
30
|
1371 |
}
|
|
1372 |
else if(firstAction != mToolbarActions[ETBActionAllVideos])
|
|
1373 |
{
|
35
|
1374 |
showAction(true, DOCML_NAME_SORT_MENU);
|
|
1375 |
showAction(true, DOCML_NAME_SORT_BY_DATE);
|
|
1376 |
showAction(true, DOCML_NAME_SORT_BY_NAME);
|
|
1377 |
showAction(true, DOCML_NAME_SORT_BY_SIZE);
|
|
1378 |
|
36
|
1379 |
HbAction* action = mSortingRoles.key(role);
|
|
1380 |
if (action)
|
|
1381 |
{
|
|
1382 |
action->setChecked(true);
|
|
1383 |
}
|
|
1384 |
|
41
|
1385 |
if (!mVideoServices)
|
30
|
1386 |
{
|
34
|
1387 |
showAction(true, DOCML_NAME_DELETE_MULTIPLE);
|
30
|
1388 |
}
|
|
1389 |
}
|
|
1390 |
}
|
|
1391 |
|
|
1392 |
// -------------------------------------------------------------------------------------------------
|
36
|
1393 |
// prepareBrowseServiceMenu
|
|
1394 |
// -------------------------------------------------------------------------------------------------
|
|
1395 |
//
|
|
1396 |
void VideoListView::prepareBrowseServiceMenu()
|
|
1397 |
{
|
|
1398 |
if (!mCurrentList)
|
|
1399 |
{
|
|
1400 |
return;
|
|
1401 |
}
|
|
1402 |
|
|
1403 |
// hide all actions by default
|
|
1404 |
showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
|
|
1405 |
showAction(false, DOCML_NAME_CREATE_COLLECTION);
|
|
1406 |
showAction(false, DOCML_NAME_DELETE_MULTIPLE);
|
|
1407 |
showAction(false, DOCML_NAME_SORT_BY_DATE);
|
|
1408 |
showAction(false, DOCML_NAME_SORT_BY_NAME);
|
|
1409 |
showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
|
|
1410 |
showAction(false, DOCML_NAME_SORT_BY_SIZE);
|
|
1411 |
showAction(false, DOCML_NAME_SORT_MENU);
|
|
1412 |
|
58
|
1413 |
VideoProxyModelGeneric *model = mCurrentList->getModel();
|
40
|
1414 |
if (!model || !model->rowCount())
|
36
|
1415 |
{
|
|
1416 |
return;
|
|
1417 |
}
|
|
1418 |
|
|
1419 |
// show delete action
|
|
1420 |
showAction(true, DOCML_NAME_DELETE_MULTIPLE);
|
|
1421 |
|
|
1422 |
// show sort actions
|
|
1423 |
showAction(true, DOCML_NAME_SORT_MENU);
|
|
1424 |
showAction(true, DOCML_NAME_SORT_BY_DATE);
|
|
1425 |
showAction(true, DOCML_NAME_SORT_BY_NAME);
|
|
1426 |
showAction(true, DOCML_NAME_SORT_BY_SIZE);
|
|
1427 |
|
|
1428 |
// set current sort action selected
|
|
1429 |
int role;
|
|
1430 |
Qt::SortOrder order;
|
40
|
1431 |
model->getSorting(role, order);
|
36
|
1432 |
HbAction* action = mSortingRoles.key(role);
|
|
1433 |
if (action)
|
|
1434 |
{
|
|
1435 |
action->setChecked(true);
|
|
1436 |
}
|
|
1437 |
}
|
|
1438 |
|
|
1439 |
// -------------------------------------------------------------------------------------------------
|
30
|
1440 |
// handleAsyncStatusSlot
|
|
1441 |
// -------------------------------------------------------------------------------------------------
|
|
1442 |
//
|
|
1443 |
void VideoListView::handleAsyncStatusSlot(int statusCode, QVariant &additional)
|
|
1444 |
{
|
36
|
1445 |
FUNC_LOG;
|
30
|
1446 |
// show msg from status
|
|
1447 |
mUiUtils.showStatusMsgSlot(statusCode, additional);
|
|
1448 |
}
|
|
1449 |
|
|
1450 |
// -------------------------------------------------------------------------------------------------
|
|
1451 |
// collectionOpenedSlot
|
|
1452 |
// -------------------------------------------------------------------------------------------------
|
|
1453 |
//
|
41
|
1454 |
void VideoListView::collectionOpenedSlot(bool openingCollection,
|
34
|
1455 |
const QString& collection,
|
41
|
1456 |
const TMPXItemId &collectionId)
|
30
|
1457 |
{
|
36
|
1458 |
FUNC_LOG;
|
49
|
1459 |
|
|
1460 |
// update / clear collection name
|
|
1461 |
mCollectionName = collection;
|
30
|
1462 |
|
41
|
1463 |
if(openingCollection)
|
30
|
1464 |
{
|
49
|
1465 |
VideoListWidget *collectionContentWidget =
|
|
1466 |
mUiLoader->findWidget<VideoListWidget>(
|
|
1467 |
DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
|
|
1468 |
// open album view, mCurrentList might be NULL at this point
|
|
1469 |
if (!collectionContentWidget || mCurrentList == collectionContentWidget)
|
37
|
1470 |
{
|
49
|
1471 |
// collection widget cannot be loaded or
|
|
1472 |
// currentlist is already collection content -list
|
34
|
1473 |
return;
|
|
1474 |
}
|
41
|
1475 |
|
37
|
1476 |
// get level from the item to be opened only default
|
|
1477 |
// or user defined collections can be activated here
|
|
1478 |
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid;
|
41
|
1479 |
if(collectionId.iId2 == KVcxMvcMediaTypeCategory)
|
36
|
1480 |
{
|
37
|
1481 |
level = VideoCollectionCommon::ELevelDefaultColl;
|
36
|
1482 |
}
|
41
|
1483 |
else if(collectionId.iId2 == KVcxMvcMediaTypeAlbum)
|
34
|
1484 |
{
|
37
|
1485 |
level = VideoCollectionCommon::ELevelAlbum;
|
|
1486 |
}
|
|
1487 |
else
|
|
1488 |
{
|
36
|
1489 |
return;
|
|
1490 |
}
|
49
|
1491 |
|
58
|
1492 |
VideoProxyModelGeneric *model = collectionContentWidget->getModel();
|
40
|
1493 |
if(!model)
|
|
1494 |
{
|
|
1495 |
// no model for content widget, cannot activate
|
|
1496 |
return;
|
|
1497 |
}
|
49
|
1498 |
|
|
1499 |
// disable collection content animations during widget change
|
|
1500 |
HbAbstractItemView::ItemAnimations animationState = collectionContentWidget->enabledAnimations();
|
|
1501 |
collectionContentWidget->setEnabledAnimations(HbAbstractItemView::None);
|
|
1502 |
|
|
1503 |
// Start fetching content before changing list widget
|
41
|
1504 |
model->openItem(collectionId);
|
36
|
1505 |
|
37
|
1506 |
// deactivat current widget.
|
41
|
1507 |
if(mCurrentList)
|
|
1508 |
{
|
|
1509 |
mCurrentList->deactivate();
|
|
1510 |
}
|
36
|
1511 |
|
37
|
1512 |
// activate video collection content widget and set it as current list.
|
|
1513 |
mCurrentList = collectionContentWidget;
|
|
1514 |
mCurrentList->activate(level);
|
|
1515 |
|
|
1516 |
updateSubLabel();
|
|
1517 |
|
|
1518 |
// update hint widget for correct content
|
40
|
1519 |
mModelReady = model->rowCount() > 0;
|
37
|
1520 |
setHintLevel(VideoHintWidget::Collection);
|
|
1521 |
|
58
|
1522 |
if(mToolbarCollectionActionGroup)
|
37
|
1523 |
{
|
58
|
1524 |
// update toolbar for albums, default categories don't have one. Neither does services.
|
|
1525 |
toolBar()->clearActions();
|
|
1526 |
if(!mVideoServices && level == VideoCollectionCommon::ELevelAlbum &&
|
|
1527 |
mToolbarActions.contains(ETBActionCollections))
|
|
1528 |
{
|
|
1529 |
mToolbarActions[ETBActionCollections]->setChecked(false);
|
|
1530 |
toolBar()->addActions(mToolbarCollectionActionGroup->actions());
|
|
1531 |
setItemVisible(Hb::ToolBarItem, true);
|
|
1532 |
}
|
|
1533 |
else
|
|
1534 |
{
|
|
1535 |
setItemVisible(Hb::ToolBarItem, false);
|
|
1536 |
}
|
49
|
1537 |
}
|
|
1538 |
// restore animations for collection content widget
|
|
1539 |
collectionContentWidget->setEnabledAnimations(animationState);
|
30
|
1540 |
}
|
|
1541 |
else
|
|
1542 |
{
|
49
|
1543 |
// clear actions to make sure there is no wrong toolbar in case main
|
|
1544 |
// toolbar actiongroup actiongroup is missing
|
|
1545 |
toolBar()->clearActions();
|
37
|
1546 |
// open collection view
|
49
|
1547 |
openCollectionViewSlot();
|
37
|
1548 |
// update toolbar
|
|
1549 |
if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections))
|
49
|
1550 |
{
|
37
|
1551 |
toolBar()->addActions(mToolbarViewsActionGroup->actions());
|
|
1552 |
mToolbarActions[ETBActionCollections]->setChecked(true);
|
49
|
1553 |
setItemVisible(Hb::ToolBarItem, true);
|
44
|
1554 |
|
|
1555 |
if(mToolbarServiceExtension)
|
|
1556 |
{
|
|
1557 |
HbAction *action = toolBar()->addExtension(mToolbarServiceExtension);
|
|
1558 |
HbIcon icon("qtg_mono_video_services");
|
|
1559 |
action->setIcon(icon);
|
|
1560 |
}
|
37
|
1561 |
}
|
49
|
1562 |
}
|
41
|
1563 |
if(!mVideoServices)
|
|
1564 |
{
|
|
1565 |
// save / clear collection related activity data
|
|
1566 |
VideoCollectionViewUtils::setCollectionActivityData(collectionId, collection);
|
|
1567 |
}
|
34
|
1568 |
}
|
|
1569 |
|
|
1570 |
// -------------------------------------------------------------------------------------------------
|
36
|
1571 |
// objectReadySlot
|
34
|
1572 |
// -------------------------------------------------------------------------------------------------
|
|
1573 |
//
|
36
|
1574 |
void VideoListView::objectReadySlot(QObject *object, const QString &name)
|
34
|
1575 |
{
|
36
|
1576 |
FUNC_LOG;
|
34
|
1577 |
if (name.compare(DOCML_NAME_VC_VIDEOLISTWIDGET) == 0)
|
|
1578 |
{
|
36
|
1579 |
connect(object, SIGNAL(command(int)), this, SIGNAL(command(int)));
|
39
|
1580 |
if(mCurrentList != object)
|
|
1581 |
{
|
|
1582 |
// this widget not yet activated so it's has been created on the second phase
|
|
1583 |
// safe to call doDelayed right away
|
|
1584 |
qobject_cast<VideoListWidget*>(object)->doDelayedsSlot();
|
|
1585 |
}
|
34
|
1586 |
}
|
|
1587 |
else if (name.compare(DOCML_NAME_VC_COLLECTIONWIDGET) == 0)
|
|
1588 |
{
|
|
1589 |
connect(
|
41
|
1590 |
object, SIGNAL(collectionOpened(bool, const QString&, const TMPXItemId&)),
|
|
1591 |
this, SLOT(collectionOpenedSlot(bool, const QString&, const TMPXItemId&)));
|
39
|
1592 |
if(mCurrentList != object)
|
|
1593 |
{
|
|
1594 |
// this widget not yet activated so it's has been created on the second phase
|
|
1595 |
// safe to call doDelayed right away
|
|
1596 |
qobject_cast<VideoListWidget*>(object)->doDelayedsSlot();
|
|
1597 |
}
|
34
|
1598 |
}
|
|
1599 |
else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0)
|
|
1600 |
{
|
36
|
1601 |
connect(object, SIGNAL(command(int)), this, SIGNAL(command(int)));
|
34
|
1602 |
connect(
|
41
|
1603 |
object, SIGNAL(collectionOpened(bool, const QString&, const TMPXItemId&)),
|
|
1604 |
this, SLOT(collectionOpenedSlot(bool, const QString&, const TMPXItemId&)));
|
39
|
1605 |
if(mCurrentList != object)
|
|
1606 |
{
|
|
1607 |
// this widget not yet activated so it's has been created on the second phase
|
|
1608 |
// safe to call doDelayed right away
|
|
1609 |
qobject_cast<VideoListWidget*>(object)->doDelayedsSlot();
|
|
1610 |
}
|
34
|
1611 |
}
|
|
1612 |
else if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0)
|
|
1613 |
{
|
|
1614 |
connect(
|
36
|
1615 |
object, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot()));
|
34
|
1616 |
}
|
|
1617 |
else if (name.compare(DOCML_NAME_HINT_BUTTON) == 0)
|
|
1618 |
{
|
44
|
1619 |
connect(object, SIGNAL(clicked(bool)), this, SLOT(openOperatorServiceSlot()));
|
34
|
1620 |
}
|
36
|
1621 |
else if (name.compare(DOCML_NAME_SORT_BY_DATE) == 0)
|
34
|
1622 |
{
|
|
1623 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1624 |
if (action)
|
|
1625 |
{
|
|
1626 |
connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
|
|
1627 |
mSortingRoles[action] = VideoCollectionCommon::KeyDateTime;
|
|
1628 |
}
|
|
1629 |
}
|
|
1630 |
else if (name.compare(DOCML_NAME_SORT_BY_NAME) == 0)
|
|
1631 |
{
|
|
1632 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1633 |
if (action)
|
|
1634 |
{
|
|
1635 |
connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
|
36
|
1636 |
mSortingRoles[action] = VideoCollectionCommon::KeyTitle;
|
34
|
1637 |
}
|
|
1638 |
}
|
|
1639 |
else if (name.compare(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) == 0)
|
|
1640 |
{
|
|
1641 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1642 |
if (action)
|
|
1643 |
{
|
36
|
1644 |
connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
|
|
1645 |
mSortingRoles[action] = VideoCollectionCommon::KeyNumberOfItems;
|
34
|
1646 |
}
|
|
1647 |
}
|
|
1648 |
else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0)
|
|
1649 |
{
|
|
1650 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1651 |
if (action)
|
|
1652 |
{
|
|
1653 |
connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
|
|
1654 |
mSortingRoles[action] = VideoCollectionCommon::KeySizeValue;
|
|
1655 |
}
|
|
1656 |
}
|
|
1657 |
else if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0)
|
|
1658 |
{
|
|
1659 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1660 |
if (action)
|
|
1661 |
{
|
|
1662 |
connect(action, SIGNAL(triggered()), this, SLOT(addVideosToCollectionSlot()));
|
|
1663 |
}
|
|
1664 |
}
|
|
1665 |
else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0)
|
|
1666 |
{
|
|
1667 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1668 |
if (action)
|
|
1669 |
{
|
|
1670 |
connect(action, SIGNAL(triggered()), this, SLOT(createCollectionSlot()));
|
|
1671 |
}
|
|
1672 |
}
|
|
1673 |
else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0)
|
|
1674 |
{
|
|
1675 |
HbAction *action = qobject_cast<HbAction*>(object);
|
|
1676 |
if (action)
|
|
1677 |
{
|
|
1678 |
connect(action, SIGNAL(triggered()), this, SLOT(deleteItemsSlot()));
|
|
1679 |
}
|
|
1680 |
}
|
30
|
1681 |
}
|
|
1682 |
|
|
1683 |
// Just for testing, remove this
|
|
1684 |
void VideoListView::debugNotImplementedYet()
|
|
1685 |
{
|
36
|
1686 |
FUNC_LOG;
|
30
|
1687 |
HbMessageBox::information(tr("Not implemented yet"));
|
|
1688 |
}
|
|
1689 |
|
38
|
1690 |
// End of file
|