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