sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Part of the MVS Application for TechView sl@0: // sl@0: sl@0: #include "MVSSystemInfoDialog.h" sl@0: #include "MVSApp.hrh" sl@0: #include "MVSAppUI.h" sl@0: #include sl@0: sl@0: const TInt KControllerCaptionLength = 23; sl@0: const TInt KCodecCaptionLength = 8; sl@0: sl@0: void CMVSSystemInfoDialog::SetupDialogLD(CMVSAppUi* aAppUi) sl@0: { sl@0: CMVSSystemInfoDialog* dialog = new (ELeave) CMVSSystemInfoDialog(aAppUi); sl@0: CleanupStack::PushL(dialog); sl@0: dialog->ConstructL(); sl@0: CleanupStack::Pop(dialog); sl@0: dialog->ExecuteLD(R_NEW_MVS_DIALOG_SYSTEMINFO); sl@0: } sl@0: sl@0: sl@0: void CMVSSystemInfoDialog::PreLayoutDynInitL() sl@0: { sl@0: // Get a downcasted pointer to the controls sl@0: CDesCArrayFlat* arrCtlrCodec = NULL; sl@0: arrCtlrCodec = new(ELeave)CDesCArrayFlat(8); sl@0: CEikEdwin* controlPtr = static_cast(Control(EMVSCmdSystemInfo)); sl@0: if(controlPtr) sl@0: { sl@0: controlPtr->SetReadOnly(TRUE); sl@0: controlPtr->SetBackgroundColorL(KRgbGray); sl@0: TInt len = 0; sl@0: TInt counter = 0; sl@0: //get the array of plugins - audio sl@0: iAppUi->GetSystemInfoL(arrCtlrCodec); sl@0: for(counter=0; counter < arrCtlrCodec->MdcaCount(); counter++) sl@0: { sl@0: len =len + (*arrCtlrCodec)[counter].Length();//getting the total length required to be assigned to HBufC sl@0: } sl@0: _LIT(KControllerCaption,"AVAILABLE CONTROLLERS"); sl@0: TInt finalLength =len + counter + KControllerCaptionLength;//adding space for delimiter, sl@0: //so that every controller is displayed in a newline. sl@0: HBufC* controllerList = HBufC::NewLC(finalLength); sl@0: controllerList->Des().Append(KControllerCaption); sl@0: controllerList->Des().Append(CEditableText::EParagraphDelimiter); sl@0: for(TInt i=0; i < arrCtlrCodec->MdcaCount(); i++) sl@0: { sl@0: TBuf<256> data((*arrCtlrCodec)[i]); sl@0: controllerList->Des().Append(data); sl@0: controllerList->Des().Append(CEditableText::EParagraphDelimiter); sl@0: } sl@0: //get the array of plugins - video sl@0: arrCtlrCodec->Reset(); sl@0: RArray nArrCodecs; sl@0: char *pch = NULL; sl@0: TUint32 unValue; sl@0: TBuf<40> td; sl@0: TInt err = 0; sl@0: TRAP(err,iAppUi->GetSupportedCodecsArrayL(nArrCodecs)); sl@0: if(err==KErrNotSupported) sl@0: { sl@0: TPtrC infoPtr = controllerList->Des(); sl@0: controlPtr->SetTextL(&infoPtr); sl@0: CleanupStack::PopAndDestroy(controllerList); sl@0: } sl@0: else sl@0: { sl@0: _LIT(KCodecCaption,"CODECS"); sl@0: TInt availableCodecCount = nArrCodecs.Count(); sl@0: TInt codecLength = availableCodecCount * 4;//4 becuase thats the size of each codec sl@0: TInt codecDataFinalLength = codecLength + finalLength + availableCodecCount +KCodecCaptionLength;//Final length of the HBuf sl@0: HBufC* newList = controllerList->ReAllocL(codecDataFinalLength); sl@0: CleanupStack::Pop(controllerList);//This is the old pointer which was pushed into the cleanupstack before ReAlloc. sl@0: CleanupStack::PushL(newList);//The new pointer pointing to the new memory allocated after ReAlloc. sl@0: newList->Des().Append(CEditableText::EParagraphDelimiter); sl@0: newList->Des().Append(KCodecCaption); sl@0: newList->Des().Append(CEditableText::EParagraphDelimiter); sl@0: for(TInt i = 0; i < nArrCodecs.Count(); i++) sl@0: { sl@0: unValue = nArrCodecs[i].FourCC(); sl@0: pch =(char*)&unValue; sl@0: td.Zero(); sl@0: td.Append(pch[0]); sl@0: td.Append(pch[1]); sl@0: td.Append(pch[2]); sl@0: td.Append(pch[3]); sl@0: newList->Des().Append(td); sl@0: newList->Des().Append(CEditableText::EParagraphDelimiter); sl@0: } sl@0: TPtrC infoPtr = newList->Des(); sl@0: controlPtr->SetTextL(&infoPtr); sl@0: CleanupStack::PopAndDestroy(newList); sl@0: } sl@0: //set the contents of CEikEdwin - system info control sl@0: nArrCodecs.Close(); sl@0: delete arrCtlrCodec; sl@0: } sl@0: } sl@0: sl@0: sl@0: sl@0: CMVSSystemInfoDialog::CMVSSystemInfoDialog(CMVSAppUi* aAppUi) sl@0: : iAppUi(aAppUi) sl@0: { sl@0: //Nothing to do here - all done in initialisation list sl@0: } sl@0: sl@0: sl@0: CMVSSystemInfoDialog::~CMVSSystemInfoDialog() sl@0: { sl@0: } sl@0: sl@0: void CMVSSystemInfoDialog::ConstructL() sl@0: { sl@0: } sl@0: sl@0: sl@0: sl@0: TBool CMVSSystemInfoDialog::OkToExitL(TInt/* aButtonId*/) sl@0: { sl@0: //Nothing to be taken from the user here, sl@0: //Just display the information. sl@0: return ETrue; sl@0: }