58 // ------------------------------------------------------------------------------------------------- |
58 // ------------------------------------------------------------------------------------------------- |
59 // |
59 // |
60 QVideoPlayerEngine::~QVideoPlayerEngine() |
60 QVideoPlayerEngine::~QVideoPlayerEngine() |
61 { |
61 { |
62 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::~QVideoPlayerEngine()")); |
62 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::~QVideoPlayerEngine()")); |
63 |
63 |
64 if ( mVideoServices ) |
64 if ( mVideoServices ) |
65 { |
65 { |
66 mVideoServices->decreaseReferenceCount(); |
66 mVideoServices->decreaseReferenceCount(); |
67 mVideoServices = 0; |
67 mVideoServices = 0; |
68 } |
68 } |
69 |
69 |
70 if ( mCollectionViewPlugin ) |
70 if ( mCollectionViewPlugin ) |
71 { |
71 { |
72 mCollectionViewPlugin->destroyView(); |
72 mCollectionViewPlugin->destroyView(); |
73 delete mCollectionViewPlugin; |
73 delete mCollectionViewPlugin; |
74 mCollectionViewPlugin = 0; |
74 mCollectionViewPlugin = 0; |
75 } |
75 } |
76 |
76 |
77 if ( mPlaybackViewPlugin ) |
77 if ( mPlaybackViewPlugin ) |
78 { |
78 { |
79 mPlaybackViewPlugin->destroyView(); |
79 mPlaybackViewPlugin->destroyView(); |
80 delete mPlaybackViewPlugin; |
80 delete mPlaybackViewPlugin; |
81 mPlaybackViewPlugin = 0; |
81 mPlaybackViewPlugin = 0; |
82 } |
82 } |
83 |
83 |
84 if ( mFileDetailsViewPlugin ) |
84 if ( mFileDetailsViewPlugin ) |
85 { |
85 { |
86 mFileDetailsViewPlugin->destroyView(); |
86 mFileDetailsViewPlugin->destroyView(); |
87 delete mFileDetailsViewPlugin; |
87 delete mFileDetailsViewPlugin; |
88 mFileDetailsViewPlugin = 0; |
88 mFileDetailsViewPlugin = 0; |
89 } |
89 } |
90 |
90 |
91 delete mPlaybackWrapper; |
91 delete mPlaybackWrapper; |
92 |
92 |
93 // disconnect all signals |
93 // disconnect all signals |
94 disconnect(); |
94 disconnect(); |
95 } |
95 } |
96 |
96 |
97 // ------------------------------------------------------------------------------------------------- |
97 // ------------------------------------------------------------------------------------------------- |
98 // initialize() |
98 // initialize() |
99 // ------------------------------------------------------------------------------------------------- |
99 // ------------------------------------------------------------------------------------------------- |
100 // |
100 // |
101 void QVideoPlayerEngine::initialize() |
101 void QVideoPlayerEngine::initialize() |
102 { |
102 { |
103 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::initialize()")); |
103 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::initialize()")); |
104 |
104 |
105 // |
105 // |
106 // Clean up QVideoPlayerEngine when qApp try to quit |
106 // Clean up QVideoPlayerEngine when qApp try to quit |
107 // |
107 // |
108 connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( handleQuit() ) ); |
108 connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( handleQuit() ) ); |
109 |
109 |
119 SLOT( handleCommand( int ) ) ); |
119 SLOT( handleCommand( int ) ) ); |
120 } |
120 } |
121 |
121 |
122 QList<XQPluginInfo> impls; |
122 QList<XQPluginInfo> impls; |
123 XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls); |
123 XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls); |
124 |
124 |
125 if ( mIsService ) |
125 if ( mIsService ) |
126 { |
126 { |
127 if(!mVideoServices) |
127 if(!mVideoServices) |
128 { |
128 { |
129 mVideoServices = VideoServices::instance(this); |
129 mVideoServices = VideoServices::instance(this); |
130 connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int))); |
130 connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int))); |
131 } |
131 } |
132 if ( isPlayServiceInvoked() ) |
132 if ( isPlayServiceInvoked() ) |
133 { |
133 { |
134 createPlaybackView(); |
134 createPlaybackView(); |
135 } |
135 } |
136 else |
136 else |
137 { |
137 { |
138 loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); |
138 loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); |
139 |
139 |
140 // Browse service will activate view once the category to be opened is informed from highway |
140 // Browse service will activate view once the category to be opened is informed from highway |
141 // since the category is not known at this point, we do not activate view for it here |
141 // since the category is not known at this point, we do not activate view for it here |
142 if(!(XQServiceUtil::interfaceName().contains("IVideoBrowse"))) |
142 if(!(XQServiceUtil::interfaceName().contains("IVideoBrowse"))) |
143 { |
143 { |
144 activateView( MpxHbVideoCommon::CollectionView ); |
144 activateView( MpxHbVideoCommon::CollectionView ); |
145 } |
145 } |
146 } |
146 } |
147 } |
147 } |
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(KEY_VIEWPLUGIN_TYPE).toInt(); |
153 int typeGotten = VideoActivityState::instance().getActivityData(KEY_VIEWPLUGIN_TYPE).toInt(); |
154 |
154 |
155 if ( typeGotten == MpxHbVideoCommon::PlaybackView ) |
155 if ( typeGotten == MpxHbVideoCommon::PlaybackView ) |
156 { |
156 { |
157 createPlaybackView(); |
157 createPlaybackView(); |
158 viewType = MpxHbVideoCommon::MpxHbVideoViewType(typeGotten); |
158 viewType = MpxHbVideoCommon::MpxHbVideoViewType(typeGotten); |
159 QVariant data = VideoActivityState::instance().getActivityData(KEY_LAST_PLAYED_CLIP); |
159 QVariant data = VideoActivityState::instance().getActivityData(KEY_LAST_PLAYED_CLIP); |
160 playMedia( data.toString() ); |
160 playMedia( data.toString() ); |
161 } |
161 } |
162 else |
162 else |
163 { |
163 { |
164 loadPluginAndCreateView( viewType ); |
164 loadPluginAndCreateView( viewType ); |
165 activateView( viewType ); |
165 activateView( viewType ); |
166 } |
166 } |
167 } |
167 } |
168 |
|
169 } |
168 } |
170 |
169 |
171 // ------------------------------------------------------------------------------------------------- |
170 // ------------------------------------------------------------------------------------------------- |
172 // handleCommand() |
171 // handleCommand() |
173 // ------------------------------------------------------------------------------------------------- |
172 // ------------------------------------------------------------------------------------------------- |
174 // |
173 // |
175 void QVideoPlayerEngine::handleCommand( int commandCode ) |
174 void QVideoPlayerEngine::handleCommand( int commandCode ) |
176 { |
175 { |
177 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::handleCommand()"), |
176 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::handleCommand()"), |
178 _L("commandCode = %d"), commandCode ); |
177 _L("commandCode = %d"), commandCode ); |
179 |
178 |
180 switch ( commandCode ) |
179 switch ( commandCode ) |
181 { |
180 { |
182 case MpxHbVideoCommon::ActivateCollectionView: |
181 case MpxHbVideoCommon::ActivateCollectionView: |
183 { |
182 { |
184 if ( mCurrentViewPlugin != mCollectionViewPlugin ) |
183 if ( mCurrentViewPlugin != mCollectionViewPlugin ) |
185 { |
184 { |
186 activateView( MpxHbVideoCommon::CollectionView ); |
185 activateView( MpxHbVideoCommon::CollectionView ); |
187 } |
186 } |
188 break; |
187 break; |
189 } |
188 } |
190 case MpxHbVideoCommon::ActivatePlaybackView: |
189 case MpxHbVideoCommon::ActivatePlaybackView: |
191 { |
190 { |
192 if ( mCurrentViewPlugin != mPlaybackViewPlugin ) |
191 if ( mCurrentViewPlugin != mPlaybackViewPlugin ) |
193 { |
192 { |
194 activateView( MpxHbVideoCommon::PlaybackView ); |
193 activateView( MpxHbVideoCommon::PlaybackView ); |
195 } |
194 } |
196 break; |
195 break; |
197 } |
196 } |
198 case MpxHbVideoCommon::ActivateVideoDetailsView: |
197 case MpxHbVideoCommon::ActivateVideoDetailsView: |
199 { |
198 { |
200 if ( mCurrentViewPlugin != mFileDetailsViewPlugin ) |
199 if ( mCurrentViewPlugin != mFileDetailsViewPlugin ) |
201 { |
200 { |
202 activateView( MpxHbVideoCommon::VideoDetailsView ); |
201 activateView( MpxHbVideoCommon::VideoDetailsView ); |
203 } |
202 } |
204 break; |
203 break; |
205 } |
204 } |
206 case MpxHbVideoCommon::DoDelayedLoad: |
205 case MpxHbVideoCommon::DoDelayedLoad: |
207 { |
206 { |
209 { |
208 { |
210 doDelayedLoad(); |
209 doDelayedLoad(); |
211 } |
210 } |
212 break; |
211 break; |
213 } |
212 } |
214 |
213 |
215 default: |
214 default: |
216 { |
215 { |
217 break; |
216 break; |
218 } |
217 } |
219 } |
218 } |
220 } |
219 } |
221 |
220 |
222 // ------------------------------------------------------------------------------------------------- |
221 // ------------------------------------------------------------------------------------------------- |
223 // doDelayedLoad() |
222 // doDelayedLoad() |
224 // ------------------------------------------------------------------------------------------------- |
223 // ------------------------------------------------------------------------------------------------- |
225 // |
224 // |
226 void QVideoPlayerEngine::doDelayedLoad() |
225 void QVideoPlayerEngine::doDelayedLoad() |
227 { |
226 { |
228 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::doDelayedLoad()")); |
227 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::doDelayedLoad()")); |
229 |
228 |
230 createMissingViews(); |
229 createMissingViews(); |
231 |
230 |
232 mDelayedLoadDone = true; |
231 mDelayedLoadDone = true; |
233 } |
232 } |
234 |
233 |
235 // ------------------------------------------------------------------------------------------------- |
234 // ------------------------------------------------------------------------------------------------- |
236 // createPlaybackView() |
235 // createPlaybackView() |
237 // ------------------------------------------------------------------------------------------------- |
236 // ------------------------------------------------------------------------------------------------- |
238 // |
237 // |
239 void QVideoPlayerEngine::createPlaybackView() |
238 void QVideoPlayerEngine::createPlaybackView() |
240 { |
239 { |
|
240 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::createPlaybackView()")); |
|
241 |
241 mPlaybackWrapper->lateInit(); |
242 mPlaybackWrapper->lateInit(); |
242 |
243 |
243 if ( ! mPlaybackViewPlugin ) |
244 if ( ! mPlaybackViewPlugin ) |
244 { |
245 { |
245 loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); |
246 loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); |
246 } |
247 } |
247 } |
248 } |
294 case MpxHbVideoCommon::CollectionView: |
295 case MpxHbVideoCommon::CollectionView: |
295 { |
296 { |
296 if ( shouldExit() ) |
297 if ( shouldExit() ) |
297 { |
298 { |
298 qApp->quit(); |
299 qApp->quit(); |
299 XQServiceUtil::toBackground( false ); |
300 XQServiceUtil::toBackground( false ); |
300 } |
301 } |
301 else if ( shouldActivateCollectionView() ) |
302 else if ( shouldActivateCollectionView() ) |
302 { |
303 { |
303 if ( ! mCollectionViewPlugin ) |
304 if ( ! mCollectionViewPlugin ) |
304 { |
305 { |
305 loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); |
306 loadPluginAndCreateView( MpxHbVideoCommon::CollectionView ); |
306 } |
307 } |
307 mCurrentViewPlugin = mCollectionViewPlugin; |
308 mCurrentViewPlugin = mCollectionViewPlugin; |
308 setCurrentView(); |
309 setCurrentView(); |
309 } |
310 } |
310 |
311 |
311 break; |
312 break; |
312 } |
313 } |
313 case MpxHbVideoCommon::PlaybackView: |
314 case MpxHbVideoCommon::PlaybackView: |
314 { |
315 { |
315 if ( ! mPlaybackViewPlugin ) |
316 if ( ! mPlaybackViewPlugin ) |
316 { |
317 { |
317 loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); |
318 loadPluginAndCreateView( MpxHbVideoCommon::PlaybackView ); |
318 } |
319 } |
319 |
320 |
320 mCurrentViewPlugin = mPlaybackViewPlugin; |
321 mCurrentViewPlugin = mPlaybackViewPlugin; |
321 setCurrentView(); |
322 setCurrentView(); |
322 |
323 |
323 break; |
324 break; |
324 } |
325 } |
325 case MpxHbVideoCommon::VideoDetailsView: |
326 case MpxHbVideoCommon::VideoDetailsView: |
326 { |
327 { |
327 if ( ! mFileDetailsViewPlugin ) |
328 if ( ! mFileDetailsViewPlugin ) |
328 { |
329 { |
329 loadPluginAndCreateView( MpxHbVideoCommon::VideoDetailsView ); |
330 loadPluginAndCreateView( MpxHbVideoCommon::VideoDetailsView ); |
330 } |
331 } |
331 |
332 |
332 mCurrentViewPlugin = mFileDetailsViewPlugin; |
333 mCurrentViewPlugin = mFileDetailsViewPlugin; |
333 setCurrentView(); |
334 setCurrentView(); |
334 |
335 |
335 break; |
336 break; |
336 } |
337 } |
337 } |
338 } |
338 } |
339 } |
339 |
340 |
340 // ------------------------------------------------------------------------------------------------- |
341 // ------------------------------------------------------------------------------------------------- |
341 // loadPluginAndCreateView() |
342 // loadPluginAndCreateView() |
342 // ------------------------------------------------------------------------------------------------- |
343 // ------------------------------------------------------------------------------------------------- |
343 // |
344 // |
344 void QVideoPlayerEngine::loadPluginAndCreateView( MpxHbVideoCommon::MpxHbVideoViewType viewType ) |
345 void QVideoPlayerEngine::loadPluginAndCreateView( MpxHbVideoCommon::MpxHbVideoViewType viewType ) |
345 { |
346 { |
346 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::loadPluginAndCreateView() "), |
347 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::loadPluginAndCreateView() "), |
347 _L("viewType = %d"), viewType ); |
348 _L("viewType = %d"), viewType ); |
348 |
349 |
349 int viewTypeUid( 0 ); |
350 int viewTypeUid( 0 ); |
350 |
351 |
351 if ( viewType == MpxHbVideoCommon::CollectionView ) |
352 if ( viewType == MpxHbVideoCommon::CollectionView ) |
352 { |
353 { |
353 viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllCollectionUid; |
354 viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllCollectionUid; |
354 } |
355 } |
355 else if ( viewType == MpxHbVideoCommon::PlaybackView ) |
356 else if ( viewType == MpxHbVideoCommon::PlaybackView ) |
356 { |
357 { |
357 viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllPlaybackUid; |
358 viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllPlaybackUid; |
358 } |
359 } |
359 else if ( viewType == MpxHbVideoCommon::VideoDetailsView ) |
360 else if ( viewType == MpxHbVideoCommon::VideoDetailsView ) |
360 { |
361 { |
361 viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllFileDetailsUid; |
362 viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllFileDetailsUid; |
362 } |
363 } |
363 |
364 |
364 if ( viewTypeUid ) |
365 if ( viewTypeUid ) |
365 { |
366 { |
366 // |
367 // |
367 // load corresponding plug-in |
368 // load corresponding plug-in |
368 // |
369 // |
369 XQPluginLoader pluginLoader( viewTypeUid ); |
370 XQPluginLoader pluginLoader( viewTypeUid ); |
370 QObject* instance = pluginLoader.instance(); |
371 QObject* instance = pluginLoader.instance(); |
371 |
372 |
372 if ( instance ) |
373 if ( instance ) |
373 { |
374 { |
374 MpxViewPlugin *currentViewPlugin = NULL; |
375 MpxViewPlugin *currentViewPlugin = NULL; |
375 |
376 |
376 if ( viewType == MpxHbVideoCommon::CollectionView ) |
377 if ( viewType == MpxHbVideoCommon::CollectionView ) |
377 { |
378 { |
378 mCollectionViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin(); |
379 mCollectionViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin(); |
379 currentViewPlugin = mCollectionViewPlugin; |
380 currentViewPlugin = mCollectionViewPlugin; |
380 } |
381 } |
381 else if ( viewType == MpxHbVideoCommon::PlaybackView ) |
382 else if ( viewType == MpxHbVideoCommon::PlaybackView ) |
388 mFileDetailsViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin(); |
389 mFileDetailsViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin(); |
389 currentViewPlugin = mFileDetailsViewPlugin; |
390 currentViewPlugin = mFileDetailsViewPlugin; |
390 } |
391 } |
391 else |
392 else |
392 { |
393 { |
393 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : plugin not FOUND ! ")); |
394 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : plugin not FOUND ! ")); |
394 } |
395 } |
395 |
396 |
396 // |
397 // |
397 // create corresponding view |
398 // create corresponding view |
398 // |
399 // |
399 if ( currentViewPlugin ) |
400 if ( currentViewPlugin ) |
400 { |
401 { |
401 QGraphicsWidget *view = currentViewPlugin->getView(); |
402 QGraphicsWidget *view = currentViewPlugin->getView(); |
402 |
403 |
403 if ( ! view ) |
404 if ( ! view ) |
404 { |
405 { |
405 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : create view ")); |
406 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : create view ")); |
406 |
407 |
407 currentViewPlugin->createView(); |
408 currentViewPlugin->createView(); |
408 hbInstance->allMainWindows().value(0)->addView( currentViewPlugin->getView() ); |
409 hbInstance->allMainWindows().value(0)->addView( currentViewPlugin->getView() ); |
409 } |
410 } |
410 else |
411 else |
411 { |
412 { |
412 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : view has already been created! ")); |
413 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : view has already been created! ")); |
413 } |
414 } |
414 } |
415 } |
415 else |
416 else |
416 { |
417 { |
417 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : currentViewPlugin is NULL ! ")); |
418 MPX_DEBUG(_L("QVideoPlayerEngine::loadPluginAndCreateView() : currentViewPlugin is NULL ! ")); |
418 } |
419 } |
419 } |
420 } |
420 } |
421 } |
421 } |
422 } |
422 |
423 |
423 // ------------------------------------------------------------------------------------------------- |
424 // ------------------------------------------------------------------------------------------------- |
441 // ------------------------------------------------------------------------------------------------- |
442 // ------------------------------------------------------------------------------------------------- |
442 // |
443 // |
443 void QVideoPlayerEngine::disconnectView() |
444 void QVideoPlayerEngine::disconnectView() |
444 { |
445 { |
445 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::disconnectView()")); |
446 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::disconnectView()")); |
446 |
447 |
447 if ( mCurrentViewPlugin ) |
448 if ( mCurrentViewPlugin ) |
448 { |
449 { |
449 disconnect( mCurrentViewPlugin, |
450 disconnect( mCurrentViewPlugin, |
450 SIGNAL( command( int ) ), |
451 SIGNAL( command( int ) ), |
451 this, |
452 this, |
452 SLOT( handleCommand( int ) ) ); |
453 SLOT( handleCommand( int ) ) ); |
453 } |
454 } |
454 } |
455 } |
455 |
456 |
456 // ------------------------------------------------------------------------------------------------- |
457 // ------------------------------------------------------------------------------------------------- |
457 // handleQuit() |
458 // handleQuit() |
458 // ------------------------------------------------------------------------------------------------- |
459 // ------------------------------------------------------------------------------------------------- |
459 // |
460 // |
460 void QVideoPlayerEngine::handleQuit() |
461 void QVideoPlayerEngine::handleQuit() |
461 { |
462 { |
462 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::handleQuit()")); |
463 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::handleQuit()")); |
463 |
464 |
464 if(!mIsService) |
465 if(!mIsService) |
465 { |
466 { |
466 VideoActivityState &localActivity(VideoActivityState::instance()); |
467 VideoActivityState &localActivity(VideoActivityState::instance()); |
467 |
468 |
468 QVariant data = QVariant(); |
469 QVariant data = QVariant(); |
469 HbActivityManager *actManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
470 HbActivityManager *actManager = qobject_cast<HbApplication*>(qApp)->activityManager(); |
470 |
471 |
471 // |
472 // |
472 // deactivate is the final point for current plugin to save it's activity data into |
473 // 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 // VideoActivityState before they are saved to to activity manager |
474 // |
475 // |
475 mCurrentViewPlugin->deactivateView(); |
476 mCurrentViewPlugin->deactivateView(); |
476 |
477 |
477 // |
478 // |
478 // get and save recent view type: either playback or collection view plugins are currently used. |
479 // get and save recent view type: either playback or collection view plugins are currently used. |
479 // activity will not be saved from the details plugin |
480 // activity will not be saved from the details plugin |
480 // |
481 // |
481 int viewType = MpxHbVideoCommon::CollectionView; |
482 int viewType = MpxHbVideoCommon::CollectionView; |
487 // |
488 // |
488 QVariant playdata = VideoActivityState::instance().getActivityData(KEY_LAST_LOCAL_PLAYBACK); |
489 QVariant playdata = VideoActivityState::instance().getActivityData(KEY_LAST_LOCAL_PLAYBACK); |
489 if ( playdata.toBool() ) |
490 if ( playdata.toBool() ) |
490 { |
491 { |
491 viewType = MpxHbVideoCommon::PlaybackView; |
492 viewType = MpxHbVideoCommon::PlaybackView; |
492 } |
493 } |
493 } |
494 } |
494 |
495 |
495 data = viewType; |
496 data = viewType; |
496 localActivity.setActivityData(data, KEY_VIEWPLUGIN_TYPE); |
497 localActivity.setActivityData(data, KEY_VIEWPLUGIN_TYPE); |
497 |
498 |
498 // save data to activity manager |
499 // save data to activity manager |
499 actManager->addActivity(ACTIVITY_VIDEOPLAYER_MAINVIEW, |
500 actManager->addActivity(ACTIVITY_VIDEOPLAYER_MAINVIEW, |
500 localActivity.getActivityData(), |
501 localActivity.getActivityData(), |
501 QVariantHash()); |
502 QVariantHash()); |
502 } |
503 } |
503 |
504 |
504 delete this; |
505 delete this; |
505 } |
506 } |
506 |
507 |
507 |
508 |
508 // ------------------------------------------------------------------------------------------------- |
509 // ------------------------------------------------------------------------------------------------- |
510 // ------------------------------------------------------------------------------------------------- |
511 // ------------------------------------------------------------------------------------------------- |
511 // |
512 // |
512 void QVideoPlayerEngine::playMedia( QString filePath ) |
513 void QVideoPlayerEngine::playMedia( QString filePath ) |
513 { |
514 { |
514 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::playMedia()"), |
515 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::playMedia()"), |
515 _L("filePath = %s"), filePath.data() ); |
516 _L("filePath = %s"), filePath.data() ); |
516 |
517 |
517 mPlaybackWrapper->playMedia( filePath ); |
518 mPlaybackWrapper->playMedia( filePath ); |
518 } |
519 } |
519 |
520 |
520 // ------------------------------------------------------------------------------------------------- |
521 // ------------------------------------------------------------------------------------------------- |
521 // playMedia() |
522 // playMedia() |
522 // ------------------------------------------------------------------------------------------------- |
523 // ------------------------------------------------------------------------------------------------- |
523 // |
524 // |
524 void QVideoPlayerEngine::playMedia( RFile file ) |
525 void QVideoPlayerEngine::playMedia( RFile file ) |
525 { |
526 { |
526 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::playMedia( RFile )")); |
527 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::playMedia( RFile )")); |
527 |
528 |
528 mPlaybackWrapper->playMedia( file ); |
529 mPlaybackWrapper->playMedia( file ); |
529 } |
530 } |
530 |
531 |
531 // ------------------------------------------------------------------------------------------------- |
532 // ------------------------------------------------------------------------------------------------- |
532 // setEmbedded() |
533 // setEmbedded() |
533 // ------------------------------------------------------------------------------------------------- |
534 // ------------------------------------------------------------------------------------------------- |
534 // |
535 // |
535 void QVideoPlayerEngine::setEmbedded() |
536 void QVideoPlayerEngine::setEmbedded() |
536 { |
537 { |
537 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::setEmbedded()")); |
538 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::setEmbedded()")); |
538 |
539 |
539 mEmbedded = true; |
540 mEmbedded = true; |
540 } |
541 } |
541 |
542 |
542 // ------------------------------------------------------------------------------------------------- |
543 // ------------------------------------------------------------------------------------------------- |
543 // setCurrentView() |
544 // setCurrentView() |
544 // ------------------------------------------------------------------------------------------------- |
545 // ------------------------------------------------------------------------------------------------- |
545 // |
546 // |
546 void QVideoPlayerEngine::setCurrentView() |
547 void QVideoPlayerEngine::setCurrentView() |
547 { |
548 { |
548 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::setCurrentView()")); |
549 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::setCurrentView()")); |
549 |
550 |
550 if ( mCurrentViewPlugin ) |
551 if ( mCurrentViewPlugin ) |
551 { |
552 { |
552 // |
553 // |
553 // set current view |
554 // set current view |
554 // |
555 // |
555 hbInstance->allMainWindows().value(0)->setCurrentView( |
556 hbInstance->allMainWindows().value(0)->setCurrentView( |
556 qobject_cast<HbView*>( mCurrentViewPlugin->getView() ), false ); |
557 qobject_cast<HbView*>( mCurrentViewPlugin->getView() ), false ); |
557 |
558 |
558 // |
559 // |
559 // connect view |
560 // connect view |
560 // |
561 // |
561 connectView(); |
562 connectView(); |
562 |
563 |
563 // |
564 // |
564 // activate view |
565 // activate view |
565 // |
566 // |
566 mCurrentViewPlugin->activateView(); |
567 mCurrentViewPlugin->activateView(); |
567 } |
568 } |
568 } |
569 } |
571 // isPlayServiceInvoked() |
572 // isPlayServiceInvoked() |
572 // ------------------------------------------------------------------------------------------------- |
573 // ------------------------------------------------------------------------------------------------- |
573 // |
574 // |
574 bool QVideoPlayerEngine::isPlayServiceInvoked() |
575 bool QVideoPlayerEngine::isPlayServiceInvoked() |
575 { |
576 { |
576 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::isPlayServiceInvoked()")); |
577 MPX_ENTER_EXIT(_L("QVideoPlayerEngine::isPlayServiceInvoked()")); |
577 |
578 |
578 bool result = false; |
579 bool result = false; |
579 |
580 |
580 if ( mIsService ) |
581 if ( mIsService ) |
581 { |
582 { |
582 QString intface = XQServiceUtil::interfaceName(); |
583 QString intface = XQServiceUtil::interfaceName(); |
583 |
584 |
584 if ( intface.contains("IVideoView") || |
585 if ( intface.contains("IVideoView") || |
585 intface.contains("IFileView") ) |
586 intface.contains("IFileView") ) |
586 { |
587 { |
587 result = true; |
588 result = true; |
588 mIsPlayService = true; |
589 mIsPlayService = true; |
589 } |
590 } |
590 } |
591 } |
591 |
592 |
592 return result; |
593 return result; |
593 } |
594 } |
594 |
595 |
595 // ------------------------------------------------------------------------------------------------- |
596 // ------------------------------------------------------------------------------------------------- |
596 // shouldExit() |
597 // shouldExit() |
597 // ------------------------------------------------------------------------------------------------- |
598 // ------------------------------------------------------------------------------------------------- |
598 // |
599 // |
599 bool QVideoPlayerEngine::shouldExit() |
600 bool QVideoPlayerEngine::shouldExit() |
600 { |
601 { |
601 bool result = false; |
602 bool result = false; |
602 |
603 |
603 if ( mIsPlayService ) // play or view service |
604 if ( mIsPlayService ) // play or view service |
604 { |
605 { |
605 result = true; |
606 result = true; |
606 } |
607 } |
607 |
608 |
608 MPX_DEBUG(_L("QVideoPlayerEngine::shouldExit() return %d"), result); |
609 MPX_DEBUG(_L("QVideoPlayerEngine::shouldExit() return %d"), result); |
609 |
610 |
610 return result; |
611 return result; |
611 } |
612 } |
612 |
613 |
613 |
614 |
614 // ------------------------------------------------------------------------------------------------- |
615 // ------------------------------------------------------------------------------------------------- |
615 // shouldActivateCollectionView() |
616 // shouldActivateCollectionView() |
616 // ------------------------------------------------------------------------------------------------- |
617 // ------------------------------------------------------------------------------------------------- |
617 // |
618 // |
618 bool QVideoPlayerEngine::shouldActivateCollectionView() |
619 bool QVideoPlayerEngine::shouldActivateCollectionView() |
619 { |
620 { |
620 bool result = true; |
621 bool result = true; |
621 |
622 |
622 // the only case where collection view should NOT be activated is ... |
623 // the only case where collection view should NOT be activated is ... |
623 // if we are in service and that service is fetch and if fetch is selected |
624 // if we are in service and that service is fetch and if fetch is selected |
624 // in all other cases collection view should be activated |
625 // in all other cases collection view should be activated |
625 |
626 |
626 if ( mIsService && |
627 if ( mIsService && |
627 mVideoServices->currentService() == VideoServices::EUriFetcher && |
628 mVideoServices->currentService() == VideoServices::EUriFetcher && |
628 mVideoServices->mFetchSelected ) |
629 mVideoServices->mFetchSelected ) |
629 { |
630 { |
630 result = false; |
631 result = false; |
631 } |
632 } |
632 |
633 |
633 MPX_DEBUG(_L("QVideoPlayerEngine::shouldActivateCollectionView() return %d"), result); |
634 MPX_DEBUG(_L("QVideoPlayerEngine::shouldActivateCollectionView() return %d"), result); |
634 |
635 |
635 return result; |
636 return result; |
636 } |
637 } |
637 |
638 |
638 // End of file |
639 // End of file |