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 #include "cxenamespace.h" |
|
24 |
|
25 class CxeCameraDevice; |
|
26 class CxeSnapshotControlPrivate; |
|
27 |
|
28 /*! |
|
29 * Snapshot control class. |
|
30 */ |
|
31 class CxeSnapshotControl : public QObject |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 |
|
37 // State Machine |
|
38 enum State { |
|
39 //! Idle, snapshot not active. |
|
40 Idle = 0x01, |
|
41 //! Active, snapshot events provided after successful capture. |
|
42 Active = 0x02 |
|
43 }; |
|
44 |
|
45 |
|
46 explicit CxeSnapshotControl(CxeCameraDevice &device); |
|
47 virtual ~CxeSnapshotControl(); |
|
48 |
|
49 public: |
|
50 State state() const; |
|
51 QSize calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const; |
|
52 void start(const QSize &size); |
|
53 void stop(); |
|
54 |
|
55 signals: |
|
56 void stateChanged(CxeSnapshotControl::State newState, CxeError::Id status); |
|
57 void snapshotReady(CxeError::Id status, const QImage &snapshot); |
|
58 |
|
59 public slots: |
|
60 void handleCameraEvent(int id, int error); |
|
61 |
|
62 private: |
|
63 CxeSnapshotControlPrivate *d; |
|
64 |
|
65 Q_DISABLE_COPY(CxeSnapshotControl) |
|
66 friend class CxeSnapshotControlPrivate; |
|
67 }; |
|
68 |
|
69 Q_DECLARE_METATYPE(CxeSnapshotControl::State) |
|
70 |
|
71 #endif // CXESNAPSHOTCONTROL_H |
|