videocollection/videocollectionview/src/videolistview.cpp
changeset 49 824471cb468a
parent 44 518105d52e45
child 50 21fe8338c6bf
equal deleted inserted replaced
44:518105d52e45 49:824471cb468a
    13 *
    13 *
    14 * Description:   Videolist view class source code
    14 * Description:   Videolist view class source code
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 113.1.1 %
    18 // Version : %version: 113.1.4 %
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include <xqserviceutil.h>
    21 #include <xqserviceutil.h>
    22 #include <qactiongroup.h>
    22 #include <qactiongroup.h>
    23 #include <hbinstance.h>
    23 #include <hbinstance.h>
   162     QList<VideoCollectionUiLoaderParam> params;
   162     QList<VideoCollectionUiLoaderParam> params;
   163     
   163     
   164     params.append(VideoCollectionUiLoaderParam(
   164     params.append(VideoCollectionUiLoaderParam(
   165         DOCML_NAME_VC_VIDEOLISTWIDGET,
   165         DOCML_NAME_VC_VIDEOLISTWIDGET,
   166         DOCML_VIDEOCOLLECTIONVIEW_FILE,
   166         DOCML_VIDEOCOLLECTIONVIEW_FILE,
       
   167         DOCML_VIDEOCOLLECTIONVIEW_SECTION_LIST,
   167         true,
   168         true,
   168         videoListPhase));
   169         videoListPhase));
   169     
   170     
   170     params.append(VideoCollectionUiLoaderParam(
   171     params.append(VideoCollectionUiLoaderParam(
   171         DOCML_NAME_VC_COLLECTIONWIDGET,
   172         DOCML_NAME_VC_COLLECTIONWIDGET,
   272     {
   273     {
   273         mCurrentList = mUiLoader->findWidget<VideoListWidget>(
   274         mCurrentList = mUiLoader->findWidget<VideoListWidget>(
   274                 DOCML_NAME_VC_COLLECTIONWIDGET );
   275                 DOCML_NAME_VC_COLLECTIONWIDGET );
   275     }
   276     }
   276 
   277 
   277 
       
   278     
       
   279     return 0;
   278     return 0;
   280 }
   279 }
   281 
   280 
   282 // ---------------------------------------------------------------------------
   281 // ---------------------------------------------------------------------------
   283 // titleReadySlot()
   282 // titleReadySlot()
  1409 void VideoListView::collectionOpenedSlot(bool openingCollection,
  1408 void VideoListView::collectionOpenedSlot(bool openingCollection,
  1410     const QString& collection,
  1409     const QString& collection,
  1411     const TMPXItemId &collectionId)
  1410     const TMPXItemId &collectionId)
  1412 {
  1411 {
  1413 	FUNC_LOG;
  1412 	FUNC_LOG;
  1414 
  1413  
  1415     // clear toolbar actions.
  1414     // update / clear collection name
  1416     toolBar()->clearActions();
       
  1417 
       
  1418     VideoListWidget *collectionContentWidget =
       
  1419                 mUiLoader->findWidget<VideoListWidget>(
       
  1420                     DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
       
  1421     
       
  1422     if(!collectionContentWidget)
       
  1423     {
       
  1424         return;
       
  1425     }
       
  1426     // update collection specific information
       
  1427 	mCollectionName = collection;
  1415 	mCollectionName = collection;
  1428 	
  1416 
  1429 	// disable collection content animations during widget change        
       
  1430 	HbAbstractItemView::ItemAnimations animationState = collectionContentWidget->enabledAnimations();
       
  1431 	collectionContentWidget->setEnabledAnimations(HbAbstractItemView::None);
       
  1432 	
       
  1433 	if(openingCollection)
  1417 	if(openingCollection)
  1434     {
  1418     {
  1435         // open album view        
  1419 	    VideoListWidget *collectionContentWidget =
  1436         if (collectionId == TMPXItemId::InvalidId() || mCurrentList == collectionContentWidget)
  1420 	                   mUiLoader->findWidget<VideoListWidget>(
  1437         {
  1421 	                       DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
  1438             // no currentlist or currentlist is already collection content -list 
  1422         // open album view, mCurrentList might be NULL at this point        
  1439             collectionContentWidget->setEnabledAnimations(animationState);
  1423         if (!collectionContentWidget || mCurrentList == collectionContentWidget)
       
  1424         {
       
  1425             // collection widget cannot be loaded or 
       
  1426             // currentlist is already collection content -list            
  1440             return;
  1427             return;
  1441         }
  1428         }
  1442                 
  1429                 
  1443         // get level from the item to be opened only default 
  1430         // get level from the item to be opened only default 
  1444         // or user defined collections can be activated here
  1431         // or user defined collections can be activated here
  1451         {
  1438         {
  1452             level = VideoCollectionCommon::ELevelAlbum; 
  1439             level = VideoCollectionCommon::ELevelAlbum; 
  1453         }
  1440         }
  1454         else 
  1441         else 
  1455         {
  1442         {
  1456             collectionContentWidget->setEnabledAnimations(animationState);
       
  1457             return;
  1443             return;
  1458         }
  1444         }
  1459         
  1445                 
  1460         // Start fetching content before changing.
       
  1461         VideoSortFilterProxyModel *model = collectionContentWidget->getModel();
  1446         VideoSortFilterProxyModel *model = collectionContentWidget->getModel();
  1462         if(!model)
  1447         if(!model)
  1463         {
  1448         {
  1464             // no model for content widget, cannot activate
  1449             // no model for content widget, cannot activate
  1465             collectionContentWidget->setEnabledAnimations(animationState);
       
  1466             return;
  1450             return;
  1467         }
  1451         }
       
  1452         
       
  1453         // disable collection content animations during widget change        
       
  1454         HbAbstractItemView::ItemAnimations animationState = collectionContentWidget->enabledAnimations();
       
  1455         collectionContentWidget->setEnabledAnimations(HbAbstractItemView::None);
       
  1456         
       
  1457         // Start fetching content before changing list widget
  1468         model->openItem(collectionId);
  1458         model->openItem(collectionId);
  1469         
  1459         
  1470         // deactivat current widget.
  1460         // deactivat current widget.
  1471         if(mCurrentList)
  1461         if(mCurrentList)
  1472         {
  1462         {
  1476         // activate video collection content widget and set it as current list.
  1466         // activate video collection content widget and set it as current list.
  1477         mCurrentList = collectionContentWidget;
  1467         mCurrentList = collectionContentWidget;
  1478         mCurrentList->activate(level);
  1468         mCurrentList->activate(level);
  1479 
  1469 
  1480         updateSubLabel();
  1470         updateSubLabel();
  1481 
       
  1482         model->invalidate();
       
  1483         
  1471         
  1484         // update hint widget for correct content
  1472         // update hint widget for correct content
  1485         mModelReady = model->rowCount() > 0;
  1473         mModelReady = model->rowCount() > 0;
  1486         setHintLevel(VideoHintWidget::Collection);
  1474         setHintLevel(VideoHintWidget::Collection);
  1487 
  1475 
  1488         // update toolbar for albums, default categories don't have one.
  1476         // update toolbar for albums, default categories don't have one. Neither does services.
  1489         if(level == VideoCollectionCommon::ELevelAlbum && 
  1477         toolBar()->clearActions();
       
  1478         if(!mVideoServices && level == VideoCollectionCommon::ELevelAlbum && 
  1490            mToolbarCollectionActionGroup && mToolbarActions.contains(ETBActionCollections))
  1479            mToolbarCollectionActionGroup && mToolbarActions.contains(ETBActionCollections))
  1491         {
  1480         {
  1492             mToolbarActions[ETBActionCollections]->setChecked(false);
  1481             mToolbarActions[ETBActionCollections]->setChecked(false);
  1493             toolBar()->addActions(mToolbarCollectionActionGroup->actions());
  1482             toolBar()->addActions(mToolbarCollectionActionGroup->actions());
  1494         }
  1483             setItemVisible(Hb::ToolBarItem, true);
       
  1484         }
       
  1485         else
       
  1486         {
       
  1487             setItemVisible(Hb::ToolBarItem, false);
       
  1488         }
       
  1489         // restore animations for collection content widget
       
  1490         collectionContentWidget->setEnabledAnimations(animationState);
  1495     }
  1491     }
  1496     else
  1492     else
  1497     {
  1493     {
       
  1494         // clear actions to make sure there is no wrong toolbar in case main 
       
  1495         // toolbar actiongroup actiongroup is missing
       
  1496         toolBar()->clearActions();   
  1498         // open collection view
  1497         // open collection view
  1499         openCollectionViewSlot();
  1498         openCollectionViewSlot();        
  1500         
       
  1501         // update toolbar
  1499         // update toolbar
  1502         if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections))
  1500         if(mToolbarViewsActionGroup && mToolbarActions.contains(ETBActionCollections))
  1503         {
  1501         {                    
  1504             toolBar()->addActions(mToolbarViewsActionGroup->actions());
  1502             toolBar()->addActions(mToolbarViewsActionGroup->actions());
  1505             mToolbarActions[ETBActionCollections]->setChecked(true);
  1503             mToolbarActions[ETBActionCollections]->setChecked(true);
       
  1504             setItemVisible(Hb::ToolBarItem, true);
  1506             
  1505             
  1507             if(mToolbarServiceExtension)
  1506             if(mToolbarServiceExtension)
  1508             {
  1507             {
  1509                 HbAction *action = toolBar()->addExtension(mToolbarServiceExtension);
  1508                 HbAction *action = toolBar()->addExtension(mToolbarServiceExtension);
  1510                 HbIcon icon("qtg_mono_video_services");
  1509                 HbIcon icon("qtg_mono_video_services");
  1511                 action->setIcon(icon);
  1510                 action->setIcon(icon);
  1512             }
  1511             }
  1513         }
  1512         }
  1514     }
  1513     }	
  1515 	// restore animations for collection content widget
       
  1516 	collectionContentWidget->setEnabledAnimations(animationState);
       
  1517 	if(!mVideoServices)
  1514 	if(!mVideoServices)
  1518 	{
  1515 	{
  1519 	    // save / clear collection related activity data
  1516 	    // save / clear collection related activity data
  1520 	    VideoCollectionViewUtils::setCollectionActivityData(collectionId, collection);
  1517 	    VideoCollectionViewUtils::setCollectionActivityData(collectionId, collection);
  1521 	}
  1518 	}