1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Provides blid startup view class methods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // SYSTEM INCLUDES |
|
21 #include <StringLoader.h> |
|
22 #include <Blid.rsg> |
|
23 #include <blid.mbg> |
|
24 #include <akntitle.h> |
|
25 #include <aknnavide.h> |
|
26 #include <eikspane.h> |
|
27 #include <aknlayoutscalable_apps.cdl.h> |
|
28 #include <layoutmetadata.cdl.h> |
|
29 #include <AknUtils.h> |
|
30 #include <AknsConstants.h> |
|
31 |
|
32 #include <alf/alfenv.h> |
|
33 #include <alf/alfanchorlayout.h> |
|
34 #include <alf/alftextvisual.h> |
|
35 #include <alf/alftextstyle.h> |
|
36 #include <alf/alfborderbrush.h> |
|
37 #include <alf/alfbrusharray.h> |
|
38 #include <alf/alfevent.h> |
|
39 #include <alf/alftransformation.h> |
|
40 #include <alf/alftexture.h> |
|
41 #include <alf/alfdecklayout.h> |
|
42 #include <alf/alfutil.h> |
|
43 #include <alf/alfimagevisual.h> |
|
44 #include <alf/alftexture.h> |
|
45 #include <alf/alfimageloaderutil.h> |
|
46 #include <alf/alfflowlayout.h> |
|
47 |
|
48 // USER INCLUDES |
|
49 #include "CBlidSatelliteControl.h" |
|
50 #include "CBlidEng.h" |
|
51 #include "CBlidDocument.h" |
|
52 #include "MBlidLocation.h" |
|
53 #include "CBlidBaseView.h" |
|
54 #include "bliduiconsts.h" |
|
55 #include "Debug.h" |
|
56 |
|
57 TInt TimerCallBack(TAny* aPtr); |
|
58 |
|
59 // ================= MEMBER FUNCTIONS ======================= |
|
60 // --------------------------------------------------------- |
|
61 // CBlidSatelliteControl::NewL() |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 CBlidSatelliteControl* CBlidSatelliteControl::NewL( CAlfEnv& aEnv, |
|
65 const TRect& aRect, |
|
66 CBlidBaseView& aView) |
|
67 { |
|
68 CBlidSatelliteControl* self = new (ELeave) CBlidSatelliteControl(aEnv, |
|
69 aView ); |
|
70 CleanupStack::PushL(self); |
|
71 self->ConstructL( aRect ); |
|
72 CleanupStack::Pop(self); |
|
73 return self; |
|
74 } |
|
75 |
|
76 |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 //CBlidSatelliteControl::CBlidSatelliteControl() |
|
80 // --------------------------------------------------------- |
|
81 // |
|
82 CBlidSatelliteControl::CBlidSatelliteControl(CAlfEnv& aEnv, |
|
83 CBlidBaseView& aView ) |
|
84 : CAlfControl( ),iEnv(aEnv),iView(aView) |
|
85 { |
|
86 iOnlineMode = EFalse; |
|
87 } |
|
88 |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // CBlidSatelliteControl::ConstructL() |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 void CBlidSatelliteControl::ConstructL( const TRect& /*aRect*/ ) |
|
95 { |
|
96 CAlfControl::ConstructL( iEnv ); |
|
97 |
|
98 CBlidEng* engine = iView.BlidDocument()->Engine(); |
|
99 iLocation = engine->LocationModel(); |
|
100 |
|
101 iImagePath = HBufC::NewL( iEnv.TextureManager().ImagePath().Length() + 1 ); |
|
102 iImagePath->Des().Copy( iEnv.TextureManager().ImagePath() ); |
|
103 |
|
104 iAvailableNoteText = StringLoader::LoadL( R_BLID_NOTE_GPS_POSITIONING_AVAILABLE, CEikonEnv::Static() ); |
|
105 iSearchNoteText = StringLoader::LoadL( R_BLID_WAITNOTE_SEARCHING_GPS_SATELLITES, CEikonEnv::Static() ); |
|
106 |
|
107 iMainAnchorLayout = CAlfAnchorLayout::AddNewL( *this ); |
|
108 |
|
109 iGlobeDeckLayout = CAlfDeckLayout::AddNewL( *this, iMainAnchorLayout ); |
|
110 iAnimationVisual = CAlfImageVisual::AddNewL(*this, iGlobeDeckLayout ); |
|
111 |
|
112 iDisplayIcon = 1; |
|
113 iPeriodic = CPeriodic::NewL(0); // neutral priority |
|
114 iPeriodic->Start( TTimeIntervalMicroSeconds32( 200000 ), |
|
115 TTimeIntervalMicroSeconds32( 200000 ), |
|
116 TCallBack(Tick, this)); |
|
117 |
|
118 CalculateRects(); |
|
119 SetAnchors(); |
|
120 CreateGlobeVisualL(); |
|
121 UpdateGlobeVisual(); |
|
122 CreateSatelliteSignalVisualsL(); |
|
123 |
|
124 } |
|
125 |
|
126 // ---------------------------------------------------- |
|
127 // CBlidSatelliteControl::~CBlidSatelliteControl |
|
128 // Destructor |
|
129 // Frees reserved resources |
|
130 // ---------------------------------------------------- |
|
131 // |
|
132 CBlidSatelliteControl::~CBlidSatelliteControl() |
|
133 { |
|
134 iTextures.Reset(); |
|
135 iTextures.Close(); |
|
136 delete iNavimessage; |
|
137 delete iImagePath; |
|
138 delete iSearchNoteText; |
|
139 delete iAvailableNoteText; |
|
140 iSignalBarRects.Reset(); |
|
141 iSignalBarRects.Close(); |
|
142 iSatelliteNumberRects.Reset(); |
|
143 iSatelliteNumberRects.Close(); |
|
144 delete iPeriodic; |
|
145 delete iTimer; |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------- |
|
149 // CBlidSatelliteControl::Tick() |
|
150 // --------------------------------------------------------- |
|
151 // |
|
152 TInt CBlidSatelliteControl::Tick(TAny* aObject) |
|
153 { |
|
154 ((CBlidSatelliteControl*)aObject)->UpdateGlobeVisual(); // cast, and call non-static function |
|
155 |
|
156 return KErrNone; |
|
157 } |
|
158 |
|
159 |
|
160 // --------------------------------------------------------- |
|
161 // CBlidSatelliteControl::UpdateL |
|
162 // --------------------------------------------------------- |
|
163 // |
|
164 void CBlidSatelliteControl::UpdateL() |
|
165 { |
|
166 TInt satInView = iLocation->NumberOfSatellitesVisible(); |
|
167 TInt satId = 0; |
|
168 DEBUG1(" CBlidSatelliteControl::UpdateL iErrorCode ::%d", iErrorCode ); |
|
169 if( iOnlineMode ) |
|
170 { |
|
171 CreateNaviPaneL( *iAvailableNoteText ); |
|
172 // code for GPS fix received view |
|
173 for( TInt i = 0; i < satInView; i++ ) |
|
174 { |
|
175 satId = iLocation->GetSatelliteNo( i ); |
|
176 TBuf<5> satNumber; |
|
177 satNumber.Format(_L("%d"), satId); |
|
178 |
|
179 if( i < 16 ) |
|
180 { |
|
181 DisplaySatellitesRowL( satNumber, iSignalStrengthRowOne[i], iSatNoRowOne[i], i ); |
|
182 // Dimmed those satellites which are not used. |
|
183 if( !iLocation->IsSatellitesUsed( i ) ) |
|
184 { |
|
185 iSignalStrengthRowOne[i]->SetOpacity( 0.3 ); |
|
186 } |
|
187 else |
|
188 { |
|
189 iSignalStrengthRowOne[i]->SetOpacity( 1.0 ); |
|
190 } |
|
191 } |
|
192 |
|
193 } |
|
194 |
|
195 // Change soft key |
|
196 iView.CBAPtr()->SetCommandSetL( R_AVKON_SOFTKEYS_EXIT ); |
|
197 iView.CBAPtr()->DrawDeferred(); |
|
198 // Start the timer for 2 seconds |
|
199 if( iTimer ) |
|
200 { |
|
201 delete iTimer; |
|
202 iTimer = NULL; |
|
203 } |
|
204 iTimer = CPeriodic::NewL( EPriorityHigh ); |
|
205 if( iTimer ) |
|
206 { |
|
207 TCallBack callback( TimerCallBack, this ); |
|
208 iTimer->Start( TTimeIntervalMicroSeconds32( 2000000 ), |
|
209 TTimeIntervalMicroSeconds32( 80000000 ), |
|
210 callback ); |
|
211 } |
|
212 // once timer completed then activate navigation view |
|
213 } |
|
214 else if( iLocation->WaitingGPSData() || iErrorCode == KErrTimedOut ) |
|
215 { |
|
216 CreateNaviPaneL( *iSearchNoteText ); |
|
217 // code for searching GPS view |
|
218 for( TInt i = 0; i < satInView; i++ ) |
|
219 { |
|
220 satId = iLocation->GetSatelliteNo( i ); |
|
221 TBuf<5> satNumber; |
|
222 satNumber.Format(_L("%d"), satId); |
|
223 |
|
224 if( i < 16 ) |
|
225 { |
|
226 DisplaySatellitesRowL( satNumber, iSignalStrengthRowOne[i], iSatNoRowOne[i], i ); |
|
227 } |
|
228 } |
|
229 ChangeSoftKeyL(); |
|
230 } |
|
231 } |
|
232 |
|
233 // ---------------------------------------------------- |
|
234 // CBlidSatelliteControl::MakeTitleL |
|
235 // ---------------------------------------------------- |
|
236 // |
|
237 void CBlidSatelliteControl::MakeTitleL( TInt aResourceText ) |
|
238 { |
|
239 HBufC* buf = StringLoader::LoadLC(aResourceText); |
|
240 CAknTitlePane* title = static_cast<CAknTitlePane*>( StatusPane()-> |
|
241 ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
242 CleanupStack::Pop(); //buf |
|
243 title->SetText(buf); // Takes ownership of buf |
|
244 } |
|
245 |
|
246 // ---------------------------------------------------- |
|
247 // CBlidSatelliteControl::StatusPane |
|
248 // ---------------------------------------------------- |
|
249 // |
|
250 CEikStatusPane* CBlidSatelliteControl::StatusPane() |
|
251 { |
|
252 return CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
253 } |
|
254 |
|
255 // ---------------------------------------------------- |
|
256 // CBlidSatelliteControl::SetErrorCode |
|
257 // ---------------------------------------------------- |
|
258 // |
|
259 void CBlidSatelliteControl::SetErrorCode( TInt aErrorCode ) |
|
260 { |
|
261 iErrorCode = aErrorCode; |
|
262 } |
|
263 |
|
264 // ---------------------------------------------------- |
|
265 // CBlidSatelliteControl::SetOnlineMode |
|
266 // ---------------------------------------------------- |
|
267 // |
|
268 void CBlidSatelliteControl::SetOnlineMode( TBool aOnlineMode ) |
|
269 { |
|
270 iOnlineMode = aOnlineMode; |
|
271 } |
|
272 |
|
273 // ---------------------------------------------------- |
|
274 // CBlidSatelliteControl::CreateNaviPaneL |
|
275 // ---------------------------------------------------- |
|
276 // |
|
277 void CBlidSatelliteControl::CreateNaviPaneL( const TDesC& aText ) |
|
278 { |
|
279 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
280 // Fetch pointer to the default navi pane control |
|
281 CAknNavigationControlContainer* naviPane = |
|
282 static_cast<CAknNavigationControlContainer*>(sp->ControlL( |
|
283 TUid::Uid(EEikStatusPaneUidNavi))); |
|
284 |
|
285 naviPane->PushDefaultL(EFalse); |
|
286 if( iNavimessage ) |
|
287 { |
|
288 delete iNavimessage; |
|
289 iNavimessage = NULL; |
|
290 } |
|
291 iNavimessage = naviPane->CreateNavigationLabelL( aText ); |
|
292 naviPane->PushL( *iNavimessage ); |
|
293 } |
|
294 |
|
295 // ---------------------------------------------------- |
|
296 // CBlidSatelliteControl::CreateGlobeVisualL |
|
297 // ---------------------------------------------------- |
|
298 // |
|
299 void CBlidSatelliteControl::CreateGlobeVisualL( ) |
|
300 { |
|
301 // code to load svg icon |
|
302 MAlfBitmapProvider* provider = NULL; |
|
303 |
|
304 // first creste the image loader utils and then call SetSize. |
|
305 iView.ImageLoaderUtils()->SetSize( iGlobeRect.Size() ); |
|
306 |
|
307 // then create the bitmap provider |
|
308 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
309 iView.ImagePathName(), // mif file name with path. |
|
310 EMbmBlidQgn_graf_blid_searching_01, // bitmap id defiened in mbg file |
|
311 EMbmBlidQgn_graf_blid_searching_01_mask ); // bitmap mask id defiened in mbg file |
|
312 // now using that bitmap provider create the texture. |
|
313 CAlfTexture & texture1 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
314 provider, |
|
315 EAlfTextureFlagDefault ); |
|
316 iTextures.Append(&texture1); |
|
317 |
|
318 // then create the bitmap provider |
|
319 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
320 iView.ImagePathName(), // mif file name with path. |
|
321 EMbmBlidQgn_graf_blid_searching_02, // bitmap id defiened in mbg file |
|
322 EMbmBlidQgn_graf_blid_searching_02_mask ); // bitmap mask id defiened in mbg file |
|
323 // now using that bitmap provider create the texture. |
|
324 CAlfTexture & texture2 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
325 provider, |
|
326 EAlfTextureFlagDefault ); |
|
327 iTextures.Append(&texture2); |
|
328 |
|
329 // then create the bitmap provider |
|
330 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
331 iView.ImagePathName(), // mif file name with path. |
|
332 EMbmBlidQgn_graf_blid_searching_03, // bitmap id defiened in mbg file |
|
333 EMbmBlidQgn_graf_blid_searching_03_mask ); // bitmap mask id defiened in mbg file |
|
334 // now using that bitmap provider create the texture. |
|
335 CAlfTexture & texture3 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
336 provider, |
|
337 EAlfTextureFlagDefault ); |
|
338 iTextures.Append(&texture3); |
|
339 |
|
340 // then create the bitmap provider |
|
341 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
342 iView.ImagePathName(), // mif file name with path. |
|
343 EMbmBlidQgn_graf_blid_searching_04, // bitmap id defiened in mbg file |
|
344 EMbmBlidQgn_graf_blid_searching_04_mask ); // bitmap mask id defiened in mbg file |
|
345 // now using that bitmap provider create the texture. |
|
346 CAlfTexture & texture4 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
347 provider, |
|
348 EAlfTextureFlagDefault ); |
|
349 iTextures.Append(&texture4); |
|
350 |
|
351 // then create the bitmap provider |
|
352 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
353 iView.ImagePathName(), // mif file name with path. |
|
354 EMbmBlidQgn_graf_blid_searching_05, // bitmap id defiened in mbg file |
|
355 EMbmBlidQgn_graf_blid_searching_05_mask ); // bitmap mask id defiened in mbg file |
|
356 // now using that bitmap provider create the texture. |
|
357 CAlfTexture & texture5 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
358 provider, |
|
359 EAlfTextureFlagDefault ); |
|
360 iTextures.Append(&texture5); |
|
361 |
|
362 // then create the bitmap provider |
|
363 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
364 iView.ImagePathName(), // mif file name with path. |
|
365 EMbmBlidQgn_graf_blid_searching_06, // bitmap id defiened in mbg file |
|
366 EMbmBlidQgn_graf_blid_searching_06_mask ); // bitmap mask id defiened in mbg file |
|
367 // now using that bitmap provider create the texture. |
|
368 CAlfTexture & texture6 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
369 provider, |
|
370 EAlfTextureFlagDefault ); |
|
371 iTextures.Append(&texture6); |
|
372 |
|
373 // then create the bitmap provider |
|
374 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
375 iView.ImagePathName(), // mif file name with path. |
|
376 EMbmBlidQgn_graf_blid_searching_07, // bitmap id defiened in mbg file |
|
377 EMbmBlidQgn_graf_blid_searching_07_mask ); // bitmap mask id defiened in mbg file |
|
378 // now using that bitmap provider create the texture. |
|
379 CAlfTexture & texture7 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
380 provider, |
|
381 EAlfTextureFlagDefault ); |
|
382 iTextures.Append(&texture7); |
|
383 |
|
384 // then create the bitmap provider |
|
385 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSearching, // svg icon skin constant id defiened in Aknsconstant.h file |
|
386 iView.ImagePathName(), // mif file name with path. |
|
387 EMbmBlidQgn_graf_blid_searching_08, // bitmap id defiened in mbg file |
|
388 EMbmBlidQgn_graf_blid_searching_08_mask ); // bitmap mask id defiened in mbg file |
|
389 // now using that bitmap provider create the texture. |
|
390 CAlfTexture & texture8 = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, |
|
391 provider, |
|
392 EAlfTextureFlagDefault ); |
|
393 iTextures.Append(&texture8); |
|
394 } |
|
395 |
|
396 // ---------------------------------------------------- |
|
397 // CBlidSatelliteControl::UpdateGlobeVisual |
|
398 // ---------------------------------------------------- |
|
399 // |
|
400 void CBlidSatelliteControl::UpdateGlobeVisual( ) |
|
401 { |
|
402 if(KNumOfStartUpIcon > iDisplayIcon) |
|
403 { |
|
404 iDisplayIcon++; |
|
405 } |
|
406 else |
|
407 { |
|
408 iDisplayIcon = 1; |
|
409 } |
|
410 //iAnimationVisual->SetSize( animationRect.Size() ); |
|
411 iAnimationVisual->SetImage( TAlfImage( *iTextures[iDisplayIcon-1] ) );//N |
|
412 } |
|
413 |
|
414 // ---------------------------------------------------- |
|
415 // CBlidSatelliteControl::CreateSatelliteSignalVisualsL |
|
416 // ---------------------------------------------------- |
|
417 // |
|
418 void CBlidSatelliteControl::CreateSatelliteSignalVisualsL( ) |
|
419 { |
|
420 TInt typefaceStyleId = iEnv.TextStyleManager().CreatePlatformTextStyleL(EAknLogicalFontPrimarySmallFont, EAlfTextStyleSmall); |
|
421 CAlfTextStyle* style1 = iEnv.TextStyleManager().TextStyle( typefaceStyleId ); |
|
422 style1->SetBold( ETrue ); |
|
423 // Set the text font size in pixel |
|
424 style1->SetTextPaneHeightInPixels( 26, ETrue ); |
|
425 |
|
426 TRgb rgb; |
|
427 AknsUtils::GetCachedColor ( AknsUtils::SkinInstance(), |
|
428 rgb, |
|
429 KAknsIIDQsnTextColors, |
|
430 EAknsCIQsnTextColorsCG1 |
|
431 ); |
|
432 |
|
433 CreateSignalLayoutL( style1, rgb ); |
|
434 } |
|
435 |
|
436 // ---------------------------------------------------- |
|
437 // CBlidSatelliteControl::CreateSignalLayoutL |
|
438 // ---------------------------------------------------- |
|
439 // |
|
440 void CBlidSatelliteControl::CreateSignalLayoutL( CAlfTextStyle* aStyle, TRgb aRgb ) |
|
441 { |
|
442 for( TInt i = 0; i < 16; i++ ) |
|
443 { |
|
444 iSignalStrengthRowOne[i] = CAlfImageVisual::AddNewL( *this, iMainAnchorLayout ); |
|
445 |
|
446 iSatNoRowOne[i] = CAlfTextVisual::AddNewL( *this, iMainAnchorLayout ); |
|
447 iSatNoRowOne[i]->SetColor( aRgb ); |
|
448 iSatNoRowOne[i]->SetTextStyle( aStyle->Id() ); |
|
449 iSatNoRowOne[i]->SetAlign( EAlfAlignHCenter, EAlfAlignVCenter ); |
|
450 } |
|
451 } |
|
452 |
|
453 // --------------------------------------------------------- |
|
454 // CBlidSatelliteControl::DisplaySatellitesRowL |
|
455 // --------------------------------------------------------- |
|
456 // |
|
457 void CBlidSatelliteControl::DisplaySatellitesRowL( const TDesC& aSatNo, |
|
458 CAlfImageVisual* aImageVisual, |
|
459 CAlfTextVisual* aTextVisual, |
|
460 TInt aIndex ) |
|
461 { |
|
462 // code to load svg icon |
|
463 MAlfBitmapProvider* provider = NULL; |
|
464 // first creste the image loader utils and then call SetSize. |
|
465 iView.ImageLoaderUtils()->SetSize( iSignalBarRects[0].Size() ); |
|
466 |
|
467 aTextVisual->SetTextL( aSatNo ); |
|
468 |
|
469 switch( iLocation->GetSatelliteSignalStrength( aIndex ) ) |
|
470 { |
|
471 case EBlidSignalStrengthZero: |
|
472 { |
|
473 |
|
474 // then create the bitmap provider |
|
475 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSignalBar01, // svg icon skin constant id defiened in Aknsconstant.h file |
|
476 iView.ImagePathName(), // mif file name with path. |
|
477 EMbmBlidQgn_graf_blid_signal_bar_01, // bitmap id defiened in mbg file |
|
478 EMbmBlidQgn_graf_blid_signal_bar_01_mask ); // bitmap mask id defiened in mbg file |
|
479 |
|
480 |
|
481 // now using that bitmap provider create the texture. |
|
482 CAlfTexture & texture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault ); |
|
483 |
|
484 aImageVisual->SetImage(TAlfImage(texture)); |
|
485 break; |
|
486 } |
|
487 case EBlidSignalStrengthOne: |
|
488 { |
|
489 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSignalBar02, // svg icon skin constant id defiened in Aknsconstant.h file |
|
490 iView.ImagePathName(), // mif file name with path. |
|
491 EMbmBlidQgn_graf_blid_signal_bar_02, // bitmap id defiened in mbg file |
|
492 EMbmBlidQgn_graf_blid_signal_bar_02_mask ); // bitmap mask id defiened in mbg file |
|
493 |
|
494 |
|
495 // now using that bitmap provider create the texture. |
|
496 CAlfTexture & texture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault ); |
|
497 |
|
498 aImageVisual->SetImage(TAlfImage(texture)); |
|
499 break; |
|
500 } |
|
501 case EBlidSignalStrengthTwo: |
|
502 { |
|
503 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSignalBar03, // svg icon skin constant id defiened in Aknsconstant.h file |
|
504 iView.ImagePathName(), // mif file name with path. |
|
505 EMbmBlidQgn_graf_blid_signal_bar_03, // bitmap id defiened in mbg file |
|
506 EMbmBlidQgn_graf_blid_signal_bar_03_mask ); // bitmap mask id defiened in mbg file |
|
507 |
|
508 |
|
509 // now using that bitmap provider create the texture. |
|
510 CAlfTexture & texture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault ); |
|
511 |
|
512 aImageVisual->SetImage(TAlfImage(texture)); |
|
513 break; |
|
514 } |
|
515 case EBlidSignalStrengthThree: |
|
516 { |
|
517 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSignalBar04, // svg icon skin constant id defiened in Aknsconstant.h file |
|
518 iView.ImagePathName(), // mif file name with path. |
|
519 EMbmBlidQgn_graf_blid_signal_bar_04, // bitmap id defiened in mbg file |
|
520 EMbmBlidQgn_graf_blid_signal_bar_04_mask ); // bitmap mask id defiened in mbg file |
|
521 |
|
522 |
|
523 // now using that bitmap provider create the texture. |
|
524 CAlfTexture & texture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault ); |
|
525 |
|
526 aImageVisual->SetImage(TAlfImage(texture)); |
|
527 break; |
|
528 } |
|
529 case EBlidSignalStrengthFour: |
|
530 { |
|
531 provider = iView.ImageLoaderUtils()->CreateImageLoaderL( KAknsIIDQgnGrafBlidSignalBar05, // svg icon skin constant id defiened in Aknsconstant.h file |
|
532 iView.ImagePathName(), // mif file name with path. |
|
533 EMbmBlidQgn_graf_blid_signal_bar_05, // bitmap id defiened in mbg file |
|
534 EMbmBlidQgn_graf_blid_signal_bar_05_mask ); // bitmap mask id defiened in mbg file |
|
535 |
|
536 |
|
537 // now using that bitmap provider create the texture. |
|
538 CAlfTexture & texture = iEnv.TextureManager().CreateTextureL( KAlfAutoGeneratedTextureId, provider, EAlfTextureFlagDefault ); |
|
539 |
|
540 aImageVisual->SetImage(TAlfImage(texture)); |
|
541 break; |
|
542 } |
|
543 default: |
|
544 { |
|
545 break; |
|
546 } |
|
547 } |
|
548 } |
|
549 |
|
550 // ---------------------------------------------------- |
|
551 // CBlidSatelliteControl::ChangeNavigationViewL |
|
552 // ---------------------------------------------------- |
|
553 // |
|
554 void CBlidSatelliteControl::ChangeNavigationViewL() |
|
555 { |
|
556 iView.ActivateNavigationViewL(); |
|
557 //delete the timer if present |
|
558 delete iTimer; |
|
559 iTimer = NULL; |
|
560 } |
|
561 |
|
562 // ---------------------------------------------------- |
|
563 // CBlidSatelliteControl::ChangeSoftKeyL |
|
564 // ---------------------------------------------------- |
|
565 // |
|
566 void CBlidSatelliteControl::ChangeSoftKeyL() |
|
567 { |
|
568 iView.ChangeViewSoftKeyL(); |
|
569 } |
|
570 |
|
571 // ---------------------------------------------------- |
|
572 // CBlidSatelliteControl::UpdateDisplayLayoutL |
|
573 // ---------------------------------------------------- |
|
574 // |
|
575 void CBlidSatelliteControl::UpdateDisplayLayoutL( ) |
|
576 { |
|
577 CalculateRects(); |
|
578 SetAnchors(); |
|
579 } |
|
580 |
|
581 // ---------------------------------------------------- |
|
582 // CBlidSatelliteControl::CalculateRects |
|
583 // ---------------------------------------------------- |
|
584 // |
|
585 void CBlidSatelliteControl::CalculateRects() |
|
586 { |
|
587 TAknLayoutRect mainBlid2Pane; |
|
588 TAknLayoutRect layoutWindow; |
|
589 TRect mainRect; |
|
590 TRect animationRect; |
|
591 TInt variety; |
|
592 |
|
593 if( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
594 { |
|
595 variety = 1; |
|
596 } |
|
597 else |
|
598 { |
|
599 variety = 0; |
|
600 } |
|
601 |
|
602 /////////////// calculate animation rect ///////////////////////// |
|
603 mainBlid2Pane.LayoutRect( iView.ApplicationRect(), |
|
604 AknLayoutScalable_Apps::main_blid2_pane().LayoutLine() ); |
|
605 |
|
606 mainRect = mainBlid2Pane.Rect(); |
|
607 |
|
608 mainBlid2Pane.LayoutRect( mainRect, |
|
609 AknLayoutScalable_Apps::blid2_gps_pane( 0 ).LayoutLine() ); |
|
610 |
|
611 animationRect = mainBlid2Pane.Rect(); |
|
612 |
|
613 mainBlid2Pane.LayoutRect( animationRect, |
|
614 AknLayoutScalable_Apps::blid2_gps_pane_g1( variety ).LayoutLine() ); |
|
615 |
|
616 iGlobeRect = mainBlid2Pane.Rect(); |
|
617 |
|
618 /////////////// calculate satellite grid rect ///////////////////////// |
|
619 mainBlid2Pane.LayoutRect( animationRect, |
|
620 AknLayoutScalable_Apps::grid_blid2_satellite_pane( variety ).LayoutLine() ); |
|
621 |
|
622 iSatGridRect = mainBlid2Pane.Rect(); |
|
623 |
|
624 /////////////// calculate cell rects ///////////////////////// |
|
625 TAknLayoutScalableParameterLimits paramLimits; |
|
626 paramLimits = AknLayoutScalable_Apps::cell_blid2_satellite_pane_ParamLimits(); |
|
627 |
|
628 TInt numberOfRows = paramLimits.LastRow() - paramLimits.FirstRow() + 1; |
|
629 TInt numberOfColumns = paramLimits.LastColumn() - paramLimits.FirstColumn() + 1; |
|
630 iSignalBarRects.Reset(); |
|
631 iSatelliteNumberRects.Reset(); |
|
632 for( TInt row = paramLimits.FirstRow() ; row <= paramLimits.LastRow(); ++row ) |
|
633 { |
|
634 for( TInt column = paramLimits.FirstColumn() ; column <= paramLimits.LastColumn(); ++column ) |
|
635 { |
|
636 layoutWindow.LayoutRect( iSatGridRect, AknLayoutScalable_Apps::cell_blid2_satellite_pane(0, column, row).LayoutLine() ); |
|
637 TRect cellRect = layoutWindow.Rect(); |
|
638 |
|
639 layoutWindow.LayoutRect( cellRect, AknLayoutScalable_Apps::cell_blid2_satellite_pane_g1(0).LayoutLine()); |
|
640 TRect barRect = layoutWindow.Rect(); |
|
641 iSignalBarRects.Append(barRect); |
|
642 |
|
643 // Save the layouts of the satellite numbers |
|
644 TAknLayoutText satNumberLayout; |
|
645 satNumberLayout.LayoutText(cellRect, AknLayoutScalable_Apps::cell_blid2_satellite_pane_t1(0).LayoutLine()); |
|
646 iSatelliteNumberRects.Append(satNumberLayout.TextRect()); |
|
647 } |
|
648 } |
|
649 } |
|
650 |
|
651 // ---------------------------------------------------- |
|
652 // CBlidSatelliteControl::SetAnchors |
|
653 // ---------------------------------------------------- |
|
654 // |
|
655 void CBlidSatelliteControl::SetAnchors() |
|
656 { |
|
657 // Anchor for Globe Animation |
|
658 TAlfRealPoint topAnimationPoint( iGlobeRect.iTl ); |
|
659 TAlfRealPoint bottomAnimationPoint( iGlobeRect.iBr ); |
|
660 |
|
661 iMainAnchorLayout->SetAnchor( EAlfAnchorTopLeft, 0, |
|
662 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
663 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
664 TAlfTimedPoint( topAnimationPoint.iX, topAnimationPoint.iY ) ); |
|
665 iMainAnchorLayout->SetAnchor( EAlfAnchorBottomRight, 0, |
|
666 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
667 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
668 TAlfTimedPoint( bottomAnimationPoint.iX, bottomAnimationPoint.iY ) ); |
|
669 |
|
670 // Set anchor for all signal strength images |
|
671 for( TInt i = 0; i < 16; i++ ) |
|
672 { |
|
673 TInt ordinal = i*2 + 1; |
|
674 |
|
675 TAlfRealPoint topPoint( iSignalBarRects[i].iTl ); |
|
676 TAlfRealPoint bottomPoint( iSignalBarRects[i].iBr ); |
|
677 |
|
678 iMainAnchorLayout->SetAnchor(EAlfAnchorTopLeft, ordinal, |
|
679 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
680 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
681 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
682 iMainAnchorLayout->SetAnchor(EAlfAnchorBottomRight, ordinal, |
|
683 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
684 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
685 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
686 } |
|
687 // Set anchor for Satellite number text |
|
688 for( TInt i = 0; i < 16; i++ ) |
|
689 { |
|
690 TInt ordinal = i*2 + 2; |
|
691 |
|
692 TAlfRealPoint topPoint( iSatelliteNumberRects[i].iTl ); |
|
693 TAlfRealPoint bottomPoint( iSatelliteNumberRects[i].iBr ); |
|
694 |
|
695 iMainAnchorLayout->SetAnchor(EAlfAnchorTopLeft, ordinal, |
|
696 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
697 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
698 TAlfTimedPoint( topPoint.iX, topPoint.iY ) ); |
|
699 iMainAnchorLayout->SetAnchor(EAlfAnchorBottomRight, ordinal, |
|
700 EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
701 EAlfAnchorMetricAbsolute, EAlfAnchorMetricAbsolute, |
|
702 TAlfTimedPoint( bottomPoint.iX, bottomPoint.iY ) ); |
|
703 } |
|
704 |
|
705 } |
|
706 |
|
707 // ---------------------------------------------------------------------------- |
|
708 // TimerCallBack |
|
709 // ---------------------------------------------------------------------------- |
|
710 // |
|
711 TInt TimerCallBack(TAny* aPtr) |
|
712 { |
|
713 CBlidSatelliteControl* ptr = static_cast<CBlidSatelliteControl*>(aPtr); |
|
714 if( ptr ) |
|
715 { |
|
716 // Activate navigation view |
|
717 TRAP_IGNORE( ptr->ChangeNavigationViewL() ); |
|
718 } |
|
719 return 0; |
|
720 } |
|
721 //End Of File |
|
722 |
|
723 |
|
724 |
|