201 |
203 |
202 if ( mViewMode == MpCommon::FetchView ) { |
204 if ( mViewMode == MpCommon::FetchView ) { |
203 // Banner is not needed since playback is stopped when returning |
205 // Banner is not needed since playback is stopped when returning |
204 // from playback preview. Disable the banner from updating. |
206 // from playback preview. Disable the banner from updating. |
205 mNowPlayingBanner->setEnabled( false ); |
207 mNowPlayingBanner->setEnabled( false ); |
|
208 attachNowPlayingBanner( false ); |
206 } |
209 } |
207 else { |
210 else { |
208 connect( mNowPlayingBanner, SIGNAL( clicked() ), this, SLOT( startPlaybackView() ) ); |
211 connect( mNowPlayingBanner, SIGNAL( clicked() ), this, SLOT( startPlaybackView() ) ); |
209 connect( mNowPlayingBanner, SIGNAL( playbackAttachmentChanged( bool ) ), |
212 connect( mNowPlayingBanner, SIGNAL( playbackAttachmentChanged( bool ) ), |
210 this, SLOT( attachNowPlayingBanner( bool ) ) ); |
213 this, SLOT( attachNowPlayingBanner( bool ) ) ); |
|
214 attachNowPlayingBanner( mNowPlayingBanner->isBannerAttached() ); |
211 } |
215 } |
212 |
216 |
213 widget = mDocumentLoader->findWidget( QString( "mainContainer" ) ); |
217 widget = mDocumentLoader->findWidget( QString( "mainContainer" ) ); |
214 mMainContainer = qobject_cast<HbWidget*>( widget ); |
218 mMainContainer = qobject_cast<HbWidget*>( widget ); |
215 |
219 |
345 { |
352 { |
346 TX_ENTRY_ARGS( "context=" << context ); |
353 TX_ENTRY_ARGS( "context=" << context ); |
347 if ( mActivated ) { |
354 if ( mActivated ) { |
348 startContainerTransition( mCollectionContext, context ); |
355 startContainerTransition( mCollectionContext, context ); |
349 } |
356 } |
|
357 |
350 mCollectionContext = context; |
358 mCollectionContext = context; |
|
359 // Reset softkey and the menu |
|
360 if ( mActivated ) { |
|
361 setSoftkey(); |
|
362 } |
|
363 updateToolBar(); |
|
364 updateMenu(); |
|
365 |
351 mCollectionContainer = mContainerFactory->createContainer( context ); |
366 mCollectionContainer = mContainerFactory->createContainer( context ); |
352 mCollectionContainer->setViewMode( mViewMode ); |
367 mCollectionContainer->setViewMode( mViewMode ); |
353 mCollectionDataModel->refreshModel(); |
368 mCollectionDataModel->refreshModel(); |
354 mCollectionContainer->setDataModel( mCollectionDataModel ); |
369 mCollectionContainer->setDataModel( mCollectionDataModel ); |
355 |
370 |
356 // Reset softkey and the menu |
|
357 if ( mActivated ) { |
|
358 setSoftkey(); |
|
359 } |
|
360 updateToolBar(); |
|
361 updateMenu(); |
|
362 TX_EXIT |
371 TX_EXIT |
363 } |
372 } |
364 |
373 |
365 /*! |
374 /*! |
366 Slot to be called when 'All Songs' action is triggered from the toolbar. |
375 Slot to be called when 'All Songs' action is triggered from the toolbar. |
617 void MpCollectionView::shufflePlayAll() |
626 void MpCollectionView::shufflePlayAll() |
618 { |
627 { |
619 mMpEngine->setShuffle( true ); |
628 mMpEngine->setShuffle( true ); |
620 MpSettingsManager::setShuffle( true ); |
629 MpSettingsManager::setShuffle( true ); |
621 int index = generateShuffleIndex(); |
630 int index = generateShuffleIndex(); |
622 openIndex( index ); |
631 switch ( mCollectionContext ) { |
623 } |
632 case ECollectionContextArtistAlbumsTBone: |
624 |
633 case ECollectionContextAlbumsTBone: |
|
634 playAlbumSongs( mCollectionData->currentAlbumIndex(), index ); |
|
635 break; |
|
636 default: |
|
637 openIndex( index ); |
|
638 break; |
|
639 } |
|
640 } |
625 |
641 |
626 /*! |
642 /*! |
627 Slot to be called when 'Refresh Library' is clicked by the user from the menu. |
643 Slot to be called when 'Refresh Library' is clicked by the user from the menu. |
628 */ |
644 */ |
629 void MpCollectionView::refreshLibrary() |
645 void MpCollectionView::refreshLibrary() |
794 cancelOngoingOperation(); |
810 cancelOngoingOperation(); |
795 |
811 |
796 //Update cache, even if collection is in background. |
812 //Update cache, even if collection is in background. |
797 //Library refreshing could be triggered at any point due USB/MMC events. |
813 //Library refreshing could be triggered at any point due USB/MMC events. |
798 mMpEngine->reopenCollection(); |
814 mMpEngine->reopenCollection(); |
|
815 } |
|
816 TX_EXIT |
|
817 } |
|
818 |
|
819 /*! |
|
820 Slot to be called when shuffle action status changes. This is called by the |
|
821 containers. Shuffle is only enabled when there is more than 1 song and the |
|
822 it can change when songs are deleted or when new songs are found during refresh. |
|
823 */ |
|
824 void MpCollectionView::setShuffleAction( bool enabled ) |
|
825 { |
|
826 TX_ENTRY |
|
827 mShuffleEnabled = enabled; |
|
828 if ( mShuffleAction ) { |
|
829 mShuffleAction->setEnabled(enabled); |
799 } |
830 } |
800 TX_EXIT |
831 TX_EXIT |
801 } |
832 } |
802 |
833 |
803 /*! |
834 /*! |
947 { |
978 { |
948 TX_ENTRY |
979 TX_ENTRY |
949 HbMenu *myMenu = new HbMenu(); |
980 HbMenu *myMenu = new HbMenu(); |
950 HbAction *menuAction; |
981 HbAction *menuAction; |
951 if ( mViewMode == MpCommon::DefaultView ) { |
982 if ( mViewMode == MpCommon::DefaultView ) { |
952 bool items = mCollectionData->count() != 0; |
983 int count = mCollectionData->count(); |
953 switch ( mCollectionContext ) { |
984 switch ( mCollectionContext ) { |
954 case ECollectionContextAllSongs: |
985 case ECollectionContextAllSongs: |
955 menuAction = myMenu->addAction( hbTrId( "txt_mus_dblist_shuffle" ) ); |
986 mShuffleAction = myMenu->addAction( hbTrId( "txt_mus_opt_shuffle" ) ); |
956 if ( items ){ |
987 connect( mShuffleAction, SIGNAL( triggered() ), this, SLOT( shufflePlayAll() ) ); |
957 connect( menuAction, SIGNAL( triggered() ), this, SLOT( shufflePlayAll() ) ); |
988 if ( count <= 1 ) { |
|
989 mShuffleAction->setDisabled( true ); |
|
990 } |
|
991 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_add_to_playlist" ) ); |
|
992 if ( count && !mUsbBlocked ) { |
|
993 connect( menuAction, SIGNAL( triggered() ), this, SLOT( addToPlaylist() ) ); |
958 } |
994 } |
959 else { |
995 else { |
960 menuAction->setDisabled( true ); |
996 menuAction->setDisabled( true ); |
961 } |
997 } |
962 |
998 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_refresh_library" ) ); |
963 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_add_to_playlist" ) ); |
999 if ( !mUsbBlocked ) { |
964 if ( items && !mUsbBlocked ) { |
1000 connect( menuAction, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) ); |
965 connect( menuAction, SIGNAL( triggered() ), this, SLOT( addToPlaylist() ) ); |
|
966 } |
1001 } |
967 else { |
1002 else { |
968 menuAction->setDisabled( true ); |
1003 menuAction->setDisabled( true ); |
969 } |
1004 } |
970 |
|
971 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_refresh_library" ) ); |
|
972 if ( !mUsbBlocked ) { |
|
973 connect( menuAction, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) ); |
|
974 } |
|
975 else { |
|
976 menuAction->setDisabled( true ); |
|
977 } |
|
978 |
|
979 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
1005 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
980 break; |
1006 break; |
981 |
|
982 case ECollectionContextArtists: |
1007 case ECollectionContextArtists: |
983 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_refresh_library" ) ); |
|
984 if ( !mUsbBlocked ) { |
|
985 connect( menuAction, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) ); |
|
986 } |
|
987 else { |
|
988 menuAction->setDisabled( true ); |
|
989 } |
|
990 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
|
991 break; |
|
992 case ECollectionContextAlbums: |
1008 case ECollectionContextAlbums: |
993 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_refresh_library" ) ); |
1009 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_refresh_library" ) ); |
994 if ( !mUsbBlocked ) { |
1010 if ( !mUsbBlocked ) { |
995 connect( menuAction, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) ); |
1011 connect( menuAction, SIGNAL( triggered() ), this, SLOT( refreshLibrary() ) ); |
996 } |
1012 } |
998 menuAction->setDisabled( true ); |
1014 menuAction->setDisabled( true ); |
999 } |
1015 } |
1000 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
1016 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
1001 break; |
1017 break; |
1002 case ECollectionContextArtistAlbumsTBone: |
1018 case ECollectionContextArtistAlbumsTBone: |
|
1019 case ECollectionContextAlbumsTBone: |
|
1020 mShuffleAction = myMenu->addAction( hbTrId( "txt_mus_opt_shuffle" ) ); |
|
1021 connect( mShuffleAction, SIGNAL( triggered() ), this, SLOT( shufflePlayAll() ) ); |
|
1022 if ( !mShuffleEnabled ) { |
|
1023 mShuffleAction->setDisabled( true ); |
|
1024 } |
|
1025 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_add_to_playlist" ) ); |
|
1026 if ( !mUsbBlocked ) { |
|
1027 connect( menuAction, SIGNAL( triggered() ), this, SLOT( addToPlaylist() ) ); |
|
1028 } |
|
1029 else { |
|
1030 menuAction->setDisabled( true ); |
|
1031 } |
|
1032 break; |
1003 case ECollectionContextArtistAllSongs: |
1033 case ECollectionContextArtistAllSongs: |
1004 case ECollectionContextAlbumsTBone: |
1034 mShuffleAction = myMenu->addAction( hbTrId( "txt_mus_opt_shuffle" ) ); |
|
1035 connect( mShuffleAction, SIGNAL( triggered() ), this, SLOT( shufflePlayAll() ) ); |
|
1036 if ( count <= 1 ) { |
|
1037 mShuffleAction->setDisabled( true ); |
|
1038 } |
1005 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_add_to_playlist" ) ); |
1039 menuAction = myMenu->addAction( hbTrId( "txt_mus_opt_add_to_playlist" ) ); |
1006 if ( !mUsbBlocked ) { |
1040 if ( !mUsbBlocked ) { |
1007 connect( menuAction, SIGNAL( triggered() ), this, SLOT( addToPlaylist() ) ); |
1041 connect( menuAction, SIGNAL( triggered() ), this, SLOT( addToPlaylist() ) ); |
1008 } |
1042 } |
1009 else { |
1043 else { |
1019 menuAction->setDisabled( true ); |
1053 menuAction->setDisabled( true ); |
1020 } |
1054 } |
1021 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
1055 connect( myMenu->addAction(hbTrId("txt_common_opt_exit")), SIGNAL(triggered()), this, SLOT(exit()) ); |
1022 break; |
1056 break; |
1023 case ECollectionContextPlaylistSongs: |
1057 case ECollectionContextPlaylistSongs: |
1024 if ( !mCollectionData->isAutoPlaylist() ){ |
1058 mShuffleAction = myMenu->addAction( hbTrId( "txt_mus_opt_shuffle" ) ); |
|
1059 connect( mShuffleAction, SIGNAL( triggered() ), this, SLOT( shufflePlayAll() ) ); |
|
1060 if ( count <= 1 ) { |
|
1061 mShuffleAction->setDisabled( true ); |
|
1062 } |
|
1063 if ( !mCollectionData->isAutoPlaylist() ) { |
1025 menuAction = myMenu->addAction( hbTrId( "txt_common_menu_rename_item" ) ); |
1064 menuAction = myMenu->addAction( hbTrId( "txt_common_menu_rename_item" ) ); |
1026 if ( !mUsbBlocked ) { |
1065 if ( !mUsbBlocked ) { |
1027 connect( menuAction, SIGNAL( triggered() ), this, SLOT( renameCurrentPlaylistContainer() ) ); |
1066 connect( menuAction, SIGNAL( triggered() ), this, SLOT( renameCurrentPlaylistContainer() ) ); |
1028 } |
1067 } |
1029 else { |
1068 else { |