1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
24 #include "cxevideocapturecontrol.h" |
24 #include "cxevideocapturecontrol.h" |
25 |
25 |
26 #include "cxuiserviceprovider.h" |
26 #include "cxuiserviceprovider.h" |
27 #include "cxesettings.h" |
27 #include "cxesettings.h" |
28 |
28 |
|
29 #include <xqaiwdecl.h> |
|
30 |
29 CxuiServiceProvider* CxuiServiceProvider::mInstance = NULL; |
31 CxuiServiceProvider* CxuiServiceProvider::mInstance = NULL; |
30 |
|
31 // TODO: get these constants from header <xqaiwdecl.h> |
|
32 // will be released wk16 |
|
33 const QString CXUI_SERVICE_NAME = "cxui.com.nokia.symbian.ICameraCapture"; |
|
34 |
|
35 const QString CAMERA_INDEX = "CameraIndex"; |
|
36 const QString QUALITY = "Quality"; |
|
37 const QString ALLOW_MODE_SWITCH = "AllowModeSwitch"; |
|
38 const QString ALLOW_CAMERA_SWITCH = "AllowCameraSwitch"; |
|
39 const QString ALLOW_QUALITY_CHANGE = "AllowQualityChange"; |
|
40 |
32 |
41 CxuiServiceProvider::CxuiServiceProvider(CxeEngine *engine) |
33 CxuiServiceProvider::CxuiServiceProvider(CxeEngine *engine) |
42 : |
34 : |
43 XQServiceProvider(CXUI_SERVICE_NAME), |
35 XQServiceProvider("cxui." + XQI_CAMERA_CAPTURE), |
44 mRequestIndex(-1), |
36 mRequestIndex(-1), |
45 mEngine(engine), |
37 mEngine(engine), |
46 mRequestedMode(Cxe::ImageMode), |
38 mRequestedMode(Cxe::ImageMode), |
47 mCameraIndex(0), |
39 mCameraIndex(0), |
48 mQuality(0), |
40 mQuality(0), |
149 CX_DEBUG_ENTER_FUNCTION(); |
141 CX_DEBUG_ENTER_FUNCTION(); |
150 |
142 |
151 if (mRequestIndex == -1) { |
143 if (mRequestIndex == -1) { |
152 CX_DEBUG(("CxuiServiceProvider: no request in progress")); |
144 CX_DEBUG(("CxuiServiceProvider: no request in progress")); |
153 QCoreApplication::instance()->quit(); |
145 QCoreApplication::instance()->quit(); |
|
146 CX_DEBUG_EXIT_FUNCTION(); |
154 return; |
147 return; |
155 } |
148 } |
156 |
149 |
157 connect(this, SIGNAL(returnValueDelivered()), QCoreApplication::instance(), SLOT(quit())); |
150 connect(this, SIGNAL(returnValueDelivered()), QCoreApplication::instance(), SLOT(quit())); |
158 |
151 |
159 CX_DEBUG(("CxuiServiceProvider: completing request")); |
152 CX_DEBUG(("CxuiServiceProvider: completing request")); |
160 if (!completeRequest(mRequestIndex, QVariant(filename))) { |
153 if (!completeRequest(mRequestIndex, QVariant(filename))) { |
161 // if request completion fails call quit immediately because signal is not coming |
154 // if request completion fails call quit immediately because signal is not coming |
|
155 CX_DEBUG(("completeRequest() failed, quitting now")); |
162 QCoreApplication::instance()->quit(); |
156 QCoreApplication::instance()->quit(); |
163 } |
157 } |
164 mRequestIndex = -1; |
158 mRequestIndex = -1; |
165 |
159 |
166 CX_DEBUG_EXIT_FUNCTION(); |
160 CX_DEBUG_EXIT_FUNCTION(); |
234 { |
228 { |
235 |
229 |
236 CX_DEBUG_ENTER_FUNCTION(); |
230 CX_DEBUG_ENTER_FUNCTION(); |
237 CX_DEBUG(("Reading parameters")); |
231 CX_DEBUG(("Reading parameters")); |
238 bool ok; |
232 bool ok; |
239 mCameraIndex = parameters[CAMERA_INDEX].toInt(&ok); |
233 mCameraIndex = parameters[XQCAMERA_INDEX].toInt(&ok); |
240 if (!ok) { |
234 if (!ok) { |
241 CX_DEBUG(("Error reading parameter %s", CAMERA_INDEX.toAscii().constData())); |
235 CX_DEBUG(("Error reading parameter %s", XQCAMERA_INDEX.latin1())); |
242 CX_DEBUG_EXIT_FUNCTION(); |
236 CX_DEBUG_EXIT_FUNCTION(); |
243 return false; |
237 return false; |
244 } |
238 } |
245 mQuality = parameters[QUALITY].toInt(&ok); |
239 mQuality = parameters[XQCAMERA_QUALITY].toInt(&ok); |
246 if (!ok) { |
240 if (!ok) { |
247 CX_DEBUG(("Error reading parameter %s", CAMERA_INDEX.toAscii().constData())); |
241 CX_DEBUG(("Error reading parameter %s", XQCAMERA_QUALITY.latin1())); |
248 CX_DEBUG_EXIT_FUNCTION(); |
242 CX_DEBUG_EXIT_FUNCTION(); |
249 return false; |
243 return false; |
250 } |
244 } |
251 |
245 |
252 mAllowModeSwitching = parameters[ALLOW_MODE_SWITCH].toBool(); |
246 // ignore possible errors on these parameters. default values will be false |
253 mAllowQualityChange = parameters[ALLOW_QUALITY_CHANGE].toBool(); |
247 mAllowModeSwitching = parameters[XQCAMERA_MODE_SWITCH].toBool(); |
254 mAllowCameraSwitching = parameters[ALLOW_CAMERA_SWITCH].toBool(); |
248 mAllowQualityChange = parameters[XQCAMERA_QUALITY_CHANGE].toBool(); |
|
249 mAllowCameraSwitching = parameters[XQCAMERA_INDEX_SWITCH].toBool(); |
255 |
250 |
256 CX_DEBUG_EXIT_FUNCTION(); |
251 CX_DEBUG_EXIT_FUNCTION(); |
257 return true; |
252 return true; |
258 } |
253 } |
259 |
254 |