|
1 /* |
|
2 * Copyright (c) 2009 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: fmradio media idle controller |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "fmradioidlecontroller.h" |
|
19 #include "fmradioidlecontrolinterface.h" |
|
20 #include "debug.h" |
|
21 |
|
22 // ======== MEMBER FUNCTIONS ======== |
|
23 |
|
24 // ---------------------------------------------------------------------------- |
|
25 // CFMRadioIdleController::CFMRadioIdleController |
|
26 // Default constructor |
|
27 // ---------------------------------------------------------------------------- |
|
28 // |
|
29 CFMRadioIdleController::CFMRadioIdleController() |
|
30 { |
|
31 } |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CFMRadioIdleController::ConstructL |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 void CFMRadioIdleController::ConstructL() |
|
38 { |
|
39 FTRACE( FPrint( _L("CFMRadioIdleController::ConstructL()") ) ); |
|
40 } |
|
41 |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CFMRadioIdleController::NewL |
|
45 // Two-phase constructor of CFMRadioPreset |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CFMRadioIdleController* CFMRadioIdleController::NewL() |
|
49 { |
|
50 FTRACE( FPrint( _L("CFMRadioIdleController::NewL()") ) ); |
|
51 CFMRadioIdleController* self = new ( ELeave ) CFMRadioIdleController(); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(); |
|
54 CleanupStack::Pop( self ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CFMRadioIdleController::~CFMRadioIdleController |
|
61 // Destructor |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CFMRadioIdleController::~CFMRadioIdleController() |
|
65 { |
|
66 FTRACE( FPrint( _L("CFMRadioIdleController::~CFMRadioIdleController()") ) ); |
|
67 iControlArray.Close(); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CFMRadioIdleController::AddControlItem |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 void CFMRadioIdleController::AddControlItem( const MFMRadioIdleControlInterface& aControl ) |
|
75 { |
|
76 TInt index = iControlArray.FindInAddressOrder( &aControl ); |
|
77 if ( index == KErrNotFound ) |
|
78 { |
|
79 iControlArray.InsertInAddressOrder( &aControl ); |
|
80 } |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CFMRadioIdleController::ShowControl |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 void CFMRadioIdleController::ShowControl( const MFMRadioIdleControlInterface& aControl ) |
|
88 { |
|
89 for ( TInt i = 0; i < iControlArray.Count(); i++ ) |
|
90 { |
|
91 MFMRadioIdleControlInterface* controlItem = iControlArray[i]; |
|
92 // show requested item |
|
93 if ( &aControl == controlItem ) |
|
94 { |
|
95 controlItem->Show(); |
|
96 } |
|
97 else // hide rest of the items |
|
98 { |
|
99 controlItem->Hide(); |
|
100 } |
|
101 } |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CFMRadioIdleController::HideAllControls |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void CFMRadioIdleController::HideAllControls() |
|
109 { |
|
110 FTRACE( FPrint( _L("CFMRadioIdleController::HideAllControls()") ) ); |
|
111 for ( TInt i = 0; i < iControlArray.Count(); i++ ) |
|
112 { |
|
113 iControlArray[i]->Hide(); |
|
114 } |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CFMRadioIdleController::DeactivateControls |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 void CFMRadioIdleController::DeactivateControls() |
|
122 { |
|
123 FTRACE( FPrint( _L("CFMRadioIdleController::DeactivateControls()") ) ); |
|
124 for ( TInt i = 0; i < iControlArray.Count(); i++ ) |
|
125 { |
|
126 iControlArray[i]->Deactivate(); |
|
127 } |
|
128 } |
|
129 |
|
130 // end of file |