|
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: definition of the class CFMRadioChannelListView |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef FMRADIOCHANNELLISTVIEW_H |
|
20 #define FMRADIOCHANNELLISTVIEW_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknview.h> |
|
24 #include <akntoolbarobserver.h> |
|
25 |
|
26 #include "fmradiochannellistcontainer.h" |
|
27 #include "mfmradiolayoutchangeobserver.h" |
|
28 #include "fmradiordsobserver.h" |
|
29 #include "mchannellisthandler.h" |
|
30 |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CFMRadioChannelListViewContainer; |
|
34 class CRadioEngine; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * CFMRadioChannelListView view class. |
|
40 * @since 2.6 |
|
41 */ |
|
42 class CFMRadioChannelListView : public CAknView, |
|
43 public MCoeControlObserver, |
|
44 public MFMRadioLayoutChangeObserver, |
|
45 public MFMRadioRdsObserver, |
|
46 public MAknToolbarObserver |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 /** |
|
50 * Two-phase constructor of CFMRadioChannelListView |
|
51 * @since 2.6 |
|
52 * @param aRadioEngine pointer to a radio engine object |
|
53 * @param aObserver Handler for channel list |
|
54 */ |
|
55 static CFMRadioChannelListView* NewL( CRadioEngine* aRadioEngine, |
|
56 MChannelListHandler& aObserver ); |
|
57 |
|
58 /** |
|
59 * CFMRadioChannelListView. |
|
60 * @since 2.6 |
|
61 */ |
|
62 CFMRadioChannelListView::CFMRadioChannelListView( MChannelListHandler& aObserver ) ; |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 * @since 2.6 |
|
67 */ |
|
68 virtual ~CFMRadioChannelListView(); |
|
69 public: // New functions |
|
70 /** |
|
71 * Return the unique identifier corresponding to this view |
|
72 * @since 2.6 |
|
73 * @return the unique identifier corresponding to this view |
|
74 */ |
|
75 TUid Id() const; |
|
76 /** |
|
77 * Keep track of the last selected channel |
|
78 * @since 2.6 |
|
79 * @param aIndex the index of the last listened to channel |
|
80 */ |
|
81 void SetLastListenedChannel( TInt aIndex ); |
|
82 /** |
|
83 * Keep track of the current selected channel |
|
84 * @param aChannelIndex the index of the current channel |
|
85 */ |
|
86 void SetNowPlayingChannel ( TInt aChannelIndex ); |
|
87 /** |
|
88 * Returns the index of the playing channel item from the |
|
89 * channel list. |
|
90 * @return the currently playing channel |
|
91 */ |
|
92 TInt CurrentlyPlayingChannel(); |
|
93 /** |
|
94 * Returns the index of the selected channel item from the |
|
95 * channel list. If the container is active get the info from |
|
96 * it, because it may have more up-to-date info. |
|
97 * @since 2.6 |
|
98 * @return the currently selected channel |
|
99 */ |
|
100 TInt CurrentlySelectedChannel(); |
|
101 /** |
|
102 * Make a request to the channel container to update the |
|
103 * content of the channel at aIndex with the values specified |
|
104 * @since 2.6 |
|
105 * @param aIndex the index of the channel to update |
|
106 * @param aChannelName the new name of the channel |
|
107 * @param aChannelFrequency the new frequency |
|
108 */ |
|
109 void UpdateChannelListContentL( TInt aIndex, const TDesC& aChannelName, TInt aChannelFrequency ); |
|
110 /** |
|
111 * Return true/false to indicate whether the channel specified is in play |
|
112 * @param aChannelIndex the index of the channel to check |
|
113 * @return true/false to indicate whether the channel is currently being played |
|
114 */ |
|
115 TBool ChannelInPlay( TInt aChannelIndex ) const; |
|
116 /** |
|
117 * Retrieve the index of the next channel that has been set. |
|
118 * @since 2.6 |
|
119 * @return the index of the next "in use" channel |
|
120 */ |
|
121 TInt NextChannel(); |
|
122 /** |
|
123 * Retrieve the index of the previous channel that has been set. |
|
124 * @since 2.6 |
|
125 * @return the index of the previous "in use" channel |
|
126 */ |
|
127 TInt PreviousChannel(); |
|
128 /** |
|
129 * Initialize the channels with the values currently saved in |
|
130 * the radio engine |
|
131 * @since 2.6 |
|
132 */ |
|
133 void InitializeChannelsL(); |
|
134 /** |
|
135 * Fade the view and all controls associated with it. Change |
|
136 * the soft keys so that "Exit" is displayed |
|
137 * @since 2.6 |
|
138 * @param aFaded indicates whether the view should fade/unfade. |
|
139 */ |
|
140 void FadeAndShowExit( TBool aFaded ); |
|
141 /** |
|
142 * Update display when focus regained |
|
143 * @since 3.0 |
|
144 */ |
|
145 void UpdateDisplayForFocusGained(); |
|
146 /** |
|
147 * from MFMRadioLayoutChangeObserver |
|
148 * This method gets called by the AppUI when a dynamic layout change |
|
149 * event occurs. |
|
150 * @param aType layout change type |
|
151 */ |
|
152 void LayoutChangedL( TInt aType ); |
|
153 /** |
|
154 * Set empty channel list item |
|
155 * when preset is deleted from fmradiopresetutility |
|
156 * @param aIndex list index to delete |
|
157 */ |
|
158 void SetEmptyChannelListItemL( const TInt aIndex ) const; |
|
159 |
|
160 /** |
|
161 * From MAknToolbarObserver |
|
162 * Handle commands from toolbar. |
|
163 * @param aCommandId The command id |
|
164 */ |
|
165 void OfferToolbarEventL( TInt aCommandId ); |
|
166 |
|
167 /** |
|
168 * Sets toolbar visibility |
|
169 * @param aVisible |
|
170 * @return none |
|
171 */ |
|
172 void ShowToolbar( TBool aVisible ); |
|
173 |
|
174 /** |
|
175 * From base class MFMRadioRdsObserver |
|
176 */ |
|
177 void RdsDataProgrammeService( const TDesC& aProgramService ); |
|
178 void RdsDataPsNameIsStatic( TBool aStatic ); |
|
179 void RdsDataRadioText( const TDesC& aRadioText ); |
|
180 void RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioText ); |
|
181 void RdsAfSearchBegin(); |
|
182 void RdsAfSearchEnd( TUint32 aFrequency, TInt aError ); |
|
183 void RdsAfSearchStateChange( TBool aEnabled ); |
|
184 void RdsAvailable( TBool aAvailable ); |
|
185 /** |
|
186 * Procedures for finishing a move of channel on the list |
|
187 * @param none |
|
188 * @return none |
|
189 */ |
|
190 void MoveActionDoneL(); |
|
191 |
|
192 /** |
|
193 * Cancel the moving |
|
194 */ |
|
195 void CancelMoveL(); |
|
196 |
|
197 /** |
|
198 * Dim relevant buttons when the list is empty |
|
199 */ |
|
200 void UpdateToolbar() const; |
|
201 |
|
202 /* |
|
203 * Updates view when seek event is ended |
|
204 */ |
|
205 void StopSeekL(); |
|
206 |
|
207 /** |
|
208 * Interprets view's menu,softkey and other commands and acts |
|
209 * accordingly by calling the appropriate command handler |
|
210 * function for further action. |
|
211 * @since 2.6 |
|
212 * @param aCommand the command to process |
|
213 */ |
|
214 void HandleCommandL( TInt aCommand ); |
|
215 |
|
216 private: // Functions from base classes |
|
217 /** |
|
218 * Activate the channel list view |
|
219 * @since 2.6 |
|
220 */ |
|
221 void DoActivateL( const TVwsViewId& aPrevViewId,TUid aCustomMessageId, const TDesC8& aCustomMessage ); |
|
222 /** |
|
223 * Deactivate the channel list view |
|
224 * @since 2.6 |
|
225 */ |
|
226 void DoDeactivate(); |
|
227 /** |
|
228 * From MCoeControlObserver, control event observing. In this case, |
|
229 * the user selection from the list is reported by container class |
|
230 * and observed here. |
|
231 * @since 2.6 |
|
232 * @param aControl the control that caused the event |
|
233 * @param aEventType the type of event that was triggered |
|
234 */ |
|
235 void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); |
|
236 /** |
|
237 * Sets the state of menu items dynamically according to the |
|
238 * state of application data. |
|
239 * @since 2.6 |
|
240 * @param aResourceId Resource ID identifying the menu pane to initialise. |
|
241 * @param aMenuPane The in-memory representation of the menu pane. |
|
242 */ |
|
243 void DynInitMenuPaneL( TInt aResourceId,CEikMenuPane* aMenuPane ); |
|
244 |
|
245 /** |
|
246 * SetMiddleSoftKeyLabelL, sets the MSK label |
|
247 * |
|
248 */ |
|
249 void SetMiddleSoftKeyLabelL (TInt aResourceId, TInt aCommandId); |
|
250 |
|
251 /** |
|
252 * UpdateMiddleSoftKeyL, updates the MSK |
|
253 * |
|
254 */ |
|
255 void UpdateMiddleSoftKeyL(); |
|
256 private: // new functions |
|
257 /** |
|
258 * EPOC default constructor. |
|
259 * @since 2.6 |
|
260 * @param aRadioEngine pointer to a radio engine object |
|
261 */ |
|
262 void ConstructL( CRadioEngine* aRadioEngine ); |
|
263 |
|
264 /** |
|
265 * Prepare toolbar for FMRadio command buttons |
|
266 */ |
|
267 void PrepareToolbar(); |
|
268 /* |
|
269 * Set view title text |
|
270 * @param aResourceId resource Id containing the title text |
|
271 */ |
|
272 void SetTitleL( TInt aResourceId ); |
|
273 /** |
|
274 * Procedures for beginning a move of channel on the list |
|
275 * @param none |
|
276 * @return none |
|
277 */ |
|
278 void MoveCurrentItemIndexL(); |
|
279 |
|
280 private: // Data |
|
281 CFMRadioChannelListContainer* iContainer; |
|
282 CRadioEngine* iRadioEngine; |
|
283 TInt iChIndex; |
|
284 TInt iNowPlayingIndex; |
|
285 TInt iCurrentMSKCommandId; //owned |
|
286 TBool iFaded; |
|
287 MChannelListHandler& iObserver; |
|
288 |
|
289 CAknQueryDialog* iManualQueryDialog; |
|
290 |
|
291 TBool iMoveMode; |
|
292 |
|
293 /** |
|
294 * Boolean for knowing if any moves have been made |
|
295 */ |
|
296 TBool iFirstMoveDone; |
|
297 |
|
298 /** |
|
299 * Toolbar for controlling the application. |
|
300 */ |
|
301 CAknToolbar* iToolbar; |
|
302 }; |
|
303 |
|
304 #endif |
|
305 |
|
306 // End of File |