summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2009-12-15 11:09:09 (GMT)
committerSami Merila <sami.merila@nokia.com>2009-12-15 11:09:09 (GMT)
commita0ce8bba1aae7c1aaf189b83bfe83eb6b80bf0bf (patch)
tree9cc4bdf56e4c438384d54cb73a9dedf1af3b375c /util
parent2c6749c38a2538639de86355856414b0d21317cf (diff)
downloadQt-a0ce8bba1aae7c1aaf189b83bfe83eb6b80bf0bf.zip
Qt-a0ce8bba1aae7c1aaf189b83bfe83eb6b80bf0bf.tar.gz
Qt-a0ce8bba1aae7c1aaf189b83bfe83eb6b80bf0bf.tar.bz2
QS60Style: Remove layouts with mirrored information
Currently QS60Style stores pixel metrics values (96 of them for each layout) in a static lookup table. There is one "line" for each screensize, orientation and layout direction (ten in total). This fix removes the layout direction specific "lines" as there are only two pixel metrics values that differ depending on direction. We can handle those two inside QS60Style::pixelMetrics() and thus remove half of the rows, and thus gain 16*96*5 ~ 8kB of RAM. Task-number: QTBUG-6803 Reviewed-by: Alessandro Portale
Diffstat (limited to 'util')
-rw-r--r--util/s60pixelmetrics/pm_mapper.hrh9
-rw-r--r--util/s60pixelmetrics/pm_mapper.rss4
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.cpp138
-rw-r--r--util/s60pixelmetrics/pm_mapperapp.h14
-rw-r--r--util/s60pixelmetrics/pm_mapperview.cpp12
-rw-r--r--util/s60pixelmetrics/pm_mapperview.h2
6 files changed, 35 insertions, 144 deletions
diff --git a/util/s60pixelmetrics/pm_mapper.hrh b/util/s60pixelmetrics/pm_mapper.hrh
index 4822654..f46a963 100644
--- a/util/s60pixelmetrics/pm_mapper.hrh
+++ b/util/s60pixelmetrics/pm_mapper.hrh
@@ -55,16 +55,9 @@ enum
{
ECmdStartCalculations = 8500,
ECmdSwitchOrientation,
- ECmdSwitchMirroring,
ECmdStatus,
ECmdSwitchOutput,
- ECmdCreateHeaderFile,
- ECmdSetAutoMode
- };
-
-enum
- {
- EWaitNote = 9000
+ ECmdCreateHeaderFile
};
#endif // PMMAPPER_HRH
diff --git a/util/s60pixelmetrics/pm_mapper.rss b/util/s60pixelmetrics/pm_mapper.rss
index 22817ad..8071b44 100644
--- a/util/s60pixelmetrics/pm_mapper.rss
+++ b/util/s60pixelmetrics/pm_mapper.rss
@@ -150,11 +150,9 @@ RESOURCE MENU_PANE r_pmmapper_system_menu
{
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";}
+ MENU_ITEM { command = ECmdCreateHeaderFile; txt = "Create header file"; }
};
}
diff --git a/util/s60pixelmetrics/pm_mapperapp.cpp b/util/s60pixelmetrics/pm_mapperapp.cpp
index de6af0d..19d3b36 100644
--- a/util/s60pixelmetrics/pm_mapperapp.cpp
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp
@@ -65,7 +65,6 @@
#include <aknglobalnote.h>
#include <CentralRepository.h>
-#include <AvkonInternalCRKeys.h> // KAknLayoutId
#include <Aknsutils.h>
#include <AknUtils.h>
@@ -89,7 +88,7 @@ _LIT(KEndBraceWithCommaAndCRLF, "},\n");
_LIT(KCRLF, "\n");
// Number of header lines in layout data.
-const TInt KHeaderValues = 5;
+const TInt KHeaderValues = 4;
// ============================ MEMBER FUNCTIONS ===============================
@@ -156,37 +155,27 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
Exit();
break;
case ECmdSwitchOutput:
+ {
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ TBool last = ETrue;
+ bufferPtr.Append(_L("Output switched to "));
iFileOutputOn = !iFileOutputOn;
+ if (iFileOutputOn)
+ bufferPtr.Append(_L("file."));
+ else
+ bufferPtr.Append(_L("screen."));
+ ShowL( *buffer, last );
+ }
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: "));
@@ -201,12 +190,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
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();
@@ -261,47 +244,24 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
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();
+ HBufC* buffer = HBufC::NewLC( 100 );
+ TPtr bufferPtr = buffer->Des();
+ TBool last = ETrue;
+
#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;
+ break;
}
#endif //__SERIES60_31__
+
if ( iAvkonAppUi->Orientation() == CAknAppUiBase::EAppUiOrientationPortrait)
{
iAvkonAppUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape);
@@ -314,15 +274,11 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
{
// 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;*/
}
+ bufferPtr.Append(_L("Orientation changed."));
+ ShowL( *buffer, last );
+ bufferPtr.Zero();
+ delete buffer;
break;
}
case ECmdStartCalculations:
@@ -362,12 +318,6 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
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;
@@ -385,33 +335,15 @@ void CPixelMetricsMapperAppUi::HandleCommandL( TInt aCommand )
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);
- }
// -----------------------------------------------------------------------------
//
@@ -834,21 +766,7 @@ void CPixelMetricsMapperAppUi::CreateHeaderFileL() const
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);
- }
+ bufferLayoutHdr.AppendNum(nextValue);
}
else
{
@@ -882,13 +800,11 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
// 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++)
{
@@ -907,10 +823,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
{
error = myLexer.Val(width);
}
- if (i==4) //mirror info is fourth
- {
- error = myLexer.Val(mirroring);
- }
User::LeaveIfError(error);
}
@@ -966,10 +878,6 @@ TFileName CPixelMetricsMapperAppUi::CreateLayoutNameL(TFileText& aFileHandle) co
{
layoutName.Append(_L("Portrait"));
}
- if (mirroring)
- {
- layoutName.Append(_L(" Mirrored"));
- }
return layoutName;
}
diff --git a/util/s60pixelmetrics/pm_mapperapp.h b/util/s60pixelmetrics/pm_mapperapp.h
index cd119bc..aa6a63b 100644
--- a/util/s60pixelmetrics/pm_mapperapp.h
+++ b/util/s60pixelmetrics/pm_mapperapp.h
@@ -111,7 +111,7 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
/**
* Constructor.
*/
- CPixelMetricsMapperAppUi();
+ CPixelMetricsMapperAppUi();
/**
* Symbian 2nd phase constructor.
@@ -123,12 +123,6 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
*/
~CPixelMetricsMapperAppUi();
- public:
- void DoAutoOperationL();
-
- TBool ReadyForAutoOp() const;
-
-
private: // Functions from base classes
/**
@@ -158,18 +152,16 @@ class CPixelMetricsMapperAppUi : public CAknViewAppUi
private: // Data
// Test view.
- CPixelMetricsMapperView* iView;
+ CPixelMetricsMapperView* iView;
CEikDialog* iDialog;
TBool iFileOutputOn;
+ TBool iMode;
CFbsBitmap* icon;
CFbsBitmap* iconMask;
- TBool iAutoMode;
- TBool iMode;
-
};
diff --git a/util/s60pixelmetrics/pm_mapperview.cpp b/util/s60pixelmetrics/pm_mapperview.cpp
index 82b825d..04bc3e8 100644
--- a/util/s60pixelmetrics/pm_mapperview.cpp
+++ b/util/s60pixelmetrics/pm_mapperview.cpp
@@ -129,8 +129,6 @@ void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast
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);
@@ -263,11 +261,9 @@ void CPixelMetricsMapperViewContainer::HandleResourceChange(TInt aType)
mainPaneRect );
SetRect( mainPaneRect );
- CPixelMetricsMapperAppUi* myApp = static_cast<CPixelMetricsMapperAppUi*> (ControlEnv()->AppUi());
- if (myApp->ReadyForAutoOp())
- myApp->DoAutoOperationL();
}
- if (iListbox) iListbox->HandleResourceChange(aType);
+ if (iListbox)
+ iListbox->HandleResourceChange(aType);
}
@@ -329,6 +325,7 @@ void CPixelMetricsMapperView::HandleCommandL( TInt aCommand )
AppUi()->HandleCommandL( aCommand );
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -342,6 +339,7 @@ void CPixelMetricsMapperView::HandleStatusPaneSizeChange()
}
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -358,6 +356,7 @@ void CPixelMetricsMapperView::DoActivateL(
AppUi()->AddToViewStackL( *this, iView );
}
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -372,4 +371,5 @@ void CPixelMetricsMapperView::DoDeactivate()
iView = NULL;
}
+
// End of File
diff --git a/util/s60pixelmetrics/pm_mapperview.h b/util/s60pixelmetrics/pm_mapperview.h
index be40a15..36376cd 100644
--- a/util/s60pixelmetrics/pm_mapperview.h
+++ b/util/s60pixelmetrics/pm_mapperview.h
@@ -219,7 +219,7 @@ class CPixelMetricsMapperView : public CAknView
private: // Data
// The view container.
- CPixelMetricsMapperViewContainer* iView;
+ CPixelMetricsMapperViewContainer* iView;
};