author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:15:47 +0300 | |
branch | RCL_3 |
changeset 27 | 41fba8bcf7b7 |
parent 25 | c6bafb5162d8 |
child 29 | c9b63fff5abf |
permissions | -rw-r--r-- |
25 | 1 |
/* |
2 |
* Copyright (c) 2002-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: |
|
15 |
* CVRRecView is an CAknView inherited view class that implements |
|
16 |
* the recorder view functionality of Voicer Recorder. |
|
17 |
* It owns the view container (which, in turn, owns all the ui controls) |
|
18 |
* and the view model. |
|
19 |
* |
|
20 |
*/ |
|
21 |
||
22 |
||
23 |
#ifndef __CVRRECVIEW_H__ |
|
24 |
#define __CVRRECVIEW_H__ |
|
25 |
||
26 |
// INCLUDES |
|
27 |
#include <aknview.h> |
|
28 |
#include <VoiceRecorderContexts.h> |
|
29 |
#include <voicerecorder.rsg> |
|
30 |
#include <AknWaitDialog.h> |
|
31 |
||
32 |
#include "MVRSelectionProvider.h" |
|
33 |
#include "MVRLayoutChangeObserver.h" |
|
34 |
#include "voicerecorder.hrh" |
|
35 |
#include "VRUSBStateHanlder.h" |
|
36 |
||
37 |
// FORWARD DECLARATIONS |
|
38 |
class CAknLaunchAppService; |
|
39 |
class CSendUi; |
|
40 |
class CVRRecViewContainer; |
|
41 |
class CVRRecViewActivationContainer; |
|
42 |
class CVRRecViewModel; |
|
43 |
||
44 |
enum TDialogTypeID { |
|
45 |
EDialogForWaitStorageCard = 0, |
|
46 |
EDialogForWaitUSBPluggingOut |
|
47 |
}; |
|
48 |
||
49 |
// CLASS DEFINITION |
|
50 |
/** |
|
51 |
* CVRRecView is an CAknView inherited view class that implements |
|
52 |
* the recorder view functionality of Voicer Recorder. |
|
53 |
* It owns the view container (which, in turn, owns all the ui controls) |
|
54 |
* and the view model. |
|
55 |
*/ |
|
56 |
class CVRRecView : public CAknView, |
|
57 |
public MVRSelectionProvider, |
|
58 |
public MVRLayoutChangeObserver, |
|
59 |
public MVRUSBStateObserver, |
|
60 |
public MProgressDialogCallback |
|
61 |
{ |
|
62 |
private: |
|
63 |
// nested classes |
|
64 |
||
65 |
/* |
|
66 |
* One shot class for model activation. Receives a pointer to |
|
67 |
* constructed CVRRecViewModel object and activates it asynchronically |
|
68 |
* when Activate() is called. |
|
69 |
*/ |
|
70 |
NONSHARABLE_CLASS( CVRRecViewModelActivator ) |
|
71 |
: public CAsyncOneShot |
|
72 |
{ |
|
73 |
public: // constructor and destructor |
|
74 |
CVRRecViewModelActivator( CVRRecViewModel* aModel ); |
|
75 |
~CVRRecViewModelActivator(); |
|
76 |
||
77 |
public: // New functions: |
|
78 |
||
79 |
/** |
|
80 |
* Activate model in given context |
|
81 |
*/ |
|
82 |
void Activate( TVRRecViewContexts aContext, TCallBack aCallback ); |
|
83 |
||
84 |
private: // Functions from base classes |
|
85 |
||
86 |
/** |
|
87 |
* From CActive. |
|
88 |
*/ |
|
89 |
void RunL(); |
|
90 |
void DoCancel(); |
|
91 |
||
92 |
private: // Data: |
|
93 |
||
94 |
/* |
|
95 |
* State machine model, not owned |
|
96 |
*/ |
|
97 |
CVRRecViewModel* iModel; |
|
98 |
||
99 |
/* |
|
100 |
* Context that is used to activate model in RunL |
|
101 |
*/ |
|
102 |
TVRRecViewContexts iContext; |
|
103 |
||
104 |
/* |
|
105 |
* Callback that is called after model is activated |
|
106 |
*/ |
|
107 |
TCallBack iCallback; |
|
108 |
}; |
|
109 |
||
110 |
/* |
|
111 |
* One shot class for note pop-up |
|
112 |
*/ |
|
113 |
NONSHARABLE_CLASS( CVRRecViewDialogActivator ) |
|
114 |
: public CAsyncOneShot |
|
115 |
{ |
|
116 |
public: // constructor and destructor |
|
117 |
CVRRecViewDialogActivator( CVRRecViewModel* aModel); |
|
118 |
~CVRRecViewDialogActivator(); |
|
119 |
||
120 |
public: // new method |
|
121 |
void SetDialogType(TDialogTypeID aType); |
|
122 |
||
123 |
void SetViewContexts(TVRRecViewContexts aContext); |
|
124 |
||
125 |
private: // Functions from base classes |
|
126 |
||
127 |
/** |
|
128 |
* From CActive. |
|
129 |
*/ |
|
130 |
void RunL(); |
|
131 |
void DoCancel(); |
|
132 |
||
133 |
private: // Data: |
|
134 |
||
135 |
/* |
|
136 |
* State machine model, not owned |
|
137 |
*/ |
|
138 |
CVRRecViewModel* iModel; |
|
139 |
||
140 |
/* |
|
141 |
* The type of dialog |
|
142 |
*/ |
|
143 |
TDialogTypeID iType; |
|
144 |
||
145 |
/* |
|
146 |
* Context that is used to activate model |
|
147 |
*/ |
|
148 |
TVRRecViewContexts iContext; |
|
149 |
}; |
|
150 |
||
151 |
||
152 |
public: // Constructors and destructor |
|
153 |
||
154 |
/** |
|
155 |
* Static constructor. |
|
156 |
* @param aViewResourceId The resource used in view construction. |
|
157 |
* @param aModelResourceId The resource used in model construction. |
|
158 |
*/ |
|
159 |
IMPORT_C static CVRRecView* NewLC( TInt aViewResourceId, |
|
160 |
TInt aModelResourceId ); |
|
161 |
||
162 |
/** |
|
163 |
* Destructor |
|
164 |
*/ |
|
165 |
~CVRRecView(); |
|
166 |
||
167 |
private: // Constructors |
|
168 |
||
169 |
/** |
|
170 |
* Default constructor. |
|
171 |
* The inline saves a few bytes. |
|
172 |
*/ |
|
173 |
inline CVRRecView() {}; |
|
174 |
||
175 |
/** |
|
176 |
* 2nd phase constructor. |
|
177 |
* @param aViewResourceId The resource used in view construction. |
|
178 |
* @param aModelResourceId The resource used in model construction. |
|
179 |
*/ |
|
180 |
void ConstructL( TInt aViewResourceId, TInt aModelResourceId ); |
|
181 |
||
182 |
public: // from MVRSelectionProvider |
|
183 |
||
184 |
/** |
|
185 |
* Returns an array of currently selected files. |
|
186 |
* Ownership is transferred. Caller must destroy the returned array. |
|
187 |
* @param aStyle Used to return the style of selection |
|
188 |
* (empty/focused/marked) |
|
189 |
* @return An array of selected files (0 or more). |
|
190 |
*/ |
|
191 |
MDesCArray* GetSelectedFilesLC( TVRSelectionStyle& aStyle ) const; |
|
192 |
||
193 |
/** |
|
194 |
* Pass the file handle to recview. |
|
195 |
* Recorded memo is placed there. |
|
196 |
* @param aFile File handle |
|
197 |
*/ |
|
198 |
void SetFileHandle( RFile& aFile ); |
|
199 |
||
200 |
/** |
|
201 |
* Return the recorded open file handle |
|
202 |
* @param aFile File handle |
|
203 |
*/ |
|
204 |
RFile& GetFile(); |
|
205 |
||
206 |
public: // from MVRLayoutChangeObserver |
|
207 |
||
208 |
/** |
|
209 |
* This method gets called by the AppUI when a dynamic layout change |
|
210 |
* event occurs. |
|
211 |
*/ |
|
212 |
void LayoutChangedL( TInt aType ); |
|
213 |
||
214 |
public: // from CAknView |
|
215 |
||
216 |
/** |
|
217 |
* Returns the id of the view. |
|
218 |
* @return KVRRecViewUID |
|
219 |
*/ |
|
220 |
TUid Id() const; |
|
221 |
||
222 |
/** |
|
223 |
* Handles menu commands. |
|
224 |
* @param aCommand Command identifier. |
|
225 |
*/ |
|
226 |
void HandleCommandL( TInt aCommandId ); |
|
227 |
||
228 |
protected: // from CAknView |
|
229 |
||
230 |
/** |
|
231 |
* Dynamically initialises a menu pane. The Uikon framework calls this |
|
232 |
* function, immediately before the menu pane is activated. |
|
233 |
* @param aResourceId Resource ID identifying a menu pane to initialise |
|
234 |
* @param aMenuPane The in-memory representation of the menu pane. |
|
235 |
*/ |
|
236 |
void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
237 |
||
238 |
/** |
|
239 |
* Foreground event handling function. |
|
240 |
* |
|
241 |
* Called by UI Framework when view switches to and from foreground |
|
242 |
* |
|
243 |
* @param aForeground True if view is switched to foreground else false. |
|
244 |
*/ |
|
245 |
// void HandleForegroundEventL( TBool aForeground ); |
|
246 |
||
247 |
private: // from CAknView |
|
248 |
||
249 |
/** |
|
250 |
* Is called by the framework when the view is activated. |
|
251 |
* @param aPrevViewId Id of the previous view that was active |
|
252 |
* @param aCustomMessageId Id of the custom message passed |
|
253 |
* @param aCustomMessage Descriptor containing the custom message data |
|
254 |
*/ |
|
255 |
void DoActivateL( const TVwsViewId& aPrevViewId, |
|
256 |
TUid aCustomMessageId, |
|
257 |
const TDesC8& aCustomMessage ); |
|
258 |
||
259 |
/** |
|
260 |
* Is called by the framework when the view is deactivated. |
|
261 |
*/ |
|
262 |
void DoDeactivate(); |
|
263 |
||
264 |
protected: // from MCoeView |
|
265 |
||
266 |
/** |
|
267 |
* Is called by the view server when the application goes to background. |
|
268 |
*/ |
|
269 |
void ViewDeactivated(); |
|
270 |
||
271 |
/** |
|
272 |
* Is called by the view server when the application goes to the foreground. |
|
273 |
*/ |
|
274 |
void ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); |
|
275 |
||
276 |
public: // from CAknView |
|
277 |
||
278 |
/** |
|
279 |
* Returns a pointer to the CBA container |
|
280 |
* Calls base class Cba() (which is protected) |
|
281 |
*/ |
|
282 |
CEikButtonGroupContainer* Cba() const; |
|
283 |
||
284 |
/** |
|
285 |
* Returns a the StateId |
|
286 |
* |
|
287 |
*/ |
|
288 |
TUint GetStateId() const; |
|
289 |
||
290 |
/** |
|
291 |
* Returns embedding status. |
|
292 |
* @param ETrue if the current context is an embedded one. |
|
293 |
*/ |
|
294 |
TBool IsEmbedded() const; |
|
295 |
||
296 |
/** |
|
297 |
* Returns the active quality setting. |
|
298 |
* @return Quality setting of the active memo |
|
299 |
*/ |
|
300 |
TVRQuality Quality() const; |
|
301 |
||
302 |
private: // new methods |
|
303 |
||
304 |
/** |
|
305 |
* Dynamically adds a Send Via menu item plus associated cascade |
|
306 |
* to the given menu pane. |
|
307 |
* @param aResourceId Resource ID identifying a menu pane |
|
308 |
* @param aMenuPane The in-memory representation of the menu pane. |
|
309 |
*/ |
|
310 |
void AddSendToMenuL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
311 |
||
312 |
/* |
|
313 |
* Trappable version of DoActivateL. Activates an empty UI container |
|
314 |
* and starts asynchronic model activation. |
|
315 |
* See CAknView::DoActivateL for parameters |
|
316 |
*/ |
|
317 |
void ReallyDoActivateL( const TVwsViewId& aPrevViewId, |
|
318 |
TUid aCustomMessageId, |
|
319 |
const TDesC8& aCustomMessage ); |
|
320 |
||
321 |
/* |
|
322 |
* Called by iModelActivator object after model has been |
|
323 |
* fully activated. |
|
324 |
* @param aRecView Always a valid pointer to CVRRecView object |
|
325 |
* @return Return value required by TCallBack, not used. |
|
326 |
*/ |
|
327 |
static TInt ActivationCallBack(TAny* aRecView); |
|
328 |
||
329 |
/* |
|
330 |
* Non-static method called by ActivationCallBack. Activates |
|
331 |
* the actual UI container and deletes the empty one. |
|
332 |
*/ |
|
333 |
void ActivateContainerL(); |
|
334 |
||
335 |
/* |
|
336 |
* Check the current state of drives |
|
337 |
*/ |
|
338 |
void CheckDriveState(); |
|
339 |
||
340 |
/** |
|
341 |
* This method show a dialog to warn user to insert the SD card. |
|
342 |
* @return if user insert the SD card or not |
|
343 |
*/ |
|
344 |
static TBool ShowDialogForWaitStorageCardL(); |
|
345 |
||
346 |
/** |
|
347 |
* Make user insert the SD card, and choose SD card as the memo storage |
|
348 |
*/ |
|
349 |
void SetDriveL(); |
|
350 |
||
351 |
public: |
|
352 |
virtual TInt HandleUsbPlugInL(); |
|
353 |
virtual TInt HandleUsbPlugOutL(); |
|
354 |
||
355 |
virtual void DialogDismissedL( TInt aButtonId ); |
|
356 |
||
357 |
private: |
|
358 |
// data |
|
359 |
||
360 |
/** |
|
361 |
* Pointer to the UI control container. Owned. |
|
362 |
*/ |
|
363 |
CVRRecViewContainer* iContainer; |
|
364 |
||
365 |
/** |
|
366 |
* Pointer to the container that is displayed during |
|
367 |
* model construction. Owned |
|
368 |
*/ |
|
369 |
CVRRecViewActivationContainer* iActivationContainer; |
|
370 |
||
371 |
/** |
|
372 |
* Pointer to the view model (statemachine). Owned. |
|
373 |
*/ |
|
374 |
CVRRecViewModel* iModel; |
|
375 |
||
376 |
/** |
|
377 |
* SendUi used to implement the Send Via feature. Owned. |
|
378 |
*/ |
|
379 |
CSendUi* iSendUi; |
|
380 |
||
381 |
/** |
|
382 |
* One shot object that is used to activate model in correct context |
|
383 |
* asynchronically. Owned. |
|
384 |
*/ |
|
385 |
CVRRecViewModelActivator* iModelActivator; |
|
386 |
||
387 |
/** |
|
388 |
* One shot object that is used to pop up the note |
|
389 |
*/ |
|
390 |
CVRRecViewDialogActivator* iDialogActivator; |
|
391 |
||
392 |
/** |
|
393 |
* The type of dialog |
|
394 |
*/ |
|
395 |
TDialogTypeID iDialogType; |
|
396 |
||
397 |
/** |
|
398 |
* The command that passed to Handlecommand |
|
399 |
* |
|
400 |
*/ |
|
401 |
TInt iCommand; |
|
402 |
||
403 |
CAknLaunchAppService* iLaunchService; |
|
404 |
||
405 |
CAknWaitDialog* iUsbWaitDialog; |
|
406 |
||
407 |
CVRUSBStateHanlder* iUSBStateHandler; |
|
408 |
||
409 |
/* |
|
410 |
* Context that is used to activate model |
|
411 |
*/ |
|
412 |
TVRRecViewContexts iContext; |
|
27
41fba8bcf7b7
Revision: 201034
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
413 |
|
41fba8bcf7b7
Revision: 201034
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
414 |
/** |
41fba8bcf7b7
Revision: 201034
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
415 |
* Own: Indicates USB connection dialog is open or not. |
41fba8bcf7b7
Revision: 201034
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
416 |
* If value is ETrue, don't try to open it again. |
41fba8bcf7b7
Revision: 201034
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
417 |
*/ |
41fba8bcf7b7
Revision: 201034
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
418 |
TBool iUSBConnectedDialogOpen; |
25 | 419 |
}; |
420 |
||
421 |
#endif // __CVRRECVIEW_H__ |
|
422 |