equal
deleted
inserted
replaced
29 #include "mpviewbase.h" |
29 #include "mpviewbase.h" |
30 #include "musicservices.h" |
30 #include "musicservices.h" |
31 #include "mpenginefactory.h" |
31 #include "mpenginefactory.h" |
32 #include "mpsettingsmanager.h" |
32 #include "mpsettingsmanager.h" |
33 #include "mpglobalpopuphandler.h" |
33 #include "mpglobalpopuphandler.h" |
|
34 #include "mpmediacontroller.h" |
34 #include "mptrace.h" |
35 #include "mptrace.h" |
35 |
36 |
36 const QString MUSIC_MAIN_VIEW = "MusicMainView"; |
37 const QString MUSIC_MAIN_VIEW = "MusicMainView"; |
37 const QString MUSIC_NOW_PLAYING_VIEW = "MusicNowPlayingView"; |
38 const QString MUSIC_NOW_PLAYING_VIEW = "MusicNowPlayingView"; |
38 |
39 |
58 mCurrentViewPlugin(0), |
59 mCurrentViewPlugin(0), |
59 mVerticalViewType( CollectionView ), |
60 mVerticalViewType( CollectionView ), |
60 mMusicServices(0), |
61 mMusicServices(0), |
61 mPopupHandler(0), |
62 mPopupHandler(0), |
62 mUserExit( false ), |
63 mUserExit( false ), |
63 mActivityManager(0) |
64 mActivityManager(0), |
|
65 mMpMediaController(0) |
64 { |
66 { |
65 TX_LOG |
67 TX_LOG |
66 } |
68 } |
67 |
69 |
68 /*! |
70 /*! |
92 delete mDetailsViewPlugin; |
94 delete mDetailsViewPlugin; |
93 } |
95 } |
94 if (mMediaWallViewPlugin) { |
96 if (mMediaWallViewPlugin) { |
95 mMediaWallViewPlugin->destroyView(); |
97 mMediaWallViewPlugin->destroyView(); |
96 delete mMediaWallViewPlugin; |
98 delete mMediaWallViewPlugin; |
97 } |
99 } |
|
100 |
|
101 delete mMpMediaController; |
|
102 |
98 MpEngineFactory::close(); |
103 MpEngineFactory::close(); |
99 |
104 |
100 |
105 |
101 TX_EXIT |
106 TX_EXIT |
102 } |
107 } |
181 mActivityManager->waitActivity(); |
186 mActivityManager->waitActivity(); |
182 mActivityManager->removeActivity( MUSIC_MAIN_VIEW ); |
187 mActivityManager->removeActivity( MUSIC_MAIN_VIEW ); |
183 mActivityManager->removeActivity( MUSIC_NOW_PLAYING_VIEW ); |
188 mActivityManager->removeActivity( MUSIC_NOW_PLAYING_VIEW ); |
184 connect( app, SIGNAL( activate() ), this , SLOT( handleActivity() ) ); |
189 connect( app, SIGNAL( activate() ), this , SLOT( handleActivity() ) ); |
185 connect( app, SIGNAL( aboutToQuit() ), this, SLOT( saveActivity() ) ); |
190 connect( app, SIGNAL( aboutToQuit() ), this, SLOT( saveActivity() ) ); |
|
191 mMpMediaController = new MpMediaController(); |
186 emit applicationReady(); |
192 emit applicationReady(); |
187 |
193 |
188 } |
194 } |
189 else { |
195 else { |
190 setOrientation(Qt::Vertical, true);//This sould prevent media wall activation. |
196 setOrientation(Qt::Vertical, true);//This sould prevent media wall activation. |
224 activateView(SettingsView); |
230 activateView(SettingsView); |
225 break; |
231 break; |
226 case MpCommon::ActivateDetailsView: |
232 case MpCommon::ActivateDetailsView: |
227 activateView(DetailsView); |
233 activateView(DetailsView); |
228 break; |
234 break; |
|
235 case MpCommon::ActivatePreviousView: |
|
236 activateView(mVerticalViewType); |
|
237 break; |
229 } |
238 } |
230 TX_EXIT |
239 TX_EXIT |
231 } |
240 } |
232 |
241 |
233 /*! |
242 /*! |
270 // loadView will not reload the view if is already loaded. |
279 // loadView will not reload the view if is already loaded. |
271 mCurrentViewPlugin = loadView( viewType ); |
280 mCurrentViewPlugin = loadView( viewType ); |
272 Q_ASSERT( mCurrentViewPlugin ); |
281 Q_ASSERT( mCurrentViewPlugin ); |
273 |
282 |
274 if ( mCurrentViewPlugin ) { |
283 if ( mCurrentViewPlugin ) { |
275 if ( viewType != MediaWallView ) { |
284 if ( viewType != MediaWallView && viewType != DetailsView ) { |
276 mVerticalViewType = viewType; |
285 mVerticalViewType = viewType; |
277 } |
286 } |
278 addView( reinterpret_cast<HbView*>( mCurrentViewPlugin->getView() ) ); |
287 addView( reinterpret_cast<HbView*>( mCurrentViewPlugin->getView() ) ); |
279 setCurrentView( reinterpret_cast<HbView*>( mCurrentViewPlugin->getView() ) , doTransition , transitionFlags); |
288 setCurrentView( reinterpret_cast<HbView*>( mCurrentViewPlugin->getView() ) , doTransition , transitionFlags); |
280 mCurrentViewPlugin->activateView(); |
289 mCurrentViewPlugin->activateView(); |
317 */ |
326 */ |
318 void MpMainWindow::handleLibraryUpdated() |
327 void MpMainWindow::handleLibraryUpdated() |
319 { |
328 { |
320 TX_ENTRY |
329 TX_ENTRY |
321 |
330 |
322 // If library changed while playing back, always return to AllSongs collection view. |
331 // Data might have changed, so other views than Collection or MediaWall are not valid any more. |
323 if ( mPlaybackViewPlugin && |
332 if ( mCurrentViewPlugin == mMediaWallViewPlugin ) { |
324 mCurrentViewPlugin == mPlaybackViewPlugin && |
333 if ( mVerticalViewType != CollectionView ) { |
325 mCollectionViewPlugin ) { |
334 mVerticalViewType = CollectionView; |
326 |
335 } |
|
336 } |
|
337 else if ( mCollectionViewPlugin && mCurrentViewPlugin != mCollectionViewPlugin ) { |
327 activateView( CollectionView ); |
338 activateView( CollectionView ); |
328 MpViewBase* collectionView = reinterpret_cast<MpViewBase*>(mCollectionViewPlugin->getView()); |
339 MpViewBase* collectionView = reinterpret_cast<MpViewBase*>(mCollectionViewPlugin->getView()); |
329 collectionView->setDefaultView(); |
340 collectionView->setDefaultView(); |
330 } |
341 } |
331 |
342 |
388 } |
399 } |
389 default: |
400 default: |
390 Q_ASSERT_X(false, "MpMainWindow::initializeServiceView", "undefined service"); |
401 Q_ASSERT_X(false, "MpMainWindow::initializeServiceView", "undefined service"); |
391 break; |
402 break; |
392 } |
403 } |
|
404 mMpMediaController = new MpMediaController(); |
393 emit applicationReady(); |
405 emit applicationReady(); |
394 } |
406 } |
395 |
407 |
396 /*! |
408 /*! |
397 Slot to handle activity switching once the stand alone instance is running and registered |
409 Slot to handle activity switching once the stand alone instance is running and registered |
518 void MpMainWindow::loadActivity( QVariant data ) |
530 void MpMainWindow::loadActivity( QVariant data ) |
519 { |
531 { |
520 TX_ENTRY |
532 TX_ENTRY |
521 QVariantHash activityData = data.toHash(); |
533 QVariantHash activityData = data.toHash(); |
522 QByteArray serializedRestorePath = activityData.value( "restorePath" ).toByteArray(); |
534 QByteArray serializedRestorePath = activityData.value( "restorePath" ).toByteArray(); |
|
535 connect( MpEngineFactory::sharedEngine(), SIGNAL( restorePathFailed() ), this, SLOT( handleRestorePathFailed() ) ); |
523 MpEngineFactory::sharedEngine()->loadActivityData( serializedRestorePath ); |
536 MpEngineFactory::sharedEngine()->loadActivityData( serializedRestorePath ); |
524 TX_EXIT |
537 TX_EXIT |
525 } |
538 } |
526 |
539 |