21
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Voice Recorder sub-menu in General Settings.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDES
|
|
20 |
#include "CVRGSPluginContainer.h"
|
|
21 |
#include "CVRGSPlugin.h"
|
|
22 |
|
|
23 |
#include <voicerecorder.rsg>
|
|
24 |
#include <VoiceRecorderUID.h>
|
|
25 |
|
|
26 |
#include "VRConsts.h"
|
|
27 |
#include "VRUtils.h"
|
|
28 |
#include <csxhelp/vorec.hlp.hrh>
|
|
29 |
|
|
30 |
|
|
31 |
#include <aknlists.h> //for CAknSettingStyleListBox
|
|
32 |
#include <aknsettingitemlist.h>
|
|
33 |
#include <CAknMemorySelectionSettingItem.h>
|
|
34 |
#include <aknnotewrappers.h> // for CAknInformationNote
|
|
35 |
//#include <GSCamcorderPlugin.mbg>
|
|
36 |
#include <gslistbox.h> //for listbox clases
|
|
37 |
#include <AknIconArray.h> // CAknIconArray
|
|
38 |
#include <eikclbd.h> // CColumnListBoxData
|
|
39 |
|
|
40 |
#ifdef RD_MULTIPLE_DRIVE
|
|
41 |
#include <driveinfo.h>
|
|
42 |
#include <CAknMemorySelectionSettingItemMultiDrive.h>
|
|
43 |
#include <AknCommonDialogsDynMem.h>
|
|
44 |
#endif
|
|
45 |
|
|
46 |
const TUid KVRAppUID = { KVoiceRecorderAppUID3 };
|
|
47 |
|
|
48 |
// ListBox item index
|
|
49 |
enum TListItemIndex
|
|
50 |
{
|
|
51 |
EListItemQualityIndex = 0,
|
|
52 |
ElistItemMemoStoreIndex,
|
|
53 |
};
|
|
54 |
|
|
55 |
// ========================= MEMBER FUNCTIONS ================================
|
|
56 |
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
// CVRGSPluginContainer::ConstructL
|
|
59 |
// Symbian OS default constructor
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
void CVRGSPluginContainer::ConstructL( const TRect& aRect )
|
|
63 |
{
|
|
64 |
// Construct iListBox
|
|
65 |
iListBox = new ( ELeave ) CAknSettingStyleListBox;
|
|
66 |
iSettingItemArray = new(ELeave) CAknSettingItemArray(2,0,0);
|
|
67 |
|
|
68 |
if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
|
|
69 |
{
|
|
70 |
iQuality = VRUtils::QualityL();
|
|
71 |
}
|
|
72 |
|
|
73 |
// Convert the internal memory enumeration to CFD enumeration
|
|
74 |
#ifndef RD_MULTIPLE_DRIVE
|
|
75 |
if ( VRUtils::MemoStoreL() == EMemoStorePhoneMemory )
|
|
76 |
{
|
|
77 |
iMemoStore = CAknMemorySelectionSettingPage::EPhoneMemory;
|
|
78 |
}
|
|
79 |
else
|
|
80 |
{
|
|
81 |
iMemoStore = CAknMemorySelectionSettingPage::EMemoryCard;
|
|
82 |
}
|
|
83 |
#else
|
|
84 |
iDrive = (TDriveNumber)VRUtils::MemoDriveL();
|
|
85 |
|
|
86 |
#endif
|
|
87 |
|
|
88 |
BaseConstructL( aRect, R_VOREC_GS_VIEW_TITLE, 0 );
|
|
89 |
}
|
|
90 |
|
|
91 |
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
// CVRGSPluginContainer::~CGSTelPluginContainer
|
|
94 |
// Destructor
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
CVRGSPluginContainer::~CVRGSPluginContainer()
|
|
98 |
{
|
|
99 |
if ( iSettingItemArray )
|
|
100 |
{
|
|
101 |
iSettingItemArray->ResetAndDestroy();
|
|
102 |
}
|
|
103 |
|
|
104 |
delete iSettingItemArray;
|
|
105 |
}
|
|
106 |
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
// CVRGSPluginContainer::CGSTelPluginContainer
|
|
109 |
// Default constructor
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
//
|
|
112 |
CVRGSPluginContainer::CVRGSPluginContainer()
|
|
113 |
: iQuality( EQualityMMSOptimized ),
|
|
114 |
iMemoStore( CAknMemorySelectionSettingPage::EPhoneMemory )
|
|
115 |
{
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
// CVRGSPluginContainer::UpdateListBoxL
|
|
120 |
// Update listbox item
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
void CVRGSPluginContainer::UpdateListBoxL( TInt /*aFeatureId*/ )
|
|
124 |
{
|
|
125 |
|
|
126 |
// Update the listbox
|
|
127 |
iListBox->HandleItemAdditionL();
|
|
128 |
}
|
|
129 |
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// CVRGSPluginContainer::ConstructListBoxL
|
|
133 |
// Update listbox item
|
|
134 |
// Items are added manually, instead of loading them from resources
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
void CVRGSPluginContainer::ConstructListBoxL( TInt /*aResLbxId*/ )
|
|
138 |
{
|
|
139 |
iListBox->ConstructL( this, EAknListBoxSelectionList );
|
|
140 |
|
|
141 |
// Create items to array
|
|
142 |
CreateListBoxItemsL();
|
|
143 |
|
|
144 |
// Set array to listbox
|
|
145 |
CTextListBoxModel* model = iListBox->Model();
|
|
146 |
model->SetItemTextArray( iSettingItemArray );
|
|
147 |
// Ownership retained by us
|
|
148 |
model->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
149 |
|
|
150 |
iSettingItemArray->RecalculateVisibleIndicesL();
|
|
151 |
iListBox->CreateScrollBarFrameL( ETrue );
|
|
152 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
153 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
|
|
154 |
iListBox->HandleItemAdditionL();
|
|
155 |
iListBox->UpdateScrollBarsL();
|
|
156 |
}
|
|
157 |
|
|
158 |
|
|
159 |
// ---------------------------------------------------------------------------
|
|
160 |
// CVRGSPluginContainer::CreateListBoxItemsL
|
|
161 |
// Update listbox item
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
void CVRGSPluginContainer::CreateListBoxItemsL()
|
|
165 |
{
|
|
166 |
CAknSettingItem* settingItem;
|
|
167 |
HBufC* itemTitle;
|
|
168 |
|
|
169 |
// Add quality setting
|
|
170 |
if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
|
|
171 |
{
|
|
172 |
|
|
173 |
// Add quality setting
|
|
174 |
#ifdef __AAC_ENCODER_PLUGIN
|
|
175 |
settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem ( 0, ( TInt& ) iQuality );
|
|
176 |
|
|
177 |
#else
|
|
178 |
settingItem = new( ELeave ) CAknBinaryPopupSettingItem ( 0, ( TInt& ) iQuality );
|
|
179 |
#endif
|
|
180 |
CleanupStack::PushL( settingItem );
|
|
181 |
|
|
182 |
itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_QUALITY );
|
|
183 |
settingItem->ConstructL( EFalse, EListItemQualityIndex, *itemTitle, NULL,
|
|
184 |
R_VR_SETTINGS_DEFAULT_SPEAKER_PAGE,
|
|
185 |
EAknCtPopupField, NULL,
|
|
186 |
R_VR_SETTINGS_QUALITY_TEXTS );
|
|
187 |
|
|
188 |
CleanupStack::PopAndDestroy(); // itemTitle
|
|
189 |
|
|
190 |
// Add quality item to the settings array
|
|
191 |
iSettingItemArray->AppendL( settingItem );
|
|
192 |
CleanupStack::Pop(); // settingItem
|
|
193 |
}
|
|
194 |
if ( VRUtils::MultipleMassStorageAvailable() )
|
|
195 |
{
|
|
196 |
// Add memo store setting
|
|
197 |
// Create the memo store item
|
|
198 |
#ifndef RD_MULTIPLE_DRIVE
|
|
199 |
settingItem =
|
|
200 |
new( ELeave ) CAknMemorySelectionSettingItem( 0, iMemoStore );
|
|
201 |
//multiple drives
|
|
202 |
#else
|
|
203 |
settingItem =
|
|
204 |
new( ELeave ) CAknMemorySelectionSettingItemMultiDrive(0, iDrive );
|
|
205 |
TInt includedMedias = AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage |
|
|
206 |
AknCommonDialogsDynMem::EMemoryTypeMMCExternal;
|
|
207 |
static_cast< CAknMemorySelectionSettingItemMultiDrive *> ( settingItem )->SetIncludedMediasL( includedMedias );
|
|
208 |
#endif
|
|
209 |
|
|
210 |
CleanupStack::PushL( settingItem );
|
|
211 |
|
|
212 |
itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_STORE );
|
|
213 |
|
|
214 |
#ifndef RD_MULTIPLE_DRIVE
|
|
215 |
// Set memo store item's title
|
|
216 |
settingItem->ConstructL( EFalse, id, *itemTitle, NULL,
|
|
217 |
R_VOREC_MEMORY_SELECTION_DIALOG, EAknCtPopupSettingList );
|
|
218 |
#else
|
|
219 |
settingItem->ConstructL( EFalse, ElistItemMemoStoreIndex, *itemTitle, NULL, 0, EAknCtPopupSettingList );
|
|
220 |
#endif
|
|
221 |
|
|
222 |
CleanupStack::PopAndDestroy(); // itemTitle
|
|
223 |
|
|
224 |
// Add memo store item to the settings array
|
|
225 |
iSettingItemArray->AppendL( settingItem );
|
|
226 |
CleanupStack::Pop(); // settingItem
|
|
227 |
}
|
|
228 |
}
|
|
229 |
|
|
230 |
|
|
231 |
// ---------------------------------------------------------------------------
|
|
232 |
// CVRGSPluginContainer::CurrentFeatureId
|
|
233 |
// Get the currently selected feature
|
|
234 |
// ---------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
TInt CVRGSPluginContainer::CurrentFeatureId() const
|
|
237 |
{
|
|
238 |
if ( iSettingItemArray )
|
|
239 |
{
|
|
240 |
return iSettingItemArray->MdcaCount();
|
|
241 |
}
|
|
242 |
else
|
|
243 |
{
|
|
244 |
return 0;
|
|
245 |
}
|
|
246 |
}
|
|
247 |
|
|
248 |
// ---------------------------------------------------------------------------
|
|
249 |
// CVRGSPluginContainer::GetHelpContext
|
|
250 |
// Get help for this view
|
|
251 |
// ---------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
void CVRGSPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const
|
|
254 |
{
|
|
255 |
aContext.iMajor = KVRAppUID;
|
|
256 |
aContext.iContext = KVOREC_HLP_SETTINGS;
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
// CVRGSPluginContainer::SizeChanged
|
|
261 |
// Set the size and position of component controls.
|
|
262 |
// ---------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
void CVRGSPluginContainer::SizeChanged()
|
|
265 |
{
|
|
266 |
if ( iListBox )
|
|
267 |
{
|
|
268 |
iListBox->SetRect( Rect() );
|
|
269 |
}
|
|
270 |
}
|
|
271 |
|
|
272 |
void CVRGSPluginContainer::HandleListBoxSelectionL( TInt aCommand )
|
|
273 |
{
|
|
274 |
TInt index( iListBox->CurrentItemIndex() );
|
|
275 |
TInt driveDefaultMassStorage = VRUtils::DefaultMemoDriveL();
|
|
276 |
TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL();
|
|
277 |
|
|
278 |
if ( index >=0 ) // index is -1 if there are no items in the list
|
|
279 |
{
|
|
280 |
if(index == ElistItemMemoStoreIndex &&
|
|
281 |
!VRUtils::DriveValid(driveDefaultMassStorage) &&
|
|
282 |
!VRUtils::DriveValid(driveRemovableMassStorage) )
|
|
283 |
{
|
|
284 |
return;
|
|
285 |
}
|
|
286 |
// Open edit dialog if EAknCmdOpen, invert the value otherwise
|
|
287 |
iSettingItemArray->At( index )->EditItemL( aCommand == EAknCmdOpen );
|
|
288 |
iListBox->DrawItem( index );
|
|
289 |
//Store all settings after change
|
|
290 |
StoreAllL();
|
|
291 |
}
|
|
292 |
}
|
|
293 |
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
// CVRGSPluginContainer::StoreAll
|
|
296 |
// Stores values in settings list to permanent storage
|
|
297 |
// ---------------------------------------------------------------------------
|
|
298 |
//
|
|
299 |
void CVRGSPluginContainer::StoreAllL()
|
|
300 |
{
|
|
301 |
// Retrieve values to member variables
|
|
302 |
TInt settingItemCount( iSettingItemArray->Count() );
|
|
303 |
|
|
304 |
for ( TInt i( 0 ); i < settingItemCount; i++ )
|
|
305 |
{
|
|
306 |
iSettingItemArray->At( i )->StoreL();
|
|
307 |
}
|
|
308 |
|
|
309 |
// Save memo store setting
|
|
310 |
#ifndef RD_MULTIPLE_DRIVE
|
|
311 |
if ( iMemoStore == CAknMemorySelectionSettingPage::EPhoneMemory )
|
|
312 |
{
|
|
313 |
VRUtils::SetMemoStoreL( EMemoStorePhoneMemory );
|
|
314 |
}
|
|
315 |
else
|
|
316 |
{
|
|
317 |
// check if MMC is read-only
|
|
318 |
TVRDriveInfo mmcInfo;
|
|
319 |
VRUtils::GetMMCInfo( mmcInfo );
|
|
320 |
|
|
321 |
if ( mmcInfo.iDriveReadOnly )
|
|
322 |
{
|
|
323 |
HBufC* noteText = iCoeEnv->AllocReadResourceLC(
|
|
324 |
R_QTN_MEMC_READONLY );
|
|
325 |
CAknInformationNote* infoNote =
|
|
326 |
new( ELeave ) CAknInformationNote( ETrue );
|
|
327 |
infoNote->ExecuteLD( *noteText );
|
|
328 |
CleanupStack::PopAndDestroy(); // noteText
|
|
329 |
VRUtils::SetMemoStoreL( EMemoStorePhoneMemory );
|
|
330 |
}
|
|
331 |
else
|
|
332 |
{
|
|
333 |
VRUtils::SetMemoStoreL( EMemoStoreMMC );
|
|
334 |
}
|
|
335 |
}
|
|
336 |
#else
|
|
337 |
TUint status( 0 );
|
|
338 |
TInt defaultDrive = VRUtils::DefaultMemoDriveL();
|
|
339 |
if (VRUtils::MemoDriveL() != defaultDrive)
|
|
340 |
{
|
|
341 |
VRUtils::GetDriveInfo(iDrive, status);
|
|
342 |
// check if drive status is ok
|
|
343 |
if ( status & DriveInfo::EDriveReadOnly )
|
|
344 |
{
|
|
345 |
HBufC* noteText = iCoeEnv->AllocReadResourceLC(R_QTN_MEMC_READONLY );
|
|
346 |
CAknInformationNote* infoNote = new( ELeave ) CAknInformationNote( ETrue );
|
|
347 |
infoNote->ExecuteLD( *noteText );
|
|
348 |
CleanupStack::PopAndDestroy(); // noteText
|
|
349 |
|
|
350 |
// use default device drive to save files
|
|
351 |
iDrive = (TDriveNumber)defaultDrive;
|
|
352 |
}
|
|
353 |
}
|
|
354 |
if(iDrive == defaultDrive || iDrive == VRUtils::GetRemovableMassStorageL())
|
|
355 |
{
|
|
356 |
VRUtils::SetMemoDriveL( iDrive );
|
|
357 |
}
|
|
358 |
#endif
|
|
359 |
|
|
360 |
// Save quality setting
|
|
361 |
if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) )
|
|
362 |
{
|
|
363 |
// Save the quality setting
|
|
364 |
VRUtils::SetQualityL( iQuality );
|
|
365 |
}
|
|
366 |
|
|
367 |
}
|
|
368 |
|
|
369 |
// End of File
|