camerauis/cameraxui/cxengine/inc/cxesnapshotcontrol.h
changeset 29 699651f2666f
child 37 64817133cd1d
equal deleted inserted replaced
24:2094593137f5 29:699651f2666f
       
     1 /*
       
     2 * Copyright (c) 2010 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CXESNAPSHOTCONTROL_H
       
    19 #define CXESNAPSHOTCONTROL_H
       
    20 
       
    21 #include <QObject>
       
    22 #include "cxeerror.h"
       
    23 
       
    24 class CxeCameraDevice;
       
    25 class CxeSnapshotControlPrivate;
       
    26 
       
    27 /*!
       
    28 * Snapshot control class.
       
    29 */
       
    30 class CxeSnapshotControl : public QObject
       
    31 {
       
    32     Q_OBJECT
       
    33 
       
    34 public:
       
    35 
       
    36     // State Machine
       
    37     enum State {
       
    38         //! Idle, snapshot not active.
       
    39         Idle   = 0x01,
       
    40         //! Active, snapshot events provided after successful capture.
       
    41         Active = 0x02
       
    42     };
       
    43 
       
    44 
       
    45     explicit CxeSnapshotControl(CxeCameraDevice &device);
       
    46     virtual ~CxeSnapshotControl();
       
    47 
       
    48 public:
       
    49     State state() const;
       
    50     QSize calculateSnapshotSize(const QSize& displaySize, const QSize& outputResolution) const;
       
    51     void start(const QSize& size);
       
    52     void stop();
       
    53 
       
    54 signals:
       
    55     void stateChanged(CxeSnapshotControl::State newState, CxeError::Id status);
       
    56     void snapshotReady(CxeError::Id status, const QPixmap& snapshot);
       
    57 
       
    58 public slots:
       
    59     void handleCameraEvent(int id, int error);
       
    60 
       
    61 private:
       
    62     CxeSnapshotControlPrivate *d;
       
    63 
       
    64     Q_DISABLE_COPY(CxeSnapshotControl)
       
    65     friend class CxeSnapshotControlPrivate;
       
    66 };
       
    67 
       
    68 Q_DECLARE_METATYPE(CxeSnapshotControl::State)
       
    69 
       
    70 #endif // CXESNAPSHOTCONTROL_H