summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/s60pixelmetrics/bld.inf45
-rw-r--r--util/s60pixelmetrics/pixel_metrics.cpp1223
-rw-r--r--util/s60pixelmetrics/pixel_metrics.h216
-rw-r--r--util/s60pixelmetrics/pm_mapper.hrh73
-rw-r--r--util/s60pixelmetrics/pm_mapper.mmp91
-rw-r--r--util/s60pixelmetrics/pm_mapper.pkg32
-rw-r--r--util/s60pixelmetrics/pm_mapper.rss162
-rw-r--r--util/s60pixelmetrics/pm_mapper_reg.rss57
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.cpp1044
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.h198
-rw-r--r--util/s60pixelmetrics/pm_mapperview.cpp375
-rw-r--r--util/s60pixelmetrics/pm_mapperview.h228
-rw-r--r--util/s60theme/README31
-rw-r--r--util/s60theme/main.cpp78
-rw-r--r--util/s60theme/s60theme.pro12
-rw-r--r--util/s60theme/s60themeconvert.cpp301
-rw-r--r--util/s60theme/s60themeconvert.h54
17 files changed, 4220 insertions, 0 deletions
diff --git a/util/s60pixelmetrics/bld.inf b/util/s60pixelmetrics/bld.inf
new file mode 100644
index 0000000..748e8810
--- /dev/null
+++ b/util/s60pixelmetrics/bld.inf
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+PRJ_MMPFILES
+pm_mapper.mmp
+
+// End of File
diff --git a/util/s60pixelmetrics/pixel_metrics.cpp b/util/s60pixelmetrics/pixel_metrics.cpp
new file mode 100644
index 0000000..8925ebe
--- /dev/null
+++ b/util/s60pixelmetrics/pixel_metrics.cpp
@@ -0,0 +1,1223 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "pixel_metrics.h"
+
+#include <AknLayout2ScalableDef.h>
+#include <AknLayoutScalable_Avkon.cdl.h>
+#include <AknLayoutScalable_Apps.cdl.h>
+#include <AknUtils.h>
+
+// Version number for dynamic calculations. These are to be exported to static data,
+// so that we can keep dynamic and static values inline.
+// Please adjust version data if correcting dynamic PM calculations.
+const TInt KPMMajorVersion = 1;
+const TInt KPMMinorVersion = 14;
+
+TPixelMetricsVersion PixelMetrics::Version()
+ {
+ TPixelMetricsVersion version;
+ version.majorVersion = KPMMajorVersion;
+ version.minorVersion = KPMMinorVersion;
+ return version;
+ }
+
+TInt PixelMetrics::PixelMetricValue(QStyle::PixelMetric metric)
+ {
+ TInt value = -909;
+ // Main pane
+ TRect mainPaneRect;
+ AknLayoutUtils::LayoutMetricsRect(
+ AknLayoutUtils::EMainPane,
+ mainPaneRect );
+ // Screen
+ TRect screenRect;
+ AknLayoutUtils::LayoutMetricsRect(
+ AknLayoutUtils::EApplicationWindow,
+ screenRect );
+ // Navi pane
+ TRect naviPaneRect;
+ AknLayoutUtils::LayoutMetricsRect(
+ AknLayoutUtils::ENaviPane,
+ naviPaneRect );
+
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) );
+
+ TInt variety = 0;
+ TBool landscape = EFalse;
+ if ( screenRect.iBr.iX > screenRect.iBr.iY )
+ {
+ // in landscape another variety is used
+ landscape = ETrue;
+ }
+ switch (metric)
+ {
+ case QStyle::PM_DockWidgetHandleExtent:
+ // what's this??? Not in S60
+ break;
+ case QStyle::PM_CheckListControllerSize:
+ case QStyle::PM_CheckListButtonSize:
+ {
+ // hierarchical menu - checkbox / radiobutton
+ // Area (width/height) of the checkbox/radio button in a Q3CheckListItem.
+ TAknLayoutRect listScrollPane;
+ listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0));
+ TAknLayoutRect listGenPane;
+ listGenPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0));
+ TAknLayoutRect listHierarchyPane;
+ listHierarchyPane.LayoutRect( listGenPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane(0));
+
+ TAknLayoutRect listHierarchyControllerPane;
+ listHierarchyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g3(0));
+ TAknLayoutRect listHierarchyPropertyPane;
+ listHierarchyPropertyPane.LayoutRect( listHierarchyPane.Rect(), AknLayoutScalable_Avkon::list_single_graphic_hl_pane_g2(0));
+
+ if (metric==QStyle::PM_CheckListControllerSize)value = Max( listHierarchyPane.Rect().Width(), listHierarchyPane.Rect().Width());
+ else value = Max( listHierarchyPropertyPane.Rect().Width(), listHierarchyPropertyPane.Rect().Width());
+ }
+ break;
+ case QStyle::PM_DialogButtonsSeparator: //Distance between buttons in a dialog buttons widget.
+ case QStyle::PM_DialogButtonsButtonWidth: // Minimum width of a button in a dialog buttons widget.
+ case QStyle::PM_DialogButtonsButtonHeight:// Minimum height of a button in a dialog buttons widget.
+ {
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) );
+ variety = 0;
+ if ( landscape )
+ {
+ variety = 2;
+ }
+ TAknLayoutRect areaBottomRect;
+ areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) );
+
+ TAknLayoutRect controlPaneRect;
+ controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() );
+ TAknLayoutText controlPaneLSKText;
+ TAknLayoutText controlPaneRSKText;
+ TAknLayoutText controlPaneMSKText;
+ variety = 0;
+ if (AknLayoutUtils::MSKEnabled())
+ {
+ variety = 3;
+ controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area
+ }
+ controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area
+ controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area
+
+ /*
+ *
+ ==================================================================================
+ | A | LSK_rect | B | MSK_rect | C | RSK_rect | D |
+ ==================================================================================
+ where A is left padding (between control pane and LSK rect)
+ B is mid-left padding (between LSK and MSK rects)
+ C is mid-right padding (between MSK and RSK rects)
+ D is right padding (between RSK and control pane)
+
+ ==> Since all these can be separate, lets take Max of {A..D} for PM value
+ */
+
+ TInt itemSpacingA = 0;
+ TInt itemSpacingB = 0;
+ TInt itemSpacingC = 0;
+ TInt itemSpacingMax = 0;
+ if ( !AknLayoutUtils::MSKEnabled() )
+ {
+ itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX;
+ itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX;
+ if (!landscape)
+ {
+ // use mid-gap only in portrait
+ itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX;
+ }
+ itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, itemSpacingC));
+ // no itemspacing4 if no MSK
+ }
+ else
+ {
+ TInt itemSpacingD = 0;
+ itemSpacingA = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX;
+ itemSpacingB = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX;
+ if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape
+ {
+ itemSpacingC = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX;
+ itemSpacingD = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX;
+ }
+ itemSpacingMax = Max(itemSpacingA, Max( itemSpacingB, Max( itemSpacingC, itemSpacingD )));
+ }
+ if (metric==QStyle::PM_DialogButtonsSeparator) value = itemSpacingMax;
+ else if (metric==QStyle::PM_DialogButtonsButtonWidth)
+ {
+ value = Max( controlPaneLSKText.TextRect().Width(), controlPaneRSKText.TextRect().Width());
+ if (AknLayoutUtils::MSKEnabled())
+ {
+ value = Max(value, controlPaneMSKText.TextRect().Width());
+ }
+ }
+ else if (metric==QStyle::PM_DialogButtonsButtonHeight)
+ {
+ value = Max( controlPaneLSKText.TextRect().Height(), controlPaneRSKText.TextRect().Height());
+ if (AknLayoutUtils::MSKEnabled())
+ {
+ value = Max(value, controlPaneMSKText.TextRect().Height());
+ }
+ }
+ }
+ break;
+ case QStyle::PM_DockWidgetTitleMargin: // not in S60, lets use the same margin as in button
+ case QStyle::PM_DockWidgetTitleBarButtonMargin: // not in S60, lets use the same margin as in button
+ case QStyle::PM_ButtonMargin:
+ {
+ TRect myRect(TSize( 80, 20)); // this arbitrary size - user can set it - button border does not seem to have any scalability in it
+ TAknLayoutRect buttonRect;
+ TAknLayoutRect buttonBordersRect;
+ TAknLayoutText buttonText;
+
+ buttonRect.LayoutRect( myRect, AknLayoutScalable_Avkon::eswt_ctrl_button_pane());
+ buttonBordersRect.LayoutRect( buttonRect.Rect(), AknLayoutScalable_Avkon::common_borders_pane_copy2(0)); //with text
+ buttonText.LayoutText( buttonRect.Rect(), AknLayoutScalable_Avkon::control_button_pane_t1() );
+
+ // Its better to use left-right margins, since font deployment can create funny top / bottom margins
+ TInt leftMargin = buttonText.TextRect().iTl.iX - buttonBordersRect.Rect().iTl.iX;
+ TInt rightMargin = buttonBordersRect.Rect().iBr.iX - buttonText.TextRect().iBr.iX;
+ value = (TInt) ((leftMargin+rightMargin)/2);
+ }
+ break;
+ case QStyle::PM_ButtonDefaultIndicator:
+ {
+ // no default button indicators in S60
+ value = 0;
+ }
+ break;
+ case QStyle::PM_MdiSubWindowFrameWidth:
+ case QStyle::PM_ComboBoxFrameWidth:
+ case QStyle::PM_SpinBoxFrameWidth:
+ value = 0;
+ break;
+ case QStyle::PM_ToolBarFrameWidth:
+ case QStyle::PM_DefaultFrameWidth:
+ {
+ TAknLayoutRect highLightPaneRect;
+ TAknLayoutRect centerPaneRect;
+ TRect rectParent( mainPaneRect );
+ highLightPaneRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::toolbar_button_pane(0).LayoutLine());
+ centerPaneRect.LayoutRect(rectParent, AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine());
+
+ value = highLightPaneRect.Rect().iBr.iX - centerPaneRect.Rect().iBr.iX;
+ }
+ break;
+ case QStyle::PM_RadioButtonLabelSpacing:
+ {
+ /*
+ *
+ ===================================================================================
+ | A | iconLayoutRect |B| itemText | C |
+ ===================================================================================
+ mirrored:
+ ===================================================================================
+ | C | itemText |B| iconLayoutRect | A |
+ ===================================================================================
+ where A is left padding
+ B is gap between icon and text
+ C is right padding
+ */
+
+ TRect rectParent( mainPaneRect );
+ TAknLayoutRect layoutRect;
+ layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar
+ TAknLayoutText itemText;
+ itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) );
+ TAknLayoutRect iconLayoutRect;
+ iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() );
+
+ if ( !AknLayoutUtils::LayoutMirrored() )
+ {
+ value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX;
+ }
+ else
+ {
+ value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX;
+ }
+ }
+
+ break;
+ case QStyle::PM_CheckBoxLabelSpacing:
+ {
+ /*
+ *
+ ===================================================================================
+ | A | iconLayoutRect |B| itemText | C |
+ ===================================================================================
+ mirrored:
+ ===================================================================================
+ | C | itemText |B| iconLayoutRect | A |
+ ===================================================================================
+ where A is left padding
+ B is gap between icon and text
+ C is right padding
+ */
+
+ TRect rectParent( mainPaneRect );
+ TAknLayoutRect layoutRect;
+ layoutRect.LayoutRect( rectParent, AknLayoutScalable_Avkon::listscroll_gen_pane(0).LayoutLine() );
+
+ TAknLayoutRect layoutRect2;
+ layoutRect2.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_gen_pane(0).LayoutLine() );
+ TAknLayoutRect layoutRect3;
+ layoutRect3.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane(0).LayoutLine() );
+
+ TAknLayoutText itemText;
+ itemText.LayoutText( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_t1(0) );
+ TAknLayoutRect iconLayoutRect;
+ iconLayoutRect.LayoutRect( layoutRect3.Rect(), AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() );
+
+ if ( !AknLayoutUtils::LayoutMirrored() )
+ {
+ value = itemText.TextRect().iTl.iX - iconLayoutRect.Rect().iBr.iX;
+ }
+ else
+ {
+ value = iconLayoutRect.Rect().iTl.iX - itemText.TextRect().iBr.iX;
+ }
+ }
+ break;
+ case QStyle::PM_ToolTipLabelFrameWidth:
+ {
+ /*
+ *
+ |===================================================================================|
+ | info popup note B |
+ | ============================================================================== |
+ | A | hintText | D|
+ | ============================================================================== |
+ | C |
+ |===================================================================================|
+ where A is left padding
+ B is top padding
+ C is bottom padding
+ D is right padding
+ we'll provide the average of top and bottom padding as PM_ToolTipLabelFrameWidth
+ */
+
+ // Set pop-up to contain only one line of text
+ TInt index = 0;
+ if ( landscape )
+ {
+ // in landscape another variety is used
+ index += 5;
+ }
+ // Get parameter and table limits for popup preview text window
+ TAknLayoutScalableParameterLimits limits =
+ AknLayoutScalable_Avkon::popup_preview_text_window_ParamLimits();
+
+ TAknLayoutScalableTableLimits tableLimits =
+ AknLayoutScalable_Avkon::popup_preview_text_window_t_Limits();
+
+ TInt windowVariety = Min( Max( index, limits.FirstVariety() ), limits.LastVariety() );
+
+ TAknLayoutScalableParameterLimits tParamLimits =
+ AknLayoutScalable_Avkon:: popup_preview_text_window_t_ParamLimits(
+ tableLimits.FirstIndex() );
+
+ TInt lineVariety = Min( Max( index, tParamLimits.FirstVariety() ), tParamLimits.LastVariety() );
+
+ TAknWindowLineLayout lineLayout = AknLayoutScalable_Avkon::popup_preview_text_window(windowVariety).LayoutLine();
+
+ // rect for the whole info popup
+ TAknLayoutRect layoutRect;
+ layoutRect.LayoutRect(screenRect, lineLayout);
+ TRect rectPopupWindow = layoutRect.Rect();
+
+ TAknTextComponentLayout popupTextLayout =
+ AknLayoutScalable_Avkon::popup_preview_text_window_t(
+ tableLimits.FirstIndex(), lineVariety );
+
+ // rect for the whole the text inside the popup
+ TAknLayoutText layoutText;
+ layoutText.LayoutText( rectPopupWindow, popupTextLayout );
+
+ // Each margin has different value in S60 - let's take average of top & bottom
+ TInt topMargin = layoutText.TextRect().iTl.iY - layoutRect.Rect().iTl.iY;
+ TInt bottomMargin = layoutRect.Rect().iBr.iY - layoutText.TextRect().iBr.iY;
+ TInt averageMargin = (TInt)(topMargin+bottomMargin)/2;
+ value = averageMargin;
+ }
+ break;
+ case QStyle::PM_ListViewIconSize:
+ {
+ // todo: there are lots and lots of views with different sized icons - which one to use?
+ // todo: this is probably not a good default icon size, as this fetches A column icon size
+ // todo: preferably use settings item with graphic instead
+ TAknLayoutRect iconRect;
+ iconRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::list_double_graphic_pane_g1_cp2(0).LayoutLine());
+ //icon areas are usually squares - lets take bigger of two dimensions
+ value = Max( iconRect.Rect().Width(), iconRect.Rect().Height() );
+ }
+ break;
+
+ case QStyle::PM_LargeIconSize: // lets use AS icon as a base for large icon
+ case QStyle::PM_IconViewIconSize:
+ {
+ // Lets assume that we'd take these from grid (3x4) layout
+ TAknLayoutRect appPaneRect;
+ TAknLayoutRect gridAppRect;
+ TAknLayoutRect cellAppRect;
+ TInt varietyGrid = 2; //Let's use the 3x4 grid as a base.
+ TInt varietyCell = 1; //Let's use the 3x4 grid as a base.
+ if ( landscape )
+ {
+ varietyGrid = 3;
+ varietyCell = 2;
+ }
+ appPaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_app_pane(1).LayoutLine()); //3x4 grid
+ gridAppRect.LayoutRect( appPaneRect.Rect(), AknLayoutScalable_Avkon::grid_app_pane(varietyGrid).LayoutLine());
+ cellAppRect.LayoutRect( gridAppRect.Rect(), AknLayoutScalable_Avkon::cell_app_pane(varietyCell, 0, 0).LayoutLine());
+ TAknLayoutRect cellGraphRect;
+ TAknWindowComponentLayout appIcon = AknLayoutScalable_Avkon::cell_app_pane_g1(0); // no mark, no highlight
+ cellGraphRect.LayoutRect( gridAppRect.Rect(), appIcon);
+ //icon areas are usually squares - if not, lets take larger
+ value = Max( cellGraphRect.Rect().Width(), cellGraphRect.Rect().Height());
+ }
+ break;
+ case QStyle::PM_TabBarIconSize:
+ {
+ TAknLayoutRect naviNaviRect;
+ naviNaviRect.LayoutRect( naviPaneRect, AknLayoutScalable_Avkon::navi_navi_tabs_pane().LayoutLine()); // two tabs
+ TAknLayoutRect tabRect;
+ tabRect.LayoutRect( naviNaviRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane().LayoutLine()); //active tab on left
+ TAknLayoutRect activeTabRect;
+ activeTabRect.LayoutRect( tabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0).LayoutLine()); //active tab
+ TAknLayoutRect activeTabGraphicRect;
+
+ activeTabGraphicRect.LayoutRect( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_g1().LayoutLine()); //active tab graphic
+ value = Min(activeTabGraphicRect.Rect().Width(), activeTabGraphicRect.Rect().Height());
+ }
+ break;
+ case QStyle::PM_MessageBoxIconSize:
+ {
+ TAknLayoutRect noteRect;
+ noteRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_image_window(0).LayoutLine()); //note with image
+ TAknLayoutRect noteImageRect;
+ noteImageRect.LayoutRect( noteRect.Rect(), AknLayoutScalable_Avkon::popup_note_image_window_g2(2).LayoutLine()); //note with image
+ value = noteImageRect.Rect().Width();
+ }
+ break;
+ case QStyle::PM_TextCursorWidth:
+ {
+ TAknLayoutRect miscGraphicsRect;
+ miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics());
+ miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics());
+ TAknLayoutRect textsGraphicsRect;
+ textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics());
+ TAknLayoutRect cursorGraphicsRect;
+ cursorGraphicsRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_graphics_pane());
+ TAknLayoutRect cursorPrimaryRect;
+ cursorPrimaryRect.LayoutRect( cursorGraphicsRect.Rect(), AknLayoutScalable_Avkon::cursor_primary_pane());
+ TAknLayoutRect cursorRect;
+ cursorRect.LayoutRect( cursorPrimaryRect.Rect(), AknLayoutScalable_Avkon::cursor_digital_pane_g1());
+ value = cursorRect.Rect().Width();
+ }
+ break;
+ case QStyle::PM_SliderLength:
+ {
+ TAknLayoutRect settingRect;
+ settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() );
+ TAknLayoutRect settingContentRect;
+ settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() );
+ TAknLayoutRect sliderRect;
+ sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() );
+ TAknLayoutRect sliderSettingRect;
+ sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() );
+ TAknLayoutRect sliderGraph2Rect;
+ sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() );
+ value = sliderGraph2Rect.Rect().Width();
+ }
+ break;
+ case QStyle::PM_SliderThickness:
+ {
+ TAknLayoutRect settingRect;
+ settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() );
+ TAknLayoutRect settingContentRect;
+ settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() );
+ TAknLayoutRect sliderRect;
+ sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() );
+ TAknLayoutRect sliderSettingRect;
+ sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() );
+ TAknLayoutRect sliderGraph2Rect;
+ sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() );
+ value = (TInt)(sliderGraph2Rect.Rect().Height()*1.5); // add assumed tickmark height
+ }
+ break;
+ case QStyle::PM_SliderTickmarkOffset:
+ {
+ TAknLayoutRect settingRect;
+ settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() );
+ TAknLayoutRect settingContentRect;
+ settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() );
+ TAknLayoutRect sliderRect;
+ sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() );
+ TAknLayoutRect sliderSettingRect;
+ sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() );
+ TAknLayoutRect sliderGraph2Rect;
+ sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() );
+ value = (TInt)(sliderGraph2Rect.Rect().Height()*0.5); // no tickmarks in S60, lets assume they are half the size of slider indicator
+ }
+ break;
+ case QStyle::PM_SliderControlThickness:
+ {
+ TAknLayoutRect settingRect;
+ settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() );
+ TAknLayoutRect settingContentRect;
+ settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() );
+ TAknLayoutRect sliderRect;
+ sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() );
+ TAknLayoutRect sliderSettingRect;
+ sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() );
+ TAknLayoutRect sliderGraph2Rect;
+ sliderGraph2Rect.LayoutRect( sliderSettingRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_g2() );
+ value = sliderGraph2Rect.Rect().Height();
+ }
+ break;
+ case QStyle::PM_SliderSpaceAvailable:
+ {
+ TAknLayoutRect settingRect;
+ settingRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_set_pane() );
+ TAknLayoutRect settingContentRect;
+ settingContentRect.LayoutRect( settingRect.Rect(), AknLayoutScalable_Avkon::set_content_pane() );
+ TAknLayoutRect sliderRect;
+ sliderRect.LayoutRect( settingContentRect.Rect(), AknLayoutScalable_Avkon::setting_slider_graphic_pane() );
+ TAknLayoutRect sliderSettingRect;
+ sliderSettingRect.LayoutRect( sliderRect.Rect(), AknLayoutScalable_Avkon::slider_set_pane_cp() );
+ value = sliderSettingRect.Rect().Width();
+ }
+ break;
+ case QStyle::PM_MenuBarItemSpacing:
+ {
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) );
+
+ variety = 0;
+ if ( landscape )
+ {
+ variety = 2;
+ }
+ TAknLayoutRect areaBottomRect;
+ areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) );
+
+ TAknLayoutRect controlPaneRect;
+ controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() );
+ TAknLayoutText controlPaneLSKText;
+ TAknLayoutText controlPaneRSKText;
+ TAknLayoutText controlPaneMSKText;
+ variety = 0;
+ if (AknLayoutUtils::MSKEnabled())
+ {
+ variety = 3;
+ controlPaneMSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t3(variety)); //MSK text area
+ }
+ controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area
+ controlPaneRSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t2(variety)); //RSK text area
+
+ /*
+ *
+ ==================================================================================
+ | A | LSK_rect | B | MSK_rect | C | RSK_rect | D |
+ ==================================================================================
+ where A is left padding (between control pane and LSK rect)
+ B is mid-left padding (between LSK and MSK rects)
+ C is mid-right padding (between MSK and RSK rects)
+ D is right padding (between RSK and control pane)
+
+ ==> Since all these can be separate, lets take Max of {A..D} for PM value
+ */
+
+ TInt itemSpacing1 = 0;
+ TInt itemSpacing2 = 0;
+ TInt itemSpacing3 = 0;
+ TInt itemSpacing4 = 0;
+ TInt itemSpacingMax = 0;
+ if ( !AknLayoutUtils::MSKEnabled() )
+ {
+ itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX;
+ itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX;
+ if ( !landscape )
+ {
+ // use mid gap only in portrait
+ itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX;
+ }
+ itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, itemSpacing3));
+ // no itemspacing4 if no MSK
+ }
+ else
+ {
+ itemSpacing1 = controlPaneRect.Rect().iBr.iX - controlPaneRSKText.TextRect().iBr.iX;
+ itemSpacing2 = controlPaneLSKText.TextRect().iTl.iX - controlPaneRect.Rect().iTl.iX;
+ if ( !(AknLayoutUtils::PenEnabled() || landscape) ) // no MSK in touch, nor in landscape
+ {
+ itemSpacing3 = controlPaneRSKText.TextRect().iTl.iX - controlPaneMSKText.TextRect().iBr.iX;
+ itemSpacing4 = controlPaneMSKText.TextRect().iTl.iX - controlPaneLSKText.TextRect().iBr.iX;
+ }
+ itemSpacingMax = Max(itemSpacing1, Max( itemSpacing2, Max( itemSpacing3, itemSpacing4 )));
+ }
+ value = itemSpacingMax;
+ }
+ break;
+ case QStyle::PM_MenuBarHMargin:
+ {
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) );
+
+ variety = 0;
+ if ( landscape )
+ {
+ variety = 6;
+ }
+ TAknLayoutRect areaBottomRect;
+ areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) );
+
+ // variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties)
+ TAknLayoutRect controlPaneRect;
+ controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() );
+ value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height();
+ }
+ break;
+ case QStyle::PM_MenuBarVMargin:
+ {
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) );
+
+ variety = 0;
+ if ( landscape )
+ {
+ variety = 6;
+ }
+ TAknLayoutText controlPaneLSKText;
+ TAknLayoutRect areaBottomRect;
+ areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) );
+ // variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties)
+ TAknLayoutRect controlPaneRect;
+ controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() );
+
+ variety = 0;
+ if (AknLayoutUtils::MSKEnabled())
+ {
+ variety = 3;
+ }
+ controlPaneLSKText.LayoutText( controlPaneRect.Rect(), AknLayoutScalable_Avkon::control_pane_t1(variety)); //LSK text area
+
+ value = controlPaneRect.Rect().Height() - controlPaneLSKText.TextRect().Height();
+ }
+ break;
+ case QStyle::PM_ToolBarItemSpacing:
+ {
+ TAknLayoutRect popupToolBarWindow;
+ variety = 4;
+ popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) );
+ TAknLayoutRect gridToolBarRect;
+ gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() );
+ TAknLayoutRect cellToolBarRect1;
+ TAknLayoutRect cellToolBarRect2;
+ cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item
+ cellToolBarRect2.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(1).LayoutLine() ); //second item
+ value = cellToolBarRect1.Rect().iBr.iX - cellToolBarRect2.Rect().iTl.iX;
+ }
+ break;
+ case QStyle::PM_ToolBarItemMargin:
+ {
+ variety = 4;
+ TAknLayoutRect popupToolBarWindow;
+ popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) );
+ TAknLayoutRect gridToolBarRect;
+ gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() );
+ TAknLayoutRect cellToolBarRect1;
+ cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item
+ value = gridToolBarRect.Rect().iTl.iX - cellToolBarRect1.Rect().iTl.iX;
+ }
+ break;
+ case QStyle::PM_LayoutLeftMargin: // there really isn't a default layoutting on s60, but lets use AppShell icon deployment as base
+ case QStyle::PM_LayoutRightMargin:
+ case QStyle::PM_LayoutTopMargin:
+ case QStyle::PM_LayoutBottomMargin:
+ case QStyle::PM_LayoutHorizontalSpacing:
+ case QStyle::PM_LayoutVerticalSpacing:
+ {
+ //since spacing and margins should be globally same, lets use same easy component as base - such as find popup
+ TAknLayoutRect popup_find_windowRect;
+ TAknLayoutRect bg_popup_window_pane_cp12Rect;
+ TAknLayoutRect find_popup_paneRect;
+ popup_find_windowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_find_window(0).LayoutLine());
+ bg_popup_window_pane_cp12Rect.LayoutRect( popup_find_windowRect.Rect(), AknLayoutScalable_Avkon::bg_popup_window_pane_cp12().LayoutLine());
+ find_popup_paneRect.LayoutRect( bg_popup_window_pane_cp12Rect.Rect(), AknLayoutScalable_Avkon::find_popup_pane().LayoutLine());
+
+ const TBool mirrored = AknLayoutUtils::LayoutMirrored();
+ if ((metric==QStyle::PM_LayoutVerticalSpacing && !mirrored) || metric==QStyle::PM_LayoutLeftMargin)
+ {
+ if (mirrored)
+ {
+ value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX;
+ }
+ else
+ {
+ value = find_popup_paneRect.Rect().iTl.iX - bg_popup_window_pane_cp12Rect.Rect().iTl.iX;
+ }
+ }
+ else if (metric==QStyle::PM_LayoutRightMargin || (metric==QStyle::PM_LayoutVerticalSpacing && mirrored))
+ {
+ if (mirrored)
+ {
+ value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX;
+ }
+ else
+ {
+ value = bg_popup_window_pane_cp12Rect.Rect().iBr.iX - find_popup_paneRect.Rect().iBr.iX;
+ }
+ }
+ else if (metric==QStyle::PM_LayoutTopMargin || metric==QStyle::PM_LayoutHorizontalSpacing)
+ {
+ value = find_popup_paneRect.Rect().iTl.iY - bg_popup_window_pane_cp12Rect.Rect().iTl.iY;
+ }
+ else if (metric==QStyle::PM_LayoutBottomMargin)
+ {
+ value = bg_popup_window_pane_cp12Rect.Rect().iBr.iY - find_popup_paneRect.Rect().iBr.iY;
+ }
+ }
+ break;
+ case QStyle::PM_MaximumDragDistance:
+ {
+ value = -1; //disable - not in S60
+ }
+ break;
+ case QStyle::PM_ScrollBarExtent:
+ {
+ TAknLayoutRect miscGraphicsRect;
+ miscGraphicsRect.LayoutRect( screenRect, AknLayoutScalable_Avkon::misc_graphics());
+ miscGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::misc_graphics());
+ TAknLayoutRect textsGraphicsRect;
+ textsGraphicsRect.LayoutRect( miscGraphicsRect.Rect(), AknLayoutScalable_Avkon::texts_graphics());
+ TAknLayoutRect editorScrollRect;
+ editorScrollRect.LayoutRect( textsGraphicsRect.Rect(), AknLayoutScalable_Avkon::editor_scroll_pane());
+ TAknLayoutRect scrollPaneRect;
+ scrollPaneRect.LayoutRect( editorScrollRect.Rect(), AknLayoutScalable_Avkon::scroll_pane_cp13());
+ value = scrollPaneRect.Rect().Width(); // width of editor's scroll bar
+ }
+ break;
+ case QStyle::PM_ScrollBarSliderMin:
+ {
+ TAknLayoutRect listScrollPane;
+ listScrollPane.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::listscroll_gen_pane(0));
+ TAknLayoutRect scrollPane;
+ scrollPane.LayoutRect( listScrollPane.Rect(), AknLayoutScalable_Avkon::scroll_pane());
+ TAknLayoutRect scrollHandlePane;
+ scrollHandlePane.LayoutRect( scrollPane.Rect(), AknLayoutScalable_Avkon::scroll_handle_pane());
+ TAknLayoutRect aidMinSizePane;
+ aidMinSizePane.LayoutRect( scrollHandlePane.Rect(), AknLayoutScalable_Avkon::aid_size_min_handle()); // this gives min width size for horizontal scroll bar - same can be used for vertical height minimum
+ value = aidMinSizePane.Rect().Height();
+ }
+ break;
+ case QStyle::PM_MenuBarPanelWidth:
+ {
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(0) );
+
+ variety = 0;
+ if ( landscape )
+ {
+ variety = 2;
+ }
+ TAknLayoutRect areaBottomRect;
+ areaBottomRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(variety) );
+
+ // todo: prt: variety 7 if thin status pane, 1 if no status pane, 3 if small status pane and with main pane, 4 otherwise (idle has bunch of own varieties)
+ // todo: lsc: variety 6 if thin status pane
+ // todo: should stacon be considered?
+ TAknLayoutRect controlPaneRect;
+ controlPaneRect.LayoutRect( areaBottomRect.Rect(), AknLayoutScalable_Avkon::control_pane() );
+ value = areaBottomRect.Rect().Height() - controlPaneRect.Rect().Height(); //usually zero
+ }
+ break;
+ case QStyle::PM_ProgressBarChunkWidth:
+ {
+ // This is either deduced or skinned (for Java) in S60
+ // Layout data does not know it. It would require parameters from the
+ // actual progress dialog to be able to calc this (max. value and increment)
+ // So we need to set up some values - lets take one tenth of progress dialog area:
+ TAknLayoutRect appWindow;
+ appWindow.LayoutRect( screenRect, AknLayoutScalable_Avkon::application_window(variety) );
+ if (landscape)
+ {
+ variety = 6;
+ }
+ TAknLayoutRect popupWaitWindowRect;
+ popupWaitWindowRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_note_wait_window(variety) );
+ TAknLayoutRect waitbarPaneRect;
+ waitbarPaneRect.LayoutRect( popupWaitWindowRect.Rect(), AknLayoutScalable_Avkon::wait_bar_pane(0) );
+ TAknLayoutRect waitAnimRect;
+ waitAnimRect.LayoutRect( waitbarPaneRect.Rect(), AknLayoutScalable_Avkon::wait_anim_pane() );
+ value = (TInt) (waitAnimRect.Rect().Width() / 10);
+ }
+ break;
+ case QStyle::PM_TabBarTabOverlap:
+ case QStyle::PM_TabBarTabHSpace:
+ case QStyle::PM_TabBarTabVSpace:
+ case QStyle::PM_TabBarBaseHeight:
+ case QStyle::PM_TabBarBaseOverlap:
+ case QStyle::PM_TabBarScrollButtonWidth:
+ case QStyle::PM_TabBarTabShiftHorizontal:
+ case QStyle::PM_TabBarTabShiftVertical:
+ value = PixelMetricTabValue(metric, appWindow.Rect(), landscape);
+ break;
+ case QStyle::PM_MenuPanelWidth:
+ case QStyle::PM_MenuHMargin:
+ case QStyle::PM_MenuVMargin:
+ value = PixelMetricMenuValue(metric, mainPaneRect);
+ break;
+ case QStyle::PM_ButtonIconSize:
+ //lets use voice recorder icons as a base
+ //Unfortunately S60 graphics don't separate button bevel graphics from the actual icon.
+ //Se we have no means to query the margin from bevel border to "central icon" border.
+ //So, we need to make a estimate...
+
+ const TInt varietyForButtons = !landscape ? 0 : 1;
+
+ TAknLayoutRect vRMainRect;
+ vRMainRect.LayoutRect( mainPaneRect, AknLayoutScalable_Apps::main_vorec_pane() );
+
+ TAknLayoutRect vRButtonGridRect;
+ vRButtonGridRect.LayoutRect( vRMainRect.Rect(), AknLayoutScalable_Apps::grid_vorec_pane() );
+
+ TAknLayoutRect vRButtonCellRect;
+ vRButtonCellRect.LayoutRect( vRButtonGridRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane(0) );
+
+ TAknLayoutRect vRButtonCellGraphicsRect;
+ vRButtonCellGraphicsRect.LayoutRect( vRButtonCellRect.Rect(), AknLayoutScalable_Apps::cell_vorec_pane_g1() );
+
+ // 0.32 is the estimate how much the icon occupies of the button bevel area
+ value = vRButtonCellGraphicsRect.Rect().Width() * 0.32;
+
+ break;
+ case QStyle::PM_SmallIconSize:
+ {
+ // lets use AI2 icon as a base
+ TAknLayoutRect idlePaneRect;
+ idlePaneRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::main_idle_act2_pane() );
+ TAknLayoutRect idleDataRect;
+ idleDataRect.LayoutRect( idlePaneRect.Rect(), AknLayoutScalable_Avkon::popup_ai2_data_window(1) );
+ TAknLayoutRect ai2GridRect;
+ ai2GridRect.LayoutRect( idleDataRect.Rect(), AknLayoutScalable_Avkon::grid_ai2_button_pane() );
+ TAknLayoutRect ai2MpRect;
+ ai2MpRect.LayoutRect( ai2GridRect.Rect(), AknLayoutScalable_Avkon::ai2_mp_button_pane() );
+ TAknLayoutRect ai2CellPaneRect;
+ ai2CellPaneRect.LayoutRect( ai2MpRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane(1).LayoutLine() );
+ TAknLayoutRect ai2CellButtonRect;
+ ai2CellButtonRect.LayoutRect( ai2CellPaneRect.Rect(), AknLayoutScalable_Avkon::cell_ai2_button_pane_g1());
+ value = Min( ai2CellButtonRect.Rect().Width(), ai2CellButtonRect.Rect().Height());
+ }
+ break;
+ case QStyle::PM_FocusFrameHMargin:
+ case QStyle::PM_FocusFrameVMargin:
+ {
+ TAknLayoutRect gridRect;
+ gridRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::grid_highlight_pane(0));
+ TAknLayoutRect gridRectCenter;
+ gridRectCenter.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::cell_highlight_pane_g1());
+
+ // The difference of center piece from border tell the frame width.
+ if ( value == QStyle::PM_FocusFrameHMargin)
+ {
+ value = gridRect.Rect().iBr.iX - gridRectCenter.Rect().iBr.iX;
+ }
+ else
+ {
+ value = gridRect.Rect().iBr.iY - gridRectCenter.Rect().iBr.iY;
+ }
+ }
+ break;
+ case QStyle::PM_ToolBarIconSize:
+ {
+ TAknLayoutRect popupToolBarWindow;
+ variety = 4;
+ popupToolBarWindow.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_toolbar_window(variety) );
+ TAknLayoutRect gridToolBarRect;
+ gridToolBarRect.LayoutRect( popupToolBarWindow.Rect(), AknLayoutScalable_Avkon::grid_toobar_pane() );
+ TAknLayoutRect cellToolBarRect1;
+ TAknLayoutRect cellToolBarRect2;
+ cellToolBarRect1.LayoutRect( gridToolBarRect.Rect(), AknLayoutScalable_Avkon::cell_toolbar_pane(0).LayoutLine() ); //first item
+ value = Min( cellToolBarRect1.Rect().Height(), cellToolBarRect1.Rect().Width() );
+ }
+ break;
+
+ case QStyle::PM_TitleBarHeight: // use titlepane height
+ {
+ TAknLayoutRect statusPaneRect;
+ TAknLayoutRect titlePane;
+ TAknLayoutRect areaTopRect;
+ if (landscape)
+ {
+ if ( AknLayoutUtils::PenEnabled() )
+ {
+ // Top area - 0 is for classic landscape (used in touch landscape as well)
+ areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(2) );
+ // Status pane - 0 softkeys on right
+ statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() );
+ }
+ else
+ {
+ // Top area - 2 is for classic landscape.
+ areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_bottom_pane(2) );
+ // Stacon top pane (default ok)
+ statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() );
+ }
+ titlePane.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::title_pane_stacon(0) ); //softkeys on right
+ }
+ else
+ {
+ // Top area - 0 is for classic portrait
+ areaTopRect.LayoutRect( appWindow.Rect(), AknLayoutScalable_Avkon::area_top_pane(0) );
+ // Status pane - 0 is for classic portrait
+ statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) );
+ titlePane.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::title_pane(0) );
+ }
+ value = titlePane.Rect().Height();
+ }
+ break;
+ case QStyle::PM_IndicatorWidth:
+ case QStyle::PM_IndicatorHeight:
+ {
+ TRect rectParent( mainPaneRect );
+
+ TAknLayoutRect layoutRect;
+ layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::set_content_pane().LayoutLine() );
+ TAknLayoutRect layoutRect2;
+ layoutRect2.LayoutRect( layoutRect.Rect(),AknLayoutScalable_Avkon::list_set_graphic_pane(0).LayoutLine() );
+
+ TAknLayoutRect iconLayoutRect;
+ iconLayoutRect.LayoutRect( layoutRect2.Rect(), AknLayoutScalable_Avkon::list_set_graphic_pane_g1(0).LayoutLine() );
+ if (metric==QStyle::PM_IndicatorWidth)
+ {
+ value = iconLayoutRect.Rect().Width();
+ }
+ else
+ {
+ value = iconLayoutRect.Rect().Height();
+ }
+ }
+ break;
+ case QStyle::PM_ExclusiveIndicatorHeight:
+ case QStyle::PM_ExclusiveIndicatorWidth:
+ {
+ TRect rectParent( mainPaneRect );
+ TAknLayoutRect layoutRect;
+ layoutRect.LayoutRect( rectParent,AknLayoutScalable_Avkon::list_choice_list_pane(1).LayoutLine() ); // w/ scrollbar
+ TAknLayoutText itemText;
+ itemText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_t1(1) );
+ TAknLayoutRect iconLayoutRect;
+ iconLayoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Avkon::list_single_choice_list_pane_g1().LayoutLine() );
+
+ if (metric==QStyle::PM_ExclusiveIndicatorHeight)
+ {
+ value = iconLayoutRect.Rect().Height();
+ }
+ else
+ {
+ value = iconLayoutRect.Rect().Width();
+ }
+ }
+ break;
+
+ // These are obsolete.
+ case QStyle::PM_DefaultTopLevelMargin:
+ case QStyle::PM_DefaultChildMargin:
+ case QStyle::PM_DefaultLayoutSpacing:
+ break;
+
+ case QStyle::PM_Custom_FrameCornerWidth:
+ {
+ TAknLayoutRect inputFocusRect;
+ inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0));
+ TAknLayoutRect inputFocusInnerRect;
+ inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1());
+
+ value = inputFocusRect.Rect().iBr.iX - inputFocusInnerRect.Rect().iBr.iX;
+ value+= 2; //visually better value for generic cases
+ }
+ break;
+ case QStyle::PM_Custom_FrameCornerHeight:
+ {
+ TAknLayoutRect inputFocusRect;
+ inputFocusRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane(0));
+ TAknLayoutRect inputFocusInnerRect;
+ inputFocusInnerRect.LayoutRect(mainPaneRect, AknLayoutScalable_Avkon::input_focus_pane_g1());
+ value = inputFocusRect.Rect().iBr.iY - inputFocusInnerRect.Rect().iBr.iY;
+ value+= 2; //visually better value for generic cases
+ }
+ break;
+ case QStyle::PM_Custom_BoldLineWidth:
+ value = 3;
+ break;
+ case QStyle::PM_Custom_ThinLineWidth:
+ value = 1;
+ break;
+ case QStyle::PM_ButtonShiftHorizontal:
+ case QStyle::PM_ButtonShiftVertical:
+ value = 0;
+ break;
+
+ case QStyle::PM_ToolBarExtensionExtent:
+ value = PixelMetricTabValue(QStyle::PM_TabBarScrollButtonWidth, appWindow.Rect(), landscape);
+ break;
+
+// todo: re-check if these really are not available in s60
+ case QStyle::PM_MenuDesktopFrameWidth: // not needed in S60 - dislocates Menu both horizontally and vertically
+ case QStyle::PM_HeaderMarkSize: // The size of the sort indicator in a header. Not in S60
+ case QStyle::PM_SpinBoxSliderHeight: // The height of the optional spin box slider. Not in S60
+ case QStyle::PM_HeaderMargin: // not in S60
+ case QStyle::PM_MenuScrollerHeight: // not in S60
+ case QStyle::PM_MenuTearoffHeight: // not in S60
+ case QStyle::PM_DockWidgetFrameWidth: // not in S60
+ case QStyle::PM_DockWidgetSeparatorExtent: // not in S60
+ case QStyle::PM_MdiSubWindowMinimizedWidth: //no such thing in S60
+ case QStyle::PM_HeaderGripMargin: // not in S60
+ case QStyle::PM_SplitterWidth: // not in S60
+ case QStyle::PM_ToolBarSeparatorExtent: // not in S60
+ case QStyle::PM_ToolBarHandleExtent: // not in s60
+ case QStyle::PM_MenuButtonIndicator: // none???
+ case QStyle::PM_TabBar_ScrollButtonOverlap: // not used in S60 - tab arrows are on left and right side of tab group - not together
+ case QStyle::PM_SizeGripSize: // use default
+ case QStyle::PM_TabCloseIndicatorWidth:
+ case QStyle::PM_TabCloseIndicatorHeight:
+ case QStyle::PM_ScrollView_ScrollBarSpacing:
+ case QStyle::PM_SubMenuOverlap:
+ default:
+ break;
+ }
+ return value;
+ }
+
+TInt PixelMetrics::PixelMetricTabValue(QStyle::PixelMetric tabMetric, TRect appWindow, TBool landscape)
+ {
+ TInt tabValue = 0;
+ // common ones
+ TAknLayoutRect mainAreaRect;
+ TAknLayoutRect rightIndicationRect;
+ TAknLayoutRect leftIndicationRect;
+ TAknLayoutRect activeTabRect;
+ TAknLayoutText activeTabTextRect;
+ TAknLayoutRect passiveTabRect;
+ TAknLayoutText passiveTabTextRect;
+ TAknLayoutRect tabsPaneRect;
+ if ( landscape )
+ {
+ TAknLayoutRect statusPaneRect;
+ TAknLayoutRect areaTopRect;
+ if ( AknLayoutUtils::PenEnabled() )
+ {
+ // Top area - 0 is for classic landscape (used in touch landscape as well)
+ areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(2) );
+ // Status pane - 0 softkeys on right
+ statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_top_pane() );
+ }
+ else
+ {
+ // Top area - 2 is for classic landscape.
+ areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_bottom_pane(2) );
+ // Stacon top pane (default ok)
+ statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::stacon_bottom_pane() );
+ }
+ // main pane for landscape
+ mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(4) );
+
+ // navi pane
+ TAknLayoutRect naviPaneRect;
+ naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane_stacon(0) ); // softkeys on right
+ // navi-navi pane
+ tabsPaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_stacon(0) ); // softkeys on right
+ // Passive tab item - lets use layout where active is on left side of passive
+ passiveTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) );
+ // Active tab item
+ activeTabRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) );
+ // Left indication
+ leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) );
+ // Right indication
+ rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) );
+ // active tab text rect
+ activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(1) );
+ // passive tab text rect
+ passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(1) );
+ }
+ else
+ {
+ // main pane for portait
+ mainAreaRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::main_pane(3) );
+ // Top area - 0 is for classic portrait
+ TAknLayoutRect areaTopRect;
+ areaTopRect.LayoutRect( appWindow, AknLayoutScalable_Avkon::area_top_pane(0) );
+ // Status pane - 0 is for classic portrait
+ TAknLayoutRect statusPaneRect;
+ statusPaneRect.LayoutRect( areaTopRect.Rect(), AknLayoutScalable_Avkon::status_pane(0) );
+
+ // Navi pane
+ TAknLayoutRect naviPaneRect;
+ naviPaneRect.LayoutRect( statusPaneRect.Rect(), AknLayoutScalable_Avkon::navi_pane(0) );
+ // Navi-navi pane for tabs (0)
+ TAknLayoutRect navi2PaneRect;
+ navi2PaneRect.LayoutRect( naviPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane() );
+ // Short tab pane
+ tabsPaneRect.LayoutRect( navi2PaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_tabs_pane() );
+ // Tab pane for 2 items
+ TAknLayoutRect tab2PaneRect;
+ tab2PaneRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_tabs_3_pane() );
+ // Passive tab item - lets use layout where active is on left side of passive
+ passiveTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane(0) );
+ // Active tab item
+ activeTabRect.LayoutRect( tab2PaneRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane(0) );
+ // Left indication
+ leftIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g1(0) );
+ // Right indication
+ rightIndicationRect.LayoutRect( tabsPaneRect.Rect(), AknLayoutScalable_Avkon::navi_navi_pane_g2(0) );
+ // active tab text rect
+ activeTabTextRect.LayoutText( activeTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_active_pane_t1(0) );
+ // passive tab text rect
+ passiveTabTextRect.LayoutText( passiveTabRect.Rect(), AknLayoutScalable_Avkon::tabs_3_passive_pane_t1(0) );
+ }
+
+ // active tab on left, passive on rightside
+ TInt tabOverlap = activeTabRect.Rect().iBr.iX - passiveTabRect.Rect().iTl.iX;
+ TInt tabHSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iX - activeTabRect.Rect().iTl.iX + activeTabRect.Rect().iBr.iX - activeTabTextRect.TextRect().iBr.iX)/2);
+ TInt tabVSpace = (TInt) ((activeTabTextRect.TextRect().iTl.iY - activeTabRect.Rect().iTl.iY + activeTabRect.Rect().iBr.iY - activeTabTextRect.TextRect().iBr.iY)/2);
+ TInt tabBaseHeight = 0;
+ if ( landscape && !AknLayoutUtils::PenEnabled())
+ {
+ // In landscape tab is below mainpane
+ tabBaseHeight = mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY;
+ }
+ else
+ {
+ // In portrait (and in landscape touch) tab is above mainpane
+ tabBaseHeight = tabsPaneRect.Rect().iBr.iY - mainAreaRect.Rect().iTl.iY;
+ }
+ TInt tabBaseOverlap = 0;
+ if ( landscape && !AknLayoutUtils::PenEnabled())
+ {
+ // In landscape tab is below mainpane
+ tabBaseOverlap = Max( 0, mainAreaRect.Rect().iBr.iY - tabsPaneRect.Rect().iTl.iY);
+ }
+ else
+ {
+ // In portrait tab is above mainpane
+ tabBaseOverlap = Max( 0, mainAreaRect.Rect().iTl.iY - tabsPaneRect.Rect().iBr.iY);
+ }
+ TInt tabButtonWidth = Max(leftIndicationRect.Rect().Width(), rightIndicationRect.Rect().Width());
+ TInt tabVShift = Max( Abs(activeTabTextRect.TextRect().iBr.iY - passiveTabTextRect.TextRect().iBr.iY), Abs(activeTabTextRect.TextRect().iTl.iY - passiveTabTextRect.TextRect().iTl.iY) );
+ TInt tabHShift = Max( Abs(activeTabTextRect.TextRect().iBr.iX - passiveTabTextRect.TextRect().iBr.iX), Abs(activeTabTextRect.TextRect().iTl.iX - passiveTabTextRect.TextRect().iTl.iX) );
+ tabHShift -= (passiveTabRect.Rect().Width() - tabOverlap); // remove tab change and add overlapping area
+
+ switch( tabMetric )
+ {
+ case QStyle::PM_TabBarTabOverlap:
+ tabValue = tabOverlap;
+ break;
+ case QStyle::PM_TabBarTabHSpace:
+ tabValue = tabHSpace;
+ break;
+ case QStyle::PM_TabBarTabVSpace:
+ tabValue = tabVSpace;
+ break;
+ case QStyle::PM_TabBarBaseHeight:
+ tabValue = tabBaseHeight;
+ break;
+ case QStyle::PM_TabBarBaseOverlap:
+ tabValue = tabBaseOverlap;
+ break;
+ case QStyle::PM_TabBarScrollButtonWidth:
+ // Since in Qt the scroll indicator is shown within a button, we need to add button margins to this value
+ {
+ tabValue = tabButtonWidth + 2*PixelMetricValue(QStyle::PM_ButtonMargin);
+ }
+ break;
+ case QStyle::PM_TabBarTabShiftHorizontal:
+ tabValue = tabHShift;
+ break;
+ case QStyle::PM_TabBarTabShiftVertical:
+ tabValue = tabVShift;
+ break;
+ default:
+ break;
+ }
+ return tabValue;
+ }
+
+TInt PixelMetrics::PixelMetricMenuValue(QStyle::PixelMetric tabMetric, TRect mainPaneRect )
+ {
+ TInt menuValue = 0;
+ TAknLayoutRect popupMenuRect;
+ popupMenuRect.LayoutRect( mainPaneRect, AknLayoutScalable_Avkon::popup_menu_window(0) );
+ TAknLayoutRect listScrollPaneRect;
+ listScrollPaneRect.LayoutRect( popupMenuRect.Rect(), AknLayoutScalable_Avkon::listscroll_menu_pane(0) );
+ TAknLayoutRect listMenuPaneRect;
+ listMenuPaneRect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_menu_pane(0) );
+ TAknLayoutRect listMenuRow1Rect;
+ listMenuRow1Rect.LayoutRect( listScrollPaneRect.Rect(), AknLayoutScalable_Avkon::list_single_pane_cp2(0));
+
+ switch (tabMetric)
+ {
+ case QStyle::PM_MenuPanelWidth:
+ menuValue = listMenuPaneRect.Rect().iTl.iX - listScrollPaneRect.Rect().iTl.iX;
+ if ( AknLayoutUtils::LayoutMirrored() )
+ {
+ menuValue = listScrollPaneRect.Rect().iBr.iX - listMenuPaneRect.Rect().iBr.iX;
+ }
+ break;
+ case QStyle::PM_MenuHMargin:
+ menuValue = listMenuRow1Rect.Rect().iTl.iX - popupMenuRect.Rect().iTl.iX;
+ if ( AknLayoutUtils::LayoutMirrored() )
+ {
+ menuValue = popupMenuRect.Rect().iBr.iX - listMenuRow1Rect.Rect().iBr.iX;
+ }
+ break;
+ case QStyle::PM_MenuVMargin:
+ menuValue = listMenuRow1Rect.Rect().iTl.iY - popupMenuRect.Rect().iTl.iY;
+ break;
+ default:
+ break;
+ }
+ return menuValue;
+ }
diff --git a/util/s60pixelmetrics/pixel_metrics.h b/util/s60pixelmetrics/pixel_metrics.h
new file mode 100644
index 0000000..692564c
--- /dev/null
+++ b/util/s60pixelmetrics/pixel_metrics.h
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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
+ };
+
+ };
+#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
diff --git a/util/s60pixelmetrics/pm_mapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh
new file mode 100644
index 0000000..afd47db
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapper.hrh
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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,
+ ECmdSwitchMirroring,
+ ECmdStatus,
+ ECmdSwitchOutput,
+ ECmdCreateHeaderFile,
+ ECmdSetAutoMode
+ };
+
+enum
+ {
+ EWaitNote = 9000
+ };
+
+#endif // PMMAPPER_HRH
+
+
+// End of File
diff --git a/util/s60pixelmetrics/pm_mapper.mmp b/util/s60pixelmetrics/pm_mapper.mmp
new file mode 100644
index 0000000..a277404
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapper.mmp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <data_caging_paths.hrh>
+#include <domain\osextensions\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
diff --git a/util/s60pixelmetrics/pm_mapper.pkg b/util/s60pixelmetrics/pm_mapper.pkg
new file mode 100644
index 0000000..1f2e38f
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapper.pkg
@@ -0,0 +1,32 @@
+; ==============================================================================
+; Name : PMMapper.pkg
+; Part of : Pixel Metrics Mapper
+; Description : Package file for pixel metrics mapper
+; SIS creation.
+; Version :
+;
+; Copyright (c) 2009 Nokia Corporation.
+; 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"
diff --git a/util/s60pixelmetrics/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss
new file mode 100644
index 0000000..8543271
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapper.rss
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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 = ECmdSwitchMirroring; txt = "Switch mirroring";},
+ MENU_ITEM { command = ECmdStatus; txt = "Status"; },
+ MENU_ITEM { command = ECmdSwitchOutput; txt = "Switch output (file/screen)"; },
+ MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; },
+ MENU_ITEM { command = ECmdSetAutoMode; txt = "Switch autoMode";}
+ };
+ }
+
+
+// End of File
diff --git a/util/s60pixelmetrics/pm_mapper_reg.rss b/util/s60pixelmetrics/pm_mapper_reg.rss
new file mode 100644
index 0000000..d21a2c8
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapper_reg.rss
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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
diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp
new file mode 100644
index 0000000..e699019
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp
@@ -0,0 +1,1044 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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 <AvkonInternalCRKeys.h> // KAknLayoutId
+
+#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 = 5;
+
+// ============================ 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:
+ iFileOutputOn = !iFileOutputOn;
+ break;
+ case ECmdStatus:
+ {
+ ClearL();
+
+ // layout
+ CRepository* repository = NULL;
+ TInt value = KErrNotFound;
+ TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
+ if (ret == KErrNone)
+ {
+ ret = repository->Get(KAknLayoutId, value);
+ }
+ delete repository;
+ ret= 0;
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ bufferPtr.Append(_L("Layout: "));
+ if (ret==KErrNone)
+ {
+ bufferPtr.AppendNum(value);
+ }
+ else
+ {
+ bufferPtr.Append(_L("(error) "));
+ bufferPtr.AppendNum(ret);
+ }
+ TBool last = ETrue;
+ ShowL( *buffer, last );
+ bufferPtr.Zero();
+
+ // 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();
+
+ // Automode
+ bufferPtr.Append(_L("AutoMode: "));
+ bufferPtr.AppendNum((TInt)iAutoMode);
+ 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 ECmdSwitchMirroring:
+ {
+ // set the shared data value
+ CRepository* repository = NULL;
+ TRAPD(ret, repository = CRepository::NewL(KCRUidAvkon));
+ if (ret == KErrNone)
+ {
+ TInt value = KErrNotFound;
+ repository->Get(KAknLayoutId, value);
+ if ( value == EAknLayoutIdELAF)
+ {
+ value = EAknLayoutIdABRW;
+ }
+ else if (value ==EAknLayoutIdABRW)
+ {
+ value = EAknLayoutIdELAF;
+ }
+ ret = repository->Set(KAknLayoutId, value);
+ }
+ delete repository;
+ // now inform all open apps of the switch
+ TWsEvent event;
+ event.SetType(KEikDynamicLayoutVariantSwitch);
+ iEikonEnv->WsSession().SendEventToAllWindowGroups(event);
+ }
+ break;
+ case ECmdSwitchOrientation:
+ {
+ ClearL();
+ #ifndef __SERIES60_31__
+ if (!iAvkonAppUi->OrientationCanBeChanged())
+ {
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ bufferPtr.Append(_L("Orientation cannot be changed."));
+ TBool last = EFalse;
+ ShowL( *buffer, last );
+ bufferPtr.Zero();
+ delete buffer;
+ }
+ #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);
+ /*User::After(100000);
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ bufferPtr.Append(_L("Orientation unspecified."));
+ TBool last = EFalse;
+ ShowL( *buffer, last );
+ bufferPtr.Zero();
+ delete 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;
+ // HEIGTH
+ 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();
+ // MIRRORED
+ TBool mirrored = AknLayoutUtils::LayoutMirrored();
+ tgt.Append(_L("mirrored: \t"));
+ tgt.AppendNum(mirrored, EDecimal); // put mirrored state into text file
+ ShowL( tgt, last );
+ tgt.Zero();
+ }
+
+ TInt myValue = KErrNotFound;
+ for (;;)
+ {
+ if (index==QStyle::PM_Custom_ThinLineWidth)
+ {
+ 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++;
+ }
+ if (iAutoMode && !iMode)
+ {
+ HandleCommandL(ECmdSwitchMirroring);
+ iMode = ETrue;
+ }
+ }
+ break;
+ case ECmdCreateHeaderFile:
+ CreateHeaderFileL();
+ break;
+ case ECmdSetAutoMode:
+ iAutoMode = !iAutoMode;
+ default:
+ break;
+ }
+ }
+void CPixelMetricsMapperAppUi::DoAutoOperationL()
+ {
+ HandleCommandL(ECmdStartCalculations);
+ iMode = EFalse;
+ HandleCommandL(ECmdSwitchMirroring);
+ }
+
+TBool CPixelMetricsMapperAppUi::ReadyForAutoOp() const
+ {
+ return (iAutoMode && iMode);
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+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;
+ 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)
+ {
+ if (loop == KHeaderValues -1 ) // true / false values
+ {
+ if (nextValue == 1)
+ {
+ bufferLayoutHdr.Append(_L("true"));
+ }
+ else
+ {
+ bufferLayoutHdr.Append(_L("false"));
+ }
+ }
+ else
+ {
+ 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
+ }
+
+ 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
+ // fifth line mirror info
+ TFileName lines;
+ TFileName layoutName;
+
+ TInt height = -666;
+ TInt width = -666;
+ TInt mirroring = -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);
+ }
+ if (i==4) //mirror info is fourth
+ {
+ error = myLexer.Val(mirroring);
+ }
+ 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"));
+ }
+ if (mirroring)
+ {
+ layoutName.Append(_L(" Mirrored"));
+ }
+ 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
diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h
new file mode 100644
index 0000000..02d297e
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapperapp.h
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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();
+
+ public:
+ void DoAutoOperationL();
+
+ TBool ReadyForAutoOp() const;
+
+
+ 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;
+
+ CFbsBitmap* icon;
+ CFbsBitmap* iconMask;
+
+ TBool iAutoMode;
+ TBool iMode;
+
+ };
+
+
+/**
+* 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
diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp
new file mode 100644
index 0000000..f7ab2ac
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapperview.cpp
@@ -0,0 +1,375 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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);
+
+ if (AknLayoutUtils::LayoutMirrored())
+ fileName.Append(_L("_mirrored"));
+ 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 );
+
+ CPixelMetricsMapperAppUi* myApp = static_cast<CPixelMetricsMapperAppUi*> (ControlEnv()->AppUi());
+ if (myApp->ReadyForAutoOp())
+ myApp->DoAutoOperationL();
+ }
+ 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
diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h
new file mode 100644
index 0000000..e9eb42e
--- /dev/null
+++ b/util/s60pixelmetrics/pm_mapperview.h
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the utility applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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
diff --git a/util/s60theme/README b/util/s60theme/README
new file mode 100644
index 0000000..da4e81a
--- /dev/null
+++ b/util/s60theme/README
@@ -0,0 +1,31 @@
+'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
diff --git a/util/s60theme/main.cpp b/util/s60theme/main.cpp
new file mode 100644
index 0000000..f092a9a
--- /dev/null
+++ b/util/s60theme/main.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "s60themeconvert.h"
+
+int help()
+{
+ 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);
+ else if (inputInfo.suffix().compare(QString::fromLatin1("tdf"), Qt::CaseInsensitive) == 0)
+ return S60ThemeConvert::convertTdfToBlob(input, output);
+
+ return help();
+}
diff --git a/util/s60theme/s60theme.pro b/util/s60theme/s60theme.pro
new file mode 100644
index 0000000..83c0cf2
--- /dev/null
+++ b/util/s60theme/s60theme.pro
@@ -0,0 +1,12 @@
+SOURCES += \
+ s60themeconvert.cpp \
+ main.cpp
+
+HEADERS += \
+ s60themeconvert.h
+
+QT += \
+ webkit
+
+CONFIG += \
+ console
diff --git a/util/s60theme/s60themeconvert.cpp b/util/s60theme/s60themeconvert.cpp
new file mode 100644
index 0000000..a1e1d58
--- /dev/null
+++ b/util/s60theme/s60themeconvert.cpp
@@ -0,0 +1,301 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "s60themeconvert.h"
+
+#include <QtGui>
+#include <QtWebKit>
+
+static const int pictureSize = 256;
+
+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, parsedPartSvgs.keys()) {
+ const QString tdfFullName =
+ tdfBasePath + QDir::separator() + parsedPartSvgs.value(partKey);
+ if (!QFile(tdfFullName).exists())
+ qWarning() << "Could not find part:" << parsedPartSvgs.value(partKey);
+ 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() << "Could not find part:" << partFileName;
+ continue;
+ }
+ 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"
diff --git a/util/s60theme/s60themeconvert.h b/util/s60theme/s60themeconvert.h
new file mode 100644
index 0000000..e48922f
--- /dev/null
+++ b/util/s60theme/s60themeconvert.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $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