os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSystemInfoDialog.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSystemInfoDialog.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,137 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Part of the MVS Application for TechView
1.18 +//
1.19 +
1.20 +#include "MVSSystemInfoDialog.h"
1.21 +#include "MVSApp.hrh"
1.22 +#include "MVSAppUI.h"
1.23 +#include <techview/eikedwin.h>
1.24 +
1.25 +const TInt KControllerCaptionLength = 23;
1.26 +const TInt KCodecCaptionLength = 8;
1.27 +
1.28 +void CMVSSystemInfoDialog::SetupDialogLD(CMVSAppUi* aAppUi)
1.29 + {
1.30 + CMVSSystemInfoDialog* dialog = new (ELeave) CMVSSystemInfoDialog(aAppUi);
1.31 + CleanupStack::PushL(dialog);
1.32 + dialog->ConstructL();
1.33 + CleanupStack::Pop(dialog);
1.34 + dialog->ExecuteLD(R_NEW_MVS_DIALOG_SYSTEMINFO);
1.35 + }
1.36 +
1.37 +
1.38 +void CMVSSystemInfoDialog::PreLayoutDynInitL()
1.39 + {
1.40 + // Get a downcasted pointer to the controls
1.41 + CDesCArrayFlat* arrCtlrCodec = NULL;
1.42 + arrCtlrCodec = new(ELeave)CDesCArrayFlat(8);
1.43 + CEikEdwin* controlPtr = static_cast<CEikEdwin*>(Control(EMVSCmdSystemInfo));
1.44 + if(controlPtr)
1.45 + {
1.46 + controlPtr->SetReadOnly(TRUE);
1.47 + controlPtr->SetBackgroundColorL(KRgbGray);
1.48 + TInt len = 0;
1.49 + TInt counter = 0;
1.50 + //get the array of plugins - audio
1.51 + iAppUi->GetSystemInfoL(arrCtlrCodec);
1.52 + for(counter=0; counter < arrCtlrCodec->MdcaCount(); counter++)
1.53 + {
1.54 + len =len + (*arrCtlrCodec)[counter].Length();//getting the total length required to be assigned to HBufC
1.55 + }
1.56 + _LIT(KControllerCaption,"AVAILABLE CONTROLLERS");
1.57 + TInt finalLength =len + counter + KControllerCaptionLength;//adding space for delimiter,
1.58 + //so that every controller is displayed in a newline.
1.59 + HBufC* controllerList = HBufC::NewLC(finalLength);
1.60 + controllerList->Des().Append(KControllerCaption);
1.61 + controllerList->Des().Append(CEditableText::EParagraphDelimiter);
1.62 + for(TInt i=0; i < arrCtlrCodec->MdcaCount(); i++)
1.63 + {
1.64 + TBuf<256> data((*arrCtlrCodec)[i]);
1.65 + controllerList->Des().Append(data);
1.66 + controllerList->Des().Append(CEditableText::EParagraphDelimiter);
1.67 + }
1.68 + //get the array of plugins - video
1.69 + arrCtlrCodec->Reset();
1.70 + RArray<TFourCC> nArrCodecs;
1.71 + char *pch = NULL;
1.72 + TUint32 unValue;
1.73 + TBuf<40> td;
1.74 + TInt err = 0;
1.75 + TRAP(err,iAppUi->GetSupportedCodecsArrayL(nArrCodecs));
1.76 + if(err==KErrNotSupported)
1.77 + {
1.78 + TPtrC infoPtr = controllerList->Des();
1.79 + controlPtr->SetTextL(&infoPtr);
1.80 + CleanupStack::PopAndDestroy(controllerList);
1.81 + }
1.82 + else
1.83 + {
1.84 + _LIT(KCodecCaption,"CODECS");
1.85 + TInt availableCodecCount = nArrCodecs.Count();
1.86 + TInt codecLength = availableCodecCount * 4;//4 becuase thats the size of each codec
1.87 + TInt codecDataFinalLength = codecLength + finalLength + availableCodecCount +KCodecCaptionLength;//Final length of the HBuf
1.88 + HBufC* newList = controllerList->ReAllocL(codecDataFinalLength);
1.89 + CleanupStack::Pop(controllerList);//This is the old pointer which was pushed into the cleanupstack before ReAlloc.
1.90 + CleanupStack::PushL(newList);//The new pointer pointing to the new memory allocated after ReAlloc.
1.91 + newList->Des().Append(CEditableText::EParagraphDelimiter);
1.92 + newList->Des().Append(KCodecCaption);
1.93 + newList->Des().Append(CEditableText::EParagraphDelimiter);
1.94 + for(TInt i = 0; i < nArrCodecs.Count(); i++)
1.95 + {
1.96 + unValue = nArrCodecs[i].FourCC();
1.97 + pch =(char*)&unValue;
1.98 + td.Zero();
1.99 + td.Append(pch[0]);
1.100 + td.Append(pch[1]);
1.101 + td.Append(pch[2]);
1.102 + td.Append(pch[3]);
1.103 + newList->Des().Append(td);
1.104 + newList->Des().Append(CEditableText::EParagraphDelimiter);
1.105 + }
1.106 + TPtrC infoPtr = newList->Des();
1.107 + controlPtr->SetTextL(&infoPtr);
1.108 + CleanupStack::PopAndDestroy(newList);
1.109 + }
1.110 + //set the contents of CEikEdwin - system info control
1.111 + nArrCodecs.Close();
1.112 + delete arrCtlrCodec;
1.113 + }
1.114 + }
1.115 +
1.116 +
1.117 +
1.118 +CMVSSystemInfoDialog::CMVSSystemInfoDialog(CMVSAppUi* aAppUi)
1.119 +: iAppUi(aAppUi)
1.120 + {
1.121 + //Nothing to do here - all done in initialisation list
1.122 + }
1.123 +
1.124 +
1.125 +CMVSSystemInfoDialog::~CMVSSystemInfoDialog()
1.126 + {
1.127 + }
1.128 +
1.129 +void CMVSSystemInfoDialog::ConstructL()
1.130 + {
1.131 + }
1.132 +
1.133 +
1.134 +
1.135 +TBool CMVSSystemInfoDialog::OkToExitL(TInt/* aButtonId*/)
1.136 + {
1.137 + //Nothing to be taken from the user here,
1.138 + //Just display the information.
1.139 + return ETrue;
1.140 + }