1 /* |
|
2 * Copyright (c) 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: Main application view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __HOMEMEDIAAPPVIEW_H__ |
|
24 #define __HOMEMEDIAAPPVIEW_H__ |
|
25 |
|
26 // INCLUDES |
|
27 #include <aknview.h> |
|
28 #include <AknWaitNoteWrapper.h> //MAknBackgroundProcess |
|
29 #include "upnpfilesharingengineobserver.h" |
|
30 #include "upnppluginloaderobserver.h" |
|
31 |
|
32 //forward declaration |
|
33 class CHomeMediaContainer; |
|
34 class CUPnPFileSharingEngine; |
|
35 class CUPnPPluginInterface; |
|
36 class CUPnPPluginLoader; |
|
37 class MUPnPAVController; |
|
38 class CUPnPSettingsEngine; |
|
39 class CAknNavigationDecorator; |
|
40 class CGSPluginInterface; |
|
41 class CIdle; |
|
42 class CAknInputBlock; |
|
43 class CUPnPAppFileSharingDialog; |
|
44 class CUPnPPeriodic; |
|
45 |
|
46 /** |
|
47 * CHomeMediaAppView |
|
48 * View class for CHomeMediaAppUi, handles menu commands and creates |
|
49 * container which shows main view items. |
|
50 */ |
|
51 class CHomeMediaAppView : public CAknView, |
|
52 private MUPnPFileSharingEngineObserver, |
|
53 private MAknBackgroundProcess, |
|
54 private MUPnPPluginLoaderObserver |
|
55 { |
|
56 public: |
|
57 // New methods |
|
58 |
|
59 /** |
|
60 * NewL. |
|
61 * Two-phased constructor. |
|
62 * @return a pointer to the created instance of CHomeMediaAppView. |
|
63 */ |
|
64 static CHomeMediaAppView* NewL(); |
|
65 |
|
66 /** |
|
67 * NewLC. |
|
68 * Two-phased constructor. |
|
69 * @return A pointer to the created instance of CHomeMediaAppView. |
|
70 */ |
|
71 static CHomeMediaAppView* NewLC(); |
|
72 |
|
73 /** |
|
74 * ~CHomeMediaAppView |
|
75 * Virtual Destructor. |
|
76 */ |
|
77 virtual ~CHomeMediaAppView(); |
|
78 |
|
79 /** |
|
80 * Get the pointer of fileSharingDialog ,which is constructed in the function of |
|
81 * ProcessCommandL |
|
82 */ |
|
83 void RefreshVisibilitySettingItemL() ; |
|
84 |
|
85 private: |
|
86 // Constructors |
|
87 |
|
88 /** |
|
89 * ConstructL |
|
90 * 2nd phase constructor. |
|
91 * Perform the second phase construction of a |
|
92 * CHomeMediaAppView object. |
|
93 */ |
|
94 void ConstructL(); |
|
95 |
|
96 /** |
|
97 * CHomeMediaAppView. |
|
98 * C++ default constructor. |
|
99 */ |
|
100 CHomeMediaAppView(); |
|
101 |
|
102 public: // Functions from base classes |
|
103 |
|
104 /** |
|
105 * Return Uid |
|
106 */ |
|
107 TUid Id() const; |
|
108 |
|
109 /** |
|
110 * Handle Size changes |
|
111 */ |
|
112 void HandleClientRectChange(); |
|
113 |
|
114 private: // From AknView |
|
115 |
|
116 /** |
|
117 * Activates view |
|
118 */ |
|
119 void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId, |
|
120 const TDesC8& aCustomMessage); |
|
121 |
|
122 /** |
|
123 * Deactivates view |
|
124 */ |
|
125 void DoDeactivate(); |
|
126 |
|
127 private: // Functions from base classes |
|
128 |
|
129 /** |
|
130 * Handle Commands |
|
131 */ |
|
132 void HandleCommandL(TInt aCommand); |
|
133 |
|
134 /** |
|
135 * Add some comments here |
|
136 */ |
|
137 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
138 |
|
139 private: |
|
140 /** |
|
141 * From MAknBackgroundProcess |
|
142 */ |
|
143 void StepL(); |
|
144 |
|
145 /** |
|
146 * From MAknBackgroundProcess |
|
147 */ |
|
148 TBool IsProcessDone() const; |
|
149 |
|
150 /** |
|
151 * From MAknBackgroundProcess |
|
152 */ |
|
153 TInt CycleError( TInt aError ); |
|
154 |
|
155 private: //From MUPnPFileSharingEngineObserver |
|
156 |
|
157 /** |
|
158 * Function informs when file sharing was enabled or disabled |
|
159 * @param aEngine File sharing engine |
|
160 * @param aError, error code |
|
161 * @param aPhase ETrue if current phase is sharing activation, |
|
162 * otherwise EFalse |
|
163 */ |
|
164 void HandleSharingStatus( |
|
165 CUPnPFileSharingEngine& aEngine, |
|
166 TInt aError, |
|
167 TBool aPhase ); |
|
168 |
|
169 /** |
|
170 * Callback to inform if connection has been lost |
|
171 * @param aEngine File sharing engine |
|
172 */ |
|
173 void HandleSharingConnectionLost( |
|
174 CUPnPFileSharingEngine& aEngine ); |
|
175 |
|
176 private: //From MUPnPPluginLoaderObserver |
|
177 |
|
178 /** |
|
179 * Called by UPnPPluginLoader when plugin(s) has been updated |
|
180 */ |
|
181 void PluginsUpdated(); |
|
182 |
|
183 private: //business logic methods |
|
184 |
|
185 /** |
|
186 * Browse home |
|
187 */ |
|
188 void ExecuteBrowseL(); |
|
189 |
|
190 /** |
|
191 * Browse home |
|
192 */ |
|
193 void DoExecuteBrowseL(); |
|
194 |
|
195 /** |
|
196 * Start wizard |
|
197 * @return key pressed in the wizard |
|
198 */ |
|
199 TInt StartWizardL(); |
|
200 |
|
201 /** |
|
202 * @return IAP id |
|
203 */ |
|
204 TInt IAP() const; |
|
205 |
|
206 /** |
|
207 * @return validity of current IAP |
|
208 */ |
|
209 TBool CheckAccessPointValid(); |
|
210 |
|
211 /** |
|
212 * Show the error note |
|
213 * |
|
214 * @param aMain resource id for loc |
|
215 */ |
|
216 void ShowErrorNoteL( TInt aMain ) const; |
|
217 |
|
218 /** |
|
219 * Update title pane |
|
220 */ |
|
221 void UpdateTitlePaneL(); |
|
222 |
|
223 /** |
|
224 * update navi pane |
|
225 * |
|
226 * @param aShowStatus ETrue if shown |
|
227 */ |
|
228 void UpdateNaviPaneL( TBool aShowStatus ); |
|
229 |
|
230 /** |
|
231 * Load external plugins |
|
232 */ |
|
233 void LoadPluginL(); |
|
234 |
|
235 /** |
|
236 * Launch the settings view |
|
237 */ |
|
238 void StartSettingsViewL(); |
|
239 |
|
240 /** |
|
241 * If get the correct pointer ,refresh the correspond item in view or share dialog |
|
242 */ |
|
243 void RefreshSharelistItemL() ; |
|
244 |
|
245 /** |
|
246 * Launch the setup wizard |
|
247 * |
|
248 * @param aPtr CHomeMediaAppView* pointer |
|
249 * @return EFalse |
|
250 */ |
|
251 static TBool InitializeWizardL( TAny* aPtr ); |
|
252 |
|
253 /** |
|
254 * Launch a timer |
|
255 * |
|
256 * @param aPtr CHomeMediaAppView* pointer |
|
257 * @return KErrNone |
|
258 */ |
|
259 static TInt RefreshSharingL( TAny* aPtr ); |
|
260 |
|
261 private: |
|
262 /** |
|
263 * The internal phases of wait note when starting browsing |
|
264 */ |
|
265 enum TBrowsingState |
|
266 { |
|
267 EPhaseNotActive, |
|
268 EPhaseProcessing, |
|
269 EPhaseCompleted |
|
270 }; |
|
271 |
|
272 /** |
|
273 * View's window |
|
274 * Own |
|
275 */ |
|
276 CHomeMediaContainer* iContainer; |
|
277 |
|
278 /** |
|
279 * File sharing engine |
|
280 * Own |
|
281 */ |
|
282 CUPnPFileSharingEngine* iFileSharing; |
|
283 |
|
284 /** |
|
285 * Array of plugins |
|
286 * Not own |
|
287 */ |
|
288 RPointerArray<CUPnPPluginInterface> iPluginArray; |
|
289 |
|
290 /** |
|
291 * Plugin loader |
|
292 * Own |
|
293 */ |
|
294 CUPnPPluginLoader* iPluginLoader; |
|
295 |
|
296 /** |
|
297 * Current browse state |
|
298 */ |
|
299 TBrowsingState iBrowseState; |
|
300 |
|
301 /** |
|
302 * AV contoller |
|
303 * Own |
|
304 */ |
|
305 MUPnPAVController* iAvControl; |
|
306 |
|
307 /** |
|
308 * Settings engine |
|
309 * Own |
|
310 */ |
|
311 CUPnPSettingsEngine* iSettingsEngine; |
|
312 |
|
313 /** |
|
314 * App's navigation decorator |
|
315 * Own |
|
316 */ |
|
317 CAknNavigationDecorator* iNaviDecorator; |
|
318 |
|
319 /** |
|
320 * Settings view |
|
321 * Not own |
|
322 */ |
|
323 CGSPluginInterface* iSettingsView; |
|
324 |
|
325 /** |
|
326 * Idle loop |
|
327 * Own |
|
328 */ |
|
329 CIdle* iIdle; |
|
330 |
|
331 /** |
|
332 * block UI in case of first start |
|
333 * Own |
|
334 */ |
|
335 CAknInputBlock* iInputBlocker; |
|
336 |
|
337 /** |
|
338 * record the pointer of CUPnPAppFileSharingDialog |
|
339 * Own |
|
340 */ |
|
341 CUPnPAppFileSharingDialog* ifileSharingDialog; |
|
342 |
|
343 CUPnPPeriodic* iRefreshTimer; |
|
344 }; |
|
345 |
|
346 #endif // __HOMEMEDIAAPPVIEW_H__ |
|
347 // End of File |
|