diff -r 01e205c615b9 -r a289dde0a1d6 camerauis/cameraxui/cxengine/src/cxestillcapturecontroldesktop.cpp --- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontroldesktop.cpp Thu Sep 02 20:14:28 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontroldesktop.cpp Fri Sep 17 08:27:13 2010 +0300 @@ -32,8 +32,11 @@ #include "cxecameradevicedesktop.h" // constants -const int KMaintainAspectRatio = false; - +namespace +{ + static const int KMaintainAspectRatio = false; + static const int VIEWFINDER_START_TIMEOUT = 500; // 0.5 second +} /** @@ -62,6 +65,10 @@ initializeStates(); reset(); + mViewFinderStartTimer.setSingleShot(true); + mViewFinderStartTimer.setInterval(VIEWFINDER_START_TIMEOUT); + connect(&mViewFinderStartTimer, SIGNAL(timeout()), this, SLOT(startViewfinder())); + mImageDataQueue = new CxeImageDataQueueDesktop(); CX_DEBUG_EXIT_FUNCTION(); @@ -131,6 +138,10 @@ CX_DEBUG_EXIT_FUNCTION(); return; } + + mViewFinderStartTimer.stop(); + mViewfinderControl.stop(); + mState = Uninitialized; CX_DEBUG_EXIT_FUNCTION(); } @@ -173,8 +184,8 @@ } if (!err) { - // If viewfinder is already running, this call does nothing - mViewfinderControl.start(); + // Start viewfinder with delay. + mViewFinderStartTimer.start(); // inform zoom control to prepare zoom emit prepareZoomForStill(ecamStillResolutionIndex); } else { @@ -573,6 +584,17 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! +* Slot for starting viewfinder after a delay. +* Delay helps viewfinder widget to find the right, visible transparent window to attach to. +*/ +void CxeStillCaptureControlDesktop::startViewfinder() +{ + CX_DEBUG_ENTER_FUNCTION(); + mViewfinderControl.start(); + CX_DEBUG_EXIT_FUNCTION(); +} + /*! * Returns supported image qualities based on the camera index