util/s60pixelmetrics/pm_mapperapp.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
--- a/util/s60pixelmetrics/pm_mapperapp.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/util/s60pixelmetrics/pm_mapperapp.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -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(KCRLF, "\n");
 
 // Number of header lines in layout data.
-const TInt KHeaderValues = 5;
+const TInt KHeaderValues = 4;
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -138,7 +137,7 @@
 //
 TKeyResponse CPixelMetricsMapperAppUi::HandleKeyEventL(
         const TKeyEvent& /*aKeyEvent*/,
-        TEventCode aType )
+        TEventCode /*aType*/ )
     {
     return EKeyWasNotConsumed;
     }
@@ -156,37 +155,27 @@
             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 @@
             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 @@
             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 @@
                 {
                 // 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 @@
                 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 @@
                 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 @@
             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 @@
     // 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 @@
             {
             error = myLexer.Val(width);
             }
-        if (i==4) //mirror info is fourth
-            {
-            error = myLexer.Val(mirroring);
-            }
         User::LeaveIfError(error);
         }
 
@@ -966,10 +878,6 @@
         {
         layoutName.Append(_L("Portrait"));
         }
-    if (mirroring)
-        {
-        layoutName.Append(_L(" Mirrored"));
-        }
     return layoutName;
     }