|
57
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2002 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 the License "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: Setting item list class for Video settings list view.*
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
// Version : %version: 20 %
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
// INCLUDE FILES
|
|
|
24 |
#include <eikappui.h>
|
|
|
25 |
#include <MediaSettings.rsg>
|
|
|
26 |
#include <StringLoader.h>
|
|
|
27 |
#include <cmmanagerext.h>
|
|
|
28 |
#include <cmdestinationext.h>
|
|
|
29 |
#include <cmapplicationsettingsui.h>
|
|
|
30 |
|
|
|
31 |
#include "MediaPlayerVariant.hrh"
|
|
|
32 |
#include "MediaPlayerPrivateCRKeys.h"
|
|
|
33 |
#include "mediasettings.hrh"
|
|
|
34 |
#include "MPSettingsVideoSettingItemList.h"
|
|
|
35 |
#include "MPSettingsSliderSettingItem.h"
|
|
|
36 |
#include "MPSettingsModelForROP.h"
|
|
|
37 |
#include "MPSettingsAppUi.h"
|
|
|
38 |
#include "videoplayersettingsengine.h"
|
|
|
39 |
#include "videoplayercenrepkeys.h"
|
|
|
40 |
#include "mpxlog.h"
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
|
44 |
|
|
|
45 |
// -----------------------------------------------------------------------------
|
|
|
46 |
// CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList
|
|
|
47 |
// C++ default constructor can NOT contain any code, that
|
|
|
48 |
// might leave.
|
|
|
49 |
// -----------------------------------------------------------------------------
|
|
|
50 |
//
|
|
|
51 |
CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList(
|
|
|
52 |
CMPSettingsModelForROP* aModel,
|
|
|
53 |
CVcxNsSettingsEngine& aVideoSettingsEngine)
|
|
|
54 |
: iModel( aModel ),
|
|
|
55 |
iVideoSettingsEngine(aVideoSettingsEngine),
|
|
|
56 |
iRockerKeysSupported( EFalse )
|
|
|
57 |
{
|
|
|
58 |
CMPSettingsAppUi* AppUi =
|
|
|
59 |
static_cast<CMPSettingsAppUi*> (CCoeEnv::Static()->AppUi());
|
|
|
60 |
iLandscapeSupportedByDevice = AppUi->OrientationCanBeChanged();
|
|
|
61 |
|
|
|
62 |
TBool rockerSupported = EFalse;
|
|
|
63 |
TRAP_IGNORE( rockerSupported = iModel->IsRockerKeysSupportedL() );
|
|
|
64 |
if ( rockerSupported )
|
|
|
65 |
{
|
|
|
66 |
iRockerKeysSupported = ETrue;
|
|
|
67 |
}
|
|
|
68 |
MPX_DEBUG3(_L("#MS# CMPSettingsVideoSettingItemList::CMPSettingsVideoSettingItemList() iLandscapeSupportedByDevice(%d) iRockerKeysSupported(%d) "),iLandscapeSupportedByDevice,iRockerKeysSupported );
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
// -----------------------------------------------------------------------------
|
|
|
72 |
// CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList
|
|
|
73 |
// Destructor
|
|
|
74 |
// -----------------------------------------------------------------------------
|
|
|
75 |
//
|
|
|
76 |
CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()
|
|
|
77 |
{
|
|
|
78 |
MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::~CMPSettingsVideoSettingItemList()"));
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
// -----------------------------------------------------------------------------
|
|
|
82 |
// CMPSettingsVideoSettingItemList::EditItemL
|
|
|
83 |
// -----------------------------------------------------------------------------
|
|
|
84 |
//
|
|
|
85 |
void CMPSettingsVideoSettingItemList::EditItemL(TInt aIndex, TBool aCalledFromMenu)
|
|
|
86 |
{
|
|
|
87 |
MPX_DEBUG3(_L("#MS# CMPSettingsVideoSettingItemList::EditItemL(%d,%d)"),aIndex,aCalledFromMenu);
|
|
|
88 |
|
|
|
89 |
TInt itemIndex = aIndex;
|
|
|
90 |
TBool storeModifiedSetting( ETrue );
|
|
|
91 |
|
|
|
92 |
CAknSettingItem* settingItem = SettingItemArray()->At( itemIndex );
|
|
|
93 |
TInt identifier = settingItem->Identifier();
|
|
|
94 |
|
|
|
95 |
// Load current value from shared data
|
|
|
96 |
switch ( identifier )
|
|
|
97 |
{
|
|
|
98 |
case EMPSettVideoContrastSettingId:
|
|
|
99 |
{
|
|
|
100 |
CAknSettingItemList::EditItemL( itemIndex, aCalledFromMenu );
|
|
|
101 |
break;
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
default:
|
|
|
105 |
break;
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
if ( storeModifiedSetting )
|
|
|
109 |
{
|
|
|
110 |
// Store the modified setting
|
|
|
111 |
switch ( itemIndex )
|
|
|
112 |
{
|
|
|
113 |
case EVcSettingsViewParentControlIndex:
|
|
|
114 |
case EVcSettingsViewMemoryItemIndex:
|
|
|
115 |
case EVcSettingsViewThumbnailsIndex:
|
|
|
116 |
break;
|
|
|
117 |
|
|
|
118 |
default:
|
|
|
119 |
{
|
|
|
120 |
// Store setting value to settings model
|
|
|
121 |
settingItem->StoreL();
|
|
|
122 |
StoreSettingL( identifier );
|
|
|
123 |
}
|
|
|
124 |
break;
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
// --------------------------------------------------------------------------
|
|
|
130 |
// CMPSettingsVideoSettingItemList::HandleListBoxEventL()
|
|
|
131 |
// --------------------------------------------------------------------------
|
|
|
132 |
//
|
|
|
133 |
void CMPSettingsVideoSettingItemList::HandleListBoxEventL(
|
|
|
134 |
CEikListBox* aListBox,
|
|
|
135 |
TListBoxEvent aListBoxEvent )
|
|
|
136 |
{
|
|
|
137 |
if ( aListBoxEvent == EEventEnterKeyPressed ||
|
|
|
138 |
aListBoxEvent == EEventItemSingleClicked ||
|
|
|
139 |
aListBoxEvent == EEventItemDoubleClicked )
|
|
|
140 |
{
|
|
|
141 |
TInt itemIndex = SettingItemArray()->ItemIndexFromVisibleIndex(
|
|
|
142 |
aListBox->CurrentItemIndex() );
|
|
|
143 |
|
|
|
144 |
CAknSettingItemList::HandleListBoxEventL( aListBox, aListBoxEvent );
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
// --------------------------------------------------------------------------
|
|
|
149 |
// CMPSettingsVideoSettingItemList::EditCurrentItemL()
|
|
|
150 |
// --------------------------------------------------------------------------
|
|
|
151 |
//
|
|
|
152 |
void CMPSettingsVideoSettingItemList::EditCurrentItemL( TBool aCalledFromMenu )
|
|
|
153 |
{
|
|
|
154 |
TInt itemIndex = SettingItemArray()->ItemIndexFromVisibleIndex(
|
|
|
155 |
ListBox()->CurrentItemIndex() );
|
|
|
156 |
|
|
|
157 |
EditItemL( itemIndex, aCalledFromMenu );
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
// --------------------------------------------------------------------------
|
|
|
161 |
// CMPSettingsVideoSettingItemList::IsCurrentItem()
|
|
|
162 |
// --------------------------------------------------------------------------
|
|
|
163 |
//
|
|
|
164 |
TBool CMPSettingsVideoSettingItemList::IsCurrentItem( TInt aIndex )
|
|
|
165 |
{
|
|
|
166 |
TBool retValue( EFalse );
|
|
|
167 |
TInt currentIndex = SettingItemArray()->ItemIndexFromVisibleIndex(
|
|
|
168 |
ListBox()->CurrentItemIndex() );
|
|
|
169 |
|
|
|
170 |
CAknSettingItem* settingItem = SettingItemArray()->At( currentIndex );
|
|
|
171 |
TInt identifier = settingItem->Identifier();
|
|
|
172 |
if ( aIndex == identifier )
|
|
|
173 |
{
|
|
|
174 |
retValue = ETrue;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
return retValue;
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
// -----------------------------------------------------------------------------
|
|
|
181 |
// CMPSettingsVideoSettingItemList::LoadSettingsL
|
|
|
182 |
// -----------------------------------------------------------------------------
|
|
|
183 |
//
|
|
|
184 |
void CMPSettingsVideoSettingItemList::LoadSettingsL()
|
|
|
185 |
{
|
|
|
186 |
MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::LoadSettingsL()"));
|
|
|
187 |
// Get setting values from settings model
|
|
|
188 |
LoadAllL();
|
|
|
189 |
|
|
|
190 |
CAknSettingItemList::LoadSettingsL();
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
// -----------------------------------------------------------------------------
|
|
|
194 |
// CMPSettingsVideoSettingItemList::CreateSettingItemL
|
|
|
195 |
// -----------------------------------------------------------------------------
|
|
|
196 |
//
|
|
|
197 |
CAknSettingItem* CMPSettingsVideoSettingItemList::CreateSettingItemL(TInt aSettingId)
|
|
|
198 |
{
|
|
|
199 |
MPX_DEBUG2(_L("#MS# CMPSettingsVideoSettingItemList::CreateSettingItemL(%d)"),aSettingId);
|
|
|
200 |
CAknSettingItem* settingItem = NULL;
|
|
|
201 |
|
|
|
202 |
switch (aSettingId)
|
|
|
203 |
{
|
|
|
204 |
case EMPSettVideoContrastSettingId:
|
|
|
205 |
{
|
|
|
206 |
settingItem = new (ELeave) CMPSettingsSliderSettingItem(
|
|
|
207 |
aSettingId, iVideoContrast,
|
|
|
208 |
R_MPSETT_CONTRAST_SLIDER_LIST_VALUE, EFalse);
|
|
|
209 |
if ( ! VideoContrastIsSupportedL() )
|
|
|
210 |
{
|
|
|
211 |
settingItem->SetHidden( ETrue );
|
|
|
212 |
}
|
|
|
213 |
break;
|
|
|
214 |
}
|
|
|
215 |
default:
|
|
|
216 |
break;
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
return settingItem;
|
|
|
220 |
}
|
|
|
221 |
|
|
|
222 |
// -----------------------------------------------------------------------------
|
|
|
223 |
// CMPSettingsVideoSettingItemList::LoadSettingL
|
|
|
224 |
// -----------------------------------------------------------------------------
|
|
|
225 |
//
|
|
|
226 |
void CMPSettingsVideoSettingItemList::LoadSettingL(TInt aSettingId)
|
|
|
227 |
{
|
|
|
228 |
MPX_DEBUG2(_L("#MS# CMPSettingsVideoSettingItemList::LoadSettingL(%d)"),aSettingId);
|
|
|
229 |
switch (aSettingId)
|
|
|
230 |
{
|
|
|
231 |
case EMPSettVideoContrastSettingId:
|
|
|
232 |
iModel->GetVideoContrast(iVideoContrast);
|
|
|
233 |
break;
|
|
|
234 |
|
|
|
235 |
default:
|
|
|
236 |
break;
|
|
|
237 |
}
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
// -----------------------------------------------------------------------------
|
|
|
241 |
// CMPSettingsVideoSettingItemList::StoreSettingL
|
|
|
242 |
// -----------------------------------------------------------------------------
|
|
|
243 |
//
|
|
|
244 |
void CMPSettingsVideoSettingItemList::StoreSettingL(TInt aSettingId)
|
|
|
245 |
{
|
|
|
246 |
MPX_DEBUG2(_L("#MS# CMPSettingsVideoSettingItemList::StoreSettingL(%d)"),aSettingId);
|
|
|
247 |
switch (aSettingId)
|
|
|
248 |
{
|
|
|
249 |
case EMPSettVideoContrastSettingId:
|
|
|
250 |
iModel->SetVideoContrast(iVideoContrast);
|
|
|
251 |
break;
|
|
|
252 |
|
|
|
253 |
default:
|
|
|
254 |
break;
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
iModel->StoreSettingsL();
|
|
|
258 |
}
|
|
|
259 |
|
|
|
260 |
// -----------------------------------------------------------------------------
|
|
|
261 |
// CMPSettingsVideoSettingItemList::LoadAllL
|
|
|
262 |
// -----------------------------------------------------------------------------
|
|
|
263 |
//
|
|
|
264 |
void CMPSettingsVideoSettingItemList::LoadAllL()
|
|
|
265 |
{
|
|
|
266 |
MPX_DEBUG1(_L("#MS# CMPSettingsVideoSettingItemList::LoadAllL()"));
|
|
|
267 |
iModel->LoadSettingsL(EConfigUser);
|
|
|
268 |
LoadSettingL(EMPSettVideoContrastSettingId);
|
|
|
269 |
}
|
|
|
270 |
|
|
|
271 |
// --------------------------------------------------------------------------
|
|
|
272 |
// Check if video contrast is supported.
|
|
|
273 |
// --------------------------------------------------------------------------
|
|
|
274 |
//
|
|
|
275 |
TBool CMPSettingsVideoSettingItemList::VideoContrastIsSupportedL()
|
|
|
276 |
{
|
|
|
277 |
// As video contrast is only item in video settings list,
|
|
|
278 |
// we can assume here that contrast is supported, because
|
|
|
279 |
// it has been already checked in AppUi/GsPlugin level.
|
|
|
280 |
return ETrue;
|
|
|
281 |
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
// End of File
|