diff -r fdb31ab341af -r a0afa279b8fe app/src/mpmainwindow.cpp --- a/app/src/mpmainwindow.cpp Fri May 14 18:54:37 2010 -0500 +++ b/app/src/mpmainwindow.cpp Fri May 28 19:46:01 2010 -0500 @@ -17,6 +17,7 @@ #include +#include #include #include #include @@ -30,6 +31,7 @@ #include "mpviewbase.h" #include "musicservices.h" #include "mpenginefactory.h" +#include "mpsettingsmanager.h" #include "mptrace.h" /*! @@ -98,7 +100,7 @@ /*! Initialize and activate the collection view */ -void MpMainWindow::initialize() +void MpMainWindow::initialize( ActivityMode mode ) { TX_ENTRY @@ -135,19 +137,39 @@ if ( !mMusicServices ) { MpEngineFactory::createSharedEngine(); if ( orientation() == Qt::Vertical ) { - loadView(CollectionView); - activateView(CollectionView); - loadView(MediaWallView); + // If first startup ignore shuffleAll and send to collection view to refresh library + if ( mode == MusicMainView || MpSettingsManager::firstStartup() ) { + loadView(CollectionView); + activateView(CollectionView); + loadView(MediaWallView); + loadView( PlaybackView ); + } else if (mode == MusicNowPlayingViewShuffleAll ) { + MpEngineFactory::sharedEngine()->shuffleAll(); + loadView( PlaybackView ); + activateView(PlaybackView); + loadView(CollectionView); + loadView(MediaWallView); + } } else { + // If first startup ignore shuffleAll and send to refresh library + if( mode == MusicNowPlayingViewShuffleAll && !MpSettingsManager::firstStartup() ) { + MpEngineFactory::sharedEngine()->shuffleAll(); + mVerticalViewType = PlaybackView; + } loadView(MediaWallView); activateView(MediaWallView); loadView(CollectionView); + loadView( PlaybackView ); } connect(this, SIGNAL( orientationChanged( Qt::Orientation ) ), SLOT( switchView( Qt::Orientation ) ) ); connect( MpEngineFactory::sharedEngine(), SIGNAL( libraryUpdated() ), SLOT( handleLibraryUpdated() ) ); MpEngineFactory::sharedEngine()->checkForSystemEvents(); - loadView( PlaybackView ); + //Register to application manager to wait for activities + HbApplication* app = qobject_cast(qApp); + app->activityManager()->waitActivity(); + connect( app, SIGNAL( activate() ), this , SLOT( handleActivity() ) ); + } else { setOrientation(Qt::Vertical, true);//This sould prevent media wall activation. @@ -296,8 +318,8 @@ void MpMainWindow::keyPressEvent(QKeyEvent *event) { switch(event->key()) { - case 16842754: - case Qt::Key_Hangup: + case 16842753: + case Qt::Key_Call: if (orientation () == Qt::Vertical) { setOrientation(Qt::Horizontal, false); } @@ -305,10 +327,6 @@ setOrientation(Qt::Vertical, false); } break; - case 16842753: - case Qt::Key_Call: - unsetOrientation(false); - break; default: HbMainWindow::keyPressEvent (event); break; @@ -401,3 +419,24 @@ return plugin ? *plugin : 0; } +/*! + Slot to handle activity switching once the stand alone instance is running and registered + in the activity manager to wait for activities. + Only running activity supported at the moment is "MusicNowPlayingView" + */ +void MpMainWindow::handleActivity() +{ + HbApplication* app = qobject_cast(qApp); + QString activityId = app->activateId(); + + if( !activityId.compare( "MusicNowPlayingView&launchtype=standalone" ) ) { + if ( orientation() == Qt::Vertical ) { + if( mVerticalViewType != PlaybackView ) { + activateView( PlaybackView ); + } + } + } + HbActivityManager* activityManager = qobject_cast(qApp)->activityManager(); + activityManager->waitActivity(); +} +