185 * Initialize the still image capture control. |
185 * Initialize the still image capture control. |
186 */ |
186 */ |
187 void CxeStillCaptureControlSymbian::init() |
187 void CxeStillCaptureControlSymbian::init() |
188 { |
188 { |
189 CX_DEBUG_ENTER_FUNCTION(); |
189 CX_DEBUG_ENTER_FUNCTION(); |
190 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_IN, "msg: e_CX_STILL_CAPCONT_INIT 1"); |
|
191 |
190 |
192 if (state() == Uninitialized) { |
191 if (state() == Uninitialized) { |
193 |
192 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_IN, "msg: e_CX_STILL_CAPCONT_INIT 1"); |
|
193 |
194 // prepare for still capture. |
194 // prepare for still capture. |
195 prepare(); |
195 prepare(); |
196 |
196 |
197 // Initialize orientation sensor and other sensors |
197 // Initialize orientation sensor and other sensors |
198 mSensorEventHandler.init(); |
198 mSensorEventHandler.init(); |
199 |
199 |
200 // inform zoom control to prepare zoom |
200 // inform zoom control to prepare zoom |
201 emit prepareZoomForStill(mSizeIndex); |
201 emit prepareZoomForStill(mSizeIndex); |
202 } |
202 |
203 |
203 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_OUT, "msg: e_CX_STILL_CAPCONT_INIT 0"); |
204 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_OUT, "msg: e_CX_STILL_CAPCONT_INIT 0"); |
204 } |
|
205 |
205 CX_DEBUG_EXIT_FUNCTION(); |
206 CX_DEBUG_EXIT_FUNCTION(); |
206 } |
207 } |
207 |
208 |
208 /*! |
209 /*! |
209 * Un-initialize the image mode. |
210 * Un-initialize the image mode. |
210 */ |
211 */ |
211 void CxeStillCaptureControlSymbian::deinit() |
212 void CxeStillCaptureControlSymbian::deinit() |
212 { |
213 { |
213 CX_DEBUG_ENTER_FUNCTION(); |
214 CX_DEBUG_ENTER_FUNCTION(); |
214 |
215 |
215 if (state() == Uninitialized) { |
216 if (state() != Uninitialized) { |
216 // nothing to do |
217 OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" ); |
217 return; |
218 |
218 } |
219 // Stop monitoring disk space. |
219 |
220 mDiskMonitor.stop(); |
220 OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" ); |
221 disconnect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged())); |
221 |
222 |
222 // Stop monitoring disk space. |
223 //stop viewfinder |
223 mDiskMonitor.stop(); |
224 mViewfinderControl.stop(); |
224 disconnect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged())); |
225 |
225 |
226 if (state() == Capturing) { |
226 //stop viewfinder |
227 mCameraDevice.camera()->CancelCaptureImage(); |
227 mViewfinderControl.stop(); |
228 } |
228 |
229 |
229 if (state() == Capturing) { |
230 // disable sensor event handler. |
230 mCameraDevice.camera()->CancelCaptureImage(); |
231 mSensorEventHandler.deinit(); |
231 } |
232 |
232 |
233 mSnapshotControl.stop(); |
233 // disable sensor event handler. |
234 |
234 mSensorEventHandler.deinit(); |
235 setState(Uninitialized); |
235 |
236 |
236 mSnapshotControl.stop(); |
237 OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" ); |
237 |
238 } |
238 setState(Uninitialized); |
239 |
239 |
|
240 OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" ); |
|
241 CX_DEBUG_EXIT_FUNCTION(); |
240 CX_DEBUG_EXIT_FUNCTION(); |
242 } |
241 } |
243 |
242 |
244 |
243 |
245 /*! |
244 /*! |
246 * Prepare still capture mode. |
245 * Prepare still capture mode. |
247 */ |
246 */ |
248 void CxeStillCaptureControlSymbian::prepare() |
247 void CxeStillCaptureControlSymbian::prepare() |
249 { |
248 { |
250 CX_DEBUG_ENTER_FUNCTION(); |
249 CX_DEBUG_ENTER_FUNCTION(); |
251 |
|
252 if (state() != Uninitialized) { |
|
253 // wrong state and we return |
|
254 return; |
|
255 } |
|
256 |
|
257 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1"); |
250 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1"); |
258 |
251 |
259 CxeError::Id status(CxeError::None); |
252 CxeError::Id status(CxeError::None); |
260 |
253 |
261 try { |
254 try { |
277 // Prepare snapshot |
270 // Prepare snapshot |
278 prepareSnapshot(); |
271 prepareSnapshot(); |
279 |
272 |
280 // Start monitoring disk space. |
273 // Start monitoring disk space. |
281 mDiskMonitor.start(); |
274 mDiskMonitor.start(); |
282 connect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged())); |
275 connect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged()), Qt::UniqueConnection); |
283 |
276 |
284 // Enable AF reticule drawing by adaptation |
277 // Enable AF reticule drawing by adaptation |
285 MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking(); |
278 MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking(); |
286 if (faceTracking) { |
279 if (faceTracking) { |
287 TRAP_IGNORE(faceTracking->EnableFaceIndicatorsL(ETrue)); |
280 TRAP_IGNORE(faceTracking->EnableFaceIndicatorsL(ETrue)); |
468 } |
461 } |
469 |
462 |
470 // Emit snapshotReady signal in all cases (error or not) |
463 // Emit snapshotReady signal in all cases (error or not) |
471 emit snapshotReady(status, snapshot, stillImage->id()); |
464 emit snapshotReady(status, snapshot, stillImage->id()); |
472 |
465 |
473 // When the snapshot ready event is handled, prepare new filename. |
|
474 if (stillImage->filename().isEmpty()) { |
|
475 // Error ignored at this point, try again when image data arrives. |
|
476 prepareFilename(stillImage); |
|
477 } |
|
478 |
|
479 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0"); |
466 OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0"); |
480 } |
467 } |
481 |
468 |
482 CX_DEBUG_EXIT_FUNCTION(); |
469 CX_DEBUG_EXIT_FUNCTION(); |
483 } |
470 } |
576 CX_DEBUG_EXIT_FUNCTION(); |
563 CX_DEBUG_EXIT_FUNCTION(); |
577 } |
564 } |
578 |
565 |
579 |
566 |
580 /*! |
567 /*! |
581 * Settings changed, needs updated |
568 * Settings changed, needs updated. |
582 */ |
569 */ |
583 void CxeStillCaptureControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue) |
570 void CxeStillCaptureControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue) |
584 { |
571 { |
585 CX_DEBUG_ENTER_FUNCTION(); |
572 CX_DEBUG_ENTER_FUNCTION(); |
586 |
573 |
587 Q_UNUSED(newValue); |
574 Q_UNUSED(newValue); |
588 |
575 |
589 if (settingId == CxeSettingIds::IMAGE_QUALITY) { |
576 if (settingId == CxeSettingIds::IMAGE_QUALITY) { |
590 // re-prepare for still |
577 // Re-prepare for still, if already prepared. |
591 if (state() == Ready) { |
578 if (state() == Ready) { |
592 deinit(); |
579 // Avoid problems with AF status overlays. |
593 init(); |
580 mAutoFocusControl.cancel(); |
|
581 |
|
582 // Viewfinder and snapshot need to be re-prepared if active. |
|
583 // Stop them now to get proper re-prepare done. |
|
584 mSnapshotControl.stop(); |
|
585 mViewfinderControl.stop(); |
|
586 |
|
587 // Re-prepare image capture for the new quality. |
|
588 prepare(); |
|
589 |
|
590 // Inform zoom control to prepare zoom for new quality. |
|
591 emit prepareZoomForStill(mSizeIndex); |
594 } |
592 } |
595 } |
593 } |
596 |
594 |
597 CX_DEBUG_EXIT_FUNCTION(); |
595 CX_DEBUG_EXIT_FUNCTION(); |
598 } |
596 } |