126 } |
133 } |
127 |
134 |
128 // start loading widgets |
135 // start loading widgets |
129 QSet<QString> uiItems; |
136 QSet<QString> uiItems; |
130 uiItems.insert(DOCML_NAME_VC_VIDEOLISTWIDGET); |
137 uiItems.insert(DOCML_NAME_VC_VIDEOLISTWIDGET); |
|
138 uiItems.insert(DOCML_NAME_VC_HEADINGBANNER); |
131 uiItems.insert(DOCML_NAME_OPTIONS_MENU); |
139 uiItems.insert(DOCML_NAME_OPTIONS_MENU); |
132 uiItems.insert(DOCML_NAME_ADD_TO_COLLECTION); |
140 if(!mIsService) |
133 uiItems.insert(DOCML_NAME_CREATE_COLLECTION); |
141 { |
134 uiItems.insert(DOCML_NAME_DELETE_MULTIPLE); |
142 uiItems.insert(DOCML_NAME_ADD_TO_COLLECTION); |
135 uiItems.insert(DOCML_NAME_VC_HEADINGBANNER); |
143 uiItems.insert(DOCML_NAME_CREATE_COLLECTION); |
136 uiItems.insert(DOCML_NAME_VC_VIDEOHINTWIDGET); |
144 uiItems.insert(DOCML_NAME_DELETE_MULTIPLE); |
137 uiItems.insert(DOCML_NAME_HINT_BUTTON); |
145 } |
138 uiItems.insert(DOCML_NAME_NO_VIDEOS_LABEL); |
|
139 uiItems.insert(DOCML_NAME_SORT_MENU); |
146 uiItems.insert(DOCML_NAME_SORT_MENU); |
140 uiItems.insert(DOCML_NAME_SORT_BY_DATE); |
147 uiItems.insert(DOCML_NAME_SORT_BY_DATE); |
141 uiItems.insert(DOCML_NAME_SORT_BY_NAME); |
148 uiItems.insert(DOCML_NAME_SORT_BY_NAME); |
142 uiItems.insert(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS); |
149 uiItems.insert(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS); |
143 uiItems.insert(DOCML_NAME_SORT_BY_TOTAL_LENGTH); |
|
144 uiItems.insert(DOCML_NAME_SORT_BY_RATING); |
150 uiItems.insert(DOCML_NAME_SORT_BY_RATING); |
145 uiItems.insert(DOCML_NAME_SORT_BY_SIZE); |
151 uiItems.insert(DOCML_NAME_SORT_BY_SIZE); |
146 uiItems.insert(DOCML_NAME_VC_COLLECTIONWIDGET); |
|
147 uiItems.insert(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
|
148 uiItems.insert(DOCML_NAME_DIALOG); |
|
149 mUiLoader->startLoading(uiItems, |
152 mUiLoader->startLoading(uiItems, |
150 this, |
153 this, |
151 SLOT(widgetReadySlot(QGraphicsWidget*, const QString&)), |
154 SLOT(widgetReadySlot(QGraphicsWidget*, const QString&)), |
152 SLOT(objectReadySlot(QObject*, const QString&))); |
155 SLOT(objectReadySlot(QObject*, const QString&))); |
153 uiItems.clear(); |
156 uiItems.clear(); |
236 } |
239 } |
237 |
240 |
238 return 0; |
241 return 0; |
239 } |
242 } |
240 |
243 |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // loadMultiSelection |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 void VideoListView::loadMultiSelection() |
|
250 { |
|
251 if(!mIsService) |
|
252 { |
|
253 if(!mMultiselectionLoaded) |
|
254 { |
|
255 QSet<QString> uiItems; |
|
256 uiItems.insert(DOCML_NAME_DIALOG); |
|
257 mUiLoader->startLoading(uiItems, |
|
258 this, |
|
259 SLOT(widgetReadySlot(QGraphicsWidget*, const QString&)), |
|
260 SLOT(objectReadySlot(QObject*, const QString&))); |
|
261 uiItems.clear(); |
|
262 mMultiselectionLoaded = true; |
|
263 } |
|
264 } |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // loadLists |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 void VideoListView::loadLists(bool doAsync) |
|
272 { |
|
273 if(!mListsLoaded) |
|
274 { |
|
275 QSet<QString> uiItems; |
|
276 uiItems.insert(DOCML_NAME_VC_COLLECTIONWIDGET); |
|
277 uiItems.insert(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
|
278 mUiLoader->startLoading(uiItems, |
|
279 this, |
|
280 SLOT(widgetReadySlot(QGraphicsWidget*, const QString&)), |
|
281 SLOT(objectReadySlot(QObject*, const QString&))); |
|
282 uiItems.clear(); |
|
283 |
|
284 if(!doAsync) |
|
285 { |
|
286 VideoListWidget* widget(0); |
|
287 widget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONWIDGET); |
|
288 widget->setVisible(false); |
|
289 widget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
|
290 widget->setVisible(false); |
|
291 } |
|
292 mListsLoaded = true; |
|
293 } |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // doDelayedsSlot |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void VideoListView::doDelayedsSlot() |
|
301 { |
|
302 loadLists(true); |
|
303 loadMultiSelection(); |
|
304 loadHint(true); |
|
305 emit doDelayeds(); |
|
306 } |
|
307 |
241 // --------------------------------------------------------------------------- |
308 // --------------------------------------------------------------------------- |
242 // modelReadySlot |
309 // modelReadySlot |
243 // --------------------------------------------------------------------------- |
310 // --------------------------------------------------------------------------- |
244 // |
311 // |
245 void VideoListView::modelReadySlot() |
312 void VideoListView::modelReadySlot() |
364 // All Videos tab |
431 // All Videos tab |
365 mToolbarActions[ETBActionAllVideos] = createAction(":/images/qtg_mono_video_all.svg", |
432 mToolbarActions[ETBActionAllVideos] = createAction(":/images/qtg_mono_video_all.svg", |
366 mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot())); |
433 mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot())); |
367 |
434 |
368 // Collections tab |
435 // Collections tab |
369 mToolbarActions[ETBActionCollections] = createAction(":/images/qtg_mono_video_collection.svg", |
436 mToolbarActions[ETBActionCollections] = createAction("qtg_mono_video_collection", |
370 mToolbarViewsActionGroup, SLOT(openCollectionViewSlot())); |
437 mToolbarViewsActionGroup, SLOT(openCollectionViewSlot())); |
371 |
438 |
372 if (!mIsService) |
439 if (!mIsService) |
373 { |
440 { |
374 // Services tab |
441 // Services tab |
375 mToolbarActions[ETBActionServices] = createAction(":/images/qtg_mono_video_services.svg", |
442 mToolbarActions[ETBActionServices] = createAction("qtg_mono_ovistore", |
376 mToolbarViewsActionGroup, SLOT(openServicesViewSlot())); |
443 mToolbarViewsActionGroup, SLOT(openServicesViewSlot())); |
377 // Add Videos tab |
444 // Add Videos tab |
378 mToolbarActions[ETBActionAddVideos] = createAction(":/images/mono_video_addvideos.svg", |
445 mToolbarActions[ETBActionAddVideos] = |
|
446 createAction("qtg_mono_add_to_video_collection", |
379 mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot())); |
447 mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot())); |
380 |
448 |
381 // Remove Videos tab |
449 // Remove Videos tab |
382 mToolbarActions[ETBActionRemoveVideos] = createAction(":/images/mono_video_removevideos.svg", |
450 mToolbarActions[ETBActionRemoveVideos] = |
383 mToolbarCollectionActionGroup, SLOT(debugNotImplementedYet())); |
451 createAction(":/images/qtg_mono_remove_from_video_collection.svg", |
384 } |
452 mToolbarCollectionActionGroup, SLOT(removeVideosFromCollectionSlot())); |
385 |
453 } |
386 // Sort by tab |
|
387 mToolbarActions[ETBActionSortVideos] = createAction(":/images/mono_video_sortvideos.svg", |
|
388 mToolbarCollectionActionGroup, SLOT(openSortByMenuSlot())); |
|
389 |
454 |
390 HbToolBar *bar = toolBar(); // First call to toolBar() creates the object, so on failure it could return 0. |
455 HbToolBar *bar = toolBar(); // First call to toolBar() creates the object, so on failure it could return 0. |
391 |
456 |
392 if( !bar |
457 if( !bar |
393 || !mToolbarActions[ETBActionAllVideos] |
458 || !mToolbarActions[ETBActionAllVideos] |
394 || !mToolbarActions[ETBActionCollections] |
459 || !mToolbarActions[ETBActionCollections] |
395 || !mToolbarActions[ETBActionSortVideos] |
|
396 || (!mToolbarActions[ETBActionServices] && !mIsService) |
460 || (!mToolbarActions[ETBActionServices] && !mIsService) |
397 || (!mToolbarActions[ETBActionAddVideos] && !mIsService) |
461 || (!mToolbarActions[ETBActionAddVideos] && !mIsService) |
398 || (!mToolbarActions[ETBActionRemoveVideos] && !mIsService)) |
462 || (!mToolbarActions[ETBActionRemoveVideos] && !mIsService)) |
399 { |
463 { |
400 delete mToolbarActions[ETBActionAllVideos]; |
464 delete mToolbarActions[ETBActionAllVideos]; |
401 delete mToolbarActions[ETBActionCollections]; |
465 delete mToolbarActions[ETBActionCollections]; |
402 delete mToolbarActions[ETBActionServices]; |
466 delete mToolbarActions[ETBActionServices]; |
403 delete mToolbarActions[ETBActionAddVideos]; |
467 delete mToolbarActions[ETBActionAddVideos]; |
404 delete mToolbarActions[ETBActionRemoveVideos]; |
468 delete mToolbarActions[ETBActionRemoveVideos]; |
405 delete mToolbarActions[ETBActionSortVideos]; |
|
406 return -1; |
469 return -1; |
407 } |
470 } |
408 |
471 |
409 // Collection view actions are not checkable |
472 // Collection view actions are not checkable |
410 mToolbarActions[ETBActionAllVideos]->setCheckable(true); |
473 mToolbarActions[ETBActionAllVideos]->setCheckable(true); |
411 mToolbarActions[ETBActionCollections]->setCheckable(true); |
474 mToolbarActions[ETBActionCollections]->setCheckable(true); |
412 |
475 |
413 if (!mIsService) |
476 if (!mIsService) |
414 { |
477 { |
415 mToolbarActions[ETBActionServices]->setCheckable(true); |
478 mToolbarActions[ETBActionServices]->setCheckable(false); |
416 } |
479 } |
417 |
480 |
418 // Allvideos is checked at creation phase |
481 // Allvideos is checked at creation phase |
419 mToolbarActions[ETBActionAllVideos]->setChecked(true); |
482 mToolbarActions[ETBActionAllVideos]->setChecked(true); |
420 |
483 |
776 DOCML_NAME_OPTIONS_MENU); |
889 DOCML_NAME_OPTIONS_MENU); |
777 if (optionsMenu) |
890 if (optionsMenu) |
778 { |
891 { |
779 // get sorting role from active action |
892 // get sorting role from active action |
780 HbAction *action = optionsMenu->activeAction()->menu()->activeAction(); |
893 HbAction *action = optionsMenu->activeAction()->menu()->activeAction(); |
781 int role = mSortingRoles[action]; |
894 if(action) |
782 |
895 { |
783 // sort model |
896 doSorting(mSortingRoles[action]); |
784 Qt::SortOrder order(Qt::AscendingOrder); |
897 } |
785 VideoSortFilterProxyModel &model = mCurrentList->getModel(); |
898 } |
786 if(model.sortRole() == role && model.sortOrder() == Qt::AscendingOrder) |
899 } |
787 { |
900 |
788 order = Qt::DescendingOrder; |
901 // --------------------------------------------------------------------------- |
789 } |
902 // doSorting() |
790 model.doSorting(role, order); |
903 // --------------------------------------------------------------------------- |
791 |
904 // |
792 // save sorting values |
905 void VideoListView::doSorting(int role) |
793 mUiUtils.saveSortingValues(role, order); |
906 { |
794 } |
907 // sort model |
|
908 Qt::SortOrder order(Qt::AscendingOrder); |
|
909 VideoSortFilterProxyModel &model = mCurrentList->getModel(); |
|
910 if(model.sortRole() == role && model.sortOrder() == Qt::AscendingOrder) |
|
911 { |
|
912 order = Qt::DescendingOrder; |
|
913 } |
|
914 model.doSorting(role, order); |
|
915 |
|
916 // save sorting values |
|
917 mUiUtils.saveSortingValues(role, order); |
795 } |
918 } |
796 |
919 |
797 // ------------------------------------------------------------------------------------------------- |
920 // ------------------------------------------------------------------------------------------------- |
798 // aboutToChangeOrientationSlot() |
921 // aboutToChangeOrientationSlot() |
799 // hide all items in the window during orientation change |
922 // hide all items in the window during orientation change |
883 { |
1012 { |
884 if(!mCurrentList) |
1013 if(!mCurrentList) |
885 { |
1014 { |
886 return; |
1015 return; |
887 } |
1016 } |
888 |
1017 |
|
1018 if(!mMultiselectionLoaded) |
|
1019 { |
|
1020 loadMultiSelection(); |
|
1021 } |
|
1022 |
889 VideoListSelectionDialog *dialog = |
1023 VideoListSelectionDialog *dialog = |
890 mUiLoader->findWidget<VideoListSelectionDialog>( |
1024 mUiLoader->findWidget<VideoListSelectionDialog>( |
891 DOCML_NAME_DIALOG); |
1025 DOCML_NAME_DIALOG); |
892 if (dialog) |
1026 if (!dialog) |
893 { |
1027 { |
894 if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum) |
1028 // fatal: no selection dialog |
895 { |
1029 return; |
896 // album is opened, do not proceed in case it already have same amount |
1030 } |
897 // of videos than all videos view. |
1031 if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum) |
898 VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>( |
1032 { |
899 DOCML_NAME_VC_VIDEOLISTWIDGET); |
1033 // album is opened, do not proceed in case it already have same amount |
900 if(allVideos) |
1034 // of videos than all videos view. |
|
1035 VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>( |
|
1036 DOCML_NAME_VC_VIDEOLISTWIDGET); |
|
1037 if(allVideos) |
|
1038 { |
|
1039 int count = allVideos->getModel().rowCount(); |
|
1040 if(count == mCurrentList->getModel().rowCount()) |
901 { |
1041 { |
902 if(allVideos->getModel().rowCount() == mCurrentList->getModel().rowCount()) |
1042 if(count) |
903 { |
1043 { |
904 QVariant emptyAdditional; |
1044 QVariant emptyAdditional; |
905 mUiUtils.showStatusMsgSlot( |
1045 mUiUtils.showStatusMsgSlot( |
906 VideoCollectionCommon::statusAllVideosAlreadyInCollection, |
1046 VideoCollectionCommon::statusAllVideosAlreadyInCollection, |
907 emptyAdditional); |
1047 emptyAdditional); |
908 return; |
1048 } |
909 } |
1049 return; |
910 } |
1050 } |
911 } |
1051 } |
912 TMPXItemId collectionId = mCurrentList->getModel().getOpenItem(); |
1052 } |
913 dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId); |
1053 TMPXItemId collectionId = mCurrentList->getModel().getOpenItem(); |
|
1054 dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId); |
|
1055 dialog->exec(); |
|
1056 } |
|
1057 |
|
1058 // ------------------------------------------------------------------------------------------------- |
|
1059 // removeVideosFromCollectionSlot |
|
1060 // ------------------------------------------------------------------------------------------------- |
|
1061 // |
|
1062 void VideoListView::removeVideosFromCollectionSlot() |
|
1063 { |
|
1064 if(!mCurrentList) |
|
1065 { |
|
1066 return; |
|
1067 } |
|
1068 // not allowed if for some reason current widget |
|
1069 // is all videos or collection or there are no items |
|
1070 if(mCurrentList->getLevel() < VideoCollectionCommon::ELevelDefaultColl || |
|
1071 !mCurrentList->getModel().rowCount()) |
|
1072 { |
|
1073 return; |
|
1074 } |
|
1075 |
|
1076 if(!mMultiselectionLoaded) |
|
1077 { |
|
1078 loadMultiSelection(); |
|
1079 } |
|
1080 |
|
1081 VideoListSelectionDialog *dialog = |
|
1082 mUiLoader->findWidget<VideoListSelectionDialog>( |
|
1083 DOCML_NAME_DIALOG); |
|
1084 if (!dialog) |
|
1085 { |
|
1086 // fatal: no selection dialog |
|
1087 return; |
|
1088 } |
|
1089 TMPXItemId collectionId = mCurrentList->getModel().getOpenItem(); |
|
1090 if(collectionId != TMPXItemId::InvalidId() && collectionId.iId2 != KVcxMvcMediaTypeVideo) |
|
1091 { |
|
1092 dialog->setupContent(VideoListSelectionDialog::ERemoveFromCollection, collectionId); |
914 dialog->exec(); |
1093 dialog->exec(); |
915 } |
1094 } |
916 } |
1095 } |
917 |
1096 |
918 // ------------------------------------------------------------------------------------------------- |
1097 // ------------------------------------------------------------------------------------------------- |
1075 itemId.iId2 != KVcxMvcMediaTypeAlbum)) |
1273 itemId.iId2 != KVcxMvcMediaTypeAlbum)) |
1076 { |
1274 { |
1077 return; |
1275 return; |
1078 } |
1276 } |
1079 |
1277 |
1080 // deactivat current |
1278 // Send level that is opened with the effect. |
1081 mCurrentList->deactivate(); |
1279 QVariant nextLevel; |
1082 |
|
1083 // activate video collection content widget |
|
1084 mCurrentList = collectionContentWidget; |
|
1085 |
|
1086 if(itemId.iId2 == KVcxMvcMediaTypeCategory) |
1280 if(itemId.iId2 == KVcxMvcMediaTypeCategory) |
1087 { |
1281 { |
1088 mCurrentList->activate(VideoCollectionCommon::ELevelDefaultColl); |
1282 nextLevel = QVariant(VideoCollectionCommon::ELevelDefaultColl); |
1089 } |
1283 } |
1090 else if(itemId.iId2 == KVcxMvcMediaTypeAlbum) |
1284 else if(itemId.iId2 == KVcxMvcMediaTypeAlbum) |
1091 { |
1285 { |
1092 mCurrentList->activate(VideoCollectionCommon::ELevelAlbum); |
1286 nextLevel = QVariant(VideoCollectionCommon::ELevelAlbum); |
1093 } |
1287 } |
1094 mCurrentList->getModel().openItem(itemId); |
|
1095 |
1288 |
1096 // update hint widget, but don't show yet |
1289 // Start fetching content. |
1097 setHintLevel(VideoHintWidget::Collection); |
1290 collectionContentWidget->getModel().openItem(itemId); |
1098 showHint(false); |
|
1099 |
1291 |
1100 // update toolbar |
1292 HbEffect::start(collectionContentWidget, |
1101 mToolbarActions[ETBActionCollections]->setChecked(false); |
1293 EFFECT_SLIDE_IN_TO_LEFT, |
1102 bar->addActions(mToolbarCollectionActionGroup->actions()); |
1294 this, |
|
1295 "finishCollectionOpenedSlot", |
|
1296 nextLevel); |
|
1297 |
|
1298 mTransitionOngoing = true; |
1103 } |
1299 } |
1104 } |
1300 } |
1105 else |
1301 else |
1106 { |
1302 { |
1107 // open collection view |
1303 // open categories view. |
1108 openCollectionViewSlot(); |
1304 VideoListWidget *collectionContentWidget = |
1109 |
1305 mUiLoader->findWidget<VideoListWidget>( |
1110 // update toolbar |
1306 DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
1111 bar->addActions(mToolbarViewsActionGroup->actions()); |
1307 |
|
1308 HbEffect::start(collectionContentWidget, |
|
1309 EFFECT_SLIDE_OUT_TO_LEFT, |
|
1310 this, |
|
1311 "finishCollectionClosedSlot"); |
|
1312 |
|
1313 mTransitionOngoing = true; |
|
1314 } |
|
1315 } |
|
1316 |
|
1317 // ------------------------------------------------------------------------------------------------- |
|
1318 // finishCollectionOpenedSlot |
|
1319 // ------------------------------------------------------------------------------------------------- |
|
1320 // |
|
1321 void VideoListView::finishCollectionOpenedSlot(const HbEffect::EffectStatus &status) |
|
1322 { |
|
1323 Q_UNUSED(status); |
|
1324 |
|
1325 mTransitionOngoing = false; |
|
1326 |
|
1327 // deactivat current widget. |
|
1328 mCurrentList->deactivate(); |
|
1329 |
|
1330 // activate video collection content widget. |
|
1331 mCurrentList = mUiLoader->findWidget<VideoListWidget>( |
|
1332 DOCML_NAME_VC_COLLECTIONCONTENTWIDGET); |
|
1333 |
|
1334 if(!mCurrentList || !status.userData.isValid()) |
|
1335 { |
|
1336 return; |
|
1337 } |
|
1338 |
|
1339 updateSubLabel(); |
|
1340 |
|
1341 VideoCollectionCommon::TCollectionLevels level = |
|
1342 static_cast<VideoCollectionCommon::TCollectionLevels>(status.userData.toInt()); |
|
1343 mCurrentList->activate(level); |
|
1344 |
|
1345 // update hint widget |
|
1346 setHintLevel(VideoHintWidget::Collection); |
|
1347 showHint(); |
|
1348 |
|
1349 // update toolbar for albums, default categories don't have one. |
|
1350 if(level == VideoCollectionCommon::ELevelAlbum && |
|
1351 mToolbarCollectionActionGroup && mToolbarActions.contains(ETBActionCollections)) |
|
1352 { |
|
1353 mToolbarActions[ETBActionCollections]->setChecked(false); |
|
1354 toolBar()->addActions(mToolbarCollectionActionGroup->actions()); |
|
1355 } |
|
1356 } |
|
1357 |
|
1358 // ------------------------------------------------------------------------------------------------- |
|
1359 // finishCollectionClosedSlot |
|
1360 // ------------------------------------------------------------------------------------------------- |
|
1361 // |
|
1362 void VideoListView::finishCollectionClosedSlot(const HbEffect::EffectStatus &status) |
|
1363 { |
|
1364 Q_UNUSED(status); |
|
1365 |
|
1366 mTransitionOngoing = false; |
|
1367 |
|
1368 // open collection view |
|
1369 openCollectionViewSlot(); |
|
1370 |
|
1371 // update toolbar |
|
1372 if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections)) |
|
1373 { |
|
1374 toolBar()->addActions(mToolbarViewsActionGroup->actions()); |
1112 mToolbarActions[ETBActionCollections]->setChecked(true); |
1375 mToolbarActions[ETBActionCollections]->setChecked(true); |
1113 } |
1376 } |
1114 } |
1377 } |
1115 |
1378 |
1116 // ------------------------------------------------------------------------------------------------- |
1379 // ------------------------------------------------------------------------------------------------- |
1117 // openSortByMenuSlot |
|
1118 // ------------------------------------------------------------------------------------------------- |
|
1119 // |
|
1120 void VideoListView::openSortByMenuSlot() |
|
1121 { |
|
1122 if(!mCurrentList) |
|
1123 { |
|
1124 return; |
|
1125 } |
|
1126 |
|
1127 VideoSortFilterProxyModel &model = mCurrentList->getModel(); |
|
1128 if (!model.rowCount(QModelIndex())) |
|
1129 { |
|
1130 // no items, no menu |
|
1131 return; |
|
1132 } |
|
1133 |
|
1134 // hide all actions by default |
|
1135 showAction(false, DOCML_NAME_ADD_TO_COLLECTION); |
|
1136 showAction(false, DOCML_NAME_CREATE_COLLECTION); |
|
1137 showAction(false, DOCML_NAME_DELETE_MULTIPLE); |
|
1138 showAction(false, DOCML_NAME_SORT_BY_DATE); |
|
1139 showAction(false, DOCML_NAME_SORT_BY_NAME); |
|
1140 showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS); |
|
1141 showAction(false, DOCML_NAME_SORT_BY_TOTAL_LENGTH); |
|
1142 showAction(false, DOCML_NAME_SORT_BY_RATING); |
|
1143 showAction(false, DOCML_NAME_SORT_BY_SIZE); |
|
1144 showAction(false, DOCML_NAME_SORT_MENU); |
|
1145 |
|
1146 // if sort menu found, show all sort items |
|
1147 HbMenu *sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU); |
|
1148 if (sortMenu) |
|
1149 { |
|
1150 // show actions |
|
1151 showAction(true, DOCML_NAME_SORT_MENU); |
|
1152 showAction(true, DOCML_NAME_SORT_BY_DATE); |
|
1153 showAction(true, DOCML_NAME_SORT_BY_NAME); |
|
1154 showAction(true, DOCML_NAME_SORT_BY_SIZE); |
|
1155 |
|
1156 // show sort menu |
|
1157 sortMenu->show(); |
|
1158 |
|
1159 // execute sort menu |
|
1160 QPointF coords((size()/2).width(), (size()/3).height()); |
|
1161 sortMenu->exec(coords); |
|
1162 } |
|
1163 } |
|
1164 |
|
1165 // ------------------------------------------------------------------------------------------------- |
|
1166 // widgetReadySlot |
1380 // widgetReadySlot |
1167 // ------------------------------------------------------------------------------------------------- |
1381 // ------------------------------------------------------------------------------------------------- |
1168 // |
1382 // |
1169 void VideoListView::widgetReadySlot(QGraphicsWidget *widget, const QString &name) |
1383 void VideoListView::widgetReadySlot(QGraphicsWidget *widget, const QString &name) |
1170 { |
1384 { |
1171 if (name.compare(DOCML_NAME_VC_VIDEOLISTWIDGET) == 0) |
1385 if (name.compare(DOCML_NAME_VC_VIDEOLISTWIDGET) == 0) |
1172 { |
1386 { |
1173 connect(widget, SIGNAL(command(int)), this, SIGNAL(command(int))); |
1387 connect(widget, SIGNAL(command(int)), this, SIGNAL(command(int))); |
|
1388 connect(this, SIGNAL(doDelayeds()), widget, SLOT(doDelayedsSlot())); |
1174 } |
1389 } |
1175 else if (name.compare(DOCML_NAME_VC_COLLECTIONWIDGET) == 0) |
1390 else if (name.compare(DOCML_NAME_VC_COLLECTIONWIDGET) == 0) |
1176 { |
1391 { |
1177 connect( |
1392 connect( |
1178 widget, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)), |
1393 widget, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)), |
1179 this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&))); |
1394 this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&))); |
|
1395 connect(this, SIGNAL(doDelayeds()), widget, SLOT(doDelayedsSlot())); |
|
1396 emit(doDelayeds()); |
1180 } |
1397 } |
1181 else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0) |
1398 else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0) |
1182 { |
1399 { |
1183 connect(widget, SIGNAL(command(int)), this, SIGNAL(command(int))); |
1400 connect(widget, SIGNAL(command(int)), this, SIGNAL(command(int))); |
1184 connect( |
1401 connect( |
1185 widget, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)), |
1402 widget, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)), |
1186 this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&))); |
1403 this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&))); |
|
1404 connect(this, SIGNAL(doDelayeds()), widget, SLOT(doDelayedsSlot())); |
|
1405 emit(doDelayeds()); |
1187 } |
1406 } |
1188 else if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0) |
1407 else if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0) |
1189 { |
1408 { |
1190 connect( |
1409 connect( |
1191 widget, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot())); |
1410 widget, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot())); |
1228 // TODO: implement |
1447 // TODO: implement |
1229 connect(action, SIGNAL(triggered()), this, SLOT(debugNotImplementedYet())); |
1448 connect(action, SIGNAL(triggered()), this, SLOT(debugNotImplementedYet())); |
1230 mSortingRoles[action] = 0; |
1449 mSortingRoles[action] = 0; |
1231 } |
1450 } |
1232 } |
1451 } |
1233 else if (name.compare(DOCML_NAME_SORT_BY_TOTAL_LENGTH) == 0) |
1452 else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0) |
1234 { |
1453 { |
1235 HbAction *action = qobject_cast<HbAction*>(object); |
1454 HbAction *action = qobject_cast<HbAction*>(object); |
1236 if (action) |
1455 if (action) |
1237 { |
1456 { |
1238 // TODO: implement |
1457 connect(action, SIGNAL(triggered()), this, SLOT(startSorting())); |
1239 connect(action, SIGNAL(triggered()), this, SLOT(debugNotImplementedYet())); |
1458 mSortingRoles[action] = VideoCollectionCommon::KeySizeValue; |
1240 mSortingRoles[action] = 0; |
1459 } |
1241 } |
1460 } |
1242 } |
1461 else if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0) |
1243 else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0) |
|
1244 { |
1462 { |
1245 HbAction *action = qobject_cast<HbAction*>(object); |
1463 HbAction *action = qobject_cast<HbAction*>(object); |
1246 if (action) |
1464 if (action) |
1247 { |
1465 { |
1248 connect(action, SIGNAL(triggered()), this, SLOT(startSorting())); |
1466 connect(action, SIGNAL(triggered()), this, SLOT(addVideosToCollectionSlot())); |
1249 mSortingRoles[action] = VideoCollectionCommon::KeySizeValue; |
1467 } |
1250 } |
1468 } |
1251 } |
1469 else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0) |
1252 else if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0) |
|
1253 { |
1470 { |
1254 HbAction *action = qobject_cast<HbAction*>(object); |
1471 HbAction *action = qobject_cast<HbAction*>(object); |
1255 if (action) |
1472 if (action) |
1256 { |
1473 { |
1257 connect(action, SIGNAL(triggered()), this, SLOT(addVideosToCollectionSlot())); |
1474 connect(action, SIGNAL(triggered()), this, SLOT(createCollectionSlot())); |
1258 } |
1475 } |
1259 } |
1476 } |
1260 else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0) |
1477 else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0) |
1261 { |
1478 { |
1262 HbAction *action = qobject_cast<HbAction*>(object); |
1479 HbAction *action = qobject_cast<HbAction*>(object); |
1263 if (action) |
1480 if (action) |
1264 { |
1481 { |
1265 connect(action, SIGNAL(triggered()), this, SLOT(createCollectionSlot())); |
|
1266 } |
|
1267 } |
|
1268 else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0) |
|
1269 { |
|
1270 HbAction *action = qobject_cast<HbAction*>(object); |
|
1271 if (action) |
|
1272 { |
|
1273 connect(action, SIGNAL(triggered()), this, SLOT(deleteItemsSlot())); |
1482 connect(action, SIGNAL(triggered()), this, SLOT(deleteItemsSlot())); |
1274 } |
1483 } |
1275 } |
1484 } |
1276 } |
1485 } |
1277 |
1486 |