|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "VeiEditVideoLabelNavi.h" |
|
21 #include <videoeditoruicomponents.mbg> |
|
22 #include <videoeditoruicomponents.rsg> |
|
23 #include <stringloader.h> |
|
24 #include <barsread.h> |
|
25 #include <e32std.h> |
|
26 #include <gulfont.h> |
|
27 #include <e32math.h> |
|
28 #include <aknsutils.h> |
|
29 #include <data_caging_path_literals.hrh> |
|
30 #include "VeiVideoEditorSettings.h" |
|
31 #include "VideoEditorCommon.h" |
|
32 #include "VideoEditorUtils.h" |
|
33 #include "VideoEditorDebugUtils.h" |
|
34 |
|
35 #include <AknFontAccess.h> |
|
36 #include <AknFontSpecification.h> |
|
37 #include <AknLayoutFont.h> |
|
38 |
|
39 // CONSTANTS |
|
40 _LIT(KResourceFile, "VideoEditorUiComponents.rsc"); |
|
41 const TReal KQvgaTextAndIconShrinkFactor = 0.8; |
|
42 |
|
43 // --------------------------------------------------------- |
|
44 // CVeiEditVideoLabelNavi::NewL() |
|
45 // --------------------------------------------------------- |
|
46 // |
|
47 EXPORT_C CVeiEditVideoLabelNavi* CVeiEditVideoLabelNavi::NewL() |
|
48 { |
|
49 CVeiEditVideoLabelNavi* self = CVeiEditVideoLabelNavi::NewLC(); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 // --------------------------------------------------------- |
|
54 // CVeiEditVideoLabelNavi::NewLC() |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 EXPORT_C CVeiEditVideoLabelNavi* CVeiEditVideoLabelNavi::NewLC() |
|
58 { |
|
59 CVeiEditVideoLabelNavi* self = new (ELeave) CVeiEditVideoLabelNavi; |
|
60 CleanupStack::PushL( self ); |
|
61 self->ConstructL(); |
|
62 return self; |
|
63 } |
|
64 // --------------------------------------------------------- |
|
65 // TUid CVeiEditVideoLabelNavi::ConstructL() |
|
66 // --------------------------------------------------------- |
|
67 // |
|
68 void CVeiEditVideoLabelNavi::ConstructL() |
|
69 { |
|
70 LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::ConstructL: in"); |
|
71 |
|
72 iState = /*EStateEditView*/EStateInitializing; |
|
73 |
|
74 iMmsMaxSize = 0; |
|
75 CVeiVideoEditorSettings::GetMaxMmsSizeL( iMmsMaxSize ); |
|
76 |
|
77 LoadBitmapsL(); |
|
78 |
|
79 // Open resource file |
|
80 TFileName resourceFile; |
|
81 Dll::FileName(resourceFile); |
|
82 TParse p; |
|
83 p.Set(KResourceFile, &KDC_RESOURCE_FILES_DIR, &resourceFile); |
|
84 resourceFile = p.FullName(); |
|
85 iResLoader.OpenL( resourceFile ); |
|
86 |
|
87 // The primary small font seems to be the smallest font available, |
|
88 // but it is still too large to fit all the texts in QVGA mode. |
|
89 // We need to shrink it a little bit. |
|
90 TAknFontSpecification spec( KAknFontCategoryPrimarySmall ); |
|
91 const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
92 spec.SetTextPaneHeight( myFont->HeightInPixels() * KQvgaTextAndIconShrinkFactor ); |
|
93 CWsScreenDevice* dev = ControlEnv()->ScreenDevice(); |
|
94 iCustomFont = AknFontAccess::CreateLayoutFontFromSpecificationL( *dev, spec ); |
|
95 |
|
96 LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::ConstructL: out"); |
|
97 } |
|
98 // --------------------------------------------------------- |
|
99 // TUid CVeiEditVideoLabelNavi::LoadBitmapsL() |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CVeiEditVideoLabelNavi::LoadBitmapsL() |
|
103 { |
|
104 LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::LoadBitmapsL: in"); |
|
105 |
|
106 TFileName bitmapfile( VideoEditorUtils::IconFileNameAndPath(KVideoEditorUiComponentsIconFileId) ); |
|
107 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
108 /* Mms bitmap */ |
|
109 AknsUtils::CreateColorIconL( |
|
110 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
111 EAknsCIQsnIconColorsCG6, |
|
112 iMmsBitmap, iMmsBitmapMask, |
|
113 bitmapfile, |
|
114 EMbmVideoeditoruicomponentsQgn_indi_ve_mms_ok, EMbmVideoeditoruicomponentsQgn_indi_ve_mms_ok_mask,KRgbBlack); |
|
115 |
|
116 /* No Mms bitmap */ |
|
117 AknsUtils::CreateColorIconL( |
|
118 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
119 EAknsCIQsnIconColorsCG6, |
|
120 iNoMmsBitmap, iNoMmsBitmapMask, |
|
121 bitmapfile, |
|
122 EMbmVideoeditoruicomponentsQgn_indi_ve_mms_non, EMbmVideoeditoruicomponentsQgn_indi_ve_mms_non_mask,KRgbBlack); |
|
123 |
|
124 /* Phone memory bitmap */ |
|
125 AknsUtils::CreateColorIconL( |
|
126 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
127 EAknsCIQsnIconColorsCG6, |
|
128 iPhoneMemoryBitmap, iPhoneMemoryBitmapMask, |
|
129 bitmapfile, |
|
130 EMbmVideoeditoruicomponentsQgn_indi_ve_phone, EMbmVideoeditoruicomponentsQgn_indi_ve_phone_mask,KRgbBlack); |
|
131 |
|
132 /* No phone memory bitmap */ |
|
133 AknsUtils::CreateColorIconL( |
|
134 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
135 EAknsCIQsnIconColorsCG6, |
|
136 iNoPhoneMemoryBitmap, iNoPhoneMemoryBitmapMask, |
|
137 bitmapfile, |
|
138 EMbmVideoeditoruicomponentsQgn_indi_ve_phone_non, EMbmVideoeditoruicomponentsQgn_indi_ve_phone_non_mask,KRgbBlack); |
|
139 |
|
140 /* MMC bitmap */ |
|
141 AknsUtils::CreateColorIconL( |
|
142 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
143 EAknsCIQsnIconColorsCG6, |
|
144 iMMCBitmap, iMMCBitmapMask, |
|
145 bitmapfile, |
|
146 EMbmVideoeditoruicomponentsQgn_indi_ve_mmc, EMbmVideoeditoruicomponentsQgn_indi_ve_mmc_mask,KRgbBlack); |
|
147 |
|
148 /* No MMC bitmap */ |
|
149 AknsUtils::CreateColorIconL( |
|
150 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
151 EAknsCIQsnIconColorsCG6, |
|
152 iNoMMCBitmap, iNoMMCBitmapMask, |
|
153 bitmapfile, |
|
154 EMbmVideoeditoruicomponentsQgn_indi_ve_mmc_non, EMbmVideoeditoruicomponentsQgn_indi_ve_mmc_non_mask,KRgbBlack); |
|
155 |
|
156 /* Time bitmap */ |
|
157 AknsUtils::CreateColorIconL( |
|
158 skinInstance, KAknsIIDNone,KAknsIIDQsnIconColors, |
|
159 EAknsCIQsnIconColorsCG6, |
|
160 iTimeBitmap, iTimeBitmapMask, |
|
161 bitmapfile, |
|
162 EMbmVideoeditoruicomponentsQgn_indi_ve_videolength, EMbmVideoeditoruicomponentsQgn_indi_ve_videolength_mask,KRgbBlack); |
|
163 |
|
164 LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::LoadBitmapsL: out"); |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------- |
|
168 // TUid CVeiEditVideoLabelNavi::~CVeiEditVideoLabelNavi() |
|
169 // --------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C CVeiEditVideoLabelNavi::~CVeiEditVideoLabelNavi() |
|
172 { |
|
173 DeleteBitmaps(); |
|
174 iResLoader.Close(); |
|
175 delete iCustomFont; |
|
176 } |
|
177 |
|
178 void CVeiEditVideoLabelNavi::DeleteBitmaps() |
|
179 { |
|
180 delete iMmsBitmap; |
|
181 iMmsBitmap = NULL; |
|
182 |
|
183 delete iMmsBitmapMask; |
|
184 iMmsBitmapMask = NULL; |
|
185 |
|
186 delete iNoMmsBitmap; |
|
187 iNoMmsBitmap = NULL; |
|
188 |
|
189 delete iNoMmsBitmapMask; |
|
190 iNoMmsBitmapMask = NULL; |
|
191 |
|
192 delete iPhoneMemoryBitmap; |
|
193 iPhoneMemoryBitmap = NULL; |
|
194 |
|
195 delete iPhoneMemoryBitmapMask; |
|
196 iPhoneMemoryBitmapMask = NULL; |
|
197 |
|
198 delete iNoPhoneMemoryBitmap; |
|
199 iNoPhoneMemoryBitmap = NULL; |
|
200 |
|
201 delete iNoPhoneMemoryBitmapMask; |
|
202 iNoPhoneMemoryBitmapMask = NULL; |
|
203 |
|
204 delete iMMCBitmap; |
|
205 iMMCBitmap = NULL; |
|
206 |
|
207 delete iMMCBitmapMask; |
|
208 iMMCBitmapMask = NULL; |
|
209 |
|
210 delete iNoMMCBitmap; |
|
211 iNoMMCBitmap = NULL; |
|
212 |
|
213 delete iNoMMCBitmapMask; |
|
214 iNoMMCBitmapMask = NULL; |
|
215 |
|
216 delete iTimeBitmap; |
|
217 iTimeBitmap = NULL; |
|
218 |
|
219 delete iTimeBitmapMask; |
|
220 iTimeBitmapMask = NULL; |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------- |
|
224 // CVeiEditVideoLabelNavi::CVeiEditVideoLabelNavi() |
|
225 // --------------------------------------------------------- |
|
226 // |
|
227 CVeiEditVideoLabelNavi::CVeiEditVideoLabelNavi() : iResLoader(*CEikonEnv::Static()) |
|
228 { |
|
229 iStoryboardDuration = 0; |
|
230 iStoryboardSize = 0; |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------- |
|
234 // CVeiEditVideoLabelNavi::Draw(const TRect& aRect) const |
|
235 // --------------------------------------------------------- |
|
236 // |
|
237 void CVeiEditVideoLabelNavi::Draw(const TRect& aRect) const |
|
238 { |
|
239 if ( iState == EStateInitializing ) |
|
240 { |
|
241 return; |
|
242 } |
|
243 CWindowGc& gc=SystemGc(); |
|
244 |
|
245 // Get navi pane text color from skin |
|
246 TRgb textColor( KRgbBlack ); |
|
247 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
248 AknsUtils::GetCachedColor(skinInstance, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG2 ); |
|
249 |
|
250 TBuf<25> layoutTime; |
|
251 //minutes and seconds "120:13" |
|
252 TBuf<15> minsec; |
|
253 TInt64 duration = 0; |
|
254 TTimeIntervalHours hours; |
|
255 TTimeIntervalMinutes minutes; |
|
256 TTimeIntervalMicroSeconds seconds; |
|
257 duration = static_cast<TInt64>( iStoryboardDuration / 1000 ); |
|
258 |
|
259 TChar timeSeparator = TLocale().TimeSeparator(2); |
|
260 |
|
261 //over 1 hour |
|
262 if( duration >= 3600000 ) |
|
263 { |
|
264 hours = TTimeIntervalHours( (TInt)(duration / 3600000) ); |
|
265 minsec.AppendNum( hours.Int() ); |
|
266 minsec.Append( timeSeparator ); |
|
267 |
|
268 duration = duration - TInt64(hours.Int()) * TInt64(3600000); |
|
269 } |
|
270 //over 1 minute |
|
271 if( duration >= 60000 ) |
|
272 { |
|
273 minutes = TTimeIntervalMinutes( (TInt)(duration / 60000) ); |
|
274 minsec.AppendNum( minutes.Int() ); |
|
275 |
|
276 duration = duration - TInt64(minutes.Int()) * TInt64(60000); |
|
277 } |
|
278 else |
|
279 { |
|
280 minsec.Append( _L( "00" ) ); |
|
281 } |
|
282 |
|
283 if( duration >= 1000 ) |
|
284 { |
|
285 seconds = TTimeIntervalMicroSeconds( duration / 1000 ); |
|
286 |
|
287 if( seconds.Int64() >= 60 ) |
|
288 { |
|
289 minsec.Append( timeSeparator ); |
|
290 minsec.AppendNum( seconds.Int64() - 60 ); |
|
291 } |
|
292 else |
|
293 { |
|
294 minsec.Append( timeSeparator ); |
|
295 if ( seconds.Int64() < 10 ) |
|
296 { |
|
297 minsec.Append( _L("0") ); |
|
298 } |
|
299 |
|
300 minsec.AppendNum( seconds.Int64() ); |
|
301 } |
|
302 } |
|
303 else |
|
304 { |
|
305 minsec.Append( timeSeparator ); |
|
306 minsec.Append( _L("00") ); |
|
307 } |
|
308 layoutTime.Append( minsec ); |
|
309 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutTime ); |
|
310 |
|
311 //text MMS |
|
312 TBuf<25> layoutTextMMS; |
|
313 HBufC* stringholder = StringLoader::LoadLC( R_VEI_NAVI_PANE_MMS, iEikonEnv ); |
|
314 layoutTextMMS.Append( *stringholder ); |
|
315 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutTextMMS ); |
|
316 CleanupStack::PopAndDestroy( stringholder ); |
|
317 |
|
318 //size of the movie in KB, MB or GB |
|
319 TBuf<25> layoutSize; |
|
320 |
|
321 if ( iStoryboardSize < 1000 ) |
|
322 { |
|
323 HBufC* stringholder = StringLoader::LoadLC( R_VEI_SIZE_KB, iStoryboardSize, iEikonEnv ); |
|
324 layoutSize.Append( *stringholder ); |
|
325 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutSize ); |
|
326 CleanupStack::PopAndDestroy( stringholder ); |
|
327 } |
|
328 else |
|
329 { |
|
330 TReal size = (TReal)iStoryboardSize / 1024; |
|
331 if ( size >= 1000 ) |
|
332 { |
|
333 // Gigabytes are handled differently from megabytes, because we don't have |
|
334 // appropriate localized string (i.e. with %U param) for gigabytes. |
|
335 TInt gigaSize = (TInt) (size/1024 + 0.5); |
|
336 stringholder = StringLoader::LoadLC( R_VEI_SIZE_GB, gigaSize, iEikonEnv ); |
|
337 layoutSize.Append( *stringholder ); |
|
338 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutSize ); |
|
339 CleanupStack::PopAndDestroy( stringholder ); |
|
340 } |
|
341 else |
|
342 { |
|
343 // for megabytes, drop the decimals if the value has 3 or more digits |
|
344 TBuf16<256> sizeValue; |
|
345 if (size < 100) |
|
346 { |
|
347 _LIT16( KFormat,"%3.1f" ); |
|
348 sizeValue.Format( KFormat,size ); |
|
349 } |
|
350 else |
|
351 { |
|
352 _LIT16( KFormat,"%3.0f" ); |
|
353 sizeValue.Format( KFormat,size ); |
|
354 } |
|
355 stringholder = StringLoader::LoadLC( R_VEI_SIZE_MB, sizeValue, iCoeEnv ); |
|
356 layoutSize.Append( *stringholder ); |
|
357 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( layoutSize ); |
|
358 CleanupStack::PopAndDestroy( stringholder ); |
|
359 } |
|
360 } |
|
361 |
|
362 |
|
363 if ( iState == EStateEditView ) //EditView owns the navipane |
|
364 { |
|
365 if ( iMmsAvailable ) |
|
366 { |
|
367 iBitmapLayout[0].DrawImage( gc, iMmsBitmap, iMmsBitmapMask ); |
|
368 } |
|
369 else |
|
370 { |
|
371 iBitmapLayout[0].DrawImage( gc, iNoMmsBitmap, iNoMmsBitmapMask ); |
|
372 } |
|
373 |
|
374 if ( aRect.iBr.iX >= 148 ) // QVGA or bigger |
|
375 { |
|
376 |
|
377 if ( iPhoneMemory ) //phone memory in use. |
|
378 { |
|
379 if ( iMemoryAvailable ) |
|
380 { |
|
381 iBitmapLayout[1].DrawImage( gc, iPhoneMemoryBitmap, iPhoneMemoryBitmapMask ); |
|
382 } |
|
383 else |
|
384 { |
|
385 iBitmapLayout[1].DrawImage( gc, iNoPhoneMemoryBitmap, iNoPhoneMemoryBitmapMask ); |
|
386 } |
|
387 } |
|
388 else //mmc-memory in use. |
|
389 { |
|
390 if ( iMemoryAvailable ) |
|
391 { |
|
392 iBitmapLayout[1].DrawImage( gc, iMMCBitmap, iMMCBitmapMask ); |
|
393 } |
|
394 else |
|
395 { |
|
396 iBitmapLayout[1].DrawImage( gc, iNoMMCBitmap, iNoMMCBitmapMask ); |
|
397 } |
|
398 } |
|
399 iTextLayout[1].DrawText( gc, layoutSize, ETrue, textColor ); |
|
400 } |
|
401 |
|
402 iBitmapLayout[2].DrawImage( gc, iTimeBitmap, iTimeBitmapMask ); |
|
403 |
|
404 |
|
405 iTextLayout[0].DrawText( gc, layoutTextMMS, ETrue, textColor ); |
|
406 iTextLayout[2].DrawText( gc, layoutTime, ETrue, textColor ); |
|
407 |
|
408 } |
|
409 else if ( iState == EStateTrimForMmsView ) //TrimForMmsView owns the navi pane. |
|
410 { |
|
411 if ( iMmsAvailable ) |
|
412 { |
|
413 iBitmapLayout[0].DrawImage( gc, iMmsBitmap, iMmsBitmapMask ); |
|
414 } |
|
415 else |
|
416 { |
|
417 iBitmapLayout[0].DrawImage( gc, iNoMmsBitmap, iNoMmsBitmapMask ); |
|
418 } |
|
419 iTextLayout[0].DrawText( gc, layoutSize, ETrue, textColor ); |
|
420 iBitmapLayout[2].DrawImage( gc, iTimeBitmap, iTimeBitmapMask ); |
|
421 iTextLayout[2].DrawText( gc, layoutTime, ETrue, textColor ); |
|
422 } |
|
423 |
|
424 // TEST |
|
425 /* gc.SetPenColor( KRgbRed ); |
|
426 iBitmapLayout[0].DrawOutLineRect(gc); |
|
427 iBitmapLayout[1].DrawOutLineRect(gc); |
|
428 iBitmapLayout[2].DrawOutLineRect(gc); |
|
429 |
|
430 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
431 gc.DrawRect( iTextLayout[0].TextRect() ); |
|
432 gc.DrawRect( iTextLayout[1].TextRect() ); |
|
433 gc.DrawRect( iTextLayout[2].TextRect() ); |
|
434 |
|
435 gc.DrawRect( Rect() );*/ |
|
436 // END TEST |
|
437 |
|
438 } |
|
439 |
|
440 // --------------------------------------------------------- |
|
441 // CVeiEditVideoLabelNavi::HandleResourceChange(TInt aType) |
|
442 // --------------------------------------------------------- |
|
443 // |
|
444 void CVeiEditVideoLabelNavi::HandleResourceChange(TInt aType) |
|
445 { |
|
446 LOGFMT(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::HandleResourceChange() In, aType:%d", aType); |
|
447 |
|
448 if (KAknsMessageSkinChange == aType) |
|
449 { |
|
450 // Reload the icon bitmaps with the current skin color |
|
451 DeleteBitmaps(); |
|
452 TRAP_IGNORE( LoadBitmapsL() ); |
|
453 } |
|
454 CCoeControl::HandleResourceChange(aType); |
|
455 |
|
456 LOG(KVideoEditorLogFile, "CVeiEditVideoLabelNavi::HandleResourceChange() Out"); |
|
457 } |
|
458 |
|
459 // -------------------------------------------------------- |
|
460 // CVeiEditVideoLabelNavi::SetMmsAvailableL( TBool aIsAvailable ) |
|
461 // Set MMS envelope without red line or with it. |
|
462 // --------------------------------------------------------- |
|
463 // |
|
464 EXPORT_C void CVeiEditVideoLabelNavi::SetMmsAvailableL( TBool aIsAvailable ) |
|
465 { |
|
466 iMmsAvailable = aIsAvailable; |
|
467 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
468 } |
|
469 EXPORT_C TBool CVeiEditVideoLabelNavi::IsMMSAvailable() const |
|
470 { |
|
471 return iMmsAvailable; |
|
472 } |
|
473 |
|
474 // -------------------------------------------------------- |
|
475 // CVeiEditVideoLabelNavi::SetMemoryInUseL( TBool aPhoneMemory ) |
|
476 // Set memory in use Phone/MMC. |
|
477 // --------------------------------------------------------- |
|
478 // |
|
479 EXPORT_C void CVeiEditVideoLabelNavi::SetMemoryInUseL( TBool aPhoneMemory ) |
|
480 { |
|
481 iPhoneMemory = aPhoneMemory; |
|
482 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
483 } |
|
484 // -------------------------------------------------------- |
|
485 // CVeiEditVideoLabelNavi::SetMemoryAvailableL( TBool aIsAvailable ) |
|
486 // ?implementation_description |
|
487 // --------------------------------------------------------- |
|
488 // |
|
489 EXPORT_C void CVeiEditVideoLabelNavi::SetMemoryAvailableL( TBool aIsAvailable ) |
|
490 { |
|
491 iMemoryAvailable = aIsAvailable; |
|
492 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
493 } |
|
494 // --------------------------------------------------------- |
|
495 // CVeiEditVideoLabelNavi::SetDurationLabelL( const TUint& aDuration ) |
|
496 // Set movie duration. |
|
497 // --------------------------------------------------------- |
|
498 // |
|
499 EXPORT_C void CVeiEditVideoLabelNavi::SetDurationLabelL( const TInt64& aDuration ) |
|
500 { |
|
501 iStoryboardDuration = aDuration; |
|
502 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
503 } |
|
504 |
|
505 // --------------------------------------------------------- |
|
506 // CVeiEditVideoLabelNavi::SetSizeLabelL( const TUint& aSize ) |
|
507 // Set movie size. |
|
508 // --------------------------------------------------------- |
|
509 // |
|
510 EXPORT_C void CVeiEditVideoLabelNavi::SetSizeLabelL( const TUint& aSize ) |
|
511 { |
|
512 iStoryboardSize = aSize; |
|
513 ReportEventL( MCoeControlObserver::EEventStateChanged ); |
|
514 } |
|
515 // --------------------------------------------------------- |
|
516 // CVeiEditVideoLabelNavi::SetState( CVeiEditVideoLabelNavi::TLabelNaviState aState ) |
|
517 // Set whether editview or trimformms-view |
|
518 // --------------------------------------------------------- |
|
519 // |
|
520 EXPORT_C void CVeiEditVideoLabelNavi::SetState( CVeiEditVideoLabelNavi::TLabelNaviState aState ) |
|
521 { |
|
522 iState = aState; |
|
523 } |
|
524 |
|
525 // --------------------------------------------------------- |
|
526 // CVeiEditVideoLabelNavi::SizeChanged() |
|
527 // --------------------------------------------------------- |
|
528 // |
|
529 void CVeiEditVideoLabelNavi::SizeChanged() |
|
530 { |
|
531 TRect parentRect = Rect(); |
|
532 parentRect.iTl.iY = parentRect.iTl.iY +2; |
|
533 TInt adjustLeftMemoryIcon(0); |
|
534 TInt adjustLeftTimeIcon(0); |
|
535 |
|
536 TInt adjustLeftMMSIcon = 0; |
|
537 TInt adjustWidth = parentRect.Height(); |
|
538 TInt adjustHeight = parentRect.Height(); |
|
539 |
|
540 const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ); |
|
541 |
|
542 // For high resolution(352x416) use different font |
|
543 if ( parentRect.iBr.iX >= 216 ) // high resolution(352x416) |
|
544 { |
|
545 adjustLeftMemoryIcon = STATIC_CAST( TInt, parentRect.Width() * 0.28 ); |
|
546 adjustLeftTimeIcon = STATIC_CAST( TInt, parentRect.Width() * 0.67 ); |
|
547 myFont = AknLayoutUtils::FontFromId( ELatinBold12 ); |
|
548 } |
|
549 else if ( parentRect.iBr.iX >= 148 ) // QVGA (240x320) |
|
550 { |
|
551 adjustLeftMemoryIcon = STATIC_CAST( TInt, parentRect.Width() * 0.27 ); |
|
552 adjustLeftTimeIcon = STATIC_CAST( TInt, parentRect.Width() * 0.64 ); |
|
553 |
|
554 // Reduce the relative size of the icons a little bit. |
|
555 adjustWidth *= KQvgaTextAndIconShrinkFactor; |
|
556 adjustHeight *= KQvgaTextAndIconShrinkFactor; |
|
557 |
|
558 // use the extra small font |
|
559 myFont = (const CFont*)iCustomFont; |
|
560 } |
|
561 else |
|
562 { |
|
563 // in the small resolution (176x208) the memory icon and text are dropped out |
|
564 adjustLeftMemoryIcon = STATIC_CAST( TInt, parentRect.Width() * 0.4138 ); |
|
565 adjustLeftTimeIcon = STATIC_CAST( TInt, parentRect.Width() * 0.42 + 15); |
|
566 } |
|
567 |
|
568 AknIconUtils::SetSize( iMmsBitmap, TSize( adjustWidth,adjustHeight) ); |
|
569 AknIconUtils::SetSize( iNoMmsBitmap, TSize(adjustWidth,adjustHeight) ); |
|
570 AknIconUtils::SetSize( iPhoneMemoryBitmap, TSize(adjustWidth,adjustHeight) ); |
|
571 AknIconUtils::SetSize( iNoPhoneMemoryBitmap, TSize(adjustWidth,adjustHeight) ); |
|
572 AknIconUtils::SetSize( iMMCBitmap, TSize(adjustWidth,adjustHeight) ); |
|
573 AknIconUtils::SetSize( iNoMMCBitmap, TSize(adjustWidth,adjustHeight) ); |
|
574 AknIconUtils::SetSize( iTimeBitmap, TSize(adjustWidth,adjustHeight) ); |
|
575 |
|
576 //LayoutRect(const TRect &aParent, TInt C, TInt left, TInt top, TInt right, TInt bottom, TInt Width, TInt Height); |
|
577 iBitmapLayout[0].LayoutRect( parentRect, ELayoutEmpty, adjustLeftMMSIcon, 0, ELayoutEmpty, ELayoutEmpty, adjustWidth, adjustHeight ); |
|
578 iBitmapLayout[1].LayoutRect( parentRect, ELayoutEmpty, adjustLeftMemoryIcon, 0, ELayoutEmpty, ELayoutEmpty, adjustWidth, adjustHeight ); |
|
579 iBitmapLayout[2].LayoutRect( parentRect, ELayoutEmpty, adjustLeftTimeIcon, 0, ELayoutEmpty, ELayoutEmpty, adjustWidth, adjustHeight ); |
|
580 |
|
581 //layout for MMS-text |
|
582 TInt tX = adjustLeftMMSIcon + adjustWidth; |
|
583 TInt tY = 2; |
|
584 |
|
585 TInt bX = adjustLeftTimeIcon; |
|
586 TInt bY = parentRect.Height(); |
|
587 TRect mmsTextArea( tX, tY, bX, bY ); |
|
588 |
|
589 TInt baseline = ( mmsTextArea.Height() / 2 ) + ( myFont->AscentInPixels() / 2 ); |
|
590 if (myFont == iCustomFont) |
|
591 { |
|
592 // It seems that even if the font size is scaled down, AscentInPixels() |
|
593 // returns the original fon't ascent. We have to scale it down as well. |
|
594 baseline = ( mmsTextArea.Height() / 2 ) + ( myFont->AscentInPixels() / 2 * KQvgaTextAndIconShrinkFactor ); |
|
595 } |
|
596 TInt margin=1; |
|
597 TInt width = mmsTextArea.Width(); |
|
598 iTextLayout[0].LayoutText( mmsTextArea,0,0,margin,margin,baseline,width,ELayoutAlignLeft,myFont ); |
|
599 |
|
600 //layout for size-text |
|
601 tX = adjustLeftMemoryIcon + adjustWidth; |
|
602 bX = adjustLeftTimeIcon; |
|
603 TRect sizeTextArea( tX, tY, bX, bY ); |
|
604 width = sizeTextArea.Width(); |
|
605 //LayoutText(const TRect& aParent, TInt fontid, TInt C, TInt l, TInt r, TInt B, TInt W, TInt J, const CFont* aCustomFont=0); |
|
606 iTextLayout[1].LayoutText( sizeTextArea, 0, 0, margin, margin, baseline, width, ELayoutAlignLeft, myFont ); |
|
607 |
|
608 //layout for time-text |
|
609 tX = adjustLeftTimeIcon + adjustWidth; |
|
610 bX = parentRect.Width(); |
|
611 TRect timeTextArea( tX, tY, bX, bY ); |
|
612 width = timeTextArea.Width(); |
|
613 iTextLayout[2].LayoutText( timeTextArea, 0, 0, margin, margin, baseline, width, ELayoutAlignLeft, myFont ); |
|
614 } |
|
615 |
|
616 |
|
617 //------------------------------------------------------------------------------- |
|
618 //CVeiEditVideoLabelNavi::GetMaxMmsSize() |
|
619 // available max size of the MMS. |
|
620 //------------------------------------------------------------------------------- |
|
621 EXPORT_C TInt CVeiEditVideoLabelNavi::GetMaxMmsSize() const |
|
622 { |
|
623 return iMmsMaxSize/1024; |
|
624 } |
|
625 // End of File |