1 /* |
|
2 * Copyright (c) 2004 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: CIRStationInfoView class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /* --------------------------------------------------------------------------- |
|
20 * Version history: |
|
21 * Template version: |
|
22 * <ccm_history> |
|
23 * |
|
24 * Version: 3, Thu Jul 3 16:30:00 2008 by Rohit |
|
25 * Ref: |
|
26 * Codescanner fixes |
|
27 * |
|
28 * Version: 2, Fri May 16 16:00:00 2008 by Rohit |
|
29 * Ref: |
|
30 * Fixed the Back button issue to go back to previous view |
|
31 * |
|
32 * Version: 1, Thu May 15 14:00:00 2008 by Rohit |
|
33 * Ref: |
|
34 * Created |
|
35 * |
|
36 * </ccm_history> |
|
37 * ============================================================================ |
|
38 */ |
|
39 |
|
40 |
|
41 #include <akniconarray.h> |
|
42 #include <akntitle.h> |
|
43 #include <eikmenup.h> |
|
44 #include <gulicon.h> |
|
45 #include <stringloader.h> |
|
46 #include <psserv.h> |
|
47 |
|
48 #include <internetradio.rsg> |
|
49 #include "irui.h" |
|
50 #include "ir.hrh" |
|
51 #include "ircommon.h" |
|
52 #include "irdebug.h" |
|
53 #include "irbaseview.h" |
|
54 #include "irstationinfoview.h" |
|
55 #include "irstationinfocontainer.h" |
|
56 #include "irapplication.h" |
|
57 #include "irsettings.h" |
|
58 #include "irviewstack.h" |
|
59 #include "irisdspreset.h" |
|
60 #include "irpreset.h" |
|
61 #include "irisdswrapper.h" |
|
62 #include "irdataprovider.h" |
|
63 #include "irhttpdataprovider.h" |
|
64 #include "irlogodownloadengine.h" |
|
65 |
|
66 const TInt KLogoXValue = 200; |
|
67 const TInt KLogoYValue = 200; |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // CIRStationInfoView::CIRStationInfoView() |
|
71 // C++ default constructor can NOT contain any code, that might leave. |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CIRStationInfoView::CIRStationInfoView():iContainer(NULL) |
|
75 { |
|
76 IRLOG_DEBUG( "CIRStationInfoView::CIRStationInfoView " ); |
|
77 // Nothing here |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CIRStationInfoView::ConstructL |
|
82 // EPOC default constructor can leave. |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CIRStationInfoView::ConstructL(const TRect & /*aRect*/) |
|
86 { |
|
87 IRLOG_DEBUG( "CIRStationInfoView::ConstructL - Entering " ); |
|
88 CIRBaseView::ConstructL(R_IR_STATIONINFO); |
|
89 iStationPreset = CIRIsdsPreset::NewL(); |
|
90 IRLOG_DEBUG( "CIRStationInfoView::ConstructL - Exiting " ); |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CIRStationInfoView::NewL |
|
95 // Two-phased constructor. |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 CIRStationInfoView* CIRStationInfoView::NewL(const TRect& aRect) |
|
99 { |
|
100 IRLOG_DEBUG("CIRStationInfoView::NewL - Entering" ); |
|
101 CIRStationInfoView* self = CIRStationInfoView::NewLC(aRect); |
|
102 CleanupStack::Pop(self); |
|
103 IRLOG_DEBUG( "CIRStationInfoView::NewL - Exiting." ); |
|
104 return self; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CIRStationInfoView::NewLC |
|
109 // Two-phased constructor. |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 |
|
113 CIRStationInfoView* CIRStationInfoView::NewLC(const TRect & aRect) |
|
114 { |
|
115 |
|
116 IRLOG_DEBUG( "CIRStationInfoView::NewLC - Entering" ); |
|
117 CIRStationInfoView* self = new (ELeave) CIRStationInfoView; |
|
118 CleanupStack::PushL(self); |
|
119 self->ConstructL(aRect); |
|
120 IRLOG_DEBUG( "CIRStationInfoView::NewLC - Exiting." ); |
|
121 return self; |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // CIRStationInfoView::~CIRStationInfoView() |
|
126 // Destructor |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 CIRStationInfoView::~CIRStationInfoView() |
|
130 { |
|
131 IRLOG_DEBUG( "CIRStationInfoView::~CIRStationInfoView - Entering " ); |
|
132 if ( iContainer ) |
|
133 { |
|
134 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
135 delete iContainer; |
|
136 iContainer=NULL; |
|
137 } |
|
138 if(iStationPreset) |
|
139 { |
|
140 delete iStationPreset; |
|
141 iStationPreset = NULL; |
|
142 } |
|
143 IRLOG_DEBUG( "CIRStationInfoView::~CIRStationInfoView - Exiting." ); |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CIRStationInfoView::Id |
|
148 // Base class CAknView function |
|
149 // Returns view id |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 TUid CIRStationInfoView::Id() const |
|
153 { |
|
154 IRLOG_DEBUG( "CIRStationInfoView::Id " ); |
|
155 return KIRStationInfoViewId; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CIRStationInfoView::DoActivateL |
|
160 // Base class CAknView function |
|
161 // Handles view activation |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 void CIRStationInfoView::DoActivateL( const TVwsViewId& aPrevViewId, |
|
165 TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
|
166 { |
|
167 IRLOG_DEBUG( "CIRStationInfoView::DoActivateL - Entering " ); |
|
168 |
|
169 //Create the instance of the container |
|
170 iContainer = CIRStationInfoContainer::NewL(ClientRect(), this); |
|
171 iContainer->SetMopParent(this); |
|
172 AppUi()->AddToViewStackL( *this, iContainer ); |
|
173 SetTitleL( R_IRAPP_STATIONINFO_TITLE ); |
|
174 CIRBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
175 HandleStatusPaneSizeChange(); |
|
176 |
|
177 // Download logo for Isds channel |
|
178 if( iStationPreset->GetChannelType() == CIRIsdsPreset::EIsdsPreset |
|
179 && iStationPreset->GetImgUrl().Length() ) |
|
180 { |
|
181 // Issue logo download request |
|
182 iUi->iIsdsWrapper->GetISDSInstance()->GetDataProvider()->GetHttpDataProvider()-> |
|
183 GetLogoDownloadEngine()->SendRequestL(iStationPreset, this,0,KLogoXValue,KLogoYValue); |
|
184 } |
|
185 |
|
186 // Populate container without logo |
|
187 if(iContainer) |
|
188 { |
|
189 iContainer->ReloadStationInformationL(); |
|
190 } |
|
191 |
|
192 IRLOG_DEBUG( "CIRStationInfoView::DoActivateL - Exiting " ); |
|
193 } |
|
194 |
|
195 // --------------------------------------------------------------------------- |
|
196 // CIRStationInfoView::DoDeactivate |
|
197 // Base class CAknView function |
|
198 // Handles view deactivation |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 void CIRStationInfoView::DoDeactivate() |
|
202 { |
|
203 IRLOG_DEBUG( "CIRStationInfoView::DoDeactivate - Entering " ); |
|
204 CIRBaseView::DoDeactivate(); |
|
205 |
|
206 CIRUi* appUi = static_cast<CIRUi*>( AppUi() ); |
|
207 |
|
208 if ( iContainer ) |
|
209 { |
|
210 appUi->RemoveFromViewStack( *this, iContainer ); |
|
211 iContainer->MakeVisible( EFalse ); |
|
212 delete iContainer; |
|
213 iContainer = NULL; |
|
214 } |
|
215 IRLOG_DEBUG( "CIRStationInfoView::DoDeactivate - Exiting " ); |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // CIRStationInfoView::HandleCommandL |
|
220 // Base class CAknView function |
|
221 // Command handling function |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 void CIRStationInfoView::HandleCommandL( TInt aCommand ) |
|
225 { |
|
226 IRLOG_DEBUG( "CIRStationInfoView::HandleCommandL - Entering " ); |
|
227 switch(aCommand) |
|
228 { |
|
229 case EAknSoftkeyClose: |
|
230 case EIRBack: |
|
231 CIRBaseView::HandleCommandL( EIRBack ); |
|
232 break; |
|
233 |
|
234 default: |
|
235 AppUi()->HandleCommandL(aCommand); |
|
236 break; |
|
237 } |
|
238 IRLOG_DEBUG( "CIRStationInfoView::HandleCommandL - Exiting " ); |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // CIRStationInfoView::HandleStatusPaneSizeChange |
|
243 // Base class CAknView function |
|
244 // Event handler for status pane size changes |
|
245 // --------------------------------------------------------------------------- |
|
246 // |
|
247 void CIRStationInfoView::HandleStatusPaneSizeChange() |
|
248 { |
|
249 IRLOG_DEBUG( "CIRStationInfoView::HandleStatusPaneSizeChange - Entering " ); |
|
250 CIRBaseView::HandleStatusPaneSizeChange(); |
|
251 // the client rect is also set here after screen orientation change |
|
252 if ( iContainer ) |
|
253 { |
|
254 iContainer->SetRect( ClientRect() ); |
|
255 } |
|
256 IRLOG_DEBUG( "CIRStationInfoView::HandleStatusPaneSizeChange - Exiting " ); |
|
257 } |
|
258 |
|
259 |
|
260 // --------------------------------------------------------------------------- |
|
261 // CIRStationInfoView::PresetLogoDownloadedL |
|
262 // From MLogoDownloadObserver |
|
263 // Invoked after requested logo is downloaded |
|
264 // --------------------------------------------------------------------------- |
|
265 // |
|
266 void CIRStationInfoView::PresetLogoDownloadedL(CIRIsdsPreset* aPreset) |
|
267 { |
|
268 IRLOG_DEBUG( "CIRStationInfoView::PresetLogoDownloadedL - Entering" ); |
|
269 |
|
270 if( !aPreset ) |
|
271 { |
|
272 IRLOG_DEBUG( "CIRStationInfoView::PresetLogoDownloadedL - NULL Preset is passed" ); |
|
273 User::LeaveIfNull( aPreset ); |
|
274 } |
|
275 |
|
276 *iStationPreset = *aPreset; |
|
277 |
|
278 if(iContainer) |
|
279 iContainer->StartConvertStationLogoL(); |
|
280 |
|
281 IRLOG_DEBUG( "CIRStationInfoView::PresetLogoDownloadedL - Exiting" ); |
|
282 } |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CIRStationInfoView::PresetLogoDownloadError |
|
286 // From MLogoDownloadObserver |
|
287 // Invoked if an error has occured while logo is downloading or no logo data available |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 void CIRStationInfoView::PresetLogoDownloadError(CIRIsdsPreset* /*aPreset*/ ) |
|
291 { |
|
292 IRLOG_DEBUG( "CIRStationInfoView::PresetLogoDownloadError" ); |
|
293 } |
|
294 |
|
295 // ----------------------------------------------------------------------------- |
|
296 // CIRStationInfoView::SetStationPresetL |
|
297 // Copies the given preset to member iStationPreset for display |
|
298 // ----------------------------------------------------------------------------- |
|
299 // |
|
300 void CIRStationInfoView::SetStationPresetL( CIRIsdsPreset* aPreset ) |
|
301 { |
|
302 IRLOG_DEBUG( "CIRStationInfoView::SetStationPresetL - Entering " ); |
|
303 if( !aPreset ) |
|
304 { |
|
305 IRLOG_DEBUG( "CIRStationInfoView::PresetLogoDownloadedL - NULL Preset is passed" ); |
|
306 User::LeaveIfNull( aPreset ); |
|
307 } |
|
308 *iStationPreset = *aPreset; |
|
309 IRLOG_DEBUG( "CIRStationInfoView::SetStationPresetL - Exiting " ); |
|
310 } |
|
311 |
|
312 // ----------------------------------------------------------------------------- |
|
313 // CIRStationInfoView::SetStationPresetL |
|
314 // Copies the given preset to member iStationPreset for display |
|
315 // ----------------------------------------------------------------------------- |
|
316 // |
|
317 void CIRStationInfoView::SetStationPresetL( CIRPreset* aPreset ) |
|
318 { |
|
319 IRLOG_DEBUG( "CIRStationInfoView::SetStationPresetL - Entering " ); |
|
320 if( !aPreset ) |
|
321 { |
|
322 IRLOG_DEBUG( "CIRStationInfoView::PresetLogoDownloadedL - NULL Preset is passed" ); |
|
323 User::LeaveIfNull( aPreset ); |
|
324 } |
|
325 aPreset->CopyPresetData( *iStationPreset ); |
|
326 IRLOG_DEBUG( "CIRStationInfoView::SetStationPresetL - Exiting " ); |
|
327 } |
|
328 |
|
329 // ----------------------------------------------------------------------------- |
|
330 // CIRStationInfoView::GetStationPresetL |
|
331 // |
|
332 // ----------------------------------------------------------------------------- |
|
333 // |
|
334 CIRIsdsPreset* CIRStationInfoView::GetStationPresetL( ) |
|
335 { |
|
336 return iStationPreset; |
|
337 } |
|
338 |
|