sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@test
|
sl@0
|
19 |
@internalComponent
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <e32debug.h> //RDebug
|
sl@0
|
23 |
|
sl@0
|
24 |
#include "t_pseudoapputils.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
EXPORT_C void TImportScreenConfig::VerifyFramesPerTraverse(TInt& aFramesPerTraverse, TInt aScreenPixelDimension)
|
sl@0
|
27 |
{
|
sl@0
|
28 |
if(aFramesPerTraverse <= 0 || aFramesPerTraverse > aScreenPixelDimension)
|
sl@0
|
29 |
{
|
sl@0
|
30 |
RDebug::Print(_L("Illegal FramesPerTraverse value of %d Value must be between 1 and %d inclusive\n"), aFramesPerTraverse, aScreenPixelDimension);
|
sl@0
|
31 |
User::Exit(0);
|
sl@0
|
32 |
}
|
sl@0
|
33 |
else
|
sl@0
|
34 |
{
|
sl@0
|
35 |
if(aScreenPixelDimension % aFramesPerTraverse)
|
sl@0
|
36 |
{
|
sl@0
|
37 |
RDebug::Print(_L("Dimension Divisor of %d must be a sub-multiple of the screen pixel dimension %d\n"), aFramesPerTraverse, aScreenPixelDimension);
|
sl@0
|
38 |
User::Exit(0);
|
sl@0
|
39 |
}
|
sl@0
|
40 |
}
|
sl@0
|
41 |
}
|
sl@0
|
42 |
|
sl@0
|
43 |
EXPORT_C void TImportScreenConfig::ReadIni(const TPtrC& aIniParam, TPtrC& aMemberVar, CIniData* aUtils)
|
sl@0
|
44 |
{
|
sl@0
|
45 |
TPtrC readInValue;
|
sl@0
|
46 |
|
sl@0
|
47 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
48 |
{
|
sl@0
|
49 |
RDebug::Print(_L("Could not read %s value from config file, aborting\n"), aIniParam.Ptr());
|
sl@0
|
50 |
User::Exit(0);
|
sl@0
|
51 |
}
|
sl@0
|
52 |
else
|
sl@0
|
53 |
{
|
sl@0
|
54 |
aMemberVar.Set(readInValue);
|
sl@0
|
55 |
}
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
EXPORT_C void TImportScreenConfig::ReadIni(const TDesC& tempStore, const TPtrC& aIniParam, TPtrC& aMemberVar, CIniData* aUtils)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
TBuf<KMaxUiBitmapNameLength> temp = tempStore;
|
sl@0
|
61 |
temp.Append(aIniParam);
|
sl@0
|
62 |
ReadIni(temp, aMemberVar, aUtils);
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
EXPORT_C void TImportScreenConfig::ReadIni(const TPtrC& aIniParam, TInt& aMemberVar, CIniData* aUtils)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
TInt readInValue;
|
sl@0
|
68 |
|
sl@0
|
69 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
70 |
{
|
sl@0
|
71 |
RDebug::Print(_L("Could not read %s value from config file, aborting\n"), aIniParam.Ptr());
|
sl@0
|
72 |
User::Exit(0);
|
sl@0
|
73 |
}
|
sl@0
|
74 |
else
|
sl@0
|
75 |
{
|
sl@0
|
76 |
aMemberVar = readInValue;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
EXPORT_C void TImportScreenConfig::ReadIni(const TDesC& tempStore, const TPtrC& aIniParam, TInt& aMemberVar, CIniData* aUtils)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
TBuf<KMaxUiBitmapNameLength> temp = tempStore;
|
sl@0
|
83 |
temp.Append(aIniParam);
|
sl@0
|
84 |
ReadIni(temp, aMemberVar, aUtils);
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
EXPORT_C void TImportScreenConfig::ReadIni(const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2, TInt& aMemberVar,
|
sl@0
|
88 |
TInt aValue1, TInt aValue2, CIniData* aUtils)
|
sl@0
|
89 |
{
|
sl@0
|
90 |
TPtrC readInValue;
|
sl@0
|
91 |
|
sl@0
|
92 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
93 |
{
|
sl@0
|
94 |
RDebug::Print(_L("Could not read %s value from config file, aborting\n"), aIniParam.Ptr());
|
sl@0
|
95 |
User::Exit(0);
|
sl@0
|
96 |
}
|
sl@0
|
97 |
else
|
sl@0
|
98 |
{
|
sl@0
|
99 |
if(readInValue == aIniValue1)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
aMemberVar = aValue1;
|
sl@0
|
102 |
}
|
sl@0
|
103 |
else
|
sl@0
|
104 |
{
|
sl@0
|
105 |
if(readInValue == aIniValue2)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
aMemberVar = aValue2;
|
sl@0
|
108 |
}
|
sl@0
|
109 |
else
|
sl@0
|
110 |
{
|
sl@0
|
111 |
RDebug::Print(_L("Invalid %s value from config file\n"), aIniParam.Ptr());
|
sl@0
|
112 |
}
|
sl@0
|
113 |
}
|
sl@0
|
114 |
}
|
sl@0
|
115 |
}
|
sl@0
|
116 |
|
sl@0
|
117 |
EXPORT_C void TImportScreenConfig::ReadIni(const TDesC& tempStore, const TPtrC& aIniParam, const TPtrC& aIniValue1,
|
sl@0
|
118 |
const TPtrC& aIniValue2, TInt& aMemberVar, TInt aValue1,
|
sl@0
|
119 |
TInt aValue2, CIniData* aUtils)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
TBuf<KMaxUiBitmapNameLength> temp = tempStore;
|
sl@0
|
122 |
temp.Append(aIniParam);
|
sl@0
|
123 |
ReadIni(temp, aIniValue1, aIniValue2, aMemberVar, aValue1, aValue2, aUtils);
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
EXPORT_C void TImportScreenConfig::ReadIni(const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2, const TPtrC& aIniValue3,
|
sl@0
|
128 |
TInt& aMemberVar, TInt aValue1, TInt aValue2, TInt aValue3, CIniData* aUtils)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
TPtrC readInValue;
|
sl@0
|
131 |
|
sl@0
|
132 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
133 |
{
|
sl@0
|
134 |
RDebug::Print(_L("Could not read %s value from config file, aborting\n"), aIniParam.Ptr());
|
sl@0
|
135 |
User::Exit(0);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
else
|
sl@0
|
138 |
{
|
sl@0
|
139 |
if(readInValue == aIniValue1)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
aMemberVar = aValue1;
|
sl@0
|
142 |
}
|
sl@0
|
143 |
else
|
sl@0
|
144 |
{
|
sl@0
|
145 |
if(readInValue == aIniValue2)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
aMemberVar = aValue2;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
else
|
sl@0
|
150 |
{
|
sl@0
|
151 |
if(readInValue == aIniValue3)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
aMemberVar = aValue3;
|
sl@0
|
154 |
}
|
sl@0
|
155 |
else
|
sl@0
|
156 |
{
|
sl@0
|
157 |
RDebug::Print(_L("Invalid %s value from config file\n"), aIniParam.Ptr());
|
sl@0
|
158 |
}
|
sl@0
|
159 |
}
|
sl@0
|
160 |
}
|
sl@0
|
161 |
}
|
sl@0
|
162 |
}
|
sl@0
|
163 |
|
sl@0
|
164 |
EXPORT_C void TImportScreenConfig::ReadIni(const TDesC& tempStore, const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2,
|
sl@0
|
165 |
const TPtrC& aIniValue3, TInt& aMemberVar, TInt aValue1, TInt aValue2,
|
sl@0
|
166 |
TInt aValue3, CIniData* aUtils)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
TBuf<KMaxUiBitmapNameLength> temp = tempStore;
|
sl@0
|
169 |
temp.Append(aIniParam);
|
sl@0
|
170 |
ReadIni(temp, aIniValue1, aIniValue2, aIniValue3, aMemberVar, aValue1, aValue2, aValue3, aUtils);
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
EXPORT_C void TImportScreenConfig::ReadIni(const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2, const TPtrC& aIniValue3,
|
sl@0
|
174 |
const TPtrC& aIniValue4, TInt& aMemberVar, TInt aValue1, TInt aValue2,
|
sl@0
|
175 |
TInt aValue3, TInt aValue4, CIniData* aUtils)
|
sl@0
|
176 |
{
|
sl@0
|
177 |
TPtrC readInValue;
|
sl@0
|
178 |
|
sl@0
|
179 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
180 |
{
|
sl@0
|
181 |
RDebug::Print(_L("Could not read %s value from config file, aborting\n"), aIniParam.Ptr());
|
sl@0
|
182 |
User::Exit(0);
|
sl@0
|
183 |
}
|
sl@0
|
184 |
else
|
sl@0
|
185 |
{
|
sl@0
|
186 |
if(readInValue == aIniValue1)
|
sl@0
|
187 |
{
|
sl@0
|
188 |
aMemberVar = aValue1;
|
sl@0
|
189 |
}
|
sl@0
|
190 |
else
|
sl@0
|
191 |
{
|
sl@0
|
192 |
if(readInValue == aIniValue2)
|
sl@0
|
193 |
{
|
sl@0
|
194 |
aMemberVar = aValue2;
|
sl@0
|
195 |
}
|
sl@0
|
196 |
else
|
sl@0
|
197 |
{
|
sl@0
|
198 |
if(readInValue == aIniValue3)
|
sl@0
|
199 |
{
|
sl@0
|
200 |
aMemberVar = aValue3;
|
sl@0
|
201 |
}
|
sl@0
|
202 |
else
|
sl@0
|
203 |
{
|
sl@0
|
204 |
if(readInValue == aIniValue4)
|
sl@0
|
205 |
{
|
sl@0
|
206 |
aMemberVar = aValue4;
|
sl@0
|
207 |
}
|
sl@0
|
208 |
else
|
sl@0
|
209 |
{
|
sl@0
|
210 |
RDebug::Print(_L("Invalid %s value from config file\n"), aIniParam.Ptr());
|
sl@0
|
211 |
}
|
sl@0
|
212 |
}
|
sl@0
|
213 |
}
|
sl@0
|
214 |
}
|
sl@0
|
215 |
}
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
EXPORT_C void TImportScreenConfig::ReadIni(const TDesC& tempStore, const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2,
|
sl@0
|
219 |
const TPtrC& aIniValue3, const TPtrC& aIniValue4, TInt& aMemberVar,
|
sl@0
|
220 |
TInt aValue1, TInt aValue2, TInt aValue3,
|
sl@0
|
221 |
TInt aValue4, CIniData* aUtils)
|
sl@0
|
222 |
{
|
sl@0
|
223 |
TBuf<KMaxUiBitmapNameLength> temp = tempStore;
|
sl@0
|
224 |
temp.Append(aIniParam);
|
sl@0
|
225 |
ReadIni(temp, aIniValue1, aIniValue2, aIniValue3, aIniValue4, aMemberVar, aValue1, aValue2, aValue3, aValue4, aUtils);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
|
sl@0
|
228 |
EXPORT_C void TImportScreenConfig::ReadIni(const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2, const TPtrC& aIniValue3,
|
sl@0
|
229 |
const TPtrC& aIniValue4, const TPtrC& aIniValue5, TInt& aMemberVar, TInt aValue1,
|
sl@0
|
230 |
TInt aValue2, TInt aValue3, TInt aValue4, TInt aValue5, CIniData* aUtils)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
TPtrC readInValue;
|
sl@0
|
233 |
|
sl@0
|
234 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
235 |
{
|
sl@0
|
236 |
RDebug::Print(_L("Could not read %s value from config file, aborting\n"), aIniParam.Ptr());
|
sl@0
|
237 |
User::Exit(0);
|
sl@0
|
238 |
}
|
sl@0
|
239 |
else
|
sl@0
|
240 |
{
|
sl@0
|
241 |
if(readInValue == aIniValue1)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
aMemberVar = aValue1;
|
sl@0
|
244 |
}
|
sl@0
|
245 |
else
|
sl@0
|
246 |
{
|
sl@0
|
247 |
if(readInValue == aIniValue2)
|
sl@0
|
248 |
{
|
sl@0
|
249 |
aMemberVar = aValue2;
|
sl@0
|
250 |
}
|
sl@0
|
251 |
else
|
sl@0
|
252 |
{
|
sl@0
|
253 |
if(readInValue == aIniValue3)
|
sl@0
|
254 |
{
|
sl@0
|
255 |
aMemberVar = aValue3;
|
sl@0
|
256 |
}
|
sl@0
|
257 |
else
|
sl@0
|
258 |
{
|
sl@0
|
259 |
if(readInValue == aIniValue4)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
aMemberVar = aValue4;
|
sl@0
|
262 |
}
|
sl@0
|
263 |
else
|
sl@0
|
264 |
{
|
sl@0
|
265 |
if(readInValue == aIniValue5)
|
sl@0
|
266 |
{
|
sl@0
|
267 |
aMemberVar = aValue5;
|
sl@0
|
268 |
}
|
sl@0
|
269 |
else
|
sl@0
|
270 |
{
|
sl@0
|
271 |
RDebug::Print(_L("Invalid %s value from config file\n"), aIniParam.Ptr());
|
sl@0
|
272 |
}
|
sl@0
|
273 |
}
|
sl@0
|
274 |
}
|
sl@0
|
275 |
}
|
sl@0
|
276 |
}
|
sl@0
|
277 |
}
|
sl@0
|
278 |
}
|
sl@0
|
279 |
|
sl@0
|
280 |
EXPORT_C void TImportScreenConfig::ReadIni(const TDesC& tempStore, const TPtrC& aIniParam, const TPtrC& aIniValue1, const TPtrC& aIniValue2,
|
sl@0
|
281 |
const TPtrC& aIniValue3, const TPtrC& aIniValue4, const TPtrC& aIniValue5, TInt& aMemberVar,
|
sl@0
|
282 |
TInt aValue1, TInt aValue2, TInt aValue3, TInt aValue4,
|
sl@0
|
283 |
TInt aValue5, CIniData* aUtils)
|
sl@0
|
284 |
{
|
sl@0
|
285 |
TBuf<KMaxUiBitmapNameLength> temp = tempStore;
|
sl@0
|
286 |
temp.Append(aIniParam);
|
sl@0
|
287 |
ReadIni(temp, aIniValue1, aIniValue2, aIniValue3, aIniValue4, aIniValue5, aMemberVar, aValue1, aValue2, aValue3, aValue4, aValue5, aUtils);
|
sl@0
|
288 |
}
|
sl@0
|
289 |
|
sl@0
|
290 |
EXPORT_C TInt TImportScreenConfig::Numeral(TInt val, TInt& aDigit)
|
sl@0
|
291 |
{
|
sl@0
|
292 |
if( (val > 47) && (val < 58) )
|
sl@0
|
293 |
{
|
sl@0
|
294 |
aDigit = val - 48; //ascii to int conversion trick
|
sl@0
|
295 |
return KErrNone;
|
sl@0
|
296 |
}
|
sl@0
|
297 |
else if(val == 45)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
aDigit = -1; //ascii code 45 is a minus sign
|
sl@0
|
300 |
return KErrNone;
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
return KErrNotFound;
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
EXPORT_C TInt TImportScreenConfig::ExtractNumber(const TPtrC& aRectTextString, TInt& aSearchFrom, TInt& aNumber)
|
sl@0
|
307 |
{
|
sl@0
|
308 |
TInt initFlag = 0;
|
sl@0
|
309 |
TInt digit;
|
sl@0
|
310 |
aNumber = 0;
|
sl@0
|
311 |
TInt sign = 1;
|
sl@0
|
312 |
|
sl@0
|
313 |
for(TInt i=aSearchFrom; i<aRectTextString.Length(); i++)
|
sl@0
|
314 |
{
|
sl@0
|
315 |
if(Numeral(aRectTextString[i], digit) != KErrNotFound)
|
sl@0
|
316 |
{
|
sl@0
|
317 |
if(initFlag == 0)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
initFlag = 1;
|
sl@0
|
320 |
if(digit == -1)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
sign = digit;
|
sl@0
|
323 |
}
|
sl@0
|
324 |
else
|
sl@0
|
325 |
{
|
sl@0
|
326 |
aNumber = digit;
|
sl@0
|
327 |
}
|
sl@0
|
328 |
}
|
sl@0
|
329 |
else
|
sl@0
|
330 |
{
|
sl@0
|
331 |
if(digit == -1)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
RDebug::Print(_L("Error - cannot read value from string, spurious minus sign\n"));
|
sl@0
|
334 |
return KErrNotFound;
|
sl@0
|
335 |
}
|
sl@0
|
336 |
else
|
sl@0
|
337 |
{
|
sl@0
|
338 |
aNumber = aNumber*10 + digit*sign;
|
sl@0
|
339 |
}
|
sl@0
|
340 |
}
|
sl@0
|
341 |
}
|
sl@0
|
342 |
else
|
sl@0
|
343 |
{
|
sl@0
|
344 |
if(initFlag == 1)
|
sl@0
|
345 |
{
|
sl@0
|
346 |
aSearchFrom = i + 1;
|
sl@0
|
347 |
return KErrNone;
|
sl@0
|
348 |
}
|
sl@0
|
349 |
}
|
sl@0
|
350 |
}
|
sl@0
|
351 |
|
sl@0
|
352 |
if(initFlag == 1)
|
sl@0
|
353 |
{
|
sl@0
|
354 |
return KErrNone;
|
sl@0
|
355 |
}
|
sl@0
|
356 |
return KErrNotFound;
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
EXPORT_C TInt TImportScreenConfig::ExtractRect(const TPtrC& aRectTextString, TRect& aRect, const TSize& aScreenSize)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
TInt searchFrom = 0;
|
sl@0
|
362 |
TInt number = 0;
|
sl@0
|
363 |
TInt pointvalue[4] = {0};
|
sl@0
|
364 |
|
sl@0
|
365 |
for(TInt i=0; i<4; i++)
|
sl@0
|
366 |
{
|
sl@0
|
367 |
if(ExtractNumber(aRectTextString, searchFrom, number) == KErrNotFound)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
RDebug::Print(_L("Error - cannot read rectangle dimensions from string, setting to zero size\n"));
|
sl@0
|
370 |
aRect = TRect(0,0,0,0);
|
sl@0
|
371 |
return KErrNotFound;
|
sl@0
|
372 |
}
|
sl@0
|
373 |
else
|
sl@0
|
374 |
{
|
sl@0
|
375 |
pointvalue[i] = number;
|
sl@0
|
376 |
}
|
sl@0
|
377 |
}
|
sl@0
|
378 |
|
sl@0
|
379 |
aRect = TRect(TPoint((pointvalue[0]*aScreenSize.iWidth)/100, (pointvalue[2]*aScreenSize.iHeight)/100)
|
sl@0
|
380 |
,TPoint((pointvalue[1]*aScreenSize.iWidth)/100, (pointvalue[3]*aScreenSize.iHeight)/100));
|
sl@0
|
381 |
|
sl@0
|
382 |
return KErrNone;
|
sl@0
|
383 |
}
|
sl@0
|
384 |
|
sl@0
|
385 |
EXPORT_C TInt TImportScreenConfig::ExtractAspectRatio(const TPtrC& aRatioString, TSize& aAspectRatio)
|
sl@0
|
386 |
{
|
sl@0
|
387 |
TInt searchFrom = 0;
|
sl@0
|
388 |
TInt number = 0;
|
sl@0
|
389 |
TInt pointvalue[2] = {0};
|
sl@0
|
390 |
|
sl@0
|
391 |
for(TInt i=0; i<2; i++)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
if(ExtractNumber(aRatioString, searchFrom, number) == KErrNotFound)
|
sl@0
|
394 |
{
|
sl@0
|
395 |
RDebug::Print(_L("Error - cannot read aspect ratio dimensions from string\n"));
|
sl@0
|
396 |
return KErrNotFound;
|
sl@0
|
397 |
}
|
sl@0
|
398 |
else
|
sl@0
|
399 |
{
|
sl@0
|
400 |
pointvalue[i] = number;
|
sl@0
|
401 |
}
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
aAspectRatio = TSize(pointvalue[0], pointvalue[1]);
|
sl@0
|
405 |
return KErrNone;
|
sl@0
|
406 |
}
|
sl@0
|
407 |
|
sl@0
|
408 |
EXPORT_C TInt TImportScreenConfig::ExtractPoint(const TPtrC& aPointString, TPoint& aPoint)
|
sl@0
|
409 |
{
|
sl@0
|
410 |
TInt searchFrom = 0;
|
sl@0
|
411 |
TInt number = 0;
|
sl@0
|
412 |
TInt pointvalue[2] = {0};
|
sl@0
|
413 |
|
sl@0
|
414 |
for(TInt i=0; i<2; i++)
|
sl@0
|
415 |
{
|
sl@0
|
416 |
if(ExtractNumber(aPointString, searchFrom, number) == KErrNotFound)
|
sl@0
|
417 |
{
|
sl@0
|
418 |
RDebug::Print(_L("Error - cannot read point dimensions from string\n"));
|
sl@0
|
419 |
return KErrNotFound;
|
sl@0
|
420 |
}
|
sl@0
|
421 |
else
|
sl@0
|
422 |
{
|
sl@0
|
423 |
pointvalue[i] = number;
|
sl@0
|
424 |
}
|
sl@0
|
425 |
}
|
sl@0
|
426 |
|
sl@0
|
427 |
aPoint = TPoint(pointvalue[0], pointvalue[1]);
|
sl@0
|
428 |
return KErrNone;
|
sl@0
|
429 |
}
|
sl@0
|
430 |
|
sl@0
|
431 |
EXPORT_C TInt TImportScreenConfig::ExtractSize(const TPtrC& aSizeString, TSize& aSize)
|
sl@0
|
432 |
{
|
sl@0
|
433 |
TInt searchFrom = 0;
|
sl@0
|
434 |
TInt number = 0;
|
sl@0
|
435 |
TInt pointvalue[2] = {0};
|
sl@0
|
436 |
|
sl@0
|
437 |
for(TInt i=0; i<2; i++)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
if(ExtractNumber(aSizeString, searchFrom, number) == KErrNotFound)
|
sl@0
|
440 |
{
|
sl@0
|
441 |
RDebug::Print(_L("Error - cannot read size dimensions from string\n"));
|
sl@0
|
442 |
return KErrNotFound;
|
sl@0
|
443 |
}
|
sl@0
|
444 |
else
|
sl@0
|
445 |
{
|
sl@0
|
446 |
pointvalue[i] = number;
|
sl@0
|
447 |
}
|
sl@0
|
448 |
}
|
sl@0
|
449 |
|
sl@0
|
450 |
aSize = TSize(pointvalue[0], pointvalue[1]);
|
sl@0
|
451 |
return KErrNone;
|
sl@0
|
452 |
}
|
sl@0
|
453 |
|
sl@0
|
454 |
TInt TImportScreenConfig::ReadIniAllowMissing(const TPtrC& aIniParam, TPtrC& aMemberVar, CIniData* aUtils)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
TPtrC readInValue;
|
sl@0
|
457 |
|
sl@0
|
458 |
if(!aUtils->FindVar(KSimVideoConfigSectionName, aIniParam, readInValue))
|
sl@0
|
459 |
{
|
sl@0
|
460 |
RDebug::Print(_L("%s value not found in config file\n"), aIniParam.Ptr());
|
sl@0
|
461 |
return KErrNotFound;
|
sl@0
|
462 |
}
|
sl@0
|
463 |
else
|
sl@0
|
464 |
{
|
sl@0
|
465 |
aMemberVar.Set(readInValue);
|
sl@0
|
466 |
return KErrNone;
|
sl@0
|
467 |
}
|
sl@0
|
468 |
}
|
sl@0
|
469 |
|
sl@0
|
470 |
TBool TImportScreenConfig::GetShareSurfaceInfoL(TInt aScreenNo, TInt aWindowNo, TInt& aShareScreenNumber, TInt& aShareWindowNumber, CIniData* aUtils)
|
sl@0
|
471 |
{
|
sl@0
|
472 |
TBuf<KMaxUiBitmapNameLength> tempStore;
|
sl@0
|
473 |
tempStore.Format(KScreenSurface, aScreenNo, aWindowNo);
|
sl@0
|
474 |
tempStore.Append(_L("share_surface"));
|
sl@0
|
475 |
TPtrC shareSurfaceString;
|
sl@0
|
476 |
TInt res = ReadIniAllowMissing(tempStore, shareSurfaceString, aUtils);
|
sl@0
|
477 |
|
sl@0
|
478 |
if(res == KErrNotFound)
|
sl@0
|
479 |
{
|
sl@0
|
480 |
RDebug::Print(_L("%s value not found in config file\n"), tempStore.Ptr());
|
sl@0
|
481 |
return EFalse;
|
sl@0
|
482 |
}
|
sl@0
|
483 |
else if(res != KErrNone)
|
sl@0
|
484 |
{
|
sl@0
|
485 |
RDebug::Print(_L("Could not read %s value correctly from config file, aborting\n"), tempStore.Ptr());
|
sl@0
|
486 |
User::Exit(0);
|
sl@0
|
487 |
}
|
sl@0
|
488 |
|
sl@0
|
489 |
// Format of aShareSurfaceString should be "screenX_windowY"
|
sl@0
|
490 |
TInt searchFrom = 5;
|
sl@0
|
491 |
TInt ret = ExtractNumber(shareSurfaceString, searchFrom, aShareScreenNumber);
|
sl@0
|
492 |
if(KErrNone != ret)
|
sl@0
|
493 |
{
|
sl@0
|
494 |
RDebug::Print(_L("Error - cannot read screen number from shared_surface string\n"));
|
sl@0
|
495 |
User::Exit(0);
|
sl@0
|
496 |
}
|
sl@0
|
497 |
|
sl@0
|
498 |
ret = ExtractNumber(shareSurfaceString, searchFrom, aShareWindowNumber);
|
sl@0
|
499 |
if(KErrNone != ret)
|
sl@0
|
500 |
{
|
sl@0
|
501 |
RDebug::Print(_L("Error - cannot read window number from shared_surface string\n"));
|
sl@0
|
502 |
User::Exit(0);
|
sl@0
|
503 |
}
|
sl@0
|
504 |
|
sl@0
|
505 |
// Read screen number and window number correctly - surface is shared
|
sl@0
|
506 |
return ETrue;
|
sl@0
|
507 |
}
|