diff options
-rw-r--r-- | src/gui/styles/qs60style.cpp | 27 | ||||
-rw-r--r-- | src/gui/styles/qs60style_s60.cpp | 20 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper.hrh | 9 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapper.rss | 4 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperapp.cpp | 138 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperapp.h | 14 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperview.cpp | 12 | ||||
-rw-r--r-- | util/s60pixelmetrics/pm_mapperview.h | 2 |
8 files changed, 50 insertions, 176 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 17db53d..ed86f5a 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -88,16 +88,11 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,15,true,"QVGA Landscape Mirrored"}, -{240,320,1,15,false,"QVGA Landscape"}, -{320,240,1,15,true,"QVGA Portrait Mirrored"}, -{320,240,1,15,false,"QVGA Portrait"}, -{360,640,1,15,true,"NHD Landscape Mirrored"}, -{360,640,1,15,false,"NHD Landscape"}, -{640,360,1,15,true,"NHD Portrait Mirrored"}, -{640,360,1,15,false,"NHD Portrait"}, -{352,800,1,12,true,"E90 Landscape Mirrored"}, -{352,800,1,12,false,"E90 Landscape"} +{240,320,1,15,"QVGA Landscape"}, +{320,240,1,15,"QVGA Portrait"}, +{360,640,1,15,"NHD Landscape"}, +{640,360,1,15,"NHD Portrait"}, +{352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; const int QS60StylePrivate::m_numberOfLayouts = @@ -105,15 +100,10 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,6,3,3,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, {5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, {5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} // *** End of generated data *** }; @@ -2329,6 +2319,13 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const metricValue = -menuWidth; } } + //if layout direction is mirrored, switch left and right border margins + if (option && option->direction == Qt::RightToLeft) { + if (metric == PM_LayoutLeftMargin) + metricValue = QS60StylePrivate::pixelMetric(PM_LayoutRightMargin); + else if (metric == PM_LayoutRightMargin) + metricValue = QS60StylePrivate::pixelMetric(PM_LayoutLeftMargin); + } return metricValue; } diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index d5b3f73..13ac301 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -960,37 +960,23 @@ void QS60StylePrivate::setActiveLayout() { const QSize activeScreenSize(screenSize()); int activeLayoutIndex = -1; - const bool mirrored = !QApplication::isLeftToRight(); const short screenHeight = (short)activeScreenSize.height(); const short screenWidth = (short)activeScreenSize.width(); for (int i=0; i<m_numberOfLayouts; i++) { if (screenHeight==m_layoutHeaders[i].height && - screenWidth==m_layoutHeaders[i].width && - mirrored==m_layoutHeaders[i].mirroring) { + screenWidth==m_layoutHeaders[i].width) { activeLayoutIndex = i; break; } } - //not found, lets try without mirroring info - if (activeLayoutIndex==-1){ - for (int i=0; i<m_numberOfLayouts; i++) { - if (screenHeight==m_layoutHeaders[i].height && - screenWidth==m_layoutHeaders[i].width) { - activeLayoutIndex = i; - break; - } - } - } - //not found, lets try with either of dimensions if (activeLayoutIndex==-1){ const QSysInfo::S60Version currentRelease = QSysInfo::s60Version(); const bool landscape = screenHeight < screenWidth; - activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 4; - activeLayoutIndex += (!landscape) ? 2 : 0; - activeLayoutIndex += (!mirrored) ? 1 : 0; + activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 2; + activeLayoutIndex += (!landscape) ? 1 : 0; } m_pmPointer = data[activeLayoutIndex]; 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; }; |