0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the utility applications of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
// INCLUDE FILES
|
|
43 |
|
|
44 |
#include <avkon.rsg>
|
|
45 |
#include <avkon.hrh>
|
|
46 |
#include "pm_mapper.hrh"
|
|
47 |
#include "pm_mapperapp.h"
|
|
48 |
#include "pm_mapperview.h"
|
|
49 |
#include <pm_mapper.rsg>
|
|
50 |
|
|
51 |
#include <BldVariant.hrh>
|
|
52 |
|
|
53 |
#include <w32std.h>
|
|
54 |
#include <apgwgnam.h>
|
|
55 |
#include <eikstart.h>
|
|
56 |
#include <eikenv.h>
|
|
57 |
#include <f32file.h>
|
|
58 |
|
|
59 |
#include <avkon.hrh>
|
|
60 |
#include <aknenv.h>
|
|
61 |
|
|
62 |
#include <aknnotedialog.h>
|
|
63 |
#include <stringloader.h>
|
|
64 |
#include <coneresloader.h>
|
|
65 |
#include <aknglobalnote.h>
|
|
66 |
|
|
67 |
#include <CentralRepository.h>
|
|
68 |
#include <AvkonInternalCRKeys.h> // KAknLayoutId
|
|
69 |
|
|
70 |
#include <Aknsutils.h>
|
|
71 |
#include <AknUtils.h>
|
|
72 |
#include "pixel_metrics.h"
|
|
73 |
|
|
74 |
#include <avkon.mbg>
|
|
75 |
|
|
76 |
#include <AknLayoutConfig.h>
|
|
77 |
#include <aknsgcc.h>
|
|
78 |
|
|
79 |
typedef TBuf<2048> TMySmallBuffer;
|
|
80 |
typedef TBuf<8192> TMyBigBuffer;
|
|
81 |
|
|
82 |
_LIT(KLayoutSourceFileAndPath, "\\private\\2002121f\\pm_layout.cpp");
|
|
83 |
_LIT(KPixelMetricsDataFiles, "\\private\\2002121f\\*.txt");
|
|
84 |
_LIT(KOpenBrace, "{");
|
|
85 |
_LIT(KComma, ",");
|
|
86 |
_LIT(KColon, ":");
|
|
87 |
_LIT(KTab, "\t");
|
|
88 |
_LIT(KEndBraceWithCommaAndCRLF, "},\n");
|
|
89 |
_LIT(KCRLF, "\n");
|
|
90 |
|
|
91 |
// Number of header lines in layout data.
|
|
92 |
const TInt KHeaderValues = 5;
|
|
93 |
|
|
94 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
95 |
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
// C++ constructor can NOT contain any code, that
|
|
98 |
// might leave.
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
CPixelMetricsMapperAppUi::CPixelMetricsMapperAppUi() : iFileOutputOn(EFalse)
|
|
102 |
{
|
|
103 |
}
|
|
104 |
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
// Destructor.
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
CPixelMetricsMapperAppUi::~CPixelMetricsMapperAppUi()
|
|
110 |
{
|
|
111 |
}
|
|
112 |
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
// Symbian 2nd phase constructor can leave.
|
|
115 |
// -----------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
void CPixelMetricsMapperAppUi::ConstructL()
|
|
118 |
{
|
|
119 |
BaseConstructL();
|
|
120 |
|
|
121 |
CEikonEnv& eikEnv = *CEikonEnv::Static();
|
|
122 |
|
|
123 |
eikEnv.WsSession().ComputeMode(
|
|
124 |
RWsSession::EPriorityControlDisabled );
|
|
125 |
RThread().SetProcessPriority( EPriorityHigh );
|
|
126 |
|
|
127 |
CPixelMetricsMapperView* view = new( ELeave ) CPixelMetricsMapperView;
|
|
128 |
CleanupStack::PushL( view );
|
|
129 |
view->ConstructL();
|
|
130 |
CleanupStack::Pop(); // view
|
|
131 |
AddViewL(view); // transfer ownership to CAknViewAppUi
|
|
132 |
iView = view;
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
TKeyResponse CPixelMetricsMapperAppUi::HandleKeyEventL(
|
|
140 |
const TKeyEvent& /*aKeyEvent*/,
|
|
141 |
TEventCode aType )
|
|
142 |
{
|
|
143 |
return EKeyWasNotConsumed;
|
|
144 |
}
|
|
145 |
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
|
|
151 |
{
|
|
152 |
switch ( aCommand )
|
|
153 |
{
|
|
154 |
case EAknSoftkeyExit:
|
|
155 |
case EEikCmdExit:
|
|
156 |
Exit();
|
|
157 |
break;
|
|
158 |
case ECmdSwitchOutput:
|
|
159 |
iFileOutputOn = !iFileOutputOn;
|
|
160 |
break;
|
|
161 |
case ECmdStatus:
|
|
162 |
{
|
|
163 |
ClearL();
|
|
164 |
|
|
165 |
// layout
|
|
166 |
CRepository* repository = NULL;
|
|
167 |
TInt value = KErrNotFound;
|
|
168 |
TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
|
|
169 |
if (ret == KErrNone)
|
|
170 |
{
|
|
171 |
ret = repository->Get(KAknLayoutId, value);
|
|
172 |
}
|
|
173 |
delete repository;
|
|
174 |
ret= 0;
|
|
175 |
HBufC* buffer = HBufC::NewLC( 100 );
|
|
176 |
TPtr bufferPtr = buffer->Des();
|
|
177 |
bufferPtr.Append(_L("Layout: "));
|
|
178 |
if (ret==KErrNone)
|
|
179 |
{
|
|
180 |
bufferPtr.AppendNum(value);
|
|
181 |
}
|
|
182 |
else
|
|
183 |
{
|
|
184 |
bufferPtr.Append(_L("(error) "));
|
|
185 |
bufferPtr.AppendNum(ret);
|
|
186 |
}
|
|
187 |
TBool last = ETrue;
|
|
188 |
ShowL( *buffer, last );
|
|
189 |
bufferPtr.Zero();
|
|
190 |
|
|
191 |
// Orientation
|
|
192 |
bufferPtr.Append(_L("Orientation: "));
|
|
193 |
bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation());
|
|
194 |
ShowL( *buffer, last );
|
|
195 |
bufferPtr.Zero();
|
|
196 |
|
|
197 |
// Output
|
|
198 |
bufferPtr.Append(_L("Output: "));
|
|
199 |
if (iFileOutputOn) bufferPtr.Append(_L("File"));
|
|
200 |
else bufferPtr.Append(_L("Screen"));
|
|
201 |
ShowL( *buffer, last );
|
|
202 |
bufferPtr.Zero();
|
|
203 |
|
|
204 |
// Automode
|
|
205 |
bufferPtr.Append(_L("AutoMode: "));
|
|
206 |
bufferPtr.AppendNum((TInt)iAutoMode);
|
|
207 |
ShowL( *buffer, last );
|
|
208 |
bufferPtr.Zero();
|
|
209 |
|
|
210 |
CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
|
|
211 |
TInt hashValue = localAppScreenMode.ScreenStyleHash();
|
|
212 |
TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
|
|
213 |
TSize pixelSize = pixels.iPixelSize;
|
|
214 |
|
|
215 |
bufferPtr.Append(_L("LayoutName: "));
|
|
216 |
|
|
217 |
if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&&
|
|
218 |
(pixelSize.iHeight == 320 || pixelSize.iHeight == 240 ))
|
|
219 |
{
|
|
220 |
if (hashValue==0x996F7AA7)
|
|
221 |
bufferPtr.Append(_L("QVGA2"));
|
|
222 |
else
|
|
223 |
bufferPtr.Append(_L("QVGA1"));
|
|
224 |
}
|
|
225 |
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&&
|
|
226 |
(pixelSize.iHeight == 360 || pixelSize.iHeight == 640 ))
|
|
227 |
{
|
|
228 |
bufferPtr.Append(_L("nHD"));
|
|
229 |
}
|
|
230 |
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&&
|
|
231 |
(pixelSize.iHeight == 480 || pixelSize.iHeight == 640 ))
|
|
232 |
{
|
|
233 |
bufferPtr.Append(_L("VGA"));
|
|
234 |
}
|
|
235 |
else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&&
|
|
236 |
(pixelSize.iHeight == 800 || pixelSize.iHeight == 352 ))
|
|
237 |
{
|
|
238 |
bufferPtr.Append(_L("E90"));
|
|
239 |
}
|
|
240 |
else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 ||
|
|
241 |
pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&&
|
|
242 |
(pixelSize.iHeight == 320 || pixelSize.iHeight == 480 ||
|
|
243 |
pixelSize.iHeight == 240 || pixelSize.iHeight == 640))
|
|
244 |
{
|
|
245 |
bufferPtr.Append(_L("HVGA"));
|
|
246 |
}
|
|
247 |
else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 ||
|
|
248 |
pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&&
|
|
249 |
(pixelSize.iHeight == 800 || pixelSize.iHeight == 480 ||
|
|
250 |
pixelSize.iHeight == 848 || pixelSize.iHeight == 854))
|
|
251 |
{
|
|
252 |
bufferPtr.Append(_L("WVGA"));
|
|
253 |
}
|
|
254 |
else
|
|
255 |
{
|
|
256 |
bufferPtr.Append(_L("Unknown"));
|
|
257 |
}
|
|
258 |
|
|
259 |
ShowL( *buffer, last );
|
|
260 |
bufferPtr.Zero();
|
|
261 |
CleanupStack::PopAndDestroy( buffer );
|
|
262 |
}
|
|
263 |
break;
|
|
264 |
case ECmdSwitchMirroring:
|
|
265 |
{
|
|
266 |
// set the shared data value
|
|
267 |
CRepository* repository = NULL;
|
|
268 |
TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
|
|
269 |
if (ret == KErrNone)
|
|
270 |
{
|
|
271 |
TInt value = KErrNotFound;
|
|
272 |
repository->Get(KAknLayoutId, value);
|
|
273 |
if ( value == EAknLayoutIdELAF)
|
|
274 |
{
|
|
275 |
value = EAknLayoutIdABRW;
|
|
276 |
}
|
|
277 |
else if (value ==EAknLayoutIdABRW)
|
|
278 |
{
|
|
279 |
value = EAknLayoutIdELAF;
|
|
280 |
}
|
|
281 |
ret = repository->Set(KAknLayoutId, value);
|
|
282 |
}
|
|
283 |
delete repository;
|
|
284 |
// now inform all open apps of the switch
|
|
285 |
TWsEvent event;
|
|
286 |
event.SetType(KEikDynamicLayoutVariantSwitch);
|
|
287 |
iEikonEnv->WsSession().SendEventToAllWindowGroups(event);
|
|
288 |
}
|
|
289 |
break;
|
|
290 |
case ECmdSwitchOrientation:
|
|
291 |
{
|
|
292 |
ClearL();
|
|
293 |
#ifndef __SERIES60_31__
|
|
294 |
if (!iAvkonAppUi->OrientationCanBeChanged())
|
|
295 |
{
|
|
296 |
HBufC* buffer = HBufC::NewLC( 100 );
|
|
297 |
TPtr bufferPtr = buffer->Des();
|
|
298 |
bufferPtr.Append(_L("Orientation cannot be changed."));
|
|
299 |
TBool last = EFalse;
|
|
300 |
ShowL( *buffer, last );
|
|
301 |
bufferPtr.Zero();
|
|
302 |
delete buffer;
|
|
303 |
}
|
|
304 |
#endif //__SERIES60_31__
|
|
305 |
if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
|
|
306 |
{
|
|
307 |
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
|
|
308 |
}
|
|
309 |
else if (iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationLandscape)
|
|
310 |
{
|
|
311 |
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait);
|
|
312 |
}
|
|
313 |
else
|
|
314 |
{
|
|
315 |
// unspecified
|
|
316 |
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
|
|
317 |
/*User::After(100000);
|
|
318 |
HBufC* buffer = HBufC::NewLC( 100 );
|
|
319 |
TPtr bufferPtr = buffer->Des();
|
|
320 |
bufferPtr.Append(_L("Orientation unspecified."));
|
|
321 |
TBool last = EFalse;
|
|
322 |
ShowL( *buffer, last );
|
|
323 |
bufferPtr.Zero();
|
|
324 |
delete buffer;*/
|
|
325 |
}
|
|
326 |
break;
|
|
327 |
}
|
|
328 |
case ECmdStartCalculations:
|
|
329 |
{
|
|
330 |
ClearL();
|
|
331 |
// Get known values
|
|
332 |
TInt index = 0;
|
|
333 |
TBool last = EFalse;
|
|
334 |
if (iFileOutputOn)
|
|
335 |
{
|
|
336 |
TRect screenRect;
|
|
337 |
AknLayoutUtils::LayoutMetricsRect(
|
|
338 |
AknLayoutUtils::EApplicationWindow,
|
|
339 |
screenRect );
|
|
340 |
|
|
341 |
// Add screen dimensions
|
|
342 |
TInt height = screenRect.Height();
|
|
343 |
TInt width = screenRect.Width();
|
|
344 |
TBuf16<32> tgt;
|
|
345 |
// HEIGTH
|
|
346 |
tgt.Append(_L("height: \t"));
|
|
347 |
tgt.AppendNum(height, EDecimal); // put max height into text file
|
|
348 |
ShowL( tgt, last );
|
|
349 |
tgt.Zero();
|
|
350 |
// WIDTH
|
|
351 |
tgt.Append(_L("width: \t"));
|
|
352 |
tgt.AppendNum(width, EDecimal); // put max width into text file
|
|
353 |
ShowL( tgt, last );
|
|
354 |
tgt.Zero();
|
|
355 |
// VERSION
|
|
356 |
TPixelMetricsVersion version = PixelMetrics::Version();
|
|
357 |
tgt.Append(_L("major_version: \t"));
|
|
358 |
tgt.AppendNum(version.majorVersion, EDecimal); // put major version into text file
|
|
359 |
ShowL( tgt, last );
|
|
360 |
tgt.Zero();
|
|
361 |
tgt.Append(_L("minor_version: \t"));
|
|
362 |
tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file
|
|
363 |
ShowL( tgt, last );
|
|
364 |
tgt.Zero();
|
|
365 |
// MIRRORED
|
|
366 |
TBool mirrored = AknLayoutUtils::LayoutMirrored();
|
|
367 |
tgt.Append(_L("mirrored: \t"));
|
|
368 |
tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file
|
|
369 |
ShowL( tgt, last );
|
|
370 |
tgt.Zero();
|
|
371 |
}
|
|
372 |
|
|
373 |
TInt myValue = KErrNotFound;
|
|
374 |
for (;;)
|
|
375 |
{
|
|
376 |
if (index==QStyle::PM_Custom_ThinLineWidth)
|
|
377 |
{
|
|
378 |
last = ETrue;
|
|
379 |
}
|
|
380 |
myValue = PixelMetrics::PixelMetricValue(static_cast<QStyle::PixelMetric>(index));
|
|
381 |
ShowSingleValueL( index, myValue, last );
|
|
382 |
|
|
383 |
if (last) break;
|
|
384 |
// if last before custom values, "jump" to custom base
|
|
385 |
if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase;
|
|
386 |
index++;
|
|
387 |
}
|
|
388 |
if (iAutoMode && !iMode)
|
|
389 |
{
|
|
390 |
HandleCommandL(ECmdSwitchMirroring);
|
|
391 |
iMode = ETrue;
|
|
392 |
}
|
|
393 |
}
|
|
394 |
break;
|
|
395 |
case ECmdCreateHeaderFile:
|
|
396 |
CreateHeaderFileL();
|
|
397 |
break;
|
|
398 |
case ECmdSetAutoMode:
|
|
399 |
iAutoMode = !iAutoMode;
|
|
400 |
default:
|
|
401 |
break;
|
|
402 |
}
|
|
403 |
}
|
|
404 |
void CPixelMetricsMapperAppUi::DoAutoOperationL()
|
|
405 |
{
|
|
406 |
HandleCommandL(ECmdStartCalculations);
|
|
407 |
iMode = EFalse;
|
|
408 |
HandleCommandL(ECmdSwitchMirroring);
|
|
409 |
}
|
|
410 |
|
|
411 |
TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const
|
|
412 |
{
|
|
413 |
return (iAutoMode && iMode);
|
|
414 |
}
|
|
415 |
|
|
416 |
// -----------------------------------------------------------------------------
|
|
417 |
//
|
|
418 |
// -----------------------------------------------------------------------------
|
|
419 |
//
|
|
420 |
void CPixelMetricsMapperAppUi::ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput )
|
|
421 |
{
|
|
422 |
_LIT( KTestPrefix, "\t" );
|
|
423 |
|
|
424 |
HBufC* buffer = HBufC::NewLC( aText.Length() + KTestPrefix().Length() );
|
|
425 |
TPtr ptr = buffer->Des();
|
|
426 |
ptr.Append( KTestPrefix );
|
|
427 |
ptr.Append( aText );
|
|
428 |
iView->ShowL( *buffer, aLast, aFileOutput );
|
|
429 |
CleanupStack::PopAndDestroy( buffer );
|
|
430 |
}
|
|
431 |
|
|
432 |
void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast )
|
|
433 |
{
|
|
434 |
HBufC* buffer = HBufC::NewLC( 100 );
|
|
435 |
TPtr bufferPtr = buffer->Des();
|
|
436 |
|
|
437 |
switch (aPixelMetric)
|
|
438 |
{
|
|
439 |
case QStyle::PM_DockWidgetTitleMargin:
|
|
440 |
bufferPtr.Append(_L("DockTitleMargin: "));
|
|
441 |
break;
|
|
442 |
case QStyle::PM_DockWidgetTitleBarButtonMargin:
|
|
443 |
bufferPtr.Append(_L("DockTitleBtnMargin: "));
|
|
444 |
break;
|
|
445 |
case QStyle::PM_ButtonMargin:
|
|
446 |
bufferPtr.Append(_L("ButtonMargin: "));
|
|
447 |
break;
|
|
448 |
case QStyle::PM_ButtonDefaultIndicator:
|
|
449 |
bufferPtr.Append(_L("ButtonDefaultIndicator: "));
|
|
450 |
break;
|
|
451 |
case QStyle::PM_MdiSubWindowFrameWidth:
|
|
452 |
bufferPtr.Append(_L("MdiSubWndFrameW: "));
|
|
453 |
break;
|
|
454 |
case QStyle::PM_ComboBoxFrameWidth:
|
|
455 |
bufferPtr.Append(_L("ComboBoxFrameWidth: "));
|
|
456 |
break;
|
|
457 |
case QStyle::PM_SpinBoxFrameWidth:
|
|
458 |
bufferPtr.Append(_L("SpinBoxFrameWidth: "));
|
|
459 |
break;
|
|
460 |
case QStyle::PM_DefaultFrameWidth:
|
|
461 |
bufferPtr.Append(_L("DefaultFrameWidth: "));
|
|
462 |
break;
|
|
463 |
case QStyle::PM_RadioButtonLabelSpacing:
|
|
464 |
bufferPtr.Append(_L("RadioButtonLabelSpc: "));
|
|
465 |
break;
|
|
466 |
case QStyle::PM_CheckBoxLabelSpacing:
|
|
467 |
bufferPtr.Append(_L("CheckBoxLabelSpacing: "));
|
|
468 |
break;
|
|
469 |
case QStyle::PM_ToolTipLabelFrameWidth:
|
|
470 |
bufferPtr.Append(_L("ToolTipLabelFrameW: "));
|
|
471 |
break;
|
|
472 |
case QStyle::PM_ListViewIconSize:
|
|
473 |
bufferPtr.Append(_L("ListViewIconSize: "));
|
|
474 |
break;
|
|
475 |
case QStyle::PM_LargeIconSize:
|
|
476 |
bufferPtr.Append(_L("LargeIconSize: "));
|
|
477 |
break;
|
|
478 |
case QStyle::PM_IconViewIconSize:
|
|
479 |
bufferPtr.Append(_L("IconViewIconSize: "));
|
|
480 |
break;
|
|
481 |
case QStyle::PM_TabBarIconSize:
|
|
482 |
bufferPtr.Append(_L("TabBarIconSize: "));
|
|
483 |
break;
|
|
484 |
case QStyle::PM_MessageBoxIconSize:
|
|
485 |
bufferPtr.Append(_L("MessageBoxIconSize: "));
|
|
486 |
break;
|
|
487 |
case QStyle::PM_ButtonIconSize:
|
|
488 |
bufferPtr.Append(_L("ButtonIconSize: "));
|
|
489 |
break;
|
|
490 |
case QStyle::PM_TextCursorWidth:
|
|
491 |
bufferPtr.Append(_L("TextCursorWidth: "));
|
|
492 |
break;
|
|
493 |
case QStyle::PM_SliderLength:
|
|
494 |
bufferPtr.Append(_L("SliderLength: "));
|
|
495 |
break;
|
|
496 |
case QStyle::PM_SliderThickness:
|
|
497 |
bufferPtr.Append(_L("SliderThickness: "));
|
|
498 |
break;
|
|
499 |
case QStyle::PM_SliderTickmarkOffset:
|
|
500 |
bufferPtr.Append(_L("SliderTickmarkOffset: "));
|
|
501 |
break;
|
|
502 |
case QStyle::PM_SliderControlThickness:
|
|
503 |
bufferPtr.Append(_L("SliderCntrlThickness: "));
|
|
504 |
break;
|
|
505 |
case QStyle::PM_SliderSpaceAvailable:
|
|
506 |
bufferPtr.Append(_L("SliderSpaceAvailable: "));
|
|
507 |
break;
|
|
508 |
case QStyle::PM_MenuBarItemSpacing:
|
|
509 |
bufferPtr.Append(_L("MenuBarItemSpacing: "));
|
|
510 |
break;
|
|
511 |
case QStyle::PM_MenuBarHMargin:
|
|
512 |
bufferPtr.Append(_L("MenuBarHMargin: "));
|
|
513 |
break;
|
|
514 |
case QStyle::PM_MenuBarVMargin:
|
|
515 |
bufferPtr.Append(_L("MenuBarVMargin: "));
|
|
516 |
break;
|
|
517 |
case QStyle::PM_ToolBarItemSpacing:
|
|
518 |
bufferPtr.Append(_L("ToolBarItemSpacing: "));
|
|
519 |
break;
|
|
520 |
case QStyle::PM_ToolBarFrameWidth:
|
|
521 |
bufferPtr.Append(_L("ToolBarFrameWidth: "));
|
|
522 |
break;
|
|
523 |
case QStyle::PM_ToolBarItemMargin:
|
|
524 |
bufferPtr.Append(_L("ToolBarItemMargin: "));
|
|
525 |
break;
|
|
526 |
case QStyle::PM_LayoutLeftMargin:
|
|
527 |
bufferPtr.Append(_L("LayoutLeftMargin: "));
|
|
528 |
break;
|
|
529 |
case QStyle::PM_LayoutRightMargin:
|
|
530 |
bufferPtr.Append(_L("LayoutRightMargin: "));
|
|
531 |
break;
|
|
532 |
case QStyle::PM_LayoutTopMargin:
|
|
533 |
bufferPtr.Append(_L("LayoutTopMargin: "));
|
|
534 |
break;
|
|
535 |
case QStyle::PM_LayoutBottomMargin:
|
|
536 |
bufferPtr.Append(_L("LayoutBottomMargin: "));
|
|
537 |
break;
|
|
538 |
case QStyle::PM_LayoutHorizontalSpacing:
|
|
539 |
bufferPtr.Append(_L("LayoutHSpacing: "));
|
|
540 |
break;
|
|
541 |
case QStyle::PM_LayoutVerticalSpacing:
|
|
542 |
bufferPtr.Append(_L("LayoutVSpacing: "));
|
|
543 |
break;
|
|
544 |
case QStyle::PM_MaximumDragDistance:
|
|
545 |
bufferPtr.Append(_L("MaxDragDistance: "));
|
|
546 |
break;
|
|
547 |
case QStyle::PM_ScrollBarExtent:
|
|
548 |
bufferPtr.Append(_L("ScrollBarExtent: "));
|
|
549 |
break;
|
|
550 |
case QStyle::PM_ScrollBarSliderMin:
|
|
551 |
bufferPtr.Append(_L("ScrollBarSliderMin: "));
|
|
552 |
break;
|
|
553 |
case QStyle::PM_MenuBarPanelWidth:
|
|
554 |
bufferPtr.Append(_L("MenuBarPanelWidth: "));
|
|
555 |
break;
|
|
556 |
case QStyle::PM_ProgressBarChunkWidth:
|
|
557 |
bufferPtr.Append(_L("ProgBarChunkWidth: "));
|
|
558 |
break;
|
|
559 |
case QStyle::PM_TabBarTabOverlap:
|
|
560 |
bufferPtr.Append(_L("TabBarTabOverlap: "));
|
|
561 |
break;
|
|
562 |
case QStyle::PM_TabBarTabHSpace:
|
|
563 |
bufferPtr.Append(_L("TabBarTabHSpace: "));
|
|
564 |
break;
|
|
565 |
case QStyle::PM_TabBarTabVSpace:
|
|
566 |
bufferPtr.Append(_L("TabBarTabVSpace: "));
|
|
567 |
break;
|
|
568 |
case QStyle::PM_TabBarBaseHeight:
|
|
569 |
bufferPtr.Append(_L("TabBarBaseHeight: "));
|
|
570 |
break;
|
|
571 |
case QStyle::PM_TabBarBaseOverlap:
|
|
572 |
bufferPtr.Append(_L("TabBarBaseOverlap: "));
|
|
573 |
break;
|
|
574 |
case QStyle::PM_TabBarScrollButtonWidth:
|
|
575 |
bufferPtr.Append(_L("TabBarScrollBtnWidth: "));
|
|
576 |
break;
|
|
577 |
case QStyle::PM_TabBarTabShiftHorizontal:
|
|
578 |
bufferPtr.Append(_L("TabBarTabShiftH: "));
|
|
579 |
break;
|
|
580 |
case QStyle::PM_TabBarTabShiftVertical:
|
|
581 |
bufferPtr.Append(_L("TabBarTabShiftV: "));
|
|
582 |
break;
|
|
583 |
case QStyle::PM_MenuPanelWidth:
|
|
584 |
bufferPtr.Append(_L("MenuPanelWidth: "));
|
|
585 |
break;
|
|
586 |
case QStyle::PM_MenuHMargin:
|
|
587 |
bufferPtr.Append(_L("MenuHMargin: "));
|
|
588 |
break;
|
|
589 |
case QStyle::PM_MenuVMargin:
|
|
590 |
bufferPtr.Append(_L("MenuVMargin: "));
|
|
591 |
break;
|
|
592 |
case QStyle::PM_MenuDesktopFrameWidth:
|
|
593 |
bufferPtr.Append(_L("MenuFrameWidth: "));
|
|
594 |
break;
|
|
595 |
case QStyle::PM_SmallIconSize:
|
|
596 |
bufferPtr.Append(_L("SmallIconSize: "));
|
|
597 |
break;
|
|
598 |
case QStyle::PM_FocusFrameHMargin:
|
|
599 |
bufferPtr.Append(_L("FocusFrameHMargin: "));
|
|
600 |
break;
|
|
601 |
case QStyle::PM_FocusFrameVMargin:
|
|
602 |
bufferPtr.Append(_L("FocusFrameVMargin: "));
|
|
603 |
break;
|
|
604 |
case QStyle::PM_ToolBarIconSize:
|
|
605 |
bufferPtr.Append(_L("ToolBarIconSize: "));
|
|
606 |
break;
|
|
607 |
case QStyle::PM_TitleBarHeight: // use titlepane height
|
|
608 |
bufferPtr.Append(_L("TitleBarHeight: "));
|
|
609 |
break;
|
|
610 |
case QStyle::PM_IndicatorWidth:
|
|
611 |
bufferPtr.Append(_L("IndicatorWidth: "));
|
|
612 |
break;
|
|
613 |
case QStyle::PM_IndicatorHeight:
|
|
614 |
bufferPtr.Append(_L("IndicatorHeight: "));
|
|
615 |
break;
|
|
616 |
case QStyle::PM_ExclusiveIndicatorHeight:
|
|
617 |
bufferPtr.Append(_L("ExclusiveIndHeight: "));
|
|
618 |
break;
|
|
619 |
case QStyle::PM_ExclusiveIndicatorWidth:
|
|
620 |
bufferPtr.Append(_L("ExclusiveIndWidth: "));
|
|
621 |
break;
|
|
622 |
case QStyle::PM_HeaderMargin: // not in S60
|
|
623 |
bufferPtr.Append(_L("HeaderMargin: "));
|
|
624 |
break;
|
|
625 |
case QStyle::PM_MenuScrollerHeight: // not in S60
|
|
626 |
bufferPtr.Append(_L("MenuScrollerHeight: "));
|
|
627 |
break;
|
|
628 |
case QStyle::PM_MenuTearoffHeight: // not in S60
|
|
629 |
bufferPtr.Append(_L("MenuTearoffHeight: "));
|
|
630 |
break;
|
|
631 |
case QStyle::PM_DockWidgetFrameWidth: // not in S60
|
|
632 |
bufferPtr.Append(_L("DockFrameWidth: "));
|
|
633 |
break;
|
|
634 |
case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
|
|
635 |
bufferPtr.Append(_L("DockSepExtent: "));
|
|
636 |
break;
|
|
637 |
case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
|
|
638 |
bufferPtr.Append(_L("MdiSubWndMinWidth: "));
|
|
639 |
break;
|
|
640 |
case QStyle::PM_HeaderGripMargin: // not in S60
|
|
641 |
bufferPtr.Append(_L("HeaderGripMargin: "));
|
|
642 |
break;
|
|
643 |
case QStyle::PM_SplitterWidth: // not in S60
|
|
644 |
bufferPtr.Append(_L("SplitterWidth: "));
|
|
645 |
break;
|
|
646 |
case QStyle::PM_ToolBarExtensionExtent: // not in S60
|
|
647 |
bufferPtr.Append(_L("ToolBarExtExtent: "));
|
|
648 |
break;
|
|
649 |
case QStyle::PM_ToolBarSeparatorExtent: // not in S60
|
|
650 |
bufferPtr.Append(_L("ToolBarSepExtent: "));
|
|
651 |
break;
|
|
652 |
case QStyle::PM_ToolBarHandleExtent: // not in s60
|
|
653 |
bufferPtr.Append(_L("ToolBarHandleExtent: "));
|
|
654 |
break;
|
|
655 |
case QStyle::PM_MenuButtonIndicator: // none???
|
|
656 |
bufferPtr.Append(_L("MenuButtonIndicator: "));
|
|
657 |
break;
|
|
658 |
case QStyle::PM_ButtonShiftHorizontal: //none in 3.x
|
|
659 |
bufferPtr.Append(_L("ButtonShiftHorizontal: "));
|
|
660 |
break;
|
|
661 |
case QStyle::PM_ButtonShiftVertical: // none in 3.x
|
|
662 |
bufferPtr.Append(_L("ButtonShiftVertical: "));
|
|
663 |
break;
|
|
664 |
case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together
|
|
665 |
bufferPtr.Append(_L("TabScrollBtnOverlap: "));
|
|
666 |
break;
|
|
667 |
case QStyle::PM_SizeGripSize: // use default
|
|
668 |
bufferPtr.Append(_L("SizeGripSize: "));
|
|
669 |
break;
|
|
670 |
case QStyle::PM_DockWidgetHandleExtent:
|
|
671 |
bufferPtr.Append(_L("DockWdgtHandleExt: "));
|
|
672 |
break;
|
|
673 |
case QStyle::PM_CheckListButtonSize:
|
|
674 |
bufferPtr.Append(_L("CheckListButtonSize: "));
|
|
675 |
break;
|
|
676 |
case QStyle::PM_CheckListControllerSize:
|
|
677 |
bufferPtr.Append(_L("CheckListCntlerSize: "));
|
|
678 |
break;
|
|
679 |
case QStyle::PM_DialogButtonsSeparator:
|
|
680 |
bufferPtr.Append(_L("DialogBtnSeparator: "));
|
|
681 |
break;
|
|
682 |
case QStyle::PM_DialogButtonsButtonWidth:
|
|
683 |
bufferPtr.Append(_L("DialogBtnWidth: "));
|
|
684 |
break;
|
|
685 |
case QStyle::PM_DialogButtonsButtonHeight:
|
|
686 |
bufferPtr.Append(_L("DialogBtnHeight: "));
|
|
687 |
break;
|
|
688 |
case QStyle::PM_HeaderMarkSize:
|
|
689 |
bufferPtr.Append(_L("HeaderMarkSize: "));
|
|
690 |
break;
|
|
691 |
case QStyle::PM_SpinBoxSliderHeight:
|
|
692 |
bufferPtr.Append(_L("SpinBoxSliderHeight: "));
|
|
693 |
break;
|
|
694 |
case QStyle::PM_DefaultTopLevelMargin:
|
|
695 |
bufferPtr.Append(_L("DefaultTopLvlMrg: "));
|
|
696 |
break;
|
|
697 |
case QStyle::PM_DefaultChildMargin:
|
|
698 |
bufferPtr.Append(_L("DefaultChildMrg: "));
|
|
699 |
break;
|
|
700 |
case QStyle::PM_DefaultLayoutSpacing:
|
|
701 |
bufferPtr.Append(_L("DefaultlayoutSpc: "));
|
|
702 |
break;
|
|
703 |
case QStyle::PM_TabCloseIndicatorWidth:
|
|
704 |
bufferPtr.Append(_L("TabCloseIndWidth: "));
|
|
705 |
break;
|
|
706 |
case QStyle::PM_TabCloseIndicatorHeight:
|
|
707 |
bufferPtr.Append(_L("TabCloseIndHeight: "));
|
|
708 |
break;
|
|
709 |
case QStyle::PM_ScrollView_ScrollBarSpacing:
|
|
710 |
bufferPtr.Append(_L("ScrollViewBarSpc: "));
|
|
711 |
break;
|
|
712 |
case QStyle::PM_SubMenuOverlap:
|
|
713 |
bufferPtr.Append(_L("SubMenuOverlap: "));
|
|
714 |
break;
|
|
715 |
case QStyle::PM_Custom_FrameCornerHeight:
|
|
716 |
bufferPtr.Append(_L("C_FrCornerHeight: "));
|
|
717 |
break;
|
|
718 |
case QStyle::PM_Custom_FrameCornerWidth:
|
|
719 |
bufferPtr.Append(_L("C_FrCornerWidth: "));
|
|
720 |
break;
|
|
721 |
case QStyle::PM_Custom_ThinLineWidth:
|
|
722 |
bufferPtr.Append(_L("C_ThinLineWidth: "));
|
|
723 |
break;
|
|
724 |
case QStyle::PM_Custom_BoldLineWidth:
|
|
725 |
bufferPtr.Append(_L("C_BoldLineWidth: "));
|
|
726 |
break;
|
|
727 |
default:
|
|
728 |
bufferPtr.Append(_L("Default: "));
|
|
729 |
break;
|
|
730 |
}
|
|
731 |
|
|
732 |
if (iFileOutputOn)
|
|
733 |
{
|
|
734 |
bufferPtr.Append('\t');
|
|
735 |
}
|
|
736 |
bufferPtr.AppendNum(aValue);
|
|
737 |
bufferPtr.Append(_L(" "));
|
|
738 |
ShowL( *buffer, aLast, iFileOutputOn );
|
|
739 |
CleanupStack::PopAndDestroy( buffer );
|
|
740 |
}
|
|
741 |
|
|
742 |
void CPixelMetricsMapperAppUi::ClearL()
|
|
743 |
{
|
|
744 |
iView->ClearL();
|
|
745 |
}
|
|
746 |
|
|
747 |
void CPixelMetricsMapperAppUi::CreateHeaderFileL() const
|
|
748 |
{
|
|
749 |
// Open/create resulting file.
|
|
750 |
RFile file;
|
|
751 |
HBufC* layoutFile = HBufC::NewLC( KMaxFileName );
|
|
752 |
*layoutFile = KLayoutSourceFileAndPath;
|
|
753 |
TFileName fileName = *layoutFile;
|
|
754 |
CleanupStack::PopAndDestroy(layoutFile);
|
|
755 |
RFs& fs = CEikonEnv::Static()->FsSession();
|
|
756 |
TInt error = file.Open(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText );
|
|
757 |
if (error==KErrNotFound)
|
|
758 |
{
|
|
759 |
file.Create(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText);
|
|
760 |
}
|
|
761 |
CleanupClosePushL( file );
|
|
762 |
file.SetSize( 0 );
|
|
763 |
|
|
764 |
// Make all writes as from textfile.
|
|
765 |
TFileText textFile;
|
|
766 |
textFile.Set( file );
|
|
767 |
textFile.Seek( ESeekStart );
|
|
768 |
|
|
769 |
// Take all layout files from private folder.
|
|
770 |
CDir* dirList;
|
|
771 |
User::LeaveIfError(fs.GetDir(
|
|
772 |
KPixelMetricsDataFiles,
|
|
773 |
KEntryAttMaskSupported,
|
|
774 |
ESortByName,
|
|
775 |
dirList));
|
|
776 |
|
|
777 |
TMySmallBuffer bufferLayoutHdr;
|
|
778 |
TMyBigBuffer bufferPMData;
|
|
779 |
TInt fileCount = dirList->Count();
|
|
780 |
for (TInt i=0;i<fileCount;i++)
|
|
781 |
{
|
|
782 |
// open sourcefile
|
|
783 |
RFile sourceFile;
|
|
784 |
TFileName layoutFile = (*dirList)[i].iName;
|
|
785 |
User::LeaveIfError( sourceFile.Open(
|
|
786 |
fs,layoutFile, EFileRead|EFileShareAny|EFileStreamText ));
|
|
787 |
CleanupClosePushL( sourceFile );
|
|
788 |
|
|
789 |
// Make all reads as from textfile.
|
|
790 |
TFileText textSourceFile;
|
|
791 |
textSourceFile.Set( sourceFile );
|
|
792 |
TFileName layoutName = CreateLayoutNameL( textSourceFile );
|
|
793 |
|
|
794 |
// rewind - just in case.
|
|
795 |
textSourceFile.Seek( ESeekStart );
|
|
796 |
TFileName oneline;
|
|
797 |
bufferLayoutHdr.Append(KOpenBrace);
|
|
798 |
bufferPMData.Append(KOpenBrace);
|
|
799 |
TInt loop = 0;
|
|
800 |
FOREVER
|
|
801 |
{
|
|
802 |
if( textSourceFile.Read(oneline) != KErrNone )
|
|
803 |
{
|
|
804 |
break;
|
|
805 |
}
|
|
806 |
// Add commas for all but first line
|
|
807 |
if (loop != 0)
|
|
808 |
{
|
|
809 |
if ( loop <= KHeaderValues-1)
|
|
810 |
{
|
|
811 |
bufferLayoutHdr.Append(KComma);
|
|
812 |
}
|
|
813 |
else
|
|
814 |
{
|
|
815 |
if (loop != KHeaderValues)
|
|
816 |
{
|
|
817 |
bufferPMData.Append(KComma);
|
|
818 |
}
|
|
819 |
}
|
|
820 |
if (loop==KHeaderValues)
|
|
821 |
{
|
|
822 |
bufferLayoutHdr.Append(_L(",QLatin1String(\""));
|
|
823 |
bufferLayoutHdr.Append(layoutName);
|
|
824 |
bufferLayoutHdr.Append(_L("\")"));
|
|
825 |
}
|
|
826 |
}
|
|
827 |
// Remove pixel metrics name and ":"
|
|
828 |
oneline = oneline.Mid(oneline.Find(KColon)+1);
|
|
829 |
// Remove tab
|
|
830 |
oneline = oneline.Mid(oneline.Find(KTab)+1);
|
|
831 |
// remove crap from the end of line
|
|
832 |
TLex lex(oneline);
|
|
833 |
TInt nextValue = -666;
|
|
834 |
User::LeaveIfError( lex.Val(nextValue) );
|
|
835 |
if ( loop <= KHeaderValues-1)
|
|
836 |
{
|
|
837 |
if (loop == KHeaderValues -1 ) // true / false values
|
|
838 |
{
|
|
839 |
if (nextValue == 1)
|
|
840 |
{
|
|
841 |
bufferLayoutHdr.Append(_L("true"));
|
|
842 |
}
|
|
843 |
else
|
|
844 |
{
|
|
845 |
bufferLayoutHdr.Append(_L("false"));
|
|
846 |
}
|
|
847 |
}
|
|
848 |
else
|
|
849 |
{
|
|
850 |
bufferLayoutHdr.AppendNum(nextValue);
|
|
851 |
}
|
|
852 |
}
|
|
853 |
else
|
|
854 |
{
|
|
855 |
if (nextValue == -909)
|
|
856 |
bufferPMData.Append(_L("ECommonStyleValue"));
|
|
857 |
else
|
|
858 |
bufferPMData.AppendNum(nextValue);
|
|
859 |
}
|
|
860 |
oneline.Zero();
|
|
861 |
loop++;
|
|
862 |
}
|
|
863 |
file.Flush();
|
|
864 |
bufferLayoutHdr.Append(KEndBraceWithCommaAndCRLF);
|
|
865 |
bufferPMData.Append(KEndBraceWithCommaAndCRLF);
|
|
866 |
CleanupStack::PopAndDestroy(); //sourceFile
|
|
867 |
}
|
|
868 |
|
|
869 |
bufferLayoutHdr = bufferLayoutHdr.Left(bufferLayoutHdr.Length()-2);
|
|
870 |
bufferPMData = bufferPMData.Left(bufferPMData.Length()-2);
|
|
871 |
textFile.Write(bufferLayoutHdr);
|
|
872 |
textFile.Write(KCRLF);
|
|
873 |
textFile.Write(bufferPMData);
|
|
874 |
delete dirList;
|
|
875 |
|
|
876 |
CleanupStack::PopAndDestroy(); //file
|
|
877 |
}
|
|
878 |
|
|
879 |
TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) const
|
|
880 |
{
|
|
881 |
aFileHandle.Seek(ESeekStart);
|
|
882 |
// Layout data is deployed like this:
|
|
883 |
// first line - height
|
|
884 |
// second line - width
|
|
885 |
// fifth line mirror info
|
|
886 |
TFileName lines;
|
|
887 |
TFileName layoutName;
|
|
888 |
|
|
889 |
TInt height = -666;
|
|
890 |
TInt width = -666;
|
|
891 |
TInt mirroring = -666;
|
|
892 |
// Collect name information.
|
|
893 |
for (TInt i=0; i<6; i++)
|
|
894 |
{
|
|
895 |
User::LeaveIfError(aFileHandle.Read(lines));
|
|
896 |
// Remove pixel metrics name and ":"
|
|
897 |
lines = lines.Mid(lines.Find(KColon)+1);
|
|
898 |
// Remove tab
|
|
899 |
lines = lines.Mid(lines.Find(KTab)+1);
|
|
900 |
TLex myLexer(lines);
|
|
901 |
TInt error = KErrNone;
|
|
902 |
if (i==0) //height is first
|
|
903 |
{
|
|
904 |
error = myLexer.Val(height);
|
|
905 |
}
|
|
906 |
if (i==1) //width is second
|
|
907 |
{
|
|
908 |
error = myLexer.Val(width);
|
|
909 |
}
|
|
910 |
if (i==4) //mirror info is fourth
|
|
911 |
{
|
|
912 |
error = myLexer.Val(mirroring);
|
|
913 |
}
|
|
914 |
User::LeaveIfError(error);
|
|
915 |
}
|
|
916 |
|
|
917 |
// Interpret results and write name to buffer.
|
|
918 |
if ( (width == 240 && height == 320) ||
|
|
919 |
(width == 320 && height == 240))
|
|
920 |
{
|
|
921 |
layoutName.Append(_L("QVGA "));
|
|
922 |
}
|
|
923 |
else if ( (width == 360 && height == 640) ||
|
|
924 |
(width == 640 && height == 360))
|
|
925 |
{
|
|
926 |
layoutName.Append(_L("NHD "));
|
|
927 |
}
|
|
928 |
else if ( (width == 480 && height == 640) ||
|
|
929 |
(width == 640 && height == 480))
|
|
930 |
{
|
|
931 |
layoutName.Append(_L("VGA "));
|
|
932 |
}
|
|
933 |
else if ( (width == 800 && height == 352) ||
|
|
934 |
(width == 352 && height == 800))
|
|
935 |
{
|
|
936 |
layoutName.Append(_L("E90 "));
|
|
937 |
}
|
|
938 |
else if ( (width == 800 && height == 480) ||
|
|
939 |
(width == 480 && height == 800) ||
|
|
940 |
(width == 848 && height == 480) ||
|
|
941 |
(width == 480 && height == 848) ||
|
|
942 |
(width == 854 && height == 480) ||
|
|
943 |
(width == 480 && height == 854))
|
|
944 |
{
|
|
945 |
layoutName.Append(_L("WVGA "));
|
|
946 |
}
|
|
947 |
else if ( (width == 480 && height == 320) ||
|
|
948 |
(width == 320 && height == 480) ||
|
|
949 |
(width == 640 && height == 240) ||
|
|
950 |
(width == 240 && height == 640))
|
|
951 |
{
|
|
952 |
layoutName.Append(_L("HVGA "));
|
|
953 |
}
|
|
954 |
else
|
|
955 |
{
|
|
956 |
layoutName.Append(_L("Unknown "));
|
|
957 |
layoutName.AppendNum(height);
|
|
958 |
layoutName.Append(_L("x"));
|
|
959 |
layoutName.AppendNum(width);
|
|
960 |
}
|
|
961 |
if (width > height)
|
|
962 |
{
|
|
963 |
layoutName.Append(_L("Landscape"));
|
|
964 |
}
|
|
965 |
else
|
|
966 |
{
|
|
967 |
layoutName.Append(_L("Portrait"));
|
|
968 |
}
|
|
969 |
if (mirroring)
|
|
970 |
{
|
|
971 |
layoutName.Append(_L(" Mirrored"));
|
|
972 |
}
|
|
973 |
return layoutName;
|
|
974 |
}
|
|
975 |
|
|
976 |
// -----------------------------------------------------------------------------
|
|
977 |
//
|
|
978 |
// -----------------------------------------------------------------------------
|
|
979 |
//
|
|
980 |
CEikAppUi* CPixelMetricsMapperDocument::CreateAppUiL()
|
|
981 |
{
|
|
982 |
return( new ( ELeave ) CPixelMetricsMapperAppUi );
|
|
983 |
}
|
|
984 |
|
|
985 |
// -----------------------------------------------------------------------------
|
|
986 |
//
|
|
987 |
// -----------------------------------------------------------------------------
|
|
988 |
//
|
|
989 |
void CPixelMetricsMapperDocument::ConstructL()
|
|
990 |
{
|
|
991 |
}
|
|
992 |
|
|
993 |
// -----------------------------------------------------------------------------
|
|
994 |
//
|
|
995 |
// -----------------------------------------------------------------------------
|
|
996 |
//
|
|
997 |
TUid CPixelMetricsMapperApplication::AppDllUid() const
|
|
998 |
{
|
|
999 |
return KUidPMMapperApplication;
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
|
|
1003 |
// -----------------------------------------------------------------------------
|
|
1004 |
//
|
|
1005 |
// -----------------------------------------------------------------------------
|
|
1006 |
//
|
|
1007 |
CApaDocument* CPixelMetricsMapperApplication::CreateDocumentL()
|
|
1008 |
{
|
|
1009 |
CPixelMetricsMapperDocument* document =
|
|
1010 |
new( ELeave ) CPixelMetricsMapperDocument( *this );
|
|
1011 |
CleanupStack::PushL( document );
|
|
1012 |
document->ConstructL();
|
|
1013 |
CleanupStack::Pop();
|
|
1014 |
return( document );
|
|
1015 |
}
|
|
1016 |
|
|
1017 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
1018 |
// ---------------------------------------------------------
|
|
1019 |
// NewApplication implements
|
|
1020 |
//
|
|
1021 |
// Creates an instance of application.
|
|
1022 |
//
|
|
1023 |
// Returns: an instance of CVtUiApp
|
|
1024 |
// ---------------------------------------------------------
|
|
1025 |
//
|
|
1026 |
LOCAL_C CApaApplication* NewApplication()
|
|
1027 |
{
|
|
1028 |
return new CPixelMetricsMapperApplication;
|
|
1029 |
}
|
|
1030 |
|
|
1031 |
// ---------------------------------------------------------
|
|
1032 |
// E32Main implements
|
|
1033 |
//
|
|
1034 |
// It is called when executable is started.
|
|
1035 |
//
|
|
1036 |
// Returns: error code.
|
|
1037 |
// ---------------------------------------------------------
|
|
1038 |
//
|
|
1039 |
GLDEF_C TInt E32Main()
|
|
1040 |
{
|
|
1041 |
return EikStart::RunApplication( NewApplication );
|
|
1042 |
}
|
|
1043 |
|
|
1044 |
// End of File
|