videoplayerapp/videoplayerengine/src/videoplayerengine.cpp
changeset 41 229f037ce963
parent 40 13331705e488
child 42 17f382c040b1
equal deleted inserted replaced
40:13331705e488 41:229f037ce963
    13 *
    13 *
    14 * Description:  Implementation of VideoPlayerEngine
    14 * Description:  Implementation of VideoPlayerEngine
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 33 %
    18 // Version : %version: da1mmcf#35 %
    19 
    19 
    20 
    20 
    21 #include <QApplication>
    21 #include <QApplication>
    22 
    22 
    23 #include <hbinstance.h>
    23 #include <hbinstance.h>
   148     else
   148     else
   149     {
   149     {
   150         // check latest plugin type from activity manager data and create + activate it 
   150         // check latest plugin type from activity manager data and create + activate it 
   151         // CollectionView (default) and playbackview are the ones that are accepted
   151         // CollectionView (default) and playbackview are the ones that are accepted
   152         MpxHbVideoCommon::MpxHbVideoViewType viewType = MpxHbVideoCommon::CollectionView;
   152         MpxHbVideoCommon::MpxHbVideoViewType viewType = MpxHbVideoCommon::CollectionView;
   153         int typeGotten = VideoActivityState::instance().getActivityData(VideoActivityData::KEY_VIEWPLUGIN_TYPE).toInt();
   153         int typeGotten = VideoActivityState::instance().getActivityData(KEY_VIEWPLUGIN_TYPE).toInt();
   154         if(typeGotten == MpxHbVideoCommon::CollectionView || typeGotten == MpxHbVideoCommon::PlaybackView)
   154         
   155         {
   155         if ( typeGotten == MpxHbVideoCommon::PlaybackView )  
       
   156         {
       
   157             createPlaybackView(); 
   156             viewType = MpxHbVideoCommon::MpxHbVideoViewType(typeGotten);
   158             viewType = MpxHbVideoCommon::MpxHbVideoViewType(typeGotten);
   157         }
   159             QVariant data = VideoActivityState::instance().getActivityData(KEY_LAST_PLAYED_CLIP);
   158         loadPluginAndCreateView( viewType );  
   160             playMedia( data.toString() );
   159         activateView( viewType );
   161         }
       
   162         else
       
   163         {
       
   164             loadPluginAndCreateView( viewType );  
       
   165             activateView( viewType );        
       
   166         }
   160     }
   167     }
   161             
   168             
   162 }
   169 }
   163 
   170 
   164 // -------------------------------------------------------------------------------------------------
   171 // -------------------------------------------------------------------------------------------------
   460             
   467             
   461         QVariant data = QVariant();
   468         QVariant data = QVariant();
   462         HbActivityManager *actManager = qobject_cast<HbApplication*>(qApp)->activityManager();
   469         HbActivityManager *actManager = qobject_cast<HbApplication*>(qApp)->activityManager();
   463         
   470         
   464         //
   471         //
       
   472         // deactivate is the final point for current plugin to save it's activity data into 
       
   473         // VideoActivityState before they are saved to to activity manager
       
   474         //
       
   475         mCurrentViewPlugin->deactivateView();        
       
   476         
       
   477         //
   465         // get and save recent view type: either playback or collection view plugins are currently used.
   478         // get and save recent view type: either playback or collection view plugins are currently used.
   466         // activity will not be saved from the details plugin
   479         // activity will not be saved from the details plugin
   467         //
   480         //
   468         int viewType = MpxHbVideoCommon::CollectionView;
   481         int viewType = MpxHbVideoCommon::CollectionView;
   469         if(mCurrentViewPlugin == mPlaybackViewPlugin)
   482         if(mCurrentViewPlugin == mPlaybackViewPlugin)
   470         {
   483         {
   471             viewType = MpxHbVideoCommon::PlaybackView;
   484             // for playback view, the state preservation and restoration should only be done
   472         }
   485             // for loacl clips (non-streaming) - so set KEY_VIEWPLUGIN_TYPE to PlaybackView only
       
   486             // for local clips. Otherwise the default value CollectionView should be set.
       
   487             //
       
   488             QVariant playdata = VideoActivityState::instance().getActivityData(KEY_LAST_LOCAL_PLAYBACK);
       
   489             if  ( playdata.toBool() )
       
   490             {
       
   491                 viewType = MpxHbVideoCommon::PlaybackView;
       
   492             }            
       
   493         }
       
   494         
   473         data = viewType;
   495         data = viewType;
   474         localActivity.setActivityData(data, VideoActivityData::KEY_VIEWPLUGIN_TYPE);
   496         localActivity.setActivityData(data, KEY_VIEWPLUGIN_TYPE);
   475         
       
   476         //
       
   477         // deactivate is the final point for current plugin to save it's activity data into 
       
   478         // VideoActivityState before they are saved to to activity manager
       
   479         //
       
   480         mCurrentViewPlugin->deactivateView();
       
   481         
   497         
   482         // save data to activity manager
   498         // save data to activity manager
   483         actManager->addActivity(ACTIVITY_VIDEOPLAYER_MAINVIEW, 
   499         actManager->addActivity(ACTIVITY_VIDEOPLAYER_MAINVIEW, 
   484                                 localActivity.getActivityData(),
   500                                 localActivity.getActivityData(),
   485                                 QVariantHash());                
   501                                 QVariantHash());