1 /* |
|
2 * Copyright (c) 2008-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: Control for single station logo |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <alf/alfcommand.h> |
|
20 #include <alf/alfcontrolgroup.h> |
|
21 #include <alf/alfdecklayout.h> |
|
22 #include <alf/alfenv.h> |
|
23 #include <alf/alfimagevisual.h> |
|
24 #include <alf/alftexture.h> |
|
25 #include <alf/alftexturemanager.h> |
|
26 #include <alf/alftimedvalue.h> |
|
27 |
|
28 #include "irdebug.h" |
|
29 |
|
30 #include "irimageconverter.h" |
|
31 #include "irstationlogocontrolobserver.h" |
|
32 #include "irstationlogocontrol.h" |
|
33 #include "irstationlogodata.h" |
|
34 |
|
35 // Time in milliseconds to spend animating the displays moving in and out of the screen |
|
36 const TInt KVRLogoFadeTime = 400; |
|
37 const TInt KTwo=-2; |
|
38 // --------------------------------------------------------------------------- |
|
39 // Default constructor |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CIRStationLogoControl::CIRStationLogoControl() : iCurrentId( KErrNotFound ),iError(KErrNone) |
|
43 { |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // Second phase constructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 void CIRStationLogoControl::ConstructL( CAlfEnv& aAlfEnv, TInt aControlGroupId, |
|
51 CAlfLayout* aParentLayout ) |
|
52 { |
|
53 IRLOG_DEBUG(" *** S60VisualRadio -- CIRStationLogoControl::ConstructL()"); |
|
54 CAlfControl::ConstructL( aAlfEnv ); |
|
55 |
|
56 iDeck = CAlfDeckLayout::AddNewL( *this, aParentLayout ); |
|
57 iFadeOut=EFalse; |
|
58 iCurrentImageConverter = CIRImageConverter::NewL(); |
|
59 iCurrentImageConverter->SetObserver( this ); |
|
60 iVisualSize = DisplayArea().Size(); |
|
61 |
|
62 CAlfControlGroup& group = Env().ControlGroup( aControlGroupId ); |
|
63 group.AppendL( this ); // Transfers ownership |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // Two-phased constructor |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 CIRStationLogoControl* CIRStationLogoControl::NewL( CAlfEnv& aAlfEnv, |
|
71 TInt aControlGroupId, |
|
72 CAlfLayout* aParentLayout ) |
|
73 { |
|
74 CIRStationLogoControl* self = new( ELeave ) CIRStationLogoControl; |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL( aAlfEnv, aControlGroupId, aParentLayout ); |
|
77 CleanupStack::Pop( self ); |
|
78 return self; |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // Destructor |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 CIRStationLogoControl::~CIRStationLogoControl() |
|
86 { |
|
87 iLogoControlObserver = NULL; |
|
88 delete iCurrentImageConverter; |
|
89 |
|
90 for( TInt i = 0 ; i < iLogoData.Count() ; i++ ) |
|
91 { |
|
92 Env().CancelCustomCommands( iLogoData[i] ); |
|
93 } |
|
94 iLogoData.ResetAndDestroy(); |
|
95 iLogoData.Close(); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // Prepares the graphics for the logo that is to be displayed |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CIRStationLogoControl::PrepareLogoL( TInt aId ) |
|
103 { |
|
104 IRLOG_DEBUG2(" *** S60VisualRadio -- CIRStationLogoControl::PrepareLogoL(aId=%d)", aId); |
|
105 CIRStationLogoData* logoData = LogoDataForId( aId ); |
|
106 if( logoData && !logoData->Texture() ) |
|
107 { |
|
108 StartConversionL( *logoData ); |
|
109 } |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // Switches the logo that is to be displayed |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 TBool CIRStationLogoControl::SwitchToLogoL( TInt aId ) |
|
117 { |
|
118 IRLOG_DEBUG2(" CIRStationLogoControl::SwitchToLogoL(aId=%d)", aId); |
|
119 // No need to fade out or load new logo. |
|
120 if ( aId != KErrNotFound ) |
|
121 { |
|
122 PrepareLogoL( aId ); |
|
123 } |
|
124 |
|
125 CIRStationLogoData* previousLogoData = LogoDataForId( iCurrentId ); |
|
126 CIRStationLogoData* newData = LogoDataForId( aId ); |
|
127 |
|
128 // No need to fade out or load new logo. |
|
129 if ( aId == iCurrentId && previousLogoData && previousLogoData->Visual() ) |
|
130 { |
|
131 return ETrue; |
|
132 } |
|
133 // To Do |
|
134 // Fade the current logo out.Handled in View |
|
135 /*if ( previousLogoData && previousLogoData->Visual() ) |
|
136 { |
|
137 // Station logo. |
|
138 FadeOutCurrentLogo( *previousLogoData->Visual() ); |
|
139 }*/ |
|
140 if(iError!=KErrNone) |
|
141 { |
|
142 return EFalse; |
|
143 } |
|
144 TBool logoAdded = EFalse; |
|
145 iCurrentId = aId; |
|
146 if( newData ) |
|
147 { |
|
148 Env().CancelCustomCommands( newData, |
|
149 CIRStationLogoData::EIRCustomEventLogoFadeOutComplete ); |
|
150 if( !newData->Visual() ) |
|
151 { |
|
152 iDelayedFadeIn = EIRLogoNoDelay; |
|
153 |
|
154 CAlfImageVisual* visual = NULL; |
|
155 if( !newData->Visual() ) |
|
156 { |
|
157 visual = CAlfImageVisual::AddNewL( *this, iDeck ); |
|
158 visual->SetOpacity( TAlfTimedValue( 0.0f ) ); |
|
159 visual->SetScaleMode( CAlfImageVisual::EScaleFitInside ); |
|
160 newData->SetVisual( visual ); |
|
161 } |
|
162 else |
|
163 { |
|
164 visual = newData->Visual(); |
|
165 } |
|
166 |
|
167 if( newData->Texture() ) |
|
168 { |
|
169 visual->SetImage( TAlfImage( *newData->Texture() ) ); |
|
170 FadeInStationLogoL( *visual ); |
|
171 } |
|
172 else |
|
173 { |
|
174 if( newData != previousLogoData ) |
|
175 { |
|
176 iDelayedFadeIn = EIRDelayedTextureImage; |
|
177 } |
|
178 else |
|
179 { |
|
180 visual->SetOpacity( TAlfTimedValue( 1.0f ) ); |
|
181 } |
|
182 } |
|
183 } |
|
184 logoAdded = ETrue; |
|
185 } |
|
186 |
|
187 return logoAdded; |
|
188 } |
|
189 |
|
190 |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // Setter for logo data |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 void CIRStationLogoControl::SetLogosL( const RArray<TInt>& aIdArray , const CPtrC8Array& aRawData ) |
|
197 { |
|
198 IRLOG_DEBUG2(" *** S60VisualRadio -- CIRStationLogoControl::SetLogosL() -- %d items", aRawData.Count()); |
|
199 iFadeOut=EFalse; |
|
200 iError=KErrNone; |
|
201 DestroyPreviousLogosL(aIdArray, aRawData); |
|
202 iRet=0; |
|
203 iLogoDisplay=EFalse; |
|
204 } |
|
205 |
|
206 void CIRStationLogoControl::UpdateLogoL( TInt aId, const TDesC8& aRawData ) |
|
207 { |
|
208 IRLOG_DEBUG2(" *** S60VisualRadio -- CIRStationLogoControl::UpdateLogoL(aId=%d)", aId); |
|
209 TBool idFound = EFalse; |
|
210 for( TInt i = 0 ; i < iLogoData.Count() ; i++ ) |
|
211 { |
|
212 if( aId == iLogoData[i]->Id() ) |
|
213 { |
|
214 // Update existing logo |
|
215 if( aRawData == KNullDesC8 ) |
|
216 { |
|
217 delete iLogoData[i]; |
|
218 iLogoData.Remove( i ); |
|
219 } |
|
220 else |
|
221 { |
|
222 iLogoData[i]->SetRawData( aRawData ); |
|
223 } |
|
224 idFound = ETrue; |
|
225 i = iLogoData.Count(); |
|
226 } |
|
227 } |
|
228 if( !idFound && aRawData != KNullDesC8 ) |
|
229 { |
|
230 CIRStationLogoData* data = CIRStationLogoData::NewLC( aId, aRawData ); |
|
231 iLogoData.AppendL( data ); |
|
232 CleanupStack::Pop( data ); |
|
233 } |
|
234 CIRStationLogoData* logoData = LogoDataForId( iCurrentId ); |
|
235 if( logoData && logoData->Id() == aId ) |
|
236 { |
|
237 StartConversionL( *logoData ); |
|
238 } |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // Setter for logo fade style. |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 void CIRStationLogoControl::SetLogoFadeStyle( TIRFadeStyle aFadeStyle ) |
|
246 { |
|
247 iFadeStyle = aFadeStyle; |
|
248 } |
|
249 |
|
250 // --------------------------------------------------------------------------- |
|
251 // From class CAlfControl. |
|
252 // VisualLayoutUpdated |
|
253 // --------------------------------------------------------------------------- |
|
254 // |
|
255 void CIRStationLogoControl::VisualLayoutUpdated( CAlfVisual& /*aVisual*/ ) |
|
256 { |
|
257 IRLOG_DEBUG(" CIRStationLogoControl::VisualLayoutUpdated()"); |
|
258 |
|
259 // Start the converter for current logo for animation purposes |
|
260 CIRStationLogoData* logoData = LogoDataForId( iCurrentId ); |
|
261 if( logoData ) |
|
262 { |
|
263 TRAP_IGNORE( StartConversionL( *logoData ) ) |
|
264 } |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // CIRStationLogoControl::SetLogoControlObserver |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 void CIRStationLogoControl::SetLogoControlObserver( MIRLogoControlObserver& aObserver ) |
|
272 { |
|
273 IRLOG_DEBUG(" CIRStationLogoControl::SetLogoControlObserver()"); |
|
274 iLogoControlObserver = &aObserver; |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // From class MVRImageConverterObserver. |
|
279 // HandleImageConversionEventL |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 void CIRStationLogoControl::HandleImageConversionEventL( MIRImageConverterObserver:: |
|
283 TIRImageConversionEvent /*aEvent*/, |
|
284 TInt aId, |
|
285 TInt aError ) |
|
286 { |
|
287 IRLOG_DEBUG3(" *** S60VisualRadio -- CIRStationLogoControl::HandleImageConversionEventL(aId=%d, aError=%d)", aId, aError); |
|
288 iError=aError; |
|
289 if( aError == KErrNone ) |
|
290 { |
|
291 CFbsBitmap* bitmap = NULL; |
|
292 CFbsBitmap* mask = NULL; |
|
293 iCurrentImageConverter->TransferBitmapOwnership( bitmap, mask ); |
|
294 CIRStationLogoData* convertedLogoData = LogoDataForId( aId ); |
|
295 if( convertedLogoData ) |
|
296 { |
|
297 convertedLogoData->UpdateTextureL( bitmap, mask ); // transfers ownership |
|
298 } |
|
299 else |
|
300 { |
|
301 delete bitmap; |
|
302 delete mask ; |
|
303 } |
|
304 CIRStationLogoData* currentLogoData = LogoDataForId( iCurrentId ); |
|
305 if( currentLogoData && currentLogoData->Visual() && currentLogoData == convertedLogoData ) |
|
306 { |
|
307 // Logo is ready for display, check that everything is OK before displaying the logo. |
|
308 iLogoControlObserver->LogoReadyForDisplayL(); |
|
309 // Display the logo. |
|
310 currentLogoData->Visual()->SetImage( TAlfImage( *currentLogoData->Texture() ) ); |
|
311 if( iDelayedFadeIn == EIRDelayedTextureImage ) |
|
312 { |
|
313 FadeInStationLogoL( *currentLogoData->Visual() ); |
|
314 } |
|
315 } |
|
316 } |
|
317 else |
|
318 { |
|
319 iLogoControlObserver->LogoConversionFailedL(); |
|
320 } |
|
321 } |
|
322 |
|
323 // --------------------------------------------------------------------------- |
|
324 // Maps the logo ID to station logo data |
|
325 // --------------------------------------------------------------------------- |
|
326 // |
|
327 CIRStationLogoData* CIRStationLogoControl::LogoDataForId( TInt aId ) |
|
328 { |
|
329 CIRStationLogoData* logo = NULL; |
|
330 for( TInt i = 0 ; i < iLogoData.Count() ; i++ ) |
|
331 { |
|
332 if( iLogoData[i]->Id() == aId ) |
|
333 { |
|
334 logo = iLogoData[i]; |
|
335 i = iLogoData.Count(); |
|
336 } |
|
337 } |
|
338 return logo; |
|
339 } |
|
340 |
|
341 // --------------------------------------------------------------------------- |
|
342 // Starts the conversion for hte current logo |
|
343 // --------------------------------------------------------------------------- |
|
344 // |
|
345 void CIRStationLogoControl::StartConversionL( CIRStationLogoData& aLogoData ) |
|
346 { |
|
347 IRLOG_DEBUG(" *** S60VisualRadio -- CIRStationLogoControl::StartConversionL()"); |
|
348 if( iVisualSize.iWidth && iVisualSize.iHeight ) |
|
349 { |
|
350 iCurrentImageConverter->SetDataL( aLogoData.RawData() ); |
|
351 if(iError==KErrNone) |
|
352 { |
|
353 iCurrentImageConverter->StartL( iVisualSize, aLogoData.Id() ); |
|
354 } |
|
355 } |
|
356 } |
|
357 |
|
358 // --------------------------------------------------------------------------- |
|
359 // Fades the station logo in. |
|
360 // --------------------------------------------------------------------------- |
|
361 // |
|
362 void CIRStationLogoControl::FadeInStationLogoL( CAlfVisual& aVisual ) |
|
363 { |
|
364 IRLOG_DEBUG(" *** S60VisualRadio -- CIRStationLogoControl::FadeInCurrent()"); |
|
365 |
|
366 iDelayedFadeIn = EIRLogoNoDelay; |
|
367 |
|
368 // Get start point and fade time. |
|
369 TAlfTimedPoint point = FadeInStartPoint( aVisual ); |
|
370 TInt fadeTime = point.iX.TimeToTargetinMilliSeconds(); |
|
371 |
|
372 // Fade the logo in. |
|
373 TAlfTimedValue opacity( 0.0f ); |
|
374 opacity.SetStyle( EAlfTimedValueStyleDecelerate ); |
|
375 opacity.SetTarget( 1.0f, fadeTime ); |
|
376 |
|
377 aVisual.SetFlag( EAlfVisualFlagManualPosition ); |
|
378 aVisual.SetPos( point ); |
|
379 aVisual.SetOpacity( opacity ); |
|
380 |
|
381 return; |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------------------------- |
|
385 // Fades the current logo out. If logo is not the default logo, deletes it's |
|
386 // data after the fading (ansynchronously). |
|
387 // --------------------------------------------------------------------------- |
|
388 // |
|
389 void CIRStationLogoControl::FadeOutCurrentLogo( CAlfVisual& aVisual ) |
|
390 { |
|
391 IRLOG_DEBUG(" *** S60VisualRadio -- CIRStationLogoControl::FadeOutCurrentLogo"); |
|
392 |
|
393 CIRStationLogoData* logoData = LogoDataForId( iCurrentId ); |
|
394 |
|
395 // Get target point. |
|
396 TAlfTimedPoint point = FadeOutTargetPoint( aVisual ); |
|
397 TInt fadeTime = point.iX.TimeToTargetinMilliSeconds(); |
|
398 |
|
399 // Fade the logo out. |
|
400 TAlfTimedValue opacity( aVisual.Opacity().ValueNow() ); |
|
401 opacity.SetStyle( EAlfTimedValueStyleAccelerate ); |
|
402 opacity.SetTarget( 0.0f, fadeTime ); |
|
403 |
|
404 aVisual.SetFlag( EAlfVisualFlagManualPosition ); |
|
405 aVisual.SetPos( point ); |
|
406 aVisual.SetOpacity( opacity ); |
|
407 |
|
408 if( logoData ) |
|
409 { |
|
410 // This is not default logo, send event to destroy logo data. |
|
411 IRLOG_DEBUG2(" *** S60VisualRadio -- CIRStationLogoControl::FadeOutAndDeleteCurrent() -- sending custom event to delete logo data: 0x%x", logoData); |
|
412 Env().Send( TAlfCustomEventCommand( CIRStationLogoData::EIRCustomEventLogoFadeOutComplete, |
|
413 logoData, |
|
414 NULL), KVRLogoFadeTime ); |
|
415 } |
|
416 } |
|
417 |
|
418 // --------------------------------------------------------------------------- |
|
419 // Returns fades out target point. |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 TAlfTimedPoint CIRStationLogoControl::FadeOutTargetPoint( CAlfVisual& aVisual ) const |
|
423 { |
|
424 TAlfTimedPoint point( 0.0f, 0.0f ); |
|
425 point.SetStyle( EAlfTimedValueStyleDecelerate ); |
|
426 |
|
427 TAlfRealPoint size = aVisual.Size().ValueNow(); |
|
428 TAlfRealPoint pos = aVisual.Pos().ValueNow(); |
|
429 |
|
430 point = TAlfTimedPoint( pos.iX, pos.iY ); |
|
431 |
|
432 TAlfRealPoint target = aVisual.Pos().Target(); |
|
433 |
|
434 switch ( iFadeStyle ) |
|
435 { |
|
436 case EIRFadeUnknown: |
|
437 point.SetTarget( TAlfRealPoint( target.iX, target.iY ), KVRLogoFadeTime ); |
|
438 break; |
|
439 case EIRFadeLeftToRight: |
|
440 point.SetTarget( TAlfRealPoint( target.iX + size.iX, target.iY ), KVRLogoFadeTime ); |
|
441 break; |
|
442 case EIRFadeRightToLeft: |
|
443 point.SetTarget( TAlfRealPoint( target.iX - size.iX, target.iY ), KVRLogoFadeTime ); |
|
444 break; |
|
445 case EIRFadeTopToBottom: |
|
446 point.SetTarget( TAlfRealPoint( target.iX, target.iY + size.iY ), KVRLogoFadeTime ); |
|
447 break; |
|
448 case EIRFadeBottomToTop: |
|
449 point.SetTarget( TAlfRealPoint( target.iX, target.iY - size.iY ), KVRLogoFadeTime ); |
|
450 break; |
|
451 case EIRFadeNoFade: |
|
452 point.SetTarget( TAlfRealPoint( target.iX, target.iY ), 0 ); |
|
453 break; |
|
454 default: |
|
455 break; |
|
456 } |
|
457 return point; |
|
458 } |
|
459 |
|
460 // --------------------------------------------------------------------------- |
|
461 // Returns fade in start point. |
|
462 // --------------------------------------------------------------------------- |
|
463 // |
|
464 TAlfTimedPoint CIRStationLogoControl::FadeInStartPoint( CAlfVisual& aVisual ) const |
|
465 { |
|
466 TAlfTimedPoint point( 0.0f, 0.0f ); |
|
467 point.SetStyle( EAlfTimedValueStyleDecelerate ); |
|
468 |
|
469 TAlfRealPoint size = aVisual.Size().ValueNow(); |
|
470 TAlfRealPoint pos = aVisual.Pos().ValueNow(); |
|
471 |
|
472 point = TAlfTimedPoint( pos.iX, pos.iY, KVRLogoFadeTime ); |
|
473 |
|
474 switch ( iFadeStyle ) |
|
475 { |
|
476 case EIRFadeUnknown: |
|
477 point.iX.SetValueNow( pos.iX ); |
|
478 point.iY.SetValueNow( pos.iY ); |
|
479 break; |
|
480 case EIRFadeLeftToRight: |
|
481 point.iX.SetValueNow( pos.iX - size.iX ); |
|
482 point.iY.SetValueNow( pos.iY ); |
|
483 break; |
|
484 case EIRFadeRightToLeft: |
|
485 point.iX.SetValueNow( pos.iX + size.iX ); |
|
486 point.iY.SetValueNow( pos.iY ); |
|
487 break; |
|
488 case EIRFadeTopToBottom: |
|
489 point.iX.SetValueNow( pos.iX ); |
|
490 point.iY.SetValueNow( pos.iY - size.iY ); |
|
491 break; |
|
492 case EIRFadeBottomToTop: |
|
493 point.iX.SetValueNow( pos.iX ); |
|
494 point.iY.SetValueNow( pos.iY + size.iY ); |
|
495 break; |
|
496 case EIRFadeNoFade: |
|
497 point.iX.SetValueNow( pos.iX ); |
|
498 point.iY.SetValueNow( pos.iY ); |
|
499 point.SetTarget( pos, 0 ); |
|
500 break; |
|
501 default: |
|
502 break; |
|
503 } |
|
504 return point; |
|
505 } |
|
506 |
|
507 |
|
508 // --------------------------------------------------------------------------- |
|
509 // Sets the default image to the current visual |
|
510 // --------------------------------------------------------------------------- |
|
511 // |
|
512 void CIRStationLogoControl::DestroyPreviousLogosL( const RArray<TInt>& aIdArray , |
|
513 const CPtrC8Array& aRawData ) |
|
514 { |
|
515 |
|
516 for(TInt value=0;value<iLogoData.Count();value++) |
|
517 { |
|
518 TInt Value=iLogoData[value]->Id(); |
|
519 } |
|
520 if(iCount==0) |
|
521 { |
|
522 iCurrentId=KTwo; |
|
523 iCount++; |
|
524 iLogoData.ResetAndDestroy(); |
|
525 for( TInt i = 0 ; i < aRawData.Count() ; i++ ) |
|
526 { |
|
527 if(aIdArray.Count()) |
|
528 { |
|
529 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
530 iLogoData.AppendL( data ); |
|
531 CleanupStack::Pop( data ); |
|
532 } |
|
533 } |
|
534 } |
|
535 |
|
536 else if(iCount==1) |
|
537 { |
|
538 if(aRawData.Count()==1) |
|
539 { |
|
540 iCurrentId=KTwo; |
|
541 TInt i=0; |
|
542 delete iLogoData[i]; |
|
543 iLogoData.Remove( i); |
|
544 for( TInt i = 0 ; i < aRawData.Count() ; i++ ) |
|
545 { |
|
546 if(aIdArray.Count()) |
|
547 { |
|
548 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
549 iLogoData.AppendL( data ); |
|
550 CleanupStack::Pop( data ); |
|
551 } |
|
552 } |
|
553 } |
|
554 else |
|
555 { |
|
556 for( TInt i = 1 ; i < aRawData.Count() ; i++ ) |
|
557 { |
|
558 if(aIdArray.Count()) |
|
559 { |
|
560 |
|
561 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
562 iLogoData.AppendL( data ); |
|
563 CleanupStack::Pop( data ); |
|
564 } |
|
565 } |
|
566 } |
|
567 iCount++; |
|
568 } |
|
569 |
|
570 else if(iCount>1) |
|
571 { |
|
572 if(aRawData.Count()==1) |
|
573 { |
|
574 iLogoData.ResetAndDestroy(); |
|
575 iLogoDisplay=ETrue; |
|
576 |
|
577 for( TInt i = 0 ; i < aRawData.Count() ; i++ ) |
|
578 { |
|
579 if(aIdArray.Count()) |
|
580 { |
|
581 |
|
582 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
583 iLogoData.AppendL( data ); |
|
584 CleanupStack::Pop( data ); |
|
585 } |
|
586 } |
|
587 } |
|
588 else if(aRawData.Count()==2 && iLogoData.Count()==1) |
|
589 { |
|
590 for( TInt i = 1 ; i < aRawData.Count() ; i++ ) |
|
591 { |
|
592 if(aIdArray.Count()) |
|
593 { |
|
594 |
|
595 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
596 iLogoData.AppendL( data ); |
|
597 CleanupStack::Pop( data ); |
|
598 } |
|
599 } |
|
600 } |
|
601 else if(iLogoData.Count()==1&&!iLogoDisplay) |
|
602 { |
|
603 for( TInt i = 1 ; i < aRawData.Count() ; i++ ) |
|
604 { |
|
605 if(aIdArray.Count()) |
|
606 { |
|
607 |
|
608 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
609 iLogoData.AppendL( data ); |
|
610 CleanupStack::Pop( data ); |
|
611 } |
|
612 } |
|
613 iLogoDisplay=ETrue; |
|
614 } |
|
615 else if(!iLogoDisplay) |
|
616 { |
|
617 |
|
618 |
|
619 for(TInt j = 0;j<aRawData.Count();j++) |
|
620 { |
|
621 if(aIdArray.Count()) |
|
622 { |
|
623 |
|
624 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[j], aRawData[j] ); |
|
625 |
|
626 for(TInt i = 0;i<iLogoData.Count();i++) |
|
627 { |
|
628 if(!(data->Id()==iLogoData[i]->Id())&&(!iRet)) |
|
629 { |
|
630 if(i==1) |
|
631 { |
|
632 DefaultlogoHandlingL(aIdArray, aRawData); |
|
633 } |
|
634 else |
|
635 { |
|
636 delete iLogoData[i]; |
|
637 iLogoData.Remove( i); |
|
638 for( TInt i = 1 ; i < aRawData.Count() ; i++ ) |
|
639 { |
|
640 if(aIdArray.Count()) |
|
641 { |
|
642 |
|
643 CIRStationLogoData* data = CIRStationLogoData:: |
|
644 NewLC( aIdArray[i], aRawData[i] ); |
|
645 iLogoData.AppendL( data ); |
|
646 CleanupStack::Pop( data ); |
|
647 } |
|
648 } |
|
649 iRet++; |
|
650 } |
|
651 |
|
652 } |
|
653 |
|
654 |
|
655 } |
|
656 |
|
657 CleanupStack::PopAndDestroy( data ); |
|
658 } |
|
659 } |
|
660 } |
|
661 |
|
662 |
|
663 } |
|
664 } |
|
665 // --------------------------------------------------------------------------- |
|
666 // Sets the default image to the current visual |
|
667 // --------------------------------------------------------------------------- |
|
668 // |
|
669 void CIRStationLogoControl::DefaultlogoHandlingL( const RArray<TInt>& aIdArray , |
|
670 const CPtrC8Array& aRawData ) |
|
671 { |
|
672 for(TInt j = 0;j<aRawData.Count();j++) |
|
673 { |
|
674 TInt i=0; |
|
675 delete iLogoData[i]; |
|
676 iLogoData.Remove( i); |
|
677 for( TInt i = 1 ; i < aRawData.Count() ; i++ ) |
|
678 { |
|
679 if(aIdArray.Count()) |
|
680 { |
|
681 CIRStationLogoData* data = CIRStationLogoData::NewLC( aIdArray[i], aRawData[i] ); |
|
682 iLogoData.AppendL( data ); |
|
683 CleanupStack::Pop( data ); |
|
684 } |
|
685 } |
|
686 } |
|
687 } |
|
688 |
|
689 // --------------------------------------------------------------------------- |
|
690 // Sets the default image to the current visual |
|
691 // --------------------------------------------------------------------------- |
|
692 // |
|
693 void CIRStationLogoControl::FadeOutLogo(TInt /*aId*/) |
|
694 { |
|
695 CIRStationLogoData* previousLogoData = LogoDataForId( iCurrentId ); |
|
696 // Fade the current logo out. |
|
697 if ( previousLogoData && previousLogoData->Visual() ) |
|
698 { |
|
699 // Station logo. |
|
700 iFadeOut=ETrue; |
|
701 FadeOutCurrentLogo( *previousLogoData->Visual() ); |
|
702 } |
|
703 iCurrentId=KTwo; |
|
704 } |
|