Remove Symbian / S60 code from util.

Change-Id: I00a151a5f23bb7258f78712cce569b324c92c7d7
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Xizhi Zhu 2012-01-23 12:05:01 +01:00 committed by Qt by Nokia
parent 65bad77d26
commit 26e92680e9
17 changed files with 0 additions and 4195 deletions

View File

@ -1,45 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
PRJ_MMPFILES
pm_mapper.mmp
// End of File

File diff suppressed because it is too large Load Diff

View File

@ -1,218 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PIXELMETRICS_H
#define PIXELMETRICS_H
#include <e32base.h>
#define S60_Rnd_Env
#ifdef S60_Rnd_Env
#pragma message ("Building in supported environment")
const TInt KUnknownBase = -5000;
NONSHARABLE_CLASS( QStyle )
{
public:
enum PixelMetric {
PM_ButtonMargin,
PM_ButtonDefaultIndicator,
PM_MenuButtonIndicator,
PM_ButtonShiftHorizontal,
PM_ButtonShiftVertical,
PM_DefaultFrameWidth,
PM_SpinBoxFrameWidth,
PM_ComboBoxFrameWidth,
PM_MaximumDragDistance,
PM_ScrollBarExtent,
PM_ScrollBarSliderMin,
PM_SliderThickness, // total slider thickness
PM_SliderControlThickness, // thickness of the business part
PM_SliderLength, // total length of slider
PM_SliderTickmarkOffset, //
PM_SliderSpaceAvailable, // available space for slider to move
PM_DockWidgetSeparatorExtent,
PM_DockWidgetHandleExtent,
PM_DockWidgetFrameWidth,
PM_TabBarTabOverlap,
PM_TabBarTabHSpace,
PM_TabBarTabVSpace,
PM_TabBarBaseHeight,
PM_TabBarBaseOverlap,
PM_ProgressBarChunkWidth,
PM_SplitterWidth,
PM_TitleBarHeight,
PM_MenuScrollerHeight,
PM_MenuHMargin,
PM_MenuVMargin,
PM_MenuPanelWidth,
PM_MenuTearoffHeight,
PM_MenuDesktopFrameWidth,
PM_MenuBarPanelWidth,
PM_MenuBarItemSpacing,
PM_MenuBarVMargin,
PM_MenuBarHMargin,
PM_IndicatorWidth,
PM_IndicatorHeight,
PM_ExclusiveIndicatorWidth,
PM_ExclusiveIndicatorHeight,
PM_CheckListButtonSize,
PM_CheckListControllerSize,
PM_DialogButtonsSeparator,
PM_DialogButtonsButtonWidth,
PM_DialogButtonsButtonHeight,
PM_MdiSubWindowFrameWidth,
PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, //obsolete
PM_MdiSubWindowMinimizedWidth,
PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, //obsolete
PM_HeaderMargin,
PM_HeaderMarkSize,
PM_HeaderGripMargin,
PM_TabBarTabShiftHorizontal,
PM_TabBarTabShiftVertical,
PM_TabBarScrollButtonWidth,
PM_ToolBarFrameWidth,
PM_ToolBarHandleExtent,
PM_ToolBarItemSpacing,
PM_ToolBarItemMargin,
PM_ToolBarSeparatorExtent,
PM_ToolBarExtensionExtent,
PM_SpinBoxSliderHeight,
PM_DefaultTopLevelMargin,
PM_DefaultChildMargin,
PM_DefaultLayoutSpacing,
PM_ToolBarIconSize,
PM_ListViewIconSize,
PM_IconViewIconSize,
PM_SmallIconSize,
PM_LargeIconSize,
PM_FocusFrameVMargin,
PM_FocusFrameHMargin,
PM_ToolTipLabelFrameWidth,
PM_CheckBoxLabelSpacing,
PM_TabBarIconSize,
PM_SizeGripSize,
PM_DockWidgetTitleMargin,
PM_MessageBoxIconSize,
PM_ButtonIconSize,
PM_DockWidgetTitleBarButtonMargin,
PM_RadioButtonLabelSpacing,
PM_LayoutLeftMargin,
PM_LayoutTopMargin,
PM_LayoutRightMargin,
PM_LayoutBottomMargin,
PM_LayoutHorizontalSpacing,
PM_LayoutVerticalSpacing,
PM_TabBar_ScrollButtonOverlap,
PM_TextCursorWidth,
PM_TabCloseIndicatorWidth,
PM_TabCloseIndicatorHeight,
PM_ScrollView_ScrollBarSpacing,
PM_SubMenuOverlap,
// do not add any values below/greater than this
PM_CustomBase = 0xf0000000,
// The following are custom values needed to draw the S60Style according scalable UIs.
// Width of 9-part frame-corner
PM_Custom_FrameCornerWidth,
// Height of 9-part frame corner
PM_Custom_FrameCornerHeight,
// Bold line width
PM_Custom_BoldLineWidth,
// Thin line width
PM_Custom_ThinLineWidth,
// Height of a popup info messagebox
PM_Custom_MessageBoxHeight
};
};
#else
#pragma message ("Building in non-supported environment, this probably fails")
#endif
// Pixel metrics version information.
class TPixelMetricsVersion
{
public:
TInt majorVersion;
TInt minorVersion;
};
NONSHARABLE_CLASS(PixelMetrics)
{
public:
static TPixelMetricsVersion Version();
static TInt PixelMetricValue(QStyle::PixelMetric);
private:
static TInt PixelMetricMenuValue( QStyle::PixelMetric menuValue, TRect mainPaneRect );
static TInt PixelMetricTabValue( QStyle::PixelMetric tabValue, TRect appWindow, TBool landscape );
};
#endif // PIXELMETRICS_H

View File

@ -1,66 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PMMAPPER_HRH
#define PMMAPPER_HRH
// DATA TYPES
// View IDs.
enum
{
EPMMapperViewId = 1 // Base view.
};
// Menu items (commands)
enum
{
ECmdStartCalculations = 8500,
ECmdSwitchOrientation,
ECmdStatus,
ECmdSwitchOutput,
ECmdCreateHeaderFile
};
#endif // PMMAPPER_HRH
// End of File

View File

@ -1,91 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <data_caging_paths.hrh>
#include <platform_paths.hrh>
TARGET pm_mapper.exe
TARGETTYPE exe
UID 0x100039CE 0x2002121F
CAPABILITY CAP_APPLICATION
VENDORID VID_DEFAULT
SOURCEPATH .
SOURCE pm_mapperview.cpp
SOURCE pm_mapperapp.cpp
SOURCE pixel_metrics.cpp
START RESOURCE pm_mapper.rss
HEADER
TARGETPATH APP_RESOURCE_DIR
END
START RESOURCE pm_mapper_reg.rss
TARGETPATH \private\10003a3f\apps
END
APP_LAYER_SYSTEMINCLUDE
USERINCLUDE .
LIBRARY eikcoctl.lib
LIBRARY avkon.lib
LIBRARY euser.lib
LIBRARY apparc.lib
LIBRARY cone.lib
LIBRARY eikcore.lib
LIBRARY bafl.lib
LIBRARY eikctl.lib
LIBRARY apgrfx.lib
LIBRARY aknnotify.lib
LIBRARY ws32.lib
LIBRARY commonengine.lib
LIBRARY fbscli.lib
LIBRARY eikdlg.lib
LIBRARY aknskins.lib
LIBRARY gdi.lib
LIBRARY CentralRepository.lib
LIBRARY efsrv.lib
LIBRARY cdlengine.lib
LIBRARY AknLayout2.lib
LIBRARY AknLayout2Scalable.lib
// End of File

View File

@ -1,32 +0,0 @@
; ==============================================================================
; Name : PMMapper.pkg
; Part of : Pixel Metrics Mapper
; Description : Package file for pixel metrics mapper
; SIS creation.
; Version :
;
; Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
; This material, including documentation and any related
; computer programs, is protected by copyright controlled by
; Nokia Corporation. All rights are reserved. Copying,
; including reproducing, storing, adapting or translating, any
; or all of this material requires the prior written consent of
; Nokia Corporation. This material also contains confidential
; information which may not be disclosed to others without the
; prior written consent of Nokia Corporation.
; ==============================================================================
;Header
#{"PMMapper"},(0x2002121F),1,0,0
;Localised Vendor name
%{"Nokia Test EN"}
;Unique Vendor name
:"Vendor"
;Files to install
"\Epoc32\release\armv5\urel\pm_mapper.exe" -"!:\sys\bin\pm_mapper.exe"
"\epoc32\data\z\private\10003a3f\apps\pm_mapper_reg.rsc" -"!:\private\10003a3f\import\apps\pm_mapper_reg.rsc"
"\epoc32\data\Z\Resource\Apps\pm_mapper.RSC" -"!:\resource\apps\pm_mapper.rsc"

View File

@ -1,160 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
// RESOURCE IDENTIFIER
NAME TATR
// INCLUDES
#include <eikon.rh>
#include <avkon.rh>
#include <avkon.mbg>
#include <avkon.rsg>
#include <avkon.hrh>
#include <uikon.hrh>
#include <avkonIcons.hrh>
#include <data_caging_paths_strings.hrh>
#include <appinfo.rh>
#include "pm_mapper.hrh"
// RESOURCE DEFINITIONS
// -----------------------------------------------------------------------------
//
// RSS_SIGNATURE
//
//
// -----------------------------------------------------------------------------
//
RESOURCE RSS_SIGNATURE { }
// -----------------------------------------------------------------------------
//
// TBUF
//
//
// -----------------------------------------------------------------------------
//
RESOURCE TBUF { buf = "pm_mapper"; }
// -----------------------------------------------------------------------------
//
// EIK_APP_INFO
//
//
// -----------------------------------------------------------------------------
//
RESOURCE EIK_APP_INFO
{
}
// -----------------------------------------------------------------------------
//
// r_pmmapper_localisable_app_info
// Captions for this application.
//
// -----------------------------------------------------------------------------
//
RESOURCE LOCALISABLE_APP_INFO r_pmmapper_localisable_app_info
{
short_caption = "pm_mapper";
caption_and_icon =
CAPTION_AND_ICON_INFO
{
caption = "PixelMetricsMapper";
};
}
// -----------------------------------------------------------------------------
//
// r_pmmapper_view
//
//
// -----------------------------------------------------------------------------
//
RESOURCE AVKON_VIEW r_pmmapper_view
{
menubar = r_pmmapper_view_menu;
cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
}
// -----------------------------------------------------------------------------
//
// r_pmmapper_view_menu
//
//
// -----------------------------------------------------------------------------
//
RESOURCE MENU_BAR r_pmmapper_view_menu
{
titles=
{
MENU_TITLE { txt = "A"; menu_pane = r_pmmapper_system_menu; }
};
}
// -----------------------------------------------------------------------------
//
// r_pmmapper_system_menu
//
//
// -----------------------------------------------------------------------------
//
RESOURCE MENU_PANE r_pmmapper_system_menu
{
items =
{
MENU_ITEM { command = ECmdStartCalculations; txt = "Start calculations"; },
MENU_ITEM { command = ECmdSwitchOrientation; txt = "Switch orientation"; },
MENU_ITEM { command = ECmdStatus; txt = "Status"; },
MENU_ITEM { command = ECmdSwitchOutput; txt = "Switch output (file/screen)"; },
MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; }
};
}
// End of File

View File

@ -1,57 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <appinfo.rh>
#include <pm_mapper.rsg>
#include <data_caging_paths_strings.hrh>
UID2 KUidAppRegistrationResourceFile
UID3 0x2002121F // application UID
RESOURCE APP_REGISTRATION_INFO
{
app_file = "pm_mapper";
localisable_resource_file =
APP_RESOURCE_DIR"\\pm_mapper";
localisable_resource_id = R_PMMAPPER_LOCALISABLE_APP_INFO;
}
// End of File

View File

@ -1,959 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
// INCLUDE FILES
#include <avkon.rsg>
#include <avkon.hrh>
#include "pm_mapper.hrh"
#include "pm_mapperapp.h"
#include "pm_mapperview.h"
#include <pm_mapper.rsg>
#include <BldVariant.hrh>
#include <w32std.h>
#include <apgwgnam.h>
#include <eikstart.h>
#include <eikenv.h>
#include <f32file.h>
#include <avkon.hrh>
#include <aknenv.h>
#include <aknnotedialog.h>
#include <stringloader.h>
#include <coneresloader.h>
#include <aknglobalnote.h>
#include <CentralRepository.h>
#include <Aknsutils.h>
#include <AknUtils.h>
#include "pixel_metrics.h"
#include <avkon.mbg>
#include <AknLayoutConfig.h>
#include <aknsgcc.h>
typedef TBuf<2048> TMySmallBuffer;
typedef TBuf<8192> TMyBigBuffer;
_LIT(KLayoutSourceFileAndPath, "\\private\\2002121f\\pm_layout.cpp");
_LIT(KPixelMetricsDataFiles, "\\private\\2002121f\\*.txt");
_LIT(KOpenBrace, "{");
_LIT(KComma, ",");
_LIT(KColon, ":");
_LIT(KTab, "\t");
_LIT(KEndBraceWithCommaAndCRLF, "},\n");
_LIT(KCRLF, "\n");
// Number of header lines in layout data.
const TInt KHeaderValues = 4;
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// C++ constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CPixelMetricsMapperAppUi::CPixelMetricsMapperAppUi() : iFileOutputOn(EFalse)
{
}
// -----------------------------------------------------------------------------
// Destructor.
// -----------------------------------------------------------------------------
//
CPixelMetricsMapperAppUi::~CPixelMetricsMapperAppUi()
{
}
// -----------------------------------------------------------------------------
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::ConstructL()
{
BaseConstructL();
CEikonEnv& eikEnv = *CEikonEnv::Static();
eikEnv.WsSession().ComputeMode(
RWsSession::EPriorityControlDisabled );
RThread().SetProcessPriority( EPriorityHigh );
CPixelMetricsMapperView* view = new( ELeave ) CPixelMetricsMapperView;
CleanupStack::PushL( view );
view->ConstructL();
CleanupStack::Pop(); // view
AddViewL(view); // transfer ownership to CAknViewAppUi
iView = view;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TKeyResponse CPixelMetricsMapperAppUi::HandleKeyEventL(
const TKeyEvent& /*aKeyEvent*/,
TEventCode /*aType*/ )
{
return EKeyWasNotConsumed;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
{
switch ( aCommand )
{
case EAknSoftkeyExit:
case EEikCmdExit:
Exit();
break;
case ECmdSwitchOutput:
{
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
bufferPtr.Append(_L("Output switched to "));
iFileOutputOn = !iFileOutputOn;
if (iFileOutputOn)
bufferPtr.Append(_L("file."));
else
bufferPtr.Append(_L("screen."));
ShowL( *buffer, last );
CleanupStack::PopAndDestroy( buffer );
}
break;
case ECmdStatus:
{
ClearL();
// layout
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
// Orientation
bufferPtr.Append(_L("Orientation: "));
bufferPtr.AppendNum((TInt)iAvkonAppUi->Orientation());
ShowL( *buffer, last );
bufferPtr.Zero();
// Output
bufferPtr.Append(_L("Output: "));
if (iFileOutputOn) bufferPtr.Append(_L("File"));
else bufferPtr.Append(_L("Screen"));
ShowL( *buffer, last );
bufferPtr.Zero();
CAknLayoutConfig::TScreenMode localAppScreenMode = CAknSgcClient::ScreenMode();
TInt hashValue = localAppScreenMode.ScreenStyleHash();
TPixelsTwipsAndRotation pixels = CAknSgcClient::PixelsAndRotation();
TSize pixelSize = pixels.iPixelSize;
bufferPtr.Append(_L("LayoutName: "));
if ( (pixelSize.iWidth == 320 || pixelSize.iWidth == 240 )&&
(pixelSize.iHeight == 320 || pixelSize.iHeight == 240 ))
{
if (hashValue==0x996F7AA7)
bufferPtr.Append(_L("QVGA2"));
else
bufferPtr.Append(_L("QVGA1"));
}
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 360 )&&
(pixelSize.iHeight == 360 || pixelSize.iHeight == 640 ))
{
bufferPtr.Append(_L("nHD"));
}
else if ((pixelSize.iWidth == 640 || pixelSize.iWidth == 480 )&&
(pixelSize.iHeight == 480 || pixelSize.iHeight == 640 ))
{
bufferPtr.Append(_L("VGA"));
}
else if ((pixelSize.iWidth == 352 || pixelSize.iWidth == 800 )&&
(pixelSize.iHeight == 800 || pixelSize.iHeight == 352 ))
{
bufferPtr.Append(_L("E90"));
}
else if ((pixelSize.iWidth == 320 || pixelSize.iWidth == 480 ||
pixelSize.iWidth == 240 || pixelSize.iWidth == 640 )&&
(pixelSize.iHeight == 320 || pixelSize.iHeight == 480 ||
pixelSize.iHeight == 240 || pixelSize.iHeight == 640))
{
bufferPtr.Append(_L("HVGA"));
}
else if ((pixelSize.iWidth == 480 || pixelSize.iWidth == 854 ||
pixelSize.iWidth == 848 || pixelSize.iWidth == 800 )&&
(pixelSize.iHeight == 800 || pixelSize.iHeight == 480 ||
pixelSize.iHeight == 848 || pixelSize.iHeight == 854))
{
bufferPtr.Append(_L("WVGA"));
}
else
{
bufferPtr.Append(_L("Unknown"));
}
ShowL( *buffer, last );
bufferPtr.Zero();
CleanupStack::PopAndDestroy( buffer );
}
break;
case ECmdSwitchOrientation:
{
ClearL();
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
TBool last = ETrue;
#ifndef __SERIES60_31__
if (!iAvkonAppUi->OrientationCanBeChanged())
{
bufferPtr.Append(_L("Orientation cannot be changed."));
ShowL( *buffer, last );
bufferPtr.Zero();
CleanupStack::PopAndDestroy( buffer );
break;
}
#endif //__SERIES60_31__
if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
{
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
}
else if (iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationLandscape)
{
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait);
}
else
{
// unspecified
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
}
bufferPtr.Append(_L("Orientation changed."));
ShowL( *buffer, last );
bufferPtr.Zero();
CleanupStack::PopAndDestroy( buffer );
break;
}
case ECmdStartCalculations:
{
ClearL();
// Get known values
TInt index = 0;
TBool last = EFalse;
if (iFileOutputOn)
{
TRect screenRect;
AknLayoutUtils::LayoutMetricsRect(
AknLayoutUtils::EApplicationWindow,
screenRect );
// Add screen dimensions
TInt height = screenRect.Height();
TInt width = screenRect.Width();
TBuf16<32> tgt;
// HEIGHT
tgt.Append(_L("height: \t"));
tgt.AppendNum(height, EDecimal); // put max height into text file
ShowL( tgt, last );
tgt.Zero();
// WIDTH
tgt.Append(_L("width: \t"));
tgt.AppendNum(width, EDecimal); // put max width into text file
ShowL( tgt, last );
tgt.Zero();
// VERSION
TPixelMetricsVersion version = PixelMetrics::Version();
tgt.Append(_L("major_version: \t"));
tgt.AppendNum(version.majorVersion, EDecimal); // put major version into text file
ShowL( tgt, last );
tgt.Zero();
tgt.Append(_L("minor_version: \t"));
tgt.AppendNum(version.minorVersion, EDecimal); // put minor version into text file
ShowL( tgt, last );
tgt.Zero();
}
TInt myValue = KErrNotFound;
for (;;)
{
if (index==QStyle::PM_Custom_MessageBoxHeight)
{
last = ETrue;
}
myValue = PixelMetrics::PixelMetricValue(static_cast<QStyle::PixelMetric>(index));
ShowSingleValueL( index, myValue, last );
if (last) break;
// if last before custom values, "jump" to custom base
if (index==QStyle::PM_SubMenuOverlap) index = QStyle::PM_CustomBase;
index++;
}
}
break;
case ECmdCreateHeaderFile:
CreateHeaderFileL();
break;
default:
break;
}
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperAppUi::ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput )
{
_LIT( KTestPrefix, "\t" );
HBufC* buffer = HBufC::NewLC( aText.Length() + KTestPrefix().Length() );
TPtr ptr = buffer->Des();
ptr.Append( KTestPrefix );
ptr.Append( aText );
iView->ShowL( *buffer, aLast, aFileOutput );
CleanupStack::PopAndDestroy( buffer );
}
void CPixelMetricsMapperAppUi::ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast )
{
HBufC* buffer = HBufC::NewLC( 100 );
TPtr bufferPtr = buffer->Des();
switch (aPixelMetric)
{
case QStyle::PM_DockWidgetTitleMargin:
bufferPtr.Append(_L("DockTitleMargin: "));
break;
case QStyle::PM_DockWidgetTitleBarButtonMargin:
bufferPtr.Append(_L("DockTitleBtnMargin: "));
break;
case QStyle::PM_ButtonMargin:
bufferPtr.Append(_L("ButtonMargin: "));
break;
case QStyle::PM_ButtonDefaultIndicator:
bufferPtr.Append(_L("ButtonDefaultIndicator: "));
break;
case QStyle::PM_MdiSubWindowFrameWidth:
bufferPtr.Append(_L("MdiSubWndFrameW: "));
break;
case QStyle::PM_ComboBoxFrameWidth:
bufferPtr.Append(_L("ComboBoxFrameWidth: "));
break;
case QStyle::PM_SpinBoxFrameWidth:
bufferPtr.Append(_L("SpinBoxFrameWidth: "));
break;
case QStyle::PM_DefaultFrameWidth:
bufferPtr.Append(_L("DefaultFrameWidth: "));
break;
case QStyle::PM_RadioButtonLabelSpacing:
bufferPtr.Append(_L("RadioButtonLabelSpc: "));
break;
case QStyle::PM_CheckBoxLabelSpacing:
bufferPtr.Append(_L("CheckBoxLabelSpacing: "));
break;
case QStyle::PM_ToolTipLabelFrameWidth:
bufferPtr.Append(_L("ToolTipLabelFrameW: "));
break;
case QStyle::PM_ListViewIconSize:
bufferPtr.Append(_L("ListViewIconSize: "));
break;
case QStyle::PM_LargeIconSize:
bufferPtr.Append(_L("LargeIconSize: "));
break;
case QStyle::PM_IconViewIconSize:
bufferPtr.Append(_L("IconViewIconSize: "));
break;
case QStyle::PM_TabBarIconSize:
bufferPtr.Append(_L("TabBarIconSize: "));
break;
case QStyle::PM_MessageBoxIconSize:
bufferPtr.Append(_L("MessageBoxIconSize: "));
break;
case QStyle::PM_ButtonIconSize:
bufferPtr.Append(_L("ButtonIconSize: "));
break;
case QStyle::PM_TextCursorWidth:
bufferPtr.Append(_L("TextCursorWidth: "));
break;
case QStyle::PM_SliderLength:
bufferPtr.Append(_L("SliderLength: "));
break;
case QStyle::PM_SliderThickness:
bufferPtr.Append(_L("SliderThickness: "));
break;
case QStyle::PM_SliderTickmarkOffset:
bufferPtr.Append(_L("SliderTickmarkOffset: "));
break;
case QStyle::PM_SliderControlThickness:
bufferPtr.Append(_L("SliderCntrlThickness: "));
break;
case QStyle::PM_SliderSpaceAvailable:
bufferPtr.Append(_L("SliderSpaceAvailable: "));
break;
case QStyle::PM_MenuBarItemSpacing:
bufferPtr.Append(_L("MenuBarItemSpacing: "));
break;
case QStyle::PM_MenuBarHMargin:
bufferPtr.Append(_L("MenuBarHMargin: "));
break;
case QStyle::PM_MenuBarVMargin:
bufferPtr.Append(_L("MenuBarVMargin: "));
break;
case QStyle::PM_ToolBarItemSpacing:
bufferPtr.Append(_L("ToolBarItemSpacing: "));
break;
case QStyle::PM_ToolBarFrameWidth:
bufferPtr.Append(_L("ToolBarFrameWidth: "));
break;
case QStyle::PM_ToolBarItemMargin:
bufferPtr.Append(_L("ToolBarItemMargin: "));
break;
case QStyle::PM_LayoutLeftMargin:
bufferPtr.Append(_L("LayoutLeftMargin: "));
break;
case QStyle::PM_LayoutRightMargin:
bufferPtr.Append(_L("LayoutRightMargin: "));
break;
case QStyle::PM_LayoutTopMargin:
bufferPtr.Append(_L("LayoutTopMargin: "));
break;
case QStyle::PM_LayoutBottomMargin:
bufferPtr.Append(_L("LayoutBottomMargin: "));
break;
case QStyle::PM_LayoutHorizontalSpacing:
bufferPtr.Append(_L("LayoutHSpacing: "));
break;
case QStyle::PM_LayoutVerticalSpacing:
bufferPtr.Append(_L("LayoutVSpacing: "));
break;
case QStyle::PM_MaximumDragDistance:
bufferPtr.Append(_L("MaxDragDistance: "));
break;
case QStyle::PM_ScrollBarExtent:
bufferPtr.Append(_L("ScrollBarExtent: "));
break;
case QStyle::PM_ScrollBarSliderMin:
bufferPtr.Append(_L("ScrollBarSliderMin: "));
break;
case QStyle::PM_MenuBarPanelWidth:
bufferPtr.Append(_L("MenuBarPanelWidth: "));
break;
case QStyle::PM_ProgressBarChunkWidth:
bufferPtr.Append(_L("ProgBarChunkWidth: "));
break;
case QStyle::PM_TabBarTabOverlap:
bufferPtr.Append(_L("TabBarTabOverlap: "));
break;
case QStyle::PM_TabBarTabHSpace:
bufferPtr.Append(_L("TabBarTabHSpace: "));
break;
case QStyle::PM_TabBarTabVSpace:
bufferPtr.Append(_L("TabBarTabVSpace: "));
break;
case QStyle::PM_TabBarBaseHeight:
bufferPtr.Append(_L("TabBarBaseHeight: "));
break;
case QStyle::PM_TabBarBaseOverlap:
bufferPtr.Append(_L("TabBarBaseOverlap: "));
break;
case QStyle::PM_TabBarScrollButtonWidth:
bufferPtr.Append(_L("TabBarScrollBtnWidth: "));
break;
case QStyle::PM_TabBarTabShiftHorizontal:
bufferPtr.Append(_L("TabBarTabShiftH: "));
break;
case QStyle::PM_TabBarTabShiftVertical:
bufferPtr.Append(_L("TabBarTabShiftV: "));
break;
case QStyle::PM_MenuPanelWidth:
bufferPtr.Append(_L("MenuPanelWidth: "));
break;
case QStyle::PM_MenuHMargin:
bufferPtr.Append(_L("MenuHMargin: "));
break;
case QStyle::PM_MenuVMargin:
bufferPtr.Append(_L("MenuVMargin: "));
break;
case QStyle::PM_MenuDesktopFrameWidth:
bufferPtr.Append(_L("MenuFrameWidth: "));
break;
case QStyle::PM_SmallIconSize:
bufferPtr.Append(_L("SmallIconSize: "));
break;
case QStyle::PM_FocusFrameHMargin:
bufferPtr.Append(_L("FocusFrameHMargin: "));
break;
case QStyle::PM_FocusFrameVMargin:
bufferPtr.Append(_L("FocusFrameVMargin: "));
break;
case QStyle::PM_ToolBarIconSize:
bufferPtr.Append(_L("ToolBarIconSize: "));
break;
case QStyle::PM_TitleBarHeight: // use titlepane height
bufferPtr.Append(_L("TitleBarHeight: "));
break;
case QStyle::PM_IndicatorWidth:
bufferPtr.Append(_L("IndicatorWidth: "));
break;
case QStyle::PM_IndicatorHeight:
bufferPtr.Append(_L("IndicatorHeight: "));
break;
case QStyle::PM_ExclusiveIndicatorHeight:
bufferPtr.Append(_L("ExclusiveIndHeight: "));
break;
case QStyle::PM_ExclusiveIndicatorWidth:
bufferPtr.Append(_L("ExclusiveIndWidth: "));
break;
case QStyle::PM_HeaderMargin: // not in S60
bufferPtr.Append(_L("HeaderMargin: "));
break;
case QStyle::PM_MenuScrollerHeight: // not in S60
bufferPtr.Append(_L("MenuScrollerHeight: "));
break;
case QStyle::PM_MenuTearoffHeight: // not in S60
bufferPtr.Append(_L("MenuTearoffHeight: "));
break;
case QStyle::PM_DockWidgetFrameWidth: // not in S60
bufferPtr.Append(_L("DockFrameWidth: "));
break;
case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
bufferPtr.Append(_L("DockSepExtent: "));
break;
case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
bufferPtr.Append(_L("MdiSubWndMinWidth: "));
break;
case QStyle::PM_HeaderGripMargin: // not in S60
bufferPtr.Append(_L("HeaderGripMargin: "));
break;
case QStyle::PM_SplitterWidth: // not in S60
bufferPtr.Append(_L("SplitterWidth: "));
break;
case QStyle::PM_ToolBarExtensionExtent: // not in S60
bufferPtr.Append(_L("ToolBarExtExtent: "));
break;
case QStyle::PM_ToolBarSeparatorExtent: // not in S60
bufferPtr.Append(_L("ToolBarSepExtent: "));
break;
case QStyle::PM_ToolBarHandleExtent: // not in s60
bufferPtr.Append(_L("ToolBarHandleExtent: "));
break;
case QStyle::PM_MenuButtonIndicator: // none???
bufferPtr.Append(_L("MenuButtonIndicator: "));
break;
case QStyle::PM_ButtonShiftHorizontal: //none in 3.x
bufferPtr.Append(_L("ButtonShiftHorizontal: "));
break;
case QStyle::PM_ButtonShiftVertical: // none in 3.x
bufferPtr.Append(_L("ButtonShiftVertical: "));
break;
case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together
bufferPtr.Append(_L("TabScrollBtnOverlap: "));
break;
case QStyle::PM_SizeGripSize: // use default
bufferPtr.Append(_L("SizeGripSize: "));
break;
case QStyle::PM_DockWidgetHandleExtent:
bufferPtr.Append(_L("DockWdgtHandleExt: "));
break;
case QStyle::PM_CheckListButtonSize:
bufferPtr.Append(_L("CheckListButtonSize: "));
break;
case QStyle::PM_CheckListControllerSize:
bufferPtr.Append(_L("CheckListCntlerSize: "));
break;
case QStyle::PM_DialogButtonsSeparator:
bufferPtr.Append(_L("DialogBtnSeparator: "));
break;
case QStyle::PM_DialogButtonsButtonWidth:
bufferPtr.Append(_L("DialogBtnWidth: "));
break;
case QStyle::PM_DialogButtonsButtonHeight:
bufferPtr.Append(_L("DialogBtnHeight: "));
break;
case QStyle::PM_HeaderMarkSize:
bufferPtr.Append(_L("HeaderMarkSize: "));
break;
case QStyle::PM_SpinBoxSliderHeight:
bufferPtr.Append(_L("SpinBoxSliderHeight: "));
break;
case QStyle::PM_DefaultTopLevelMargin:
bufferPtr.Append(_L("DefaultTopLvlMrg: "));
break;
case QStyle::PM_DefaultChildMargin:
bufferPtr.Append(_L("DefaultChildMrg: "));
break;
case QStyle::PM_DefaultLayoutSpacing:
bufferPtr.Append(_L("DefaultlayoutSpc: "));
break;
case QStyle::PM_TabCloseIndicatorWidth:
bufferPtr.Append(_L("TabCloseIndWidth: "));
break;
case QStyle::PM_TabCloseIndicatorHeight:
bufferPtr.Append(_L("TabCloseIndHeight: "));
break;
case QStyle::PM_ScrollView_ScrollBarSpacing:
bufferPtr.Append(_L("ScrollViewBarSpc: "));
break;
case QStyle::PM_SubMenuOverlap:
bufferPtr.Append(_L("SubMenuOverlap: "));
break;
case QStyle::PM_Custom_FrameCornerHeight:
bufferPtr.Append(_L("C_FrCornerHeight: "));
break;
case QStyle::PM_Custom_FrameCornerWidth:
bufferPtr.Append(_L("C_FrCornerWidth: "));
break;
case QStyle::PM_Custom_ThinLineWidth:
bufferPtr.Append(_L("C_ThinLineWidth: "));
break;
case QStyle::PM_Custom_BoldLineWidth:
bufferPtr.Append(_L("C_BoldLineWidth: "));
break;
case QStyle::PM_Custom_MessageBoxHeight:
bufferPtr.Append(_L("C_MsgBoxHeight: "));
break;
default:
bufferPtr.Append(_L("Default: "));
break;
}
if (iFileOutputOn)
{
bufferPtr.Append('\t');
}
bufferPtr.AppendNum(aValue);
bufferPtr.Append(_L(" "));
ShowL( *buffer, aLast, iFileOutputOn );
CleanupStack::PopAndDestroy( buffer );
}
void CPixelMetricsMapperAppUi::ClearL()
{
iView->ClearL();
}
void CPixelMetricsMapperAppUi::CreateHeaderFileL() const
{
// Open/create resulting file.
RFile file;
HBufC* layoutFile = HBufC::NewLC( KMaxFileName );
*layoutFile = KLayoutSourceFileAndPath;
TFileName fileName = *layoutFile;
CleanupStack::PopAndDestroy(layoutFile);
RFs& fs = CEikonEnv::Static()->FsSession();
TInt error = file.Open(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText );
if (error==KErrNotFound)
{
file.Create(fs,fileName, EFileWrite|EFileShareAny|EFileStreamText);
}
CleanupClosePushL( file );
file.SetSize( 0 );
// Make all writes as from textfile.
TFileText textFile;
textFile.Set( file );
textFile.Seek( ESeekStart );
// Take all layout files from private folder.
CDir* dirList;
User::LeaveIfError(fs.GetDir(
KPixelMetricsDataFiles,
KEntryAttMaskSupported,
ESortByName,
dirList));
TMySmallBuffer bufferLayoutHdr;
TMyBigBuffer bufferPMData;
TInt fileCount = dirList->Count();
for (TInt i=0;i<fileCount;i++)
{
// open sourcefile
RFile sourceFile;
TFileName layoutFile = (*dirList)[i].iName;
User::LeaveIfError( sourceFile.Open(
fs,layoutFile, EFileRead|EFileShareAny|EFileStreamText ));
CleanupClosePushL( sourceFile );
// Make all reads as from textfile.
TFileText textSourceFile;
textSourceFile.Set( sourceFile );
TFileName layoutName = CreateLayoutNameL( textSourceFile );
// rewind - just in case.
textSourceFile.Seek( ESeekStart );
TFileName oneline;
bufferLayoutHdr.Append(KOpenBrace);
bufferPMData.Append(KOpenBrace);
TInt loop = 0;
FOREVER
{
if( textSourceFile.Read(oneline) != KErrNone )
{
break;
}
// Add commas for all but first line
if (loop != 0)
{
if ( loop <= KHeaderValues-1)
{
bufferLayoutHdr.Append(KComma);
}
else
{
if (loop != KHeaderValues)
{
bufferPMData.Append(KComma);
}
}
if (loop==KHeaderValues)
{
bufferLayoutHdr.Append(_L(",QLatin1String(\""));
bufferLayoutHdr.Append(layoutName);
bufferLayoutHdr.Append(_L("\")"));
}
}
// Remove pixel metrics name and ":"
oneline = oneline.Mid(oneline.Find(KColon)+1);
// Remove tab
oneline = oneline.Mid(oneline.Find(KTab)+1);
// remove crap from the end of line
TLex lex(oneline);
TInt nextValue = -666;
User::LeaveIfError( lex.Val(nextValue) );
if ( loop <= KHeaderValues-1)
{
bufferLayoutHdr.AppendNum(nextValue);
}
else
{
if (nextValue == -909)
bufferPMData.Append(_L("ECommonStyleValue"));
else
bufferPMData.AppendNum(nextValue);
}
oneline.Zero();
loop++;
}
file.Flush();
bufferLayoutHdr.Append(KEndBraceWithCommaAndCRLF);
bufferPMData.Append(KEndBraceWithCommaAndCRLF);
CleanupStack::PopAndDestroy(); //sourceFile
}
if (fileCount > 0)
{
bufferLayoutHdr = bufferLayoutHdr.Left(bufferLayoutHdr.Length()-2);
bufferPMData = bufferPMData.Left(bufferPMData.Length()-2);
textFile.Write(bufferLayoutHdr);
textFile.Write(KCRLF);
textFile.Write(bufferPMData);
}
delete dirList;
CleanupStack::PopAndDestroy(); //file
}
TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) const
{
aFileHandle.Seek(ESeekStart);
// Layout data is deployed like this:
// first line - height
// second line - width
TFileName lines;
TFileName layoutName;
TInt height = -666;
TInt width = -666;
// Collect name information.
for (TInt i=0; i<6; i++)
{
User::LeaveIfError(aFileHandle.Read(lines));
// Remove pixel metrics name and ":"
lines = lines.Mid(lines.Find(KColon)+1);
// Remove tab
lines = lines.Mid(lines.Find(KTab)+1);
TLex myLexer(lines);
TInt error = KErrNone;
if (i==0) //height is first
{
error = myLexer.Val(height);
}
if (i==1) //width is second
{
error = myLexer.Val(width);
}
User::LeaveIfError(error);
}
// Interpret results and write name to buffer.
if ( (width == 240 && height == 320) ||
(width == 320 && height == 240))
{
layoutName.Append(_L("QVGA "));
}
else if ( (width == 360 && height == 640) ||
(width == 640 && height == 360))
{
layoutName.Append(_L("NHD "));
}
else if ( (width == 480 && height == 640) ||
(width == 640 && height == 480))
{
layoutName.Append(_L("VGA "));
}
else if ( (width == 800 && height == 352) ||
(width == 352 && height == 800))
{
layoutName.Append(_L("E90 "));
}
else if ( (width == 800 && height == 480) ||
(width == 480 && height == 800) ||
(width == 848 && height == 480) ||
(width == 480 && height == 848) ||
(width == 854 && height == 480) ||
(width == 480 && height == 854))
{
layoutName.Append(_L("WVGA "));
}
else if ( (width == 480 && height == 320) ||
(width == 320 && height == 480) ||
(width == 640 && height == 240) ||
(width == 240 && height == 640))
{
layoutName.Append(_L("HVGA "));
}
else
{
layoutName.Append(_L("Unknown "));
layoutName.AppendNum(height);
layoutName.Append(_L("x"));
layoutName.AppendNum(width);
}
if (width > height)
{
layoutName.Append(_L("Landscape"));
}
else
{
layoutName.Append(_L("Portrait"));
}
return layoutName;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
CEikAppUi* CPixelMetricsMapperDocument::CreateAppUiL()
{
return( new ( ELeave ) CPixelMetricsMapperAppUi );
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperDocument::ConstructL()
{
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TUid CPixelMetricsMapperApplication::AppDllUid() const
{
return KUidPMMapperApplication;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
CApaDocument* CPixelMetricsMapperApplication::CreateDocumentL()
{
CPixelMetricsMapperDocument* document =
new( ELeave ) CPixelMetricsMapperDocument( *this );
CleanupStack::PushL( document );
document->ConstructL();
CleanupStack::Pop();
return( document );
}
// ========================== OTHER EXPORTED FUNCTIONS =========================
// ---------------------------------------------------------
// NewApplication implements
//
// Creates an instance of application.
//
// Returns: an instance of CVtUiApp
// ---------------------------------------------------------
//
LOCAL_C CApaApplication* NewApplication()
{
return new CPixelMetricsMapperApplication;
}
// ---------------------------------------------------------
// E32Main implements
//
// It is called when executable is started.
//
// Returns: error code.
// ---------------------------------------------------------
//
GLDEF_C TInt E32Main()
{
return EikStart::RunApplication( NewApplication );
}
// End of File

View File

@ -1,190 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PMMAPPERAPP_H
#define PMMAPPERAPP_H
// INCLUDES
#include <eikapp.h>
#include <eikdoc.h>
#include <e32std.h>
#include <aknViewAppUi.h>
// CONSTANTS
const TUid KUidPMMapperApplication = { 0x2002121F };
// FORWARD DECLARATIONS
class CPixelMetricsMapperView;
class MAknsSkinInstance;
// CLASS DECLARATION
/**
* CPixelMetricsMapperDocument
*/
class CPixelMetricsMapperDocument : public CEikDocument
{
public: // Constructors and destructor
/**
* Symbian 2nd phase constructor.
*/
void ConstructL();
/**
* Constructor.
*/
CPixelMetricsMapperDocument( CEikApplication& aApp )
: CEikDocument( aApp ) {}
/**
* Destructor.
*/
~CPixelMetricsMapperDocument(){}
public: // Functions from base classes
/**
* From CEikDocument.
*/
CFileStore* OpenFileL(
TBool /*aDoOpen*/,
const TDesC& /*aFilename*/,
RFs& /*aFs*/ )
{
return NULL;
}
private: // Functions from base classes
/**
* From CEikDocument.
*/
CEikAppUi* CreateAppUiL();
};
/**
* CPixelMetricsMapperAppUi
*/
class CPixelMetricsMapperAppUi : public CAknViewAppUi
{
public: // Constructors and destructor
/**
* Constructor.
*/
CPixelMetricsMapperAppUi();
/**
* Symbian 2nd phase constructor.
*/
void ConstructL();
/**
* Destructor.
*/
~CPixelMetricsMapperAppUi();
private: // Functions from base classes
/**
* From CEikAppUi.
*/
void HandleCommandL(TInt aCommand);
/**
* From CEikAppUi.
*/
virtual TKeyResponse HandleKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType );
private:
/**
* Shows text given.
*/
void ShowL( const TDesC& aText, TBool& aLast, const TBool& aFileOutput = EFalse );
void ShowSingleValueL(TInt& aPixelMetric, TInt& aValue, TBool& aLast);
void ClearL();
void CreateHeaderFileL() const;
TFileName CreateLayoutNameL(TFileText& aFileHandle) const;
private: // Data
// Test view.
CPixelMetricsMapperView* iView;
CEikDialog* iDialog;
TBool iFileOutputOn;
TBool iMode;
CFbsBitmap* icon;
CFbsBitmap* iconMask;
};
/**
* CPixelMetricsMapperApplication
*/
class CPixelMetricsMapperApplication : public CEikApplication
{
private: // Functions from base classes
/**
* From CApaApplication.
*/
CApaDocument* CreateDocumentL();
/**
* From CApaApplication.
*/
TUid AppDllUid() const;
};
#endif // PMMAPPERAPP_H
// End of File

View File

@ -1,375 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
// INCLUDE FILES
#include <eiklabel.h>
#include <avkon.rsg>
#include <aknviewappui.h>
#include <aknconsts.h>
#include "pm_mapper.hrh"
#include <pm_mapper.rsg>
#include "pm_mapperView.h"
#include "pm_mapperApp.h"
#include <aknlists.h>
#include <avkon.hrh>
#include <AknUtils.h>
// -----------------------------------------------------------------------------
// C++ constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
CPixelMetricsMapperViewContainer::CPixelMetricsMapperViewContainer(): iCount( 1 )
{
}
// -----------------------------------------------------------------------------
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ConstructL( const TRect& aRect )
{
CreateWindowL();
SetCanDrawOutsideRect();
iTexts = new( ELeave ) CDesCArrayFlat( 10 );
iTexts->AppendL( _L( "\tStarted." ) );
iListbox = new( ELeave ) CAknSingleStyleListBox;
iListbox->SetContainerWindowL( *this );
iListbox->ConstructL( this, EAknListBoxViewerFlags );
iListbox->Model()->SetItemTextArray( iTexts );
iListbox->SetRect( TRect( aRect.Size() ) );
iListbox->CreateScrollBarFrameL( ETrue );
iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(
CEikScrollBarFrame::EOn,
CEikScrollBarFrame::EOn );
SetRect( aRect );
iListbox->ActivateL();
ActivateL();
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput )
{
MDesCArray* itemList = iListbox->Model()->ItemTextArray();
CDesCArray* itemArray = ( CDesCArray* ) itemList;
itemArray->AppendL( aString );
iListbox->HandleItemAdditionL();
iListbox->SetCurrentItemIndex( iCount );
iCount++;
if ( aLast )
{
if (aFileOutput)
{
RFile file;
RFs& fs = CEikonEnv::Static()->FsSession();
TFileName fileName =_L("Layout_");
TRect screenRect;
AknLayoutUtils::LayoutMetricsRect(
AknLayoutUtils::EApplicationWindow,
screenRect );
// Add screen dimensions
TInt height = screenRect.Height();
TInt width = screenRect.Width();
fileName.AppendNum(height);
fileName.Append('_');
fileName.AppendNum(width);
fileName.Append(_L(".txt"));
TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
if (err==KErrNotFound) // file does not exist - create it
err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny);
else
file.SetSize(0); //sweep the file
TFileText textFile;
textFile.Set(file);
err = textFile.Seek(ESeekStart);
if (err) User::InfoPrint(_L("File corrupted"));
// Finally loop through all the entries:
TInt idx = 0;
for(;idx!=itemList->MdcaCount();idx++)
{
err = textFile.Write(itemList->MdcaPoint(idx));
if (err) User::InfoPrint(_L("File corrupted"));
}
file.Close();
}
DrawNow();
}
}
void CPixelMetricsMapperViewContainer::ClearL()
{
MDesCArray* itemList = iListbox->Model()->ItemTextArray();
CDesCArray* itemArray = ( CDesCArray* ) itemList;
itemArray->Reset();
iListbox->HandleItemAdditionL();
iCount = 0;
DrawNow();
}
// -----------------------------------------------------------------------------
// Destructor.
// -----------------------------------------------------------------------------
//
CPixelMetricsMapperViewContainer::~CPixelMetricsMapperViewContainer()
{
delete iListbox;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::SizeChanged()
{
CCoeControl::SizeChanged();
if ( iListbox )
{
iListbox->SetRect( Rect() );
}
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TInt CPixelMetricsMapperViewContainer::CountComponentControls() const
{
return 1;
}
// -----------------------------------------------------------------------------
// CTestAppViewContainer::ComponentControl
//
//
// -----------------------------------------------------------------------------
//
CCoeControl* CPixelMetricsMapperViewContainer::ComponentControl(
TInt /*aIndex*/ ) const
{
return iListbox;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::Draw( const TRect& /*aRect*/ ) const
{
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::HandleControlEventL(
CCoeControl* /*aControl*/,
TCoeEvent /*aEventType*/ )
{
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TKeyResponse CPixelMetricsMapperViewContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if (aKeyEvent.iCode == EKeyUpArrow ||
aKeyEvent.iCode == EKeyDownArrow )
{
return iListbox->OfferKeyEventL( aKeyEvent, aType );
}
return EKeyWasNotConsumed;
}
void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType)
{
CCoeControl::HandleResourceChange( aType );
if ( aType == KEikDynamicLayoutVariantSwitch )
{
TRect mainPaneRect;
AknLayoutUtils::LayoutMetricsRect(
AknLayoutUtils::EMainPane,
mainPaneRect );
SetRect( mainPaneRect );
}
if (iListbox)
iListbox->HandleResourceChange(aType);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperView::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput )
{
iView->ShowL( aString, aLast, aFileOutput );
}
void CPixelMetricsMapperView::ClearL()
{
iView->ClearL();
}
// -----------------------------------------------------------------------------
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperView::ConstructL()
{
BaseConstructL( R_PMMAPPER_VIEW );
}
// -----------------------------------------------------------------------------
// Destructor.
// -----------------------------------------------------------------------------
//
CPixelMetricsMapperView::~CPixelMetricsMapperView()
{
if ( iView )
{
AppUi()->RemoveFromViewStack( *this, iView );
}
delete iView;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
TUid CPixelMetricsMapperView::Id() const
{
return TUid::Uid( EPMMapperViewId );
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperView::HandleCommandL( TInt aCommand )
{
AppUi()->HandleCommandL( aCommand );
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperView::HandleStatusPaneSizeChange()
{
if ( iView )
{
TRect cr = ClientRect();
iView->SetRect( cr );
}
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperView::DoActivateL(
const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/ )
{
iView = new( ELeave ) CPixelMetricsMapperViewContainer;
TRect cr = ClientRect();
iView->ConstructL( cr );
AppUi()->AddToViewStackL( *this, iView );
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperView::DoDeactivate()
{
if (iView)
{
AppUi()->RemoveFromViewStack( *this, iView );
}
delete iView;
iView = NULL;
}
// End of File

View File

@ -1,228 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the utility applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef PMMAPPERVIEW_H
#define PMMAPPERVIEW_H
// INCLUDES
#include <aknview.h>
#include <EIKLBO.H>
// CONSTANTS
// FORWARD DECLARATIONS
class CAknSingleStyleListBox;
class CAknSettingStyleListBox;
// CLASS DECLARATION
/**
* CPixelMetricsMapperViewContainer
*
*/
class CPixelMetricsMapperViewContainer
: public CCoeControl,
public MCoeControlObserver
{
public: // Constructors and destructor
/**
* C++ constructor.
*/
CPixelMetricsMapperViewContainer();
/**
* Symbian 2nd phase constructor.
*
* @param aRect Rectangle.
*/
void ConstructL( const TRect& aRect );
/**
* Destructor.
*/
~CPixelMetricsMapperViewContainer();
public: // New functions
/**
* Show the given string.
*
* @param aString The string to be shown.
*/
void ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput = EFalse );
void ClearL();
public: // Functions from base classes
/**
* From CCoeControl.
*/
TKeyResponse OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType );
void HandleResourceChange(TInt aType);
private: // Functions from base classes
/**
* From CCoeControl.
*/
void SizeChanged();
/**
* From CCoeControl.
*/
TInt CountComponentControls() const;
/**
* From CCoeControl.
*/
CCoeControl* ComponentControl( TInt aIndex ) const;
/**
* From CCoeControl.
*/
void Draw( const TRect& aRect ) const;
private: // Functions from base classes
/**
* From MCoeControlObserver.
*/
void HandleControlEventL(
CCoeControl* aControl,
TCoeEvent aEventType );
private: // Data
// Texts.
CDesCArray* iTexts;
// Count.
TInt iCount;
// Listbox.
CAknSingleStyleListBox* iListbox;
};
/**
* CPixelMetricsMapperView
*
*
* @since 1.0
*/
class CPixelMetricsMapperView : public CAknView
{
public: // Constructors and destructor
/**
* Symbian 2nd phase constructor.
*/
void ConstructL();
/**
* Destructor.
*/
~CPixelMetricsMapperView();
public: // Functions from base classes
/**
* From CAknView.
*/
TUid Id() const;
/**
* From CAknView.
*/
void HandleCommandL( TInt aCommand );
/**
* From CAknView.
*/
void HandleStatusPaneSizeChange();
/**
* From CAknView.
*/
void ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput =EFalse );
void ClearL();
private: // from CAknView
/**
* From CAknView.
*/
void DoActivateL(
const TVwsViewId& aPrevViewId,
TUid aCustomMessageId,
const TDesC8& aCustomMessage );
/**
* From CAknView.
*/
void DoDeactivate();
private: // Data
// The view container.
CPixelMetricsMapperViewContainer* iView;
};
#endif // PMMAPPERVIEW_H
// End of File

View File

@ -1,31 +0,0 @@
's60theme' is a commandline tool which converts Carbide.ui themes into
an intermediate binary format that can be read by the simulated
QS60Style. So, for example Designer (standalone or in Carbide) will
be able to display a realistic S60 Ui.
The intermediate binary format consists of hashes of QPictures and
QColors, streamed to a QByteArray and compressed. QS60Style could not load
the Carbide.ui theme directly because SVG handling is unfortunately
not part of QtGui, and would require a dependency on the QtSvg module.
Also, 's60theme' uses QWebkit to parse the SVG graphics (inspired by
Ariya's 'WebKit-based SVG rasterizer' labs post). QtSvg had some issues
with the SVGs that come with Carbide.ui.
Usage examples:
> s60theme "com.nokia.tools.theme.s60.50_3.4.0.0\config\model" Default.blob
(Reads the default 's60.50' theme and saves it as 'Default.blob')
> s60theme "Eclipse\Examples\Haze\Haze.tdf" Haze.blob
(Reads the Haze theme and saves it as 'Haze.blob')
To use the blob in a Qt application, get an instance of a QS60Style and call
style->loadS60ThemeFromBlob("Theme.blob");
The simulated QS60Style will, in its constructor by default, try to load a
":/s60Stylethemes/Default.blob". If your application has that a resource with
exactly that filename, it will be used by default.
'Default.blob' is not included in the current Qt source package. But it can
easily be created with 's60theme' and a fresh install of Carbide.ui
Visit http://www.forum.nokia.com for details about Carbide.ui

View File

@ -1,110 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui>
#include "s60themeconvert.h"
<<<<<<< HEAD
int help()
=======
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
QT_BEGIN_NAMESPACE
/*!
\class QAccessiblePlugin
\brief The QAccessiblePlugin class provides an abstract base for
accessibility plugins.
\ingroup plugins
\ingroup accessibility
\inmodule QtWidgets
Writing an accessibility plugin is achieved by subclassing this
base class, reimplementing the pure virtual functions keys() and
create(), and exporting the class with the Q_EXPORT_PLUGIN2()
macro.
\sa QAccessibleBridgePlugin, {How to Create Qt Plugins}
*/
/*!
Constructs an accessibility plugin with the given \a parent. This
is invoked automatically by the Q_EXPORT_PLUGIN2() macro.
*/
QAccessiblePlugin::QAccessiblePlugin(QObject *parent)
: QObject(parent)
>>>>>>> Move the documentation for the classes to their modules.
{
qDebug() << "Usage: s60theme [modeldir|theme.tdf] output.blob";
qDebug() << "";
qDebug() << "Options:";
qDebug() << " modeldir: Theme 'model' directory in Carbide.ui tree";
qDebug() << " theme.tdf: Theme .tdf file";
qDebug() << " output.blob: Theme blob output filename";
qDebug() << "";
qDebug() << "s60theme takes an S60 theme from Carbide.ui and converts";
qDebug() << "it into a compact, binary format, that can be directly loaded by";
qDebug() << "the QtS60Style.";
qDebug() << "";
qDebug() << "Visit http://www.forum.nokia.com for details about Carbide.ui";
return 1;
}
int main(int argc, char *argv[])
{
if (argc != 3)
return help();
QApplication app(argc, argv);
const QString input = QString::fromLatin1(argv[1]);
const QFileInfo inputInfo(input);
const QString output = QString::fromLatin1(argv[2]);
if (inputInfo.isDir())
return S60ThemeConvert::convertDefaultThemeToBlob(input, output) ? 0 : 1;
else if (inputInfo.suffix().compare(QString::fromLatin1("tdf"), Qt::CaseInsensitive) == 0)
return S60ThemeConvert::convertTdfToBlob(input, output) ? 0 : 1;
return help();
}

View File

@ -1,12 +0,0 @@
SOURCES += \
s60themeconvert.cpp \
main.cpp
HEADERS += \
s60themeconvert.h
QT += \
webkit
CONFIG += \
console

View File

@ -1,312 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "s60themeconvert.h"
#include <QtGui>
#include <QtWebKit>
static const int pictureSize = 256;
static const char* const msgPartNotInTdf = " Warning: The .tdf file does not have a part for ";
static const char* const msgSvgNotFound = " Fatal: Could not find part .svg ";
void dumpPartPictures(const QHash<QString, QPicture> &partPictures) {
foreach (const QString &partKey, partPictures.keys()) {
QPicture partPicture = partPictures.value(partKey);
qDebug() << partKey << partPicture.boundingRect();
QImage image(partPicture.boundingRect().size(), QImage::Format_ARGB32);
image.fill(Qt::transparent);
QPainter p(&image);
partPicture.play(&p);
image.save(partKey + QString::fromLatin1(".png"));
}
}
void dumpColors(const QHash<QPair<QString, int>, QColor> &colors) {
foreach (const QColor &color, colors.values()) {
const QPair<QString, int> key = colors.key(color);
qDebug() << key << color;
}
}
class WebKitSVGRenderer : public QWebView
{
Q_OBJECT
public:
WebKitSVGRenderer(QWidget *parent = 0);
QPicture svgToQPicture(const QString &svgFileName);
private slots:
void loadFinishedSlot(bool ok);
private:
QEventLoop m_loop;
QPicture m_result;
};
WebKitSVGRenderer::WebKitSVGRenderer(QWidget *parent)
: QWebView(parent)
{
connect(this, SIGNAL(loadFinished(bool)), SLOT(loadFinishedSlot(bool)));
setFixedSize(pictureSize, pictureSize);
QPalette pal = palette();
pal.setColor(QPalette::Base, Qt::transparent);
setPalette(pal);
}
QPicture WebKitSVGRenderer::svgToQPicture(const QString &svgFileName)
{
load(QUrl::fromLocalFile(svgFileName));
m_loop.exec();
return m_result;
}
void WebKitSVGRenderer::loadFinishedSlot(bool ok)
{
// crude error-checking
if (!ok)
qDebug() << "Failed loading " << qPrintable(url().toString());
page()->mainFrame()->evaluateJavaScript(QString::fromLatin1(
"document.rootElement.preserveAspectRatio.baseVal.align = SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE;"
"document.rootElement.style.width = '100%';"
"document.rootElement.style.height = '100%';"
"document.rootElement.width.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100);"
"document.rootElement.height.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100);"
));
m_result = QPicture(); // "Clear"
QPainter p(&m_result);
page()->mainFrame()->render(&p);
p.end();
m_result.setBoundingRect(QRect(0, 0, pictureSize, pictureSize));
m_loop.exit();
}
QPair<QString, int> colorIdPair(const QString &colorID)
{
QPair<QString, int> result;
QString idText = colorID;
idText.remove(QRegExp(QString::fromLatin1("[0-9]")));
if (QS60Style::colorListKeys().contains(idText)) {
QString idNumber = colorID;
idNumber.remove(QRegExp(QString::fromLatin1("[a-zA-Z]")));
result.first = idText;
result.second = idNumber.toInt();
}
return result;
}
bool parseTdfFile(const QString &tdfFile,
QHash<QString, QString> &partSvgs,
QHash<QPair<QString, int>, QColor> &colors)
{
QFile file(tdfFile);
if (!file.open(QIODevice::ReadOnly))
return false;
const QLatin1String elementKey("element");
const QLatin1String partKey("part");
const QLatin1String elementIdKey("id");
const QLatin1String layerKey("layer");
const QLatin1String layerFileNameKey("filename");
const QLatin1String layerColourrgbKey("colourrgb");
const QString annoyingPrefix = QString::fromLatin1("S60_2_6%");
QXmlStreamReader reader(&file);
QString partId;
QPair<QString, int> colorId;
// Somebody with a sense of aesthetics may implement proper XML parsing, here.
while (!reader.atEnd()) {
const QXmlStreamReader::TokenType token = reader.readNext();
switch (token) {
case QXmlStreamReader::StartElement:
if (reader.name() == elementKey || reader.name() == partKey) {
QString id = reader.attributes().value(elementIdKey).toString();
if (QS60Style::partKeys().contains(id))
partId = id;
else if (!id.isEmpty() && id.at(id.length()-1).isDigit())
colorId = colorIdPair(id);
else if (QS60Style::partKeys().contains(id.mid(annoyingPrefix.length())))
partId = id.mid(annoyingPrefix.length());
} else if(reader.name() == layerKey) {
if (!partId.isEmpty()) {
const QString svgFile = reader.attributes().value(layerFileNameKey).toString();
partSvgs.insert(partId, svgFile);
partId.clear();
} else if (!colorId.first.isEmpty()) {
const QColor colorValue(reader.attributes().value(layerColourrgbKey).toString().toInt(NULL, 16));
colors.insert(colorId, colorValue);
colorId.first.clear();
}
}
break;
case QXmlStreamReader::EndElement:
if (reader.tokenString() == elementKey || reader.name() == partKey)
partId.clear();
break;
default:
break;
}
}
return true;
}
bool loadThemeFromTdf(const QString &tdfFile,
QHash<QString, QPicture> &partPictures,
QHash<QPair<QString, int>, QColor> &colors)
{
QHash<QString, QString> parsedPartSvgs;
QHash<QString, QPicture> parsedPartPictures;
QHash<QPair<QString, int>, QColor> parsedColors;
bool success = parseTdfFile(tdfFile, parsedPartSvgs, parsedColors);
if (!success)
return false;
const QString tdfBasePath = QFileInfo(tdfFile).absolutePath();
WebKitSVGRenderer renderer;
foreach (const QString &partKey, QS60Style::partKeys()) {
qDebug() << partKey;
QString tdfFullName;
if (parsedPartSvgs.contains(partKey)) {
tdfFullName = tdfBasePath + QDir::separator() + parsedPartSvgs.value(partKey);
} else {
qWarning() << msgPartNotInTdf << partKey;
tdfFullName = tdfBasePath + QDir::separator() + partKey + QLatin1String(".svg");
}
if (!QFile(tdfFullName).exists()) {
qWarning() << msgSvgNotFound << QDir::toNativeSeparators(tdfFullName);
return false;
}
const QPicture partPicture = renderer.svgToQPicture(tdfFullName);
parsedPartPictures.insert(partKey, partPicture);
}
// dumpPartPictures(parsedPartPictures);
// dumpColors(colors);
partPictures = parsedPartPictures;
colors = parsedColors;
return true;
}
bool S60ThemeConvert::convertTdfToBlob(const QString &themeTdf, const QString &themeBlob)
{
QHash<QString, QPicture> partPictures;
QHash<QPair<QString, int>, QColor> colors;
if (!::loadThemeFromTdf(themeTdf, partPictures, colors))
return false;
QS60Style style;
style.setS60Theme(partPictures, colors);
return style.saveS60ThemeToBlob(themeBlob);
}
bool parseDesignFile(const QString &designFile,
QHash<QPair<QString, int>, QColor> &colors)
{
const QLatin1String elementKey("element");
const QLatin1String elementIdKey("id");
const QLatin1String colorKey("defaultcolour_rgb");
QFile file(designFile);
if (!file.open(QIODevice::ReadOnly))
return false;
QXmlStreamReader reader(&file);
QPair<QString, int> colorId;
// Somebody with a sense of aesthetics may implement proper XML parsing, here.
while (!reader.atEnd()) {
const QXmlStreamReader::TokenType token = reader.readNext();
switch (token) {
case QXmlStreamReader::StartElement:
if (reader.name() == elementKey) {
const QString colorString = reader.attributes().value(colorKey).toString();
if (!colorString.isEmpty()) {
const QString colorId = reader.attributes().value(elementIdKey).toString();
colors.insert(colorIdPair(colorId), colorString.toInt(NULL, 16));
}
}
default:
break;
}
}
return true;
}
bool loadDefaultTheme(const QString &themePath,
QHash<QString, QPicture> &partPictures,
QHash<QPair<QString, int>, QColor> &colors)
{
const QDir dir(themePath);
if (!dir.exists())
return false;
if (!parseDesignFile(themePath + QDir::separator() + QString::fromLatin1("defaultdesign.xml"), colors))
return false;
WebKitSVGRenderer renderer;
foreach (const QString &partKey, QS60Style::partKeys()) {
const QString partFileName = partKey + QLatin1String(".svg");
const QString partFile(dir.absolutePath() + QDir::separator() + partFileName);
if (!QFile::exists(partFile)) {
qWarning() << msgSvgNotFound << partFileName;
return false;
}
const QPicture partPicture = renderer.svgToQPicture(partFile);
partPictures.insert(partKey, partPicture);
}
return true;
}
bool S60ThemeConvert::convertDefaultThemeToBlob(const QString &themePath, const QString &themeBlob)
{
QHash<QString, QPicture> partPictures;
QHash<QPair<QString, int>, QColor> colors;
if (!::loadDefaultTheme(themePath, partPictures, colors))
return false;
QS60Style style;
style.setS60Theme(partPictures, colors);
return style.saveS60ThemeToBlob(themeBlob);
}
#include "s60themeconvert.moc"

View File

@ -1,54 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60THEMECONVERT_H
#define S60THEMECONVERT_H
#include <QString>
class S60ThemeConvert
{
public:
static bool convertTdfToBlob(const QString &themeTdf, const QString &themeBlob);
static bool convertDefaultThemeToBlob(const QString &themePath, const QString &themeBlob);
};
#endif // S60THEMECONVERT_H