clock2/clockui/uilayer/src/clockappui.cpp
branchRCL_3
changeset 30 d68a4b5d5885
parent 20 21239b3bcd78
child 60 96907930389d
equal deleted inserted replaced
27:55d60436f00b 30:d68a4b5d5885
    27 #include <clockapp_tab.mbg>
    27 #include <clockapp_tab.mbg>
    28 #include <AknsConstants.h>
    28 #include <AknsConstants.h>
    29 #include <featmgr.h>  
    29 #include <featmgr.h>  
    30 #include <e32property.h>
    30 #include <e32property.h>
    31 #include <startupdomainpskeys.h>
    31 #include <startupdomainpskeys.h>
       
    32 #include <touchfeedback.h>
       
    33 #include <gfxtranseffect/gfxtranseffect.h> 
    32 
    34 
    33 // User includes
    35 // User includes
    34 #include "clock.h"
    36 #include "clock.h"
    35 #include "clockappui.h"
    37 #include "clockappui.h"
    36 #include "clockmainview.h"
    38 #include "clockmainview.h"
    51                           EChangesPowerStatus |
    53                           EChangesPowerStatus |
    52                           EChangesSystemTime |
    54                           EChangesSystemTime |
    53                           EChangesFreeMemory |
    55                           EChangesFreeMemory |
    54                           EChangesOutOfMemory );
    56                           EChangesOutOfMemory );
    55 
    57 
       
    58 // constants for control effects
       
    59 const TInt KGfxControlPageSwitchDisappear = 4;
       
    60 const TInt KGfxControlPageSwitchAppear = 3;
       
    61 
       
    62 const TUid KControlUid1 = {0x2000B47C};  
       
    63 const TUid KControlUid2 = {0x2000B47D};
       
    64 
    56 // Literals
    65 // Literals
    57 _LIT( KIconFileName, "\\resource\\apps\\clockapp_tab.mif" );
    66 _LIT( KIconFileName, "\\resource\\apps\\clockapp_tab.mif" );
    58 _LIT( KIAParamExec, "clock.exe" );
    67 _LIT( KIAParamExec, "clock.exe" );
    59 
    68 
    60 // ---------------------------------------------------------
    69 // ---------------------------------------------------------
   131 	
   140 	
   132 	// Construct the datetime settings view.
   141 	// Construct the datetime settings view.
   133     CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue );
   142     CClkDateTimeView* dateTimeView = CClkDateTimeView::NewLC( KClockAppMainViewId, ETrue );
   134     AddViewL( dateTimeView );
   143     AddViewL( dateTimeView );
   135     CleanupStack::Pop( dateTimeView );
   144     CleanupStack::Pop( dateTimeView );
   136 	
   145 
       
   146     iTactileFeedbackSupported = FeatureManager::FeatureSupported( KFeatureIdTactileFeedback );
       
   147     
   137 	// Start the model.
   148 	// Start the model.
   138 	alarmModel->Start();
   149 	alarmModel->Start();
   139 	
   150 	
   140 	// Construct and start the environment change notifier.
   151 	// Construct and start the environment change notifier.
   141 	TCallBack callBack( NotifierCallbackL, this );
   152 	TCallBack callBack( NotifierCallbackL, this );
   294     switch( activeTabId )
   305     switch( activeTabId )
   295         {
   306         {
   296         case EClockAppMainViewId:
   307         case EClockAppMainViewId:
   297             {
   308             {
   298             // The main view.
   309             // The main view.
       
   310             iTransitionOngoing = ETrue;
       
   311             iTransitionDirection = ETransitionLeft;
   299             ActivateLocalViewL( KClockAppMainViewId );
   312             ActivateLocalViewL( KClockAppMainViewId );
   300             }
   313             }
   301             break;
   314             break;
   302         
   315         
   303         case EClockAppWorldViewId:
   316         case EClockAppWorldViewId:
   304             {
   317             {
   305             // The clockworld view.
   318             // The clockworld view.
       
   319             iTransitionOngoing = ETrue;
       
   320             iTransitionDirection = ETransitionRight;
   306             ActivateLocalViewL( KClockAppWorldViewId );
   321             ActivateLocalViewL( KClockAppWorldViewId );
   307             }
   322             }
   308             break;
   323             break;
   309                     
   324                     
   310         default:
   325         default:
   502 //
   517 //
   503 void CClockAppUi::OpenSettingsViewL()
   518 void CClockAppUi::OpenSettingsViewL()
   504     {
   519     {
   505     // Set the title pane text first
   520     // Set the title pane text first
   506     SetTitlePaneTextL( R_CLOCK_TITLE_SETTINGS );
   521     SetTitlePaneTextL( R_CLOCK_TITLE_SETTINGS );
   507 
   522     
       
   523     // Activate the date and time settings view
       
   524     ActivateLocalViewL( KClkDateTimeViewId );
       
   525     
   508     // Don't display the navigation pane when switching to settings view.
   526     // Don't display the navigation pane when switching to settings view.
   509     if( iNavigationDecorator )
   527     if( iNavigationDecorator )
   510         {
   528         {
   511         iNavigationDecorator->MakeVisible( EFalse );
   529         iNavigationDecorator->MakeVisible( EFalse );
   512         }
   530         }
   544     
   562     
   545     viewId.iAppUid = KClockAppUid;
   563     viewId.iAppUid = KClockAppUid;
   546     viewId.iViewUid = KClockAppMainViewId;
   564     viewId.iViewUid = KClockAppMainViewId;
   547                         
   565                         
   548     // Switch to the main view
   566     // Switch to the main view
   549     // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() );
   567     if( iTabGroup->ActiveTabId() == EClockAppWorldViewId )
   550     TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
   568         {
   551 
   569         ActivateLocalViewL( KClockAppMainViewId, TUid::Uid(KClockHideInBackground), KNullDesC8() );
       
   570         //TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
       
   571         }
       
   572     else
       
   573         {
       
   574         // ActivateLocalViewL( KClockAppMainViewId, KClockAppMainViewId, KNullDesC8() );
       
   575         TRAP_IGNORE( CAknViewAppUi::CreateActivateViewEventL( viewId, TUid::Uid(KClockHideInBackground), KNullDesC8 ) ) ;
       
   576         }
   552 	// Update the tab.
   577 	// Update the tab.
   553 	iTabGroup->SetActiveTabById( EClockAppMainViewId );
   578 	iTabGroup->SetActiveTabById( EClockAppMainViewId );
   554     }
   579     }
   555 
   580 
   556 // ---------------------------------------------------------
   581 // ---------------------------------------------------------
   695             iUpdate->CheckUpdates( *iParameters );
   720             iUpdate->CheckUpdates( *iParameters );
   696             }
   721             }
   697         }
   722         }
   698     __PRINTS( "CClockAppUi::HandleIADUpdateL - Exit" );
   723     __PRINTS( "CClockAppUi::HandleIADUpdateL - Exit" );
   699     }
   724     }
       
   725 	
       
   726 TBool CClockAppUi::TransitionOngoing() const
       
   727     {
       
   728     return iTransitionOngoing;
       
   729     }
       
   730 
       
   731 void CClockAppUi::SetTransitionOngoing( TBool aTransitionOngoing )
       
   732     {
       
   733     iTransitionOngoing = aTransitionOngoing;
       
   734     }
       
   735 
       
   736 void CClockAppUi::SetTransitionGroupId( TInt aId )
       
   737     {
       
   738     iTransitionGroupId = aId;
       
   739     }
       
   740 
       
   741 TInt CClockAppUi::TransitionGroupId() const
       
   742     {
       
   743     return iTransitionGroupId;
       
   744     }
       
   745 
       
   746 CClockAppUi::TTransitionDirection CClockAppUi::TransitionDirection() const
       
   747     {
       
   748     return iTransitionDirection;
       
   749     }
       
   750 
       
   751 void  CClockAppUi::SetTransitionDirection( CClockAppUi::TTransitionDirection aDirection )
       
   752     {
       
   753     iTransitionDirection = aDirection;
       
   754     }
       
   755 
       
   756 void  CClockAppUi::DoDisappearTransition( CCoeControl* aControl )
       
   757     {
       
   758     if( aControl && iTransitionOngoing )
       
   759         {
       
   760         if( iTransitionDirection == ETransitionLeft )
       
   761             {
       
   762             GfxTransEffect::Register( aControl, KControlUid2 );      
       
   763             }
       
   764         else
       
   765             {
       
   766             GfxTransEffect::Register( aControl, KControlUid1 );   
       
   767             }
       
   768         GfxTransEffect::Begin( aControl, KGfxControlPageSwitchDisappear );
       
   769         aControl->MakeVisible( EFalse );
       
   770         GfxTransEffect::SetDemarcation( aControl, aControl->Rect() );
       
   771         GfxTransEffect::End( aControl );
       
   772         GfxTransEffect::EndGroup( iTransitionGroupId );
       
   773         iTransitionOngoing = EFalse;
       
   774         }
       
   775     }
       
   776 
       
   777 void  CClockAppUi::DoAppearTransition( CCoeControl* aControl )
       
   778     {
       
   779     if( aControl && iTransitionOngoing )
       
   780         {
       
   781         if( iTransitionDirection == ETransitionLeft )
       
   782             {
       
   783             GfxTransEffect::Register( aControl, KControlUid2 );      
       
   784             }
       
   785         else
       
   786             {
       
   787             GfxTransEffect::Register( aControl, KControlUid1 );   
       
   788             }
       
   789         iTransitionGroupId = GfxTransEffect::BeginGroup();
       
   790         GfxTransEffect::Begin( aControl, KGfxControlPageSwitchAppear );
       
   791         aControl->MakeVisible( ETrue );
       
   792         GfxTransEffect::SetDemarcation( aControl, aControl->Rect() );
       
   793         GfxTransEffect::End( aControl );
       
   794         }
       
   795     }
       
   796 
       
   797 MTouchFeedback* CClockAppUi::GetFeedback()
       
   798 	{
       
   799     if( !iFeedback && iTactileFeedbackSupported )
       
   800     	{
       
   801         iFeedback = MTouchFeedback::Instance();
       
   802         }
       
   803     return iFeedback;
       
   804     }
   700 // End of file
   805 // End of file