|
1 /* |
|
2 * Copyright (c) 2007 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: Class create for testing. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MEDIAFILETEST_H_ |
|
20 #define MEDIAFILETEST_H_ |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include "mediafiledialogutils.h" |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <AknDialog.h> |
|
28 #include <e32math.h> // Math::FRand |
|
29 #include <AknInfoPopupNoteController.h> // CAknInfoPopupNoteController |
|
30 |
|
31 // for metadata engine |
|
32 #include <harvesterclient.h> |
|
33 |
|
34 |
|
35 |
|
36 #ifdef _DEBUG |
|
37 |
|
38 // CLASS DECLARATION |
|
39 class CMFVideoPreviewHandler; |
|
40 class CMediaFileDialog; |
|
41 class CMdeTest; |
|
42 |
|
43 |
|
44 /** |
|
45 * CRandomNum |
|
46 * |
|
47 * CRandomNum is used for generating random numbers. |
|
48 */ |
|
49 NONSHARABLE_CLASS (CRandomNum) : public CBase |
|
50 { |
|
51 public: |
|
52 static CRandomNum* NewLC(); |
|
53 static CRandomNum* NewL(); |
|
54 ~CRandomNum(); |
|
55 private: |
|
56 CRandomNum(); |
|
57 |
|
58 public: |
|
59 TInt Random(TInt aMax); |
|
60 TInt Random( TInt aMin, TInt aMax ); |
|
61 TBool Match(TInt aPercentage); |
|
62 |
|
63 private: |
|
64 TInt64 iSeed; |
|
65 }; |
|
66 |
|
67 |
|
68 |
|
69 /** |
|
70 * CMFDialogTest |
|
71 */ |
|
72 NONSHARABLE_CLASS (CMFDialogTest) : public CBase, |
|
73 public MMFActiveCallerObserver |
|
74 { |
|
75 enum TNextStep |
|
76 { |
|
77 ENextFolder = 0, |
|
78 ENextListItem = 1, |
|
79 EMovePosition = 2 |
|
80 }; |
|
81 |
|
82 public:// Constructors and destructor |
|
83 |
|
84 static CMFDialogTest* NewL( CMediaFileDialog* aDialog ); |
|
85 virtual ~CMFDialogTest(); |
|
86 |
|
87 private: |
|
88 |
|
89 CMFDialogTest( CMediaFileDialog* aDialog ); |
|
90 void ConstructL(); |
|
91 |
|
92 public: |
|
93 |
|
94 TBool TestL( TInt aAttr ); |
|
95 void Test1L( TInt aAttr ); |
|
96 void Test2L( TInt aAttr ); |
|
97 void PrintTimeL( const TDesC& aText ); |
|
98 void SetTime(); |
|
99 |
|
100 private: |
|
101 void NextListItemL(); |
|
102 void MovePositionL(); |
|
103 void NextFolderL(); |
|
104 |
|
105 private: |
|
106 void SimulateKeyEventL( TInt aEvent ); |
|
107 void SimulateOpenEventL(); |
|
108 void SimulateBackEventL(); |
|
109 void SimulateSearchEventL(); |
|
110 |
|
111 private: // from MMFActiveCallerObserver |
|
112 void HandleActiveCallL( TInt aCallId ); |
|
113 |
|
114 private: |
|
115 void SetScreenSaverPeriod( TInt aPeriod ); |
|
116 void SetScreenSaverPeriodL( TInt aPeriod ); |
|
117 TInt ScreenSaverPeriodL(); |
|
118 private: |
|
119 static TInt64 TimeAfter( TTime aBefore ); |
|
120 static TTime TimeBefore(); |
|
121 private: |
|
122 void ShowPopupNoteL( const TDesC& aText ); |
|
123 |
|
124 |
|
125 public: |
|
126 TTime iTime; |
|
127 TInt iTestCounter; |
|
128 TInt iBottomVisited; |
|
129 TInt* iDestroyedPtr; |
|
130 private: |
|
131 CMediaFileDialog* iDlg; |
|
132 CRandomNum* iRandomNum; |
|
133 CMFActiveCaller* iTestCaller; |
|
134 TInt iNewIndex; |
|
135 TInt iScreenSaverPeriod; |
|
136 |
|
137 // popup note |
|
138 CAknInfoPopupNoteController* iPopupNote; |
|
139 |
|
140 }; |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 /** |
|
146 * CMediaFileDialog3 |
|
147 * |
|
148 */ |
|
149 /* |
|
150 NONSHARABLE_CLASS (CMediaFileDialog3) : public CAknDialog |
|
151 { |
|
152 |
|
153 public:// Constructors and destructor |
|
154 static CMediaFileDialog3* NewL(); |
|
155 virtual ~CMediaFileDialog3(); |
|
156 |
|
157 public: |
|
158 static TBool ShowDialogL(); |
|
159 private: |
|
160 |
|
161 CMediaFileDialog3(); |
|
162 |
|
163 void ConstructL(); |
|
164 |
|
165 private: |
|
166 void PreLayoutDynInitL(); |
|
167 TBool OkToExitL( TInt aButtonId ); |
|
168 void ProcessCommandL(TInt aCommandId); |
|
169 |
|
170 private: |
|
171 CMFVideoPreviewHandler* iVideoPreviewHandler; |
|
172 }; |
|
173 |
|
174 */ |
|
175 |
|
176 |
|
177 /** |
|
178 * TMediaFileHistoryItem |
|
179 * |
|
180 */ |
|
181 NONSHARABLE_CLASS (TMediaFileHistoryItem) |
|
182 { |
|
183 public: |
|
184 void SetId( TInt64 aId ); |
|
185 TInt64 Id(); |
|
186 void SetTime( TTime aTime ); |
|
187 TTime Time(); |
|
188 void InternalizeL( RReadStream& aStream ); |
|
189 void ExternalizeL( RWriteStream& aStream ); |
|
190 |
|
191 |
|
192 public: |
|
193 // media file id |
|
194 TInt64 iId; |
|
195 |
|
196 // time stamp |
|
197 TTime iTime; |
|
198 |
|
199 // media file name and path |
|
200 TFileName iFullName; |
|
201 |
|
202 // does item exist |
|
203 TBool iPresent; |
|
204 }; |
|
205 |
|
206 |
|
207 |
|
208 /** |
|
209 * CMediaFileHistory |
|
210 * |
|
211 * CMediaFileHistory is used for storing list of mediafile ids |
|
212 * (and time stapms). These ids refer to most recently selected |
|
213 * ringing tones. Notice that each media file list client has its |
|
214 * own most recent list (in its private folder). |
|
215 * |
|
216 */ |
|
217 NONSHARABLE_CLASS (CMediaFileHistory) : public CBase |
|
218 { |
|
219 static const TInt KMaxHistoryItemCount = 3; |
|
220 |
|
221 public: |
|
222 static CMediaFileHistory* NewL(); |
|
223 virtual ~CMediaFileHistory(); |
|
224 |
|
225 private: |
|
226 CMediaFileHistory(); |
|
227 void ConstructL(); |
|
228 |
|
229 public: // public api |
|
230 void AddItemL( TInt64 aId ); |
|
231 TInt Count(); |
|
232 void Sort(); |
|
233 void Clean(); |
|
234 void SetPresent( TBool aPresent, TInt aIndex ); |
|
235 void SetFileNameL( const TDesC& aFullName, TInt aIndex ); |
|
236 const TDesC& FileName( TInt aIndex ); |
|
237 TInt64 Id( TInt aIndex ); |
|
238 |
|
239 private: |
|
240 void WriteHistoryL(); |
|
241 void ReadHistoryL(); |
|
242 TInt ItemIndex( TInt aId ); |
|
243 void AddItemL( TMediaFileHistoryItem aItem ); |
|
244 TMediaFileHistoryItem& Item( TInt index ); |
|
245 |
|
246 TBool RemoveOldItem(); |
|
247 void Reset(); |
|
248 |
|
249 private: |
|
250 void InternalizeL( RReadStream& aStream ); |
|
251 void ExternalizeL( RWriteStream& aStream ); |
|
252 |
|
253 |
|
254 private: |
|
255 static TInt CompareItems( const TMediaFileHistoryItem& aFirst, |
|
256 const TMediaFileHistoryItem& aSecond ); |
|
257 |
|
258 private: |
|
259 static void GetTimeText( TDes& aText, TTime aTime ); |
|
260 |
|
261 private: |
|
262 // list of query items |
|
263 RArray<TMediaFileHistoryItem> iList; |
|
264 |
|
265 // file server session |
|
266 RFs iFsSession; |
|
267 |
|
268 // history file path |
|
269 TFileName iPath; |
|
270 }; |
|
271 |
|
272 |
|
273 #endif // #ifdef _DEBUG |
|
274 |
|
275 #endif /*MEDIAFILETEST_H_*/ |