--- a/camerauis/cameraxui/cxengine/src/cxevideocapturecontroldesktop.cpp Thu Sep 02 20:14:28 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontroldesktop.cpp Fri Sep 17 08:27:13 2010 +0300
@@ -30,6 +30,7 @@
{
// Unit is milliseconds
static const int CXENGINE_ELAPSED_TIME_TIMEOUT = 1000; // 1 second
+ static const int VIEWFINDER_START_TIMEOUT = 500; // 0.5 second
// Unit is seconds
static const int CXENGINE_MAXIMUM_VIDEO_TIME = 90*60; // 90 minutes
@@ -60,6 +61,11 @@
qRegisterMetaType<CxeVideoCaptureControl::State> ();
initializeStates();
setupElapseTimer();
+
+ mViewFinderStartTimer.setSingleShot(true);
+ mViewFinderStartTimer.setInterval(VIEWFINDER_START_TIMEOUT);
+ connect(&mViewFinderStartTimer, SIGNAL(timeout()), this, SLOT(startViewfinder()));
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -108,6 +114,10 @@
CX_DEBUG_EXIT_FUNCTION();
return;
}
+
+ mViewFinderStartTimer.stop();
+ mViewfinderControl.stop();
+
// stop video-recording in-case if its ongoing.
stop();
@@ -224,7 +234,8 @@
emit prepareZoomForVideo();
}
- mViewfinderControl.start();
+ // Start viewfinder with delay.
+ mViewFinderStartTimer.start();
setState(Ready);
// emit video prepare status
@@ -319,7 +330,7 @@
* @Return current video snapshot
*/
QPixmap CxeVideoCaptureControlDesktop::snapshot() const
-{
+{
return mSnapshot;
}
@@ -341,7 +352,7 @@
if (state() == Ready || state() == Paused) {
//we skip the playing of the sound in the desktop state for now
- setState(Recording);
+ setState(Recording);
mRecordElapseTimer.start();
}
@@ -373,14 +384,13 @@
if (state() == Recording || state() == Paused) {
mFilenameGenerator.raiseCounterValue();
- }
+
+ mRecordElapseTimer.stop();
+ mElapsedTime = 0;
- mViewfinderControl.stop();
- mRecordElapseTimer.stop();
- mElapsedTime = 0;
-
- setState(Stopping);
- setState(Initialized);
+ setState(Stopping);
+ setState(Initialized);
+ }
CX_DEBUG_EXIT_FUNCTION();
}
@@ -541,6 +551,18 @@
CX_DEBUG( ("CxeVideoCaptureControlDesktop::handleElapseTimeout() <> mElapsedTime: %d", mElapsedTime ) );
}
+/*!
+* Slot for starting viewfinder after a delay.
+* Delay helps viewfinder widget to find the right, visible transparent window to attach to.
+*/
+void CxeVideoCaptureControlDesktop::startViewfinder()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mViewfinderControl.start();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
void CxeVideoCaptureControlDesktop::setState(CxeVideoCaptureControl::State stateId, CxeError::Id error)
{
mState = stateId;