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