os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSystemInfoDialog.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Part of the MVS Application for TechView
    15 //
    16 
    17 #include "MVSSystemInfoDialog.h"
    18 #include "MVSApp.hrh"
    19 #include "MVSAppUI.h"
    20 #include <techview/eikedwin.h>
    21 
    22 const TInt KControllerCaptionLength = 23;
    23 const TInt KCodecCaptionLength = 8;
    24 
    25 void CMVSSystemInfoDialog::SetupDialogLD(CMVSAppUi* aAppUi)
    26 	{
    27     CMVSSystemInfoDialog* dialog = new (ELeave) CMVSSystemInfoDialog(aAppUi);
    28     CleanupStack::PushL(dialog);
    29     dialog->ConstructL();
    30     CleanupStack::Pop(dialog);
    31     dialog->ExecuteLD(R_NEW_MVS_DIALOG_SYSTEMINFO);
    32     }
    33 
    34 
    35 void CMVSSystemInfoDialog::PreLayoutDynInitL()
    36     {
    37     // Get a downcasted pointer to the controls
    38     CDesCArrayFlat* arrCtlrCodec = NULL;
    39     arrCtlrCodec = new(ELeave)CDesCArrayFlat(8);
    40     CEikEdwin* controlPtr = static_cast<CEikEdwin*>(Control(EMVSCmdSystemInfo));
    41     if(controlPtr)
    42 	    {
    43 	    controlPtr->SetReadOnly(TRUE);
    44 	    controlPtr->SetBackgroundColorL(KRgbGray);
    45 	    TInt len = 0;
    46 	    TInt counter = 0;
    47 	    //get the array of plugins - audio
    48 		iAppUi->GetSystemInfoL(arrCtlrCodec);
    49 		for(counter=0; counter < arrCtlrCodec->MdcaCount(); counter++)
    50 			{
    51 			len =len + (*arrCtlrCodec)[counter].Length();//getting the total length required to be assigned to HBufC
    52 			}
    53 		_LIT(KControllerCaption,"AVAILABLE CONTROLLERS");
    54 		TInt finalLength =len + counter + KControllerCaptionLength;//adding space for delimiter,
    55 																   //so that every controller is displayed in a newline.	
    56 		HBufC* controllerList = HBufC::NewLC(finalLength);
    57 		controllerList->Des().Append(KControllerCaption);
    58 		controllerList->Des().Append(CEditableText::EParagraphDelimiter);
    59 		for(TInt i=0; i < arrCtlrCodec->MdcaCount(); i++)     
    60 			{
    61 			TBuf<256> data((*arrCtlrCodec)[i]);
    62 			controllerList->Des().Append(data);			
    63 		 	controllerList->Des().Append(CEditableText::EParagraphDelimiter);
    64 		 	}
    65 		//get the array of plugins - video
    66 	    arrCtlrCodec->Reset();
    67 	    RArray<TFourCC> nArrCodecs;
    68 		char *pch = NULL;
    69 		TUint32 unValue;
    70 		TBuf<40> td;
    71 		TInt err = 0;
    72 		TRAP(err,iAppUi->GetSupportedCodecsArrayL(nArrCodecs));
    73 	    if(err==KErrNotSupported)
    74 			{
    75 			TPtrC infoPtr = controllerList->Des();
    76 			controlPtr->SetTextL(&infoPtr);
    77 			CleanupStack::PopAndDestroy(controllerList);
    78 			}
    79 		else
    80 			{
    81 			_LIT(KCodecCaption,"CODECS");
    82 			TInt availableCodecCount = nArrCodecs.Count();
    83 			TInt codecLength = availableCodecCount * 4;//4 becuase thats the size of each codec
    84 			TInt codecDataFinalLength = codecLength + finalLength + availableCodecCount +KCodecCaptionLength;//Final length of the HBuf
    85 			HBufC* newList = controllerList->ReAllocL(codecDataFinalLength);
    86 			CleanupStack::Pop(controllerList);//This is the old pointer which was pushed into the cleanupstack before ReAlloc.
    87 			CleanupStack::PushL(newList);//The new pointer pointing to the new memory allocated after ReAlloc.
    88 		    newList->Des().Append(CEditableText::EParagraphDelimiter);
    89 		    newList->Des().Append(KCodecCaption);
    90 		    newList->Des().Append(CEditableText::EParagraphDelimiter);
    91 		    for(TInt i = 0; i < nArrCodecs.Count(); i++)
    92 		    	{
    93 			   	unValue = nArrCodecs[i].FourCC();
    94 		    	pch =(char*)&unValue;
    95 		    	td.Zero();
    96 		    	td.Append(pch[0]);
    97 		    	td.Append(pch[1]);
    98 		    	td.Append(pch[2]);
    99 		    	td.Append(pch[3]);
   100 		    	newList->Des().Append(td);
   101 		      	newList->Des().Append(CEditableText::EParagraphDelimiter);
   102 		      	}
   103 			TPtrC infoPtr = newList->Des();
   104 			controlPtr->SetTextL(&infoPtr);
   105 			CleanupStack::PopAndDestroy(newList);
   106 			}
   107 	    //set the contents of CEikEdwin - system info control
   108 	    nArrCodecs.Close();
   109 	    delete arrCtlrCodec; 	
   110 	    }
   111     }
   112 
   113 
   114 
   115 CMVSSystemInfoDialog::CMVSSystemInfoDialog(CMVSAppUi* aAppUi)
   116 : iAppUi(aAppUi)
   117 	{
   118     //Nothing to do here - all done in initialisation list
   119     }
   120 
   121 
   122 CMVSSystemInfoDialog::~CMVSSystemInfoDialog()
   123 	{
   124 	}
   125 
   126 void CMVSSystemInfoDialog::ConstructL()
   127 	{
   128 	}
   129 
   130 
   131 
   132 TBool CMVSSystemInfoDialog::OkToExitL(TInt/* aButtonId*/)
   133     {
   134     //Nothing to be taken from the user here,
   135 	//Just display the information.
   136 	return ETrue;
   137 	}