camerauis/cameraxui/cxengine/src/cxestillcapturecontroldesktop.cpp
changeset 60 a289dde0a1d6
parent 48 42ba2d16bf40
equal deleted inserted replaced
56:01e205c615b9 60:a289dde0a1d6
    30 #include "cxeautofocuscontrol.h"
    30 #include "cxeautofocuscontrol.h"
    31 #include "cxestate.h"
    31 #include "cxestate.h"
    32 #include "cxecameradevicedesktop.h"
    32 #include "cxecameradevicedesktop.h"
    33 
    33 
    34 // constants
    34 // constants
    35 const int KMaintainAspectRatio = false;
    35 namespace
    36 
    36 {
       
    37     static const int KMaintainAspectRatio = false;
       
    38     static const int VIEWFINDER_START_TIMEOUT = 500; // 0.5 second
       
    39 }
    37 
    40 
    38 
    41 
    39 /**
    42 /**
    40  * Constructor.
    43  * Constructor.
    41  */
    44  */
    60 
    63 
    61     qRegisterMetaType<CxeStillCaptureControl::State>();
    64     qRegisterMetaType<CxeStillCaptureControl::State>();
    62     initializeStates();
    65     initializeStates();
    63     reset();
    66     reset();
    64 
    67 
       
    68     mViewFinderStartTimer.setSingleShot(true);
       
    69     mViewFinderStartTimer.setInterval(VIEWFINDER_START_TIMEOUT);
       
    70     connect(&mViewFinderStartTimer, SIGNAL(timeout()), this, SLOT(startViewfinder()));
       
    71 
    65     mImageDataQueue = new CxeImageDataQueueDesktop();
    72     mImageDataQueue = new CxeImageDataQueueDesktop();
    66 
    73 
    67     CX_DEBUG_EXIT_FUNCTION();
    74     CX_DEBUG_EXIT_FUNCTION();
    68 }
    75 }
    69 
    76 
   129     if (state() == Uninitialized) {
   136     if (state() == Uninitialized) {
   130         // nothing to do
   137         // nothing to do
   131         CX_DEBUG_EXIT_FUNCTION();
   138         CX_DEBUG_EXIT_FUNCTION();
   132         return;
   139         return;
   133     }
   140     }
       
   141 
       
   142     mViewFinderStartTimer.stop();
       
   143     mViewfinderControl.stop();
       
   144 
   134     mState = Uninitialized;
   145     mState = Uninitialized;
   135     CX_DEBUG_EXIT_FUNCTION();
   146     CX_DEBUG_EXIT_FUNCTION();
   136 }
   147 }
   137 
   148 
   138 
   149 
   171     } else {
   182     } else {
   172         err = 0;
   183         err = 0;
   173     }
   184     }
   174 
   185 
   175     if (!err) {
   186     if (!err) {
   176         // If viewfinder is already running, this call does nothing
   187         // Start viewfinder with delay.
   177         mViewfinderControl.start();
   188         mViewFinderStartTimer.start();
   178         // inform zoom control to prepare zoom
   189         // inform zoom control to prepare zoom
   179         emit prepareZoomForStill(ecamStillResolutionIndex);
   190         emit prepareZoomForStill(ecamStillResolutionIndex);
   180     } else {
   191     } else {
   181         CX_DEBUG(("Image Prepare FAILED! symbian error = %d", err));
   192         CX_DEBUG(("Image Prepare FAILED! symbian error = %d", err));
   182     }
   193     }
   571          mode != CxeAutoFocusControl::Infinity) {
   582          mode != CxeAutoFocusControl::Infinity) {
   572     }
   583     }
   573     CX_DEBUG_EXIT_FUNCTION();
   584     CX_DEBUG_EXIT_FUNCTION();
   574 }
   585 }
   575 
   586 
       
   587 /*!
       
   588 * Slot for starting viewfinder after a delay.
       
   589 * Delay helps viewfinder widget to find the right, visible transparent window to attach to.
       
   590 */
       
   591 void CxeStillCaptureControlDesktop::startViewfinder()
       
   592 {
       
   593     CX_DEBUG_ENTER_FUNCTION();
       
   594     mViewfinderControl.start();
       
   595     CX_DEBUG_EXIT_FUNCTION();
       
   596 }
       
   597 
   576 
   598 
   577 /*!
   599 /*!
   578 * Returns supported image qualities based on the camera index
   600 * Returns supported image qualities based on the camera index
   579 * (primary/secondary).
   601 * (primary/secondary).
   580 */
   602 */