author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:46:07 +0300 | |
branch | RCL_3 |
changeset 57 | 2c87b2808fd7 |
parent 54 | bac7acad7cb3 |
child 67 | 756ad29ed18e |
permissions | -rw-r--r-- |
54 | 1 |
/* |
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
54 | 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: Control for displaying recording progress bar in navi pane. |
|
15 |
*/ |
|
16 |
||
17 |
||
18 |
#ifndef CAMNAVIPROGRESSBARMODEL_H |
|
19 |
#define CAMNAVIPROGRESSBARMODEL_H |
|
20 |
||
21 |
// INCLUDES |
|
22 |
#include <bldvariant.hrh> |
|
23 |
||
24 |
#include <coecntrl.h> |
|
25 |
#include <AknUtils.h> |
|
26 |
#include "CamAppController.h" |
|
27 |
#include "CamSettings.hrh" |
|
28 |
#include "CamResourceLoader.h" |
|
29 |
#include "CamAppUiBase.h" |
|
30 |
#include "CamObservable.h" |
|
31 |
#include "CamObserver.h" |
|
32 |
#include "mcamcameraobserver.h" |
|
33 |
||
34 |
class CCamObserverHandler; |
|
35 |
class CCamTextItem; |
|
36 |
||
37 |
// CONSTANTS |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
38 |
const TInt KMaxRecordTimeTextLength = 40+3; // +3 for separator " /" |
54 | 39 |
|
40 |
// FORWARD DECLARATIONS |
|
41 |
class MAknsSkinInstance; |
|
42 |
class CCamDecorator; |
|
43 |
||
44 |
// CLASS DECLARATION |
|
45 |
||
46 |
/** |
|
47 |
* Control for displaying recording time info in navi pane. |
|
48 |
* @since 2.8 |
|
49 |
*/ |
|
50 |
class CCamNaviProgressBarModel : public CBase, |
|
51 |
public MCamCameraObserver, |
|
52 |
public MCamControllerObserver, |
|
53 |
public MCamResourceLoader, |
|
54 |
public MCamObservable, |
|
55 |
public MCamObserver |
|
56 |
{ |
|
57 |
public: // Constructors and destructor |
|
58 |
||
59 |
/** |
|
60 |
* Static factory construction function |
|
61 |
* @since 2.8 |
|
62 |
* @param aController Reference to CCamAppController |
|
63 |
* @return pointer to constructed instance of CCamNaviProgressBarModel |
|
64 |
*/ |
|
65 |
static CCamNaviProgressBarModel* NewL( CCamAppController& aController ); |
|
66 |
||
67 |
/** |
|
68 |
* Destructor. |
|
69 |
*/ |
|
70 |
virtual ~CCamNaviProgressBarModel(); |
|
71 |
||
72 |
// ------------------------------------------------------- |
|
73 |
// From MCamCameraObserver |
|
74 |
public: |
|
75 |
||
76 |
virtual void HandleCameraEventL( TInt aStatus, |
|
77 |
TCamCameraEventId aEventId, |
|
78 |
TAny* aEventData = NULL ); |
|
79 |
||
80 |
// ------------------------------------------------------- |
|
81 |
public: |
|
82 |
||
83 |
/** |
|
84 |
* Draw Navi-progress bar |
|
85 |
* @since 3.0 |
|
86 |
* @param aGc Handle to Window graphics context |
|
87 |
* @param aControl Pointer to the Control |
|
88 |
*/ |
|
89 |
void DrawProgressBar( CBitmapContext& aGc, const CCoeControl* aControl ) const; |
|
90 |
||
91 |
/** |
|
92 |
* Sets a new extent to render into |
|
93 |
* @param aExtent New extent |
|
94 |
*/ |
|
95 |
void SetExtentL( const TRect& aExtent ); |
|
96 |
||
97 |
/** |
|
98 |
* Returns the rect used for progress bar and |
|
99 |
* elapsed/remaining videotime |
|
100 |
*/ |
|
101 |
TRect ProgPaneRect(); |
|
102 |
||
103 |
protected: |
|
104 |
||
105 |
/** |
|
106 |
* C++ constructor. |
|
107 |
* @since 2.8 |
|
108 |
* @param aController Reference to CCamAppController |
|
109 |
*/ |
|
110 |
CCamNaviProgressBarModel( CCamAppController& aController ); |
|
111 |
||
112 |
/** |
|
113 |
* Symbian OS 2nd phase constructor. |
|
114 |
* @since 2.8 |
|
115 |
*/ |
|
116 |
void ConstructL(); |
|
117 |
||
118 |
private: // Functions from base classes |
|
119 |
||
120 |
/** |
|
121 |
* From CCoeControl Draw the view |
|
122 |
* @since 3.0 |
|
123 |
* @param aGc Handle to Window graphics context |
|
124 |
* @param aControl Pointer to the control |
|
125 |
*/ |
|
126 |
virtual void DrawProgBar( CBitmapContext& aGc, const CCoeControl* aControl ) const; |
|
127 |
||
128 |
||
129 |
/** |
|
130 |
* From MCamControllerObserver |
|
131 |
* Handle an event from CCamAppController. |
|
132 |
* @since 2.8 |
|
133 |
* @param aEvent the type of event |
|
134 |
* @param aError error code |
|
135 |
*/ |
|
136 |
virtual void HandleControllerEventL( TCamControllerEvent aEvent, |
|
137 |
TInt aError ); |
|
138 |
||
139 |
public: // From MCamResourceLoader |
|
140 |
||
141 |
/** |
|
142 |
* From MCamResourceLoader |
|
143 |
* @since 3.0 |
|
144 |
*/ |
|
145 |
void LoadResourceDataL(); |
|
146 |
||
147 |
/** |
|
148 |
* From MCamResourceLoader |
|
149 |
* @since 3.0 |
|
150 |
*/ |
|
151 |
void UnloadResourceData(); |
|
152 |
||
153 |
/** |
|
154 |
* From MCamResourceLoader |
|
155 |
* @since 3.0 |
|
156 |
*/ |
|
157 |
void ReloadResourceDataL(); |
|
158 |
||
159 |
public: // From MCamObservable |
|
160 |
||
161 |
/** |
|
162 |
* From MCamObservable |
|
163 |
* @param aObserver Observer to register |
|
164 |
* @since 3.0 |
|
165 |
*/ |
|
166 |
void RegisterObserverL(MCamObserver* aObserver); |
|
167 |
||
168 |
/** |
|
169 |
* From MCamObservable |
|
170 |
* @param aObserver Observer to deregister |
|
171 |
* @since 3.0 |
|
172 |
*/ |
|
173 |
void DeregisterObserver(MCamObserver* aObserver); |
|
174 |
||
175 |
/** |
|
176 |
* From MCamObservable |
|
177 |
* @param aEvent Event code to broadcast |
|
178 |
* @since 3.0 |
|
179 |
*/ |
|
180 |
void BroadcastEvent(TCamObserverEvent aEvent); |
|
181 |
||
182 |
public: // From MCamObserver |
|
183 |
||
184 |
/** |
|
185 |
* From MCamObserver |
|
186 |
* @param aEvent The event code |
|
187 |
* @since 3.0 |
|
188 |
*/ |
|
189 |
virtual void HandleObservedEvent(TCamObserverEvent aEvent); |
|
190 |
||
191 |
private: // New functions |
|
192 |
||
193 |
/** |
|
194 |
* Formats the elapsed/remaining record times |
|
195 |
* @since 2.8 |
|
196 |
*/ |
|
197 |
void FormatTimeL(); |
|
198 |
||
199 |
/** |
|
200 |
* Draws the elapsed record time to the navi pane |
|
201 |
* @since 2.8 |
|
202 |
*/ |
|
203 |
void DrawElapsedTimeText( CBitmapContext& aGc ) const; |
|
204 |
||
205 |
/** |
|
206 |
* Draws the remaining record time to the navi pane |
|
207 |
* @since 2.8 |
|
208 |
*/ |
|
209 |
void DrawRemainingTimeText( CBitmapContext& aGc, |
|
210 |
MAknsSkinInstance* aSkin ) const; |
|
211 |
||
212 |
/** |
|
213 |
* Draws the progress bar in the navi pane |
|
214 |
*/ |
|
215 |
void DrawProgressBar( CBitmapContext& aGc ) const; |
|
216 |
||
217 |
/** |
|
218 |
* Callback for the minute-minder flash timer |
|
219 |
*/ |
|
220 |
static TInt FlashCallBack( TAny* aAny ); |
|
221 |
||
222 |
/** |
|
223 |
* Read nontouch layout for primary camera |
|
224 |
*/ |
|
225 |
void NonTouchLayoutL(); |
|
226 |
||
227 |
/** |
|
228 |
* Read nontouch layout for secondary camera |
|
229 |
*/ |
|
230 |
void NonTouchLayoutSecondaryL(); |
|
231 |
||
232 |
/** |
|
233 |
* Read touch layout |
|
234 |
*/ |
|
235 |
void TouchLayoutL(); |
|
236 |
||
237 |
protected: //data |
|
238 |
||
239 |
CCamAppController& iController; |
|
240 |
||
241 |
TTimeIntervalMicroSeconds iRecordTimeElapsed; |
|
242 |
TTimeIntervalMicroSeconds iRecordTimeRemaining; |
|
243 |
||
244 |
TBuf<KMaxRecordTimeTextLength> iElapsedTimeText; |
|
245 |
TBuf<KMaxRecordTimeTextLength> iRemainingTimeText; |
|
246 |
||
247 |
// Rectangle for drawing the elapsed time text to. |
|
248 |
TAknLayoutText iElapsedTimeTextLayout; |
|
249 |
TAknLayoutText iRemainingTimeTextLayout; |
|
250 |
||
251 |
TRect iProgPaneRect; |
|
252 |
||
253 |
// own |
|
254 |
CCamTextItem* iElapsedTimeTextItem; |
|
255 |
||
256 |
// own |
|
257 |
CCamTextItem* iRemainingTimeTextItem; |
|
258 |
||
259 |
CFbsBitmap* iPhoneIcon; |
|
260 |
CFbsBitmap* iPhoneIconMask; |
|
261 |
CFbsBitmap* iMMCIcon; |
|
262 |
CFbsBitmap* iMMCIconMask; |
|
263 |
CFbsBitmap* iMassStorageIcon; |
|
264 |
CFbsBitmap* iMassStorageIconMask; |
|
265 |
||
266 |
/** |
|
267 |
* Progress bar graphic. |
|
268 |
* |
|
269 |
* Own. |
|
270 |
*/ |
|
271 |
CFbsBitmap* iProgressBarBitmap; |
|
272 |
||
273 |
/** |
|
274 |
* Mask for progress bar graphic. |
|
275 |
* |
|
276 |
* Own. |
|
277 |
*/ |
|
278 |
CFbsBitmap* iProgressBarMask; |
|
279 |
||
280 |
/** |
|
281 |
* Background for progress bar area. |
|
282 |
* |
|
283 |
* Own. |
|
284 |
*/ |
|
285 |
CFbsBitmap* iProgressBarFrame; |
|
286 |
||
287 |
TCamMediaStorage iStorageLocation; |
|
288 |
||
289 |
// Resource string used to format the time text |
|
290 |
HBufC* iTimeFormat; |
|
291 |
||
292 |
TAknLayoutRect iProgressIconRect; |
|
293 |
TAknLayoutRect iProgressBarRect; |
|
294 |
||
295 |
// Layout information for the video storage icon. |
|
296 |
TAknLayoutRect iVidStorageIconRect; |
|
297 |
||
298 |
TCamOrientation iCamOrientation; |
|
299 |
||
300 |
CCamDecorator* iDecorator; |
|
301 |
||
302 |
// Rect to draw into |
|
303 |
TRect iExtent; |
|
304 |
||
305 |
// Handles observers |
|
306 |
CCamObserverHandler* iObserverHandler; |
|
307 |
||
308 |
// Timer for the flashing of the elapsed time every minute |
|
309 |
CPeriodic* iFlashingTimer; |
|
310 |
||
311 |
// When true, the elapsed time isn't drawn |
|
312 |
TBool iFlash; |
|
313 |
}; |
|
314 |
||
315 |
#endif // CAMNAVIPROGRESSBARMODEL_H |
|
316 |
||
317 |
// End of File |