basiclocationinfodisplay/blid/ui/inc/CHtkTripMeterControl.h
branchRCL_3
changeset 17 1fc85118c3ae
parent 16 8173571d354e
child 18 870918037e16
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Blid application Tripmeter view's control class definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CHTKTRIPMETERCONTROL_H__
       
    21 #define __CHTKTRIPMETERCONTROL_H__
       
    22 
       
    23 // SYSTEM INCLUDES
       
    24 #include <alf/alfcontrol.h>
       
    25 
       
    26 // USER INCLUDE
       
    27 
       
    28 //FORWARD DCLERATION
       
    29 class MBlidLocation;
       
    30 class MBlidRouter;
       
    31 class MBlidSettings;
       
    32 class MKeyProcessor;
       
    33 class CAlfEnv;
       
    34 class CBlidEng;
       
    35 class CAknNavigationDecorator;
       
    36 class CAknTabGroup;
       
    37 class CEikStatusPane;
       
    38 class CBlidBaseView;
       
    39 class CAlfImageVisual;
       
    40 class CAlfTextVisual;
       
    41 class CAlfAnchorLayout;
       
    42 class CAlfDeckLayout;
       
    43 class CAlfCurvePathLayout;
       
    44 class CRepository;
       
    45 class CAlfTextStyle;
       
    46 class CAlfFrameBrush;
       
    47 class CAlfImageLoaderUtil;
       
    48 class CAlfTexture;
       
    49 
       
    50 /*! 
       
    51   @class CHtkTripMeterControl
       
    52   
       
    53   @discussion HUITK-based control that displays the text "Hello World".
       
    54   */
       
    55 class CHtkTripMeterControl : public CAlfControl
       
    56     {
       
    57 	public:
       
    58 		 /*!
       
    59 		  @function NewL
       
    60 		   
       
    61 		  @discussion Create a CHtkTripMeterControl object, which will draw itself to aRect
       
    62 		  @param aRect the rectangle this view will be drawn to
       
    63 		  @result a pointer to the created instance of CHtkTripMeterControl
       
    64 		  */
       
    65 	    static CHtkTripMeterControl* NewL(CAlfEnv& aEnv,
       
    66 		    							MKeyProcessor& aKeyProcessor,
       
    67                                         MObjectProvider* aParent,
       
    68 		                                const TRect& aRect,
       
    69                                         MBlidLocation* aLocation,
       
    70                                         MBlidRouter* aRouter,
       
    71                                         CBlidEng& aEngine,
       
    72                                         CBlidBaseView& aView);
       
    73 
       
    74 		 /*!
       
    75 		  @function ~CHtkTripMeterControl
       
    76 		  
       
    77 		  @discussion Destroy the object and release all memory objects
       
    78 		  */
       
    79 		~CHtkTripMeterControl();
       
    80 
       
    81 	  
       
    82 	private:
       
    83 		 /*!
       
    84 		  @function CHtkTripMeterControl
       
    85 		  
       
    86 		  @discussion Perform the first phase of two phase construction 
       
    87 		  */
       
    88 	    CHtkTripMeterControl(CAlfEnv& aEnv,
       
    89 	    					MKeyProcessor& aKeyProcessor,
       
    90                             MBlidRouter& aRouter,
       
    91                             CBlidBaseView& aView,
       
    92                             CBlidEng& aEngine );
       
    93 
       
    94 		 /*!
       
    95 		  @function ConstructL
       
    96 		  
       
    97 		  @discussion  Perform the second phase construction of a CHtkTripMeterControl object
       
    98 		  */
       
    99 		void ConstructL(CAlfEnv& aEnv,
       
   100 						const TRect& aRect,
       
   101                         MBlidLocation* aLocation,
       
   102                         CBlidEng& aEngine );
       
   103                         
       
   104                         
       
   105 	public:	    //from CAlfControl
       
   106 		/**
       
   107          * Handle key event
       
   108          */
       
   109 		TBool OfferEventL( const TAlfEvent& aEvent );
       
   110 		/**
       
   111          * Process command
       
   112          */	
       
   113 		void ProcessCommandL(TInt aCommand);
       
   114 		
       
   115     public: // New functions
       
   116         /**
       
   117          * Update the display, called whenever a position update is received
       
   118          */
       
   119         void UpdateL();
       
   120         
       
   121     public: 
       
   122     	/**
       
   123          * Retruns ETrue if trip is started
       
   124          */
       
   125 	    TBool HasTripStarted();
       
   126 	    /**
       
   127          * Checks if GPS Data was lost
       
   128          */
       
   129 	    TBool WasGPSDataLost();
       
   130 	    /**
       
   131          * Sets GPS Data availability
       
   132          */
       
   133 	    void SetGPSDataAvailability(TBool aAvailability);
       
   134 
       
   135         /**
       
   136          * Make title
       
   137          * @param aResourceText resource to create title
       
   138          */
       
   139         void MakeTitleL( TInt aResourceText );
       
   140 		
       
   141 		/**
       
   142          * Returns Navigation decorator
       
   143          */
       
   144 		CAknNavigationDecorator* GetNiviDecorator( );
       
   145 
       
   146         /**
       
   147          * Create CAknNavigationDecorator, ownership passed to caller.
       
   148          * @param aDefaultNaviPane, ETrue if default, EFalse if tabgroup
       
   149          */
       
   150         void CreateNaviPaneL( TBool aDefaultNaviPane );
       
   151 
       
   152         /**
       
   153          * Activate navigation decorator.
       
   154          * Method can called if tab needs to be refreshed.
       
   155          * @param aNaviDecorator    navigation decorator
       
   156          * @param aTabId            activated tabulator id             
       
   157          */
       
   158         void ActivateTabL( CAknNavigationDecorator& aNaviDecorator, 
       
   159                             TInt aTabId );
       
   160 		/**
       
   161          * Saves the odometer value
       
   162          */
       
   163 		void SaveOdometerValue();
       
   164 		/**
       
   165          * Reset Odometer Distance
       
   166          */
       
   167 		void ResetOdometerDistanceL( );
       
   168 		/**
       
   169          * Change trip focus
       
   170          */
       
   171 		void ChangeTripFocus( TBool aSTripDimmed );
       
   172 		/**
       
   173          * Rechange trip focus
       
   174          */
       
   175 		void ReChangeTripFocus( );
       
   176 		/**
       
   177          * Update layout
       
   178          */
       
   179 		void UpdateLayoutL( );
       
   180 		/**
       
   181          * Displays info popup
       
   182          */
       
   183 		void DisplayInfoPopUpMsgL();
       
   184 		
       
   185 	private:    
       
   186         /** 
       
   187          * Add new tabs to tabgroup
       
   188          * @param aTabGroup
       
   189          */
       
   190         void AddTabsL(CAknTabGroup& aTabGroup);
       
   191         
       
   192         /**
       
   193          * Appui's status pane getter
       
   194          * @return Statuspane pointer
       
   195          */
       
   196         CEikStatusPane* StatusPane();
       
   197         /**
       
   198          * Creates the trip visuals
       
   199          */
       
   200         void CreateTripVisualsL( );
       
   201 		/**
       
   202          * Returns tripmeter value as descriptor
       
   203          */
       
   204 		void TripmeterFormatL( TDes& aTripmeterString );
       
   205 		/**
       
   206          * Returns total trip time as descriptor
       
   207          */
       
   208 		void TotalTimeFormat( TDes& aTotalTimeString );
       
   209 		/**
       
   210          * Returns odometer value as descriptor
       
   211          */
       
   212 		void OdometerFormat( TDes& aOdometerString );
       
   213 		/**
       
   214          * Returns current trip time as descriptor
       
   215          */
       
   216 		void TripTimeFormat( TDes& aTripTimeString );
       
   217 		/**
       
   218          * Set the value of tripmeter
       
   219          */
       
   220 		void SetTRipMeterValueL( );
       
   221 		/**
       
   222          * Set the value of odometer
       
   223          */
       
   224 		void SetOdoMeterValueL( );
       
   225 		/**
       
   226          * Set the trip time
       
   227          */
       
   228 		void SetTripTimeL( );
       
   229 		/**
       
   230          * Set the trip speed
       
   231          */
       
   232 		void SetTripSpeed( );
       
   233 		/**
       
   234          * Create speed visuals
       
   235          */
       
   236 		void CreateSpeedVisualsL();
       
   237 		/**
       
   238          * Rotates the speed dial
       
   239          */
       
   240 		void RotateSpeedDialL( int aThetaPrevious, int aThetaFinal );
       
   241 		/**
       
   242          * Ceates the speeed format
       
   243          */
       
   244 		void CreateSpeedFormatsL();
       
   245 		/**
       
   246          * Change the speedmeter scale
       
   247          */
       
   248 		void ChangeSpeedometerScaleL();
       
   249 		/**
       
   250          * Formats the odometer distance
       
   251          */
       
   252 		void FormatOdometerDistance( TReal aLastodometerValue );
       
   253 		/**
       
   254          * Launches device not available note
       
   255          */
       
   256 		void LaunchDeviceNotAvlNoteL();
       
   257 		/**
       
   258          * Displays the current signal strength
       
   259          */
       
   260 		void DisplaySatelliteSignalStrength( TInt aSatCount );
       
   261 		/**
       
   262          * Launches info query dialog
       
   263          */
       
   264 		void LaunchInfoQueryDlgL();		
       
   265 		/**
       
   266          * Update visual image
       
   267          */
       
   268         void UpdateVisualImage();
       
   269         /**
       
   270          * Create Popup visuals
       
   271          */
       
   272         void CreatePopUpVisualL();
       
   273         /**
       
   274          * Create all signal textures
       
   275          */
       
   276 		void CreateSignalTexturesL();
       
   277 		/**
       
   278          * Create popup image tesxture
       
   279          */
       
   280 		void CreatePopupImgTextureL();		 
       
   281         /**
       
   282          * Called when timer is expired
       
   283          */
       
   284         static TInt Tick(TAny* aObject); // functions for TCallBack protocol
       
   285         /**
       
   286          * Calculate the Layout Rects
       
   287          */
       
   288         void CalculateRects();
       
   289         /**
       
   290          * Set Anchors for Visuals
       
   291          */
       
   292         void SetAnchors();
       
   293 	private:
       
   294         /// Ref: aRouter
       
   295         MBlidRouter& iRouter;
       
   296         
       
   297         MBlidLocation* iLocation;
       
   298 
       
   299         /// Own: Decorator class for navigation pane controls.
       
   300         CAknNavigationDecorator* iDecoratedTabGroup;        
       
   301 
       
   302         /// Reference to the view to handle resource change
       
   303         CBlidBaseView& iView;
       
   304         
       
   305         /// Reference to the engine
       
   306         CBlidEng& iEngine;
       
   307                 
       
   308 		//Own: Layout for all the visuals.
       
   309 		CAlfAnchorLayout* iTripLayout;
       
   310 		
       
   311 		CAlfEnv& iEnv;
       
   312 		
       
   313 		CAlfImageVisual* iTripDeckVisual;
       
   314 		CAlfImageVisual* iOdoDeckVisual;
       
   315 		CAlfImageVisual* iBigTripVisual;
       
   316 		CAlfDeckLayout* iTripDistLayout;
       
   317 		CAlfDeckLayout* iOdoLayout;
       
   318 		CAlfImageVisual* iTripDialVisual;
       
   319 		CAlfImageVisual* iTripTimeVisual;
       
   320 		//CAlfDeckLayout* iTripTimeLayout;
       
   321 		CAlfDeckLayout* iBigTripDecLayout;
       
   322     	/// Ref: A pointer to MBlidSettings model
       
   323         MBlidSettings* iSettingsModel;
       
   324         
       
   325         HBufC* iDurationFormatLong;
       
   326         
       
   327         HBufC* iSpeedFormatKmph;
       
   328         
       
   329         HBufC* iSpeedFormatMph;
       
   330         
       
   331         HBufC* iDataBlank;
       
   332         
       
   333         HBufC* iTripDistance;
       
   334         
       
   335         HBufC* iOdometerDistance;
       
   336         
       
   337 		//CAlfCurvePathLayout* iSpeedCurve;
       
   338 		//CAlfDeckLayout* iMileLayout;
       
   339 		CAlfTextVisual* iMileVisual[9];
       
   340 		TInt iSpeedCount;
       
   341 		TReal32 iPrevSpeed;
       
   342 		TInt iMaxScale;
       
   343 		TInt iPrevAngle;
       
   344 		TInt iNextAngle;
       
   345 		
       
   346 		CAlfAnchorLayout* iPointerLayout;
       
   347 		
       
   348 		CAlfTextVisual* iTripMeter;
       
   349 		
       
   350 		CAlfTextVisual* iOdoMeter;
       
   351 		
       
   352 		CAlfTextVisual* iTriptime;
       
   353 		
       
   354 		CAlfTextVisual* iSpeedFormatVisual;
       
   355 		
       
   356 		TReal32 iCurrSpeed;
       
   357 		
       
   358 		TBool iIsLessThanInitial;
       
   359 		
       
   360 		CRepository* iRepository;
       
   361 		
       
   362 		TReal iLastodometerValue;
       
   363 		
       
   364 		TReal iOdoValueToStore;
       
   365 		
       
   366 		CAlfTextStyle* iStyle1;
       
   367 		
       
   368 		CAlfAnchorLayout* iPopUpLayout;
       
   369 		
       
   370 		CAlfTextVisual* iPopUpMsg;
       
   371 		
       
   372 		CAlfImageVisual* iPopImage;
       
   373 		
       
   374 		TBool isSatelliteInfoLaunch;
       
   375 		
       
   376 		CAlfDeckLayout* iPopupDeck;
       
   377 		
       
   378 		CAlfFrameBrush* iFrameBrush;
       
   379 		
       
   380 		CAlfImageVisual* iImageVisual;
       
   381 		
       
   382 	    CPeriodic* iPeriodic; // periodic timer active object
       
   383         TInt iDisplayIcon;    // Current svg animation icon
       
   384 	    RPointerArray<CAlfTexture> iPopupTextures;
       
   385 	    RPointerArray<CAlfTexture> iSignalTextures;
       
   386 	    CAlfTexture* iPopupImgTexture;	    	    
       
   387 		
       
   388 		HBufC*	iImagePath;
       
   389 		
       
   390 		TBool iSTripDimmed;
       
   391 		
       
   392 		CAlfAnchorLayout* iPopUpAnchor;
       
   393 		
       
   394 		TRect iBigTripRect;
       
   395 		
       
   396 		TRect iTripDialRect;
       
   397 		
       
   398 		TRect iTripDeckRect;
       
   399 		
       
   400 		TRect iTripMeterRect;
       
   401 		
       
   402 		TRect iOdoDeckRect;
       
   403 		
       
   404 		TRect iOdoMeterRect;
       
   405 		
       
   406 		TRect iSpeedFormatRect;
       
   407 		
       
   408 		TRect iTripTimeRect;
       
   409 		
       
   410 		TRect iClockImageRect;
       
   411 		
       
   412 		TRect iValueRect1;
       
   413 		
       
   414 		TRect iValueRect2;
       
   415 		
       
   416 		TRect iValueRect3;
       
   417 		
       
   418 		TRect iValueRect4;
       
   419 		
       
   420 		TRect iValueRect5;
       
   421 		
       
   422 		TRect iValueRect6;
       
   423 		
       
   424 		TRect iValueRect7;
       
   425 		
       
   426 		TRect iValueRect8;
       
   427 		
       
   428 		TRect iValueRect9;		
       
   429 		
       
   430 		TRect iSignalStrengthRect;												
       
   431 		
       
   432 		TBool isDeviceUnavailableDisplayed;											
       
   433 		TBool iIsDownPressed;										;
       
   434     };
       
   435 
       
   436 #endif // __CHTKTRIPMETERCONTROL_H__