|
1 /* |
|
2 * Copyright (c) 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: Controller for MPX Music player |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_MPXCONTROLLER_H |
|
20 #define C_MPXCONTROLLER_H |
|
21 |
|
22 #include <mpxcollectionobserver.h> |
|
23 #include <coeaui.h> |
|
24 |
|
25 // Foward declarations |
|
26 class MMPXCollectionUtility; |
|
27 class MMPXViewUtility; |
|
28 class MMPXPlaybackUtility; |
|
29 class CAknQueryDialog; |
|
30 |
|
31 // Enumerations |
|
32 //@FIX ME |
|
33 enum TWaitNoteType |
|
34 { |
|
35 EMPXScanningNote, |
|
36 EMPXRefreshingNote, |
|
37 EMPXMTPEventNote, |
|
38 EMPXUsbEventNote, |
|
39 EMPXOpeningNote, |
|
40 EMPXMediaNotAvailableNote, |
|
41 EMPXCorruptScanningNote, |
|
42 EMPXFormatScanningNote, |
|
43 EMPXNoteNotDefined |
|
44 }; |
|
45 |
|
46 /** |
|
47 * Controller for handling system events and system startup |
|
48 * |
|
49 * @lib mpx.exe |
|
50 * @since S60 3.2 |
|
51 */ |
|
52 class CMPXController : public CBase, |
|
53 public MMPXCollectionObserver, |
|
54 public MCoeViewActivationObserver |
|
55 { |
|
56 |
|
57 public: |
|
58 |
|
59 /** |
|
60 * Two-Phased constructor |
|
61 */ |
|
62 static CMPXController* NewL( TBool aDisablePodcasting ); |
|
63 |
|
64 /** |
|
65 * virtual destructor |
|
66 */ |
|
67 virtual ~CMPXController(); |
|
68 |
|
69 public: // New Functions |
|
70 |
|
71 /** |
|
72 * Idle callback function |
|
73 */ |
|
74 static TInt IdleCallback( TAny* ptr ); |
|
75 |
|
76 /** |
|
77 * Idle processing function |
|
78 */ |
|
79 void HandleIdleEventL(); |
|
80 |
|
81 private: // Inherited function |
|
82 |
|
83 // From MMPXCollectionObserver |
|
84 |
|
85 /** |
|
86 * From MMPXCollectionObserver |
|
87 * Handle collection message. |
|
88 * |
|
89 * @param aMessage Collection message |
|
90 * @param aErr system error code. |
|
91 */ |
|
92 void HandleCollectionMessage( |
|
93 CMPXMessage* aMessage, TInt aError ); |
|
94 |
|
95 /** |
|
96 * From MMPXCollectionObserver |
|
97 * Handles the collection entries being opened. Typically called |
|
98 * when client has Open()'d a folder |
|
99 * |
|
100 * @param aEntries collection entries opened |
|
101 * @param aIndex focused entry |
|
102 * @param aComplete ETrue no more entries. EFalse more entries |
|
103 * expected |
|
104 * @param aError error code |
|
105 */ |
|
106 void HandleOpenL( |
|
107 const CMPXMedia& aEntries, |
|
108 TInt aIndex, |
|
109 TBool aComplete, |
|
110 TInt aError ); |
|
111 |
|
112 /** |
|
113 * From MMPXCollectionObserver |
|
114 * Handles the collection entries being opened. Typically called |
|
115 * when client has Open()'d an item. Client typically responds by |
|
116 * 'playing' the item |
|
117 * |
|
118 * @param aPlaylist collection path to item |
|
119 * @param aError error code |
|
120 */ |
|
121 void HandleOpenL( |
|
122 const CMPXCollectionPlaylist& aPlaylist, |
|
123 TInt aError ); |
|
124 |
|
125 /** |
|
126 * |
|
127 * From MMPXCollectionObserver |
|
128 * Handle media properties |
|
129 * Notes: The client is responsible for delete the object of aProperties |
|
130 * |
|
131 * @param aMedia media |
|
132 * @param aError error code |
|
133 */ |
|
134 void HandleCollectionMediaL( |
|
135 const CMPXMedia& aMedia, |
|
136 TInt aError ); |
|
137 |
|
138 /** |
|
139 * From MCoeViewActivationObserver |
|
140 * Wait for view activation |
|
141 */ |
|
142 void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
|
143 const TVwsViewId& aViewIdToBeDeactivated); |
|
144 |
|
145 private: // New functions |
|
146 |
|
147 /** |
|
148 * Start either the refresh or scanning note |
|
149 */ |
|
150 void StartWaitNoteL( TWaitNoteType aNoteType ); |
|
151 |
|
152 /** |
|
153 * Close the waitnote dialog |
|
154 * @param aSkipCheckIfActive - flags if the method should check if waitnote |
|
155 * is the current view |
|
156 */ |
|
157 void CloseWaitNoteL(TBool aSkipCheckIfActive = EFalse); |
|
158 |
|
159 /** |
|
160 * Calls MediaL to retrieve item details |
|
161 */ |
|
162 void DoRetrieveDetailsL(TBool aSkipAttribute = EFalse); |
|
163 |
|
164 /** |
|
165 * Handle collection message |
|
166 * |
|
167 * @param aMessage collection message |
|
168 */ |
|
169 void DoHandleCollectionMessageL( const CMPXMessage& aMessage ); |
|
170 |
|
171 /** |
|
172 * Handle a broadcast message event |
|
173 * from the collection framework |
|
174 * @arg aEvent, event to handle |
|
175 */ |
|
176 void DoHandleBroadcastMsgL( TInt aEvent ); |
|
177 |
|
178 /** |
|
179 * Displays error notes. |
|
180 * |
|
181 * @param aError Error ID to be handled. |
|
182 */ |
|
183 void HandleErrorL( TInt aError ); |
|
184 |
|
185 /** |
|
186 * Handle a corrupt message sent from the collection server |
|
187 */ |
|
188 void DoHandleCorruptMsgL(); |
|
189 |
|
190 private: |
|
191 |
|
192 /** |
|
193 * Constructor |
|
194 */ |
|
195 CMPXController( TBool aDisablePodcasting ); |
|
196 |
|
197 /** |
|
198 * 2nd phase constructor |
|
199 */ |
|
200 void ConstructL(); |
|
201 |
|
202 private: // data |
|
203 |
|
204 // Member variables |
|
205 MMPXCollectionUtility* iCollectionUtility; |
|
206 MMPXViewUtility* iViewUtility; |
|
207 MMPXPlaybackUtility* iPlaybackUtility; |
|
208 CIdle* iIdle; |
|
209 |
|
210 // States |
|
211 TBool iDelayedRefreshForUIReady; |
|
212 TBool iDelayedUsbRefresh; |
|
213 TBool iRefreshingCollection; |
|
214 TBool iInitDBNeeded; |
|
215 TBool iInitDBCorrupted; |
|
216 TBool iUIReady; |
|
217 CMPXCollectionPath* iCurPath; |
|
218 |
|
219 // Handling system events |
|
220 CAknQueryDialog* iQueryDialog; // not owned, only for dismissal |
|
221 TInt iCurSystemEvent; |
|
222 TInt iCurPlugin; |
|
223 TBool iOutOfDisk; |
|
224 TBool iDiskDismountDuringFormat; |
|
225 TBool iRestartWaitDialog; |
|
226 TBool iDisablePodcasting; |
|
227 |
|
228 // Music and Podcast database ID |
|
229 TUid iMusicCollectionId; |
|
230 TUid iPodcastCollectionId; |
|
231 }; |
|
232 |
|
233 #endif // C_MPXCONTROLLER_H |