29 #include "musui.hrh" |
29 #include "musui.hrh" |
30 #include "mussettings.h" |
30 #include "mussettings.h" |
31 #include "mussettingskeys.h" |
31 #include "mussettingskeys.h" |
32 #include "muslogger.h" // debug logging |
32 #include "muslogger.h" // debug logging |
33 #include "musuigeneralview.h" |
33 #include "musuigeneralview.h" |
|
34 #include "musuiactivetimer.h" |
34 |
35 |
35 #include <musui.rsg> |
36 #include <musui.rsg> |
36 #include <avkon.hrh> |
37 #include <avkon.hrh> |
37 #include <StringLoader.h> |
38 #include <StringLoader.h> |
38 |
39 |
39 #include <AknUtils.h> |
40 #include <AknUtils.h> |
40 |
41 |
41 using namespace NMusResourceApi; |
42 using namespace NMusResourceApi; |
42 using namespace MusSettingsKeys; |
43 using namespace MusSettingsKeys; |
43 |
44 |
44 |
45 const TInt KMusUiPauseResumeGuardPeriod = 500000; |
45 const TInt KMusUiIntervalToPlay = 5000000; |
46 |
46 // ----------------------------------------------------------------------------- |
47 // ----------------------------------------------------------------------------- |
47 // |
48 // |
48 // ----------------------------------------------------------------------------- |
49 // ----------------------------------------------------------------------------- |
49 // |
50 // |
50 CMusUiLiveSharingController* CMusUiLiveSharingController::NewL( |
51 CMusUiLiveSharingController* CMusUiLiveSharingController::NewL( |
149 // ----------------------------------------------------------------------------- |
153 // ----------------------------------------------------------------------------- |
150 // |
154 // |
151 void CMusUiLiveSharingController::RefreshCameraOrientationL() |
155 void CMusUiLiveSharingController::RefreshCameraOrientationL() |
152 { |
156 { |
153 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::RefreshCameraOrientationL" ); |
157 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::RefreshCameraOrientationL" ); |
154 if ( IsPlayingL() ) |
158 |
155 { |
159 if ( EngineSession() ){ |
156 MUS_LOG( "mus: [MUSUI ] -> Playing, pause/stop to restart camera" ); |
160 EngineSession()->RefreshOrientationL(); |
157 TTimeIntervalMicroSeconds32 interval( KMusUiIntervalToPlay ); |
161 } |
158 PauseL(); |
162 |
159 EnableDisplayL(false); |
|
160 EnableDisplayL(true); |
|
161 PlayL(); |
|
162 } |
|
163 else |
|
164 { |
|
165 MUS_LOG( "mus: [MUSUI ] -> Not Playing, try display to restart camera"); |
|
166 if ( IsDisplayEnabledL() ) |
|
167 { |
|
168 //Disabling of display will cause disabling of viewfinder and in its |
|
169 //turn releasing of camera, enabling of display will recreate a camera |
|
170 //with new orientation |
|
171 MUS_LOG( "mus: [MUSUI ] -> display is enabled, disable/enable it"); |
|
172 EnableDisplayL(false); |
|
173 EnableDisplayL(true); |
|
174 } |
|
175 else |
|
176 { |
|
177 MUS_LOG( "mus: [MUSUI ] -> Not refreshing "); |
|
178 } |
|
179 } |
|
180 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::RefreshCameraOrientationL" ); |
163 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::RefreshCameraOrientationL" ); |
181 } |
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
182 // |
167 // |
183 // ----------------------------------------------------------------------------- |
168 // ----------------------------------------------------------------------------- |
184 // |
169 // |
185 void CMusUiLiveSharingController::PauseL() |
170 void CMusUiLiveSharingController::PauseL() |
186 { |
171 { |
316 switch ( aCommand ) |
301 switch ( aCommand ) |
317 { |
302 { |
318 case EMusuiCmdToolbarPauseLive: |
303 case EMusuiCmdToolbarPauseLive: |
319 { |
304 { |
320 HandleCommandL( EMusuiCmdViewPause ); |
305 HandleCommandL( EMusuiCmdViewPause ); |
321 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPauseLive, |
306 HandlePauseResumeInToolbar(); |
322 EMusuiCmdToolbarUnPauseLive, |
|
323 ETrue ); |
|
324 break; |
307 break; |
325 } |
308 } |
326 |
309 |
327 case EMusuiCmdToolbarUnPauseLive: |
310 case EMusuiCmdToolbarUnPauseLive: |
328 { |
311 { |
329 HandleCommandL( EMusuiCmdViewContinue ); |
312 HandleCommandL( EMusuiCmdViewContinue ); |
330 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPauseLive, |
313 HandlePauseResumeInToolbar(); |
331 EMusuiCmdToolbarPauseLive, |
|
332 ETrue ); |
|
333 break; |
314 break; |
334 } |
315 } |
335 case EMusuiCmdToolbarZoom: |
316 case EMusuiCmdToolbarZoom: |
336 { |
317 { |
337 iToolbarZoomSelected = !iToolbarZoomSelected; |
318 iToolbarZoomSelected = !iToolbarZoomSelected; |
768 DismissWaitDialog(); |
748 DismissWaitDialog(); |
769 // Saving ends when disk is full but streaming continues (user is notified) |
749 // Saving ends when disk is full but streaming continues (user is notified) |
770 TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( R_MUS_VIEW_NOTE_MEMORY_LOW ) ) ); |
750 TRAP_IGNORE( MusUiDialogUtil::ShowGlobalErrorDialogL( R_MUS_VIEW_NOTE_MEMORY_LOW ) ) ); |
771 iDiskFull = ETrue; |
751 iDiskFull = ETrue; |
772 } |
752 } |
773 |
753 |
|
754 // ----------------------------------------------------------------------------- |
|
755 // |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 void CMusUiLiveSharingController::OrientationRefreshEnded() |
|
759 { |
|
760 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::OrientationRefreshEnded" ); |
|
761 iLiveObserver.DoRefreshView(); |
|
762 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::OrientationRefreshEnded" ); |
|
763 } |
774 |
764 |
775 // ----------------------------------------------------------------------------- |
765 // ----------------------------------------------------------------------------- |
776 // |
766 // |
777 // ----------------------------------------------------------------------------- |
767 // ----------------------------------------------------------------------------- |
778 // |
768 // |
930 TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
920 TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncHandleExit ) ); |
931 |
921 |
932 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::InactivityTimeout" ); |
922 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::InactivityTimeout" ); |
933 } |
923 } |
934 |
924 |
935 |
|
936 // ----------------------------------------------------------------------------- |
|
937 // |
|
938 // ----------------------------------------------------------------------------- |
|
939 // |
|
940 void CMusUiLiveSharingController::AsyncRefreshView() |
|
941 { |
|
942 TRAP_IGNORE( iCallbackService->AsyncEventL( EMusUiAsyncRefreshView ) ); |
|
943 } |
|
944 |
|
945 // ----------------------------------------------------------------------------- |
|
946 // |
|
947 // ----------------------------------------------------------------------------- |
|
948 // |
|
949 void CMusUiLiveSharingController::HandleAsyncEventL( TMusUiAsyncEvent aEventId ) |
|
950 { |
|
951 MUS_LOG( "mus: [MUSUI ] -> CMusUiLiveSharingController::HandleAsyncEventL" ); |
|
952 switch ( aEventId ) |
|
953 { |
|
954 case EMusUiAsyncRefreshView: |
|
955 { |
|
956 iLiveObserver.DoRefreshView(); |
|
957 break; |
|
958 } |
|
959 default: |
|
960 { |
|
961 // Not live sharing specific, let the base class handle |
|
962 CMusUiSendController::HandleAsyncEventL( aEventId ); |
|
963 } |
|
964 } |
|
965 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::HandleAsyncEventL" ); |
|
966 |
|
967 } |
|
968 |
|
969 // ----------------------------------------------------------------------------- |
925 // ----------------------------------------------------------------------------- |
970 // Determines whether Session established or not |
926 // Determines whether Session established or not |
971 // ----------------------------------------------------------------------------- |
927 // ----------------------------------------------------------------------------- |
972 // |
928 // |
973 TBool CMusUiLiveSharingController::IsSessionEstablished() |
929 TBool CMusUiLiveSharingController::IsSessionEstablished() |
974 { |
930 { |
975 return iSessionEstablished; |
931 return iSessionEstablished; |
976 } |
932 } |
977 |
933 |
|
934 // ----------------------------------------------------------------------------- |
|
935 // |
|
936 // ----------------------------------------------------------------------------- |
|
937 // |
|
938 void CMusUiLiveSharingController::HandlePauseResumeInToolbar() |
|
939 { |
|
940 TBool isPlaying( EFalse ); |
|
941 TRAP_IGNORE( isPlaying = IsPlayingL() ) |
|
942 if ( isPlaying ) |
|
943 { |
|
944 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarUnPauseLive, |
|
945 EMusuiCmdToolbarPauseLive, |
|
946 ETrue ); |
|
947 } |
|
948 else |
|
949 { |
|
950 iSharingObserver.ReplaceToolbarCommand( EMusuiCmdToolbarPauseLive, |
|
951 EMusuiCmdToolbarUnPauseLive, |
|
952 ETrue ); |
|
953 } |
|
954 } |
|
955 |
|
956 // ----------------------------------------------------------------------------- |
|
957 // Workaround for problem at lower level (encoder side) which causes crash |
|
958 // if several sequential pause/resumes are done too rapidly. Discard state change |
|
959 // attempt if it occurs too quickly after previous state change. |
|
960 // ----------------------------------------------------------------------------- |
|
961 // |
|
962 void CMusUiLiveSharingController::UserInitiatedCameraStateChangeL( TBool aEnable ) |
|
963 { |
|
964 MUS_LOG1( "mus: [MUSUI ] -> CMusUiLiveSharingController::UserInitiatedCameraStateChangeL, enable:", |
|
965 aEnable ); |
|
966 |
|
967 if ( iPauseResumeGuardTimer->IsActive() ){ |
|
968 MUS_LOG( "mus: [MUSUI ] <- State change ignored as guard timer is running!" ); |
|
969 return; |
|
970 } |
|
971 |
|
972 if ( aEnable ) |
|
973 { |
|
974 PlayL(); |
|
975 } |
|
976 else |
|
977 { |
|
978 PauseL(); |
|
979 } |
|
980 |
|
981 iPauseResumeGuardTimer->After( KMusUiPauseResumeGuardPeriod ); |
|
982 |
|
983 MUS_LOG( "mus: [MUSUI ] <- CMusUiLiveSharingController::UserInitiatedCameraStateChangeL" ); |
|
984 } |
|
985 |
|
986 |
978 // End of file |
987 // End of file |
979 |
988 |