photosgallery/viewframework/views/viewbase/src/glxviewbase.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 68 5b238bc8ffb6
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    41 #include <mglxanimation.h>
    41 #include <mglxanimation.h>
    42 #include "glxcommandhandler.h"
    42 #include "glxcommandhandler.h"
    43 
    43 
    44 #include <aknbutton.h>                      // for getting the button state
    44 #include <aknbutton.h>                      // for getting the button state
    45 
    45 
    46 // For transition effects                           
       
    47 #include <gfxtranseffect/gfxtranseffect.h>
       
    48 
       
    49 _LIT(KGlxViewBaseResource, "glxviewbase.rsc");
    46 _LIT(KGlxViewBaseResource, "glxviewbase.rsc");
    50 
    47 
    51 /// Length of time a view-switch animation should take
    48 /// Length of time a view-switch animation should take
    52 const TInt KGlxViewSwitchAnimationDuration = 1000 * KGlxAnimationSlowDownFactor;
    49 const TInt KGlxViewSwitchAnimationDuration = 1000 * KGlxAnimationSlowDownFactor;
    53 
    50 
    55 // Constructor
    52 // Constructor
    56 // -----------------------------------------------------------------------------
    53 // -----------------------------------------------------------------------------
    57 //	
    54 //	
    58 EXPORT_C CGlxViewBase::CGlxViewBase(TBool aSyncActivation) :
    55 EXPORT_C CGlxViewBase::CGlxViewBase(TBool aSyncActivation) :
    59     iViewAnimationTime(KGlxViewSwitchAnimationDuration),
    56     iViewAnimationTime(KGlxViewSwitchAnimationDuration),
    60     iIsTransEffectStarted(EFalse),
       
    61     iViewAnimationInProgress(EGlxViewAnimationNone),
    57     iViewAnimationInProgress(EGlxViewAnimationNone),
    62     iSyncActivation(aSyncActivation)
    58     iSyncActivation(aSyncActivation)
    63     {
    59     {
    64     TRACER( "CGlxViewBase::CGlxViewBase()" );
    60     TRACER( "CGlxViewBase::CGlxViewBase()" );
    65     }
    61     }
   549     {
   545     {
   550     TRACER( "CGlxViewBase::OfferToolbarEventL" );
   546     TRACER( "CGlxViewBase::OfferToolbarEventL" );
   551     CAknToolbar* toolbar = GetToolBar();
   547     CAknToolbar* toolbar = GetToolBar();
   552     if(toolbar)
   548     if(toolbar)
   553         {
   549         {
       
   550         CAknButton* slideshowButton =
       
   551             static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdSlideshow));
       
   552         TBool slideshowdimmed = EFalse;
       
   553 
   554         //Here after the toolbar cmd is processed it is enabled
   554         //Here after the toolbar cmd is processed it is enabled
   555         //back. For share the toolbar state should be same as it was 
   555         //back. For share the toolbar state should be same as it was 
   556         //earlier, so we take the current state and reset back after
   556         //earlier, so we take the current state and reset back after
   557         //the command is processed.
   557         //the command is processed.
   558         CAknButton* uploadButton =
   558         CAknButton* uploadButton =
   560         TBool uploaddimmed = EFalse;
   560         TBool uploaddimmed = EFalse;
   561 
   561 
   562         CAknButton* markButton =
   562         CAknButton* markButton =
   563             static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdStartMultipleMarking));
   563             static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdStartMultipleMarking));
   564         TBool markButtondimmed = EFalse;
   564         TBool markButtondimmed = EFalse;
   565         
   565 
   566         CAknButton* deleteButton =
   566         if(slideshowButton)
   567             static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdDelete));
   567             {
   568         TBool deleteButtondimmed = EFalse;
   568             // Get current button state
   569         
   569             CAknButtonState* currentState = slideshowButton->State();
   570         CAknButton* sendButton =
   570             slideshowdimmed = slideshowButton->IsDimmed();
   571             static_cast<CAknButton*> (toolbar->ControlOrNull(EGlxCmdSend));
   571             }
   572         TBool sendButtondimmed = EFalse;
       
   573 
   572 
   574         if(markButton)
   573         if(markButton)
   575             {
   574             {
       
   575             // Get current button state
       
   576             CAknButtonState* currentState = markButton->State();
   576             markButtondimmed = markButton->IsDimmed();
   577             markButtondimmed = markButton->IsDimmed();
   577             }        
   578             }        
   578         
   579         
   579         if(uploadButton)
   580         if(uploadButton)
   580             {
   581             {
       
   582             // Get current button state
       
   583             CAknButtonState* currentState = uploadButton->State();
   581             uploaddimmed = uploadButton->IsDimmed();
   584             uploaddimmed = uploadButton->IsDimmed();
   582             }     
   585             }
   583         
   586 
   584         if(deleteButton)
       
   585             {
       
   586 			deleteButtondimmed = deleteButton->IsDimmed();
       
   587             }
       
   588         
       
   589         if(sendButton)
       
   590             {
       
   591 			sendButtondimmed = sendButton->IsDimmed();
       
   592             }
       
   593         
       
   594         // Deactivate the toolbar. Don't accept the toolbar input when the command
   587         // Deactivate the toolbar. Don't accept the toolbar input when the command
   595         // execution is already in progress.
   588         // execution is already in progress.
   596         SetToolbarItemsDimmed(ETrue); 
   589         SetToolbarItemsDimmed(ETrue); 
   597         
   590         
   598         // Execute the command recieved.
   591         // Execute the command recieved.
   600 
   593 
   601         // Activate back the toolbar and set it's state properly
   594         // Activate back the toolbar and set it's state properly
   602         // after command execution.
   595         // after command execution.
   603         SetToolbarStateL();
   596         SetToolbarStateL();
   604 
   597 
   605         // Note: Slideshow toolbar item update is done
       
   606         // at CGlxToolbarController::SetStatusL()
       
   607 
       
   608         if(!markButtondimmed)
   598         if(!markButtondimmed)
   609             {
   599             {
   610             toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, EFalse, ETrue);
   600             toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, EFalse, ETrue);
   611             }
   601             }
   612 
   602 
       
   603         if(!slideshowdimmed)
       
   604             {
       
   605             toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, EFalse, ETrue);
       
   606             }
       
   607         
   613         if(uploaddimmed || (aCommand == EGlxCmdStartMultipleMarking))
   608         if(uploaddimmed || (aCommand == EGlxCmdStartMultipleMarking))
   614             {
   609             {
   615             toolbar->SetItemDimmed(EGlxCmdUpload, ETrue, ETrue);
   610             toolbar->SetItemDimmed(EGlxCmdUpload, ETrue, ETrue);
   616             }
   611             }
   617  
       
   618         if(!deleteButtondimmed)
       
   619             {
       
   620             toolbar->SetItemDimmed(EGlxCmdDelete, EFalse, ETrue);
       
   621             }
       
   622         
       
   623         if(!sendButtondimmed)
       
   624             {
       
   625             toolbar->SetItemDimmed(EGlxCmdSend, EFalse, ETrue);
       
   626             }        
       
   627         }    
   612         }    
   628     }
   613     }
   629 
   614 
   630 // -----------------------------------------------------------------------------
   615 // -----------------------------------------------------------------------------
   631 // SetToolbarObserver
   616 // SetToolbarObserver
   723     while ( i < count )
   708     while ( i < count )
   724         {
   709         {
   725         iCommandHandlerList[i]->ActivateL(Id().iUid);
   710         iCommandHandlerList[i]->ActivateL(Id().iUid);
   726         i++;
   711         i++;
   727         }
   712         }
   728     
       
   729     //Check if transition effect is already started.
       
   730     //Calling the 'EndFullScreen()' actually starts the FS transition effect.
       
   731     if(iIsTransEffectStarted)
       
   732 		{
       
   733 		GfxTransEffect::EndFullScreen();
       
   734 		iIsTransEffectStarted = EFalse;
       
   735 		}
       
   736 
   713 
   737     InitAnimationL(EGlxViewAnimationEntry); 
   714     InitAnimationL(EGlxViewAnimationEntry); 
   738     }
   715     }
   739 
   716 
   740 // ----------------------------------------------------------------------------
   717 // ----------------------------------------------------------------------------
   748     if (toolbar)
   725     if (toolbar)
   749         {
   726         {
   750         toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, aDimmed, ETrue);
   727         toolbar->SetItemDimmed(EGlxCmdSlideshowPlay, aDimmed, ETrue);
   751         toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, aDimmed, ETrue);
   728         toolbar->SetItemDimmed(EGlxCmdStartMultipleMarking, aDimmed, ETrue);
   752         toolbar->SetItemDimmed(EGlxCmdUpload, aDimmed, ETrue);
   729         toolbar->SetItemDimmed(EGlxCmdUpload, aDimmed, ETrue);
   753         toolbar->SetItemDimmed(EGlxCmdDelete, aDimmed, ETrue);
   730         }
   754         toolbar->SetItemDimmed(EGlxCmdSend, aDimmed, ETrue);
   731     }
   755         }
   732 
   756     }
   733 
   757 
       
   758