1 /* |
|
2 * Copyright (c) 2009-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 CXEAUTOFOCUSCONTROL_H |
|
19 #define CXEAUTOFOCUSCONTROL_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QMetaType> |
|
23 #include "cxeerror.h" |
|
24 |
|
25 class QImage; |
|
26 |
|
27 |
|
28 /** |
|
29 * CxeAutoFocusControl is responsible for handling Autofocus events from the camera adaptation. |
|
30 * It also routes the Autofocus successful and failed events to the clients interested in Žknowing the |
|
31 * status of Autofocus. |
|
32 */ |
|
33 class CxeAutoFocusControl : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 public: |
|
37 |
|
38 /* |
|
39 * Autofocus control states. |
|
40 */ |
|
41 enum State |
|
42 { |
|
43 //! focusing |
|
44 InProgress = 0x01, |
|
45 |
|
46 //! Autofocus Failed |
|
47 Failed = 0x02, |
|
48 |
|
49 //! Focused |
|
50 Ready = 0x04, |
|
51 |
|
52 //! State after successfully canceling AF or during startup |
|
53 Unknown = 0x08, |
|
54 |
|
55 //! Starting to cancel any pending AF requests |
|
56 Canceling = 0x10 // Starting to Cancel any pending AF requests |
|
57 }; |
|
58 |
|
59 // TODO: Check if we have to get all the supported modes from adaptation. |
|
60 enum Mode |
|
61 { |
|
62 //! AF mode: Auto |
|
63 Auto, |
|
64 |
|
65 //! AF mode: Hyperfocal |
|
66 Hyperfocal, |
|
67 |
|
68 //! AF mode: Macro |
|
69 Macro, |
|
70 |
|
71 //! AF mode: Infinity |
|
72 Infinity, |
|
73 |
|
74 //! AF mode: Portrait |
|
75 Portrait |
|
76 }; |
|
77 |
|
78 /** |
|
79 * Starts Autofocus. |
|
80 * \param soundEnabled indicates if the auto focus sound should be played |
|
81 */ |
|
82 virtual CxeError::Id start(bool soundEnabled = true) = 0; |
|
83 |
|
84 /** |
|
85 * Cancels Autofocus. |
|
86 */ |
|
87 virtual void cancel() = 0; // cancels active start operation |
|
88 |
|
89 |
|
90 /** |
|
91 * Setting Autofocus Mode. |
|
92 */ |
|
93 virtual void setMode( Mode newMode ) = 0; // sets default value for current view/mode |
|
94 |
|
95 /** |
|
96 * Get current Autofocus mode. |
|
97 */ |
|
98 virtual Mode mode() const = 0; |
|
99 |
|
100 /** |
|
101 * Is the mode a fixed focus mode. |
|
102 */ |
|
103 virtual bool isFixedFocusMode(Mode mode) const = 0; |
|
104 |
|
105 /** |
|
106 * Get current Autofocus state. |
|
107 */ |
|
108 virtual State state() const = 0; // returns current AF state, one of AutoFocusState |
|
109 |
|
110 /** |
|
111 * Check if Autofocus is Supported or Not. |
|
112 */ |
|
113 virtual bool supported() const = 0; // true when AF is supported |
|
114 |
|
115 /** |
|
116 * Check if auto focus sound is enabled |
|
117 */ |
|
118 virtual bool isSoundEnabled() const = 0; |
|
119 |
|
120 signals: |
|
121 void stateChanged( CxeAutoFocusControl::State newState, CxeError::Id error ); |
|
122 |
|
123 protected: |
|
124 CxeAutoFocusControl() {} // protected empty contructor so that derived class construction works |
|
125 |
|
126 private: |
|
127 Q_DISABLE_COPY( CxeAutoFocusControl ) |
|
128 }; |
|
129 |
|
130 Q_DECLARE_METATYPE(CxeAutoFocusControl::State) |
|
131 |
|
132 #endif // CXEAUTOFOCUSCONTROL_H |
|