camerauis/cameraapp/generic/src/CamAppui.cpp
branchRCL_3
changeset 16 d486e5e3cc9a
parent 12 8c55c525d5d7
child 18 51dda465e618
equal deleted inserted replaced
12:8c55c525d5d7 16:d486e5e3cc9a
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  App UI class for cameraapp
    14 * Description:  App UI class for cameraapp
    15  *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // This needs to be included first, because other include files
    19 // This needs to be included first, because other include files
    20 // may be variated using these flags.
    20 // may be variated using these flags.
   112 #include "s32mem.h"
   112 #include "s32mem.h"
   113 
   113 
   114 
   114 
   115 #include "camflashstatus.h"
   115 #include "camflashstatus.h"
   116 #include "CamMemoryMonitor.h"
   116 #include "CamMemoryMonitor.h"
       
   117 #include "camstartuplogocontroller.h"
   117 
   118 
   118 
   119 
   119 
   120 
   120 // ===========================================================================
   121 // ===========================================================================
   121 // Constants
   122 // Constants
   160         {
   161         {
   161         iMemoryMonitor->StopMonitoring();
   162         iMemoryMonitor->StopMonitoring();
   162         delete iMemoryMonitor;
   163         delete iMemoryMonitor;
   163         iMemoryMonitor = 0;
   164         iMemoryMonitor = 0;
   164         }
   165         }
       
   166 
       
   167     delete iStartupLogoController;
   165 
   168 
   166     iController.SetAppUiAvailable( EFalse );
   169     iController.SetAppUiAvailable( EFalse );
   167 
   170 
   168     iResourceLoaders.Close();
   171     iResourceLoaders.Close();
   169 
   172 
   649     {
   652     {
   650     iUiConstructionComplete = ETrue;
   653     iUiConstructionComplete = ETrue;
   651     }
   654     }
   652   iMemoryMonitor->StartMonitoring( iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained(),
   655   iMemoryMonitor->StartMonitoring( iController.UiConfigManagerPtr()->CriticalLevelRamMemoryFocusGained(),
   653                                    iController.UiConfigManagerPtr()->RequiredRamMemoryFocusGained() );
   656                                    iController.UiConfigManagerPtr()->RequiredRamMemoryFocusGained() );
       
   657 
       
   658   // TRAP errors so camera starts up even if startup animation fails
       
   659   TRAP_IGNORE(iStartupLogoController = CCamStartupLogoController::NewL(EStartupLogoVisible));
       
   660 
   654   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   661   PRINT( _L("Camera <= CCamAppUi::ConstructL") )
   655   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
   662   OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP3_CCAMAPPUI_CONSTRUCTL, "e_CCamAppUi_ConstructL 0" );
   656   }
   663   }
   657     
   664     
   658 
   665 
  1799                      iResourceLoaders[rl]->ReloadResourceDataL();
  1806                      iResourceLoaders[rl]->ReloadResourceDataL();
  1800                      }
  1807                      }
  1801 
  1808 
  1802                  iCamSidePane->UpdateLayout();          
  1809                  iCamSidePane->UpdateLayout();          
  1803                  iTargetViewState = ECamViewStatePreCapture;
  1810                  iTargetViewState = ECamViewStatePreCapture;
  1804                  delete iScreenClearer;
       
  1805                  iScreenClearer = NULL;
       
  1806                  iScreenClearer = CAknLocalScreenClearer::NewL( 
       
  1807                               IsSecondCameraEnabled() || IsQwerty2ndCamera() );
       
  1808                  TrySwitchViewL( ETrue );
  1811                  TrySwitchViewL( ETrue );
  1809                  iController.SwitchCameraL();       
  1812                  iController.SwitchCameraL();       
  1810                  }
  1813                  }
  1811              }
  1814              }
  1812          }                
  1815          }                
  2644       !AppInBackground( EFalse )  )
  2647       !AppInBackground( EFalse )  )
  2645     {
  2648     {
  2646     if( ECamViewStateStandby != iViewState )
  2649     if( ECamViewStateStandby != iViewState )
  2647       {
  2650       {
  2648       DismissMemoryNoteL();  
  2651       DismissMemoryNoteL();  
  2649     
  2652 
       
  2653       if (iStartupLogoController)
       
  2654           {
       
  2655           iStartupLogoController->HideLogo();
       
  2656           }
       
  2657 
  2650       if( IsInternalView( iViewState ) )
  2658       if( IsInternalView( iViewState ) )
  2651         {
  2659         {
  2652          
  2660          
  2653         if ( aStatus != KErrInUse &&
  2661         if ( aStatus != KErrInUse &&
  2654              iPreCaptureMode == ECamPreCapCaptureSetup ||
  2662              iPreCaptureMode == ECamPreCapCaptureSetup ||
  2677               {
  2685               {
  2678               CompleteAppUIConstructionL(); 
  2686               CompleteAppUIConstructionL(); 
  2679               }
  2687               }
  2680             else
  2688             else
  2681               {    
  2689               {    
  2682               static_cast<CCamViewBase*>( iView )->ExitAllModesL();
  2690               if( iView)
       
  2691                   {
       
  2692                   static_cast<CCamViewBase*>( iView )->ExitAllModesL();
       
  2693                   }
  2683               }
  2694               }
  2684              
  2695              
  2685             }
  2696             }
  2686         }
  2697         }
  2687       // Not InternalView
  2698       // Not InternalView
  2937               // relinquish capture keys
  2948               // relinquish capture keys
  2938               UnRegisterCaptureKeys();    
  2949               UnRegisterCaptureKeys();    
  2939               }
  2950               }
  2940     #endif
  2951     #endif
  2941             }
  2952             }
  2942     
  2953 
       
  2954           if (iStartupLogoController)
       
  2955             {
       
  2956             iStartupLogoController->HideLogo();
       
  2957             }
       
  2958 
  2943           if( AppInBackground(EFalse) || ( !CamUtility::IsBatteryPowerOK() && 
  2959           if( AppInBackground(EFalse) || ( !CamUtility::IsBatteryPowerOK() && 
  2944                                            !CamUtility::IsBatteryCharging() ) )
  2960                                            !CamUtility::IsBatteryCharging() ) )
  2945             {
  2961             {
  2946             if( ECamControllerVideo == iMode )
  2962             if( ECamControllerVideo == iMode )
  2947               {
  2963               {
  3234           if ( !uiOverride )
  3250           if ( !uiOverride )
  3235               {
  3251               {
  3236               iController.CheckMemoryToUseL();
  3252               iController.CheckMemoryToUseL();
  3237               }
  3253               }
  3238                     
  3254                     
  3239           TBool returningFromPretendExit = iPretendExit;
       
  3240           iPretendExit = EFalse; 
  3255           iPretendExit = EFalse; 
  3241                  
  3256                  
  3242           TCamViewSwitch switchNeeded = ECamViewSwitchNone;               
  3257           TCamViewSwitch switchNeeded = ECamViewSwitchNone;               
  3243                                          
  3258                                          
  3244           // if a view switch has been waiting for the application to get 
  3259           // if a view switch has been waiting for the application to get 
  3325                          toolbar->SetToolbarVisibility( EFalse );
  3340                          toolbar->SetToolbarVisibility( EFalse );
  3326                          }
  3341                          }
  3327                      }
  3342                      }
  3328                  }
  3343                  }
  3329               }
  3344               }
       
  3345 
       
  3346           if (iStartupLogoController && iReturningFromPretendExit)
       
  3347               {
       
  3348               iStartupLogoController->ShowLogo();
       
  3349               }
  3330           break;
  3350           break;
  3331           }
  3351           }
  3332         // -----------------------------------------------------
  3352         // -----------------------------------------------------
  3333         case EEventFocusLost:
  3353         case EEventFocusLost:
  3334           {
  3354           {
  4367                     {
  4387                     {
  4368                     currentLocation = static_cast<TCamMediaStorage>( 
  4388                     currentLocation = static_cast<TCamMediaStorage>( 
  4369                                 iController.IntegerSettingValue( key ) );
  4389                                 iController.IntegerSettingValue( key ) );
  4370                     }
  4390                     }
  4371                 if(currentLocation != ECamMediaStoragePhone && 
  4391                 if(currentLocation != ECamMediaStoragePhone && 
  4372                     !IsMemoryFullOrUnavailable(ECamMediaStoragePhone))
  4392 				!IsMemoryFullOrUnavailable(ECamMediaStoragePhone) &&
  4373                     {
  4393 				!iController.IntegerSettingValue( ECamSettingItemRemovePhoneMemoryUsage ) )
  4374                     supportedMemTypes |= 
  4394 				{
  4375                         AknCommonDialogsDynMem::EMemoryTypePhone;
  4395 				supportedMemTypes |= AknCommonDialogsDynMem::EMemoryTypePhone;
  4376                     }
  4396 				}
  4377                 if(currentLocation != ECamMediaStorageCard && 
  4397 			if(currentLocation != ECamMediaStorageCard && 
  4378                     !IsMemoryFullOrUnavailable(ECamMediaStorageCard))
  4398 				!IsMemoryFullOrUnavailable(ECamMediaStorageCard))
  4379                     {
  4399 				{
  4380                     supportedMemTypes |= 
  4400 				supportedMemTypes |= AknCommonDialogsDynMem::EMemoryTypeMMCExternal;
  4381                         AknCommonDialogsDynMem::EMemoryTypeMMCExternal;
  4401 				}
  4382                     }
  4402 			if(currentLocation != ECamMediaStorageMassStorage && 
  4383                 if(currentLocation != ECamMediaStorageMassStorage && 
  4403 				!IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage))
  4384                     !IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage))
  4404 				{
  4385                     {
       
  4386                     supportedMemTypes |= 
  4405                     supportedMemTypes |= 
  4387                         AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;
  4406                         AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage;
  4388                     }
  4407                     }
  4389 
  4408 
  4390                 CAknMemorySelectionDialogMultiDrive* memoryDialog = 
  4409                 CAknMemorySelectionDialogMultiDrive* memoryDialog = 
  5310         {
  5329         {
  5311         iController.StopViewFinder();
  5330         iController.StopViewFinder();
  5312         iViewFinderStopped = ETrue;        
  5331         iViewFinderStopped = ETrue;        
  5313         } 
  5332         } 
  5314  
  5333  
       
  5334     if ( iStartupLogoController )
       
  5335         {
       
  5336         iStartupLogoController->ShowLogo();
       
  5337         }
       
  5338 
  5315     PRINT( _L("Camera <= CCamAppUi::InternalExitL") );
  5339     PRINT( _L("Camera <= CCamAppUi::InternalExitL") );
  5316     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP_CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 0" );
  5340     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, DUP_CCAMAPPUI_INTERNALEXITL, "e_CCamAppUi_InternalExitL 0" );
  5317     
  5341     
  5318     } 
  5342     } 
  5319 
  5343 
  8313 // CCamAppUi::AllMemoriesFullOrUnavailable
  8337 // CCamAppUi::AllMemoriesFullOrUnavailable
  8314 // -----------------------------------------------------------------------------
  8338 // -----------------------------------------------------------------------------
  8315 //
  8339 //
  8316 TBool CCamAppUi::AllMemoriesFullOrUnavailable() const
  8340 TBool CCamAppUi::AllMemoriesFullOrUnavailable() const
  8317 	{
  8341 	{
  8318 	return ( IsMemoryFullOrUnavailable(ECamMediaStoragePhone) &&
  8342 	TBool phoneMemoryUnavailable = iController.IntegerSettingValue(ECamSettingItemRemovePhoneMemoryUsage)?
       
  8343                                     ETrue:
       
  8344                                     IsMemoryFullOrUnavailable(ECamMediaStoragePhone);
       
  8345     return ( phoneMemoryUnavailable &&
  8319 		   IsMemoryFullOrUnavailable(ECamMediaStorageCard) &&
  8346 		   IsMemoryFullOrUnavailable(ECamMediaStorageCard) &&
  8320 		   IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage) );
  8347 		   IsMemoryFullOrUnavailable(ECamMediaStorageMassStorage) );
  8321 	}
  8348 	}
  8322 
  8349 
  8323     
  8350     
  8474 // -----------------------------------------------------------------------------
  8501 // -----------------------------------------------------------------------------
  8475 //
  8502 //
  8476 void CCamAppUi::SetViewFinderStoppedStatus( TBool aViewFinderStopped )
  8503 void CCamAppUi::SetViewFinderStoppedStatus( TBool aViewFinderStopped )
  8477     {
  8504     {
  8478     iViewFinderStopped = aViewFinderStopped;
  8505     iViewFinderStopped = aViewFinderStopped;
       
  8506 
       
  8507     if (iStartupLogoController)
       
  8508         {
       
  8509         iStartupLogoController->HideLogo();
       
  8510         }
  8479     }
  8511     }
  8480 
  8512 
  8481 // -----------------------------------------------------------------------------
  8513 // -----------------------------------------------------------------------------
  8482 // CCamAppUi::IsViewFinderInTransit 
  8514 // CCamAppUi::IsViewFinderInTransit 
  8483 // -----------------------------------------------------------------------------
  8515 // -----------------------------------------------------------------------------
  8498     
  8530     
  8499 // -----------------------------------------------------------------------------
  8531 // -----------------------------------------------------------------------------
  8500 // CCamAppUi::CheckMemoryAvailableForCapturing
  8532 // CCamAppUi::CheckMemoryAvailableForCapturing
  8501 // -----------------------------------------------------------------------------
  8533 // -----------------------------------------------------------------------------
  8502 //
  8534 //
  8503 void 
  8535 void CCamAppUi::CheckMemoryAvailableForCapturing()
  8504 CCamAppUi::CheckMemoryAvailableForCapturing()
  8536     {
  8505 	{
       
  8506     PRINT( _L("Camera => CCamAppUi::CheckMemoryAvailableForCapturing") )
  8537     PRINT( _L("Camera => CCamAppUi::CheckMemoryAvailableForCapturing") )
  8507     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CHECKMEMORYAVAILABLEFORCAPTURING, "e_CCamAppUi_CheckMemoryAvailableForCapturing 1" );
  8538     OstTrace0( CAMERAAPP_PERFORMANCE_DETAIL, CCAMAPPUI_CHECKMEMORYAVAILABLEFORCAPTURING, "e_CCamAppUi_CheckMemoryAvailableForCapturing 1" );
  8508     if ( ( ECamControllerVideo == iController.CurrentMode() ||
  8539     if ( ( ECamControllerVideo == iController.CurrentMode() ||
  8509            ECamControllerVideo == iController.TargetMode() ) &&
  8540            ECamControllerVideo == iController.TargetMode() ) &&
  8510            ECamMediaStorageCard == iController.
  8541            ECamMediaStorageCard == iController.
  8521     }    
  8552     }    
  8522 
  8553 
  8523 // -----------------------------------------------------------------------------
  8554 // -----------------------------------------------------------------------------
  8524 // CCamAppUi::IsMemoryAvailableForCapturing
  8555 // CCamAppUi::IsMemoryAvailableForCapturing
  8525 // -----------------------------------------------------------------------------
  8556 // -----------------------------------------------------------------------------
  8526 //    
  8557 //
  8527 TBool 
  8558 TBool CCamAppUi::IsMemoryAvailableForCapturing() const
  8528 CCamAppUi::IsMemoryAvailableForCapturing() const
       
  8529     {
  8559     {
  8530     return iMemoryAvailableForCapturing;
  8560     return iMemoryAvailableForCapturing;
  8531     }
  8561     }
  8532         
  8562 
       
  8563 // -----------------------------------------------------------------------------
       
  8564 // CCamAppUi::StartupLogoController
       
  8565 // -----------------------------------------------------------------------------
       
  8566 //
       
  8567 CCamStartupLogoController* CCamAppUi::StartupLogoController()
       
  8568     {
       
  8569     return iStartupLogoController;
       
  8570     }
       
  8571 
  8533 //  End of File
  8572 //  End of File