os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteapp/src/MVSSystemInfoDialog.cpp
First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Part of the MVS Application for TechView
17 #include "MVSSystemInfoDialog.h"
20 #include <techview/eikedwin.h>
22 const TInt KControllerCaptionLength = 23;
23 const TInt KCodecCaptionLength = 8;
25 void CMVSSystemInfoDialog::SetupDialogLD(CMVSAppUi* aAppUi)
27 CMVSSystemInfoDialog* dialog = new (ELeave) CMVSSystemInfoDialog(aAppUi);
28 CleanupStack::PushL(dialog);
30 CleanupStack::Pop(dialog);
31 dialog->ExecuteLD(R_NEW_MVS_DIALOG_SYSTEMINFO);
35 void CMVSSystemInfoDialog::PreLayoutDynInitL()
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));
43 controlPtr->SetReadOnly(TRUE);
44 controlPtr->SetBackgroundColorL(KRgbGray);
47 //get the array of plugins - audio
48 iAppUi->GetSystemInfoL(arrCtlrCodec);
49 for(counter=0; counter < arrCtlrCodec->MdcaCount(); counter++)
51 len =len + (*arrCtlrCodec)[counter].Length();//getting the total length required to be assigned to HBufC
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++)
61 TBuf<256> data((*arrCtlrCodec)[i]);
62 controllerList->Des().Append(data);
63 controllerList->Des().Append(CEditableText::EParagraphDelimiter);
65 //get the array of plugins - video
66 arrCtlrCodec->Reset();
67 RArray<TFourCC> nArrCodecs;
72 TRAP(err,iAppUi->GetSupportedCodecsArrayL(nArrCodecs));
73 if(err==KErrNotSupported)
75 TPtrC infoPtr = controllerList->Des();
76 controlPtr->SetTextL(&infoPtr);
77 CleanupStack::PopAndDestroy(controllerList);
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++)
93 unValue = nArrCodecs[i].FourCC();
100 newList->Des().Append(td);
101 newList->Des().Append(CEditableText::EParagraphDelimiter);
103 TPtrC infoPtr = newList->Des();
104 controlPtr->SetTextL(&infoPtr);
105 CleanupStack::PopAndDestroy(newList);
107 //set the contents of CEikEdwin - system info control
115 CMVSSystemInfoDialog::CMVSSystemInfoDialog(CMVSAppUi* aAppUi)
118 //Nothing to do here - all done in initialisation list
122 CMVSSystemInfoDialog::~CMVSSystemInfoDialog()
126 void CMVSSystemInfoDialog::ConstructL()
132 TBool CMVSSystemInfoDialog::OkToExitL(TInt/* aButtonId*/)
134 //Nothing to be taken from the user here,
135 //Just display the information.