|
1 /* |
|
2 * Copyright (c) 2006 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: Saves/restores current playback path |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMPXRESTOREPATH_H |
|
20 #define CMPXRESTOREPATH_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <mpxcollectionobserver.h> |
|
25 #include <mpxplaybackobserver.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CMPXAppUi; |
|
31 class CMPXCollectionPath; |
|
32 class MMPXCollectionUtility; |
|
33 class MMPXPlaybackUtility; |
|
34 class MMPXCollectionUiHelper; |
|
35 class CMPXCollectionOpenUtility; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 /** |
|
39 * Saves/restores current playback path. |
|
40 * |
|
41 * @lib mpx.exe |
|
42 * @since 3.1 |
|
43 */ |
|
44 class CMPXRestorePath : public CBase, |
|
45 public MMPXCollectionObserver, |
|
46 public MMPXPlaybackObserver |
|
47 { |
|
48 public: // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 * @since 3.1 |
|
54 * @param aPlaybackUtility Playback utility to use. |
|
55 * @param aCollectionUiHelper UI helper to use |
|
56 * @return Pointer to newly created object. |
|
57 */ |
|
58 static CMPXRestorePath * NewL(MMPXPlaybackUtility* aPlaybackUtility, |
|
59 MMPXCollectionUiHelper* aCollectionUiHelper); |
|
60 |
|
61 /** |
|
62 * Two-phased constructor. |
|
63 * |
|
64 * @since 3.1 |
|
65 * @param aPlaybackUtility Playback utility to use. |
|
66 * @param aCollectionUiHelper UI helper to use |
|
67 * @return Pointer to newly created object. |
|
68 */ |
|
69 static CMPXRestorePath * NewLC(MMPXPlaybackUtility* aPlaybackUtility, |
|
70 MMPXCollectionUiHelper* aCollectionUiHelper); |
|
71 |
|
72 /** |
|
73 * Destructor. |
|
74 */ |
|
75 virtual ~CMPXRestorePath(); |
|
76 |
|
77 public: // New funtions |
|
78 |
|
79 /** |
|
80 * Loads current collection path |
|
81 */ |
|
82 void LoadPathL(); |
|
83 |
|
84 /** |
|
85 * Loads the default collection path |
|
86 * @param some delay to load the path (in ms) |
|
87 */ |
|
88 void LoadDefaultPathL( TInt aDelay = 0 ); |
|
89 |
|
90 /** |
|
91 * Save the current collection Path |
|
92 */ |
|
93 void SavePathL(); |
|
94 |
|
95 /** |
|
96 * Return if the default playlist has been initialized |
|
97 * |
|
98 * @return ETrue if the path has been initialized, EFalse otherwise; |
|
99 */ |
|
100 TBool Initialized(); |
|
101 |
|
102 /** |
|
103 * Return if the playlist is currently initializing |
|
104 * |
|
105 * @return ETrue it's currently initializing, EFalse otherwise; |
|
106 */ |
|
107 TBool IsInitializing(); |
|
108 |
|
109 /** |
|
110 * Set the initialized state |
|
111 * |
|
112 * @param aInit The current state of initialization. |
|
113 */ |
|
114 void SetInitialized( TBool aInit ); |
|
115 |
|
116 /** |
|
117 * Cancels the initialize operation |
|
118 */ |
|
119 void CancelInit(); |
|
120 |
|
121 /** |
|
122 * Get the Uid of the root path |
|
123 */ |
|
124 TUid RooPathId(); |
|
125 |
|
126 private: |
|
127 |
|
128 /** |
|
129 * C++ Constructor |
|
130 * |
|
131 * @param aPlaybackUtility Playback utility to use. |
|
132 * @param aCollectionUiHelper collection ui helper to use |
|
133 */ |
|
134 CMPXRestorePath (MMPXPlaybackUtility* aPlaybackUtility, |
|
135 MMPXCollectionUiHelper* aCollectionUiHelper); |
|
136 |
|
137 /** |
|
138 * By default Symbian 2nd phase constructor is private. |
|
139 */ |
|
140 void ConstructL(); |
|
141 |
|
142 // from base class MMPXCollectionObserver |
|
143 |
|
144 /** |
|
145 * From MMPXCollectionObserver |
|
146 * Handle media properties. |
|
147 * |
|
148 * @since 3.1 |
|
149 * @param aMedia media properties. |
|
150 * @param aError Error code. |
|
151 */ |
|
152 void HandleCollectionMediaL( |
|
153 const CMPXMedia& aMedia, |
|
154 TInt aError ); |
|
155 |
|
156 /** |
|
157 * From MMPXCollectionObserver |
|
158 * Handle collection message. |
|
159 * |
|
160 * @since 3.1 |
|
161 * @param aMessage Collection message |
|
162 * @param aErr system error code. |
|
163 */ |
|
164 void HandleCollectionMessage( |
|
165 CMPXMessage* aMessage, TInt aError ); |
|
166 |
|
167 /** |
|
168 * From MMPXCollectionObserver |
|
169 * Handles the collection entries being opened. |
|
170 * |
|
171 * @since 3.1 |
|
172 * @param aEntries Collection entries opened. |
|
173 * @param aIndex Focused entry. |
|
174 * @param aComplete ETrue no more entries. EFalse more entries |
|
175 * expected. |
|
176 * @param aError Error code. |
|
177 */ |
|
178 void HandleOpenL( |
|
179 const CMPXMedia& aEntries, |
|
180 TInt aIndex, |
|
181 TBool aComplete, |
|
182 TInt aError ); |
|
183 |
|
184 /** |
|
185 * From MMPXCollectionObserver |
|
186 * Handles the item being opened. |
|
187 * |
|
188 * @since 3.1 |
|
189 * @param aPlaylist Collection playlist, owner ship is transfered. |
|
190 * @param aError Error code. |
|
191 */ |
|
192 void HandleOpenL( |
|
193 const CMPXCollectionPlaylist& aPlaylist, |
|
194 TInt aError ); |
|
195 |
|
196 /** |
|
197 * From MMPXPlaybackObserver |
|
198 * Handle playback message |
|
199 * |
|
200 * @param aMessage playback message |
|
201 * @param aErr system error code. |
|
202 */ |
|
203 void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); |
|
204 |
|
205 private: // New functions |
|
206 |
|
207 /** |
|
208 * Initialize playback engine with the path provided |
|
209 * |
|
210 * @param aPath The collection path to initialize playback engine with. |
|
211 */ |
|
212 void InitPlaybackEngineL( CMPXCollectionPath& aPath ); |
|
213 |
|
214 /** |
|
215 * Handle playback message |
|
216 * |
|
217 * @param aMessage playback message |
|
218 */ |
|
219 void DoHandlePlaybackMessageL( const CMPXMessage& aMessage ); |
|
220 |
|
221 /** |
|
222 * Handle collection message |
|
223 * |
|
224 * @param aMessage collection message |
|
225 */ |
|
226 void DoHandleCollectionMessageL( const CMPXMessage& aMessage ); |
|
227 |
|
228 /** |
|
229 * Start the incremental open operation at a particular index |
|
230 * @param aPath path to open |
|
231 * @param aIndex index to start reading from |
|
232 * @param aDelay delay to start the operation (in ms) |
|
233 */ |
|
234 void DoIncrementalOpenL( CMPXCollectionPath& aPath, TInt aIndex, |
|
235 TInt aDelay = 0 ); |
|
236 |
|
237 private: |
|
238 |
|
239 MMPXCollectionUtility* iCollectionUtility; // owned |
|
240 MMPXPlaybackUtility* iPlaybackUtility; // not owned |
|
241 MMPXCollectionUiHelper* iCollectionUiHelper; // not owned |
|
242 CMPXCollectionOpenUtility* iIncOpenUtil; |
|
243 |
|
244 TBool iPathInitialized; |
|
245 TBool iIsInitializing; |
|
246 TBool iInitCanceled; |
|
247 TBool iDefaultPath; // Are we initializing the default path? |
|
248 TMPXItemId iSelectionId; // Item we want to play |
|
249 TInt iSelectionIndex; // Index we are restoring to |
|
250 TBool iLoadSavedPath; // Load a saved path or load a default path? |
|
251 TBool iUSBOngoing; // is usb ongoing |
|
252 TUid iRootPathId; |
|
253 TBool iMTPStarted; // is MTP started |
|
254 }; |
|
255 |
|
256 #endif // CMPXRESTOREPATH_H |
|
257 |
|
258 // End of File |
|
259 |