64
|
1 |
/*
|
|
2 |
* Copyright (c) 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include <alf/alfenv.h>
|
|
21 |
|
|
22 |
#include <alf/alfgridlayout.h>
|
|
23 |
#include <alf/alfviewportlayout.h>
|
|
24 |
|
|
25 |
#include <alf/alftextvisual.h>
|
|
26 |
#include <alf/alfimagevisual.h>
|
|
27 |
|
|
28 |
#include <alf/alftextstylemanager.h>
|
|
29 |
#include <alf/alftextstyle.h>
|
|
30 |
|
|
31 |
#include "alfperfappsuiteepgcontrol.h"
|
|
32 |
#include "alfperfappsuitehelper.h"
|
|
33 |
#include "alfperfappsuitetestcasescroll.h"
|
|
34 |
|
|
35 |
// ============================= MEMBER FUNCTIONS ==============================
|
|
36 |
|
|
37 |
TInt DurationInMinutes( TTime aStart, TTime aEnd )
|
|
38 |
{
|
|
39 |
TTimeIntervalMinutes duration;
|
|
40 |
aEnd.MinutesFrom( aStart, duration );
|
|
41 |
return duration.Int();
|
|
42 |
}
|
|
43 |
|
|
44 |
TProgram::TProgram()
|
|
45 |
{
|
|
46 |
iName.Zero();
|
|
47 |
}
|
|
48 |
|
|
49 |
TProgram::TProgram( const TDesC& aName, const TDesC& aStart, const TDesC& aEnd )
|
|
50 |
:iName( aName ),
|
|
51 |
iStart( aStart ),
|
|
52 |
iEnd( aEnd )
|
|
53 |
{
|
|
54 |
}
|
|
55 |
|
|
56 |
TInt TProgram::DurationInMinutes()
|
|
57 |
{
|
|
58 |
return ::DurationInMinutes( iStart, iEnd );
|
|
59 |
}
|
|
60 |
|
|
61 |
CAlfPerfAppSuiteEPGControl::CAlfPerfAppSuiteEPGControl(CAlfPerfAppSuiteTestCaseScroll* aScrollControl)
|
|
62 |
: iScrollControl(aScrollControl)
|
|
63 |
{
|
|
64 |
|
|
65 |
}
|
|
66 |
|
|
67 |
CAlfPerfAppSuiteEPGControl::~CAlfPerfAppSuiteEPGControl()
|
|
68 |
{
|
|
69 |
#ifdef ENABLE_TEXTSTYLES
|
|
70 |
CAlfTextStyleManager& styleManager = Env().TextStyleManager();
|
|
71 |
for( TInt i=0; i<iTextStyles.Count(); i++ )
|
|
72 |
{
|
|
73 |
styleManager.DeleteTextStyle( iTextStyles[i] );
|
|
74 |
}
|
|
75 |
iTextStyles.Close();
|
|
76 |
#endif
|
|
77 |
}
|
|
78 |
|
|
79 |
void CAlfPerfAppSuiteEPGControl::ConstructL(
|
|
80 |
CAlfEnv& aEnv,
|
|
81 |
const TSize& aVisibleArea,
|
|
82 |
CAlfLayout* aParentLayout )
|
|
83 |
{
|
|
84 |
iLoadedImages = 0;
|
|
85 |
iVisibleArea = aVisibleArea;
|
|
86 |
CAlfControl::ConstructL( aEnv );
|
|
87 |
|
|
88 |
#ifdef ENABLE_TEXTSTYLES
|
|
89 |
CreateTextStylesL();
|
|
90 |
#endif
|
|
91 |
|
|
92 |
// Construct a base layout to add a background
|
|
93 |
CAlfLayout* baseLayout = CAlfLayout::AddNewL( *this, aParentLayout );
|
|
94 |
TAlfPerfAppSuiteHelper::AddGradientBrushL( baseLayout, KRgbBlue, KRgbWhite );
|
|
95 |
TAlfPerfAppSuiteHelper::AddDropShadowBrushL( baseLayout, KRgbWhite, 1 );
|
|
96 |
|
|
97 |
// Create grid layout
|
|
98 |
CAlfGridLayout* gridLayout =
|
|
99 |
CAlfGridLayout::AddNewL( *this, 1, 1, baseLayout );
|
|
100 |
gridLayout->SetPadding( 10 );
|
|
101 |
|
|
102 |
// Get texture manager
|
|
103 |
CAlfTextureManager& textureManager = Env().TextureManager();
|
|
104 |
|
|
105 |
// Add heading row
|
|
106 |
CAlfTextVisual* headingTextVisual = CAlfTextVisual::AddNewL( *this, gridLayout );
|
|
107 |
headingTextVisual->SetTextL( _L("Tuubi EPG") );
|
|
108 |
#ifdef ENABLE_TEXTSTYLES
|
|
109 |
headingTextVisual->SetTextStyle( iTextStyles[ETextStyleTitle] );
|
|
110 |
headingTextVisual->SetColor( KRgbWhite );
|
|
111 |
#endif
|
|
112 |
RArray<TInt> rowHeights;
|
|
113 |
rowHeights.Append( 50 );
|
|
114 |
|
|
115 |
// Define time window to show
|
|
116 |
TTime start( _L("181500.") );
|
|
117 |
TTime end( _L("201500.") );
|
|
118 |
|
|
119 |
// HEADER
|
|
120 |
RArray<TProgram> programs;
|
|
121 |
// NOTE: Programs must start and end at the same time for them to be correctly
|
|
122 |
// aligned on screen. Our total time window here is 24*60 min.
|
|
123 |
programs.Append( TProgram( _L("---"), _L("000000."), _L("174500.") ) );
|
|
124 |
programs.Append( TProgram( _L("18:00"), _L("174500."), _L("181500.") ) );
|
|
125 |
programs.Append( TProgram( _L("18:30"), _L("181500."), _L("184500.") ) );
|
|
126 |
programs.Append( TProgram( _L("19:00"), _L("184500."), _L("191500.") ) );
|
|
127 |
programs.Append( TProgram( _L("19:30"), _L("191500."), _L("194500.") ) );
|
|
128 |
programs.Append( TProgram( _L("20:00"), _L("194500."), _L("201500.") ) );
|
|
129 |
programs.Append( TProgram( _L("20:30"), _L("201500."), _L("204500.") ) );
|
|
130 |
programs.Append( TProgram( _L("21:00"), _L("204500."), _L("211500.") ) );
|
|
131 |
programs.Append( TProgram( _L("---"), _L("211500."), _L("235959.") ) );
|
|
132 |
TAlfImage empty;
|
|
133 |
TInt textStyle = 0;
|
|
134 |
#ifdef ENABLE_TEXTSTYLES
|
|
135 |
textStyle = iTextStyles[ETextStyleTime];
|
|
136 |
#endif
|
|
137 |
AddRowL( gridLayout, empty, programs, start, end, textStyle, EFalse );
|
|
138 |
programs.Reset();
|
|
139 |
rowHeights.Append( 50 );
|
|
140 |
|
|
141 |
|
|
142 |
aEnv.TextureManager().AddLoadObserverL( this );
|
|
143 |
|
|
144 |
_LIT( KImage1, "mtv3.png" );
|
|
145 |
_LIT( KImage2, "nelonen.png" );
|
|
146 |
_LIT( KImage3, "jim.png" );
|
|
147 |
_LIT( KImage4, "mtv3_scifi.png" );
|
|
148 |
_LIT( KImage5, "discoveryhd.png" );
|
|
149 |
_LIT( KImage6, "nationalgeographic.jpg" );
|
|
150 |
|
|
151 |
// MTV3
|
|
152 |
TAlfImage mtv3Image(
|
|
153 |
textureManager.LoadTextureL(
|
|
154 |
KImage1,
|
|
155 |
EAlfTextureFlagRetainResolution,
|
|
156 |
KAlfAutoGeneratedTextureId ) );
|
|
157 |
|
|
158 |
programs.Append( TProgram( _L("TV-chät"),
|
|
159 |
_L("000000."), _L("180000.") ) );
|
|
160 |
programs.Append( TProgram( _L("Emmerdale"),
|
|
161 |
_L("180000."), _L("183000.") ) );
|
|
162 |
programs.Append( TProgram( _L("T.i.l.a."),
|
|
163 |
_L("183000."), _L("190000.") ) );
|
|
164 |
programs.Append( TProgram( _L("Seitsemän Uutiset"),
|
|
165 |
_L("190000."), _L("191500.") ) );
|
|
166 |
programs.Append( TProgram( _L("Kauppalehden talousuutiset"),
|
|
167 |
_L("191500."), _L("192500.") ) );
|
|
168 |
programs.Append( TProgram( _L("Päivän sää"),
|
|
169 |
_L("192500."), _L("193000.") ) );
|
|
170 |
programs.Append( TProgram( _L("Salatut elämät"),
|
|
171 |
_L("193000."), _L("200000.") ) );
|
|
172 |
programs.Append( TProgram( _L("45min Special: Kuninkaalliset kulissien takana"),
|
|
173 |
_L("200000."), _L("210000.") ) );
|
|
174 |
programs.Append( TProgram( _L("TV-chät"),
|
|
175 |
_L("210000."), _L("235959.") ) );
|
|
176 |
#ifdef ENABLE_TEXTSTYLES
|
|
177 |
textStyle = iTextStyles[ETextStyleProgram];
|
|
178 |
#endif
|
|
179 |
AddRowL( gridLayout, mtv3Image, programs, start, end, textStyle );
|
|
180 |
programs.Reset();
|
|
181 |
rowHeights.Append( 100 );
|
|
182 |
|
|
183 |
// NELONEN
|
|
184 |
TAlfImage nelonenImage(
|
|
185 |
textureManager.LoadTextureL(
|
|
186 |
KImage2,
|
|
187 |
EAlfTextureFlagRetainResolution,
|
|
188 |
KAlfAutoGeneratedTextureId ) );
|
|
189 |
|
|
190 |
programs.Append( TProgram( _L("TV-chät"),
|
|
191 |
_L("000000."), _L("180000.") ) );
|
|
192 |
programs.Append( TProgram( _L("Leijonamies"),
|
|
193 |
_L("180000."), _L("183000.") ) );
|
|
194 |
programs.Append( TProgram( _L("Tanssi, jos osaat!"),
|
|
195 |
_L("183000."), _L("193000.") ) );
|
|
196 |
programs.Append( TProgram( _L("Nelosen uutiset"),
|
|
197 |
_L("193000."), _L("194500.") ) );
|
|
198 |
programs.Append( TProgram( _L("Nelosen sää"),
|
|
199 |
_L("194500."), _L("195000.") ) );
|
|
200 |
programs.Append( TProgram( _L("IS Urheilu-uutiset"),
|
|
201 |
_L("195000."), _L("195500.") ) );
|
|
202 |
programs.Append( TProgram( _L("B-Studio"),
|
|
203 |
_L("195500."), _L("200000.") ) );
|
|
204 |
programs.Append( TProgram( _L("Unelmien poikamies - upseeri ja herrasmies"),
|
|
205 |
_L("200000."), _L("210000.") ) );
|
|
206 |
programs.Append( TProgram( _L("TV-chät"),
|
|
207 |
_L("210000."), _L("235959.") ) );
|
|
208 |
#ifdef ENABLE_TEXTSTYLES
|
|
209 |
textStyle = iTextStyles[ETextStyleProgram];
|
|
210 |
#endif
|
|
211 |
AddRowL( gridLayout, nelonenImage, programs, start, end, textStyle );
|
|
212 |
programs.Reset();
|
|
213 |
rowHeights.Append( 100 );
|
|
214 |
|
|
215 |
// JIM
|
|
216 |
TAlfImage jimImage(
|
|
217 |
textureManager.LoadTextureL(
|
|
218 |
KImage3,
|
|
219 |
EAlfTextureFlagRetainResolution,
|
|
220 |
KAlfAutoGeneratedTextureId ) );
|
|
221 |
programs.Append( TProgram( _L("TV-chät"),
|
|
222 |
_L("000000."), _L("180000.") ) );
|
|
223 |
programs.Append( TProgram( _L("Hyvää ruokahalua"),
|
|
224 |
_L("180000."), _L("183000.") ) );
|
|
225 |
programs.Append( TProgram( _L("Kiinteistökauppaa maailmalla"),
|
|
226 |
_L("183000."), _L("190000.") ) );
|
|
227 |
programs.Append( TProgram( _L("Autoklassikot"),
|
|
228 |
_L("190000."), _L("193000.") ) );
|
|
229 |
programs.Append( TProgram( _L("Huvila & Huussi Extra"),
|
|
230 |
_L("193000."), _L("200000.") ) );
|
|
231 |
programs.Append( TProgram( _L("Fifth Gear"),
|
|
232 |
_L("200000."), _L("203000.") ) );
|
|
233 |
programs.Append( TProgram( _L("Fifth Gear"),
|
|
234 |
_L("203000."), _L("210000.") ) );
|
|
235 |
programs.Append( TProgram( _L("TV-chät"),
|
|
236 |
_L("210000."), _L("235959.") ) );
|
|
237 |
#ifdef ENABLE_TEXTSTYLES
|
|
238 |
textStyle = iTextStyles[ETextStyleProgram];
|
|
239 |
#endif
|
|
240 |
AddRowL( gridLayout, jimImage, programs, start, end, textStyle );
|
|
241 |
programs.Reset();
|
|
242 |
rowHeights.Append( 100 );
|
|
243 |
|
|
244 |
// MTV3 scifi
|
|
245 |
TAlfImage mtv3scifiImage(
|
|
246 |
textureManager.LoadTextureL(
|
|
247 |
KImage4,
|
|
248 |
EAlfTextureFlagRetainResolution,
|
|
249 |
KAlfAutoGeneratedTextureId ) );
|
|
250 |
programs.Append( TProgram( _L("TV-chät"),
|
|
251 |
_L("000000."), _L("180500.") ) );
|
|
252 |
programs.Append( TProgram( _L("Doctor Who"),
|
|
253 |
_L("180500."), _L("183000.") ) );
|
|
254 |
programs.Append( TProgram( _L("Doctor Who"),
|
|
255 |
_L("183000."), _L("185500.") ) );
|
|
256 |
programs.Append( TProgram( _L("Andromeda"),
|
|
257 |
_L("185500."), _L("194000.") ) );
|
|
258 |
programs.Append( TProgram( _L("Babylon 5"),
|
|
259 |
_L("194000.."), _L("202500.") ) );
|
|
260 |
programs.Append( TProgram( _L("Star Trek: Deep Space Nine"),
|
|
261 |
_L("202500."), _L("211000.") ) );
|
|
262 |
programs.Append( TProgram( _L("TV-chät"),
|
|
263 |
_L("211000."), _L("235959.") ) );
|
|
264 |
#ifdef ENABLE_TEXTSTYLES
|
|
265 |
textStyle = iTextStyles[ETextStyleProgram];
|
|
266 |
#endif
|
|
267 |
AddRowL( gridLayout, mtv3scifiImage, programs, start, end, textStyle );
|
|
268 |
programs.Reset();
|
|
269 |
rowHeights.Append( 100 );
|
|
270 |
|
|
271 |
// DISCOVERY HD
|
|
272 |
TAlfImage discoveryChannelImage(
|
|
273 |
textureManager.LoadTextureL(
|
|
274 |
KImage5,
|
|
275 |
EAlfTextureFlagRetainResolution,
|
|
276 |
KAlfAutoGeneratedTextureId ) );
|
|
277 |
programs.Append( TProgram( _L("TV-chät"),
|
|
278 |
_L("000000."), _L("180000.") ) );
|
|
279 |
programs.Append( TProgram( _L("Tuunaajat"),
|
|
280 |
_L("180000."), _L("190000.") ) );
|
|
281 |
programs.Append( TProgram( _L("Valmistuksen salat"),
|
|
282 |
_L("190000."), _L("193000.") ) );
|
|
283 |
programs.Append( TProgram( _L("Valmistuksen salat"),
|
|
284 |
_L("193000."), _L("200000.") ) );
|
|
285 |
programs.Append( TProgram( _L("Myytinmurtajat"),
|
|
286 |
_L("200000.."), _L("210000.") ) );
|
|
287 |
programs.Append( TProgram( _L("TV-chät"),
|
|
288 |
_L("210000."), _L("235959.") ) );
|
|
289 |
#ifdef ENABLE_TEXTSTYLES
|
|
290 |
textStyle = iTextStyles[ETextStyleProgram];
|
|
291 |
#endif
|
|
292 |
AddRowL( gridLayout, discoveryChannelImage, programs, start, end, textStyle );
|
|
293 |
programs.Reset();
|
|
294 |
rowHeights.Append( 100 );
|
|
295 |
|
|
296 |
// NATIONAL GEOGRAPHIC
|
|
297 |
TAlfImage nationalgeographicImage(
|
|
298 |
textureManager.LoadTextureL(
|
|
299 |
KImage6,
|
|
300 |
EAlfTextureFlagRetainResolution,
|
|
301 |
KAlfAutoGeneratedTextureId ) );
|
|
302 |
programs.Append( TProgram( _L("TV-chät"),
|
|
303 |
_L("000000."), _L("180000.") ) );
|
|
304 |
programs.Append( TProgram( _L("Nat Geo Junior: the Snake Wranglers: Snake Saviour"),
|
|
305 |
_L("180000."), _L("183000.") ) );
|
|
306 |
programs.Append( TProgram( _L("Nat Geo Junior: Get Outta Town: Washington Dc"),
|
|
307 |
_L("183000."), _L("190000.") ) );
|
|
308 |
programs.Append( TProgram( _L("Premiere: Ape Genius"),
|
|
309 |
_L("190000."), _L("200000.") ) );
|
|
310 |
programs.Append( TProgram( _L("Great Wall of China: Protecting the Dragon"),
|
|
311 |
_L("200000.."), _L("210000.") ) );
|
|
312 |
programs.Append( TProgram( _L("TV-chät"),
|
|
313 |
_L("210000."), _L("235959.") ) );
|
|
314 |
#ifdef ENABLE_TEXTSTYLES
|
|
315 |
textStyle = iTextStyles[ETextStyleProgram];
|
|
316 |
#endif
|
|
317 |
AddRowL( gridLayout, nationalgeographicImage, programs, start, end, textStyle );
|
|
318 |
programs.Reset();
|
|
319 |
rowHeights.Append( 100 );
|
|
320 |
|
|
321 |
// Apply rows
|
|
322 |
gridLayout->SetRows( rowHeights.Count() );
|
|
323 |
gridLayout->SetRowsL( rowHeights );
|
|
324 |
|
|
325 |
// Set grid size
|
|
326 |
gridLayout->SetFlag( EAlfVisualFlagManualSize );
|
|
327 |
TAlfRealSize size;
|
|
328 |
size.iWidth = iVisibleArea.iWidth;
|
|
329 |
for( TInt i=0; i<rowHeights.Count(); i++ )
|
|
330 |
{
|
|
331 |
size.iHeight += rowHeights[i];
|
|
332 |
}
|
|
333 |
gridLayout->SetSize( size, 0 );
|
|
334 |
|
|
335 |
// Cleanup
|
|
336 |
rowHeights.Close();
|
|
337 |
programs.Close();
|
|
338 |
}
|
|
339 |
|
|
340 |
const TInt KNumberOfImages = 6;
|
|
341 |
// -----------------------------------------------------------------------------
|
|
342 |
// Notify observers that all images have been loaded.
|
|
343 |
// -----------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
void CAlfPerfAppSuiteEPGControl::TextureLoadingCompleted(
|
|
346 |
CAlfTexture& /*aTexture*/, TInt /*aTextureId*/, TInt aErrorCode)
|
|
347 |
{
|
|
348 |
// inform if there is any error
|
|
349 |
if( aErrorCode != KErrNone )
|
|
350 |
{
|
|
351 |
iScrollControl->ImagesLoaded( aErrorCode );
|
|
352 |
}
|
|
353 |
|
|
354 |
iLoadedImages++;
|
|
355 |
if (iLoadedImages == KNumberOfImages)
|
|
356 |
{
|
|
357 |
iScrollControl->ImagesLoaded( KErrNone );
|
|
358 |
}
|
|
359 |
}
|
|
360 |
|
|
361 |
#ifdef ENABLE_TEXTSTYLES
|
|
362 |
void CAlfPerfAppSuiteEPGControl::CreateTextStylesL()
|
|
363 |
{
|
|
364 |
CAlfTextStyleManager& styleManager = Env().TextStyleManager();
|
|
365 |
|
|
366 |
// Create text styles
|
|
367 |
for( TInt i=0; i<ENumberOfTextStyles; i++ )
|
|
368 |
{
|
|
369 |
iTextStyles.Append( styleManager.CreatePlatformTextStyleL() );
|
|
370 |
}
|
|
371 |
|
|
372 |
// NOTE: This will leak memory
|
|
373 |
// styles are destroyed in TextStyleManager destructor but this is not enough...
|
|
374 |
|
|
375 |
CAlfTextStyle* style = NULL;
|
|
376 |
style = styleManager.TextStyle( iTextStyles[ETextStyleTitle] );
|
|
377 |
style->SetTextSizeInTwips( 120 );
|
|
378 |
|
|
379 |
style = styleManager.TextStyle( iTextStyles[ETextStyleTime] );
|
|
380 |
style->SetTextSizeInTwips( 100 );
|
|
381 |
|
|
382 |
style = styleManager.TextStyle( iTextStyles[ETextStyleProgram] );
|
|
383 |
style->SetTextSizeInTwips( 80 );
|
|
384 |
}
|
|
385 |
#endif
|
|
386 |
|
|
387 |
|
|
388 |
void CAlfPerfAppSuiteEPGControl::AddRowL(
|
|
389 |
CAlfLayout* aParentLayout,
|
|
390 |
TAlfImage& aChannelImage,
|
|
391 |
RArray<TProgram>& aPrograms,
|
|
392 |
const TTime& aTimeWindowStart,
|
|
393 |
const TTime& aTimeWindowEnd,
|
|
394 |
TInt aTextStyle,
|
|
395 |
TBool aSetBorders
|
|
396 |
)
|
|
397 |
{
|
|
398 |
// Create grid layout
|
|
399 |
CAlfGridLayout* gridLayout =
|
|
400 |
CAlfGridLayout::AddNewL( *this, 1, 1, aParentLayout );
|
|
401 |
|
|
402 |
// Set borders
|
|
403 |
if( aSetBorders )
|
|
404 |
{
|
|
405 |
TAlfPerfAppSuiteHelper::AddBorderBrushL( gridLayout, KRgbWhite );
|
|
406 |
}
|
|
407 |
|
|
408 |
// Add channel image
|
|
409 |
CAlfImageVisual* imageVisual = CAlfImageVisual::AddNewL( *this, gridLayout );
|
|
410 |
imageVisual->SetImage( aChannelImage );
|
|
411 |
imageVisual->SetScaleMode( CAlfImageVisual::EScaleFitInside );
|
|
412 |
imageVisual->SetPadding( 2 );
|
|
413 |
RArray<TInt> columnWeights;
|
|
414 |
columnWeights.Append( 1 );
|
|
415 |
|
|
416 |
// Add programs
|
|
417 |
AddProgramsL( gridLayout, aPrograms, aTimeWindowStart, aTimeWindowEnd, aTextStyle, aSetBorders );
|
|
418 |
columnWeights.Append( 9 );
|
|
419 |
|
|
420 |
// Apply columns
|
|
421 |
gridLayout->SetColumns( columnWeights.Count() );
|
|
422 |
gridLayout->SetColumnsL( columnWeights );
|
|
423 |
|
|
424 |
// Cleanup
|
|
425 |
columnWeights.Close();
|
|
426 |
}
|
|
427 |
|
|
428 |
void CAlfPerfAppSuiteEPGControl::AddProgramsL(
|
|
429 |
CAlfLayout* aParentLayout,
|
|
430 |
RArray<TProgram>& aPrograms,
|
|
431 |
const TTime& aTimeWindowStart,
|
|
432 |
const TTime& aTimeWindowEnd,
|
|
433 |
TInt aTextStyle,
|
|
434 |
TBool aSetBorders
|
|
435 |
)
|
|
436 |
{
|
|
437 |
|
|
438 |
// Use viewport layout as a base layout
|
|
439 |
CAlfViewportLayout* viewPortLayout
|
|
440 |
= CAlfViewportLayout::AddNewL( *this, aParentLayout );
|
|
441 |
|
|
442 |
// Set borders
|
|
443 |
if( aSetBorders )
|
|
444 |
{
|
|
445 |
TAlfPerfAppSuiteHelper::AddBorderBrushL( viewPortLayout, KRgbWhite );
|
|
446 |
}
|
|
447 |
|
|
448 |
// Virtual size is 1,1 which represents a 24*60 minute time window.
|
|
449 |
viewPortLayout->SetVirtualSize( TAlfRealSize(1.0f,1.0f), 0 );
|
|
450 |
|
|
451 |
// Calculate how much is visible by the time window.
|
|
452 |
TReal32 displayWindowSize = DurationInMinutes( aTimeWindowStart, aTimeWindowEnd );
|
|
453 |
TReal32 maxWindowSize = 24*60;
|
|
454 |
TReal32 relelativeWindowSize = displayWindowSize / maxWindowSize;
|
|
455 |
viewPortLayout->SetViewportSize( TAlfRealSize( relelativeWindowSize, 1.0f ), 0 );
|
|
456 |
|
|
457 |
// Calculate the offset from beginning.
|
|
458 |
TReal32 displayWindowOffset = DurationInMinutes( aPrograms[0].iStart, aTimeWindowStart );
|
|
459 |
TReal32 pos = displayWindowOffset / maxWindowSize;
|
|
460 |
viewPortLayout->SetViewportPos( TAlfRealPoint( pos, 0.0f ), 0 );
|
|
461 |
|
|
462 |
// Create grid layout
|
|
463 |
CAlfGridLayout* gridLayout =
|
|
464 |
CAlfGridLayout::AddNewL( *this, aPrograms.Count(), 1, viewPortLayout );
|
|
465 |
|
|
466 |
// Add the programs using the duration of the program as column weight.
|
|
467 |
RArray<TInt> columnWeights;
|
|
468 |
for( TInt i=0; i<aPrograms.Count(); i++ )
|
|
469 |
{
|
|
470 |
CAlfTextVisual* textVisual = CAlfTextVisual::AddNewL( *this, gridLayout );
|
|
471 |
textVisual->SetTextL( aPrograms[i].iName );
|
|
472 |
#ifdef ENABLE_TEXTSTYLES
|
|
473 |
textVisual->SetTextStyle( aTextStyle );
|
|
474 |
#endif
|
|
475 |
textVisual->SetWrapping( CAlfTextVisual::ELineWrapBreak );
|
|
476 |
if( aSetBorders )
|
|
477 |
{
|
|
478 |
TAlfPerfAppSuiteHelper::AddBorderBrushL( textVisual, TRgb(0xdddddd) );
|
|
479 |
}
|
|
480 |
columnWeights.Append( aPrograms[i].DurationInMinutes() );
|
|
481 |
}
|
|
482 |
|
|
483 |
// Set column weights
|
|
484 |
gridLayout->SetColumnsL( columnWeights );
|
|
485 |
|
|
486 |
// Cleanup
|
|
487 |
columnWeights.Close();
|
|
488 |
}
|