camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 19 e32fcfe0045f
parent 17 8f559c47d7fd
child 21 289bbfdb6627
equal deleted inserted replaced
17:8f559c47d7fd 19:e32fcfe0045f
  1228       // otherwise stay with the current capture mode
  1228       // otherwise stay with the current capture mode
  1229       if ( iMode == ECamControllerVideo )
  1229       if ( iMode == ECamControllerVideo )
  1230         {
  1230         {
  1231         iTargetMode = ECamControllerImage;
  1231         iTargetMode = ECamControllerImage;
  1232         }
  1232         }
       
  1233       SubmergeToolbar(); //Fix flickering when switching modes.
  1233       TrySwitchViewL();
  1234       TrySwitchViewL();
  1234       
  1235       
  1235 
  1236 
  1236       }
  1237       }
  1237       break;
  1238       break;
  1408       // Switch to video pre capture view
  1409       // Switch to video pre capture view
  1409       iTargetViewState = ECamViewStatePreCapture;
  1410       iTargetViewState = ECamViewStatePreCapture;
  1410       iTargetMode = ECamControllerVideo;
  1411       iTargetMode = ECamControllerVideo;
  1411       SetSuppressUIRiseOnViewfinderStart( EFalse );
  1412       SetSuppressUIRiseOnViewfinderStart( EFalse );
  1412       PRINT( _L("Camera => CCamAppUi::HandleCommandL Try switch to video mode"));
  1413       PRINT( _L("Camera => CCamAppUi::HandleCommandL Try switch to video mode"));
       
  1414       SubmergeToolbar();
  1413       TrySwitchViewL();
  1415       TrySwitchViewL();
  1414       }
  1416       }
  1415       break;
  1417       break;
  1416     // -----------------------------------------------------
  1418     // -----------------------------------------------------
  1417     case ECamCmdSelfTimer1: // 10-sec self-timer
  1419     case ECamCmdSelfTimer1: // 10-sec self-timer
  1869         iView->HandleCommandL(ECamCmdRedrawScreen);
  1871         iView->HandleCommandL(ECamCmdRedrawScreen);
  1870         iProcessingScreenRedraw = EFalse;
  1872         iProcessingScreenRedraw = EFalse;
  1871         }
  1873         }
  1872       }
  1874       }
  1873       break;
  1875       break;
       
  1876     // -----------------------------------------------------
       
  1877     case ECamCmdRedrawVideoTime:
       
  1878       {
       
  1879       if( !iProcessingScreenRedraw && iView )
       
  1880         {
       
  1881         iProcessingScreenRedraw = ETrue;
       
  1882         iView->HandleCommandL(ECamCmdRedrawVideoTime);
       
  1883         iProcessingScreenRedraw = EFalse;
       
  1884         }
       
  1885       }
       
  1886       break;      
       
  1887     // -----------------------------------------------------
       
  1888     case ECamCmdRedrawZoom:
       
  1889       {
       
  1890       if( !iProcessingScreenRedraw && iView )
       
  1891         {
       
  1892         iProcessingScreenRedraw = ETrue;
       
  1893         iView->HandleCommandL(ECamCmdRedrawZoom);
       
  1894         iProcessingScreenRedraw = EFalse;
       
  1895         }
       
  1896       }
       
  1897       break;            
  1874     // -----------------------------------------------------
  1898     // -----------------------------------------------------
  1875     case ECamCmdShootSetup: // fall through
  1899     case ECamCmdShootSetup: // fall through
  1876     case ECamCmdFlash:      // fall through
  1900     case ECamCmdFlash:      // fall through
  1877     case ECamCmdAddAudio:   // fall through
  1901     case ECamCmdAddAudio:   // fall through
  1878     case ECamCmdEdit:       // fall through
  1902     case ECamCmdEdit:       // fall through
  3061         // -----------------------------------------------------
  3085         // -----------------------------------------------------
  3062         // the camera app has regained the focus
  3086         // the camera app has regained the focus
  3063         case EEventFocusGained:
  3087         case EEventFocusGained:
  3064           {            
  3088           {            
  3065           PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusGained") );
  3089           PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusGained") );
       
  3090           RAknUiServer* capServ = CAknSgcClient::AknSrv();
       
  3091           CleanupStack::PushL( TCleanupItem( CleanupBlankScreen, this ) );
       
  3092           if ( iPretendExit ) 
       
  3093             {
       
  3094             capServ->BlankScreen();
       
  3095             }
  3066           iReturningFromPretendExit = iPretendExit; 
  3096           iReturningFromPretendExit = iPretendExit; 
  3067           
  3097           
  3068           TBool uiOverride = iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported();
  3098           TBool uiOverride = iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsUIOrientationOverrideSupported();
  3069           
  3099           
  3070           if ( !iSendAsInProgress )
  3100           if ( !iSendAsInProgress )
  3126               {
  3156               {
  3127               if ( ECamViewStateStandby == iViewState && 
  3157               if ( ECamViewStateStandby == iViewState && 
  3128                    StandbyStatus() == KErrInUse )
  3158                    StandbyStatus() == KErrInUse )
  3129                   { 
  3159                   { 
  3130                   // We call the base class and return
  3160                   // We call the base class and return
       
  3161                   capServ->UnblankScreen();
       
  3162                   CleanupStack::Pop();
  3131                   CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3163                   CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3132                   return;
  3164                   return;
  3133                   }
  3165                   }
  3134               else if ( iViewState != ECamViewStateSettings && 
  3166               else if ( iViewState != ECamViewStateSettings && 
  3135                         iViewState != ECamViewStateViaPlayer &&
  3167                         iViewState != ECamViewStateViaPlayer &&
  3141                       {
  3173                       {
  3142                       HideTaskL( EFalse );
  3174                       HideTaskL( EFalse );
  3143                       }
  3175                       }
  3144                   iPretendExit = EFalse; 	
  3176                   iPretendExit = EFalse; 	
  3145                   // Go to standby with error	
  3177                   // Go to standby with error	
       
  3178                   capServ->UnblankScreen();
       
  3179                   CleanupStack::Pop();
  3146                   HandleStandbyEventL( KErrInUse );
  3180                   HandleStandbyEventL( KErrInUse );
  3147                   // We call the base class and return
  3181                   // We call the base class and return
  3148                   CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3182                   CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3149                   return;
  3183                   return;
  3150                   } 
  3184                   } 
  3195           */
  3229           */
  3196           if ( iViewState == ECamViewStateViaPlayer )
  3230           if ( iViewState == ECamViewStateViaPlayer )
  3197               {
  3231               {
  3198               ActivateLocalViewL ( iViaPlayerUid );
  3232               ActivateLocalViewL ( iViaPlayerUid );
  3199               // We call the base class and return
  3233               // We call the base class and return
       
  3234               capServ->UnblankScreen();
       
  3235               CleanupStack::Pop();
  3200               CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3236               CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3201               return;
  3237               return;
  3202               }
  3238               }
  3203           else if ( iTargetViewState == ECamViewStatePostCapture  )
  3239           else if ( iTargetViewState == ECamViewStatePostCapture  )
  3204               {
  3240               {
  3212     
  3248     
  3213 #endif             
  3249 #endif             
  3214               // iPretendExit flag needs to be reset before returning, otherwise
  3250               // iPretendExit flag needs to be reset before returning, otherwise
  3215               // views think we are still in exit state and will not reserve camera
  3251               // views think we are still in exit state and will not reserve camera
  3216               iPretendExit = EFalse;
  3252               iPretendExit = EFalse;
       
  3253               capServ->UnblankScreen();
       
  3254               CleanupStack::Pop();
  3217               CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3255               CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3218               return;
  3256               return;
  3219               }
  3257               }
  3220           else if ( SettingsLaunchedFromCamera() )
  3258           else if ( SettingsLaunchedFromCamera() )
  3221               {
  3259               {
  3233                 	  iView->HandleCommandL( ECamCmdExitStandby );
  3271                 	  iView->HandleCommandL( ECamCmdExitStandby );
  3234                 	  }
  3272                 	  }
  3235                   iTargetViewState = ECamViewStateSettings;
  3273                   iTargetViewState = ECamViewStateSettings;
  3236                   }
  3274                   }
  3237               TrySwitchViewL();
  3275               TrySwitchViewL();
       
  3276               capServ->UnblankScreen();
       
  3277               CleanupStack::Pop();
  3238               CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3278               CAknAppUi::HandleWsEventL( aEvent, aDestination );
  3239               return;
  3279               return;
  3240               }
  3280               }
  3241           else
  3281           else
  3242               {
  3282               {
  3271               }
  3311               }
  3272           
  3312           
  3273           if ( memError && freeMemory < iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained() )
  3313           if ( memError && freeMemory < iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained() )
  3274               {
  3314               {
  3275               PRINT( _L("Camera <> CCamAppUi::HandleWsEvent ECamEventFocusGained memory too low. Exiting") );
  3315               PRINT( _L("Camera <> CCamAppUi::HandleWsEvent ECamEventFocusGained memory too low. Exiting") );
       
  3316               capServ->UnblankScreen();
       
  3317               CleanupStack::Pop();
  3276               CloseAppL();
  3318               CloseAppL();
  3277               PRINT( _L("Camera <= CCamAppUi::HandleWsEvent ECamEventFocusGained memory too low. Exiting") );
  3319               PRINT( _L("Camera <= CCamAppUi::HandleWsEvent ECamEventFocusGained memory too low. Exiting") );
  3278               return;
  3320               return;
  3279               }
  3321               }
  3280 
  3322 
  3300               {
  3342               {
  3301               PRINT( _L("Camera <> CCamAppUi::HandleWsEventL EEventFocusGained checking exit status") )
  3343               PRINT( _L("Camera <> CCamAppUi::HandleWsEventL EEventFocusGained checking exit status") )
  3302               // check if exit is required
  3344               // check if exit is required
  3303               if ( iController.CheckExitStatus() )
  3345               if ( iController.CheckExitStatus() )
  3304                   {
  3346                   {
       
  3347                   capServ->UnblankScreen();
       
  3348                   CleanupStack::Pop();
  3305                   InternalExitL();
  3349                   InternalExitL();
  3306                   PRINT( _L("Camera <= CCamAppUi::HandleWsEventL, internal exit") )
  3350                   PRINT( _L("Camera <= CCamAppUi::HandleWsEventL, internal exit") )
  3307                   return;
  3351                   return;
  3308                   }
  3352                   }
  3309               }
  3353               }
  3398           //We hiden toolbar when keylock was set to on in pre-capture view and camera lost focus, 
  3442           //We hiden toolbar when keylock was set to on in pre-capture view and camera lost focus, 
  3399           //so we need to display toolbar when keylock is set to off and camera gain focus again.
  3443           //so we need to display toolbar when keylock is set to off and camera gain focus again.
  3400           if ( ECamViewStatePreCapture == iViewState &&
  3444           if ( ECamViewStatePreCapture == iViewState &&
  3401                ECamPreCapViewfinder == iPreCaptureMode && 
  3445                ECamPreCapViewfinder == iPreCaptureMode && 
  3402                ( !( iSelfTimer && iSelfTimer->IsActive() ) ) &&
  3446                ( !( iSelfTimer && iSelfTimer->IsActive() ) ) &&
  3403                iController.CurrentOperation() != ECamCapturing )  
  3447                iController.CurrentOperation() != ECamCapturing &&
       
  3448                iController.CurrentOperation() != ECamPaused )
  3404             {
  3449             {
  3405             SetToolbarVisibility(); 
  3450             SetToolbarVisibility(); 
  3406             }          
  3451             }          
  3407           
  3452           
  3408           // If keylock is set on when recording is starting up but not yet 
  3453           // If keylock is set on when recording is starting up but not yet 
  3427                          }
  3472                          }
  3428                      }
  3473                      }
  3429                  }
  3474                  }
  3430               }
  3475               }
  3431 
  3476 
       
  3477           capServ->UnblankScreen();
       
  3478           CleanupStack::Pop();
  3432           if (iStartupLogoController && iReturningFromPretendExit)
  3479           if (iStartupLogoController && iReturningFromPretendExit)
  3433               {
  3480               {
  3434               iStartupLogoController->ShowLogo();
  3481               iStartupLogoController->ShowLogo();
  3435               }
  3482               }
  3436           break;
  3483           break;
  3437           }
  3484           }
  3438         // -----------------------------------------------------
  3485         // -----------------------------------------------------
  3439         case EEventFocusLost:
  3486         case EEventFocusLost:
  3440           {
  3487           {
  3441           PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusLost") );
  3488           PRINT( _L("Camera <> CCamAppUi::HandleWsEventL: case EEventFocusLost") );
  3442 
  3489           // Stop VF early to reduce load
       
  3490           if( AppInBackground( EFalse )
       
  3491               && iViewState == ECamViewStatePreCapture
       
  3492               && iMode == ECamControllerVideo )
       
  3493               {
       
  3494               iController.StopViewFinder(); 
       
  3495               }
  3443           //When go to background from video post caputure view, we need to hide the toolbar to avoid icons overlap
  3496           //When go to background from video post caputure view, we need to hide the toolbar to avoid icons overlap
  3444           if( AppInBackground( EFalse )
  3497           if( AppInBackground( EFalse )
  3445               && iViewState == ECamViewStatePostCapture
  3498               && iViewState == ECamViewStatePostCapture
  3446               && iMode == ECamControllerVideo )
  3499               && iMode == ECamControllerVideo )
  3447               {
  3500               {
  5466  
  5519  
  5467     if ( iStartupLogoController )
  5520     if ( iStartupLogoController )
  5468         {
  5521         {
  5469         iStartupLogoController->ShowLogo();
  5522         iStartupLogoController->ShowLogo();
  5470         }
  5523         }
       
  5524     SubmergeToolbar(); //For preventing toolbar to show up when starting camera again.
  5471 
  5525 
  5472     PRINT( _L("Camera <= CCamAppUi::InternalExitL") );
  5526     PRINT( _L("Camera <= CCamAppUi::InternalExitL") );
  5473     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP_CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 0" );
  5527     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP_CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 0" );
  5474     
  5528     
  5475     } 
  5529     } 
  7119     PRINT( _L("Camera => CCamAppUi::ShowZoomPane" ))
  7173     PRINT( _L("Camera => CCamAppUi::ShowZoomPane" ))
  7120     iZoomPaneShown = ETrue;
  7174     iZoomPaneShown = ETrue;
  7121     
  7175     
  7122   if ( aRedraw && IsDirectViewfinderActive() )
  7176   if ( aRedraw && IsDirectViewfinderActive() )
  7123         {
  7177         {
  7124         TRAP_IGNORE(HandleCommandL(ECamCmdRedrawScreen));
  7178         TRAP_IGNORE(HandleCommandL(ECamCmdRedrawZoom));
  7125         }
  7179         }
  7126   PRINT( _L("Camera <= CCamAppUi::ShowZoomPane" ))
  7180   PRINT( _L("Camera <= CCamAppUi::ShowZoomPane" ))
  7127     }
  7181     }
  7128     
  7182     
  7129 // ---------------------------------------------------------------------------
  7183 // ---------------------------------------------------------------------------
  7145             }
  7199             }
  7146         }
  7200         }
  7147         
  7201         
  7148   if ( aRedraw && IsDirectViewfinderActive() )
  7202   if ( aRedraw && IsDirectViewfinderActive() )
  7149         {
  7203         {
  7150         TRAP_IGNORE( HandleCommandL(ECamCmdRedrawScreen ) );
  7204         TRAP_IGNORE( HandleCommandL(ECamCmdRedrawZoom ) );
  7151         }
  7205         }
  7152   PRINT( _L("Camera <= CCamAppUi::HideZoomPane" ))
  7206   PRINT( _L("Camera <= CCamAppUi::HideZoomPane" ))
  7153     }
  7207     }
  7154 
  7208 
  7155 // ---------------------------------------------------------------------------
  7209 // ---------------------------------------------------------------------------
  8576     iUiConstructionComplete = ETrue; 
  8630     iUiConstructionComplete = ETrue; 
  8577     // Load the settings model static settings
  8631     // Load the settings model static settings
  8578     PRINT( _L("Camera <> call CCamAppController::LoadStaticSettingsL..") )
  8632     PRINT( _L("Camera <> call CCamAppController::LoadStaticSettingsL..") )
  8579     iController.LoadStaticSettingsL( IsEmbedded() );
  8633     iController.LoadStaticSettingsL( IsEmbedded() );
  8580     
  8634     
  8581     iInternalStorage = static_cast<TCamMediaStorage>(iController.IntegerSettingValue( ECamSettingItemPhotoMediaStorage ));
  8635     iInternalStorage = static_cast<TCamMediaStorage>(iController.IntegerSettingValueUnfiltered( ECamSettingItemPhotoMediaStorage ));
  8582     // store the userscene settings
  8636     // store the userscene settings
  8583     iController.StoreUserSceneSettingsL();
  8637     iController.StoreUserSceneSettingsL();
  8584 
  8638 
  8585 /*#ifndef __WINSCW__    
  8639 /*#ifndef __WINSCW__    
  8586         if ( !iSFIUtils )
  8640         if ( !iSFIUtils )
  8907             break;
  8961             break;
  8908         }
  8962         }
  8909     
  8963     
  8910     }
  8964     }
  8911 
  8965 
       
  8966 // -----------------------------------------------------------------------------
       
  8967 // CCamAppUi::NaviProgressBarModel 
       
  8968 // -----------------------------------------------------------------------------
       
  8969 //
       
  8970 CCamNaviProgressBarModel* CCamAppUi::NaviProgressBarModel()
       
  8971     {
       
  8972     return iNaviProgressBarModel;    
       
  8973     }
       
  8974 
       
  8975 
       
  8976 void CCamAppUi::CleanupBlankScreen( TAny* aAny )
       
  8977     {
       
  8978     PRINT(_L("Camera => CCamAppUi::CleanupBlankScreen."));
       
  8979     CCamAppUi* appui = static_cast<CCamAppUi*>( aAny );
       
  8980     RAknUiServer* capServ = CAknSgcClient::AknSrv();
       
  8981     if( capServ )
       
  8982         {
       
  8983         capServ->UnblankScreen();
       
  8984         appui->Exit();
       
  8985         }
       
  8986     PRINT(_L("Camera <= CCamAppUi::CleanupBlankScreen."));
       
  8987     }
       
  8988 
  8912 //  End of File
  8989 //  End of File