|
1 /* |
|
2 * Copyright (c) 2009 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 #ifndef CXUISTILLPRECAPTUREVIEW_H |
|
18 #define CXUISTILLPRECAPTUREVIEW_H |
|
19 |
|
20 #include <QMetaType> |
|
21 |
|
22 #include "cxuiprecaptureview.h" |
|
23 #include "cxeautofocuscontrol.h" |
|
24 #include "cxeviewfindercontrol.h" |
|
25 #include "cxestillcapturecontrol.h" |
|
26 #include "cxeerror.h" |
|
27 #include "cxenamespace.h" |
|
28 class HbListWidgetItem; |
|
29 class HbListWidget; |
|
30 class CxuiCaptureKeyHandler; |
|
31 class CxuiDocumentLoader; |
|
32 class HbAction; |
|
33 class HbDialog; |
|
34 class CxuiSelfTimer; |
|
35 class HbPushButton; |
|
36 class HbLabel; |
|
37 class CxuiSelfTimerRadioButtonList; |
|
38 class HbToolBarExtension; |
|
39 class HbWidget; |
|
40 /** |
|
41 * Pre-capture view for still image mode |
|
42 */ |
|
43 |
|
44 |
|
45 class CxuiStillPrecaptureView : public CxuiPrecaptureView |
|
46 { |
|
47 Q_OBJECT |
|
48 |
|
49 public: |
|
50 CxuiStillPrecaptureView(QGraphicsItem *parent = 0); |
|
51 |
|
52 virtual ~CxuiStillPrecaptureView(); |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Construct-method handles initialisation tasks for this class. Needs to be called |
|
58 * before the instance of this class is used. |
|
59 * @param mainwindow |
|
60 * @param engine |
|
61 * @param documentLoader |
|
62 * @param keyHandler |
|
63 */ |
|
64 virtual void construct(HbMainWindow *mainwindow, CxeEngine *engine, |
|
65 CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler = NULL); |
|
66 |
|
67 /** |
|
68 * Loads default widgets in layouts xml. |
|
69 */ |
|
70 virtual void loadDefaultWidgets(); |
|
71 |
|
72 /** |
|
73 * Loads widgets that are not part of the default section in layouts xml. |
|
74 * Widgets are created at the time they are first loaded. |
|
75 */ |
|
76 virtual void loadWidgets(); |
|
77 |
|
78 void updateOrientation(Qt::Orientation orientation); |
|
79 |
|
80 protected: |
|
81 |
|
82 void showEvent(QShowEvent *event); |
|
83 virtual void showToolbar(); |
|
84 |
|
85 public slots: |
|
86 |
|
87 // from CxuiPrecaptureView |
|
88 virtual void handleSettingValueChanged(const QString& key, QVariant newValue); |
|
89 |
|
90 // whenever a scene setting is changed on the engine side, an icon might need updating on the toolbar |
|
91 // connects to the sceneChanged signal of CxeSettings |
|
92 void handleSceneChanged(CxeScene &scene); |
|
93 |
|
94 protected slots: |
|
95 void focusAndCapture(); |
|
96 void capture(); |
|
97 void setCapturePending(); |
|
98 void goToVideo(); |
|
99 |
|
100 void launchSceneModesPopup(); |
|
101 |
|
102 // Key events |
|
103 void handleCaptureKeyPressed(); |
|
104 void handleAutofocusKeyPressed(); |
|
105 void handleAutofocusKeyReleased(); |
|
106 |
|
107 // Engine signals |
|
108 void handleAutoFocusStateChanged(CxeAutoFocusControl::State newState, CxeError::Id error); |
|
109 void handleViewfinderStateChanged(CxeViewfinderControl::State newState, CxeError::Id error); |
|
110 void handleStillCaptureStateChanged(CxeStillCaptureControl::State newState, CxeError::Id error); |
|
111 void handleSnapshot(CxeError::Id error); |
|
112 |
|
113 /** |
|
114 * Signal used to reset mCapturePending after a short timeout. If the image |
|
115 * cannot be captured within a given time of the key press, it is better to cancel |
|
116 * the whole operation. |
|
117 */ |
|
118 void resetCapturePendingFlag(); |
|
119 |
|
120 void showControls(); |
|
121 |
|
122 /** |
|
123 * Application focus slots are called if focus state is changed. |
|
124 * Camera is released or reserved according to new state. |
|
125 */ |
|
126 void handleFocusLost(); |
|
127 void handleFocusGained(); |
|
128 void launchSetting(); |
|
129 void updateImagesLeftLabel(); |
|
130 |
|
131 protected: |
|
132 void initializeSettingsGrid(); |
|
133 void closeDialogs(); |
|
134 |
|
135 protected: |
|
136 CxuiSelfTimer *mSelfTimer; |
|
137 HbAction *mFlashSetting; |
|
138 HbDialog *mStillSettingsPopup; |
|
139 HbDialog *mSceneModePopup; |
|
140 |
|
141 /** |
|
142 * Capture key was pressed while engine was not ready... Capture when possible. |
|
143 * This flag is reset after a short delay at resetCapturePendingFlag(). |
|
144 */ |
|
145 bool mCapturePending; |
|
146 HbLabel *mImagesLeft; |
|
147 HbWidget *mImagesLeftContainer; |
|
148 |
|
149 private: |
|
150 bool mPendingAfCanceling; |
|
151 }; |
|
152 |
|
153 Q_DECLARE_METATYPE(QList<int>) |
|
154 |
|
155 #endif // CXUISTILLPRECAPTUREVIEW_H |