20
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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 the class CFMRadioMainView
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <featmgr.h>
|
|
20 |
#include <aknViewAppUi.h>
|
|
21 |
#include <akntitle.h>
|
|
22 |
#include <avkon.hrh>
|
|
23 |
#include <avkon.rsg>
|
|
24 |
#include <avkon.mbg>
|
|
25 |
#include <data_caging_path_literals.hrh>
|
|
26 |
#include <akntoolbar.h>
|
|
27 |
#include <fmradio.rsg>
|
|
28 |
#include <StringLoader.h>
|
|
29 |
#include <aknbutton.h>
|
|
30 |
#include <aknconsts.h>
|
|
31 |
#include <aknmessagequerydialog.h>
|
|
32 |
#include <fmradio.mbg>
|
|
33 |
#include <fmradiouids.h>
|
|
34 |
#include <akntoolbarextension.h>
|
|
35 |
|
|
36 |
#include "fmradiomusicstorehandler.h"
|
|
37 |
#include "fmradiobacksteppingservicewrapper.h"
|
|
38 |
#include "fmradiodocument.h"
|
|
39 |
#include "fmradiordsreceiverbase.h"
|
|
40 |
#include "fmradioalfvisualizer.h"
|
|
41 |
#include "fmradioengine.h"
|
|
42 |
#include "fmradiomainview.h"
|
|
43 |
#include "fmradiomaincontainer.h"
|
|
44 |
#include "fmradioappui.h"
|
|
45 |
#include "fmradio.hrh"
|
|
46 |
#include "fmradioengineradiosettings.h"
|
|
47 |
#include "fmradioalfmediaidle.h"
|
|
48 |
#include "fmradiopubsub.h"
|
|
49 |
#include "fmradioalfrdsviewer.h"
|
|
50 |
#include "fmradioidlecontroller.h"
|
|
51 |
#include "fmradiologo.h"
|
|
52 |
#include "debug.h"
|
|
53 |
|
|
54 |
// A debug flag which is used for differentiating between original version and updated
|
|
55 |
// version, when set will add identifier on Main View title. Used for testing purposes
|
|
56 |
#undef __FM_UPDATE_PACKAGE__
|
|
57 |
|
|
58 |
// CONSTANTS
|
|
59 |
|
|
60 |
#ifdef __FM_UPDATE_PACKAGE__
|
|
61 |
_LIT( KFMRadioUpdated, " *" );
|
|
62 |
#endif
|
|
63 |
|
|
64 |
// Delay in milliseconds for fading out the RDS indicator
|
|
65 |
const TInt KFMRadioRdsSignalFadeOutDelay = 1000;
|
|
66 |
|
|
67 |
// ================= MEMBER FUNCTIONS =======================
|
|
68 |
|
|
69 |
// ---------------------------------------------------------
|
|
70 |
// CFMRadioMainView::NewL
|
|
71 |
// Two-phase constructor of CFMRadioMainView
|
|
72 |
// ---------------------------------------------------------
|
|
73 |
//
|
|
74 |
CFMRadioMainView* CFMRadioMainView::NewL(
|
|
75 |
CRadioEngine* aRadioEngine, CAlfEnv& aAlfEnv, MChannelListHandler& aObserver )
|
|
76 |
{
|
|
77 |
CFMRadioMainView* self = new (ELeave) CFMRadioMainView( aRadioEngine, aAlfEnv, aObserver );
|
|
78 |
CleanupStack::PushL( self );
|
|
79 |
self->ConstructL();
|
|
80 |
CleanupStack::Pop( self );
|
|
81 |
return self;
|
|
82 |
}
|
|
83 |
|
|
84 |
// ---------------------------------------------------------
|
|
85 |
// CFMRadioMainView::ConstructL
|
|
86 |
// EPOC two-phased constructor
|
|
87 |
// ---------------------------------------------------------
|
|
88 |
//
|
|
89 |
void CFMRadioMainView::ConstructL()
|
|
90 |
{
|
|
91 |
BaseConstructL( R_FMRADIO_MAIN_VIEW );
|
|
92 |
PrepareToolbar();
|
|
93 |
|
|
94 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
95 |
{
|
|
96 |
ShowToolbar( EFalse );
|
|
97 |
}
|
|
98 |
|
|
99 |
iRdsSignalTimer = CPeriodic::NewL(CActive::EPriorityStandard);
|
|
100 |
iMusicStoreHandler = CFMRadioMusicStoreHandler::NewL( R_FMRADIO_MAIN_OPTIONS_MENU );
|
|
101 |
iMusicStoreHandler->EnableMusicStore( ETrue );
|
|
102 |
|
|
103 |
CAknToolbarExtension* toolbarExt = iToolbar->ToolbarExtension();
|
|
104 |
CAknButton* operatorStoreButton = NULL;
|
|
105 |
operatorStoreButton = static_cast<CAknButton*>( toolbarExt->ControlOrNull( EFMRadioToolbarButtonCmdOperatorMusicStore ) );
|
|
106 |
const TDesC& storeName = iMusicStoreHandler->OperatorMusicStoreName();
|
|
107 |
|
|
108 |
if ( operatorStoreButton )
|
|
109 |
{
|
|
110 |
// set text for button tooltip
|
|
111 |
operatorStoreButton->State()->SetHelpTextL( storeName );
|
|
112 |
}
|
|
113 |
}
|
|
114 |
|
|
115 |
// ---------------------------------------------------------
|
|
116 |
// CFMRadioMainView::CFMRadioMainView
|
|
117 |
// default constructor
|
|
118 |
// ---------------------------------------------------------
|
|
119 |
//
|
|
120 |
CFMRadioMainView::CFMRadioMainView(
|
|
121 |
CRadioEngine* aRadioEngine,
|
|
122 |
CAlfEnv& /*aAlfEnv*/,
|
|
123 |
MChannelListHandler& aObserver)
|
|
124 |
: iRadioEngine( aRadioEngine ),
|
|
125 |
iSeeking( EFalse ),
|
|
126 |
iChangeDirection( EFMRadioStationChangeNone ),
|
|
127 |
iStartUp( ETrue ),
|
|
128 |
iObserver( aObserver )
|
|
129 |
{
|
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------
|
|
133 |
// CFMRadioMainView::~CFMRadioMainView
|
|
134 |
// Class destructor
|
|
135 |
// ---------------------------------------------------------
|
|
136 |
//
|
|
137 |
CFMRadioMainView::~CFMRadioMainView()
|
|
138 |
{
|
|
139 |
if( iRdsSignalTimer && iRdsSignalTimer->IsActive() )
|
|
140 |
{
|
|
141 |
iRdsSignalTimer->Cancel();
|
|
142 |
}
|
|
143 |
if ( iRdsSignalTimer )
|
|
144 |
{
|
|
145 |
delete iRdsSignalTimer;
|
|
146 |
iRdsSignalTimer = NULL;
|
|
147 |
}
|
|
148 |
|
|
149 |
CAlfEnv* alfEnv = CAlfEnv::Static();
|
|
150 |
if ( alfEnv && iContainer )
|
|
151 |
{
|
|
152 |
iContainer->RdsViewer().RemoveObserver( this );
|
|
153 |
iContainer->Logo().RemoveObserver( this );
|
|
154 |
}
|
|
155 |
|
|
156 |
delete iContainer;
|
|
157 |
iContainer = NULL;
|
|
158 |
|
|
159 |
delete iMusicStoreHandler;
|
|
160 |
}
|
|
161 |
|
|
162 |
// ---------------------------------------------------------
|
|
163 |
// TUid CFMRadioMainView::Id
|
|
164 |
// Return the unique identifier corresponding to this view
|
|
165 |
// ---------------------------------------------------------
|
|
166 |
//
|
|
167 |
TUid CFMRadioMainView::Id() const
|
|
168 |
{
|
|
169 |
return KFMRadioMainViewId;
|
|
170 |
}
|
|
171 |
|
|
172 |
// ---------------------------------------------------------
|
|
173 |
// CFMRadioMainView::StopSeekL
|
|
174 |
// Seek operation has completed. Update the view to reflect
|
|
175 |
// this fact.
|
|
176 |
// ---------------------------------------------------------
|
|
177 |
//
|
|
178 |
void CFMRadioMainView::StopSeekL()
|
|
179 |
{
|
|
180 |
FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL Start") ) );
|
|
181 |
if ( iContainer && iSeeking)
|
|
182 |
{
|
|
183 |
FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL inside first if") ) );
|
|
184 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
185 |
{
|
|
186 |
Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); // Change softkeys
|
|
187 |
Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 0, KNullDesC );
|
|
188 |
}
|
|
189 |
else
|
|
190 |
{
|
|
191 |
Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT ); // Change softkeys
|
|
192 |
}
|
|
193 |
|
|
194 |
SetToolbarDimmedState( EFalse );
|
|
195 |
iContainer->VisualControl()->StopTuningAnimation();
|
|
196 |
iSeeking = EFalse;
|
|
197 |
Cba()->DrawDeferred(); // Redraw softkeys
|
|
198 |
}
|
|
199 |
|
|
200 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
|
|
201 |
|
|
202 |
TInt presetIndex = iRadioEngine->GetPresetIndex();
|
|
203 |
TInt channelCount = iObserver.Channels().Count();
|
|
204 |
|
|
205 |
if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
|
|
206 |
channelCount > 0 &&
|
|
207 |
presetIndex < channelCount )
|
|
208 |
{
|
|
209 |
DisplayChannelL( presetIndex );
|
|
210 |
FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL ERadioPresetMode preset index = %d"),iRadioEngine->GetPresetIndex() ) );
|
|
211 |
}
|
|
212 |
else
|
|
213 |
{
|
|
214 |
FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL inside else") ) );
|
|
215 |
TInt channelIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() ); //, need to get here!
|
|
216 |
if ( channelIndex != KErrNotFound )
|
|
217 |
{
|
|
218 |
FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL if channelIndex is found, channelIndex = %d"),channelIndex ) );
|
|
219 |
iRadioEngine->TunePresetL( channelIndex ); //update engine to let it know that we've locked onto a preset.
|
|
220 |
}
|
|
221 |
else
|
|
222 |
{
|
|
223 |
FTRACE( FPrint( _L("CFMRadioMainView::StopSeekL else, get tuned freq = %d"),iRadioEngine->GetTunedFrequency() ) );
|
|
224 |
DisplayChannelL( KErrNotFound );
|
|
225 |
}
|
|
226 |
}
|
|
227 |
|
|
228 |
// show default radio logo
|
|
229 |
if ( iContainer )
|
|
230 |
{
|
|
231 |
iContainer->IdleController().ShowControl( iContainer->Logo() );
|
|
232 |
}
|
|
233 |
}
|
|
234 |
|
|
235 |
// ---------------------------------------------------------
|
|
236 |
// CFMRadioMainView::FadeAndShowExit
|
|
237 |
// Fade the view and all controls associated with it. Change
|
|
238 |
// the soft keys so that "Exit" is displayed
|
|
239 |
// ---------------------------------------------------------
|
|
240 |
//
|
|
241 |
void CFMRadioMainView::FadeAndShowExit(
|
|
242 |
TBool aFaded )
|
|
243 |
{
|
|
244 |
iFaded = aFaded;
|
|
245 |
|
|
246 |
if ( iContainer )
|
|
247 |
{
|
|
248 |
if ( aFaded || iRadioEngine->IsInCall() ) // Needs to be faded - headset missing
|
|
249 |
{
|
|
250 |
StopDisplayingMenuBar(); // In case options menu is open when headset is disconnected
|
|
251 |
SetToolbarDimmedState( ETrue );
|
|
252 |
TRAP_IGNORE( Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EXIT ) ); // Change softkeys
|
|
253 |
}
|
|
254 |
else // Unfade
|
|
255 |
{
|
|
256 |
SetToolbarDimmedState( EFalse );
|
|
257 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
258 |
{
|
|
259 |
TRAP_IGNORE( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); // Change softkeys
|
|
260 |
Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 0, KNullDesC ); )
|
|
261 |
}
|
|
262 |
else
|
|
263 |
{
|
|
264 |
TRAP_IGNORE ( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK__SELECT ); )// Change softkeys
|
|
265 |
}
|
|
266 |
}
|
|
267 |
iContainer->SetFaded( aFaded ); // Unfade controls inside container
|
|
268 |
Cba()->DrawDeferred(); // Redraw softkeys
|
|
269 |
}
|
|
270 |
}
|
|
271 |
|
|
272 |
// ---------------------------------------------------------
|
|
273 |
// CFMRadioMainView::UpdateDisplayForFocusGained
|
|
274 |
// Update display to override default behavior
|
|
275 |
// Can be removed when auto resume is implemented
|
|
276 |
// ---------------------------------------------------------
|
|
277 |
//
|
|
278 |
void CFMRadioMainView::UpdateDisplayForFocusGained()
|
|
279 |
{
|
|
280 |
FTRACE( FPrint( _L("CFMRadioMainView::UpdateDisplayForFocusGained") ) );
|
|
281 |
FadeAndShowExit( iFaded );
|
|
282 |
DetermineActiveMediaIdleComponent();
|
|
283 |
}
|
|
284 |
|
|
285 |
// ---------------------------------------------------------
|
|
286 |
// CFMRadioMainView::SeekL
|
|
287 |
// Tells the window owning container to display seek note
|
|
288 |
// and updates softkeys
|
|
289 |
// ---------------------------------------------------------
|
|
290 |
//
|
|
291 |
void CFMRadioMainView::SeekL()
|
|
292 |
{
|
|
293 |
if ( iContainer )
|
|
294 |
{
|
|
295 |
HBufC* seekString = StringLoader::LoadLC( R_QTN_FMRADIO_TUNING, iCoeEnv );
|
|
296 |
iContainer->VisualControl()->SetStaticInfoTextL( iChangeDirection, *seekString );
|
|
297 |
CleanupStack::PopAndDestroy( seekString );
|
|
298 |
iContainer->RdsViewer().Reset();
|
|
299 |
iContainer->MediaIdle().ResetMediaIdleContent();
|
|
300 |
iContainer->ShowRTPlusInteractionIndicator( EFalse, ETrue );
|
|
301 |
iContainer->IdleController().ShowControl( iContainer->Logo() );
|
|
302 |
iContainer->VisualControl()->StartTuningAnimation();
|
|
303 |
iSeeking = ETrue;
|
|
304 |
SetToolbarDimmedState( ETrue );
|
|
305 |
// force update for toolbar extension view
|
|
306 |
iToolbar->ToolbarExtension()->SetShown( EFalse );
|
|
307 |
}
|
|
308 |
Cba()->SetCommandSetL( R_FMRADIO_MAIN_VIEW_TUNING_STATE_SOFTKEYS );
|
|
309 |
|
|
310 |
Cba()->DrawDeferred(); // Redraw softkeys
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------
|
|
314 |
// CFMRadioMainView::ShowToolbar
|
|
315 |
// Sets toolbar visibility.
|
|
316 |
// ---------------------------------------------------------
|
|
317 |
//
|
|
318 |
void CFMRadioMainView::ShowToolbar( TBool aVisible )
|
|
319 |
{
|
|
320 |
if ( iToolbar )
|
|
321 |
{
|
|
322 |
iToolbar->SetToolbarVisibility( aVisible );
|
|
323 |
iToolbar->UpdateBackground();
|
|
324 |
iToolbar->DrawDeferred();
|
|
325 |
}
|
|
326 |
}
|
|
327 |
|
|
328 |
// ---------------------------------------------------------
|
|
329 |
// CFMRadioMainView::HandleForegroundEventL
|
|
330 |
// ---------------------------------------------------------
|
|
331 |
//
|
|
332 |
void CFMRadioMainView::HandleForegroundEventL(TBool aForeground)
|
|
333 |
{
|
|
334 |
CAknView::HandleForegroundEventL(aForeground);
|
|
335 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
336 |
if ( aForeground )
|
|
337 |
{
|
|
338 |
if ( iStartUp )
|
|
339 |
{
|
|
340 |
iStartUp = EFalse;
|
|
341 |
CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
|
|
342 |
TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
|
|
343 |
iContainer->ShowRdsInfo( receiver.SignalAvailable(), ETrue, afEnabled );
|
|
344 |
TBool showMusicStore = IsRTPlusInterActionIndicatorNeeded();
|
|
345 |
iContainer->ShowRTPlusInteractionIndicator(showMusicStore, ETrue);
|
|
346 |
}
|
|
347 |
}
|
|
348 |
else
|
|
349 |
{
|
|
350 |
CAlfEnv* env = CAlfEnv::Static();
|
|
351 |
if ( iContainer && env )
|
|
352 |
{
|
|
353 |
iContainer->IdleController().DeactivateControls();
|
|
354 |
}
|
|
355 |
}
|
|
356 |
}
|
|
357 |
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
// CFMRadioMainView::RdsDataProgrammeService
|
|
360 |
// ---------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
void CFMRadioMainView::RdsDataProgrammeService( const TDesC& aProgramService )
|
|
363 |
{
|
|
364 |
TRAP_IGNORE(
|
|
365 |
RdsDataProgrammeServiceL( aProgramService )
|
|
366 |
);
|
|
367 |
}
|
|
368 |
|
|
369 |
// ---------------------------------------------------------------------------
|
|
370 |
// CFMRadioMainView::RdsDataPsNameIsStatic
|
|
371 |
// ---------------------------------------------------------------------------
|
|
372 |
//
|
|
373 |
void CFMRadioMainView::RdsDataPsNameIsStatic( TBool aStatic )
|
|
374 |
{
|
|
375 |
TRAP_IGNORE( HandleStaticProgrammeServiceL( aStatic ) )
|
|
376 |
}
|
|
377 |
|
|
378 |
// ---------------------------------------------------------------------------
|
|
379 |
// CFMRadioMainView::RdsDataProgrammeServiceL
|
|
380 |
// ---------------------------------------------------------------------------
|
|
381 |
//
|
|
382 |
void CFMRadioMainView::RdsDataProgrammeServiceL( const TDesC& aProgramService )
|
|
383 |
{
|
|
384 |
FTRACE(FPrint(_L("CFMRadioMainView::RdsDataProgrammeServiceL('%S')"), &aProgramService));
|
|
385 |
if( iContainer )
|
|
386 |
{
|
|
387 |
CAlfEnv* alfEnv = CAlfEnv::Static();
|
|
388 |
if( alfEnv )
|
|
389 |
{
|
|
390 |
if( aProgramService.Length() > 0 )
|
|
391 |
{
|
|
392 |
TInt presetIndexToDisplay = KErrNotFound;
|
|
393 |
TInt presetIndex = iRadioEngine->GetPresetIndex();
|
|
394 |
// When we haven't preset name, ps name will save as preset name
|
|
395 |
if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
|
|
396 |
presetIndex < iObserver.Channels().Count() )
|
|
397 |
{
|
|
398 |
presetIndexToDisplay = presetIndex;
|
|
399 |
}
|
|
400 |
SetStationChangeType( EFMRadioStationChangeNone );
|
|
401 |
DisplayChannelL( presetIndexToDisplay );
|
|
402 |
}
|
|
403 |
}
|
|
404 |
}
|
|
405 |
}
|
|
406 |
|
|
407 |
// ---------------------------------------------------------------------------
|
|
408 |
// CFMRadioMainView::HandleStaticProgrammeServiceL
|
|
409 |
// ---------------------------------------------------------------------------
|
|
410 |
//
|
|
411 |
void CFMRadioMainView::HandleStaticProgrammeServiceL( TBool aStatic )
|
|
412 |
{
|
|
413 |
FTRACE(FPrint(_L("CFMRadioMainView::HandleStaticProgrammeServiceL(%d)"), aStatic));
|
|
414 |
|
|
415 |
if( iContainer )
|
|
416 |
{
|
|
417 |
if ( aStatic )
|
|
418 |
{
|
|
419 |
// When we haven't got a name for preset, a static ps name will be saved
|
|
420 |
TInt channelCount = iObserver.Channels().Count();
|
|
421 |
TInt currentPresetIx = iRadioEngine->GetPresetIndex();
|
|
422 |
|
|
423 |
if ( aStatic && iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
|
|
424 |
currentPresetIx != KErrNotFound &&
|
|
425 |
channelCount > 0 &&
|
|
426 |
currentPresetIx < channelCount )
|
|
427 |
{
|
|
428 |
const TDesC& stationName = iObserver.Channels()[ currentPresetIx ]->PresetName();
|
|
429 |
TInt presetFreq = iObserver.Channels()[ currentPresetIx ]->PresetFrequency();
|
|
430 |
|
|
431 |
if ( stationName.Length() == 0 &&
|
|
432 |
presetFreq != KErrNotFound &&
|
|
433 |
iRadioEngine->RdsReceiver().ProgrammeService().Length() )
|
|
434 |
{
|
|
435 |
iObserver.Channels()[ currentPresetIx ]->SetPresetNameL( iRadioEngine->RdsReceiver().ProgrammeService() );
|
|
436 |
iObserver.UpdateChannelsL( EStoreIndexToRepository, currentPresetIx, 0 );
|
|
437 |
// Update station information display
|
|
438 |
DisplayChannelL( currentPresetIx );
|
|
439 |
}
|
|
440 |
}
|
|
441 |
iContainer->MediaIdle().AddPsNameToMediaIdleL( iRadioEngine->RdsReceiver().ProgrammeService() );
|
|
442 |
}
|
|
443 |
}
|
|
444 |
}
|
|
445 |
|
|
446 |
// ---------------------------------------------------------
|
|
447 |
// CFMRadioMainView::RdsDataRadioText
|
|
448 |
// ---------------------------------------------------------
|
|
449 |
//
|
|
450 |
void CFMRadioMainView::RdsDataRadioText( const TDesC& aRadioText )
|
|
451 |
{
|
|
452 |
FTRACE(FPrint(_L("CFMRadioMainView::RdsDataRadioText('%S')"), &aRadioText));
|
|
453 |
if ( iContainer && aRadioText.Length() > 0 )
|
|
454 |
{
|
|
455 |
TRAP_IGNORE( iContainer->SetRdsRadioTextL( aRadioText ) );
|
|
456 |
}
|
|
457 |
}
|
|
458 |
|
|
459 |
// ---------------------------------------------------------
|
|
460 |
// CFMRadioMainView::RdsDataRadioTextPlus
|
|
461 |
// ---------------------------------------------------------
|
|
462 |
//
|
|
463 |
void CFMRadioMainView::RdsDataRadioTextPlus( const TInt aRadioTextPlusClass, const TDesC& aRadioText )
|
|
464 |
{
|
|
465 |
if ( aRadioTextPlusClass == ERTplusProgramHomepage &&
|
|
466 |
iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode )
|
|
467 |
{
|
|
468 |
TInt currentPresetIx = iRadioEngine->GetPresetIndex();
|
|
469 |
|
|
470 |
if ( currentPresetIx < iObserver.Channels().Count() )
|
|
471 |
{
|
|
472 |
TRAP_IGNORE
|
|
473 |
(
|
|
474 |
// save permanently
|
|
475 |
iRadioEngine->SaveUrlToPresetL( currentPresetIx, aRadioText );
|
|
476 |
// save to ui list
|
|
477 |
iObserver.Channels()[ currentPresetIx ]->SetPresetUrlL( aRadioText );
|
|
478 |
)
|
|
479 |
}
|
|
480 |
}
|
|
481 |
|
|
482 |
|
|
483 |
if ( IsRTPlusInterActionIndicatorNeeded() )
|
|
484 |
{
|
|
485 |
iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue );
|
|
486 |
if ( !iRadioEngine->MusicStoreNoteDisplayed() )
|
|
487 |
{
|
|
488 |
TRAP_IGNORE( ShowRTPlusFirstTimeDialogL() )
|
|
489 |
}
|
|
490 |
}
|
|
491 |
}
|
|
492 |
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
// CFMRadioMainView::IsRTPlusInterActionIndicatorNeeded
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
TBool CFMRadioMainView::IsRTPlusInterActionIndicatorNeeded()
|
|
498 |
{
|
|
499 |
CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
|
|
500 |
TBool songInformation = receiver.RtPlusSong().Length() ||
|
|
501 |
receiver.RtPlusArtist().Length() ||
|
|
502 |
receiver.RtPlusAlbum().Length();
|
|
503 |
TBool webLink = receiver.RtPlusProgramUrl().Length() &&
|
|
504 |
iRadioEngine->GetRTPlusSupportLevel() == EFMRadioAllInteractions;
|
|
505 |
|
|
506 |
return songInformation || webLink;
|
|
507 |
}
|
|
508 |
|
|
509 |
// ---------------------------------------------------------------------------
|
|
510 |
// CFMRadioMainView::ShowRTPlusFirstTimeDialogL
|
|
511 |
// ---------------------------------------------------------------------------
|
|
512 |
//
|
|
513 |
void CFMRadioMainView::ShowRTPlusFirstTimeDialogL()
|
|
514 |
{
|
|
515 |
// to avoid further calls
|
|
516 |
iRadioEngine->SetMusicStoreNoteDisplayed();
|
|
517 |
|
|
518 |
HBufC* noteTxt = StringLoader::LoadLC( R_QTN_FMRADIO_RTPLUS_FIRSTTIME, iCoeEnv );
|
|
519 |
|
|
520 |
CAknMessageQueryDialog* rdsFirstTimeDialog = new (ELeave) CAknMessageQueryDialog;
|
|
521 |
CleanupStack::PushL( rdsFirstTimeDialog );
|
|
522 |
rdsFirstTimeDialog->SetMessageTextL( *noteTxt );
|
|
523 |
CleanupStack::Pop( rdsFirstTimeDialog );
|
|
524 |
rdsFirstTimeDialog->ExecuteLD( R_FMRADIO_RTPLUS_FIRSTTIME_NOTE );
|
|
525 |
|
|
526 |
CleanupStack::PopAndDestroy( noteTxt );
|
|
527 |
}
|
|
528 |
|
|
529 |
// ---------------------------------------------------------------------------
|
|
530 |
// CFMRadioMainView::RdsAfSearchBegin
|
|
531 |
// ---------------------------------------------------------------------------
|
|
532 |
//
|
|
533 |
void CFMRadioMainView::RdsAfSearchBegin()
|
|
534 |
{
|
|
535 |
}
|
|
536 |
|
|
537 |
// ---------------------------------------------------------------------------
|
|
538 |
// CFMRadioMainView::RdsAfSearchEnd
|
|
539 |
// ---------------------------------------------------------------------------
|
|
540 |
//
|
|
541 |
void CFMRadioMainView::RdsAfSearchEnd( TUint32 /*aFrequency*/, TInt /*aError*/ )
|
|
542 |
{
|
|
543 |
}
|
|
544 |
|
|
545 |
// ---------------------------------------------------------------------------
|
|
546 |
// CFMRadioMainView::RdsAfSearchStateChange
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
//
|
|
549 |
void CFMRadioMainView::RdsAfSearchStateChange( TBool aEnabled )
|
|
550 |
{
|
|
551 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
|
|
552 |
if( appUi->ActiveView() == KFMRadioMainViewId )
|
|
553 |
{
|
|
554 |
CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
|
|
555 |
TBool show = receiver.SignalAvailable();
|
|
556 |
iContainer->ShowRdsInfo( show, ETrue, aEnabled );
|
|
557 |
}
|
|
558 |
}
|
|
559 |
|
|
560 |
// ---------------------------------------------------------------------------
|
|
561 |
// CFMRadioMainView::RdsAvailable
|
|
562 |
// ---------------------------------------------------------------------------
|
|
563 |
//
|
|
564 |
void CFMRadioMainView::RdsAvailable( TBool aAvailable )
|
|
565 |
{
|
|
566 |
CAlfEnv* alfEnv = CAlfEnv::Static();
|
|
567 |
if( alfEnv )
|
|
568 |
{
|
|
569 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
|
|
570 |
|
|
571 |
if( appUi->ActiveView() == KFMRadioMainViewId )
|
|
572 |
{
|
|
573 |
if( aAvailable )
|
|
574 |
{
|
|
575 |
iRdsSignalTimer->Cancel();
|
|
576 |
TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
|
|
577 |
iContainer->ShowRdsInfo( ETrue, ETrue, afEnabled );
|
|
578 |
}
|
|
579 |
else
|
|
580 |
{
|
|
581 |
// Start timer only if it wasn't activated before
|
|
582 |
if( !iRdsSignalTimer->IsActive() )
|
|
583 |
{
|
|
584 |
// Used for conversing milliseconds to format timer understand, ie. microseconds
|
|
585 |
const TInt timerMultiplier = 1000;
|
|
586 |
|
|
587 |
// Start timer to fade rds icon after a delay
|
|
588 |
iRdsSignalTimer->Start( TTimeIntervalMicroSeconds32( KFMRadioRdsSignalFadeOutDelay * timerMultiplier ),
|
|
589 |
TTimeIntervalMicroSeconds32(0), TCallBack( StaticRdsSignalTimerCallback, this ) );
|
|
590 |
}
|
|
591 |
}
|
|
592 |
}
|
|
593 |
}
|
|
594 |
}
|
|
595 |
|
|
596 |
// ---------------------------------------------------------
|
|
597 |
// CFMRadioMainView::StaticRdsSignalTimerCallback
|
|
598 |
// ---------------------------------------------------------
|
|
599 |
TInt CFMRadioMainView::StaticRdsSignalTimerCallback( TAny* aSelfPtr )
|
|
600 |
{
|
|
601 |
CFMRadioMainView* self = reinterpret_cast<CFMRadioMainView*>(aSelfPtr);
|
|
602 |
if(self)
|
|
603 |
{
|
|
604 |
self->iRdsSignalTimer->Cancel();
|
|
605 |
if(self->iContainer)
|
|
606 |
{
|
|
607 |
self->iContainer->ShowRdsInfo(EFalse, ETrue);
|
|
608 |
}
|
|
609 |
}
|
|
610 |
return KErrNone;
|
|
611 |
}
|
|
612 |
|
|
613 |
// ---------------------------------------------------------
|
|
614 |
// CFMRadioMainView::DisplayChannelL
|
|
615 |
// Inform the window owning container that it should display
|
|
616 |
// the frequency and name of the channel specified.
|
|
617 |
// ---------------------------------------------------------
|
|
618 |
//
|
|
619 |
void CFMRadioMainView::DisplayChannelL( TInt aChannelIndex )
|
|
620 |
{
|
|
621 |
FTRACE(FPrint(_L("DisplayChannelL Start, index: %d "), aChannelIndex));
|
|
622 |
|
|
623 |
if ( iContainer )
|
|
624 |
{
|
|
625 |
iContainer->MediaIdle().ResetMediaIdleContent();
|
|
626 |
|
|
627 |
if ( aChannelIndex != KErrNotFound )
|
|
628 |
{
|
|
629 |
CRadioEngine::TStationName stationName;
|
|
630 |
TInt channelNumber = aChannelIndex + 1;
|
|
631 |
TInt channelFrequency = KErrNotFound;
|
|
632 |
|
|
633 |
iRadioEngine->GetPresetNameAndFrequencyL( aChannelIndex, stationName, channelFrequency );
|
|
634 |
|
|
635 |
TFMRadioStationChangeType seekDirection = iChangeDirection;
|
|
636 |
|
|
637 |
// Hide index number as the frequency was set by RDS AF search.
|
|
638 |
if ( iRadioEngine->FrequencySetByRdsAf() && channelFrequency != iRadioEngine->GetTunedFrequency() )
|
|
639 |
{
|
|
640 |
channelNumber = KErrNotFound;
|
|
641 |
channelFrequency = iRadioEngine->GetTunedFrequency();
|
|
642 |
seekDirection = EFMRadioStationChangeNone;
|
|
643 |
}
|
|
644 |
|
|
645 |
// Update view
|
|
646 |
iContainer->DisplayChannelInfoL( channelNumber,
|
|
647 |
stationName,
|
|
648 |
seekDirection,
|
|
649 |
channelFrequency );
|
|
650 |
|
|
651 |
// show '+' indicator if channel exists and url is stored
|
|
652 |
if ( channelNumber && iObserver.Channels()[ aChannelIndex ]->PresetUrl().Length() )
|
|
653 |
{
|
|
654 |
iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue );
|
|
655 |
}
|
|
656 |
}
|
|
657 |
else
|
|
658 |
{
|
|
659 |
iContainer->DisplayChannelInfoL( aChannelIndex,
|
|
660 |
KNullDesC,
|
|
661 |
iChangeDirection,
|
|
662 |
iRadioEngine->GetTunedFrequency() );
|
|
663 |
}
|
|
664 |
|
|
665 |
FTRACE( FPrint(_L("DisplayChannelL End") ) );
|
|
666 |
}
|
|
667 |
}
|
|
668 |
|
|
669 |
// ---------------------------------------------------------
|
|
670 |
// CFMRadioMainView::HandleCommandL
|
|
671 |
// All commands are handled by the AppUi
|
|
672 |
// ---------------------------------------------------------
|
|
673 |
//
|
|
674 |
void CFMRadioMainView::HandleCommandL( TInt aCommand )
|
|
675 |
{
|
|
676 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
677 |
switch ( aCommand )
|
|
678 |
{
|
|
679 |
case EAknSoftkeyBack:
|
|
680 |
{
|
|
681 |
const TVwsViewId viewId( TUid::Uid( KUidFMRadioApplication ), Id() );
|
|
682 |
if ( !appUi->BackSteppingWrapper().HandleBackCommandL( viewId ) )
|
|
683 |
{
|
|
684 |
// Command not consumed by Back Stepping Service, handle here by going background
|
|
685 |
TApaTask task( iEikonEnv->WsSession() );
|
|
686 |
task.SetWgId( iEikonEnv->RootWin().Identifier() );
|
|
687 |
task.SendToBackground();
|
|
688 |
}
|
|
689 |
break;
|
|
690 |
}
|
|
691 |
case EMPXPbvCmdInternetGoToWeb:
|
|
692 |
{
|
|
693 |
LaunchBrowserL( aCommand );
|
|
694 |
break;
|
|
695 |
}
|
|
696 |
case EFMRadioCmdChannelList:
|
|
697 |
{
|
|
698 |
HandleSaveChannelQueryL();
|
|
699 |
appUi->HandleCommandL( aCommand );
|
|
700 |
break;
|
|
701 |
}
|
|
702 |
case EFMRadioRockerButtonKeyUp:
|
|
703 |
case EFMRadioRockerButtonKeyDown:
|
|
704 |
{
|
|
705 |
// NOP
|
|
706 |
break;
|
|
707 |
}
|
|
708 |
case EAknSoftkeySelect: // MSK
|
|
709 |
{
|
|
710 |
if ( !iFaded && !iSeeking )
|
|
711 |
{
|
|
712 |
HandleSaveChannelQueryL();
|
|
713 |
appUi->HandleCommandL( EFMRadioCmdChannelList );
|
|
714 |
}
|
|
715 |
break;
|
|
716 |
}
|
|
717 |
case EFMRadioRockerButtonKeyLeft:
|
|
718 |
{
|
|
719 |
if ( !iFaded && !iSeeking )
|
|
720 |
{
|
|
721 |
appUi->HandleCommandL( EFMRadioCmdPrevChannel );
|
|
722 |
}
|
|
723 |
break;
|
|
724 |
}
|
|
725 |
case EFMRadioRockerButtonKeyLeftLong:
|
|
726 |
{
|
|
727 |
if ( !iFaded && !iSeeking )
|
|
728 |
{
|
|
729 |
appUi->HandleCommandL( EFMRadioCmdSeekDown );
|
|
730 |
}
|
|
731 |
break;
|
|
732 |
}
|
|
733 |
case EFMRadioRockerButtonKeyRight:
|
|
734 |
{
|
|
735 |
if ( !iFaded && !iSeeking )
|
|
736 |
{
|
|
737 |
appUi->HandleCommandL( EFMRadioCmdNextChannel );
|
|
738 |
}
|
|
739 |
break;
|
|
740 |
}
|
|
741 |
case EFMRadioRockerButtonKeyRightLong:
|
|
742 |
{
|
|
743 |
if ( !iFaded && !iSeeking )
|
|
744 |
{
|
|
745 |
appUi->HandleCommandL( EFMRadioCmdSeekUp );
|
|
746 |
}
|
|
747 |
break;
|
|
748 |
}
|
|
749 |
case EFMRadioCmdErase:
|
|
750 |
{
|
|
751 |
if ( appUi->EraseChannelL( iRadioEngine->GetPresetIndex() ) )
|
|
752 |
{
|
|
753 |
// delete has been confirmed, update station info
|
|
754 |
if ( iContainer )
|
|
755 |
{
|
|
756 |
if ( IsRTPlusInterActionIndicatorNeeded() )
|
|
757 |
{
|
|
758 |
iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue );
|
|
759 |
}
|
|
760 |
else
|
|
761 |
{
|
|
762 |
iContainer->ShowRTPlusInteractionIndicator( EFalse, ETrue );
|
|
763 |
}
|
|
764 |
}
|
|
765 |
SetStationChangeType( EFMRadioStationChangeNone );
|
|
766 |
iRadioEngine->SetTunerModeOn();
|
|
767 |
DisplayChannelL( KErrNotFound );
|
|
768 |
}
|
|
769 |
break;
|
|
770 |
}
|
|
771 |
case EFMRadioToolbarButtonCmdToggleIhf:
|
|
772 |
{
|
|
773 |
if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputHeadset )
|
|
774 |
{
|
|
775 |
appUi->HandleCommandL( EFMRadioCmdActivateIhf );
|
|
776 |
}
|
|
777 |
else
|
|
778 |
{
|
|
779 |
appUi->HandleCommandL( EFMRadioCmdDeactivateIhf );
|
|
780 |
}
|
|
781 |
break;
|
|
782 |
}
|
|
783 |
default:
|
|
784 |
{
|
|
785 |
if ( iMusicStoreHandler->IsMusicStoreCommandId( aCommand ) )
|
|
786 |
{
|
|
787 |
LaunchBrowserL( aCommand );
|
|
788 |
}
|
|
789 |
else
|
|
790 |
{
|
|
791 |
appUi->HandleCommandL( aCommand );
|
|
792 |
}
|
|
793 |
break;
|
|
794 |
}
|
|
795 |
}
|
|
796 |
}
|
|
797 |
|
|
798 |
// ----------------------------------------
|
|
799 |
// Launch Browser
|
|
800 |
// ----------------------------------------
|
|
801 |
void CFMRadioMainView::LaunchBrowserL( TInt aCommandId )
|
|
802 |
{
|
|
803 |
FTRACE( FPrint(_L("CFMRadioMainView::LaunchBrowserL") ) );
|
|
804 |
|
|
805 |
CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
|
|
806 |
switch ( aCommandId )
|
|
807 |
{
|
|
808 |
case EMPXPbvCmdInternetGoToWeb:
|
|
809 |
{
|
|
810 |
RBuf webLinkToLaunch;
|
|
811 |
webLinkToLaunch.CleanupClosePushL();
|
|
812 |
if ( receiver.RtPlusProgramUrl().Length() )
|
|
813 |
{
|
|
814 |
webLinkToLaunch.CreateL( receiver.RtPlusProgramUrl() );
|
|
815 |
}
|
|
816 |
else if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode )
|
|
817 |
{
|
|
818 |
webLinkToLaunch.CreateL(
|
|
819 |
iObserver.Channels()[ iRadioEngine->GetPresetIndex() ]->PresetUrl() );
|
|
820 |
}
|
|
821 |
iMusicStoreHandler->LaunchWebPageL( webLinkToLaunch );
|
|
822 |
CleanupStack::PopAndDestroy( &webLinkToLaunch );
|
|
823 |
break;
|
|
824 |
}
|
|
825 |
default:
|
|
826 |
iMusicStoreHandler->LaunchMusicStoreL( aCommandId,
|
|
827 |
receiver.RtPlusSong(),
|
|
828 |
receiver.RtPlusArtist(),
|
|
829 |
receiver.RtPlusAlbum() );
|
|
830 |
break;
|
|
831 |
}
|
|
832 |
}
|
|
833 |
|
|
834 |
// ----------------------------------------------------------------------------------------------------
|
|
835 |
// CFMRadioMainView::NotifyRdsTextTimerCompletion()
|
|
836 |
// From MFMRadioAlfRdsViewObserver
|
|
837 |
// Called when same RT has stayed on display for 60 sec.
|
|
838 |
// ----------------------------------------------------------------------------------------------------
|
|
839 |
//
|
|
840 |
void CFMRadioMainView::NotifyRdsTextTimerCompletion()
|
|
841 |
{
|
|
842 |
DetermineActiveMediaIdleComponent();
|
|
843 |
}
|
|
844 |
// ---------------------------------------------------------
|
|
845 |
// CFMRadioMainView::DoActivateL
|
|
846 |
// Activate the main view
|
|
847 |
// ---------------------------------------------------------
|
|
848 |
//
|
|
849 |
void CFMRadioMainView::DoActivateL(
|
|
850 |
const TVwsViewId& /*aPrevViewId*/,
|
|
851 |
TUid /*aCustomMessageId*/,
|
|
852 |
const TDesC8& /*aCustomMessage*/)
|
|
853 |
{
|
|
854 |
CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
|
|
855 |
titlePane->SetTextToDefaultL();
|
|
856 |
#ifdef __FM_UPDATE_PACKAGE__
|
|
857 |
const TDesC* titleText = titlePane->Text();
|
|
858 |
TBufC<2> titleAddition( KFMRadioUpdated );
|
|
859 |
HBufC* newTitle = HBufC::NewLC( titleText->Length() + titleAddition.Length() );
|
|
860 |
newTitle->Des().Copy( *titleText );
|
|
861 |
newTitle->Des().Append( titleAddition );
|
|
862 |
titlePane->SetTextL( *newTitle, ETrue );
|
|
863 |
CleanupStack::PopAndDestroy( newTitle );
|
|
864 |
#endif
|
|
865 |
|
|
866 |
if ( !iContainer )
|
|
867 |
{
|
|
868 |
CAlfEnv* alfEnv = CAlfEnv::Static();
|
|
869 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
870 |
iContainer = CFMRadioMainContainer::NewL( ClientRect() , *alfEnv, *iRadioEngine );
|
|
871 |
iContainer->RdsViewer().SetObserver( this );
|
|
872 |
iContainer->Logo().SetObserver( this );
|
|
873 |
}
|
|
874 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
875 |
{
|
|
876 |
// explicitly remove the middle softkey that shouldn't be there.
|
|
877 |
Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, 0, KNullDesC );
|
|
878 |
}
|
|
879 |
|
|
880 |
SetStationChangeType( EFMRadioStationChangeNone );
|
|
881 |
|
|
882 |
if ( !iStartUp )
|
|
883 |
{
|
|
884 |
StopSeekL(); //used to trigger a UI update
|
|
885 |
}
|
|
886 |
else
|
|
887 |
{
|
|
888 |
AppUi()->HandleCommandL( EFMRadioCmdUpdateVolume );
|
|
889 |
}
|
|
890 |
|
|
891 |
AppUi()->HandleCommandL( EFMRadioCmdMainViewActive );
|
|
892 |
|
|
893 |
iRadioEngine->RdsReceiver().AddObserver( this );
|
|
894 |
|
|
895 |
TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
|
|
896 |
|
|
897 |
iContainer->ShowRdsInfo( iRadioEngine->RdsReceiver().SignalAvailable(), EFalse, afEnabled );
|
|
898 |
FadeAndShowExit(iFaded);
|
|
899 |
}
|
|
900 |
|
|
901 |
// ---------------------------------------------------------
|
|
902 |
// CFMRadioMainView::DoDeactivate
|
|
903 |
// Deactivate the main view
|
|
904 |
// ---------------------------------------------------------
|
|
905 |
//
|
|
906 |
void CFMRadioMainView::DoDeactivate()
|
|
907 |
{
|
|
908 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
|
|
909 |
|
|
910 |
if ( appUi->RadioEngine() )
|
|
911 |
{
|
|
912 |
iRadioEngine->RdsReceiver().RemoveObserver( this );
|
|
913 |
}
|
|
914 |
|
|
915 |
if ( iContainer )
|
|
916 |
{
|
|
917 |
CAlfEnv* alfEnv = CAlfEnv::Static();
|
|
918 |
if ( alfEnv )
|
|
919 |
{
|
|
920 |
iContainer->RdsViewer().RemoveObserver( this );
|
|
921 |
iContainer->RdsViewer().Reset();
|
|
922 |
iContainer->Logo().RemoveObserver( this );
|
|
923 |
iContainer->IdleController().HideAllControls();
|
|
924 |
}
|
|
925 |
delete iContainer;
|
|
926 |
iContainer = NULL;
|
|
927 |
}
|
|
928 |
}
|
|
929 |
|
|
930 |
// ---------------------------------------------------------
|
|
931 |
// CFMRadioMainView::DynInitMenuPaneL
|
|
932 |
// Sets the state of menu items dynamically according to the
|
|
933 |
// state of application data.
|
|
934 |
// ---------------------------------------------------------
|
|
935 |
//
|
|
936 |
void CFMRadioMainView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
937 |
{
|
|
938 |
iMusicStoreHandler->InitializeMenuL( aResourceId, aMenuPane );
|
|
939 |
|
|
940 |
if ( aResourceId == R_FMRADIO_MAIN_OPTIONS_MENU ) // Main menu
|
|
941 |
{
|
|
942 |
if ( IsWebLinkAvailable() )
|
|
943 |
{
|
|
944 |
aMenuPane->SetItemDimmed( EMPXPbvCmdInternetGoToWeb, EFalse );
|
|
945 |
}
|
|
946 |
else
|
|
947 |
{
|
|
948 |
aMenuPane->SetItemDimmed( EMPXPbvCmdInternetGoToWeb, ETrue );
|
|
949 |
}
|
|
950 |
|
|
951 |
if ( iRadioEngine->IsAudioRoutingPossible() )
|
|
952 |
{
|
|
953 |
if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
|
|
954 |
{
|
|
955 |
// Delete existing menu option and add a new one
|
|
956 |
aMenuPane->DeleteMenuItem( EFMRadioCmdActivateIhf );
|
|
957 |
if ( iRadioEngine->IsHeadsetConnected() )
|
|
958 |
{
|
|
959 |
aMenuPane->SetItemTextL( EFMRadioCmdDeactivateIhf, R_QTN_FMRADIO_OPTIONS_DEACTIVATE );
|
|
960 |
}
|
|
961 |
else
|
|
962 |
{
|
|
963 |
aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
|
|
964 |
}
|
|
965 |
}
|
|
966 |
else
|
|
967 |
{
|
|
968 |
// Delete existing menu option and add a new one
|
|
969 |
aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
|
|
970 |
aMenuPane->SetItemTextL( EFMRadioCmdActivateIhf,R_QTN_FMRADIO_OPTIONS_ACTIVATE );
|
|
971 |
}
|
|
972 |
}
|
|
973 |
else
|
|
974 |
{
|
|
975 |
aMenuPane->SetItemDimmed( EFMRadioCmdDeactivateIhf, ETrue );
|
|
976 |
aMenuPane->SetItemDimmed( EFMRadioCmdActivateIhf, ETrue );
|
|
977 |
}
|
|
978 |
|
|
979 |
// if help is not enabled, disable help option
|
|
980 |
if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
981 |
{
|
|
982 |
aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
|
|
983 |
}
|
|
984 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
|
|
985 |
if ( appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() ) == KErrNotFound ||
|
|
986 |
iRadioEngine->GetRadioMode() == CRadioEngine::ERadioTunerMode ) // current frequency not saved
|
|
987 |
{
|
|
988 |
aMenuPane->SetItemDimmed( EFMRadioCmdRename, ETrue );
|
|
989 |
aMenuPane->SetItemDimmed( EFMRadioCmdSaveChannel, EFalse );
|
|
990 |
aMenuPane->SetItemDimmed( EFMRadioCmdErase, ETrue );
|
|
991 |
}
|
|
992 |
else
|
|
993 |
{
|
|
994 |
aMenuPane->SetItemDimmed( EFMRadioCmdRename, EFalse );
|
|
995 |
aMenuPane->SetItemDimmed( EFMRadioCmdSaveChannel, ETrue );
|
|
996 |
aMenuPane->SetItemDimmed( EFMRadioCmdErase, EFalse );
|
|
997 |
}
|
|
998 |
}
|
|
999 |
|
|
1000 |
if ( aResourceId == R_FMRADIO_OPTIONS_AF_SUB_MENU ) // Rds af search sub menu
|
|
1001 |
{
|
|
1002 |
TBool afEnabled = iRadioEngine->RadioSettings().IsRdsAfSearchEnabled();
|
|
1003 |
if ( afEnabled )
|
|
1004 |
{
|
|
1005 |
aMenuPane->SetItemButtonState( EFMRadioCmdDisableRdsAfSearch, EEikMenuItemSymbolIndeterminate );
|
|
1006 |
aMenuPane->SetItemButtonState( EFMRadioCmdEnableRdsAfSearch, EEikMenuItemSymbolOn );
|
|
1007 |
}
|
|
1008 |
else
|
|
1009 |
{
|
|
1010 |
aMenuPane->SetItemButtonState( EFMRadioCmdEnableRdsAfSearch, EEikMenuItemSymbolIndeterminate );
|
|
1011 |
aMenuPane->SetItemButtonState( EFMRadioCmdDisableRdsAfSearch, EEikMenuItemSymbolOn );
|
|
1012 |
}
|
|
1013 |
}
|
|
1014 |
|
|
1015 |
}
|
|
1016 |
|
|
1017 |
// ---------------------------------------------------------
|
|
1018 |
// CFMRadioMainView::LayoutChangedL
|
|
1019 |
// ---------------------------------------------------------
|
|
1020 |
//
|
|
1021 |
void CFMRadioMainView::LayoutChangedL( TInt aType )
|
|
1022 |
{
|
|
1023 |
if ( iContainer )
|
|
1024 |
{
|
|
1025 |
iContainer->HandleResourceChange( aType );
|
|
1026 |
}
|
|
1027 |
}
|
|
1028 |
|
|
1029 |
// ---------------------------------------------------------
|
|
1030 |
// CFMRadioMainView::SetStationChangeType
|
|
1031 |
// ---------------------------------------------------------
|
|
1032 |
//
|
|
1033 |
void CFMRadioMainView::SetStationChangeType( TFMRadioStationChangeType aChangeType )
|
|
1034 |
{
|
|
1035 |
iChangeDirection = aChangeType;
|
|
1036 |
}
|
|
1037 |
|
|
1038 |
// ---------------------------------------------------------
|
|
1039 |
// CFMRadioMainView::PrepareViewForChannelChange
|
|
1040 |
// ---------------------------------------------------------
|
|
1041 |
//
|
|
1042 |
void CFMRadioMainView::PrepareViewForChannelChange()
|
|
1043 |
{
|
|
1044 |
TRAP_IGNORE( PrepareViewForChannelChangeL() );
|
|
1045 |
}
|
|
1046 |
|
|
1047 |
// ---------------------------------------------------------
|
|
1048 |
// CFMRadioMainView::PrepareViewForChannelChangeL
|
|
1049 |
// ---------------------------------------------------------
|
|
1050 |
//
|
|
1051 |
void CFMRadioMainView::PrepareViewForChannelChangeL()
|
|
1052 |
{
|
|
1053 |
switch ( iChangeDirection )
|
|
1054 |
{
|
|
1055 |
case EFMRadioStationChangeNext: // fall through
|
|
1056 |
case EFMRadioStationChangePrevious:
|
|
1057 |
case EFMRadioStationChangeScanUp:
|
|
1058 |
case EFMRadioStationChangeScanDown:
|
|
1059 |
{
|
|
1060 |
if( iContainer )
|
|
1061 |
{
|
|
1062 |
iContainer->VisualControl()->ScrollOutCurrentStationInformationL( iChangeDirection );
|
|
1063 |
}
|
|
1064 |
}
|
|
1065 |
break;
|
|
1066 |
default:
|
|
1067 |
{
|
|
1068 |
break;
|
|
1069 |
}
|
|
1070 |
}
|
|
1071 |
if ( iContainer )
|
|
1072 |
{
|
|
1073 |
iContainer->RdsViewer().Reset();
|
|
1074 |
}
|
|
1075 |
|
|
1076 |
if ( iContainer )
|
|
1077 |
{
|
|
1078 |
iContainer->ShowRTPlusInteractionIndicator( EFalse, ETrue);
|
|
1079 |
}
|
|
1080 |
// force update for toolbar extension view
|
|
1081 |
iToolbar->ToolbarExtension()->SetShown( EFalse );
|
|
1082 |
}
|
|
1083 |
|
|
1084 |
// --------------------------------------------------------------------------------
|
|
1085 |
// CFMRadioMainView::PrepareToolbar
|
|
1086 |
// Prepare toolbar for displaying basic radio command buttons
|
|
1087 |
// --------------------------------------------------------------------------------
|
|
1088 |
//
|
|
1089 |
void CFMRadioMainView::PrepareToolbar()
|
|
1090 |
{
|
|
1091 |
// get toolbar from view
|
|
1092 |
iToolbar = Toolbar();
|
|
1093 |
|
|
1094 |
// Set observer
|
|
1095 |
iToolbar->SetToolbarObserver( this );
|
|
1096 |
|
|
1097 |
CAknButton* leftButton = NULL;
|
|
1098 |
CAknButton* rightButton = NULL;
|
|
1099 |
leftButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdTuneDown ) );
|
|
1100 |
rightButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdTuneUp) );
|
|
1101 |
|
|
1102 |
//set delay after buttons report long key press
|
|
1103 |
if ( leftButton )
|
|
1104 |
{
|
|
1105 |
leftButton->SetLongPressInterval( KLongPressDelayValueInMicroseconds );
|
|
1106 |
}
|
|
1107 |
if ( rightButton )
|
|
1108 |
{
|
|
1109 |
rightButton->SetLongPressInterval( KLongPressDelayValueInMicroseconds );
|
|
1110 |
}
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
// --------------------------------------------------------------------------------
|
|
1114 |
// CFMRadioMainView::OfferToolbarEventL
|
|
1115 |
// Handle commands from toolbar.
|
|
1116 |
// --------------------------------------------------------------------------------
|
|
1117 |
//
|
|
1118 |
void CFMRadioMainView::OfferToolbarEventL( TInt aCommandId )
|
|
1119 |
{
|
|
1120 |
// Event modifiers are valid only during CAknToolbar::OfferToolbarEventL
|
|
1121 |
TBool isHandled = EFalse;
|
|
1122 |
if ( iToolbar->EventModifiers() == CAknToolbar::ELongPress )
|
|
1123 |
{
|
|
1124 |
switch( aCommandId )
|
|
1125 |
{
|
|
1126 |
case EFMRadioToolbarButtonCmdTuneDown:
|
|
1127 |
{
|
|
1128 |
isHandled = ETrue;
|
|
1129 |
AppUi()->HandleCommandL( EFMRadioCmdSeekDown );
|
|
1130 |
break;
|
|
1131 |
}
|
|
1132 |
case EFMRadioToolbarButtonCmdTuneUp:
|
|
1133 |
{
|
|
1134 |
isHandled = ETrue;
|
|
1135 |
AppUi()->HandleCommandL( EFMRadioCmdSeekUp );
|
|
1136 |
break;
|
|
1137 |
}
|
|
1138 |
default:
|
|
1139 |
{
|
|
1140 |
// fall through.
|
|
1141 |
// dont break here because extension list buttons
|
|
1142 |
// seem to report longpress also after the tuning buttons
|
|
1143 |
// are pressed long.
|
|
1144 |
}
|
|
1145 |
}
|
|
1146 |
}
|
|
1147 |
|
|
1148 |
if ( iToolbar->EventModifiers() != CAknToolbar::ELongPress &&
|
|
1149 |
iToolbar->EventModifiers() != CAknToolbar::ELongPressEnded )
|
|
1150 |
{
|
|
1151 |
switch( aCommandId )
|
|
1152 |
{
|
|
1153 |
case EFMRadioToolbarButtonCmdTuneDown:
|
|
1154 |
{
|
|
1155 |
isHandled = ETrue;
|
|
1156 |
AppUi()->HandleCommandL( EFMRadioCmdPrevChannel );
|
|
1157 |
break;
|
|
1158 |
}
|
|
1159 |
case EFMRadioToolbarButtonCmdTuneUp:
|
|
1160 |
{
|
|
1161 |
isHandled = ETrue;
|
|
1162 |
AppUi()->HandleCommandL( EFMRadioCmdNextChannel );
|
|
1163 |
break;
|
|
1164 |
}
|
|
1165 |
default:
|
|
1166 |
{
|
|
1167 |
// fall through.
|
|
1168 |
// dont break here because extension list buttons
|
|
1169 |
// seem to report longpress also after the tuning buttons
|
|
1170 |
// are pressed long.
|
|
1171 |
}
|
|
1172 |
}
|
|
1173 |
}
|
|
1174 |
if ( !isHandled )
|
|
1175 |
{
|
|
1176 |
switch( aCommandId )
|
|
1177 |
{
|
|
1178 |
case EFMRadioToolbarButtonCmdNokiaMusicStore:
|
|
1179 |
{
|
|
1180 |
HandleCommandL( EFMRadioMusicStoreNokiaMusicShop );
|
|
1181 |
break;
|
|
1182 |
}
|
|
1183 |
case EFMRadioToolbarButtonCmdOperatorMusicStore:
|
|
1184 |
{
|
|
1185 |
HandleCommandL( EFMRadioMusicStoreOperator );
|
|
1186 |
break;
|
|
1187 |
}
|
|
1188 |
case EFMRadioCmdRename:
|
|
1189 |
{
|
|
1190 |
iToolbar->ToolbarExtension()->SetShown( EFalse );
|
|
1191 |
HandleCommandL( aCommandId );
|
|
1192 |
break;
|
|
1193 |
}
|
|
1194 |
case EFMRadioCmdErase:
|
|
1195 |
{
|
|
1196 |
iToolbar->ToolbarExtension()->SetShown( EFalse );
|
|
1197 |
HandleCommandL( aCommandId );
|
|
1198 |
break;
|
|
1199 |
}
|
|
1200 |
case EFMRadioCmdChannelList:
|
|
1201 |
{
|
|
1202 |
iToolbar->ToolbarExtension()->SetShown( EFalse );
|
|
1203 |
HandleCommandL( aCommandId );
|
|
1204 |
break;
|
|
1205 |
}
|
|
1206 |
default:
|
|
1207 |
{
|
|
1208 |
HandleCommandL( aCommandId );
|
|
1209 |
break;
|
|
1210 |
}
|
|
1211 |
}
|
|
1212 |
}
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
// --------------------------------------------------------------------------------
|
|
1216 |
// CFMRadioMainView::DynInitToolbarL
|
|
1217 |
// from MAknToolbarObserver
|
|
1218 |
// --------------------------------------------------------------------------------
|
|
1219 |
//
|
|
1220 |
void CFMRadioMainView::DynInitToolbarL( TInt /*aResourceId*/, CAknToolbar* aToolbar )
|
|
1221 |
{
|
|
1222 |
if ( iToolbar == aToolbar )
|
|
1223 |
{
|
|
1224 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
|
|
1225 |
CAknToolbarExtension* toolbarExtension = iToolbar->ToolbarExtension();
|
|
1226 |
|
|
1227 |
if ( appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() ) == KErrNotFound ||
|
|
1228 |
iRadioEngine->GetRadioMode() == CRadioEngine::ERadioTunerMode )
|
|
1229 |
{
|
|
1230 |
// current frequency not saved
|
|
1231 |
// show save
|
|
1232 |
toolbarExtension->HideItemL( EFMRadioCmdSaveChannel, EFalse );
|
|
1233 |
// hide rename
|
|
1234 |
toolbarExtension->HideItemL( EFMRadioCmdRename, ETrue );
|
|
1235 |
// dim delete
|
|
1236 |
toolbarExtension->SetItemDimmed( EFMRadioCmdErase, ETrue );
|
|
1237 |
}
|
|
1238 |
else
|
|
1239 |
{
|
|
1240 |
// show rename
|
|
1241 |
toolbarExtension->HideItemL( EFMRadioCmdRename, EFalse );
|
|
1242 |
// hide save
|
|
1243 |
toolbarExtension->HideItemL( EFMRadioCmdSaveChannel, ETrue );
|
|
1244 |
// undim delete
|
|
1245 |
toolbarExtension->SetItemDimmed( EFMRadioCmdErase, EFalse );
|
|
1246 |
}
|
|
1247 |
|
|
1248 |
if ( IsWebLinkAvailable() )
|
|
1249 |
{
|
|
1250 |
// show web button
|
|
1251 |
toolbarExtension->HideItemL( EMPXPbvCmdInternetGoToWeb, EFalse );
|
|
1252 |
}
|
|
1253 |
else
|
|
1254 |
{
|
|
1255 |
// hide web button
|
|
1256 |
toolbarExtension->HideItemL( EMPXPbvCmdInternetGoToWeb, ETrue );
|
|
1257 |
}
|
|
1258 |
|
|
1259 |
TBool musicStoreEnabled = iMusicStoreHandler->IsMusicStoreEnabled();
|
|
1260 |
|
|
1261 |
if ( iMusicStoreHandler->OperatorMusicStoreAvailable() && musicStoreEnabled )
|
|
1262 |
{
|
|
1263 |
// show operator store
|
|
1264 |
toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdOperatorMusicStore, EFalse );
|
|
1265 |
// hide speaker button
|
|
1266 |
toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdToggleIhf, ETrue );
|
|
1267 |
}
|
|
1268 |
else
|
|
1269 |
{
|
|
1270 |
// hide operator store
|
|
1271 |
toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdOperatorMusicStore, ETrue );
|
|
1272 |
// show and update speaker button
|
|
1273 |
UpdateToolbarSpeakerButtonStatus();
|
|
1274 |
toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdToggleIhf, EFalse );
|
|
1275 |
}
|
|
1276 |
|
|
1277 |
if ( iMusicStoreHandler->NokiaMusicStoreAvailable() && musicStoreEnabled )
|
|
1278 |
{
|
|
1279 |
// show Nokia Music Store
|
|
1280 |
toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdNokiaMusicStore, EFalse );
|
|
1281 |
}
|
|
1282 |
else
|
|
1283 |
{
|
|
1284 |
// hide Nokia Music Store
|
|
1285 |
toolbarExtension->HideItemL( EFMRadioToolbarButtonCmdNokiaMusicStore, ETrue );
|
|
1286 |
}
|
|
1287 |
}
|
|
1288 |
}
|
|
1289 |
|
|
1290 |
// --------------------------------------------------------------------------------
|
|
1291 |
// CFMRadioMainView::SetToolbarDimmedState
|
|
1292 |
// Set the current state of the buttons in the button group
|
|
1293 |
// --------------------------------------------------------------------------------
|
|
1294 |
//
|
|
1295 |
void CFMRadioMainView::SetToolbarDimmedState( TBool aState )
|
|
1296 |
{
|
|
1297 |
iToolbar->SetDimmed( aState );
|
|
1298 |
iToolbar->DrawDeferred();
|
|
1299 |
}
|
|
1300 |
|
|
1301 |
// ---------------------------------------------------------------------------
|
|
1302 |
// CFMRadioMainView::HandleSaveChannelQueryL
|
|
1303 |
// show query if the current channel is not saved
|
|
1304 |
// ---------------------------------------------------------------------------
|
|
1305 |
//
|
|
1306 |
void CFMRadioMainView::HandleSaveChannelQueryL()
|
|
1307 |
{
|
|
1308 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( iCoeEnv->AppUi() );
|
|
1309 |
TInt channelIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
|
|
1310 |
|
|
1311 |
if ( KErrNotFound == channelIndex )
|
|
1312 |
{
|
|
1313 |
TBool accepted = EFalse; // Operation accepted or discarded
|
|
1314 |
CAknQueryDialog* saveQuery = CAknQueryDialog::NewL();
|
|
1315 |
accepted = saveQuery->ExecuteLD( R_FMRADIO_QUERY_SAVE_CURRENT );
|
|
1316 |
|
|
1317 |
if ( accepted )
|
|
1318 |
{
|
|
1319 |
AppUi()->HandleCommandL( EFMRadioCmdSaveChannel );
|
|
1320 |
}
|
|
1321 |
}
|
|
1322 |
}
|
|
1323 |
|
|
1324 |
// --------------------------------------------------------------------------------
|
|
1325 |
// CFMRadioMainView::SetEmphasis
|
|
1326 |
// From MEikMenuObserver.
|
|
1327 |
// --------------------------------------------------------------------------------
|
|
1328 |
//
|
|
1329 |
void CFMRadioMainView::SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis )
|
|
1330 |
{
|
|
1331 |
CAknView::SetEmphasis( aMenuControl, aEmphasis );
|
|
1332 |
|
|
1333 |
if ( iContainer )
|
|
1334 |
{
|
|
1335 |
if ( aEmphasis ) // options menu opened
|
|
1336 |
{
|
|
1337 |
iOptionsMenuOpen = ETrue;
|
|
1338 |
// deactivate controls to help improve UI performance
|
|
1339 |
iContainer->IdleController().DeactivateControls();
|
|
1340 |
}
|
|
1341 |
else
|
|
1342 |
{
|
|
1343 |
if ( iOptionsMenuOpen )
|
|
1344 |
{
|
|
1345 |
// menu has been been really opened so update status
|
|
1346 |
iOptionsMenuOpen = EFalse;
|
|
1347 |
DetermineActiveMediaIdleComponent();
|
|
1348 |
}
|
|
1349 |
}
|
|
1350 |
}
|
|
1351 |
}
|
|
1352 |
|
|
1353 |
// --------------------------------------------------------------------------------
|
|
1354 |
// CFMRadioMainView::LogoDisplayTimeCompleted
|
|
1355 |
// from MFMRadioAlfLogoObserver
|
|
1356 |
// --------------------------------------------------------------------------------
|
|
1357 |
//
|
|
1358 |
void CFMRadioMainView::LogoDisplayTimeCompleted()
|
|
1359 |
{
|
|
1360 |
DetermineActiveMediaIdleComponent();
|
|
1361 |
}
|
|
1362 |
|
|
1363 |
// --------------------------------------------------------------------------------
|
|
1364 |
// CFMRadioMainView::DetermineActiveMediaIdleComponent
|
|
1365 |
// --------------------------------------------------------------------------------
|
|
1366 |
//
|
|
1367 |
void CFMRadioMainView::DetermineActiveMediaIdleComponent()
|
|
1368 |
{
|
|
1369 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*> (AppUi());
|
|
1370 |
TBool wizardHandled = appUi->IsStartupWizardHandled();
|
|
1371 |
|
|
1372 |
if ( iContainer &&
|
|
1373 |
!iOptionsMenuOpen &&
|
|
1374 |
wizardHandled &&
|
|
1375 |
IsForeground() )
|
|
1376 |
{
|
|
1377 |
|
|
1378 |
if ( iContainer->RdsViewer().IsRdsTextVisibilityTimerCompleted() )
|
|
1379 |
{
|
|
1380 |
// same text displayed for a while, ok to start idle
|
|
1381 |
iContainer->IdleController().ShowControl( iContainer->MediaIdle() );
|
|
1382 |
}
|
|
1383 |
else
|
|
1384 |
{
|
|
1385 |
// display the rds text until the NotifyRdsTextTimerCompletion() callback
|
|
1386 |
iContainer->IdleController().ShowControl( iContainer->RdsViewer() );
|
|
1387 |
}
|
|
1388 |
}
|
|
1389 |
}
|
|
1390 |
|
|
1391 |
// --------------------------------------------------------------------------------
|
|
1392 |
// CFMRadioMainView::IsWebLinkAvailabe
|
|
1393 |
// --------------------------------------------------------------------------------
|
|
1394 |
//
|
|
1395 |
TBool CFMRadioMainView::IsWebLinkAvailable()
|
|
1396 |
{
|
|
1397 |
TBool response = EFalse;
|
|
1398 |
TBool webLinkStored = EFalse;
|
|
1399 |
TInt presetIndex = iRadioEngine->GetPresetIndex();
|
|
1400 |
|
|
1401 |
if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
|
|
1402 |
presetIndex < iObserver.Channels().Count() )
|
|
1403 |
{
|
|
1404 |
if ( iObserver.Channels()[ presetIndex ]->PresetUrl().Length() )
|
|
1405 |
{
|
|
1406 |
webLinkStored = ETrue;
|
|
1407 |
}
|
|
1408 |
}
|
|
1409 |
|
|
1410 |
CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver();
|
|
1411 |
|
|
1412 |
if ( ( receiver.RtPlusProgramUrl().Length() ||
|
|
1413 |
webLinkStored ) &&
|
|
1414 |
iRadioEngine->GetRTPlusSupportLevel() == EFMRadioAllInteractions )
|
|
1415 |
{
|
|
1416 |
response = ETrue;
|
|
1417 |
}
|
|
1418 |
|
|
1419 |
return response;
|
|
1420 |
}
|
|
1421 |
|
|
1422 |
// --------------------------------------------------------------------------------
|
|
1423 |
// CFMRadioMainView::UpdateToolbarSpeakerButtonStatus
|
|
1424 |
// --------------------------------------------------------------------------------
|
|
1425 |
//
|
|
1426 |
void CFMRadioMainView::UpdateToolbarSpeakerButtonStatus()
|
|
1427 |
{
|
|
1428 |
if ( iToolbar && iContainer )
|
|
1429 |
{
|
|
1430 |
CAknToolbarExtension* toolbarExtension = iToolbar->ToolbarExtension();
|
|
1431 |
|
|
1432 |
if ( iRadioEngine->IsAudioRoutingPossible() )
|
|
1433 |
{
|
|
1434 |
toolbarExtension->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, EFalse );
|
|
1435 |
CAknButton* speakerButton = NULL;
|
|
1436 |
|
|
1437 |
speakerButton = static_cast<CAknButton*>( toolbarExtension->ControlOrNull( EFMRadioToolbarButtonCmdToggleIhf ) );
|
|
1438 |
|
|
1439 |
if ( speakerButton )
|
|
1440 |
{
|
|
1441 |
if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
|
|
1442 |
{
|
|
1443 |
speakerButton->SetCurrentState( 1, ETrue );
|
|
1444 |
}
|
|
1445 |
else
|
|
1446 |
{
|
|
1447 |
speakerButton->SetCurrentState( 0, ETrue );
|
|
1448 |
}
|
|
1449 |
}
|
|
1450 |
}
|
|
1451 |
else
|
|
1452 |
{
|
|
1453 |
toolbarExtension->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue );
|
|
1454 |
}
|
|
1455 |
}
|
|
1456 |
}
|
|
1457 |
|
|
1458 |
// --------------------------------------------------------------------------------
|
|
1459 |
// CFMRadioMainView::ShowDefaultLogo
|
|
1460 |
// --------------------------------------------------------------------------------
|
|
1461 |
//
|
|
1462 |
void CFMRadioMainView::ShowDefaultLogo()
|
|
1463 |
{
|
|
1464 |
// show default radio logo
|
|
1465 |
if ( iContainer )
|
|
1466 |
{
|
|
1467 |
iContainer->IdleController().ShowControl( iContainer->Logo() );
|
|
1468 |
}
|
|
1469 |
}
|
|
1470 |
|
|
1471 |
// End of File
|