|
1 /* |
|
2 * Copyright (c) 2005-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 compass view's compass control class definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 #include <coemain.h> |
|
21 #include <akncontext.h> |
|
22 #include <aknnavide.h> |
|
23 #include <eikspane.h> |
|
24 #include <barsread.h> |
|
25 #include <AknIconArray.h> |
|
26 #include <gulicon.h> |
|
27 #include <StringLoader.h> |
|
28 #include <akntitle.h> |
|
29 #include <avkon.hrh> |
|
30 #include <AknsUtils.h> |
|
31 #include <akntabgrp.h> |
|
32 #include <blid.mbg> |
|
33 #include <blid.rsg> |
|
34 #include <avkon.hrh> |
|
35 #include <eikenv.h> |
|
36 #include <aknsoundsystem.h> |
|
37 #include <centralrepository.h> |
|
38 #include <ProfileEngineSDKCRKeys.h> |
|
39 #include <EPos_CPosLandmark.h> |
|
40 #include <aknnotedialog.h> |
|
41 #include <aknlayoutscalable_apps.cdl.h> |
|
42 #include <layoutmetadata.cdl.h> |
|
43 #include <AknUtils.h> |
|
44 #include <AknsConstants.h> |
|
45 // for HTK |
|
46 #include <alf/alfenv.h> |
|
47 #include <alf/alfanchorlayout.h> |
|
48 #include <alf/alftextvisual.h> |
|
49 #include <alf/alftextstyle.h> |
|
50 #include <alf/alfborderbrush.h> |
|
51 #include <alf/alfbrusharray.h> |
|
52 #include <alf/alfevent.h> |
|
53 #include <alf/alftransformation.h> |
|
54 #include <alf/alfimagevisual.h> |
|
55 #include <alf/alftexture.h> |
|
56 #include <alf/alfroster.h> |
|
57 #include <alf/alfcurvepath.h> |
|
58 #include <alf/alfcurvepathlayout.h> |
|
59 #include <alf/alfimagebrush.h> |
|
60 #include <alf/alfdecklayout.h> |
|
61 #include <alf/alfutil.h> |
|
62 #include <alf/alfframebrush.h> |
|
63 #include <alf/alfimageloaderutil.h> |
|
64 // USER INCLUDES |
|
65 #include "CHtkNavigationControl.h" |
|
66 #include "MBlidSettings.h" |
|
67 #include "Blid.hlp.hrh" |
|
68 #include "Blid.hrh" |
|
69 #include "CBlidAppUi.h" |
|
70 #include "MBlidLocation.h" |
|
71 #include "MBlidRouter.h" |
|
72 #include "CBlidEng.h" |
|
73 #include "bliduiconsts.h" |
|
74 #include "Blidutils.h" |
|
75 #include "TNamedCoordinate.h" |
|
76 #include "CBlidArrivedTonePayerUtility.h" |
|
77 #include "Debug.h" |
|
78 |
|
79 _LIT( KSpeedFormat, "%.1f" ); |
|
80 _LIT( KText1, " " ); |
|
81 _LIT( KFlagVisual, " Flag"); |
|
82 _LIT( KAccVisual, " Accuracy"); |
|
83 |
|
84 const TInt KTimerDuration = 200000; |
|
85 |
|
86 TBool CHtkNavigationControl::iHasToPlayArrivedTone = EFalse; |
|
87 TBool CHtkNavigationControl::iHasArrived = EFalse; |
|
88 TBool CHtkNavigationControl::iInArrivedZone = EFalse; |
|
89 |
|
90 // FORWARD DECLARATION |
|
91 TInt TimerCallBackFunction(TAny* aPtr); |
|
92 |
|
93 |
|
94 // ================= MEMBER FUNCTIONS ======================= |
|
95 // --------------------------------------------------------- |
|
96 // CHtkNavigationControl::NewL() |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 CHtkNavigationControl* CHtkNavigationControl::NewL(CAlfEnv& aEnv, |
|
100 MObjectProvider* aParent, |
|
101 const TRect& aRect, |
|
102 MBlidLocation& aLocation, |
|
103 MBlidRouter& aRouter, |
|
104 CBlidEng& aEngine, |
|
105 CBlidBaseView& aView) |
|
106 { |
|
107 CHtkNavigationControl* self = CHtkNavigationControl::NewLC(aEnv, |
|
108 aParent, |
|
109 aRect, |
|
110 aLocation, |
|
111 aRouter, |
|
112 aEngine, |
|
113 aView); |
|
114 CleanupStack::Pop(self); |
|
115 return self; |
|
116 } |
|
117 |
|
118 |
|
119 // --------------------------------------------------------- |
|
120 // CHtkNavigationControl::NewLC() |
|
121 // --------------------------------------------------------- |
|
122 // |
|
123 CHtkNavigationControl* CHtkNavigationControl::NewLC(CAlfEnv& aEnv, |
|
124 MObjectProvider* /*aParent*/, |
|
125 const TRect& aRect, |
|
126 MBlidLocation& aLocation, |
|
127 MBlidRouter& aRouter, |
|
128 CBlidEng& aEngine, |
|
129 CBlidBaseView& aView) |
|
130 { |
|
131 CHtkNavigationControl* self = new (ELeave) CHtkNavigationControl(aEnv, |
|
132 aLocation, |
|
133 aView, |
|
134 aEngine ); |
|
135 CleanupStack::PushL(self); |
|
136 self->ConstructL(aEnv,aRect,aRouter,aEngine); |
|
137 return self; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 //CHtkNavigationControl::CHtkNavigationControl() |
|
143 // --------------------------------------------------------- |
|
144 // |
|
145 CHtkNavigationControl::CHtkNavigationControl(CAlfEnv& aEnv, |
|
146 MBlidLocation& aLocation, |
|
147 CBlidBaseView& aView, |
|
148 CBlidEng& aEngine ) |
|
149 : CAlfControl( ),iLocationModel( aLocation ), iView(aView), iEngine(aEngine),iEnv(aEnv) |
|
150 |
|
151 { |
|
152 |
|
153 } |
|
154 |
|
155 |
|
156 // --------------------------------------------------------- |
|
157 // CHtkNavigationControl::ConstructL() |
|
158 // --------------------------------------------------------- |
|
159 // |
|
160 void CHtkNavigationControl::ConstructL( CAlfEnv& aEnv, |
|
161 const TRect& /*aRect*/, |
|
162 MBlidRouter& aRouter, |
|
163 CBlidEng& aEngine ) |
|
164 { |
|
165 |
|
166 CAlfControl::ConstructL( aEnv ); |
|
167 |
|
168 // Create a single text visual. The pointer to the visual is stored |
|
169 // as a member variable for later access. |
|
170 CreateNaviPaneL( EFalse ); |
|
171 ActivateTabL( *iDecoratedTabGroup, EBlidNavigationView ); |
|
172 |
|
173 iRouter = &aRouter; |
|
174 iSettings = aEngine.SettingsModel(); |
|
175 CreateApplicationStringsL( ); |
|
176 |
|
177 iImagePath = HBufC::NewL( iEnv.TextureManager().ImagePath().Length() + 1 ); |
|
178 iImagePath->Des().Copy( iEnv.TextureManager().ImagePath() ); |
|
179 iLayout = CAlfAnchorLayout::AddNewL( *this ); |
|
180 |
|
181 AknsUtils::GetCachedColor ( AknsUtils::SkinInstance(), |
|
182 iVisualColor, |
|
183 KAknsIIDQsnTextColors, |
|
184 EAknsCIQsnTextColorsCG1 |
|
185 ); |
|
186 |
|
187 TInt typefaceStyle1Id = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknHighestLogicalFont, EAlfTextStyleNormal); |
|
188 TInt typefaceStyle2Id = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknHighestLogicalFont, EAlfTextStyleNormal); |
|
189 CAlfTextStyle* style1 = iEnv.TextStyleManager().TextStyle( typefaceStyle1Id ); |
|
190 CAlfTextStyle* style2 = iEnv.TextStyleManager().TextStyle( typefaceStyle2Id ); |
|
191 |
|
192 CalculateRects(); |
|
193 |
|
194 CreateAnimationL(); |
|
195 CreateNavigationVisualsL( );// image |
|
196 CreateNavigationTextVisualsL( style1 ); |
|
197 CreateDistanceVisualL( style1 ); |
|
198 CreateSpeedVisualL( style2 ); |
|
199 CreateIndicatorVisualL(); |
|
200 DrawCurvesL(); |
|
201 CreateSignalTexturesL(); |
|
202 CreatePopupImgTextureL(); |
|
203 CreateAccTextureL(); |
|
204 LaunchDeviceNotAvlNoteL( ); |
|
205 |
|
206 SetAnchors(); |
|
207 isDeviceUnavailableDisplayed = EFalse; |
|
208 iIsDownPressed = EFalse; |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------- |
|
212 // CHtkNavigationControl::CreateAnimationL() |
|
213 // --------------------------------------------------------- |
|
214 // |
|
215 void CHtkNavigationControl::CreateAnimationL( ) |
|
216 { |
|
217 // code to load svg icon |
|
218 MAlfBitmapProvider* provider = NULL; |
|
219 |
|
220 // first creste the image loader utils and then call SetSize. |
|
221 iView.ImageLoaderUtils()->SetSize( TAlfRealSize( 210, 210 ) ); |
|
222 |
|
223 // then create the bitmap provider |
|
224 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidFlag, // svg icon skin constant id defiened in Aknsconstant.h file |
|
225 iView.ImagePathName(), // mif file name with path. |
|
226 EMbmBlidQgn_graf_blid_flag_01, // bitmap id defiened in mbg file |
|
227 EMbmBlidQgn_graf_blid_flag_01_mask ); // bitmap mask id defiened in mbg file |
|
228 // now using that bitmap provider create the texture. |
|
229 CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
230 provider, |
|
231 EAlfTextureFlagDefault ); |
|
232 iTextures.Append(&texture1); |
|
233 |
|
234 // then create the bitmap provider |
|
235 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidFlag, // svg icon skin constant id defiened in Aknsconstant.h file |
|
236 iView.ImagePathName(), // mif file name with path. |
|
237 EMbmBlidQgn_graf_blid_flag_02, // bitmap id defiened in mbg file |
|
238 EMbmBlidQgn_graf_blid_flag_02_mask ); // bitmap mask id defiened in mbg file |
|
239 // now using that bitmap provider create the texture. |
|
240 CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
241 provider, |
|
242 EAlfTextureFlagDefault ); |
|
243 iTextures.Append(&texture2); |
|
244 |
|
245 // then create the bitmap provider |
|
246 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidFlag, // svg icon skin constant id defiened in Aknsconstant.h file |
|
247 iView.ImagePathName(), // mif file name with path. |
|
248 EMbmBlidQgn_graf_blid_flag_03, // bitmap id defiened in mbg file |
|
249 EMbmBlidQgn_graf_blid_flag_03_mask ); // bitmap mask id defiened in mbg file |
|
250 // now using that bitmap provider create the texture. |
|
251 CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
252 provider, |
|
253 EAlfTextureFlagDefault ); |
|
254 iTextures.Append(&texture3); |
|
255 |
|
256 // then create the bitmap provider |
|
257 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidFlag, // svg icon skin constant id defiened in Aknsconstant.h file |
|
258 iView.ImagePathName(), // mif file name with path. |
|
259 EMbmBlidQgn_graf_blid_flag_04, // bitmap id defiened in mbg file |
|
260 EMbmBlidQgn_graf_blid_flag_04_mask ); // bitmap mask id defiened in mbg file |
|
261 // now using that bitmap provider create the texture. |
|
262 CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
263 provider, |
|
264 EAlfTextureFlagDefault ); |
|
265 iTextures.Append(&texture4); |
|
266 |
|
267 // then create the bitmap provider |
|
268 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidFlag, // svg icon skin constant id defiened in Aknsconstant.h file |
|
269 iView.ImagePathName(), // mif file name with path. |
|
270 EMbmBlidQgn_graf_blid_flag_05, // bitmap id defiened in mbg file |
|
271 EMbmBlidQgn_graf_blid_flag_05_mask ); // bitmap mask id defiened in mbg file |
|
272 // now using that bitmap provider create the texture. |
|
273 CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
274 provider, |
|
275 EAlfTextureFlagDefault ); |
|
276 iTextures.Append(&texture5); |
|
277 |
|
278 } |
|
279 |
|
280 // ---------------------------------------------------- |
|
281 // CHtkNavigationControl::CreateGlobeVisualL |
|
282 // ---------------------------------------------------- |
|
283 // |
|
284 void CHtkNavigationControl::CreatePopUpVisualL( ) |
|
285 { |
|
286 // code to load svg icon |
|
287 MAlfBitmapProvider* provider = NULL; |
|
288 |
|
289 // first creste the image loader utils and then call SetSize. |
|
290 iView.ImageLoaderUtils()->SetSize( TAlfRealSize( 60, 60 ) ); |
|
291 |
|
292 // then create the bitmap provider |
|
293 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
294 iView.ImagePathName(), // mif file name with path. |
|
295 EMbmBlidQgn_graf_blid_searching_01, // bitmap id defiened in mbg file |
|
296 EMbmBlidQgn_graf_blid_searching_01_mask ); // bitmap mask id defiened in mbg file |
|
297 // now using that bitmap provider create the texture. |
|
298 CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
299 provider, |
|
300 EAlfTextureFlagDefault ); |
|
301 iPopupTextures.Append(&texture1); |
|
302 |
|
303 // then create the bitmap provider |
|
304 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
305 iView.ImagePathName(), // mif file name with path. |
|
306 EMbmBlidQgn_graf_blid_searching_02, // bitmap id defiened in mbg file |
|
307 EMbmBlidQgn_graf_blid_searching_02_mask ); // bitmap mask id defiened in mbg file |
|
308 // now using that bitmap provider create the texture. |
|
309 CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
310 provider, |
|
311 EAlfTextureFlagDefault ); |
|
312 iPopupTextures.Append(&texture2); |
|
313 |
|
314 // then create the bitmap provider |
|
315 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
316 iView.ImagePathName(), // mif file name with path. |
|
317 EMbmBlidQgn_graf_blid_searching_03, // bitmap id defiened in mbg file |
|
318 EMbmBlidQgn_graf_blid_searching_03_mask ); // bitmap mask id defiened in mbg file |
|
319 // now using that bitmap provider create the texture. |
|
320 CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
321 provider, |
|
322 EAlfTextureFlagDefault ); |
|
323 iPopupTextures.Append(&texture3); |
|
324 |
|
325 // then create the bitmap provider |
|
326 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
327 iView.ImagePathName(), // mif file name with path. |
|
328 EMbmBlidQgn_graf_blid_searching_04, // bitmap id defiened in mbg file |
|
329 EMbmBlidQgn_graf_blid_searching_04_mask ); // bitmap mask id defiened in mbg file |
|
330 // now using that bitmap provider create the texture. |
|
331 CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
332 provider, |
|
333 EAlfTextureFlagDefault ); |
|
334 iPopupTextures.Append(&texture4); |
|
335 |
|
336 // then create the bitmap provider |
|
337 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
338 iView.ImagePathName(), // mif file name with path. |
|
339 EMbmBlidQgn_graf_blid_searching_05, // bitmap id defiened in mbg file |
|
340 EMbmBlidQgn_graf_blid_searching_05_mask ); // bitmap mask id defiened in mbg file |
|
341 // now using that bitmap provider create the texture. |
|
342 CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
343 provider, |
|
344 EAlfTextureFlagDefault ); |
|
345 iPopupTextures.Append(&texture5); |
|
346 |
|
347 // then create the bitmap provider |
|
348 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
349 iView.ImagePathName(), // mif file name with path. |
|
350 EMbmBlidQgn_graf_blid_searching_06, // bitmap id defiened in mbg file |
|
351 EMbmBlidQgn_graf_blid_searching_06_mask ); // bitmap mask id defiened in mbg file |
|
352 // now using that bitmap provider create the texture. |
|
353 CAlfTexture & texture6 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
354 provider, |
|
355 EAlfTextureFlagDefault ); |
|
356 iPopupTextures.Append(&texture6); |
|
357 |
|
358 // then create the bitmap provider |
|
359 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
360 iView.ImagePathName(), // mif file name with path. |
|
361 EMbmBlidQgn_graf_blid_searching_07, // bitmap id defiened in mbg file |
|
362 EMbmBlidQgn_graf_blid_searching_07_mask ); // bitmap mask id defiened in mbg file |
|
363 // now using that bitmap provider create the texture. |
|
364 CAlfTexture & texture7 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
365 provider, |
|
366 EAlfTextureFlagDefault ); |
|
367 iPopupTextures.Append(&texture7); |
|
368 |
|
369 // then create the bitmap provider |
|
370 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
371 iView.ImagePathName(), // mif file name with path. |
|
372 EMbmBlidQgn_graf_blid_searching_08, // bitmap id defiened in mbg file |
|
373 EMbmBlidQgn_graf_blid_searching_08_mask ); // bitmap mask id defiened in mbg file |
|
374 // now using that bitmap provider create the texture. |
|
375 CAlfTexture & texture8 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
376 provider, |
|
377 EAlfTextureFlagDefault ); |
|
378 iPopupTextures.Append(&texture8); |
|
379 } |
|
380 |
|
381 // --------------------------------------------------------- |
|
382 // CHtkNavigationControl::DrawCurvesL() |
|
383 // --------------------------------------------------------- |
|
384 // |
|
385 void CHtkNavigationControl::DrawCurvesL() |
|
386 { |
|
387 MAlfBitmapProvider* provider = NULL; |
|
388 // Create curvepath layout. |
|
389 iCurveLayout = CAlfCurvePathLayout::AddNewL( *this, iCurveDecLyt ); |
|
390 CAlfCurvePath& path = iCurveLayout->CurvePath(); |
|
391 |
|
392 iCurveLayout->SetBaseUnit( TAlfMetric( 1, EAlfUnitNormalized ) ); |
|
393 TAlfRealPoint centre( 0.5, 0.5 ); |
|
394 TAlfRealSize radious( 0.47, 0.37 ); |
|
395 path.AppendArcL( centre, radious, 0, 360, 1 ); |
|
396 path.EnableLoop(); |
|
397 |
|
398 iNdecLayout = CAlfDeckLayout::AddNewL( *this, iCurveLayout ); |
|
399 |
|
400 iActualNdeck = CAlfDeckLayout::AddNewL( *this, iNdecLayout ); |
|
401 |
|
402 iActualNdeck->SetSize( TAlfRealSize( 32, 32 ) ); |
|
403 |
|
404 // now map the image visual to curve path and move. |
|
405 TAlfTimedPoint pos1; |
|
406 pos1.SetMappingFunctionIdentifier( iCurveLayout->MappingFunctionIdentifier() ); |
|
407 pos1.SetTarget( 0.75, 0 ); |
|
408 iNdecLayout->SetPos( pos1 ); |
|
409 |
|
410 // create the image visual to set on curve path |
|
411 //MAlfBitmapProvider* provider = NULL; |
|
412 iNorthVisual = CAlfImageVisual::AddNewL(*this, iActualNdeck ); |
|
413 |
|
414 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidNorth, // svg icon skin constant id defiened in Aknsconstant.h file |
|
415 iView.ImagePathName(), // mif file name with path. |
|
416 EMbmBlidQgn_graf_blid_north, // bitmap id defiened in mbg file |
|
417 EMbmBlidQgn_graf_blid_north_mask ); // bitmap mask id defiened in mbg file |
|
418 // now using that bitmap provider create the texture. |
|
419 CAlfTexture & thumbTexture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
420 provider, |
|
421 EAlfTextureFlagDefault ); |
|
422 |
|
423 iNorthVisual->SetImage(TAlfImage( thumbTexture1 ) );//N |
|
424 |
|
425 iNdecLayout->EnableScrollingL( ETrue ); |
|
426 // scroll offset should be half of the |
|
427 // size of decklayout. |
|
428 iNdecLayout->SetScrollOffset( TAlfTimedPoint( 14 , 14 ) ); |
|
429 } |
|
430 |
|
431 |
|
432 // --------------------------------------------------------- |
|
433 // CHtkNavigationControl::CreateIndicatorVisualL() |
|
434 // --------------------------------------------------------- |
|
435 // |
|
436 void CHtkNavigationControl::CreateIndicatorVisualL() |
|
437 { |
|
438 iNavigationRing = CAlfImageVisual::AddNewL(*this, iLayout ); // ordinal 6 |
|
439 iNavigationRing->SetScaleMode( CAlfImageVisual::EScaleCover ); |
|
440 iNavigationRing->SetPadding(TAlfBoxMetric(TAlfMetric( 0, EAlfUnitNormalized ) ) ); |
|
441 |
|
442 // Place the curve path circle ring |
|
443 MAlfBitmapProvider* provider = NULL; |
|
444 |
|
445 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidRing, // svg icon skin constant id defiened in Aknsconstant.h file |
|
446 iView.ImagePathName(), // mif file name with path. |
|
447 EMbmBlidQgn_graf_blid_ring, // bitmap id defiened in mbg file |
|
448 EMbmBlidQgn_graf_blid_ring_mask ); // bitmap mask id defiened in mbg file |
|
449 // now using that bitmap provider create the texture. |
|
450 CAlfTexture & thumbTexture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
451 provider, |
|
452 EAlfTextureFlagDefault ); |
|
453 iNavigationRing->SetImage(TAlfImage( thumbTexture ) ); |
|
454 |
|
455 //Start |
|
456 iAccVisual = CAlfImageVisual::AddNewL( *this, iLayout ); // ordinal 7 |
|
457 |
|
458 iCurveDecLyt = CAlfDeckLayout::AddNewL( *this, iLayout); // ordinal 8 |
|
459 |
|
460 iIndicatorVisual = CAlfImageVisual::AddNewL( *this, iLayout ); // ordinal 9 |
|
461 //End |
|
462 |
|
463 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidCompass, // svg icon skin constant id defiened in Aknsconstant.h file |
|
464 iView.ImagePathName(), // mif file name with path. |
|
465 EMbmBlidQgn_graf_blid_compass, // bitmap id defiened in mbg file |
|
466 EMbmBlidQgn_graf_blid_compass_mask ); // bitmap mask id defiened in mbg file |
|
467 // now using that bitmap provider create the texture. |
|
468 CAlfTexture & thumbTextureind = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
469 provider, |
|
470 EAlfTextureFlagDefault ); |
|
471 |
|
472 iIndicatorVisual->SetImage(TAlfImage(thumbTextureind));//indicator |
|
473 iIndicatorVisual->SetOpacity(0.8); |
|
474 } |
|
475 |
|
476 |
|
477 // --------------------------------------------------------- |
|
478 // CHtkNavigationControl::CreateNavigationVisualsL() |
|
479 // --------------------------------------------------------- |
|
480 // |
|
481 void CHtkNavigationControl::CreateNavigationVisualsL( ) |
|
482 { |
|
483 iImageVisual = CAlfImageVisual::AddNewL(*this, iLayout); // ordinal 0 |
|
484 } |
|
485 |
|
486 |
|
487 // --------------------------------------------------------- |
|
488 // CHtkNavigationControl::CreateNavigationTextVisualsL() |
|
489 // --------------------------------------------------------- |
|
490 // |
|
491 void CHtkNavigationControl::CreateNavigationTextVisualsL( CAlfTextStyle* aStyle1 ) |
|
492 { |
|
493 aStyle1->SetBold( ETrue ); |
|
494 aStyle1->SetItalic( ETrue ); |
|
495 |
|
496 iLabel = CAlfTextVisual::AddNewL(*this, iLayout); // ordinal 1 |
|
497 |
|
498 iLabel->EnableBrushesL(); |
|
499 |
|
500 aStyle1->SetTextSizeInPixels( 22, ETrue ); |
|
501 iLabel->SetColor( iVisualColor ); |
|
502 iLabel->SetTextL( KText1 ); |
|
503 iLabel->SetTextStyle( aStyle1->Id() ); |
|
504 iLabel->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); |
|
505 iLabel->SetPadding(TAlfBoxMetric(TAlfMetric( 0.01, EAlfUnitNormalized ) ) ); |
|
506 iLabel->SetAlign( EAlfAlignHCenter, EAlfAlignVTop ); |
|
507 } |
|
508 |
|
509 // --------------------------------------------------------- |
|
510 // CHtkNavigationControl::CreateDistanceVisualL() |
|
511 // --------------------------------------------------------- |
|
512 // |
|
513 void CHtkNavigationControl::CreateDistanceVisualL( CAlfTextStyle* aStyle1 ) |
|
514 { |
|
515 aStyle1->SetBold( ETrue ); |
|
516 aStyle1->SetItalic( ETrue ); |
|
517 |
|
518 iDistanceLabel = CAlfTextVisual::AddNewL( *this, iLayout ); // ordinal 2 |
|
519 |
|
520 iDistanceLabel->EnableBrushesL(); |
|
521 |
|
522 iDistanceLabel->SetColor( iVisualColor ); |
|
523 |
|
524 aStyle1->SetTextSizeInPixels( 22, ETrue ); |
|
525 |
|
526 iDistanceLabel->SetTextL( KText1 ); |
|
527 iDistanceLabel->SetTextStyle( aStyle1->Id() ); |
|
528 iDistanceLabel->SetAlign( EAlfAlignHCenter, EAlfAlignVTop ); |
|
529 } |
|
530 |
|
531 // --------------------------------------------------------- |
|
532 // CHtkNavigationControl::CreateSpeedVisualL() |
|
533 // --------------------------------------------------------- |
|
534 // |
|
535 void CHtkNavigationControl::CreateSpeedVisualL( CAlfTextStyle* aStyle1 ) |
|
536 { |
|
537 CAlfImageVisual* speedmeterVisual = CAlfImageVisual::AddNewL(*this, iLayout ); // ordinal 3 |
|
538 |
|
539 // Place the speed |
|
540 MAlfBitmapProvider* provider = NULL; |
|
541 |
|
542 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSpwatch, // svg icon skin constant id defiened in Aknsconstant.h file |
|
543 iView.ImagePathName(), // mif file name with path. |
|
544 EMbmBlidQgn_graf_blid_spwatch, // bitmap id defiened in mbg file |
|
545 EMbmBlidQgn_graf_blid_spwatch_mask ); // bitmap mask id defiened in mbg file |
|
546 // now using that bitmap provider create the texture. |
|
547 CAlfTexture & thumbTexture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
548 provider, |
|
549 EAlfTextureFlagDefault ); |
|
550 |
|
551 speedmeterVisual->SetImage(TAlfImage( thumbTexture ) );// Speed image |
|
552 |
|
553 iSpeedLabel = CAlfTextVisual::AddNewL(*this, iLayout ); // ordinal 4 |
|
554 |
|
555 aStyle1->SetTextSizeInPixels( 13, ETrue ); |
|
556 aStyle1->SetItalic( ETrue ); |
|
557 |
|
558 iSpeedLabel->SetColor( KRgbWhite ); |
|
559 iSpeedLabel->SetClipping( EFalse ); |
|
560 iSpeedLabel->SetTextL( KText1 ); |
|
561 iSpeedLabel->SetTextStyle( aStyle1->Id() ); |
|
562 iSpeedLabel->SetPadding(TAlfBoxMetric(TAlfMetric(.1, EAlfUnitNormalized))); |
|
563 iSpeedLabel->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
564 |
|
565 iSpeedFormatLabel = CAlfTextVisual::AddNewL(*this, iLayout ); // ordinal 5 |
|
566 |
|
567 aStyle1->SetTextSizeInPixels( 13, ETrue ); |
|
568 aStyle1->SetItalic( ETrue ); |
|
569 |
|
570 iSpeedFormatLabel->SetColor( KRgbWhite ); |
|
571 iSpeedFormatLabel->SetClipping( EFalse ); |
|
572 iSpeedFormatLabel->SetTextL( KText1 ); |
|
573 iSpeedFormatLabel->SetTextStyle( aStyle1->Id() ); |
|
574 iSpeedFormatLabel->SetPadding(TAlfBoxMetric(TAlfMetric(.1, EAlfUnitNormalized))); |
|
575 iSpeedFormatLabel->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
576 |
|
577 } |
|
578 |
|
579 // --------------------------------------------------------- |
|
580 // CHtkNavigationControl::SetFlagVisualL() |
|
581 // --------------------------------------------------------- |
|
582 // |
|
583 void CHtkNavigationControl::SetFlagVisualL() |
|
584 { |
|
585 if( !iLocationModel.IsGPSDataAvailable() ) |
|
586 { |
|
587 return; |
|
588 } |
|
589 |
|
590 // Check wheather landmark is set or not. |
|
591 |
|
592 if( !iRouter->Waypoint() && !iRouter->Landmark() ) |
|
593 { |
|
594 iIsDestinationSet = EFalse; |
|
595 return; |
|
596 } |
|
597 |
|
598 |
|
599 idecLayout = CAlfDeckLayout::AddNewL( *this, iCurveLayout ); |
|
600 |
|
601 iFlagdeck = CAlfDeckLayout::AddNewL( *this, idecLayout ); |
|
602 |
|
603 iFlagdeck->SetSize(TAlfRealSize( 30, 30 )); |
|
604 |
|
605 TInt error = KErrNone; |
|
606 // calculate angle of bearing |
|
607 const TPosition& position = iPositionInfo; |
|
608 TReal heading = iLocationModel.GetHeading(); |
|
609 TReal32 bearing(0); |
|
610 |
|
611 TBool isWaypointSet = iRouter->IsWaypointSet(); |
|
612 TNamedCoordinate* waypoint = NULL; |
|
613 CPosLandmark* landmark = NULL; |
|
614 |
|
615 if( isWaypointSet ) |
|
616 { |
|
617 waypoint = iRouter->Waypoint() ; |
|
618 } |
|
619 else |
|
620 { |
|
621 landmark = iRouter->Landmark(); |
|
622 } |
|
623 |
|
624 if ( !Math::IsNaN(heading) ) |
|
625 { |
|
626 iHeading = heading; |
|
627 } |
|
628 |
|
629 if( isWaypointSet && waypoint ) |
|
630 { |
|
631 error = position.BearingTo( TCoordinate( |
|
632 waypoint->Latitude(), |
|
633 waypoint->Longitude(), |
|
634 waypoint->Altitude() ), |
|
635 bearing ); |
|
636 } |
|
637 else if( landmark ) |
|
638 { |
|
639 TLocality location; |
|
640 landmark->GetPosition(location); |
|
641 error = position.BearingTo( TCoordinate( |
|
642 location.Latitude(), |
|
643 location.Longitude(), |
|
644 location.Altitude() ), |
|
645 bearing ); |
|
646 } |
|
647 |
|
648 //calculate bearing and heading |
|
649 TInt resultBearing(0); |
|
650 TInt resultHeading(0); |
|
651 TReal32 lpointFlag( 0 ); |
|
652 |
|
653 error = BlidUtils::TRealToTInt(bearing, resultBearing); |
|
654 if( error == KErrNone) |
|
655 { |
|
656 error = BlidUtils::TRealToTInt(iHeading, resultHeading); |
|
657 if( error == KErrNone) |
|
658 { |
|
659 // for flag movement |
|
660 TReal32 lpoint = resultBearing - resultHeading; |
|
661 if( lpoint > 0 ) |
|
662 { |
|
663 lpointFlag = lpoint / 360; |
|
664 } |
|
665 else |
|
666 { |
|
667 lpointFlag = ( 360 + lpoint ) / 360; |
|
668 } |
|
669 } |
|
670 } |
|
671 |
|
672 // now map the image visual to curve path and move. |
|
673 TAlfTimedPoint pos1; |
|
674 pos1.SetMappingFunctionIdentifier( iCurveLayout->MappingFunctionIdentifier() ); |
|
675 pos1.SetTarget( lpointFlag, 0 ); |
|
676 idecLayout->SetPos( pos1 ); |
|
677 |
|
678 // create the image visual to set on curve path |
|
679 iFlagVisual = CAlfImageVisual::AddNewL(*this, iFlagdeck ); |
|
680 iDisplayIcon = 1; |
|
681 //iFlagVisual->SetSize( animationRect.Size() ); |
|
682 iFlagVisual->SetImage( TAlfImage( *iTextures[iDisplayIcon-1] ) );//N |
|
683 iFlagVisual->SetScaleMode( CAlfImageVisual::EScaleCover ); |
|
684 iFlagVisual->SetTagL( iFlagText->Des() ); |
|
685 iFlagVisual->SetOpacity( 0.8 ); |
|
686 |
|
687 idecLayout->EnableScrollingL( ETrue ); |
|
688 idecLayout->SetScrollOffset( TAlfTimedPoint( 17, 17 )); |
|
689 } |
|
690 |
|
691 // --------------------------------------------------------- |
|
692 // CHtkNavigationControl::SetAccRacyVisualL() |
|
693 // --------------------------------------------------------- |
|
694 // |
|
695 void CHtkNavigationControl::SetAccRacyVisualL() |
|
696 { |
|
697 if( !iLocationModel.IsGPSDataAvailable() ) |
|
698 { |
|
699 return; |
|
700 } |
|
701 // Check wheather landmark or waypoint is set or not. |
|
702 if( !iRouter->Waypoint() && !iRouter->Landmark() ) |
|
703 { |
|
704 iIsDestinationSet = EFalse; |
|
705 return; |
|
706 } |
|
707 |
|
708 iAccVisual->SetImage(TAlfImage( *iAccTexture ) );//accuracy |
|
709 iAccVisual->SetScaleMode( CAlfImageVisual::EScaleCover ); |
|
710 iAccVisual->SetTagL( iAccText->Des() ); |
|
711 iAccVisual->SetOpacity( 1.0 ); |
|
712 iAccVisual->SetScale( 0.8 ); |
|
713 |
|
714 // Find all the original size of acuracy ring, Flag, navigation ring |
|
715 iLayout->ChildSize( 6, iCurveSize ); |
|
716 TAlfTimedPoint lAccpoint = iAccVisual->Size(); |
|
717 TAlfTimedPoint lFagpoint = iFlagVisual->Size(); |
|
718 iFlagSize = lFagpoint.IntValueNow().AsSize(); |
|
719 iAccuracyringcurveSize = lAccpoint.IntValueNow().AsSize(); |
|
720 |
|
721 } |
|
722 |
|
723 // --------------------------------------------------------- |
|
724 // CHtkNavigationControl::~CHtkNavigationControl() |
|
725 // --------------------------------------------------------- |
|
726 // |
|
727 CHtkNavigationControl::~CHtkNavigationControl() |
|
728 { |
|
729 delete iPeriodic; |
|
730 iPeriodic = NULL; |
|
731 iTextures.Reset(); |
|
732 iTextures.Close(); |
|
733 iPopupTextures.Reset(); |
|
734 iPopupTextures.Close(); |
|
735 delete iDecoratedTabGroup; |
|
736 |
|
737 delete iDistanceFormatKm; |
|
738 delete iDistanceFormatM; |
|
739 delete iDistanceFormatMiles; |
|
740 delete iDistanceFormatFt; |
|
741 delete iDurationFormatLong; |
|
742 delete iBlidSpeed; |
|
743 delete iSpeedFormatKmph; |
|
744 delete iSpeedFormatMph; |
|
745 delete iDataBeingCalculated; |
|
746 delete iDataBlank; |
|
747 delete iFlagText; |
|
748 delete iAccText; |
|
749 delete iTimer; |
|
750 delete iImagePath; |
|
751 delete iToneUtility; |
|
752 iSignalTextures.Reset(); |
|
753 iSignalTextures.Close(); |
|
754 delete iMenu; |
|
755 } |
|
756 |
|
757 |
|
758 // ---------------------------------------------------- |
|
759 // CHtkNavigationControl::CreateNaviPaneL |
|
760 // ---------------------------------------------------- |
|
761 // |
|
762 void CHtkNavigationControl::CreateNaviPaneL( TBool aDefaultNaviPane ) |
|
763 { |
|
764 CEikStatusPane* sp = StatusPane(); |
|
765 // Fetch pointer to the default navi pane control |
|
766 CAknNavigationControlContainer* naviPane = |
|
767 static_cast<CAknNavigationControlContainer*>(sp->ControlL( |
|
768 TUid::Uid(EEikStatusPaneUidNavi))); |
|
769 |
|
770 if( iDecoratedTabGroup ) |
|
771 { |
|
772 delete iDecoratedTabGroup; |
|
773 iDecoratedTabGroup = NULL; |
|
774 } |
|
775 |
|
776 if ( aDefaultNaviPane ) // dummy tab |
|
777 { |
|
778 naviPane->PushDefaultL(EFalse); |
|
779 } |
|
780 else |
|
781 { |
|
782 iDecoratedTabGroup = naviPane->CreateTabGroupL(); |
|
783 iDecoratedTabGroup->SetControlType( CAknNavigationDecorator::ETabGroup ); |
|
784 CAknTabGroup* tabGroup = |
|
785 static_cast< CAknTabGroup* > ( iDecoratedTabGroup->DecoratedControl() ); |
|
786 AddTabsL( *tabGroup ); |
|
787 } |
|
788 } |
|
789 |
|
790 // ---------------------------------------------------- |
|
791 // CHtkNavigationControl::GetNiviDecorator |
|
792 // ---------------------------------------------------- |
|
793 // |
|
794 CAknNavigationDecorator* CHtkNavigationControl::GetNiviDecorator( ) |
|
795 { |
|
796 return iDecoratedTabGroup; |
|
797 } |
|
798 |
|
799 // ---------------------------------------------------- |
|
800 // CHtkNavigationControl::ActivateTabL |
|
801 // ---------------------------------------------------- |
|
802 // |
|
803 void CHtkNavigationControl::ActivateTabL( |
|
804 CAknNavigationDecorator& aNaviDecorator, |
|
805 TInt aTabId ) |
|
806 { |
|
807 CEikStatusPane* sp = StatusPane(); |
|
808 CAknNavigationControlContainer* naviPane = |
|
809 static_cast<CAknNavigationControlContainer*>( |
|
810 sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); |
|
811 CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( |
|
812 aNaviDecorator.DecoratedControl() ); |
|
813 tabGroup->SetActiveTabById( aTabId ); |
|
814 naviPane->PushL( aNaviDecorator ); |
|
815 } |
|
816 |
|
817 |
|
818 // ---------------------------------------------------- |
|
819 // CHtkNavigationControl::StatusPane |
|
820 // ---------------------------------------------------- |
|
821 // |
|
822 CEikStatusPane* CHtkNavigationControl::StatusPane() |
|
823 { |
|
824 return CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
825 } |
|
826 |
|
827 |
|
828 // ---------------------------------------------------- |
|
829 // CHtkNavigationControl::MakeTitleL |
|
830 // ---------------------------------------------------- |
|
831 // |
|
832 void CHtkNavigationControl::MakeTitleL( TInt aResourceText ) |
|
833 { |
|
834 HBufC* buf = StringLoader::LoadLC(aResourceText); |
|
835 CAknTitlePane* title = static_cast<CAknTitlePane*>( StatusPane()-> |
|
836 ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
837 CleanupStack::Pop(); //buf |
|
838 title->SetText(buf); // Takes ownership of buf |
|
839 } |
|
840 |
|
841 |
|
842 // ---------------------------------------------------- |
|
843 // CHtkNavigationControl::AddTabsL |
|
844 // ---------------------------------------------------- |
|
845 // |
|
846 void CHtkNavigationControl::AddTabsL(CAknTabGroup& aTabGroup) |
|
847 { |
|
848 aTabGroup.SetTabFixedWidthL(EAknTabWidthWithTwoTabs); |
|
849 |
|
850 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
851 HBufC* filename = BlidUtils::GetBitmapFilenameLC(); |
|
852 CFbsBitmap* bitmap = NULL; |
|
853 CFbsBitmap* bitmapMask = NULL; |
|
854 |
|
855 //Add tab icon 1 |
|
856 AknsUtils::CreateIconLC( skin, |
|
857 KAknsIIDQgnPropBlidNavigationTab3, |
|
858 bitmap, |
|
859 bitmapMask, |
|
860 *filename, |
|
861 EMbmBlidQgn_prop_blid_navigation_tab3, |
|
862 EMbmBlidQgn_prop_blid_navigation_tab3_mask ); |
|
863 aTabGroup.AddTabL( EBlidNavigationView, bitmap, bitmapMask ); |
|
864 CleanupStack::Pop(2); //bitmap, bitmapmask |
|
865 |
|
866 //Add tab icon 2 |
|
867 AknsUtils::CreateIconLC( skin, |
|
868 KAknsIIDQgnPropBlidTripTab3, |
|
869 bitmap, |
|
870 bitmapMask, |
|
871 *filename, |
|
872 EMbmBlidQgn_prop_blid_trip_tab3, |
|
873 EMbmBlidQgn_prop_blid_trip_tab3_mask ); |
|
874 aTabGroup.AddTabL( EBlidTripMeterView, bitmap, bitmapMask ); |
|
875 CleanupStack::Pop(2); //bitmap, bitmapmask |
|
876 |
|
877 CleanupStack::PopAndDestroy(); //filename |
|
878 } |
|
879 |
|
880 // ---------------------------------------------------- |
|
881 // CHtkNavigationControl::OfferEventL |
|
882 // ---------------------------------------------------- |
|
883 // |
|
884 TBool CHtkNavigationControl::OfferEventL(const TAlfEvent& aEvent) |
|
885 { |
|
886 if(aEvent.IsKeyEvent() && aEvent.Code() == EEventKey) |
|
887 { |
|
888 CEikStatusPane* sp = StatusPane(); |
|
889 // Fetch pointer to the default navi pane control |
|
890 CAknNavigationControlContainer* naviPane = |
|
891 static_cast<CAknNavigationControlContainer*>(sp->ControlL( |
|
892 TUid::Uid(EEikStatusPaneUidNavi))); |
|
893 CAknNavigationDecorator* naviDecorator = naviPane->Top(); |
|
894 |
|
895 // Check if navigation pane controls exists, because decorator does |
|
896 // not exist in every cases. E.g. after contact fetch in "new rule" |
|
897 // command operation naviDecorator is null. |
|
898 if ( naviDecorator && naviDecorator->ControlType() == |
|
899 CAknNavigationDecorator::ETabGroup ) |
|
900 { |
|
901 if ( naviDecorator->DecoratedControl()->OfferKeyEventL( |
|
902 aEvent.KeyEvent(), aEvent.Code() ) == EKeyWasConsumed ) |
|
903 { |
|
904 CAknTabGroup* tabGroup = static_cast< CAknTabGroup* > ( naviDecorator->DecoratedControl() ); |
|
905 TInt tabIndex = tabGroup->ActiveTabIndex(); |
|
906 iView.ActivateCorrectViewL( tabIndex ); |
|
907 return ETrue; |
|
908 } |
|
909 } |
|
910 StopPlayerL( ); |
|
911 } |
|
912 if( aEvent.IsPointerEvent() ) |
|
913 { |
|
914 TPointerEvent ptrEvent = aEvent.PointerEvent(); |
|
915 TPoint tapPoint = ptrEvent.iPosition; |
|
916 if ( ptrEvent.iType == TPointerEvent::EButton1Down ) |
|
917 { |
|
918 iIsDownPressed = ETrue; |
|
919 return ETrue; |
|
920 } |
|
921 if ( ptrEvent.iType == TPointerEvent::EButton1Up && iIsDownPressed) |
|
922 { |
|
923 if( iLocationModel.IsGPSDataAvailable() ) |
|
924 { |
|
925 TAlfRealRect rect = iLabel->DisplayRectTarget(); |
|
926 if( tapPoint.iY < rect.iTl.iY || tapPoint.iY > rect.iBr.iY ) |
|
927 { |
|
928 iView.LaunchNavigationContextMenuL(); |
|
929 } |
|
930 else |
|
931 { |
|
932 LaunchStylusPopupMenuL( ptrEvent ); |
|
933 } |
|
934 return ETrue; |
|
935 } |
|
936 else |
|
937 { |
|
938 if( aEvent.Visual() == iPopUpAnchor || |
|
939 aEvent.Visual() == iPopUpMsg || |
|
940 aEvent.Visual() == iPopImage ) |
|
941 { |
|
942 if( isSatelliteInfoLaunch ) |
|
943 { |
|
944 iView.LaunchSatelliteInfoDlgL(); |
|
945 return ETrue; |
|
946 } |
|
947 else |
|
948 { |
|
949 LaunchInfoQueryDlgL(); |
|
950 return ETrue; |
|
951 } |
|
952 } |
|
953 } |
|
954 return EFalse; |
|
955 } |
|
956 } |
|
957 return EFalse; |
|
958 } |
|
959 |
|
960 |
|
961 // --------------------------------------------------------- |
|
962 // CHtkNavigationControl::LaunchInfoQueryDlgL |
|
963 // --------------------------------------------------------- |
|
964 // |
|
965 void CHtkNavigationControl::LaunchInfoQueryDlgL() |
|
966 { |
|
967 CAknNoteDialog* dlg; |
|
968 dlg = new (ELeave) CAknNoteDialog(CAknNoteDialog::EConfirmationTone,CAknNoteDialog::ENoTimeout); |
|
969 TInt result = dlg->ExecuteLD( R_INFO_POPUP_MSG_QUERY ); |
|
970 if( result == EAknSoftkeyExit ) |
|
971 { |
|
972 iView.ExitMainApplicationL( EAknSoftkeyExit ); |
|
973 } |
|
974 dlg = NULL; |
|
975 } |
|
976 |
|
977 // --------------------------------------------------------- |
|
978 // CHtkNavigationControl::UpdateL |
|
979 // --------------------------------------------------------- |
|
980 // |
|
981 void CHtkNavigationControl::UpdateL() |
|
982 { |
|
983 if((iEngine.AppMode() == CBlidEng::EAppForeground) && |
|
984 (iSettings->GetBacklightOption() == EBlidBackLightOnDuringNavigation) && !iView.IsSettingsViewActive() ) |
|
985 { |
|
986 User::ResetInactivityTime(); |
|
987 } |
|
988 |
|
989 iPositionInfo = iLocationModel.GetCurrentPosition(); |
|
990 iCourse = iLocationModel.GetCourse(); |
|
991 |
|
992 if( iLocationModel.IsGPSDataAvailable() ) |
|
993 { |
|
994 isDeviceUnavailableDisplayed = EFalse; |
|
995 CalculateIfArrivedL(); |
|
996 iLayout->SetOpacity( 1.0 ); |
|
997 iPopUpLayout->SetOpacity( 0.0 ); |
|
998 |
|
999 // If MSK visible then after getting fix softkey should change |
|
1000 if( iView.CBAPtr() && |
|
1001 iMskInfoVisible ) |
|
1002 { |
|
1003 iView.CBAPtr()->SetCommandSetL( R_BLID_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS ); |
|
1004 iView.CBAPtr()->DrawDeferred(); |
|
1005 iMskInfoVisible = EFalse; |
|
1006 } |
|
1007 TInt satCount = 0; |
|
1008 iLocationModel.GetNumOfSatellitesL( satCount ); |
|
1009 DisplaySatelliteSignalStrength( satCount ); |
|
1010 CalculateDistanceL( iPositionInfo ); |
|
1011 CalculateDurationL( iCourse ); |
|
1012 // if destination is set then |
|
1013 // distance should be update. |
|
1014 if( iIsDestinationSet ) |
|
1015 { |
|
1016 if( !iRouter->Waypoint() && !iRouter->Landmark() ) |
|
1017 { |
|
1018 iIsDestinationSet = EFalse; |
|
1019 return; |
|
1020 } |
|
1021 |
|
1022 // Set the landmarks Name |
|
1023 SetLandMarksNameL(); |
|
1024 // distance format calculation |
|
1025 TBuf<KBlidLBItemMaxLen> distanceString; |
|
1026 DistanceFormat( distanceString ); |
|
1027 // distance unit calculation |
|
1028 TBuf<KBlidLBItemMaxLen> unitString; |
|
1029 DistanceUnit( unitString ); |
|
1030 if(distanceString != *iDataBlank) |
|
1031 { |
|
1032 distanceString.Append( unitString ); |
|
1033 } |
|
1034 iDistanceLabel->SetTextL( distanceString ); |
|
1035 |
|
1036 TBuf<KBlidLBItemMaxLen> speedString; |
|
1037 TBuf<KBlidLBItemMaxLen> speedFormatString; |
|
1038 if(iLocationModel.IsOnline()) |
|
1039 { |
|
1040 SpeedFormat( speedString, speedFormatString ); |
|
1041 iSpeedLabel->SetTextL( speedString ); |
|
1042 iSpeedFormatLabel->SetTextL( speedFormatString ); |
|
1043 } |
|
1044 else |
|
1045 { |
|
1046 speedString.Append(*iDataBlank); |
|
1047 speedFormatString.Append(*iDataBlank); |
|
1048 } |
|
1049 PrepareDynamicMoveL(); |
|
1050 } |
|
1051 } |
|
1052 else |
|
1053 { |
|
1054 StopPlayerL(); |
|
1055 TFileName imagepathname; |
|
1056 DisplaySatelliteSignalStrength( 0 ); |
|
1057 iLayout->SetOpacity( 0.3 ); |
|
1058 iPopUpLayout->SetOpacity( 1.0 ); |
|
1059 |
|
1060 // for MSK enabled phone add MSK |
|
1061 if( iView.CBAPtr() ) |
|
1062 { |
|
1063 iView.CBAPtr()->SetCommandSetL( R_BLID_OPTION_INFO_EXIT ); |
|
1064 iView.CBAPtr()->DrawDeferred(); |
|
1065 iMskInfoVisible = ETrue; |
|
1066 } |
|
1067 if( iPeriodic ) |
|
1068 { |
|
1069 delete iPeriodic; |
|
1070 iPeriodic = NULL; |
|
1071 } |
|
1072 if( iLocationModel.WaitingGPSData() ) |
|
1073 { |
|
1074 isSatelliteInfoLaunch = ETrue; |
|
1075 if(KNumOfSearchIcon != iPopupTextures.Count()) |
|
1076 CreatePopUpVisualL( ); |
|
1077 HBufC* noteText = StringLoader::LoadLC( R_BLID_STARTUP_NAVITEXT_SEARCHING_GPS_SATELLITES, CEikonEnv::Static() ); |
|
1078 iPopUpMsg->SetTextL( *noteText ); |
|
1079 iDisplayIcon = 1; |
|
1080 |
|
1081 iPeriodic = CPeriodic::NewL(0); // neutral priority |
|
1082 iPeriodic->Start( TTimeIntervalMicroSeconds32( KTimerDuration ), |
|
1083 TTimeIntervalMicroSeconds32( KTimerDuration ), |
|
1084 TCallBack(Tick, this)); |
|
1085 UpdateVisualImage(); |
|
1086 CleanupStack::PopAndDestroy(noteText); //noteText |
|
1087 } |
|
1088 else |
|
1089 { |
|
1090 isSatelliteInfoLaunch = EFalse; |
|
1091 HBufC* noteText = StringLoader::LoadLC( R_BLID_ERROR_NO_GPS_DEVICE, CEikonEnv::Static() ); |
|
1092 iPopUpMsg->SetTextL( *noteText ); |
|
1093 iPopImage->SetImage(TAlfImage( *iPopupImgTexture ) ); |
|
1094 CleanupStack::PopAndDestroy(noteText); //noteText |
|
1095 if(!isDeviceUnavailableDisplayed) |
|
1096 { |
|
1097 CHWRMLight* aHWRMLight = CHWRMLight::NewL(); |
|
1098 if(aHWRMLight->LightStatus(CHWRMLight::EPrimaryDisplay) != CHWRMLight::ELightOn) |
|
1099 { |
|
1100 User::ResetInactivityTime(); |
|
1101 aHWRMLight->LightOnL(CHWRMLight::EPrimaryDisplay); |
|
1102 aHWRMLight->ReleaseLight(CHWRMLight::EPrimaryDisplay); |
|
1103 isDeviceUnavailableDisplayed = ETrue; |
|
1104 |
|
1105 } |
|
1106 |
|
1107 delete aHWRMLight; |
|
1108 |
|
1109 } |
|
1110 } |
|
1111 } |
|
1112 |
|
1113 if(iHasArrived && |
|
1114 (iEngine.AppMode() == CBlidEng::EAppForeground) && |
|
1115 iHasToPlayArrivedTone && |
|
1116 iLocationModel.IsGPSDataAvailable()) |
|
1117 { |
|
1118 if(iAccVisual->Opacity().ValueNow() == 0.0) |
|
1119 { |
|
1120 iAccVisual->SetOpacity(1.0); |
|
1121 } |
|
1122 |
|
1123 if(iFlagVisual->Opacity().ValueNow() == 0.0) |
|
1124 { |
|
1125 iFlagVisual->SetOpacity(0.8); |
|
1126 } |
|
1127 if( iFlagVisual ) |
|
1128 { |
|
1129 iDisplayIcon = 1; |
|
1130 if( iPeriodic ) |
|
1131 { |
|
1132 delete iPeriodic; |
|
1133 iPeriodic = NULL; |
|
1134 } |
|
1135 iPeriodic = CPeriodic::NewL(0); // neutral priority |
|
1136 iPeriodic->Start( TTimeIntervalMicroSeconds32( KTimerDuration ), |
|
1137 TTimeIntervalMicroSeconds32( KTimerDuration ), |
|
1138 TCallBack(Tick, this)); |
|
1139 UpdateVisualImage(); |
|
1140 } |
|
1141 PlayArrivedToneL(); |
|
1142 } |
|
1143 } |
|
1144 |
|
1145 // --------------------------------------------------------- |
|
1146 // CHtkNavigationControl::DisplayInfoPopUpMsgL |
|
1147 // --------------------------------------------------------- |
|
1148 // |
|
1149 void CHtkNavigationControl::DisplayInfoPopUpMsgL() |
|
1150 { |
|
1151 if( isSatelliteInfoLaunch ) |
|
1152 { |
|
1153 iView.LaunchSatelliteInfoDlgL(); |
|
1154 } |
|
1155 else |
|
1156 { |
|
1157 LaunchInfoQueryDlgL(); |
|
1158 } |
|
1159 } |
|
1160 |
|
1161 // --------------------------------------------------------- |
|
1162 // CHtkNavigationControl::LaunchDeviceNotAvlNoteL |
|
1163 // --------------------------------------------------------- |
|
1164 // |
|
1165 void CHtkNavigationControl::LaunchDeviceNotAvlNoteL( ) |
|
1166 { |
|
1167 TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknHighestLogicalFont, EAlfTextStyleNormal); |
|
1168 CAlfTextStyle* style1 = iEnv.TextStyleManager().TextStyle( typefaceStyleId ); |
|
1169 |
|
1170 iPopUpLayout = CAlfAnchorLayout::AddNewL( *this ); |
|
1171 |
|
1172 iPopupDeck = CAlfDeckLayout::AddNewL( *this, iPopUpLayout ); |
|
1173 |
|
1174 iPopUpLayout->SetAnchor(EAlfAnchorTopLeft, 0, |
|
1175 EAlfAnchorOriginHCenter, EAlfAnchorOriginTop, |
|
1176 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1177 TAlfTimedPoint( -0.05, 0.05)); |
|
1178 iPopUpLayout->SetAnchor(EAlfAnchorBottomRight, 0, |
|
1179 EAlfAnchorOriginHCenter, EAlfAnchorOriginTop, |
|
1180 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1181 TAlfTimedPoint( 0.4, 0.38)); |
|
1182 |
|
1183 iPopupDeck->EnableBrushesL(); |
|
1184 |
|
1185 TAlfXYMetric edgeoffset(TAlfMetric( 0.01, EAlfUnitNormalized )); |
|
1186 iFrameBrush = CAlfFrameBrush::NewL(iEnv, KAknsIIDQsnFrPopup, edgeoffset); |
|
1187 iFrameBrush->SetFrameRectsL(TRect(12,12,167,167), TRect(11,11,170,170)); |
|
1188 iFrameBrush->SetEdgeOffset(edgeoffset); |
|
1189 iPopupDeck->Brushes()->AppendL( iFrameBrush, EAlfHasOwnership ); |
|
1190 |
|
1191 iPopUpAnchor = CAlfAnchorLayout::AddNewL( *this, iPopupDeck ); |
|
1192 |
|
1193 iPopUpAnchor->EnableBrushesL(); |
|
1194 |
|
1195 iPopUpMsg = CAlfTextVisual::AddNewL( *this, iPopUpAnchor ); |
|
1196 iPopImage = CAlfImageVisual::AddNewL( *this, iPopUpAnchor ); |
|
1197 style1->SetTextSizeInPixels(20, ETrue ); |
|
1198 style1->SetBold( EFalse ); |
|
1199 |
|
1200 iPopUpMsg->SetColor( iVisualColor ); |
|
1201 iPopUpMsg->SetTextL( KText1 ); |
|
1202 iPopUpMsg->SetTextStyle( style1->Id() ); |
|
1203 iPopUpMsg->SetPadding(TAlfBoxMetric(TAlfMetric(.1, EAlfUnitNormalized))); |
|
1204 iPopUpMsg->SetWrapping( CAlfTextVisual::ELineWrapBreak ); |
|
1205 iPopUpMsg->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
1206 |
|
1207 iPopUpAnchor->SetAnchor(EAlfAnchorTopLeft, 0, |
|
1208 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1209 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1210 TAlfTimedPoint( 0.02, 0.02)); |
|
1211 iPopUpAnchor->SetAnchor(EAlfAnchorBottomRight, 0, |
|
1212 EAlfAnchorOriginHCenter, EAlfAnchorOriginTop, |
|
1213 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1214 TAlfTimedPoint( 0.47, 0.3)); |
|
1215 |
|
1216 iPopUpAnchor->SetAnchor(EAlfAnchorTopLeft, 1, |
|
1217 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1218 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1219 TAlfTimedPoint( 0.28, 0.4 )); |
|
1220 iPopUpAnchor->SetAnchor(EAlfAnchorBottomRight, 1, |
|
1221 EAlfAnchorOriginHCenter, EAlfAnchorOriginBottom, |
|
1222 EAlfAnchorMetricRelativeToSize, EAlfAnchorMetricRelativeToSize, |
|
1223 TAlfTimedPoint( 0.22, -0.16 ) ); |
|
1224 |
|
1225 iPopUpLayout->SetOpacity( 0.0 ); |
|
1226 } |
|
1227 |
|
1228 |
|
1229 // --------------------------------------------------------- |
|
1230 // CHtkNavigationControl::DisplaySatelliteSignalStrength |
|
1231 // --------------------------------------------------------- |
|
1232 // |
|
1233 void CHtkNavigationControl::DisplaySatelliteSignalStrength( TInt aSatCount ) |
|
1234 { |
|
1235 TFileName imagepathname; |
|
1236 imagepathname.Zero(); |
|
1237 iImageVisual->SetImage(TAlfImage(*iSignalTextures[aSatCount])); |
|
1238 } |
|
1239 |
|
1240 // --------------------------------------------------------- |
|
1241 // CHtkNavigationControl::SetLandMarksNameL |
|
1242 // --------------------------------------------------------- |
|
1243 // |
|
1244 void CHtkNavigationControl::SetLandMarksNameL() |
|
1245 { |
|
1246 TDesC* name = NULL; |
|
1247 TBool isWaypointSet = iRouter->IsWaypointSet(); |
|
1248 TNamedCoordinate* waypoint = NULL; |
|
1249 CPosLandmark* landmark = NULL; |
|
1250 |
|
1251 TPtrC landmarkname; |
|
1252 if( isWaypointSet ) |
|
1253 { |
|
1254 waypoint = iRouter->Waypoint() ; |
|
1255 name = waypoint->Name(); |
|
1256 } |
|
1257 else |
|
1258 { |
|
1259 landmark = iRouter->Landmark(); |
|
1260 landmark->GetLandmarkName(landmarkname); |
|
1261 } |
|
1262 |
|
1263 HBufC* landmarksName = HBufC::NewLC( landmarkname.Length() + 20 ); |
|
1264 |
|
1265 if( isWaypointSet ) |
|
1266 { |
|
1267 landmarksName->Des().Copy( *name ); |
|
1268 delete name; |
|
1269 } |
|
1270 else |
|
1271 { |
|
1272 landmarksName->Des().Copy(landmarkname); |
|
1273 } |
|
1274 iLabel->SetTextL( *landmarksName ); |
|
1275 CleanupStack::PopAndDestroy(landmarksName); |
|
1276 } |
|
1277 |
|
1278 // --------------------------------------------------------- |
|
1279 // CHtkNavigationControl::ClearNavigationInfoL |
|
1280 // --------------------------------------------------------- |
|
1281 // |
|
1282 void CHtkNavigationControl::ClearNavigationInfoL() |
|
1283 { |
|
1284 CAlfVisual* lvisual = NULL; |
|
1285 if( iFlagdeck ) |
|
1286 { |
|
1287 lvisual = iFlagdeck->FindTag( iFlagText->Des() ); |
|
1288 if( lvisual ) |
|
1289 { |
|
1290 lvisual->SetOpacity( 0.0 ); |
|
1291 } |
|
1292 } |
|
1293 |
|
1294 if( iAccVisual ) |
|
1295 { |
|
1296 lvisual = iLayout->FindTag( iAccText->Des() ); |
|
1297 if( lvisual ) |
|
1298 { |
|
1299 lvisual->SetOpacity( 0.0 ); |
|
1300 } |
|
1301 } |
|
1302 |
|
1303 if( iCurveLayout && iIsDestinationSet ) |
|
1304 { |
|
1305 iNavigationRing->SetScale( 1.0 ); |
|
1306 CAlfCurvePath& path = iCurveLayout->CurvePath(); |
|
1307 TAlfRealPoint centre( 0.5, 0.5 ); |
|
1308 TAlfRealSize radious( 0.47, 0.37 ); |
|
1309 path.Reset(); |
|
1310 path.AppendArcL( centre, radious, 0, 360, 1 ); |
|
1311 path.EnableLoop(); |
|
1312 } |
|
1313 |
|
1314 iDistanceLabel->SetTextL( KText1 ); |
|
1315 iSpeedLabel->SetTextL( KText1 ); |
|
1316 iSpeedFormatLabel->SetTextL( KText1 ); |
|
1317 iLabel->SetTextL( KText1 ); |
|
1318 |
|
1319 if( iNdecLayout && iIsDestinationSet ) |
|
1320 { |
|
1321 TAlfTimedPoint pos1; |
|
1322 pos1.SetTarget( 0.75, 0 ); |
|
1323 iNdecLayout->SetPos( pos1 ); |
|
1324 } |
|
1325 |
|
1326 // Playing should be stopped if user stop navigation |
|
1327 if( iToneUtility ) |
|
1328 { |
|
1329 // change back the softkey to optionexit |
|
1330 if( iView.CBAPtr() ) |
|
1331 { |
|
1332 iView.CBAPtr()->SetCommandSetL( R_BLID_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS ); |
|
1333 iView.CBAPtr()->DrawDeferred(); |
|
1334 } |
|
1335 iToneUtility->CanclePayer(); |
|
1336 } |
|
1337 |
|
1338 iHasArrived = EFalse; |
|
1339 iHasToPlayArrivedTone = ETrue; |
|
1340 iTimeFirstArrived = EFalse; |
|
1341 iTimerComplete = EFalse; |
|
1342 iIsDestinationSet = EFalse; |
|
1343 } |
|
1344 |
|
1345 // --------------------------------------------------------- |
|
1346 // CHtkNavigationControl::SetUpdateOptionL |
|
1347 // --------------------------------------------------------- |
|
1348 // |
|
1349 void CHtkNavigationControl::SetUpdateOptionL( TBool aIsDestSet ) |
|
1350 { |
|
1351 iIsFirstDistance = 0; |
|
1352 iIsDestinationSet = aIsDestSet; |
|
1353 iLocationModel.SetTripStartL(); |
|
1354 } |
|
1355 |
|
1356 // --------------------------------------------------------- |
|
1357 // CHtkNavigationControl::PlayArrivedToneL |
|
1358 // --------------------------------------------------------- |
|
1359 // |
|
1360 void CHtkNavigationControl::PlayArrivedToneL() |
|
1361 { |
|
1362 if( !iToneUtility ) |
|
1363 { |
|
1364 iToneUtility = CBlidArrivedTonePlayerUtility::NewL(); |
|
1365 } |
|
1366 TBuf<KMaxFileName> lFileName; |
|
1367 lFileName.Copy( iSettings->GetArrivedToneName() ); |
|
1368 iToneUtility->PlayToneL( lFileName ); |
|
1369 iHasToPlayArrivedTone = EFalse; |
|
1370 if( iView.CBAPtr() ) |
|
1371 { |
|
1372 iView.CBAPtr()->SetCommandSetL( R_BLID_SOFTKEYS_OPTIONS_STOP ); |
|
1373 iView.CBAPtr()->DrawDeferred(); |
|
1374 } |
|
1375 } |
|
1376 |
|
1377 // --------------------------------------------------------- |
|
1378 // CHtkNavigationControl::CalculateIfArrivedL |
|
1379 // --------------------------------------------------------- |
|
1380 // |
|
1381 void CHtkNavigationControl::CalculateIfArrivedL() |
|
1382 { |
|
1383 if(iHasArrived) |
|
1384 { |
|
1385 if( iTimeFirstArrived ) |
|
1386 { |
|
1387 if( iTimer ) |
|
1388 { |
|
1389 delete iTimer; |
|
1390 iTimer = NULL; |
|
1391 } |
|
1392 iTimer = CPeriodic::NewL( EPriorityHigh ); |
|
1393 if( iTimer ) |
|
1394 { |
|
1395 TCallBack callback( TimerCallBackFunction, this ); |
|
1396 iTimer->Start( TTimeIntervalMicroSeconds32( KMinArrivalTime ), |
|
1397 TTimeIntervalMicroSeconds32( 80000000 ), |
|
1398 callback ); |
|
1399 iTimeFirstArrived = EFalse; |
|
1400 } |
|
1401 |
|
1402 TReal32 flagArrivedScale = ( iCurveSize.iWidth ) / ( ( iFlagSize.iWidth / 2 ) + ( iAccuracyringcurveSize.iWidth / 2 ) ); |
|
1403 TReal32 accArrivedScale = ( iCurveSize.iWidth / 2 ) / ( ( iFlagSize.iWidth / 2 ) + ( iAccuracyringcurveSize.iWidth / 2 ) ); |
|
1404 iAccVisual->SetScale( accArrivedScale ); |
|
1405 //iFlagVisual->SetScale( flagArrivedScale ); |
|
1406 iNavigationRing->SetScale( 0.25 ); |
|
1407 // change the curve path size once arrived. |
|
1408 if( iCurveLayout ) |
|
1409 { |
|
1410 TAlfRealPoint centre( 0.5, 0.4 ); |
|
1411 TAlfRealSize radious( 0, 0 ); |
|
1412 iCurveLayout->CurvePath().Reset(); |
|
1413 iCurveLayout->CurvePath().AppendArcL( centre, radious, 0, 360, 1 ); |
|
1414 iCurveLayout->CurvePath().EnableLoop(); |
|
1415 if(iFlagdeck) |
|
1416 iFlagdeck->SetPos( iCurveLayout->Pos() ); |
|
1417 } |
|
1418 |
|
1419 if(iInArrivedZone) |
|
1420 { |
|
1421 iFlagVisual->SetScale( 4 * flagArrivedScale ); |
|
1422 } |
|
1423 isStopUpdate = ETrue; |
|
1424 } |
|
1425 else if( iTimerComplete ) |
|
1426 { |
|
1427 isStopUpdate = EFalse; |
|
1428 if( iToneUtility ) |
|
1429 { |
|
1430 iToneUtility->CanclePayer(); |
|
1431 } |
|
1432 // change back the softkey to optionexit |
|
1433 if( iView.CBAPtr() ) |
|
1434 { |
|
1435 iView.CBAPtr()->SetCommandSetL( R_BLID_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS ); |
|
1436 iView.CBAPtr()->DrawDeferred(); |
|
1437 } |
|
1438 if( !IsInArrivedZone() ) |
|
1439 { |
|
1440 iHasArrived = EFalse; |
|
1441 } |
|
1442 } |
|
1443 else if( !IsInArrivedZone() ) |
|
1444 { |
|
1445 StopPlayerL(); |
|
1446 iHasArrived = EFalse; |
|
1447 iMskInfoVisible = ETrue; |
|
1448 } |
|
1449 } |
|
1450 else |
|
1451 { |
|
1452 if(iEngine.HasArrivedToDestination()) |
|
1453 { |
|
1454 iHasArrived = ETrue; |
|
1455 iHasToPlayArrivedTone = ETrue; |
|
1456 iTimeFirstArrived = ETrue; |
|
1457 iTimerComplete = EFalse; |
|
1458 } |
|
1459 } |
|
1460 } |
|
1461 |
|
1462 // --------------------------------------------------------- |
|
1463 // CHtkNavigationControl::Tick() |
|
1464 // --------------------------------------------------------- |
|
1465 // |
|
1466 TInt CHtkNavigationControl::Tick(TAny* aObject) |
|
1467 { |
|
1468 ((CHtkNavigationControl*)aObject)->UpdateVisualImage(); // cast, and call non-static function |
|
1469 |
|
1470 return KErrNone; |
|
1471 } |
|
1472 |
|
1473 // --------------------------------------------------------- |
|
1474 // CHtkNavigationControl::UpdateVisualImage |
|
1475 // --------------------------------------------------------- |
|
1476 // |
|
1477 void CHtkNavigationControl::UpdateVisualImage() |
|
1478 { |
|
1479 if( isSatelliteInfoLaunch ) |
|
1480 { |
|
1481 if(KNumOfSearchIcon > iDisplayIcon) |
|
1482 { |
|
1483 iDisplayIcon++; |
|
1484 } |
|
1485 else |
|
1486 { |
|
1487 iDisplayIcon = 1; |
|
1488 } |
|
1489 //iPopImage->SetSize( animationRect.Size() ); |
|
1490 iPopImage->SetImage( TAlfImage( *iPopupTextures[iDisplayIcon-1] ) );//N |
|
1491 } |
|
1492 else if(!iTimerComplete && isStopUpdate) |
|
1493 { |
|
1494 if(KNumOfFlagIcon > iDisplayIcon) |
|
1495 { |
|
1496 iDisplayIcon++; |
|
1497 } |
|
1498 else |
|
1499 { |
|
1500 iDisplayIcon = 1; |
|
1501 } |
|
1502 //iFlagVisual->SetSize( animationRect.Size() ); |
|
1503 iFlagVisual->SetImage( TAlfImage( *iTextures[iDisplayIcon-1] ) );//N |
|
1504 } |
|
1505 } |
|
1506 |
|
1507 // --------------------------------------------------------- |
|
1508 // CHtkNavigationControl::ChangeFlagVisualImageL |
|
1509 // --------------------------------------------------------- |
|
1510 // |
|
1511 void CHtkNavigationControl::ChangeFlagVisualImageL() |
|
1512 { |
|
1513 if( iPeriodic ) |
|
1514 { |
|
1515 delete iPeriodic; |
|
1516 iPeriodic = NULL; |
|
1517 } |
|
1518 iDisplayIcon = 1; |
|
1519 //iFlagVisual->SetSize( animationRect.Size() ); |
|
1520 iFlagVisual->SetImage( TAlfImage( *iTextures[iDisplayIcon-1] ) );//N |
|
1521 } |
|
1522 |
|
1523 // --------------------------------------------------------- |
|
1524 // CHtkNavigationControl::IsInArrivedZone |
|
1525 // --------------------------------------------------------- |
|
1526 // |
|
1527 TBool CHtkNavigationControl::IsInArrivedZone() |
|
1528 { |
|
1529 if(iRouter->IsAnyPointSet()) |
|
1530 { |
|
1531 TPosition& currentPosition = iLocationModel.GetCurrentPosition(); |
|
1532 TReal32 distanceToDestination(0); |
|
1533 |
|
1534 if(iRouter->IsWaypointSet()) |
|
1535 { |
|
1536 TNamedCoordinate* destination = iRouter->Waypoint(); |
|
1537 if(destination->Distance(currentPosition, distanceToDestination) != KErrNone) |
|
1538 { |
|
1539 return EFalse; |
|
1540 } |
|
1541 } |
|
1542 else |
|
1543 { |
|
1544 TPosition destination; |
|
1545 CPosLandmark* landmark = iRouter->Landmark(); |
|
1546 landmark->GetPosition(destination); |
|
1547 if(currentPosition.Distance(destination, distanceToDestination) != KErrNone) |
|
1548 { |
|
1549 return EFalse; |
|
1550 } |
|
1551 } |
|
1552 |
|
1553 if( distanceToDestination < iSettings->GetArrivedDistance() && |
|
1554 iHasArrived ) |
|
1555 { |
|
1556 return ETrue; |
|
1557 } |
|
1558 } |
|
1559 return EFalse; |
|
1560 } |
|
1561 |
|
1562 // --------------------------------------------------------- |
|
1563 // CHtkNavigationControl::HasArrivedDestination |
|
1564 // --------------------------------------------------------- |
|
1565 // |
|
1566 TBool CHtkNavigationControl::HasArrivedDestination() |
|
1567 { |
|
1568 return iHasArrived; |
|
1569 } |
|
1570 |
|
1571 // ---------------------------------------------------------------------------- |
|
1572 // CHtkNavigationControl::CreateApplicationStringsL |
|
1573 // ---------------------------------------------------------------------------- |
|
1574 // |
|
1575 void CHtkNavigationControl::CreateApplicationStringsL( ) |
|
1576 { |
|
1577 iDistanceFormatKm = CEikonEnv::Static()->AllocReadResourceL( |
|
1578 R_BLID_NAV_DISTANCE_KM ); |
|
1579 iDistanceFormatM = CEikonEnv::Static()->AllocReadResourceL( |
|
1580 R_BLID_NAV_DISTANCE_M ); |
|
1581 |
|
1582 iDistanceFormatMiles = CEikonEnv::Static()->AllocReadResourceL( |
|
1583 R_BLID_NAV_DISTANCE_MI ); |
|
1584 |
|
1585 iDistanceFormatFt = CEikonEnv::Static()->AllocReadResourceL( |
|
1586 R_BLID_NAV_DISTANCE_FT ); |
|
1587 |
|
1588 iDurationFormatLong = CEikonEnv::Static()->AllocReadResourceL( |
|
1589 R_QTN_TIME_DURAT_LONG_WITH_ZERO ); |
|
1590 |
|
1591 iBlidSpeed = StringLoader::LoadL( R_BLID_NAVIGATION_SPEED, CEikonEnv::Static()); |
|
1592 |
|
1593 |
|
1594 iSpeedFormatKmph = CEikonEnv::Static()->AllocReadResourceL( R_BLID_METRIC_SPEED_FORMAT ); |
|
1595 iSpeedFormatMph = CEikonEnv::Static()->AllocReadResourceL( R_BLID_IMPERIAL_SPEED_FORMAT ); |
|
1596 iDataBeingCalculated = StringLoader::LoadL( R_BLID_WAITING_GPS_LIST, CEikonEnv::Static() ); |
|
1597 iDataBlank = StringLoader::LoadL( R_BLID_BLANK, CEikonEnv::Static() ); |
|
1598 |
|
1599 iFlagText = HBufC8::NewL( 8 ); |
|
1600 iAccText = HBufC8::NewL( 15 ); |
|
1601 iFlagText->Des().Copy( KFlagVisual ); |
|
1602 iAccText->Des().Copy( KAccVisual ); |
|
1603 } |
|
1604 |
|
1605 |
|
1606 // --------------------------------------------------------- |
|
1607 // CHtkNavigationControl::CalculateDistance |
|
1608 // --------------------------------------------------------- |
|
1609 // |
|
1610 void CHtkNavigationControl::CalculateDistanceL( TPosition aPosition ) |
|
1611 { |
|
1612 // If destination is not set don't do anything |
|
1613 if( iRouter->IsAnyPointSet() ) |
|
1614 { |
|
1615 TNamedCoordinate* waypoint = NULL; |
|
1616 CPosLandmark* landmark = NULL; |
|
1617 |
|
1618 if( iRouter->IsWaypointSet() ) |
|
1619 { |
|
1620 waypoint = iRouter->Waypoint() ; |
|
1621 } |
|
1622 else |
|
1623 { |
|
1624 landmark = iRouter->Landmark(); |
|
1625 } |
|
1626 |
|
1627 iDistance = 0; |
|
1628 if ( iRouter->IsAnyPointSet() && waypoint ) |
|
1629 { |
|
1630 User::LeaveIfError( aPosition.Distance( TCoordinate( |
|
1631 waypoint->Latitude(), |
|
1632 waypoint->Longitude(), |
|
1633 waypoint->Altitude() ),iDistance) ); |
|
1634 } |
|
1635 else if( landmark ) |
|
1636 { |
|
1637 TLocality location; |
|
1638 landmark->GetPosition(location); |
|
1639 User::LeaveIfError( aPosition.Distance( TCoordinate( |
|
1640 location.Latitude(), |
|
1641 location.Longitude(), |
|
1642 location.Altitude() ),iDistance) ); |
|
1643 } |
|
1644 } |
|
1645 } |
|
1646 |
|
1647 // --------------------------------------------------------- |
|
1648 // CHtkNavigationControl::CalculateDurationL |
|
1649 // --------------------------------------------------------- |
|
1650 // |
|
1651 void CHtkNavigationControl::CalculateDurationL( TCourse /*aCourse*/ ) |
|
1652 { |
|
1653 TCourse course = iLocationModel.GetCourse(); |
|
1654 iSpeed = course.Speed(); |
|
1655 |
|
1656 iDurationInSeconds = 0; |
|
1657 |
|
1658 if ( !Math::IsNaN(iSpeed) ) |
|
1659 { |
|
1660 User::LeaveIfError( Math::Round( iSpeed, iSpeed, KDecimals3 ) ); |
|
1661 iIsSpeed = ETrue; |
|
1662 } |
|
1663 else |
|
1664 { |
|
1665 iIsSpeed = EFalse; |
|
1666 iSpeed = 0; |
|
1667 } |
|
1668 |
|
1669 if ( iSpeed != 0 && iDistance != 0) |
|
1670 { |
|
1671 iDurationInSeconds = (iDistance/iSpeed); |
|
1672 } |
|
1673 |
|
1674 TBuf<KBlidLBItemMaxLen> durationString; |
|
1675 if ( BlidUtils::FormatStringToTime( durationString, iDurationInSeconds ) |
|
1676 != KErrNone ) |
|
1677 { |
|
1678 return; |
|
1679 } |
|
1680 |
|
1681 if ( iDurationInSeconds < KDayToSeconds ) |
|
1682 { |
|
1683 iDuration.Set( durationString ); |
|
1684 } |
|
1685 else |
|
1686 { |
|
1687 User::LeaveIfError( |
|
1688 BlidUtils::SecondsToDays( iDurationInSeconds, iDurationInDays ) ); |
|
1689 } |
|
1690 } |
|
1691 |
|
1692 |
|
1693 |
|
1694 // --------------------------------------------------------- |
|
1695 // CHtkNavigationControl::PrepareDynamicMoveL |
|
1696 // --------------------------------------------------------- |
|
1697 // |
|
1698 void CHtkNavigationControl::PrepareDynamicMoveL( ) |
|
1699 { |
|
1700 if( iLocationModel.IsGPSDataAvailable() ) |
|
1701 { |
|
1702 if( isStopUpdate ) |
|
1703 { |
|
1704 return; |
|
1705 } |
|
1706 |
|
1707 if( iHasArrived ) |
|
1708 { |
|
1709 return; |
|
1710 } |
|
1711 |
|
1712 TInt error = KErrNone; |
|
1713 // calculate angle of bearing |
|
1714 const TPosition& position = iPositionInfo; |
|
1715 TReal heading = iLocationModel.GetHeading(); |
|
1716 TReal32 bearing(0); |
|
1717 |
|
1718 TBool isWaypointSet = iRouter->IsWaypointSet(); |
|
1719 TNamedCoordinate* waypoint = NULL; |
|
1720 CPosLandmark* landmark = NULL; |
|
1721 |
|
1722 if( isWaypointSet ) |
|
1723 { |
|
1724 waypoint = iRouter->Waypoint() ; |
|
1725 } |
|
1726 else |
|
1727 { |
|
1728 landmark = iRouter->Landmark(); |
|
1729 } |
|
1730 |
|
1731 if ( !Math::IsNaN(heading) ) |
|
1732 { |
|
1733 iHeading = heading; |
|
1734 } |
|
1735 |
|
1736 if( isWaypointSet && waypoint ) |
|
1737 { |
|
1738 error = position.BearingTo( TCoordinate( |
|
1739 waypoint->Latitude(), |
|
1740 waypoint->Longitude(), |
|
1741 waypoint->Altitude() ), |
|
1742 bearing ); |
|
1743 } |
|
1744 else if( landmark ) |
|
1745 { |
|
1746 TLocality location; |
|
1747 landmark->GetPosition(location); |
|
1748 error = position.BearingTo( TCoordinate( |
|
1749 location.Latitude(), |
|
1750 location.Longitude(), |
|
1751 location.Altitude() ), |
|
1752 bearing ); |
|
1753 } |
|
1754 |
|
1755 //calculate bearing and heading |
|
1756 TInt resultBearing(0); |
|
1757 TInt resultHeading(0); |
|
1758 TReal32 lDistance; |
|
1759 TReal degreeN( 0 ); |
|
1760 |
|
1761 error = BlidUtils::TRealToTInt(bearing, resultBearing); |
|
1762 if( error == KErrNone) |
|
1763 { |
|
1764 error = BlidUtils::TRealToTInt(iHeading, resultHeading); |
|
1765 if( error == KErrNone) |
|
1766 { |
|
1767 degreeN = resultHeading; |
|
1768 |
|
1769 TReal32 NavigationPaneRadius = iCurveSize.iWidth / 2; |
|
1770 TReal32 accuracyRingRadius = iAccuracyringcurveSize.iWidth / 2; |
|
1771 TReal32 flagRadious = iFlagSize.iWidth / 2; |
|
1772 |
|
1773 if( isWaypointSet ) |
|
1774 { |
|
1775 position.Distance(TCoordinate(waypoint->Latitude(),waypoint->Longitude()), lDistance); |
|
1776 } |
|
1777 else |
|
1778 { |
|
1779 TLocality location; |
|
1780 landmark->GetPosition(location); |
|
1781 position.Distance(TCoordinate(location.Latitude(),location.Longitude()), lDistance); |
|
1782 } |
|
1783 |
|
1784 if( iIsFirstDistance == 0 ) |
|
1785 { |
|
1786 iFirstDistance = lDistance; |
|
1787 iIsFirstDistance = 1; |
|
1788 } |
|
1789 |
|
1790 TReal32 flagFactor = 0,ringFactor = 0, accFactor = 0, ringMap = 0, ringWidth = 0; |
|
1791 TReal32 newRingFact = 0, newFlagFact = 0, newAccFact = 0, difference = 0; |
|
1792 TReal32 flagAccFact = NavigationPaneRadius / 2; |
|
1793 if(iAccVisual->Opacity().ValueNow() == 0.0) |
|
1794 { |
|
1795 |
|
1796 iAccVisual->SetOpacity(1.0); |
|
1797 } |
|
1798 |
|
1799 if(iFlagVisual->Opacity().ValueNow() == 0.0) |
|
1800 { |
|
1801 |
|
1802 iFlagVisual->SetOpacity(0.8); |
|
1803 } |
|
1804 if( lDistance < iFirstDistance && iFirstDistance > 0 ) |
|
1805 { |
|
1806 ringFactor = NavigationPaneRadius / iFirstDistance; |
|
1807 flagFactor = ( NavigationPaneRadius - flagRadious ) / iFirstDistance; |
|
1808 accFactor = ( flagAccFact - accuracyRingRadius ) / iFirstDistance; |
|
1809 |
|
1810 difference = iFirstDistance - lDistance; |
|
1811 newRingFact = lDistance * ringFactor; |
|
1812 newFlagFact = flagRadious + flagFactor * difference; |
|
1813 newAccFact = accuracyRingRadius + accFactor * difference; |
|
1814 |
|
1815 ringMap = (newRingFact * 0.37 ) / NavigationPaneRadius; |
|
1816 ringWidth = (newRingFact * 0.47 ) / NavigationPaneRadius; |
|
1817 if( ringMap <= 0.37 && ringMap > 0 ) |
|
1818 { |
|
1819 TAlfRealPoint centre( 0.5, 0.5 ); |
|
1820 TAlfRealSize radious( ringWidth,ringMap ); |
|
1821 Env().SetRefreshMode( EAlfRefreshModeManual ); |
|
1822 iCurveLayout->CurvePath().Reset(); |
|
1823 TRAP( error, iCurveLayout->CurvePath().AppendArcL( centre, radious, 0, 360, 1 ) ) |
|
1824 iCurveLayout->CurvePath().EnableLoop(); |
|
1825 Env().SetRefreshMode( EAlfRefreshModeAutomatic ); |
|
1826 } |
|
1827 // scale flag and accuracy ring |
|
1828 iAccVisual->SetScale( TAlfTimedValue( newAccFact / accuracyRingRadius ) ); |
|
1829 iFlagVisual->SetScale( TAlfTimedValue( newFlagFact / flagRadious ) ); |
|
1830 iNavigationRing->SetScale( newRingFact / NavigationPaneRadius ); |
|
1831 } |
|
1832 else |
|
1833 { |
|
1834 iFirstDistance = lDistance; |
|
1835 Env().SetRefreshMode( EAlfRefreshModeManual ); |
|
1836 iCurveLayout->CurvePath().Reset(); |
|
1837 TRAP( error, iCurveLayout->CurvePath().AppendArcL( TAlfRealPoint( 0.5, 0.5 ), |
|
1838 TAlfRealPoint( 0.47, 0.37 ), |
|
1839 0, |
|
1840 360, |
|
1841 1 ) ); |
|
1842 iCurveLayout->CurvePath().EnableLoop(); |
|
1843 Env().SetRefreshMode( EAlfRefreshModeAutomatic ); |
|
1844 iAccVisual->SetScale( 0.8 ); |
|
1845 iFlagVisual->SetScale( 1.5 ); |
|
1846 iNavigationRing->SetScale( 1.0 ); |
|
1847 } |
|
1848 |
|
1849 // for N movement |
|
1850 TReal32 lpointN = ( 360 - degreeN ) / 360; |
|
1851 // As start from top position |
|
1852 lpointN -= 0.25; |
|
1853 |
|
1854 // for flag movement |
|
1855 TReal32 lpoint = resultBearing - resultHeading; |
|
1856 TReal32 lpointFlag( 0 ); |
|
1857 if( lpoint > 0 ) |
|
1858 { |
|
1859 lpointFlag = lpoint / 360; |
|
1860 } |
|
1861 else |
|
1862 { |
|
1863 lpointFlag = ( 360 + lpoint ) / 360; |
|
1864 } |
|
1865 // As start from top position |
|
1866 lpointFlag -= 0.25; |
|
1867 |
|
1868 TAlfPointCommand moveCommandN( |
|
1869 iNdecLayout, |
|
1870 EAlfPointCommandVisualSetPos, |
|
1871 TAlfRealPoint( lpointN , lpointN ), |
|
1872 0 ); |
|
1873 moveCommandN.ExecuteL( iEnv ); |
|
1874 |
|
1875 // move it again later on |
|
1876 TAlfPointCommand moveCommand( |
|
1877 idecLayout, |
|
1878 EAlfPointCommandVisualSetPos, |
|
1879 TAlfRealPoint( lpointFlag , lpointFlag ), |
|
1880 0 ); |
|
1881 moveCommand.ExecuteL( iEnv ); |
|
1882 } |
|
1883 } |
|
1884 } |
|
1885 } |
|
1886 |
|
1887 // --------------------------------------------------------- |
|
1888 // CHtkNavigationControl::DistanceFormat |
|
1889 // --------------------------------------------------------- |
|
1890 // |
|
1891 void CHtkNavigationControl::DistanceFormat( TDes& aDistanceString ) |
|
1892 { |
|
1893 //max distance is 20.000km, so aDistanceString is allways |
|
1894 //long enough |
|
1895 TBuf<KBlidLBItemMaxLen> temp; |
|
1896 TInt result; |
|
1897 if( !iRouter->IsAnyPointSet() ) |
|
1898 { |
|
1899 // |
|
1900 // Destination not set |
|
1901 // |
|
1902 aDistanceString = *iDataBlank; |
|
1903 return; |
|
1904 } |
|
1905 |
|
1906 if ( iSettings->UnitOfMeasurement() == EUnitsMetric ) |
|
1907 { |
|
1908 if ( iDistance >= KKilometerToMeters ) |
|
1909 { |
|
1910 TReal distanceInKm = iDistance / KKilometerToMeters; |
|
1911 if(distanceInKm >1 && distanceInKm <100) |
|
1912 { |
|
1913 BlidUtils::DistanceFormat( aDistanceString, distanceInKm,ETrue ); |
|
1914 } |
|
1915 else |
|
1916 { |
|
1917 BlidUtils::DistanceFormat( aDistanceString, distanceInKm, EFalse ); |
|
1918 } |
|
1919 } |
|
1920 else |
|
1921 { |
|
1922 if ( BlidUtils::TRealToTInt(iDistance, result) != KErrNone ) |
|
1923 { |
|
1924 result = 0; |
|
1925 } |
|
1926 BlidUtils::DistanceFormat( aDistanceString, result, EFalse ); |
|
1927 } |
|
1928 } |
|
1929 else |
|
1930 { |
|
1931 TReal distanceImperial = iDistance*KMetreToFoot; |
|
1932 if ( distanceImperial >= KMileToFeets ) |
|
1933 { |
|
1934 distanceImperial /= KMileToFeets; |
|
1935 if(distanceImperial >10 && distanceImperial <100) |
|
1936 { |
|
1937 BlidUtils::DistanceFormat( aDistanceString, distanceImperial,ETrue ); |
|
1938 } |
|
1939 else |
|
1940 { |
|
1941 BlidUtils::DistanceFormat( aDistanceString, distanceImperial, EFalse ); |
|
1942 } |
|
1943 } |
|
1944 else |
|
1945 { |
|
1946 if ( BlidUtils::TRealToTInt(distanceImperial, result) != KErrNone ) |
|
1947 { |
|
1948 result = 0; |
|
1949 } |
|
1950 BlidUtils::DistanceFormat( aDistanceString, result, EFalse ); |
|
1951 } |
|
1952 } |
|
1953 } |
|
1954 |
|
1955 // --------------------------------------------------------- |
|
1956 // CHtkNavigationControl::DistanceUnit |
|
1957 // --------------------------------------------------------- |
|
1958 // |
|
1959 void CHtkNavigationControl::DistanceUnit( TDes& aUnitString ) |
|
1960 { |
|
1961 //max distance is 20.000km, so aDistanceString is allways |
|
1962 //long enough |
|
1963 TInt result; |
|
1964 |
|
1965 if ( iSettings->UnitOfMeasurement() == EUnitsMetric ) |
|
1966 { |
|
1967 if ( iDistance >= KKilometerToMeters ) |
|
1968 { |
|
1969 |
|
1970 aUnitString.Append(*iDistanceFormatKm); |
|
1971 } |
|
1972 else |
|
1973 { |
|
1974 if ( BlidUtils::TRealToTInt(iDistance, result) != KErrNone ) |
|
1975 { |
|
1976 result = 0; |
|
1977 } |
|
1978 |
|
1979 aUnitString.Append(*iDistanceFormatM); |
|
1980 } |
|
1981 } |
|
1982 else |
|
1983 { |
|
1984 TReal distanceImperial = iDistance*KMetreToFoot; |
|
1985 if ( distanceImperial >= KMileToFeets ) |
|
1986 { |
|
1987 distanceImperial /= KMileToFeets; |
|
1988 aUnitString.Append(*iDistanceFormatMiles); |
|
1989 } |
|
1990 else |
|
1991 { |
|
1992 if ( BlidUtils::TRealToTInt(distanceImperial, result) != KErrNone ) |
|
1993 { |
|
1994 result = 0; |
|
1995 } |
|
1996 aUnitString.Append(*iDistanceFormatFt); |
|
1997 |
|
1998 } |
|
1999 } |
|
2000 } |
|
2001 |
|
2002 // ---------------------------------------------------------------------------- |
|
2003 // CHtkNavigationControl::SpeedFormat |
|
2004 // ---------------------------------------------------------------------------- |
|
2005 // |
|
2006 void CHtkNavigationControl::SpeedFormat( TDes& aSpeedString, TDes& aSpeedFormatString) |
|
2007 { |
|
2008 if(!iRouter->IsAnyPointSet()) |
|
2009 { |
|
2010 // |
|
2011 // Destination not set |
|
2012 // |
|
2013 aSpeedString = *iDataBlank; |
|
2014 aSpeedFormatString = *iDataBlank; |
|
2015 return; |
|
2016 } |
|
2017 |
|
2018 if ( iIsSpeed ) |
|
2019 { |
|
2020 TReal speedInKmph = iSpeed * KSpeedConvertion; |
|
2021 // |
|
2022 //If speed is less than 1km or mile per hour,then no data |
|
2023 // is displayed |
|
2024 // |
|
2025 if(speedInKmph < 1) |
|
2026 { |
|
2027 aSpeedString = *iDataBlank; |
|
2028 aSpeedFormatString = *iDataBlank; |
|
2029 return; |
|
2030 } |
|
2031 TBuf<KBlidLBItemMaxLen> temp; |
|
2032 //HBufC* formatter = NULL; |
|
2033 if ( iSettings->UnitOfMeasurement() == EUnitsMetric ) |
|
2034 { |
|
2035 temp.Format( KSpeedFormat, speedInKmph ); |
|
2036 //formatter = iSpeedFormatKmph; |
|
2037 aSpeedString.Copy(temp); |
|
2038 aSpeedFormatString.Copy(*iSpeedFormatKmph); |
|
2039 } |
|
2040 else |
|
2041 { |
|
2042 speedInKmph *= KKilometreToMiles; |
|
2043 temp.Format( KSpeedFormat, speedInKmph ); |
|
2044 //formatter = iSpeedFormatMph; |
|
2045 aSpeedString.Copy(temp); |
|
2046 aSpeedFormatString.Copy(*iSpeedFormatMph); |
|
2047 } |
|
2048 //StringLoader::Format( aSpeedString, *formatter, 0, temp ); |
|
2049 } |
|
2050 else |
|
2051 { |
|
2052 aSpeedString = *iDataBeingCalculated; |
|
2053 } |
|
2054 } |
|
2055 |
|
2056 // ---------------------------------------------------------------------------- |
|
2057 // CHtkNavigationControl::StopPlayerL |
|
2058 // ---------------------------------------------------------------------------- |
|
2059 // |
|
2060 void CHtkNavigationControl::StopPlayerL( ) |
|
2061 { |
|
2062 if( iToneUtility && isStopUpdate ) |
|
2063 { |
|
2064 iToneUtility->CanclePayer(); |
|
2065 ChangeFlagVisualImageL(); |
|
2066 isStopUpdate = EFalse; |
|
2067 // change back the softkey to optionexit |
|
2068 if( iView.CBAPtr() ) |
|
2069 { |
|
2070 iView.CBAPtr()->SetCommandSetL( R_BLID_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS ); |
|
2071 iView.CBAPtr()->DrawDeferred(); |
|
2072 } |
|
2073 } |
|
2074 } |
|
2075 |
|
2076 |
|
2077 // ---------------------------------------------------------------------------- |
|
2078 // CHtkNavigationControl::NotifyControlVisibility |
|
2079 // ---------------------------------------------------------------------------- |
|
2080 // |
|
2081 void CHtkNavigationControl::NotifyControlVisibility( TBool aIsVisible, |
|
2082 CAlfDisplay& /*aDisplay*/ ) |
|
2083 { |
|
2084 if( !aIsVisible ) |
|
2085 { |
|
2086 TRAP_IGNORE(StopPlayerL()); |
|
2087 } |
|
2088 } |
|
2089 |
|
2090 // ---------------------------------------------------------------------------- |
|
2091 // CHtkNavigationControl::UpdateLayoutL |
|
2092 // ---------------------------------------------------------------------------- |
|
2093 // |
|
2094 void CHtkNavigationControl::UpdateLayoutL( ) |
|
2095 { |
|
2096 // Call all the root label setanchor and adjust the new LAyout rectangle. |
|
2097 CalculateRects(); |
|
2098 SetAnchors(); |
|
2099 } |
|
2100 |
|
2101 // ---------------------------------------------------------------------------- |
|
2102 // CHtkNavigationControl::UpdateLayoutL |
|
2103 // ---------------------------------------------------------------------------- |
|
2104 // |
|
2105 void CHtkNavigationControl::CalculateRects( ) |
|
2106 { |
|
2107 TAknLayoutRect mainPane; |
|
2108 TAknLayoutRect mainBlid2Pane; |
|
2109 TAknLayoutRect layoutWindow; |
|
2110 TAknLayoutText textLayout; |
|
2111 TRect mainRect; |
|
2112 TRect mainBlidRect; |
|
2113 TRect navigationRect; |
|
2114 TInt variety; |
|
2115 TInt mainvariety; |
|
2116 |
|
2117 if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
2118 { |
|
2119 variety = 1; |
|
2120 mainvariety = 4; |
|
2121 } |
|
2122 else |
|
2123 { |
|
2124 variety = 0; |
|
2125 mainvariety = 0; |
|
2126 } |
|
2127 |
|
2128 /////////////// calculate signal strength rect ///////////////////////// |
|
2129 |
|
2130 /*TRect mainPaneRect; |
|
2131 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPaneRect );*/ |
|
2132 mainPane.LayoutRect( iView.ApplicationRect(), |
|
2133 AknLayoutScalable_Apps::main_pane(mainvariety).LayoutLine() ); |
|
2134 |
|
2135 mainRect = mainPane.Rect(); |
|
2136 |
|
2137 mainBlid2Pane.LayoutRect( mainRect, |
|
2138 AknLayoutScalable_Apps::main_blid2_pane().LayoutLine() ); |
|
2139 |
|
2140 mainBlidRect = mainBlid2Pane.Rect(); |
|
2141 |
|
2142 layoutWindow.LayoutRect( mainBlidRect, |
|
2143 AknLayoutScalable_Apps::blid2_navig_pane( 0 ).LayoutLine() ); |
|
2144 |
|
2145 navigationRect = layoutWindow.Rect(); |
|
2146 |
|
2147 // Since the Hitchcock does draw at main pane, we take the reference to |
|
2148 // Navigation(main) pane's. |
|
2149 navigationRect.Move(navigationRect.iTl.iX,-navigationRect.iTl.iY); |
|
2150 |
|
2151 /////////////// calculate Navigation rect ///////////////////////// |
|
2152 layoutWindow.LayoutRect( navigationRect, |
|
2153 AknLayoutScalable_Apps::blid2_navig_pane_g1( variety ).LayoutLine() ); |
|
2154 |
|
2155 iSignalStrengthRect = layoutWindow.Rect(); |
|
2156 |
|
2157 /////////////// calculate Diastance rect ///////////////////////// |
|
2158 textLayout.LayoutText( navigationRect, |
|
2159 AknLayoutScalable_Apps::blid2_navig_pane_t2( variety ).LayoutLine() ); |
|
2160 |
|
2161 iDistanceRect = textLayout.TextRect(); |
|
2162 |
|
2163 /////////////// calculate Landmark Name rect ///////////////////////// |
|
2164 textLayout.LayoutText( navigationRect, |
|
2165 AknLayoutScalable_Apps::blid2_navig_pane_t1( variety ).LayoutLine() ); |
|
2166 iLmkNameRect = textLayout.TextRect(); |
|
2167 |
|
2168 /////////////// calculate Speed pane rects ///////////////////////// |
|
2169 layoutWindow.LayoutRect( navigationRect, |
|
2170 AknLayoutScalable_Apps::blid2_speed_pane( variety ).LayoutLine() ); |
|
2171 |
|
2172 |
|
2173 TRect speedPaneRect = layoutWindow.Rect(); |
|
2174 |
|
2175 layoutWindow.LayoutRect( speedPaneRect, |
|
2176 AknLayoutScalable_Apps::blid2_speed_pane_g1( 0 ).LayoutLine() ); |
|
2177 |
|
2178 // Bg image Rect |
|
2179 iSpeedBgRect = layoutWindow.Rect(); |
|
2180 |
|
2181 textLayout.LayoutText( speedPaneRect, |
|
2182 AknLayoutScalable_Apps::blid2_speed_pane_t2( 0 ).LayoutLine() ); |
|
2183 |
|
2184 // Speed Rect |
|
2185 iSpeedRect = textLayout.TextRect(); |
|
2186 |
|
2187 textLayout.LayoutText( speedPaneRect, |
|
2188 AknLayoutScalable_Apps::blid2_speed_pane_t1( 0 ).LayoutLine() ); |
|
2189 |
|
2190 // Format Rect |
|
2191 iSpdFormatRect = textLayout.TextRect(); |
|
2192 iSpdFormatRect.Move( 0, -6); // For Text alignment |
|
2193 |
|
2194 |
|
2195 |
|
2196 /////////////// calculate Navigation ring pane rect ///////////////////////// |
|
2197 layoutWindow.LayoutRect( navigationRect, |
|
2198 AknLayoutScalable_Apps::blid2_navig_ring_pane( variety ).LayoutLine() ); |
|
2199 |
|
2200 |
|
2201 TRect navRingPaneRect = layoutWindow.Rect(); |
|
2202 |
|
2203 layoutWindow.LayoutRect( navRingPaneRect, |
|
2204 AknLayoutScalable_Apps::blid2_navig_ring_pane_g1( 0 ).LayoutLine() ); |
|
2205 |
|
2206 |
|
2207 iNavRingBgRect = layoutWindow.Rect(); |
|
2208 |
|
2209 /////////////// calculate North rect ///////////////////////// |
|
2210 layoutWindow.LayoutRect( navRingPaneRect, |
|
2211 AknLayoutScalable_Apps::blid2_navig_ring_pane_g2( 0 ).LayoutLine() ); |
|
2212 |
|
2213 iNorthRect = layoutWindow.Rect(); |
|
2214 |
|
2215 /////////////// calculate Direction Ind rect ///////////////////////// |
|
2216 layoutWindow.LayoutRect( navRingPaneRect, |
|
2217 AknLayoutScalable_Apps::blid2_navig_ring_pane_g3( 0 ).LayoutLine() ); |
|
2218 |
|
2219 iDirectionIndRect = layoutWindow.Rect(); |
|
2220 iDirectionIndRect.Move( 0, -15); // For Proper alignment |
|
2221 |
|
2222 |
|
2223 /////////////// calculate Accuracy Ring rect ///////////////////////// |
|
2224 layoutWindow.LayoutRect( navRingPaneRect, |
|
2225 AknLayoutScalable_Apps::blid2_navig_ring_pane_g4( 0 ).LayoutLine() ); |
|
2226 |
|
2227 |
|
2228 iAccRingRect = layoutWindow.Rect(); |
|
2229 /////////////// calculate Flag rect ///////////////////////// |
|
2230 layoutWindow.LayoutRect( navRingPaneRect, |
|
2231 AknLayoutScalable_Apps::blid2_navig_ring_pane_g5( 0 ).LayoutLine() ); |
|
2232 |
|
2233 iFlagRect = layoutWindow.Rect(); |
|
2234 |
|
2235 } |
|
2236 |
|
2237 |
|
2238 // ---------------------------------------------------------------------------- |
|
2239 // CHtkNavigationControl::SetAnchors |
|
2240 // ---------------------------------------------------------------------------- |
|
2241 // |
|
2242 void CHtkNavigationControl::SetAnchors( ) |
|
2243 { |
|
2244 // Anchor for Signal strength image |
|
2245 TAlfRealPoint topPoint( iSignalStrengthRect.iTl ); |
|
2246 TAlfRealPoint bottomPoint( iSignalStrengthRect.iBr ); |
|
2247 |
|
2248 iLayout->SetAnchor( EAlfAnchorTopLeft, 0, |
|
2249 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2250 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2251 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2252 iLayout->SetAnchor( EAlfAnchorBottomRight, 0, |
|
2253 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2254 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2255 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2256 |
|
2257 // Anchor for Name |
|
2258 topPoint = iLmkNameRect.iTl; |
|
2259 bottomPoint = iLmkNameRect.iBr; |
|
2260 |
|
2261 iLayout->SetAnchor( EAlfAnchorTopLeft, 1, |
|
2262 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2263 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2264 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2265 iLayout->SetAnchor( EAlfAnchorBottomRight, 1, |
|
2266 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2267 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2268 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2269 |
|
2270 // Anchor for Distance |
|
2271 topPoint = iDistanceRect.iTl; |
|
2272 bottomPoint = iDistanceRect.iBr; |
|
2273 |
|
2274 iLayout->SetAnchor( EAlfAnchorTopLeft, 2, |
|
2275 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2276 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2277 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2278 iLayout->SetAnchor( EAlfAnchorBottomRight, 2, |
|
2279 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2280 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2281 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2282 |
|
2283 // Anchor for Speed Pane Bg Image |
|
2284 topPoint = iSpeedBgRect.iTl; |
|
2285 bottomPoint = iSpeedBgRect.iBr; |
|
2286 |
|
2287 iLayout->SetAnchor( EAlfAnchorTopLeft, 3, |
|
2288 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2289 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2290 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2291 iLayout->SetAnchor( EAlfAnchorBottomRight, 3, |
|
2292 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2293 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2294 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2295 |
|
2296 // Anchor for Speed |
|
2297 topPoint = iSpeedRect.iTl; |
|
2298 bottomPoint = iSpeedRect.iBr; |
|
2299 |
|
2300 iLayout->SetAnchor( EAlfAnchorTopLeft, 4, |
|
2301 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2302 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2303 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2304 iLayout->SetAnchor( EAlfAnchorBottomRight, 4, |
|
2305 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2306 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2307 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2308 |
|
2309 // Anchor for Speed Format |
|
2310 topPoint = iSpdFormatRect.iTl; |
|
2311 bottomPoint = iSpdFormatRect.iBr; |
|
2312 |
|
2313 iLayout->SetAnchor( EAlfAnchorTopLeft, 5, |
|
2314 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2315 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2316 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2317 iLayout->SetAnchor( EAlfAnchorBottomRight, 5, |
|
2318 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2319 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2320 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2321 |
|
2322 |
|
2323 // Anchor for Nav Ring Pane |
|
2324 topPoint = iNavRingBgRect.iTl; |
|
2325 bottomPoint = iNavRingBgRect.iBr; |
|
2326 |
|
2327 iLayout->SetAnchor( EAlfAnchorTopLeft, 6, |
|
2328 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2329 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2330 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2331 iLayout->SetAnchor( EAlfAnchorBottomRight, 6, |
|
2332 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2333 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2334 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2335 |
|
2336 // Anchor for Acc Ring Pane |
|
2337 topPoint = iAccRingRect.iTl; |
|
2338 bottomPoint = iAccRingRect.iBr; |
|
2339 |
|
2340 iLayout->SetAnchor( EAlfAnchorTopLeft, 7, |
|
2341 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2342 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2343 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2344 iLayout->SetAnchor( EAlfAnchorBottomRight, 7, |
|
2345 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2346 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2347 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2348 |
|
2349 //Anchor for Visuals inside curve ring (iCurveDecLyt) |
|
2350 topPoint = iNavRingBgRect.iTl; |
|
2351 bottomPoint = iNavRingBgRect.iBr; |
|
2352 |
|
2353 iLayout->SetAnchor( EAlfAnchorTopLeft, 8, |
|
2354 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2355 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2356 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2357 iLayout->SetAnchor( EAlfAnchorBottomRight, 8, |
|
2358 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2359 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2360 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2361 |
|
2362 // Anchor for Direction Ind Pane |
|
2363 topPoint = iDirectionIndRect.iTl; |
|
2364 bottomPoint = iDirectionIndRect.iBr; |
|
2365 |
|
2366 iLayout->SetAnchor( EAlfAnchorTopLeft, 9, |
|
2367 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2368 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2369 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
2370 iLayout->SetAnchor( EAlfAnchorBottomRight, 9, |
|
2371 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
2372 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
2373 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
2374 |
|
2375 } |
|
2376 |
|
2377 // ---------------------------------------------------------------------------- |
|
2378 // TimerCallBackFunction |
|
2379 // ---------------------------------------------------------------------------- |
|
2380 // |
|
2381 TInt TimerCallBackFunction(TAny* aPtr) |
|
2382 { |
|
2383 CHtkNavigationControl* ptr = static_cast<CHtkNavigationControl*>(aPtr); |
|
2384 if( ptr ) |
|
2385 { |
|
2386 if( ptr->HasArrivedDestination() ) |
|
2387 { |
|
2388 TRAP_IGNORE(ptr->ChangeFlagVisualImageL()); |
|
2389 ptr->iTimerComplete = ETrue; |
|
2390 } |
|
2391 } |
|
2392 return 0; |
|
2393 } |
|
2394 |
|
2395 // ---------------------------------------------------------------------------- |
|
2396 // CHtkNavigationControl::CreateSignalTexturesL |
|
2397 // ---------------------------------------------------------------------------- |
|
2398 // |
|
2399 void CHtkNavigationControl::CreateSignalTexturesL( ) |
|
2400 { |
|
2401 MAlfBitmapProvider* provider = NULL; |
|
2402 // then create the bitmap provider |
|
2403 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal01, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2404 iView.ImagePathName(), // mif file name with path. |
|
2405 EMbmBlidQgn_graf_blid_sat_signal_01, // bitmap id defiened in mbg file |
|
2406 EMbmBlidQgn_graf_blid_sat_signal_01_mask ); // bitmap mask id defiened in mbg file |
|
2407 |
|
2408 |
|
2409 // now using that bitmap provider create the texture. |
|
2410 CAlfTexture & thumbTexture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2411 provider, |
|
2412 EAlfTextureFlagDefault ); |
|
2413 iSignalTextures.Append( &thumbTexture1 );// At 0 |
|
2414 |
|
2415 |
|
2416 // then create the bitmap provider |
|
2417 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal02, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2418 iView.ImagePathName(), // mif file name with path. |
|
2419 EMbmBlidQgn_graf_blid_sat_signal_02, // bitmap id defiened in mbg file |
|
2420 EMbmBlidQgn_graf_blid_sat_signal_02_mask ); // bitmap mask id defiened in mbg file |
|
2421 |
|
2422 |
|
2423 // now using that bitmap provider create the texture. |
|
2424 CAlfTexture & thumbTexture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2425 provider, |
|
2426 EAlfTextureFlagDefault ); |
|
2427 |
|
2428 iSignalTextures.Append( &thumbTexture2 );// At 1 |
|
2429 // then create the bitmap provider |
|
2430 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal03, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2431 iView.ImagePathName(), // mif file name with path. |
|
2432 EMbmBlidQgn_graf_blid_sat_signal_03, // bitmap id defiened in mbg file |
|
2433 EMbmBlidQgn_graf_blid_sat_signal_03_mask ); // bitmap mask id defiened in mbg file |
|
2434 |
|
2435 |
|
2436 // now using that bitmap provider create the texture. |
|
2437 CAlfTexture & thumbTexture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2438 provider, |
|
2439 EAlfTextureFlagDefault ); |
|
2440 |
|
2441 iSignalTextures.Append( &thumbTexture3 );// At 2 |
|
2442 |
|
2443 // then create the bitmap provider |
|
2444 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal04, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2445 iView.ImagePathName(), // mif file name with path. |
|
2446 EMbmBlidQgn_graf_blid_sat_signal_04, // bitmap id defiened in mbg file |
|
2447 EMbmBlidQgn_graf_blid_sat_signal_04_mask ); // bitmap mask id defiened in mbg file |
|
2448 |
|
2449 |
|
2450 // now using that bitmap provider create the texture. |
|
2451 CAlfTexture & thumbTexture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2452 provider, |
|
2453 EAlfTextureFlagDefault ); |
|
2454 |
|
2455 iSignalTextures.Append( &thumbTexture4 );// At 3 |
|
2456 |
|
2457 // then create the bitmap provider |
|
2458 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSatSignal05, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2459 iView.ImagePathName(), // mif file name with path. |
|
2460 EMbmBlidQgn_graf_blid_sat_signal_05, // bitmap id defiened in mbg file |
|
2461 EMbmBlidQgn_graf_blid_sat_signal_05_mask ); // bitmap mask id defiened in mbg file |
|
2462 |
|
2463 |
|
2464 // now using that bitmap provider create the texture. |
|
2465 CAlfTexture & thumbTexture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2466 provider, |
|
2467 EAlfTextureFlagDefault ); |
|
2468 |
|
2469 iSignalTextures.Append( &thumbTexture5 );// At 4 |
|
2470 } |
|
2471 |
|
2472 // ---------------------------------------------------------------------------- |
|
2473 // CHtkNavigationControl::CreatePopupImgTextureL |
|
2474 // ---------------------------------------------------------------------------- |
|
2475 // |
|
2476 void CHtkNavigationControl::CreatePopupImgTextureL( ) |
|
2477 { |
|
2478 MAlfBitmapProvider* provider = NULL; |
|
2479 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidUnavail, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2480 iView.ImagePathName(), // mif file name with path. |
|
2481 EMbmBlidQgn_graf_blid_unavail, // bitmap id defiened in mbg file |
|
2482 EMbmBlidQgn_graf_blid_unavail_mask ); // bitmap mask id defiened in mbg file |
|
2483 |
|
2484 // now using that bitmap provider create the texture. |
|
2485 CAlfTexture & thumbTexture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2486 provider, |
|
2487 EAlfTextureFlagDefault ); |
|
2488 |
|
2489 iPopupImgTexture = &thumbTexture; |
|
2490 } |
|
2491 |
|
2492 // ---------------------------------------------------------------------------- |
|
2493 // CHtkNavigationControl::CreateAccTextureL |
|
2494 // ---------------------------------------------------------------------------- |
|
2495 // |
|
2496 void CHtkNavigationControl::CreateAccTextureL( ) |
|
2497 { |
|
2498 MAlfBitmapProvider* provider = NULL; |
|
2499 |
|
2500 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidDetCircle, // svg icon skin constant id defiened in Aknsconstant.h file |
|
2501 iView.ImagePathName(), // mif file name with path. |
|
2502 EMbmBlidQgn_graf_blid_det_circle, // bitmap id defiened in mbg file |
|
2503 EMbmBlidQgn_graf_blid_det_circle_mask ); // bitmap mask id defiened in mbg file |
|
2504 // now using that bitmap provider create the texture. |
|
2505 CAlfTexture & thumbTexture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
2506 provider, |
|
2507 EAlfTextureFlagDefault ); |
|
2508 |
|
2509 iAccTexture = &thumbTexture; |
|
2510 } |
|
2511 |
|
2512 // ---------------------------------------------------------------------------- |
|
2513 // CHtkNavigationControl::LaunchStylusPopupMenuL |
|
2514 // ---------------------------------------------------------------------------- |
|
2515 // |
|
2516 void CHtkNavigationControl::LaunchStylusPopupMenuL( TPointerEvent aPointerEvent ) |
|
2517 { |
|
2518 if( !iMenu ) |
|
2519 { |
|
2520 iMenu = CAknStylusPopUpMenu::NewL( &iView, aPointerEvent.iParentPosition, NULL ); |
|
2521 TInt resourceReaderId = R_BLID_DESTINATION_STYLUS_MENU; |
|
2522 TResourceReader reader; |
|
2523 CCoeEnv* env = iView.CoeEnv(); |
|
2524 env->CreateResourceReaderLC( reader , resourceReaderId ); |
|
2525 iMenu->ConstructFromResourceL( reader ); |
|
2526 CleanupStack::PopAndDestroy(); // reader |
|
2527 } |
|
2528 |
|
2529 if(iView.IsLmFeatureAvailable()) |
|
2530 { |
|
2531 iMenu->SetItemDimmed(EBlidCmdWaypoint,ETrue); |
|
2532 if(!iIsDestinationSet) |
|
2533 { |
|
2534 iMenu->SetItemDimmed(EBlidCmdStopNavigation,ETrue); |
|
2535 if(!iView.IsLmAvailableL()) |
|
2536 { |
|
2537 iMenu->SetItemDimmed(EBlidCmdLmk,ETrue); |
|
2538 } |
|
2539 else |
|
2540 { |
|
2541 iMenu->SetItemDimmed(EBlidCmdLmk,EFalse); |
|
2542 } |
|
2543 } |
|
2544 else |
|
2545 { |
|
2546 iMenu->SetItemDimmed(EBlidCmdStopNavigation,EFalse); |
|
2547 if(!iView.IsLmAvailableL()) |
|
2548 { |
|
2549 iMenu->SetItemDimmed(EBlidCmdLmk,ETrue); |
|
2550 } |
|
2551 else |
|
2552 { |
|
2553 iMenu->SetItemDimmed(EBlidCmdLmk,EFalse); |
|
2554 } |
|
2555 } |
|
2556 } |
|
2557 else |
|
2558 { |
|
2559 iMenu->SetItemDimmed(EBlidCmdLmk,ETrue); |
|
2560 if(!iIsDestinationSet) |
|
2561 { |
|
2562 iMenu->SetItemDimmed(EBlidCmdStopNavigation,ETrue); |
|
2563 if(!iView.IsWpAvailable()) |
|
2564 { |
|
2565 iMenu->SetItemDimmed(EBlidCmdWaypoint,ETrue); |
|
2566 } |
|
2567 else |
|
2568 { |
|
2569 iMenu->SetItemDimmed(EBlidCmdWaypoint,EFalse); |
|
2570 } |
|
2571 } |
|
2572 else |
|
2573 { |
|
2574 iMenu->SetItemDimmed(EBlidCmdStopNavigation,EFalse); |
|
2575 if(!iView.IsWpAvailable()) |
|
2576 { |
|
2577 iMenu->SetItemDimmed(EBlidCmdWaypoint,ETrue); |
|
2578 } |
|
2579 else |
|
2580 { |
|
2581 iMenu->SetItemDimmed(EBlidCmdWaypoint,EFalse); |
|
2582 } |
|
2583 } |
|
2584 } |
|
2585 iMenu->SetPosition( aPointerEvent.iPosition ); |
|
2586 iMenu->ShowMenu(); |
|
2587 } |
|
2588 |
|
2589 //End of File |