|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Implementation of CGSAccTvoutContainer class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32cmn.h> // For accessoriescrkeys.h |
|
20 #include <accessoriescrkeys.h> |
|
21 #include <gsaccessoryplugin.rsg> |
|
22 #include <gsfwviewuids.h> // for KUidGS |
|
23 #include <gslistbox.h> |
|
24 #include <GSServerEngine.h> |
|
25 #include <csxhelp/cp.hlp.hrh> |
|
26 |
|
27 #include "gsaccessoryplugin.hrh" |
|
28 #include "gsaccessorypluginmodel.h" |
|
29 #include "gsaccprofilelist.h" |
|
30 #include "gsacctvoutcontainer.h" |
|
31 #include "trace.h" |
|
32 |
|
33 // ========================= MEMBER FUNCTIONS ================================ |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CGSAccTvoutContainer::CGSAccTvoutContainer() |
|
37 // |
|
38 // Default constructor |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CGSAccTvoutContainer::CGSAccTvoutContainer( |
|
42 CGSAccessoryPluginModel& aModel, |
|
43 CGSServerEngine& aServerEngine ) |
|
44 : CGSAccBaseContainer( aModel ), |
|
45 iServerEngine ( aServerEngine ) |
|
46 { |
|
47 FUNC_LOG; |
|
48 } |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CGSAccTvoutContainer::~CGSAccTvoutContainer() |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CGSAccTvoutContainer::~CGSAccTvoutContainer() |
|
56 { |
|
57 FUNC_LOG; |
|
58 |
|
59 delete iTvSystemItems; |
|
60 delete iAspectItems; |
|
61 delete iFlickerItems; |
|
62 } |
|
63 |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CGSAccTvoutContainer::UpdateListBoxL( TInt aFeatureId ) |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 void CGSAccTvoutContainer::UpdateListBoxL( TInt aFeatureId ) |
|
70 { |
|
71 FUNC_LOG; |
|
72 |
|
73 switch ( aFeatureId ) |
|
74 { |
|
75 case EGSSettIdTvAspectRatio: |
|
76 RefreshAspectRatioL(); |
|
77 break; |
|
78 case EGSSettIdTvSystem: |
|
79 RefreshTvSystemL(); |
|
80 break; |
|
81 case EGSSettIdTvoutDP: |
|
82 RefreshDefaultProfileL(); |
|
83 break; |
|
84 case EGSSettIdTvFlickerFilter: |
|
85 RefreshFlickerFilterL(); |
|
86 break; |
|
87 default: |
|
88 break; |
|
89 } |
|
90 |
|
91 iListBox->HandleItemAdditionL(); |
|
92 } |
|
93 |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CGSAccTvoutContainer::ConstructL() |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CGSAccTvoutContainer::ConstructL( const TRect& aRect ) |
|
100 { |
|
101 FUNC_LOG; |
|
102 |
|
103 CreateListBoxL(); |
|
104 BaseConstructL( aRect, R_ACC_TVOUT_TITLE, R_ACC_TVOUT_LBX ); // Needs the listbox |
|
105 } |
|
106 |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // CGSAccTvoutContainer::ConstructListBoxL() |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void CGSAccTvoutContainer::ConstructListBoxL( TInt aResLbxId ) |
|
113 { |
|
114 FUNC_LOG; |
|
115 |
|
116 CGSAccBaseContainer::ConstructListBoxL( aResLbxId ); |
|
117 |
|
118 RefreshDefaultProfileL(); |
|
119 MakeItemVisibleL( EGSSettIdTvoutDP ); |
|
120 |
|
121 iAspectItems = |
|
122 iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_ASPECT_RATIO_SETTING_PAGE_LBX ); |
|
123 iFlickerItems = |
|
124 iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_FLICKER_FILTER_SETTING_PAGE_LBX ); |
|
125 iTvSystemItems = |
|
126 iCoeEnv->ReadDesC16ArrayResourceL( |
|
127 iModel.PalmSupport() ? |
|
128 R_ACC_TV_SYSTEM_SETTING_PAGE_LBX : |
|
129 R_ACC_TV_SYSTEM_SETTING_PAGE_NO_PALM_LBX ); |
|
130 |
|
131 RefreshAspectRatioL(); |
|
132 MakeItemVisibleL( EGSSettIdTvAspectRatio ); |
|
133 |
|
134 RefreshTvSystemL(); |
|
135 MakeItemVisibleL( EGSSettIdTvSystem ); |
|
136 |
|
137 RefreshFlickerFilterL(); |
|
138 MakeItemVisibleL( EGSSettIdTvFlickerFilter ); |
|
139 } |
|
140 |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // CGSAccTvoutContainer::GetHelpContext() const |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 void CGSAccTvoutContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
147 { |
|
148 FUNC_LOG; |
|
149 |
|
150 aContext.iMajor = KUidGS; |
|
151 aContext.iContext = KSET_HLP_ACCESSORIES_TVOUT; |
|
152 } |
|
153 |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CGSAccTvoutContainer::RefreshDefaultProfileL() |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 void CGSAccTvoutContainer::RefreshDefaultProfileL() |
|
160 { |
|
161 FUNC_LOG; |
|
162 |
|
163 TInt profile = |
|
164 iModel.DefaultProfileByKey( KSettingsTvOutDefaultProfile ); |
|
165 // Set default profile item text. |
|
166 SetItemTextL( |
|
167 EGSSettIdTvoutDP, |
|
168 iModel.ProfileList().NameByIdL( profile, iCoeEnv ) ); |
|
169 } |
|
170 |
|
171 |
|
172 // --------------------------------------------------------------------------- |
|
173 // CGSAccTvoutContainer::RefreshAspectRatioL() |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 void CGSAccTvoutContainer::RefreshAspectRatioL() |
|
177 { |
|
178 FUNC_LOG; |
|
179 |
|
180 TInt value = iServerEngine.AspectRatioL(); |
|
181 if ( iAspectItems && value >= 0 && value < iAspectItems->Count() ) |
|
182 { |
|
183 SetItemTextL( EGSSettIdTvAspectRatio, ( *iAspectItems )[ value ] ); |
|
184 } |
|
185 } |
|
186 |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 // CGSAccTvoutContainer::RefreshTvSystemL() |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 void CGSAccTvoutContainer::RefreshTvSystemL() |
|
193 { |
|
194 FUNC_LOG; |
|
195 |
|
196 TInt value = iServerEngine.TvSystemL(); |
|
197 |
|
198 // If PALM is not supported, index correction |
|
199 if ( !iModel.PalmSupport() && value ) |
|
200 { |
|
201 value--; |
|
202 } |
|
203 |
|
204 if ( iTvSystemItems && value >= 0 && value < iTvSystemItems->Count() ) |
|
205 { |
|
206 SetItemTextL( EGSSettIdTvSystem, ( *iTvSystemItems )[ value ] ); |
|
207 } |
|
208 } |
|
209 |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // CGSAccTvoutContainer::RefreshFlickerFilterL() |
|
213 // --------------------------------------------------------------------------- |
|
214 |
|
215 void CGSAccTvoutContainer::RefreshFlickerFilterL() |
|
216 { |
|
217 FUNC_LOG; |
|
218 |
|
219 TInt value = iServerEngine.FlickerFilterL(); |
|
220 if ( iFlickerItems && value >= 0 && value < iFlickerItems->Count() ) |
|
221 { |
|
222 SetItemTextL( EGSSettIdTvFlickerFilter, ( *iFlickerItems )[ value ] ); |
|
223 } |
|
224 } |