# HG changeset patch
# User hgs
# Date 1279148105 -10800
# Node ID 0e652f8f1fbd29c58a3fc4a381a10766f4a9b192
# Parent 3075d9b614e65448b968195bd587dde41944b86f
201027_1
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/camerax.pri
--- a/camerauis/cameraxui/camerax.pri Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/camerax.pri Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -14,28 +14,7 @@
# Description:
#
-
-# Auto-detect path for S60 Qt Mobile extensions
-exists(/qt/extensions/include) { INCLUDEPATH += /qt/extensions/include }
-exists(/qtextensions/include) { INCLUDEPATH += /qtextensions/include }
-exists(/s60/mw/qtextensions/include) { INCLUDEPATH += /s60/mw/qtextensions/include }
-exists(/sf/mw/qtextensions/include) { INCLUDEPATH += /sf/mw/qtextensions/include }
-exists(/ext/mw/qtextensions/include) { INCLUDEPATH += /ext/mw/qtextensions/include }
-exists(/epoc32/include/oem) { INCLUDEPATH += /epoc32/include/oem }
-exists(/epoc32/include/middleware) { INCLUDEPATH += /epoc32/include/middleware }
-exists(/epoc32/include/domain/middleware) { INCLUDEPATH += /epoc32/include/domain/middleware }
-exists(/epoc32/include/osextensions) { INCLUDEPATH += /epoc32/include/osextensions }
-exists(/epoc32/include/domain/osextensions) { INCLUDEPATH += /epoc32/include/domain/osextensions }
-exists(/epoc32/include/applications) { INCLUDEPATH += /epoc32/include/applications }
-exists(/epoc32/include/domain/applications) { INCLUDEPATH += /epoc32/include/domain/applications }
-exists(/epoc32/include/mw) { INCLUDEPATH += /epoc32/include/mw }
-exists(/epoc32/include/platform/mw) { INCLUDEPATH += /epoc32/include/platform/mw }
-exists(/epoc32/include/platform) { INCLUDEPATH += /epoc32/include/platform }
-exists(/epoc32/include/app) { INCLUDEPATH += /epoc32/include/app }
-exists(/epoc32/include/platform/app) { INCLUDEPATH += /epoc32/include/platform/app }
-exists(/epoc32/include/ecam) { INCLUDEPATH += /epoc32/include/ecam }
-exists(/epoc32/include/mw/QtTest) { INCLUDEPATH += /epoc32/include/mw/QtTest }
-
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
# FORCE_SECONDARY_CAMERA
# Configuration flag for forcing secondary camera hw to be used also for primary camera ui.
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/bwins/cxengineu.def
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/bwins/cxengineu.def Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?createEngine@CxeEngine@@SAPAV1@XZ @ 1 NONAME ; class CxeEngine * CxeEngine::createEngine(void)
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/conf/CI_camerax.confml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/conf/CI_camerax.confml Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,44 @@
+
+
+ CameraX settings
+
+
+ StillShowCapturedCr defines setting in Image settings.
+ If disabled, post-capture view is not shown after capturing an image.
+
+
+
+
+
+
+
+
+ VideoShowCapturedCr defines setting in Image settings.
+ If disabled, post-capture view is not shown after capturing an video.
+
+
+
+
+
+
+
+
+ Store location information in metadata for captured images.
+
+
+
+
+
+ The key defines if facetracking should be on or off.
+
+
+
+
+
+ The key defines if the capture sound should always be played, regardless of profile sounds.
+
+
+
+
+
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/conf/camerax.confml
--- a/camerauis/cameraxui/cxengine/conf/camerax.confml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/conf/camerax.confml Thu Jul 15 01:55:05 2010 +0300
@@ -27,26 +27,6 @@
-
- StillShowCapturedCr defines setting in Image settings.
- If disabled, post-capture view is not shown after capturing an image.
-
-
-
-
-
-
-
-
- VideoShowCapturedCr defines setting in Image settings.
- If disabled, post-capture view is not shown after capturing an video.
-
-
-
-
-
-
-
ImageQualityCr defines the quality currently in use in still mode.
@@ -63,6 +43,29 @@
0 indicates "video recording with sound."
+
+
+ GeoTaggingDisclaimerCr defines whether we have to show first time use note for geotagging
+ when we first start the camera.
+
+
+
+
+ Current mode of the camera - still or video.
+
+
+ VideoQualityCr defines the quality currently in use in video mode.
+
+
+
+ Scene mode setting in still mode.
+
+
+
+ Scene mode setting in video mode.
+
+
+
@@ -76,7 +79,15 @@
1
0
0
-
+ 1
+ 1
+ 0
+ 1
+ 0
+ 0
+ image_scene_auto
+ video_scene_auto
+
@@ -88,7 +99,15 @@
true
true
true
-
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/conf/camerax_20027017.crml
Binary file camerauis/cameraxui/cxengine/conf/camerax_20027017.crml has changed
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/cxengine.pro
--- a/camerauis/cameraxui/cxengine/cxengine.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/cxengine.pro Thu Jul 15 01:55:05 2010 +0300
@@ -66,6 +66,7 @@
LIBS += -lxqserviceutil
LIBS += -loommonitor
LIBS += -lhal
+LIBS += -llocationmanager
symbian {
TARGET.EPOCALLOWDLLDATA = 1 // TODO: check this out??
@@ -91,6 +92,7 @@
symbian {
CXENGINE_DIR = $$section(PWD,":",1)
BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include "
+ BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/CI_camerax.confml APP_LAYER_CONFML(CI_camerax.confml)
BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/camerax.confml APP_LAYER_CONFML(camerax.confml)
BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/camerax_20027017.crml APP_LAYER_CRML(camerax_20027017.crml)
BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/cameraxvariation.confml APP_LAYER_CONFML(cameraxvariation.confml)
@@ -156,6 +158,10 @@
cxememorymonitorprivate.h \
cxediskmonitor.h \
cxediskmonitorprivate.h \
+ cxesnapshotcontrol.h \
+ cxesnapshotcontrolprivate.h \
+ cxegeotaggingtrail.h \
+ cxegeotaggingtrailprivate.h \
sensor/xqsensor.h \
sensor/xqaccsensor.h \
sensor/xqdeviceorientation.h \
@@ -202,6 +208,10 @@
cxememorymonitorprivate.cpp \
cxediskmonitor.cpp \
cxediskmonitorprivate.cpp \
+ cxesnapshotcontrol.cpp \
+ cxesnapshotcontrolprivate.cpp \
+ cxegeotaggingtrail.cpp \
+ cxegeotaggingtrailprivate.cpp \
sensor/xqsensor.cpp \
sensor/xqaccsensor.cpp \
sensor/xqdeviceorientation.cpp \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/data/autoFocus.wav
Binary file camerauis/cameraxui/cxengine/data/autoFocus.wav has changed
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/data/capture.wav
Binary file camerauis/cameraxui/cxengine/data/capture.wav has changed
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/data/videoStart.wav
Binary file camerauis/cameraxui/cxengine/data/videoStart.wav has changed
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/data/videoStop.wav
Binary file camerauis/cameraxui/cxengine/data/videoStop.wav has changed
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/eabi/cxengineu.def
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/eabi/cxengineu.def Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _ZN9CxeEngine12createEngineEv @ 1 NONAME
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxeautofocuscontrol.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxeautofocuscontrol.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeautofocuscontrol.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -34,7 +34,7 @@
{
Q_OBJECT
public:
-
+
/*
* Autofocus control states.
*/
@@ -42,71 +42,76 @@
{
//! focusing
InProgress = 0x01,
-
+
//! Autofocus Failed
Failed = 0x02,
-
+
//! Focused
Ready = 0x04,
-
+
//! State after successfully canceling AF or during startup
Unknown = 0x08,
-
+
//! Starting to cancel any pending AF requests
Canceling = 0x10 // Starting to Cancel any pending AF requests
};
-
+
// TODO: Check if we have to get all the supported modes from adaptation.
enum Mode
{
//! AF mode: Auto
Auto,
-
+
//! AF mode: Hyperfocal
Hyperfocal,
-
+
//! AF mode: Macro
Macro,
-
+
//! AF mode: Infinity
Infinity,
-
+
//! AF mode: Portrait
Portrait
};
-
+
/**
* Starts Autofocus.
* \param soundEnabled indicates if the auto focus sound should be played
*/
virtual CxeError::Id start(bool soundEnabled = true) = 0;
-
+
/**
* Cancels Autofocus.
*/
virtual void cancel() = 0; // cancels active start operation
-
+
/**
* Setting Autofocus Mode.
*/
virtual void setMode( Mode newMode ) = 0; // sets default value for current view/mode
-
+
/**
* Get current Autofocus mode.
*/
virtual Mode mode() const = 0;
-
+
+ /**
+ * Is the mode a fixed focus mode.
+ */
+ virtual bool isFixedFocusMode(Mode mode) const = 0;
+
/**
* Get current Autofocus state.
*/
virtual State state() const = 0; // returns current AF state, one of AutoFocusState
-
+
/**
* Check if Autofocus is Supported or Not.
*/
virtual bool supported() const = 0; // true when AF is supported
-
+
/**
* Check if auto focus sound is enabled
*/
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxeengine.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Thu Jul 15 01:55:05 2010 +0300
@@ -22,6 +22,7 @@
class CxeCameraDeviceControl;
class CxeViewfinderControl;
+class CxeSnapshotControl;
class CxeStillCaptureControl;
class CxeVideoCaptureControl;
class CxeAutoFocusControl;
@@ -30,6 +31,7 @@
class CxeFeatureManager;
class CxeSettings;
class CxeMemoryMonitor;
+class CxeGeoTaggingTrail;
/**
* CxeEngine provides the the entry point into CameraX engine. This is the
@@ -59,6 +61,11 @@
virtual CxeViewfinderControl &viewfinderControl() = 0;
/**
+ * Access the snapshot control.
+ */
+ virtual CxeSnapshotControl &snapshotControl() = 0;
+
+ /**
* Access the still capture control.
*/
virtual CxeStillCaptureControl &stillCaptureControl() = 0;
@@ -92,13 +99,23 @@
* Memory monitor utility.
*/
virtual CxeMemoryMonitor &memoryMonitor() = 0;
-
+
+ /**
+ * Geotagging trail utility.
+ */
+ virtual CxeGeoTaggingTrail &geoTaggingTrail() = 0;
+
/**
* Get current camera mode.
*/
virtual Cxe::CameraMode mode() const = 0;
/**
+ * Set current camera mode.
+ */
+ virtual void setMode(Cxe::CameraMode mode) = 0;
+
+ /**
* Initialize the camera in either still or video mode. This method is also
* used to switch between modes.
*/
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxeerror.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxeerror.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeerror.h Thu Jul 15 01:55:05 2010 +0300
@@ -64,7 +64,6 @@
//! any other general errors
General = 11
};
-
}
Q_DECLARE_METATYPE(CxeError::Id)
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxegeotaggingtrail.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/api/cxegeotaggingtrail.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXEGEOTAGGINGTRAIL_H
+#define CXEGEOTAGGINGTRAIL_H
+
+#include
+#include
+#include "cxeerror.h"
+
+class CxeSettings;
+class CxeStillCaptureControl;
+class CxeVideoCaptureControl;
+
+class CxeGeoTaggingTrailPrivate;
+
+class CxeGeoTaggingTrail : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ //! Geotagging trail states
+ enum State {
+ //! location utility not connected
+ NotConnected = 0x01,
+
+ //! connected to location utility, but location trail NOT STARTED.
+ Connected = 0x02,
+
+ //! starting Location trail, GPS data not yet available
+ TrailStarted = 0x04,
+
+ //! location trail started and GPS data available.
+ DataAvailable = 0x08
+ };
+
+public:
+
+ CxeGeoTaggingTrail(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings);
+
+ ~CxeGeoTaggingTrail();
+
+signals:
+ void stateChanged(CxeGeoTaggingTrail::State newState, CxeError::Id error);
+
+public slots:
+ void start();
+ void stop();
+
+public:
+ State state();
+
+protected:
+ CxeGeoTaggingTrailPrivate *const d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(CxeGeoTaggingTrail)
+
+};
+
+Q_DECLARE_METATYPE(CxeGeoTaggingTrail::State)
+
+#endif // CXEGEOTAGGINGTRAIL_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxenamespace.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -41,7 +41,7 @@
enum CameraMode
{
//! Still image capture mode
- ImageMode,
+ ImageMode = 0,
//! Video recording mode
VideoMode
@@ -109,7 +109,8 @@
enum AspectRatio
{
AspectRatio4to3, // standard
- AspectRatio16to9 // wide screen
+ AspectRatio16to9, // wide screen
+ AspectRatio11to9
};
enum SettingKeyType
@@ -126,11 +127,45 @@
FreeMemoryTrigger = 0,
FreeMemoryTarget
};
+
+ /*!
+ * Indicates if Geotagging setting is enabled or disabled.
+ */
+ enum GeoTagging
+ {
+ GeoTaggingOff = 0,
+ GeoTaggingOn
+ };
+
+ /*!
+ * Indicates if Geotagging disclaimer note is shown to the users during camera first startup
+ */
+ enum GeoTaggingDisclaimer
+ {
+ GeoTaggingDisclaimerDisabled = 0,
+ GeoTaggingDisclaimerEnabled
+ };
+
+ // image scene mode key values
+ static const char* IMAGE_SCENE_AUTO = "image_scene_auto";
+ static const char* IMAGE_SCENE_PORTRAIT = "image_scene_portrait";
+ static const char* IMAGE_SCENE_SCENERY = "image_scene_scenery";
+ static const char* IMAGE_SCENE_MACRO = "image_scene_macro";
+ static const char* IMAGE_SCENE_SPORTS = "image_scene_sports";
+ static const char* IMAGE_SCENE_NIGHT = "image_scene_night";
+ static const char* IMAGE_SCENE_NIGHTPORTRAIT = "image_scene_night_portrait";
+
+ // video scene setting key values
+ static const char* VIDEO_SCENE_AUTO = "video_scene_auto";
+ static const char* VIDEO_SCENE_NIGHTPORTRAIT = "video_scene_night_portrait";
+ static const char* VIDEO_SCENE_LOWLIGHT = "video_scene_low_light";
+ static const char* VIDEO_SCENE_NIGHT = "video_scene_night";
}
namespace CxeSettingIds
{
// Setting Ids
+ static const char* CAMERA_MODE = "camera_mode";
static const char* FOCAL_RANGE = "focal_range";
static const char* FLASH_MODE = "flash_mode";
static const char* WHITE_BALANCE = "white_balance";
@@ -147,7 +182,10 @@
static const char* VIDEO_QUALITY = "videoQuality";
static const char* SECONDARY_CAMERA = "2ndCamera";
static const char* SELF_TIMER = "selfTimer";
-
+ static const char* FACE_TRACKING = "face_tracking";
+ static const char* GEOTAGGING = "geotagging";
+ static const char* GEOTAGGING_DISCLAIMER = "geotagging_disclaimer";
+ static const char* CAPTURE_SOUND_ALWAYS_ON = "capture_sound_always_on";
// file name/path related key values
static const char* FNAME_FOLDER_SUFFIX = "folder_suffix";
@@ -159,21 +197,6 @@
static const char* IMAGE_SCENE = "still_scene_modes";
static const char* VIDEO_SCENE = "video_scene_modes";
- // image scene mode key values
- static const char* IMAGE_SCENE_AUTO = "image_scene_auto";
- static const char* IMAGE_SCENE_PORTRAIT = "image_scene_portrait";
- static const char* IMAGE_SCENE_SCENERY = "image_scene_scenery";
- static const char* IMAGE_SCENE_MACRO = "image_scene_macro";
- static const char* IMAGE_SCENE_SPORTS = "image_scene_sports";
- static const char* IMAGE_SCENE_NIGHT = "image_scene_night";
- static const char* IMAGE_SCENE_NIGHTPORTRAIT = "image_scene_night_portrait";
-
- // video scene setting key values
- static const char* VIDEO_SCENE_AUTO = "video_scene_auto";
- static const char* VIDEO_SCENE_NIGHTPORTRAIT = "video_scene_night_portrait";
- static const char* VIDEO_SCENE_LOWLIGHT = "video_scene_low_light";
- static const char* VIDEO_SCENE_NIGHT = "video_scene_night";
-
// setting keys for post capture timeout
static const char* STILL_SHOWCAPTURED = "still_showcaptured";
static const char* VIDEO_SHOWCAPTURED = "video_showcaptured";
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxestillcapturecontrol.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxestillcapturecontrol.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxestillcapturecontrol.h Thu Jul 15 01:55:05 2010 +0300
@@ -155,7 +155,7 @@
* @param snapshot The snapshot image.
* @param id Id of the image this snapshot is for.
*/
- void snapshotReady(CxeError::Id error, const QPixmap& snapshot, int id);
+ void snapshotReady(CxeError::Id error, const QImage &snapshot, int id);
void imageCaptured(CxeError::Id error, int id);
/**
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxevideocapturecontrol.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxevideocapturecontrol.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxevideocapturecontrol.h Thu Jul 15 01:55:05 2010 +0300
@@ -90,9 +90,9 @@
virtual void deinit() = 0;
signals:
- void videoComposed(CxeError::Id error, const QString& filename);
+ void videoComposed(CxeError::Id error, const QString &filename);
void stateChanged(CxeVideoCaptureControl::State newState, CxeError::Id error);
- void snapshotReady(CxeError::Id error, const QPixmap& snapshot, const QString& filename);
+ void snapshotReady(CxeError::Id error, const QImage &snapshot, const QString &filename);
void remainingTimeChanged();
protected:
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/api/cxutils.h
--- a/camerauis/cameraxui/cxengine/inc/api/cxutils.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxutils.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -25,28 +25,39 @@
#define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION QT_TRAP_THROWING
#endif
-//! @todo change back when we can use udeb again
-//#ifdef _DEBUG
-#if 1
+
+// Traces enabled only in debug builds.
+// These can heavily affect the performance.
+#ifdef _DEBUG
#include // Qt Debug
+#ifdef Q_OS_SYMBIAN
#include // Symbian Debug
+#endif // Q_OS_SYMBIAN
- // engine specific debug macros
#define CX_DEBUG(msg) qDebug msg;
- #define CX_DEBUG_SYMBIAN(msg) RDebug::Print msg;
#define CX_DEBUG_ENTER_FUNCTION() qDebug("%s => ", __PRETTY_FUNCTION__);
#define CX_DEBUG_IN_FUNCTION() qDebug("%s =><= ", __PRETTY_FUNCTION__);
#define CX_DEBUG_EXIT_FUNCTION() qDebug("%s <= ", __PRETTY_FUNCTION__);
+#ifdef Q_OS_SYMBIAN
+ #define CX_DEBUG_SYMBIAN(msg) RDebug::Print msg;
#define CX_DEBUG_ASSERT(x) if( !(x) ) {\
qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \
ASSERT(x); \
}
+#else // !Q_OS_SYMBIAN
+ #define CX_DEBUG_SYMBIAN(msg) qDebug()<< msg;
+ #define CX_DEBUG_ASSERT(x) if( !(x) ) {\
+ qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \
+ Q_ASSERT(x); \
+ }
+ #define OstTrace0(x,y,z)
+
+#endif // Q_OS_SYMBIAN
#define CX_ASSERT_ALWAYS(x) CX_DEBUG_ASSERT(x)
#else // !_DEBUG
- // engine specific debug macros
#define CX_DEBUG(msg)
#define CX_DEBUG_SYMBIAN(msg)
#define CX_DEBUG_ENTER_FUNCTION()
@@ -57,6 +68,4 @@
#endif // _DEBUG
-
-
#endif // CXUTILS_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -27,6 +27,7 @@
//forward declarations
class CxeCameraDevice;
+class CxeSettings;
@@ -41,13 +42,14 @@
Q_OBJECT
public:
- CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice );
+ CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice, CxeSettings &settings );
virtual ~CxeAutoFocusControlSymbian();
CxeError::Id start(bool soundEnabled = true);
void cancel();
void setMode( CxeAutoFocusControl::Mode newMode );
CxeAutoFocusControl::Mode mode() const;
+ bool isFixedFocusMode(CxeAutoFocusControl::Mode mode) const;
CxeAutoFocusControl::State state() const;
bool supported() const;
@@ -80,7 +82,8 @@
// Handle ECam events
void handleCameraEvent( int eventUid, int error );
- void handleSceneChanged(CxeScene& scene);
+ void handleSceneChanged(CxeScene &scene);
+ void handleSettingValueChanged(const QString &settingId, QVariant newValue);
private:
@@ -92,8 +95,11 @@
CCamera::CCameraAdvancedSettings *mAdvancedSettings; // not owned
CxeAutoFocusControl::Mode mAfMode;
CCamera::CCameraAdvancedSettings::TFocusRange mAFRange;
+ CxeSettings &mSettings;
bool mCancelled;
bool mSoundEnabled;
+ bool mFaceTrackingOverride; //need for temporary override of the AF mode if FT is enabled by user
+ CxeAutoFocusControl::Mode mPreviousAFMode; //for restoring previous AF mode in case of FT override
};
#endif // CXEAUTOFOCUSCONTROLSYMBIAN_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h
--- a/camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h Thu Jul 15 01:55:05 2010 +0300
@@ -28,6 +28,14 @@
const unsigned long int ImageQualityCr = 0x7;
const unsigned long int VideoQualityCr = 0x8;
const unsigned long int AudioMuteCr = 0x9;
+const unsigned long int GeoTaggingCr = 0xA;
+const unsigned long int FacetrackingCr = 0xB;
+const unsigned long int CaptureSoundAlwaysOnCr = 0xC;
+const unsigned long int GeoTaggingDisclaimerCr = 0xD;
+const unsigned long int CameraModeCr = 0xE;
+const unsigned long int FlashModeStillCr = 0xF;
+const unsigned long int SceneModeStillCr = 0x10;
+const unsigned long int SceneModeVideoCr = 0x11;
const unsigned long int CxRuntimeFeaturesCrUid = {0x20027018};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxediskmonitorprivate.h
--- a/camerauis/cameraxui/cxengine/inc/cxediskmonitorprivate.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxediskmonitorprivate.h Thu Jul 15 01:55:05 2010 +0300
@@ -30,9 +30,6 @@
{
Q_OBJECT
- // Owner of this private implementation.
- friend class CxeDiskMonitor;
-
private:
explicit CxeDiskMonitorPrivate(CxeSettings &settings);
~CxeDiskMonitorPrivate();
@@ -60,6 +57,8 @@
#endif // Q_OS_SYMBIAN
qint64 mTriggerLevelBytes;
qint64 mLatestFreeBytes;
+
+ friend class CxeDiskMonitor;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -24,6 +24,7 @@
class CxeCameraDevice;
class CxeCameraDeviceControl;
class CxeViewfinderControl;
+class CxeSnapshotControl;
class CxeStillCaptureControl;
class CxeVideoCaptureControl;
class CxeSettingsControlSymbian;
@@ -39,6 +40,7 @@
class CxeFileSaveThread;
class CxeDiskMonitor;
class CxeMemoryMonitor;
+class CxeGeoTaggingTrail;
class CxeEngineSymbian : public CxeEngine
@@ -50,6 +52,7 @@
CxeCameraDeviceControl &cameraDeviceControl();
CxeViewfinderControl &viewfinderControl();
+ CxeSnapshotControl &snapshotControl();
CxeStillCaptureControl &stillCaptureControl();
CxeVideoCaptureControl &videoCaptureControl();
CxeAutoFocusControl &autoFocusControl();
@@ -58,10 +61,14 @@
CxeSensorEventHandler &sensorEventHandler();
CxeFeatureManager &featureManager();
CxeMemoryMonitor &memoryMonitor();
+ CxeGeoTaggingTrail &geoTaggingTrail();
Cxe::CameraMode mode() const;
+ void setMode(Cxe::CameraMode mode);
void initMode(Cxe::CameraMode cameraMode);
bool isEngineReady();
+ void construct();
+
signals:
void reserveStarted();
@@ -69,7 +76,6 @@
virtual void createControls();
private slots:
- void construct();
void doInit();
private:
@@ -78,11 +84,14 @@
bool initNeeded();
bool startViewfinderNeeded();
void reserve();
+ void saveMode();
+ void startGeotaggingTrail();
protected:
CxeCameraDeviceControl *mCameraDeviceControl;
CxeCameraDevice *mCameraDevice; // not own
CxeViewfinderControl *mViewfinderControl;
+ CxeSnapshotControl *mSnapshotControl;
CxeStillCaptureControl *mStillCaptureControl;
CxeVideoCaptureControl *mVideoCaptureControl;
CxeSettingsControlSymbian *mSettingsControl;
@@ -97,6 +106,7 @@
CxeFileSaveThread *mFileSaveThread;
CxeDiskMonitor *mDiskMonitor;
CxeMemoryMonitor *mMemoryMonitor;
+ CxeGeoTaggingTrail *mGeoTaggingTrail;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxeexception.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeexception.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXEEXCEPTION_H
+#define CXEEXCEPTION_H
+
+#include
+
+/*!
+* Exception class for engine internal errors.
+* Contains one integer which can be used to carry error code,
+* in normal cases which is of type CxeError::Id.
+*/
+class CxeException : public std::exception
+{
+public:
+ /*!
+ * Constructor.
+ */
+ explicit CxeException(int error) : mError(error) {};
+
+ /*!
+ * Destructor.
+ */
+ virtual ~CxeException() throw() {};
+
+ /*!
+ * Get the error code causing this exception.
+ * @return The error code.
+ */
+ int error() const { return mError; };
+
+ /*!
+ * Helper method to throw exception if given status code is an error.
+ * Everything but zero is considered error.
+ * @param status The status code to check.
+ */
+ static void throwIfError(int status) { if (status) { throw new CxeException(status); } }
+
+private:
+ //! Error code for this exception.
+ int mError;
+};
+
+#endif // CXEEXCEPTION_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxefilesavethread.h
--- a/camerauis/cameraxui/cxengine/inc/cxefilesavethread.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethread.h Thu Jul 15 01:55:05 2010 +0300
@@ -40,8 +40,8 @@
public slots:
virtual void handleVideoSaved(CxeError::Id status, const QString& filename) = 0;
- virtual void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename) = 0;
- virtual void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id) = 0;
+ virtual void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename) = 0;
+ virtual void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id) = 0;
protected:
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -48,9 +48,8 @@
public slots:
void handleVideoSaved(CxeError::Id status, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id);
-
+ void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename);
+ void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id);
protected slots:
void handleFileHarvested(CxeError::Id status, const QString& filename);
@@ -67,7 +66,7 @@
void run();
void read();
void saveNow();
- void harvestFile(const QString& filename);
+ void harvestFile(const QString& filename, bool addLocation);
private: // data shared between the threads
@@ -78,7 +77,7 @@
QWaitCondition mDataToSave;
mutable QMutex mSnapshotsMutex;
- QHash mSnapshots;
+ QHash mSnapshots;
protected: // thread only used data
int mCount;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxegeotaggingtrailprivate.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxegeotaggingtrailprivate.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXEGEOTAGGINGTRAILPRIVATE_H
+#define CXEGEOTAGGINGTRAILPRIVATE_H
+
+#include
+#include
+#include
+#include
+
+#include "cxeerror.h"
+#include "rlocationtrail.h"
+#include "cxestatemachine.h"
+#include "cxegeotaggingtrail.h"
+
+
+
+
+// Forward declarations
+class CxeSettings;
+class RLocationTrail;
+class CxeStillCaptureControl;
+class CxeVideoCaptureControl;
+
+
+
+
+class CxeGeoTaggingTrailPrivate : public QObject,
+ public CxeStateMachine
+{
+ Q_OBJECT
+
+private:
+
+ CxeGeoTaggingTrailPrivate(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings);
+ ~CxeGeoTaggingTrailPrivate();
+
+signals:
+ void stateChanged(CxeGeoTaggingTrail::State newState, CxeError::Id error);
+
+protected: // from CxeStateMachine
+ void handleStateChanged(int newStateId, CxeError::Id error);
+
+private slots:
+ void handleSettingValueChanged(const QString&,QVariant);
+ void handleGeoTaggingPropertyEvent(long int uid, unsigned long int key, QVariant value);
+ void timeout();
+ void stop(bool closeSession = false);
+
+private:
+ void start();
+ void initializeStates();
+ bool canStopTrail() const;
+ CxeGeoTaggingTrail::State state() const;
+
+private:
+ CxeStillCaptureControl &mStillCaptureControl;
+ CxeVideoCaptureControl &mVideoCaptureControl;
+ CxeSettings &mSettings;
+ QTimer mStopLocationTrailTimer;
+ bool mPendingStopTrailSession;
+#if defined(Q_OS_SYMBIAN)
+ RLocationTrail mLocationTrail;
+#endif
+
+ friend class CxeGeoTaggingTrail;
+};
+
+#endif // CXEGEOTAGGINGTRAILPRIVATE_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -30,12 +30,19 @@
{
Q_OBJECT
public: // from CxeImageDataItemSymbian
- CxeImageDataItemSymbian(QByteArray data, QString filename, int id, CxeImageDataItem::State state = CxeImageDataItem::SavePending);
+ CxeImageDataItemSymbian(QByteArray data,
+ QString filename,
+ int id,
+ bool addLocation,
+ CxeImageDataItem::State state = CxeImageDataItem::SavePending);
+
virtual ~CxeImageDataItemSymbian();
CxeImageDataItem::State state() const;
CxeError::Id save();
int id() const;
+ bool isLocationEnabled() const;
+
public: // new methods
QString path() const;
@@ -60,6 +67,7 @@
// used for image saving
QByteArray mData;
+ bool mAddLocationInfo;
QString mPath;
RFile mFile;
RFs mFs;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxeimagedataqueuesymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxeimagedataqueuesymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataqueuesymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -49,7 +49,7 @@
CxeImageDataItem &operator[]( int index );
public: // public member functions, not in client API
- CxeImageDataItemSymbian *startSave( QByteArray data, QString path, int id );
+ CxeImageDataItemSymbian *startSave( QByteArray data, QString path, int id, bool addLocation);
private: // private data members
QList mList;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxememorymonitorprivate.h
--- a/camerauis/cameraxui/cxengine/inc/cxememorymonitorprivate.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxememorymonitorprivate.h Thu Jul 15 01:55:05 2010 +0300
@@ -31,9 +31,6 @@
{
Q_OBJECT
- // Owner of this private implementation.
- friend class CxeMemoryMonitor;
-
private:
explicit CxeMemoryMonitorPrivate(CxeFeatureManager &features);
~CxeMemoryMonitorPrivate();
@@ -55,6 +52,8 @@
#ifdef Q_OS_SYMBIAN
ROomMonitorSession mOomMonitor;
#endif // Q_OS_SYMBIAN
+
+ friend class CxeMemoryMonitor;
};
#endif // CXEMEMORYMONITORPRIVATE_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxequalitypresets.h
--- a/camerauis/cameraxui/cxengine/inc/cxequalitypresets.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxequalitypresets.h Thu Jul 15 01:55:05 2010 +0300
@@ -23,8 +23,8 @@
/**!
* Interface Class for CxeQualityPresetsSymbian
-* Queries supported image and video qualities from ICM and creates the related
-* data and wraps up the quality settings for the client.
+* Queries supported image and video qualities from ICM and creates the related
+* data and wraps up the quality settings for the client.
*/
class CxeQualityPresets
{
@@ -32,7 +32,7 @@
virtual ~CxeQualityPresets() {};
virtual QList imageQualityPresets(Cxe::CameraIndex cameraId) = 0;
virtual QList videoQualityPresets(Cxe::CameraIndex cameraId) = 0;
- virtual qreal avgVideoBitRateScaler() = 0;
+ virtual int recordingTimeAvailable(const CxeVideoDetails& details, qint64 space) = 0;
};
#endif // CXEQUALITYPRESETS_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxequalitypresetssymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxequalitypresetssymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxequalitypresetssymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -37,9 +37,10 @@
~CxeQualityPresetsSymbian();
QList imageQualityPresets(Cxe::CameraIndex cameraId);
QList videoQualityPresets(Cxe::CameraIndex cameraId);
- qreal avgVideoBitRateScaler();
+ int recordingTimeAvailable(const CxeVideoDetails& details, qint64 space);
private:
+ qreal avgVideoBitRateScaler();
Cxe::AspectRatio calculateAspectRatio(int width, int height) const;
QString toString(const TUint8* aData);
CxeVideoDetails createVideoPreset(TVideoQualitySet set);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h
--- a/camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -31,14 +31,15 @@
class XQSettingsKey;
-/*
-* Settings store intrerface.
+/*!
+* \class CxeSettingsStore
+* \brief Settings store intrerface.
*/
class CxeSettingsStore
{
public:
- /**
+ /*!
* This needs to be here to be able to delete an object
* of inherited class through mixin pointer.
* If this is not defined, deleting through the mixin pointer
@@ -46,35 +47,35 @@
*/
virtual ~CxeSettingsStore() {};
- /*
+ /*!
* resets the cenrep store
*/
virtual void reset() = 0;
- /*
+ /*!
* Reads a value from cenrep
* @param "key" - setting key
* @param "value" - setting value read from cenrep
*/
virtual CxeError::Id get(const QString& key, QVariant &value) = 0;
- /*
- * Reads a value from cenrep
+ /*!
+ * Reads a value from cenrep and starts monitoring changes
* @param "uid" - UID of the component that own setting key
* @param "key" - setting key id
* @param "type" - type of setting key
* @param "value" - setting value read from cenrep
*/
- virtual void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) = 0;
+ virtual void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) = 0;
- /*
+ /*!
* Sets a new value to cenrep
* @param "key" - setting key
* @param "newValue" - new value set to the key in cenrep
*/
virtual CxeError::Id set(const QString& key,const QVariant newValue) = 0;
- /*
+ /*!
* Reads/loads all run-time settings values from cenrep
* @param QList contains list of all runtime key ids which we use to load values from cenrep.
* returns: QHash container, "contains" values associated with each key that are read from cenrep
@@ -87,8 +88,9 @@
-/*
-* CxeSettingsCenRepStore class implements CxeSettingsStore.
+/*!
+* \class CxeSettingsCenRepStore
+* \brief Class implements CxeSettingsStore.
* This class uses CenRep key mechanism for storing and retrieving settings information.
*/
class CxeSettingsCenRepStore : public QObject,
@@ -103,51 +105,18 @@
~CxeSettingsCenRepStore();
public: // from base class
- /*
- * resets the cenrep store
- */
+
void reset();
-
- /*
- * Reads a value from cenrep
- * @param "key" - setting key
- * @param "value" - setting value read from cenrep
- */
CxeError::Id get(const QString& key, QVariant &value);
-
- /*
- * Reads a value from cenrep
- * @param "uid" - UID of the component that own setting key
- * @param "key" - setting key id
- * @param "type" - type of setting key
- * @param "value" - setting value read from cenrep
- */
- void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
-
- /*
- * Sets a new value to cenrep
- * @param "key" - setting key
- * @param "newValue" - new value set to the key in cenrep
- */
+ void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
CxeError::Id set(const QString& key,const QVariant newValue);
-
- /*
- * Reads/loads all run-time settings values from cenrep
- * @param QList contains list of all runtime key ids which we use to load values from cenrep.
- * returns: QHash container, "contains" values associated with each key that are read from cenrep
- * NOTE: loading runtime settings should be done only ONCE at start-up. Its an overhead to read runtime keys
- * unnecessarily multiple times as the values of the runtime keys are not changed.
- * Runtime keys are only used to configure camerax application.
- */
QHash loadRuntimeSettings(QList& settingKeys);
signals:
-
void settingValueChanged(long int uid, unsigned long int key, QVariant value);
private slots:
-
void handleValueChanged(XQSettingsKey key, QVariant value);
private:
@@ -163,22 +132,13 @@
};
private:
-
- /*
- * add's key mapping to the hash container.
- */
+
void addKeyMapping(QString key,
unsigned long int keyid,
XQSettingsManager::Type type,
bool readOnly = false);
- /*
- * Generates XQSettingsKey from given setting/runtime key
- */
+
XQSettingsKey generateXQSettingsKey(const QString& key,CxeError::Id& error);
-
- /*
- * maps "string" type setting key ids to cenrep key ids that XQSettingsManager understands
- */
void mapKeys();
protected:
@@ -191,8 +151,9 @@
};
-/*
- * Settings store that reads key values from cenrep and keeps
+/*!
+ * \class CxeSettingsLocalStore
+ * \brief Settings store that reads key values from cenrep and keeps
* cached copies of them in memory. Doesn't write anything back
* to cenrep.
*/
@@ -204,19 +165,9 @@
CxeSettingsLocalStore();
~CxeSettingsLocalStore();
- /*
- * Reads a value from local store.
- * @param "key" - setting key
- * @param "value" - setting value read from cenrep
- */
CxeError::Id get(const QString& key, QVariant &value);
+ CxeError::Id set(const QString& key, const QVariant newValue);
- /*
- * Sets a new value to local store
- * @param "key" - setting key
- * @param "newValue" - new value set to the key in cenrep
- */
- CxeError::Id set(const QString& key, const QVariant newValue);
private:
bool useValueFromCenrep(const QString &key) const;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -51,8 +51,8 @@
void updateBrightnessSetting(QVariant newValue);
void updateExposureModeSetting(QVariant newValue);
void updateExposureCompensationSetting(QVariant newValue);
-
void updateFlashSetting(QVariant newValue);
+ void updateFaceTrackingSetting(QVariant newValue);
private:
CxeCameraDevice &mCameraDevice;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h
--- a/camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h Thu Jul 15 01:55:05 2010 +0300
@@ -62,7 +62,7 @@
void loadImageScenes();
void loadVideoScenes();
- void loadSceneData(CxeScene ¤tScene, CxeScene &sceneDefaultSettings);
+ CxeError::Id loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings);
CxeError::Id sceneSettingValue(const QString &key, QVariant &value);
CxeError::Id setSceneSettingValue(const QString &key, QVariant newValue);
@@ -70,6 +70,10 @@
CxeError::Id videoScene(const QString &sceneId, CxeScene &sceneSettings);
CxeError::Id imageScene(const QString &sceneId, CxeScene &sceneSettings);
+
+ void restoreImageSettings();
+ void restoreVideoSettings();
+
private:
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxesnapshotcontrol.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxesnapshotcontrol.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXESNAPSHOTCONTROL_H
+#define CXESNAPSHOTCONTROL_H
+
+#include
+#include "cxeerror.h"
+#include "cxenamespace.h"
+
+class CxeCameraDevice;
+class CxeSnapshotControlPrivate;
+
+/*!
+* Snapshot control class.
+*/
+class CxeSnapshotControl : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ // State Machine
+ enum State {
+ //! Idle, snapshot not active.
+ Idle = 0x01,
+ //! Active, snapshot events provided after successful capture.
+ Active = 0x02
+ };
+
+
+ explicit CxeSnapshotControl(CxeCameraDevice &device);
+ virtual ~CxeSnapshotControl();
+
+public:
+ State state() const;
+ QSize calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const;
+ void start(const QSize &size);
+ void stop();
+
+signals:
+ void stateChanged(CxeSnapshotControl::State newState, CxeError::Id status);
+ void snapshotReady(CxeError::Id status, const QImage &snapshot);
+
+public slots:
+ void handleCameraEvent(int id, int error);
+
+private:
+ CxeSnapshotControlPrivate *d;
+
+ Q_DISABLE_COPY(CxeSnapshotControl)
+ friend class CxeSnapshotControlPrivate;
+};
+
+Q_DECLARE_METATYPE(CxeSnapshotControl::State)
+
+#endif // CXESNAPSHOTCONTROL_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxesnapshotcontrolprivate.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxesnapshotcontrolprivate.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXESNAPSHOTCONTROLPRIVATE_H
+#define CXESNAPSHOTCONTROLPRIVATE_H
+
+
+#include
+#include "cxeerror.h"
+#include "cxestatemachine.h"
+
+class CxeSnapshotControl;
+class CxeCameraDevice;
+
+
+/*!
+* Snapshot control private implementation.
+*/
+class CxeSnapshotControlPrivate : public CxeStateMachine
+{
+private:
+ CxeSnapshotControlPrivate(CxeSnapshotControl *parent, CxeCameraDevice &device);
+ virtual ~CxeSnapshotControlPrivate();
+
+protected: // from CxeStateMachine
+ void handleStateChanged(int newStateId, CxeError::Id error);
+
+private:
+ CxeSnapshotControl::State state() const;
+ void initializeStates();
+ QSize calculateSnapshotSize(const QSize &displaySize, Cxe::AspectRatio aspectRatio) const;
+ void start(const QSize &size);
+ void stop();
+ void handleCameraEvent(int id, int error);
+ QImage snapshot();
+
+private:
+ CxeSnapshotControl *q;
+ CxeCameraDevice &mDevice;
+
+ friend class CxeSnapshotControl;
+};
+
+#endif // CXESNAPSHOTCONTROLPRIVATE_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -19,11 +19,13 @@
#include
#include
+#include
#include
#include "cxestatemachine.h"
class CMdaAudioPlayerUtility;
class CxeCameraDeviceControlSymbian;
+class CxeSettings;
class CxeSoundPlayerSymbian : public QObject,
public CxeStateMachine,
@@ -31,7 +33,7 @@
{
Q_OBJECT
public:
- /**
+ /*!
* CaptureSound enum defines different types of capture sounds
*/
enum CaptureSound {
@@ -47,7 +49,7 @@
AutoFocus
};
- /*
+ /*!
* Sound player states.
*/
enum State {
@@ -64,20 +66,20 @@
Playing = 0x08
};
- CxeSoundPlayerSymbian(CaptureSound soundId);
+ CxeSoundPlayerSymbian(CaptureSound soundId, CxeSettings &settings);
virtual ~CxeSoundPlayerSymbian();
- /**
- * Plays the currently open capture sound.
- */
void play();
+public slots:
+ void enableSound(long int uid, unsigned long int key, QVariant value);
+
protected: // from CxeStateMachine
void handleStateChanged(int newStateId, CxeError::Id error);
signals:
- /**
- * playComlete signal is emitted when sound has been played.
+ /*!
+ * playComplete signal is emitted when sound has been played.
* @param error Contains status information whether there was a problem with playing or not
*/
void playComplete(int error);
@@ -89,26 +91,22 @@
void MapcPlayComplete(TInt aStatus);
private:
- /**
- * Get current sound player state.
- */
State state() const;
-
- /**
- *
- */
void doOpen();
-
- /**
- * Initialize CxeStateMachine.
- */
void initializeStates();
+ void checkCaptureSoundSettings();
//! Own.
CMdaAudioPlayerUtility *mAudioPlayer;
//! Currently opened sound file
CxeSoundPlayerSymbian::CaptureSound mSoundId;
+
+ bool mUseSound;
+ bool mCaptureSoundForced;
+
+ CxeSettings &mSettings;
+
};
Q_DECLARE_METATYPE(CxeSoundPlayerSymbian::State)
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -38,6 +38,7 @@
class CxeImageDataQueue;
class CxeImageDataQueueSymbian;
class CxeViewfinderControl;
+class CxeSnapshotControl;
class CxeSensorEventHandler;
class CxeCameraDeviceControl;
class CxeAutoFocusControl;
@@ -59,6 +60,7 @@
CxeStillCaptureControlSymbian(CxeCameraDevice &cameraDevice,
CxeViewfinderControl &viewfinderControl,
+ CxeSnapshotControl &snapshotControl,
CxeCameraDeviceControl &cameraDeviceControl,
CxeFilenameGenerator &nameGenerator,
CxeSensorEventHandler &sensorEventHandler,
@@ -93,7 +95,7 @@
void prepareZoomForStill(int ecamStillResolutionIndex);
protected: // from CxeStateMachine
- void handleStateChanged( int newStateId, CxeError::Id error );
+ void handleStateChanged(int newStateId, CxeError::Id error);
protected slots:
@@ -104,9 +106,14 @@
// notification for when camera is released
void prepareForRelease();
- // ECam events
- void handleCameraEvent( int eventUid, int error );
- void handleImageData( MCameraBuffer *buffer, int error );
+ // ECAM events
+ void handleCameraEvent(int eventUid, int error);
+
+ // Image data event
+ void handleImageData(MCameraBuffer *buffer, int error);
+
+ // Snapshot event
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot);
// settings call back
void handleSettingValueChanged(const QString& settingId,QVariant newValue);
@@ -128,9 +135,7 @@
CCamera::TFormat supportedStillFormat(Cxe::CameraIndex cameraIndex);
int prepareStillSnapshot();
CxeError::Id getImageQualityDetails(CxeImageDetails &imageInfo);
- TSize getSnapshotSize() const;
void handleSnapshotEvent(CxeError::Id error);
- QPixmap extractSnapshot();
void initializeStates();
void prepare();
void updateRemainingImagesCounter();
@@ -141,6 +146,7 @@
CxeImageDataQueueSymbian *mImageDataQueue; // own
CxeCameraDevice &mCameraDevice;
CxeViewfinderControl &mViewfinderControl;
+ CxeSnapshotControl &mSnapshotControl;
CxeCameraDeviceControl &mCameraDeviceControl;
CxeFilenameGenerator &mFilenameGenerator; //! @todo could be shared with video capture control?
CxeSensorEventHandler &mSensorEventHandler;
@@ -162,20 +168,6 @@
QList mECamSupportedImageResolutions;
//current image quality details in use
CxeImageDetails mCurrentImageDetails;
-
-private: // Helper class
-
- class CxeCameraBufferCleanup
- {
- public:
- CxeCameraBufferCleanup(MCameraBuffer* buffer) : mBuffer(buffer) {}
- ~CxeCameraBufferCleanup() { if (mBuffer) { mBuffer->Release(); } }
-
- private:
- Q_DISABLE_COPY(CxeCameraBufferCleanup)
-
- MCameraBuffer* mBuffer;
- };
};
#endif // CXESTILLCAPTURECONTROLSYMBIAN_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxethumbnailmanagersymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxethumbnailmanagersymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxethumbnailmanagersymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
// forward declaration
class ThumbnailManager;
@@ -44,20 +45,13 @@
/**
* Creates from given thumbnail.
*/
- virtual void createThumbnail(const QString& filename, QPixmap thumbnail);
+ virtual void createThumbnail(const QString &filename, const QImage &thumbnail);
/**
* Cancels thumbnail creation.
*/
virtual void cancelThumbnail(const QString& filename);
-signals:
-
- /**
- * Informs clients about thumbnail ready event
- */
- void thumbnailReady(QPixmap thumbnail, int error);
-
private slots:
/**
@@ -66,7 +60,7 @@
void thumbnailReady(QPixmap thumbnail, void * data, int id, int error);
private:
- ThumbnailManager* mThumbnailManager;
+ ThumbnailManager *mThumbnailManager;
// file name, thumbnail id hash table
QHash mThumbnailRequests;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -38,6 +38,7 @@
class CxeQualityPresets;
class CxeFilenameGenerator;
class CxeViewfinderControl;
+class CxeSnapshotControl;
class CxeStillImageSymbian;
class CxeSoundPlayerSymbian;
class CxeCameraDeviceControl;
@@ -55,6 +56,7 @@
CxeVideoCaptureControlSymbian(CxeCameraDevice &cameraDevice,
CxeViewfinderControl &viewfinderControl,
+ CxeSnapshotControl &snapshotControl,
CxeCameraDeviceControl &cameraDeviceControl,
CxeFilenameGenerator &nameGenerator,
CxeSettings &settings,
@@ -75,9 +77,6 @@
QPixmap snapshot() const;
QList supportedVideoQualities();
-public: // public member functions, not in client API
- void handleSnapshotEvent(CxeError::Id error);
-
public: // functions from MVideoRecorderUtilityObserver
void MvruoOpenComplete(TInt aError);
void MvruoPrepareComplete(TInt aError);
@@ -98,14 +97,14 @@
void deinit();
//! Notification that videocapture sound has been played
void handleSoundPlayed();
+ //! Snapshot has been received from adaptiation.
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot);
protected slots:
// notifications when ECam reference is changed
void prepareForCameraDelete();
void handleCameraAllocated(CxeError::Id error);
void prepareForRelease();
- // ECam events
- void handleCameraEvent(int eventUid, int error);
// settings call back
void handleSettingValueChanged(const QString& settingId,QVariant newValue);
// scene mode change
@@ -114,19 +113,19 @@
void handleDiskSpaceChanged();
private: // helper methods
- CxeError::Id findVideoController(const TDesC8& aMimeType, const TDesC& aPreferredSupplier);
void releaseResources();
void initializeStates();
- CxeError::Id getVideoQualityDetails(CxeVideoDetails &videoInfo);
- int prepareVideoSnapshot();
+ void getVideoQualityDetails(CxeVideoDetails &videoInfo);
void initVideoRecorder();
void open();
void prepare();
- TSize getSnapshotSize() const;
virtual void createVideoRecorder();
- void calculateRemainingTime(CxeVideoDetails videoDetails, int &time);
- TFourCC audioType(const QString& str);
+ int calculateRemainingTime(const CxeVideoDetails& videoDetails);
void updateRemainingRecordingTimeCounter();
+ void generateFilename();
+ void handlePrepareFailed();
+ void handleComposeFailed(int error);
+ void emulateNormalStopping();
protected: // protected data
//! Video Recorder
@@ -141,6 +140,7 @@
CxeCameraDevice &mCameraDevice;
CxeCameraDeviceControl &mCameraDeviceControl;
CxeViewfinderControl &mViewfinderControl;
+ CxeSnapshotControl &mSnapshotControl;
CxeFilenameGenerator &mFilenameGenerator;
CxeSettings &mSettings;
CxeQualityPresets &mQualityPresets;
@@ -150,8 +150,6 @@
//! Soundplayers, own
CxeSoundPlayerSymbian *mVideoStartSoundPlayer;
CxeSoundPlayerSymbian *mVideoStopSoundPlayer;
- //! New file name generated for the video prepare.
- QString mNewFileName;
//! Current video file name
QString mCurrentFilename;
//video resolutions supported by ICM
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxevideorecorderutility.h
--- a/camerauis/cameraxui/cxengine/inc/cxevideorecorderutility.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxevideorecorderutility.h Thu Jul 15 01:55:05 2010 +0300
@@ -18,36 +18,36 @@
#define CXEVIDEORECORDERUTILITY_H_
#include
+#include
+#include
-// interface class for usage of CVideoRecorderUtility
+/*!
+* Video Recorder Utility interface.
+*/
class CxeVideoRecorderUtility
{
public:
virtual ~CxeVideoRecorderUtility() {}
- virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
- TInt aFunction,
- const TDesC8& aDataTo1,
- const TDesC8& aDataTo2) = 0;
- virtual void OpenFileL(const TDesC& aFileName,
- TInt aCameraHandle,
- TUid aControllerUid,
- TUid aVideoFormat,
- const TDesC8& aVideoType = KNullDesC8,
- TFourCC aAudioType = KMMFFourCCCodeNULL) = 0;
- virtual void SetVideoFrameSizeL(TSize aSize) = 0;
- virtual void SetVideoFrameRateL(TInt aRate) = 0;
- virtual void SetVideoBitRateL(TInt aRate) = 0;
- virtual void SetAudioEnabledL(TBool aEnable) = 0;
- virtual void SetMaxClipSizeL(TInt aClipSizeInBytes) = 0;
- virtual void Close() = 0;
- virtual void Prepare() = 0;
- virtual void Record() = 0;
- virtual int Stop() = 0;
- virtual void PauseL() = 0;
- virtual TTimeIntervalMicroSeconds RecordTimeAvailable() = 0;
- virtual TTimeIntervalMicroSeconds DurationL() = 0;
+ virtual void open(int cameraHandle,
+ const QString &filename,
+ const QString &fileMimeType,
+ const QString &supplier,
+ const QString &videoType,
+ const QString &aAudioType) = 0;
+ virtual void setVideoFrameSize(const QSize& size) = 0;
+ virtual void setVideoFrameRate(int rate) = 0;
+ virtual void setVideoBitRate(int rate) = 0;
+ virtual void setAudioEnabled(bool enable) = 0;
+ virtual void setVideoMaxSize(int sizeInBytes) = 0;
+ virtual void close() = 0;
+ virtual void prepare() = 0;
+ virtual void record() = 0;
+ virtual void stop(bool asynchronous = false) = 0;
+ virtual void pause() = 0;
+ virtual int availableRecordingTime() = 0;
+ virtual int duration() = 0;
protected:
CxeVideoRecorderUtility() {}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/inc/cxevideorecorderutilitysymbian.h
--- a/camerauis/cameraxui/cxengine/inc/cxevideorecorderutilitysymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxevideorecorderutilitysymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -24,37 +24,38 @@
{
public:
- CxeVideoRecorderUtilitySymbian(MVideoRecorderUtilityObserver& aObserver,
- TInt aPriority=EMdaPriorityNormal,
- TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);
-
+ CxeVideoRecorderUtilitySymbian(MVideoRecorderUtilityObserver& aObserver);
~CxeVideoRecorderUtilitySymbian();
- TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
- TInt aFunction,
- const TDesC8& aDataTo1,
- const TDesC8& aDataTo2);
- void OpenFileL(const TDesC& aFileName,
- TInt aCameraHandle,
- TUid aControllerUid,
- TUid aVideoFormat,
- const TDesC8& aVideoType = KNullDesC8,
- TFourCC aAudioType = KMMFFourCCCodeNULL);
- void SetVideoFrameSizeL(TSize aSize);
- void SetVideoFrameRateL(TInt aRate);
- void SetVideoBitRateL(TInt aRate);
- void SetAudioEnabledL(TBool aEnable);
- void SetMaxClipSizeL(TInt aClipSizeInBytes);
- void Close();
- void Prepare();
- void Record();
- int Stop();
- void PauseL();
- TTimeIntervalMicroSeconds RecordTimeAvailable();
- TTimeIntervalMicroSeconds DurationL();
+ virtual void open(int cameraHandle,
+ const QString &filename,
+ const QString &fileMimeType,
+ const QString &supplier,
+ const QString &videoType,
+ const QString &audioType);
+ virtual void setVideoFrameSize(const QSize& size);
+ virtual void setVideoFrameRate(int rate);
+ virtual void setVideoBitRate(int rate);
+ virtual void setAudioEnabled(bool enabled);
+ virtual void setVideoMaxSize(int sizeInBytes);
+ virtual void close();
+ virtual void prepare();
+ virtual void record();
+ virtual void stop(bool asynchronous = false);
+ virtual void pause();
+ virtual int availableRecordingTime();
+ virtual int duration();
+
+private:
+ void findControllerL(const QString& fileMimeType,
+ const QString& supplier,
+ TUid& controllerId,
+ TUid& formatId);
+
+ TFourCC audioFourCC(const QString& str);
+
private:
CVideoRecorderUtility *mVideoRecorder;
- int mStartuperror;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -40,11 +40,14 @@
/*
* CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian
*/
-CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice)
+CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice,
+ CxeSettings &settings)
: CxeStateMachine("CxeAutoFocusControlSymbian"),
mCameraDevice(cameraDevice),
mAdvancedSettings(NULL),
- mCancelled(false)
+ mSettings(settings),
+ mCancelled(false),
+ mFaceTrackingOverride(false)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -65,6 +68,13 @@
QObject::connect( &cameraDevice,
SIGNAL(prepareForRelease()),
this,SLOT(prepareForRelease()) );
+
+ // connect scene / setting change callbacks to settings control
+ QObject::connect(&mSettings,
+ SIGNAL(settingValueChanged(const QString&,QVariant)),
+ this,
+ SLOT(handleSettingValueChanged(const QString&,QVariant)));
+
OstTrace0(camerax_performance, CXEAUTOFOCUSCONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
initializeResources();
@@ -91,25 +101,28 @@
*/
CxeError::Id CxeAutoFocusControlSymbian::start(bool soundEnabled)
{
- CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <> state: %d, sound enabled: %d",
- state(), soundEnabled ) );
- mSoundEnabled = soundEnabled;
- int err = KErrNone;
-
CX_ASSERT_ALWAYS(mAdvancedSettings);
- if ( state() != CxeAutoFocusControl::InProgress && state() != CxeAutoFocusControl::Canceling ) {
- CX_DEBUG(("CxeAutoFocusControlSymbian::start() calling SetAutoFocusType"));
- mCancelled = false;
- setState(InProgress);
- setFocusRange(mAFRange);
- setFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle);
- } else { // AF was started earlier, can't start until it completes
- err = KErrInUse;
+ CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <> state: %d, sound enabled: %d",
+ state(), soundEnabled ) );
+
+ mSoundEnabled = soundEnabled;
+ CxeError::Id error = CxeError::None;
+
+ if (!isFixedFocusMode(mode())) {
+ if ( state() != CxeAutoFocusControl::InProgress && state() != CxeAutoFocusControl::Canceling ) {
+ CX_DEBUG(("CxeAutoFocusControlSymbian::start() calling SetAutoFocusType"));
+ mCancelled = false;
+ setState(InProgress);
+ setFocusRange(mAFRange);
+ setFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle);
+ } else { // AF was started earlier, can't start until it completes
+ error = CxeError::InUse;
+ }
}
- CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <= err : %d", err ) );
- return CxeErrorHandlingSymbian::map(err);
+ CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <= error: %d", error ) );
+ return error;
}
@@ -123,7 +136,7 @@
CX_DEBUG_ASSERT(mAdvancedSettings);
- if (!mCancelled) {
+ if (!mCancelled && !isFixedFocusMode(mode())) {
if (state() == CxeAutoFocusControl::InProgress) {
// Need to stop current AF first. Wait for AF event to proceed.
setState(CxeAutoFocusControl::Canceling);
@@ -171,6 +184,14 @@
return mAfMode;
}
+/**
+* Is the given mode a fixed focus mode?
+*/
+bool CxeAutoFocusControlSymbian::isFixedFocusMode(CxeAutoFocusControl::Mode mode) const
+{
+ return (mode == CxeAutoFocusControl::Hyperfocal
+ || mode == CxeAutoFocusControl::Infinity);
+}
/*
* To check if Autofocus is supported
@@ -389,7 +410,15 @@
// we are interested only in the AF range.
if(scene.contains(CxeSettingIds::FOCAL_RANGE) && supported() ) {
+
setMode(static_cast(scene[CxeSettingIds::FOCAL_RANGE].toInt()));
+
+ if (isFixedFocusMode(mode())) {
+ // Focus now if a fixed focus mode is used.
+ setFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle);
+ // Set state to InProgress, so we know to set it ready in ECAM callback.
+ setState(CxeAutoFocusControl::InProgress);
+ }
}
CX_DEBUG_EXIT_FUNCTION();
@@ -457,4 +486,40 @@
return mSoundEnabled;
}
+/*!
+* Handle new setting value.
+* New value is set to camera.
+* \param settingId The id of the updated setting
+* \param newValue A new value for the updated setting
+*/
+void CxeAutoFocusControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (settingId == CxeSettingIds::FACE_TRACKING) {
+ // Updating AF mode when face tracking is activated
+ // in scene mode which doesn't support face tracking
+ if (newValue.toInt()) {
+ //Face tracking enabled
+ if(mAfMode == CxeAutoFocusControl::Infinity ||
+ mAfMode == CxeAutoFocusControl::Hyperfocal) {
+ mPreviousAFMode = mAfMode;
+ setMode(CxeAutoFocusControl::Auto);
+ mFaceTrackingOverride = true;
+ }
+ } else {
+ //Face tracking disabled
+ if (mFaceTrackingOverride) {
+ mAfMode = mPreviousAFMode;
+ setMode(mAfMode);
+ mFaceTrackingOverride = false;
+ }
+ }
+
+ } else {
+ // do nothing
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxecameradevice.cpp
--- a/camerauis/cameraxui/cxengine/src/cxecameradevice.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxecameradevice.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -148,6 +148,7 @@
TRAPD(errorImgPr, mImageProcessor =
CCamera::CCameraImageProcessing::NewL(*mCamera));
CX_DEBUG(("CCameraImageProcessing status: %d", errorImgPr));
+ Q_UNUSED(errorImgPr); // Avoid release build unused variable warning.
TRAPD(errorSnap, mCameraSnapshot =
CCamera::CCameraSnapshot::NewL(*mCamera));
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxediskmonitorprivate.cpp
--- a/camerauis/cameraxui/cxengine/src/cxediskmonitorprivate.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxediskmonitorprivate.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -72,14 +72,6 @@
// Get the current free space.
mLatestFreeBytes = free(false);
- // TESTING >>>
- /*
- static qint64 TEST = 20*1000*1000;
- TEST /= 2;
- mLatestFreeBytes = TEST;
- */
- // <<< TESTING
-
// If space has changed during monitoring, signal it now.
if (previousFree != mLatestFreeBytes && isMonitoring()) {
CX_DEBUG(("CxeDiskMonitorPrivate - Disk space changed %d -> %d bytes", previousFree, mLatestFreeBytes));
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxeengine.cpp
--- a/camerauis/cameraxui/cxengine/src/cxeengine.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeengine.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -26,7 +26,7 @@
CX_DEBUG_ENTER_FUNCTION();
CxeEngineSymbian *res = new CxeEngineSymbian();
-
+ res->construct();
CX_DEBUG_EXIT_FUNCTION();
return res;
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -23,6 +23,7 @@
#include "cxevideocapturecontrolsymbian.h"
#include "cxesettingscontrolsymbian.h"
#include "cxeviewfindercontrolsymbian.h"
+#include "cxesnapshotcontrol.h"
#include "cxefilenamegeneratorsymbian.h"
#include "cxeautofocuscontrolsymbian.h"
#include "cxezoomcontrolsymbian.h"
@@ -38,6 +39,7 @@
#include "cxecameradevice.h"
#include "cxememorymonitor.h"
#include "cxediskmonitor.h"
+#include "cxegeotaggingtrail.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
@@ -51,6 +53,7 @@
: mCameraDeviceControl(NULL),
mCameraDevice(NULL),
mViewfinderControl(NULL),
+ mSnapshotControl(NULL),
mStillCaptureControl(NULL),
mVideoCaptureControl(NULL),
mSettingsControl(NULL),
@@ -62,27 +65,12 @@
mFilenameGenerator(NULL),
mSensorEventHandler(NULL),
mQualityPresets(NULL),
- mFileSaveThread(NULL)
+ mFileSaveThread(NULL),
+ mDiskMonitor(NULL),
+ mMemoryMonitor(NULL),
+ mGeoTaggingTrail(NULL)
{
- CX_DEBUG_ENTER_FUNCTION();
-
- // Do secondary construction during reserve call.
- //! @todo temporarily commented as part of a hack to change the startup sequence
- // to avoid GOOM issues
- // connect(this, SIGNAL(reserveStarted()), this, SLOT(construct()));
-
- CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
- mCameraDeviceControl = deviceControl;
- mCameraDevice = deviceControl->cameraDevice();
- CX_ASSERT_ALWAYS(mCameraDeviceControl);
- CX_ASSERT_ALWAYS(mCameraDevice);
-
- mCameraDeviceControl->init();
- //! @todo calling construct here is a hack to change the startup sequence
- // to avoid GOOM issues
- construct();
-
- CX_DEBUG_EXIT_FUNCTION();
+ CX_DEBUG_IN_FUNCTION();
}
@@ -110,7 +98,16 @@
// Check we do this only once.
if (!mSettingsModel) {
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "e_CX_ENGINE_CREATE_CONTROLS 1");
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "msg: e_CX_ENGINE_CREATE_CONTROLS 1");
+
+ CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
+ mCameraDeviceControl = deviceControl;
+ mCameraDevice = deviceControl->cameraDevice();
+
+ CX_ASSERT_ALWAYS(mCameraDeviceControl);
+ CX_ASSERT_ALWAYS(mCameraDevice);
+
+ mCameraDeviceControl->init();
CxeSettingsCenRepStore *settingsStore(NULL);
if (XQServiceUtil::isService()) {
@@ -124,11 +121,22 @@
CX_DEBUG_ASSERT(mSettingsModel);
mSettings = new CxeSettingsImp(*mSettingsModel);
-
+
+ // Loading current camera mode value from settings store and updating
+ // devicecontrol
+ Cxe::CameraMode cameraMode = Cxe::ImageMode;
+ int value;
+ CxeError::Id err = mSettings->get(CxeSettingIds::CAMERA_MODE, value);
+ if (!err) {
+ cameraMode = static_cast(value);
+ }
+ // set current camera mode to devicecontrol.
+ mCameraDeviceControl->setMode(cameraMode);
+
//! @todo a temporary hack to change the startup sequence to avoid GOOM problems
static_cast(mSettings)->loadSettings(mode());
-
-
+
+
// Connect P&S key updates to settings signal.
connect(settingsStore, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)));
@@ -153,25 +161,32 @@
mViewfinderControl = new CxeViewfinderControlSymbian(*mCameraDevice,
*mCameraDeviceControl);
- mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice);
+ mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
+
+ mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice,
+ *mSettings);
mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
mStillCaptureControl = new CxeStillCaptureControlSymbian(
- *mCameraDevice, *mViewfinderControl, *mCameraDeviceControl,
+ *mCameraDevice, *mViewfinderControl, *mSnapshotControl, *mCameraDeviceControl,
*mFilenameGenerator, *mSensorEventHandler, *mAutoFocusControl,
*mSettings, *mQualityPresets, *mFileSaveThread, *mDiskMonitor);
- mZoomControl = new CxeZoomControlSymbian( *mCameraDevice,
- *mCameraDeviceControl, *mSettings, *mFeatureManager);
+ mZoomControl = new CxeZoomControlSymbian(
+ *mCameraDevice, *mCameraDeviceControl, *mSettings, *mFeatureManager);
mVideoCaptureControl = new CxeVideoCaptureControlSymbian(
- *mCameraDevice, *mViewfinderControl, *mCameraDeviceControl,
+ *mCameraDevice, *mViewfinderControl, *mSnapshotControl, *mCameraDeviceControl,
*mFilenameGenerator, *mSettings, *mQualityPresets, *mDiskMonitor);
mSettingsControl = new CxeSettingsControlSymbian(*mCameraDevice, *mSettings);
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0");
+ mGeoTaggingTrail = new CxeGeoTaggingTrail(*mStillCaptureControl,
+ *mVideoCaptureControl,
+ *mSettings);
+
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "msg: e_CX_ENGINE_CREATE_CONTROLS 0");
}
CX_DEBUG_EXIT_FUNCTION();
@@ -183,7 +198,7 @@
void CxeEngineSymbian::connectSignals()
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_IN, "e_CX_ENGINE_CONNECT_SIGNALS 1");
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_IN, "msg: e_CX_ENGINE_CONNECT_SIGNALS 1");
// enabling scene setting change callbacks to Autofocus control
connect(mSettings,
@@ -200,7 +215,7 @@
// Connect signals for ECam events
connect(mCameraDeviceControl,
SIGNAL(cameraEvent(int,int)),
- mVideoCaptureControl,
+ mSnapshotControl,
SLOT(handleCameraEvent(int,int)));
connect(mCameraDeviceControl,
@@ -208,6 +223,11 @@
mAutoFocusControl,
SLOT(handleCameraEvent(int,int)));
+ connect(mCameraDeviceControl,
+ SIGNAL(cameraEvent(int,int)),
+ mStillCaptureControl,
+ SLOT(handleCameraEvent(int,int)));
+
// Connect signal for device ready events
connect(mCameraDeviceControl,
SIGNAL(deviceReady()),
@@ -240,19 +260,27 @@
// Connect file saving thread to snapshot signals and video saved signal.
// Image saving it handles internally.
connect(mStillCaptureControl,
- SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, int)),
+ SIGNAL(snapshotReady(CxeError::Id, const QImage&, int)),
mFileSaveThread,
- SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&, int)));
+ SLOT(handleSnapshotReady(CxeError::Id, const QImage&, int)));
connect(mVideoCaptureControl,
SIGNAL(videoComposed(CxeError::Id, const QString&)),
mFileSaveThread,
SLOT(handleVideoSaved(CxeError::Id, const QString&)));
connect(mVideoCaptureControl,
- SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)),
+ SIGNAL(snapshotReady(CxeError::Id, const QImage&, const QString&)),
mFileSaveThread,
- SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&, const QString&)));
+ SLOT(handleSnapshotReady(CxeError::Id, const QImage&, const QString&)));
+
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "e_CX_ENGINE_CONNECT_SIGNALS 0");
+ // stop location trail when releasing camera.
+ connect(mCameraDevice,
+ SIGNAL(prepareForRelease()),
+ mGeoTaggingTrail,
+ SLOT(stop()),
+ Qt::UniqueConnection);
+
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -261,11 +289,16 @@
{
CX_DEBUG_ENTER_FUNCTION();
+ // Saving current camera mode to cenrep
+ saveMode();
+
+ delete mGeoTaggingTrail;
delete mAutoFocusControl;
delete mZoomControl;
delete mSettingsControl;
delete mStillCaptureControl;
delete mVideoCaptureControl;
+ delete mSnapshotControl;
delete mViewfinderControl;
delete mFilenameGenerator;
delete mDiskMonitor;
@@ -290,6 +323,11 @@
return *mViewfinderControl;
}
+CxeSnapshotControl &CxeEngineSymbian::snapshotControl()
+{
+ return *mSnapshotControl;
+}
+
CxeStillCaptureControl &CxeEngineSymbian::stillCaptureControl()
{
return *mStillCaptureControl;
@@ -310,13 +348,17 @@
return *mZoomControl;
}
-// Get the settings handle
+/*!
+Returns the settings handle
+*/
CxeSettings &CxeEngineSymbian::settings()
{
return *mSettings;
}
-// Get the sensor event handle
+/*!
+Returns the sensor event handle
+*/
CxeSensorEventHandler &CxeEngineSymbian::sensorEventHandler()
{
return *mSensorEventHandler;
@@ -329,14 +371,23 @@
}
/*!
-* Get memory monitor utility handle.
+* Returns memory monitor utility handle.
*/
CxeMemoryMonitor &CxeEngineSymbian::memoryMonitor()
{
return *mMemoryMonitor;
}
-/*
+
+/*!
+ Returns geotaggingtrail handle
+ */
+CxeGeoTaggingTrail &CxeEngineSymbian::geoTaggingTrail()
+{
+ return *mGeoTaggingTrail;
+}
+
+/*!
* Returns true, if the engine is ready or else false.
*/
bool CxeEngineSymbian::isEngineReady()
@@ -364,7 +415,7 @@
void CxeEngineSymbian::doInit()
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_IN, "e_CX_ENGINE_DO_INIT 1");
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_IN, "msg: e_CX_ENGINE_DO_INIT 1");
mFilenameGenerator->init(mode());
// load settings whenever we change mode or start camera or switch camera
@@ -373,26 +424,44 @@
settingsImp->loadSettings(mode());
}
-
if (mode() == Cxe::ImageMode) {
+ // start geotagging trail in image mode.
+ startGeotaggingTrail();
mVideoCaptureControl->deinit();
mStillCaptureControl->init();
} else if (mode() == Cxe::VideoMode) {
mStillCaptureControl->deinit();
+ if (mGeoTaggingTrail) {
+ // in video mode, Geotagging is not supported for now.
+ mGeoTaggingTrail->stop();
+ }
mVideoCaptureControl->init();
}
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_OUT, "e_CX_ENGINE_DO_INIT 0");
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_OUT, "msg: e_CX_ENGINE_DO_INIT 0");
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ * Returns camera mode.
+ */
Cxe::CameraMode CxeEngineSymbian::mode() const
{
return mCameraDeviceControl->mode();
}
/*!
+ * Sets the camera mode.
+ * \parama mode New camera mode
+ */
+void CxeEngineSymbian::setMode(Cxe::CameraMode mode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mCameraDeviceControl->setMode(mode);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+/*!
Check if we need to reserve camera.
*/
bool CxeEngineSymbian::reserveNeeded()
@@ -457,6 +526,7 @@
void CxeEngineSymbian::initMode(Cxe::CameraMode cameraMode)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEENGINE_INITMODE_IN, "msg: e_CX_ENGINE_INIT_MODE 1");
if (mode() == cameraMode) {
CX_DEBUG(("initMode() called for current mode"));
@@ -508,6 +578,7 @@
}
}
+ OstTrace0(camerax_performance, CXEENGINE_INITMODE_OUT, "msg: e_CX_ENGINE_INIT_MODE 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -519,4 +590,44 @@
CX_DEBUG_EXIT_FUNCTION();
}
+
+/*!
+* Saves current mode to the cenrep
+*/
+void CxeEngineSymbian::saveMode()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mCameraDeviceControl && mSettings) {
+ int value = mCameraDeviceControl->mode();
+ mSettings->set(CxeSettingIds::CAMERA_MODE, value);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Start geotagging trail.
+*/
+void CxeEngineSymbian::startGeotaggingTrail()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEENGINE_START_GEO_IN, "msg: e_CX_ENGINE_START_GEOTAGGING 1");
+
+ if (mGeoTaggingTrail && mSettings) {
+ // location trail is limited to image mode only for now.
+ int value = Cxe::GeoTaggingDisclaimerDisabled;
+ mSettings->get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
+
+ // we start location trail only when Geotagging First-time-use note is accepted by user.
+ if (value == Cxe::GeoTaggingDisclaimerDisabled) {
+ mGeoTaggingTrail->start();
+ }
+ }
+
+ OstTrace0(camerax_performance, CXEENGINE_START_GEO_OUT, "msg: e_CX_ENGINE_START_GEOTAGGING 0");
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
// End of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -28,6 +28,11 @@
#include "cxeerror.h"
#include "cxeerrormappingsymbian.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cxefilenamegeneratorsymbianTraces.h"
+#endif
+
using namespace Cxe;
@@ -48,7 +53,10 @@
const char MAX_CHAR = 'Z';
const TInt64 KMinRequiredSpaceImage = 2000000;
-const TInt64 KMinRequiredSpaceVideo = 4000000;
+
+// Whether there's enough space for video or not is handled lower in the SW stack
+// so this is set to 0 to fix an error
+const TInt64 KMinRequiredSpaceVideo = 0;
@@ -76,6 +84,7 @@
mCurrentMode(mode)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATOR_1, "msg: e_CX_FILENAMEGENERATOR_NEW 1");
// Set default values (used in case of error retrieving values)
mCurrentMonth = "";
@@ -89,6 +98,7 @@
mSettings.get(CxeSettingIds::FNAME_IMAGE_COUNTER, mImageCounter);
mSettings.get(CxeSettingIds::FNAME_VIDEO_COUNTER, mVideoCounter);
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATOR_2, "msg: e_CX_FILENAMEGENERATOR_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -149,6 +159,7 @@
CxeError::Id CxeFilenameGeneratorSymbian::generateFilename(QString &qfName, const QString &fileExt)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_GENERATENAME_1, "msg: e_CX_GENERATE_FILENAME 1");
// Make sure that the path for images/videos exists
QString path;
@@ -164,6 +175,7 @@
}
}
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_GENERATENAME_2, "msg: e_CX_GENERATE_FILENAME 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(err);
}
@@ -350,6 +362,7 @@
int CxeFilenameGeneratorSymbian::selectFolder(QString &suggestedPath)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_SELECTFOLDER_1, "msg: e_CX_SELECT_FOLDER 1");
// Compose the path string and select counter based on mode.
QString basePath = "%1%2\\";
@@ -425,6 +438,7 @@
}
}
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_SELECTFOLDER_2, "msg: e_CX_SELECT_FOLDER 0");
CX_DEBUG_EXIT_FUNCTION();
// We fallback to basePath in case of unknown errors,
@@ -441,6 +455,7 @@
int CxeFilenameGeneratorSymbian::initMonthFolders()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INITFOLDERS_1, "msg: e_CX_INIT_MONTH_FOLDER 1");
// Month folder: YYYYMM, with suffix: YYYYMMXX
QString monthFolder = QDate::currentDate().toString("yyyyMM");
@@ -486,6 +501,7 @@
CX_DEBUG(("[FATAL] - Could not create month folder, error %d", status));
}
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INITFOLDERS_2, "msg: e_CX_INIT_MONTH_FOLDER 0");
CX_DEBUG_EXIT_FUNCTION();
return status;
}
@@ -593,6 +609,7 @@
CxeError::Id CxeFilenameGeneratorSymbian::init(Cxe::CameraMode mode)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INIT_1, "msg: e_CX_FILENAMEGENERATOR_INIT 1");
mCurrentMode = mode;
int err = KErrNone;
@@ -617,6 +634,7 @@
}
}
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INIT_2, "msg: e_CX_FILENAMEGENERATOR_INIT 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(err);
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -180,15 +180,27 @@
// Use a dummy "image data item" with empty data and saved state for videos.
// We just need to harvest the file and provide snapshot to Thumbnail Manager.
QByteArray empty;
- CxeImageDataItem* item = new CxeImageDataItemSymbian(empty, filename, CxeStillImage::INVALID_ID, CxeImageDataItem::Saved);
- if(item) {
+ CxeImageDataItem* item = new CxeImageDataItemSymbian(empty,
+ filename,
+ CxeStillImage::INVALID_ID,
+ false,
+ CxeImageDataItem::Saved);
+ if (item) {
save(item);
}
}
+
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename)
+/*!
+ * Handles snapshot event from CxeStillCaptureControl and CxeVideoCaptureControl.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code
+ * @param snapshot Snapshot as QImage
+ * @param filename Name of the file that the snapshot is from
+ */
+void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("[INFO] current thread 0x%x", QThread::currentThreadId()));
@@ -199,8 +211,6 @@
if (!snapshot.isNull()) {
// QMutexLocker handles locking and unlocking automaticly.
QMutexLocker lock(&mSnapshotsMutex);
-
- //!@todo: Store as QImage once TNM API is fixed.
mSnapshots.insert(filename, snapshot);
}
}
@@ -208,7 +218,14 @@
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id)
+/*!
+ * Handles snapshot event from CxeStillCaptureControl and CxeVideoCaptureControl.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code
+ * @param snapshot Snapshot as QImage
+ * @param id Id of the file that the snapshot is from
+ */
+void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("[INFO] current thread 0x%x", QThread::currentThreadId()));
@@ -316,13 +333,13 @@
// so we can find the snapshot when harvesting is ready.
QString idString(QString::number(item->id()));
if (mSnapshots.contains(idString)) {
- const QPixmap& snapshot(mSnapshots[idString]);
+ QImage snapshot(mSnapshots[idString]);
mSnapshots.remove(idString);
mSnapshots.insert(path, snapshot);
}
}
- harvestFile(path);
+ harvestFile(path, qobject_cast(item)->isLocationEnabled());
}
// Delete item, since we own it
@@ -337,7 +354,7 @@
* Harvest one file.
* @param filename Path of the file to be harvested.
*/
-void CxeFileSaveThreadSymbian::harvestFile(const QString& filename)
+void CxeFileSaveThreadSymbian::harvestFile(const QString& filename, bool addLocation)
{
CX_DEBUG_ENTER_FUNCTION();
if (mHarvesterControl) {
@@ -345,8 +362,8 @@
QMutexLocker lock(&mSnapshotsMutex);
// harvest file ( filename, add to album, album id )
- CX_DEBUG(("Requesting harvesting for file: %s", filename.toAscii().constData()));
- CxeError::Id status = mHarvesterControl->harvestFile(filename, false, MDS_CAPTURED_ALBUM_ID);
+ CX_DEBUG(("Requesting harvesting for file: %s addLocation = %d", filename.toAscii().constData(), addLocation));
+ CxeError::Id status = mHarvesterControl->harvestFile(filename, addLocation, MDS_CAPTURED_ALBUM_ID);
CX_DEBUG(("Status for starting harvesting: %d", status));
// If there were errors, release any snapshot stored for this file.
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxegeotaggingtrail.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cxutils.h"
+#include "cxegeotaggingtrail.h"
+#include "cxegeotaggingtrailprivate.h"
+
+/*!
+* Constructor
+*/
+CxeGeoTaggingTrail::CxeGeoTaggingTrail(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings)
+ : d_ptr(new CxeGeoTaggingTrailPrivate(stillControl, videoControl, settings))
+{
+ // connect signal state changed signal.
+ connect(d_ptr, SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
+ this, SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
+ Qt::UniqueConnection);
+}
+
+
+/*!
+* Destructor
+*/
+CxeGeoTaggingTrail::~CxeGeoTaggingTrail()
+{
+ delete d_ptr;
+}
+
+/*!
+* Slot to start location trail.
+*/
+void CxeGeoTaggingTrail::start()
+{
+ Q_D(CxeGeoTaggingTrail);
+ d->start();
+}
+
+/*!
+* Slot to stop location trail.
+*/
+void CxeGeoTaggingTrail::stop()
+{
+ Q_D(CxeGeoTaggingTrail);
+ d->stop();
+}
+
+
+
+/*!
+* Returns current state of Geo-tagging trail.
+*/
+CxeGeoTaggingTrail::State CxeGeoTaggingTrail::state()
+{
+ Q_D(CxeGeoTaggingTrail);
+ return d->state();
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include // For Q_OS_SYMBIAN define
+#if defined(Q_OS_SYMBIAN)
+#include
+#endif
+
+#include "cxutils.h"
+#include "cxestate.h"
+#include "cxesettings.h"
+#include "cxenamespace.h"
+#include "cxestillcapturecontrol.h"
+#include "cxevideocapturecontrol.h"
+#include "cxegeotaggingtrailprivate.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cxegeotaggingtrailprivateTraces.h"
+#endif
+
+
+namespace
+{
+ // in milliseconds
+ const int STOP_TRAIL_INTERVAL = 10*1000;
+}
+
+
+/*!
+* Constructor
+*/
+CxeGeoTaggingTrailPrivate::CxeGeoTaggingTrailPrivate(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings)
+ : CxeStateMachine("CxeGeoTaggingTrailPrivate"),
+ mStillCaptureControl(stillControl),
+ mVideoCaptureControl(videoControl),
+ mSettings(settings),
+ mStopLocationTrailTimer(),
+ mPendingStopTrailSession(false)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qRegisterMetaType();
+ initializeStates();
+
+#if defined(Q_OS_SYMBIAN)
+
+ QVariant locationTrailState;
+ // Get initial location trail state.
+ mSettings.get(KPSUidLocationTrail.iUid, KLocationTrailState,
+ Cxe::PublishAndSubscribe, locationTrailState);
+
+ connect(&mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
+ this, SLOT(handleGeoTaggingPropertyEvent(long int, unsigned long int, QVariant)));
+
+#endif
+
+ connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
+ this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
+
+ connect(&mStopLocationTrailTimer, SIGNAL(timeout()),
+ this, SLOT(timeout()), Qt::UniqueConnection);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Destructor
+*/
+CxeGeoTaggingTrailPrivate::~CxeGeoTaggingTrailPrivate()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // stop trail and close location utility session
+ stop(true);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Start location trail.
+*/
+void CxeGeoTaggingTrailPrivate::start()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_START_1, "msg: e_CX_START_GEOTAGGING 1");
+
+#if defined(Q_OS_SYMBIAN)
+
+ int err = KErrNone;
+ int settingValue = Cxe::GeoTaggingOff;
+ mSettings.get(CxeSettingIds::GEOTAGGING, settingValue);
+
+ if (settingValue == Cxe::GeoTaggingOn) {
+ // geotagging setting is ON, trying to start location trail
+ if (state() == CxeGeoTaggingTrail::NotConnected) {
+ err = mLocationTrail.Connect();
+ if (!err) {
+ CX_DEBUG(("CxeGeoTaggingTrail <> location trail connected"));
+ setState(CxeGeoTaggingTrail::Connected);
+ }
+ }
+
+ if (state() == CxeGeoTaggingTrail::Connected && !err) {
+ err = mLocationTrail.StartLocationTrail(RLocationTrail::ECaptureAll);
+ if (!err) {
+ CX_DEBUG(("CxeGeoTaggingTrail <> starting location trail"));
+ mStopLocationTrailTimer.stop(); // stop location timer.
+ setState(CxeGeoTaggingTrail::TrailStarted);
+ }
+ }
+
+ if (err) {
+ CX_DEBUG(("CxeGeoTaggingTrailPrivate::start <> FAILED: error = %d ", err));
+ stop(true);
+ }
+ } else {
+ // geotagging setting off, do nothing.
+ CX_DEBUG(("CxeGeoTaggingTrail <> start -- Geotagging setting OFF, do nothing.."));
+ }
+
+#endif
+ OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_START_2, "msg: e_CX_START_GEOTAGGING 0");
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+
+/*!
+* Stop location trail.
+* @ param closeSession, indicates if we are willing to close the location utility session.
+*/
+void CxeGeoTaggingTrailPrivate::stop(bool closeSession)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_STOP_1, "msg: e_CX_STOP_GEOTAGGING 1");
+
+#if defined(Q_OS_SYMBIAN)
+
+ bool ok2StopTrail = canStopTrail();
+
+ if (ok2StopTrail) {
+
+ if (state() == CxeGeoTaggingTrail::TrailStarted ||
+ state() == CxeGeoTaggingTrail::DataAvailable) {
+ CX_DEBUG(("CxeGeoTaggingTrailPrivate::StopLocationTrail"));
+ // stop location trail timer.
+ mStopLocationTrailTimer.stop();
+ mLocationTrail.StopLocationTrail();
+ setState(CxeGeoTaggingTrail::Connected);
+ }
+
+ if (closeSession && state() == CxeGeoTaggingTrail::Connected) {
+ CX_DEBUG(("CxeGeoTaggingTrailPrivate <> disconnect location trail utility"));
+ mLocationTrail.Close();
+ setState(CxeGeoTaggingTrail::NotConnected);
+ }
+ } else {
+ // not ready to stop the location trail, TrailStarted the timer.
+ if (!mPendingStopTrailSession) {
+ mPendingStopTrailSession = closeSession;
+ }
+ mStopLocationTrailTimer.start(STOP_TRAIL_INTERVAL);
+ }
+
+#endif
+
+ OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_STOP_2, "msg: e_CX_STOP_GEOTAGGING 0");
+}
+
+
+
+/*!
+* Checking possible stillcapturecontrol/videocapturecontrol states for stopping
+* location trail.
+*/
+bool CxeGeoTaggingTrailPrivate::canStopTrail() const
+{
+ // checking still capture control states
+ bool ok = mStillCaptureControl.state() != CxeStillCaptureControl::Capturing;
+
+ // Still side OK, checking video capture control states
+ if (ok) {
+ ok = (mVideoCaptureControl.state() != CxeVideoCaptureControl::Recording &&
+ mVideoCaptureControl.state() != CxeVideoCaptureControl::Paused &&
+ mVideoCaptureControl.state() != CxeVideoCaptureControl::Stopping);
+ }
+
+ return ok;
+}
+
+
+
+/*!
+* Slot that is called when timer timeout signal is triggered. We track this to do pending
+* stopping of location trail.
+*/
+void CxeGeoTaggingTrailPrivate::timeout()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // stop the pending location trail utility
+ stop(mPendingStopTrailSession);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+
+/*!
+* Handle new setting value.
+* Check if the geotagging setting has changed.
+*/
+void CxeGeoTaggingTrailPrivate::handleSettingValueChanged(const QString& settingId, QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (settingId == CxeSettingIds::GEOTAGGING) {
+ if (newValue.toInt() == Cxe::GeoTaggingOn) {
+ // setting is turned ON, start location trail
+ start();
+ } else {
+ // setting is turned OFF, stopping location trail
+ stop();
+ }
+ } else if (settingId == CxeSettingIds::GEOTAGGING_DISCLAIMER) {
+ if (newValue.toInt() == Cxe::GeoTaggingDisclaimerDisabled) {
+ // geotagging disclaimer is diabled, we can start location trail.
+ start();
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Handle new setting value.
+* Check if the geotagging setting has changed.
+*/
+void CxeGeoTaggingTrailPrivate::handleGeoTaggingPropertyEvent(long int uid,
+ unsigned long int key,
+ QVariant value)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+#if defined(Q_OS_SYMBIAN)
+
+ if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState) {
+ CX_DEBUG(("Location trail: new state = %d ", value.toInt()));
+
+ RLocationTrail::TTrailState newState =
+ static_cast(value.toInt());
+
+ if (newState == RLocationTrail::ETrailStarted) {
+ CX_DEBUG(("CxeGeoTaggingTrail <> location trail started, data available."));
+ setState(CxeGeoTaggingTrail::DataAvailable);
+ } else {
+ // ignoring all other state changes.
+ }
+ }
+
+#endif
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+Returns current state of Location trail
+*/
+CxeGeoTaggingTrail::State CxeGeoTaggingTrailPrivate::state() const
+{
+ return static_cast (stateId());
+}
+
+
+
+/*!
+* slot called when state is changed.
+*/
+void CxeGeoTaggingTrailPrivate::handleStateChanged(int newStateId, CxeError::Id error)
+{
+ emit stateChanged(static_cast (newStateId), error);
+
+}
+
+
+/*!
+* Initialize states for geotaggingtrail
+*/
+void CxeGeoTaggingTrailPrivate::initializeStates()
+{
+ // addState( id, name, allowed next states )
+ addState(new CxeState(CxeGeoTaggingTrail::NotConnected, "NotConnected", CxeGeoTaggingTrail::Connected));
+
+ addState(new CxeState(CxeGeoTaggingTrail::Connected, "Connected", CxeGeoTaggingTrail::TrailStarted |
+ CxeGeoTaggingTrail::NotConnected));
+
+ addState(new CxeState(CxeGeoTaggingTrail::TrailStarted, "TrailStarted", CxeGeoTaggingTrail::DataAvailable |
+ CxeGeoTaggingTrail::Connected |
+ CxeGeoTaggingTrail::NotConnected));
+
+ addState(new CxeState(CxeGeoTaggingTrail::DataAvailable, "DataAvailable", CxeGeoTaggingTrail::Connected |
+ CxeGeoTaggingTrail::NotConnected));
+
+
+ setInitialState(CxeGeoTaggingTrail::NotConnected);
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -31,11 +31,13 @@
CxeImageDataItemSymbian::CxeImageDataItemSymbian(QByteArray data,
QString filename,
int id,
+ bool addLocation,
CxeImageDataItem::State state)
: CxeStateMachine("CxeImageDataItemSymbian"),
mError(KErrNone),
mId(id),
mData(data),
+ mAddLocationInfo(addLocation),
mPath(filename)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -165,6 +167,7 @@
CxeError::Id CxeImageDataItemSymbian::save()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_IN, "msg: e_CX_IMAGEDATAITEM_SAVE 1");
mError = KErrNone;
@@ -225,7 +228,7 @@
mFile.Close(); //~400us
mFs.Close(); //~450us
- OstTrace0(camerax_performance, CXEIMAGEDATAIMTEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0");
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0");
if (mError == KErrNone) {
setState(CxeImageDataItem::Saved);
@@ -234,7 +237,7 @@
}
emit imageSaved(CxeErrorHandlingSymbian::map(mError), mPath, mId);
- CX_DEBUG(("mError: %d", mError));
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_OUT, "msg: e_CX_IMAGEDATAITEM_SAVE 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(mError);
}
@@ -327,6 +330,12 @@
emit stateChanged(static_cast (newStateId), error);
}
+
+bool CxeImageDataItemSymbian::isLocationEnabled() const
+{
+ return mAddLocationInfo;
+}
+
void CxeImageDataItemSymbian::initializeStates()
{
// addState( id, name, allowed next states )
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxeimagedataqueuesymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxeimagedataqueuesymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataqueuesymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -80,12 +80,12 @@
return *mList[index];
}
-CxeImageDataItemSymbian *CxeImageDataQueueSymbian::startSave( QByteArray data, QString path, int id )
+CxeImageDataItemSymbian *CxeImageDataQueueSymbian::startSave(QByteArray data, QString path, int id, bool addLocation)
{
CX_DEBUG_ENTER_FUNCTION();
- CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, id);
- mList.append( dataItem );
+ CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, id, addLocation);
+ mList.append(dataItem);
CX_DEBUG_EXIT_FUNCTION();
return dataItem;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -17,6 +17,7 @@
*
*/
+#include
#include // For Symbian types used in mmsenginedomaincrkeys.h
#include
@@ -35,15 +36,24 @@
namespace
{
// Display IDs for cameras, used when requesting data from ICM
- const int PRIMARY_CAMERA_DISPLAY_ID = 2;
- const int SECONDARY_CAMERA_DISPLAY_ID = 3;
+ const int PRIMARY_CAMERA_DISPLAY_ID = 2;
+ const int SECONDARY_CAMERA_DISPLAY_ID = 3;
- const int ONE_MILLION = 1000000;
- const qreal ASPECT_16_BY_9 = (16/9.0);
- const qreal DELTA_ERROR = 0.20;
+ const int ONE_MILLION = 1000000;
+
+ const QSize ASPECT_RATIO_SIZE_4BY3 = QSize(4,3);
+ const QSize ASPECT_RATIO_SIZE_16BY9 = QSize(16, 9);
+ const QSize ASPECT_RATIO_SIZE_11BY9 = QSize(11, 9);
// ICM "camcorderVisible" parameter value below this means sharing aka mms quality.
- const int MMS_QUALITY_CAMCORDERVISIBLE_LIMIT = 200;
+ const int MMS_QUALITY_CAMCORDERVISIBLE_LIMIT = 200;
+
+ // Average video bit rate scaler
+ const qreal VIDEO_AVG_BITRATE_SCALER = 0.9;
+ // Coefficient to estimate video metadata amount
+ const qreal VIDEO_METADATA_COEFF = 1.03;
+ // Maximum video clip duration in seconds for all qualities
+ const qint64 VIDEO_MAX_DURATION = 5400;
}
@@ -54,6 +64,7 @@
: mSettings(settings)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEQUALITYPRESETSSYMBIAN_1, "msg: e_CX_QUALITYPRESETS_NEW 1");
TRAPD(err, mIcm = CImagingConfigManager::NewL());
@@ -62,8 +73,8 @@
mIcm = NULL;
}
+ OstTrace0(camerax_performance, CXEQUALITYPRESETSSYMBIAN_2, "msg: e_CX_QUALITYPRESETS_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
-
}
/* !
@@ -98,7 +109,7 @@
int totalLevels = mIcm->NumberOfImageQualityLevels();
CX_DEBUG(("Total image quality levels = %d", totalLevels));
- CArrayFixFlat* levels= new CArrayFixFlat(totalLevels);
+ CArrayFixFlat* levels = new CArrayFixFlat(totalLevels);
// Get camera display id based on camera index
int displayId = cameraId == Cxe::SecondaryCameraIndex
@@ -235,6 +246,7 @@
*/
CxeVideoDetails CxeQualityPresetsSymbian::createVideoPreset(TVideoQualitySet set)
{
+ CX_DEBUG_ENTER_FUNCTION();
CxeVideoDetails newPreset;
// set setting values from quality set
newPreset.mWidth = set.iVideoWidth;
@@ -272,6 +284,7 @@
// set audiotype
newPreset.mAudioType = toString(fourCCBuf);
+ CX_DEBUG_EXIT_FUNCTION();
return newPreset;
}
@@ -295,14 +308,20 @@
{
Cxe::AspectRatio aspectRatio = Cxe::AspectRatio4to3;
- qreal ratio = 0;
- if (height != 0) {
- ratio = (1.0 * width) / height;
+ // calculate delta error for the resolution against supported aspect ratio's
+ int delta16by9 = abs((width * ASPECT_RATIO_SIZE_16BY9.height()) - (height * ASPECT_RATIO_SIZE_16BY9.width()));
+ int delta11by9 = abs((width * ASPECT_RATIO_SIZE_11BY9.height()) - (height * ASPECT_RATIO_SIZE_11BY9.width()));
+ int delta4by3 = abs((width * ASPECT_RATIO_SIZE_4BY3.height()) - (height * ASPECT_RATIO_SIZE_4BY3.width()));
- qreal delta16by9 = ratio - ASPECT_16_BY_9;
- if (abs(delta16by9) < DELTA_ERROR) {
- aspectRatio = Cxe::AspectRatio16to9;
- }
+ // get the closest aspect ratio
+ int minValue = qMin(qMin(delta16by9, delta11by9), delta4by3);
+
+ if (minValue == delta16by9) {
+ aspectRatio = Cxe::AspectRatio16to9;
+ } else if (minValue == delta11by9) {
+ aspectRatio = Cxe::AspectRatio11to9;
+ } else if (minValue == delta4by3) {
+ aspectRatio = Cxe::AspectRatio4to3;
}
return aspectRatio;
@@ -341,6 +360,48 @@
}
+/*!
+* Get the available recording time with given video quality details and disk space.
+* @param details Video quality details to use in calculation.
+* @param space Available disk space to use in calculation.
+* @return Available recording time estimate in seconds.
+*/
+int CxeQualityPresetsSymbian::recordingTimeAvailable(const CxeVideoDetails& details, qint64 space)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ int time(0);
+
+ // Maximum clip size may be limited for mms quality.
+ // If mMaximumSizeInBytes == 0, no limit is specified.
+ if (details.mMaximumSizeInBytes > 0 && details.mMaximumSizeInBytes < space) {
+ space = details.mMaximumSizeInBytes;
+ }
+
+ // Use average audio/video bitrates to estimate remaining time
+ qreal scaler(avgVideoBitRateScaler());
+ if (scaler == 0) {
+ // video bit rate scaler is 0, use the constant value
+ scaler = VIDEO_AVG_BITRATE_SCALER;
+ }
+
+ int muteSetting = 0; // audio enabled
+ mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
+
+ int avgVideoBitRate = (details.mVideoBitRate * scaler);
+ int avgAudioBitRate = (muteSetting == 1) ? 0 : details.mAudioBitRate;
+
+ quint32 averageBitRate = (quint32)((avgVideoBitRate + avgAudioBitRate) * VIDEO_METADATA_COEFF);
+ quint32 averageByteRate = averageBitRate / 8;
+
+ // 0 <= Remaining time <= KCamCMaxClipDurationInSecs
+ qint64 remaining = std::max(qint64(0), space/averageByteRate);
+ time = std::min(remaining, VIDEO_MAX_DURATION);
+
+ CX_DEBUG(( "remaining time from algorithm: %d", time ));
+ CX_DEBUG_EXIT_FUNCTION();
+ return time;
+}
+
/*!
Operator to sort values in ascending order.
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp
--- a/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -25,6 +25,9 @@
#include
#include
#include
+#ifdef Q_OS_SYMBIAN
+#include
+#endif
#include "xqsettingsmanager.h" // Settings Manager API
#include "xqsettingskey.h"
@@ -35,15 +38,22 @@
#include "cxeerror.h"
#include "cxecenrepkeys.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cxesettingscenrepstoreTraces.h"
+#endif
+
+
using namespace CxeSettingIds;
-/*
+/*!
* CxeSettingsCenRepStore::CxeSettingsCenRepStore
*/
CxeSettingsCenRepStore::CxeSettingsCenRepStore()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_1, "msg: e_CX_SETTINGSSTORE_CREATE 1");
// map keys of type "string" to cenrep ids
mapKeys();
@@ -51,13 +61,13 @@
// we create settings handle, scope user::scope
mSettingsManager = new XQSettingsManager(this);
- bool ok = false;
- ok = connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
- this, SLOT(handleValueChanged(XQSettingsKey, QVariant)));
- CX_DEBUG_ASSERT(ok);
+ bool ok = connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
+ this, SLOT(handleValueChanged(XQSettingsKey, QVariant)));
+ CX_ASSERT_ALWAYS(ok);
CX_DEBUG(("CxeSettingsCenRepStore - mSettingsManager ptr = %d", mSettingsManager));
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_2, "msg: e_CX_SETTINGSSTORE_CREATE 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -74,8 +84,10 @@
}
-/*
+/*!
* Generates XQSettingsKey from given setting/runtime key
+* \param key Name of the setting from which to generate the XQSettingsKey
+* \param[out] error Error code. CxeError::None if everything went fine.
*/
XQSettingsKey
CxeSettingsCenRepStore::generateXQSettingsKey(const QString& key, CxeError::Id& error)
@@ -103,7 +115,7 @@
-/*
+/*!
* Reads/loads all run-time settings values from cenrep
* @param QList contains list of all runtime key ids which we use to load values from cenrep.
* returns: QHash container, "contains" values associated with each key that are read from cenrep
@@ -112,6 +124,7 @@
QHash CxeSettingsCenRepStore::loadRuntimeSettings(QList& runtimeKeys)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_1, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 1");
QHash settings;
CxeError::Id err = CxeError::None;
@@ -145,12 +158,13 @@
CX_DEBUG_EXIT_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_2, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 0");
return settings;
}
-/*
+/*!
* Reads a value from cenrep
* @param key - setting key
* @param value - setting value read from cenrep
@@ -183,15 +197,16 @@
-/*
-* Reads a value from cenrep
+/*!
+* Reads a value from cenrep and starts the value change monitoring.
* @param key - setting key
* @param uid - setting UID of the component that owns the setting key
-* @param type - the type of key cr key or P&S key (constantly monitoring value)
+* @param type - the type of key cr key or P&S key
* @param value - setting value read from cenrep
+*
+* @sa handleValueChanged()
*/
-
-void CxeSettingsCenRepStore::get(long int uid,
+void CxeSettingsCenRepStore::startMonitoring(long int uid,
unsigned long int key,
Cxe::SettingKeyType type,
QVariant &value)
@@ -208,21 +223,27 @@
}
XQSettingsKey settingsKey(keyType, uid, key);
- CX_DEBUG(("reading values from XQSettingsManager.."));
+ CX_DEBUG(("reading value from XQSettingsManager.."));
value = mSettingsManager->readItemValue(settingsKey);
- if (keyType == XQSettingsKey::TargetPublishAndSubscribe) {
- bool ok = false;
- ok = mSettingsManager->startMonitoring(settingsKey);
- CX_DEBUG_ASSERT(ok);
+ // start monitoring changes for the key
+ // both P&S and Repository keys are monitored
+ bool ok = mSettingsManager->startMonitoring(settingsKey);
+ if (!ok) {
+ XQSettingsManager::Error error = mSettingsManager->error();
+ CX_DEBUG(("CxeSettingsCenRepStore - got error %d trying to start listening", error));
+ // If we try to start listening one key more than once,
+ // we get this error. We can safely ignore it.
+ ok = (XQSettingsManager::AlreadyExistsError == error);
}
+ CX_ASSERT_ALWAYS(ok);
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Sets a new value to cenrep
* @param key - setting key
* @param newValue - new value set to the key in cenrep
@@ -258,7 +279,7 @@
-/*
+/*!
* resets the cenrep store
*/
void CxeSettingsCenRepStore::reset()
@@ -270,12 +291,14 @@
}
-/*
-* adds key mapping to all settings
+/*!
+* Maps CxeSettingIds to cenrep key ids that XQSettingsManager understands
*/
void CxeSettingsCenRepStore::mapKeys()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_1, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 1");
+
mKeyMapping.clear();
// mapping setting keys
@@ -315,6 +338,38 @@
AudioMuteCr,
XQSettingsManager::TypeInt);
+ addKeyMapping(CxeSettingIds::GEOTAGGING,
+ GeoTaggingCr,
+ XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::FACE_TRACKING,
+ FacetrackingCr,
+ XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::IMAGE_SCENE,
+ SceneModeStillCr,
+ XQSettingsManager::TypeString);
+
+ addKeyMapping(CxeSettingIds::VIDEO_SCENE,
+ SceneModeVideoCr,
+ XQSettingsManager::TypeString);
+
+ addKeyMapping(CxeSettingIds::FLASH_MODE,
+ FlashModeStillCr,
+ XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON,
+ CaptureSoundAlwaysOnCr,
+ XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::CAMERA_MODE,
+ CameraModeCr,
+ XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::GEOTAGGING_DISCLAIMER,
+ GeoTaggingDisclaimerCr,
+ XQSettingsManager::TypeInt);
+
// mapping run-time keys
addKeyMapping(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS,
PrimaryCameraCaptureKeysCr,
@@ -346,11 +401,12 @@
XQSettingsManager::TypeString,
true);
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_2, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 0");
CX_DEBUG_EXIT_FUNCTION();
}
-/*
-* helper class to construct key mappings for each setting key
+/*!
+* helper method to construct key mappings for each setting key
*/
void CxeSettingsCenRepStore::addKeyMapping(QString key,
unsigned long int keyid,
@@ -381,14 +437,14 @@
/*!
-* Slot that handles value changed signal for Publish & Subscribe key.
+* Handles value changed signal from the XQSettingsManager.
+* Emits signals corresponding the changed setting.
+* \sa warningTonesChanged(), settingValueChanged()
*/
void CxeSettingsCenRepStore::handleValueChanged(XQSettingsKey key, QVariant value)
{
CX_DEBUG_ENTER_FUNCTION();
-
emit settingValueChanged(key.uid(), key.key(), value);
-
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
#include
#include
@@ -30,6 +31,12 @@
#include "cxesettingsmappersymbian.h"
#include "cxesettingscontrolsymbian.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cxesettingscontrolsymbianTraces.h"
+#endif
+
+
/*!
* Constructor
*/
@@ -59,6 +66,8 @@
/*!
* Handle new setting value.
* New value is set to camera.
+* \param settingId The id of the updated setting
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
{
@@ -79,6 +88,8 @@
updateExposureModeSetting(newValue);
} else if (settingId == CxeSettingIds::EV_COMPENSATION_VALUE) {
updateExposureCompensationSetting(newValue);
+ } else if (settingId == CxeSettingIds::FACE_TRACKING) {
+ updateFaceTrackingSetting(newValue);
} else {
// do nothing
}
@@ -93,23 +104,27 @@
/*!
* Handle new scene being set.
* Scene settings are checked and new values are set to camera.
-* @param scene New scene containing scene specific settings.
+* \param scene New scene containing scene specific settings.
*/
void CxeSettingsControlSymbian::handleSceneChanged(CxeScene& scene)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCONTROL_SCENE_1, "msg: e_CX_SCENE_SETTINGS_TO_CAMERA 1");
+
CX_DEBUG(("CxeSettingsControlSymbian <> new scene [%s]",
scene[CxeSettingIds::SCENE_ID].value().toAscii().constData()));
foreach (const QString& settingId, scene.keys()) {
handleSettingValueChanged(settingId, scene[settingId]);
}
+
+ OstTrace0(camerax_performance, CXESETTINGSCONTROL_SCENE_2, "msg: e_CX_SCENE_SETTINGS_TO_CAMERA 0");
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
-*
+* Update color tone setting value to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateColorToneSetting(QVariant newValue)
{
@@ -136,7 +151,8 @@
}
/*!
-*
+* Update white balance setting value to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateWhiteBalanceSetting(QVariant newValue)
{
@@ -155,7 +171,8 @@
}
/*!
-*
+* Update light sensitivity (ISO) setting value to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateLightSensitivitySetting(QVariant newValue)
{
@@ -180,7 +197,8 @@
}
/*!
-*
+* Update sharpness setting value to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateSharpnessSetting(QVariant newValue)
{
@@ -210,7 +228,8 @@
}
/*!
-*
+* Update contrast setting value to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateContrastSetting(QVariant newValue)
{
@@ -233,7 +252,8 @@
}
/*!
-*
+* Update brightness setting value to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateBrightnessSetting(QVariant newValue)
{
@@ -256,7 +276,8 @@
}
/*!
-*
+* Update Exposure mode to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateExposureModeSetting(QVariant newValue)
{
@@ -275,7 +296,8 @@
}
/*!
-*
+* Update Exposure Compensation mode to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateExposureCompensationSetting(QVariant newValue)
{
@@ -297,7 +319,8 @@
}
/*!
-*
+* Update flash mode to the camera device
+* \param newValue A new value for the updated setting
*/
void CxeSettingsControlSymbian::updateFlashSetting(QVariant newValue)
{
@@ -315,4 +338,18 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Update face tracking mode to the camera device
+* \param newValue A new value for the updated setting
+*/
+void CxeSettingsControlSymbian::updateFaceTrackingSetting(QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking();
+ if(faceTracking) {
+ TRAP_IGNORE(faceTracking->SetFaceTrackingL(newValue.toInt()));
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp
--- a/camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -69,7 +69,7 @@
/*!
Return the current integer setting value for the given key
*/
-CxeError::Id CxeSettingsImp::get(const QString& key, int& value) const
+CxeError::Id CxeSettingsImp::get(const QString &key, int &value) const
{
CX_DEBUG_ENTER_FUNCTION();
@@ -124,7 +124,7 @@
Return the current string setting value for the given key
*/
CxeError::Id CxeSettingsImp::get(
- const QString& key, QString &stringValue) const
+ const QString &key, QString &stringValue) const
{
CX_DEBUG_ENTER_FUNCTION();
@@ -173,7 +173,7 @@
Get the current scene mode setting value for the given key
*/
CxeError::Id CxeSettingsImp::getSceneMode(
- const QString& key, QString &stringValue) const
+ const QString &key, QString &stringValue) const
{
CX_DEBUG_ENTER_FUNCTION();
@@ -204,19 +204,21 @@
/*!
Set new int value for the given key
*/
-CxeError::Id CxeSettingsImp::set(const QString& key,int newValue)
+CxeError::Id CxeSettingsImp::set(const QString &key, int newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %d",
key.toAscii().data(), newValue));
- CxeError::Id err = mSettingsModel.set(key, newValue);
- emit settingValueChanged(key, newValue);
+ CxeError::Id error = mSettingsModel.set(key, newValue);
+ if (error == CxeError::None) {
+ emit settingValueChanged(key, newValue);
+ }
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
@@ -224,35 +226,38 @@
/*!
Set new int value for the given key
*/
-CxeError::Id CxeSettingsImp::set(const QString& key,qreal newValue)
+CxeError::Id CxeSettingsImp::set(const QString &key, qreal newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %f",
key.toAscii().data(), newValue));
- CxeError::Id err = mSettingsModel.set(key, newValue);
- emit settingValueChanged(key, newValue);
+ CxeError::Id error = mSettingsModel.set(key, newValue);
+
+ if (error == CxeError::None) {
+ emit settingValueChanged(key, newValue);
+ }
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
/*!
Set new string value for the given key
*/
-CxeError::Id CxeSettingsImp::set(const QString& key,const QString& newValue)
+CxeError::Id CxeSettingsImp::set(const QString &key, const QString &newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %s",
key.toAscii().data(), newValue.toAscii().data()));
- CxeError::Id err = setSceneMode(key, newValue);
+ CxeError::Id error = setSceneMode(key, newValue);
- if (err == CxeError::NotFound) {
+ if (error == CxeError::NotFound) {
// not scene mode setting, try setting value to settings store
mSettingsModel.set(key, newValue);
emit settingValueChanged(key, newValue);
@@ -260,7 +265,7 @@
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
@@ -269,34 +274,34 @@
Set the current scene mode setting value for the given key
*/
CxeError::Id CxeSettingsImp::setSceneMode(
- const QString& key,const QString& newValue)
+ const QString &key,const QString &newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %s",
key.toAscii().data(), newValue.toAscii().data()));
- CxeError::Id err = CxeError::None;
+ CxeError::Id error = CxeError::None;
CxeScene scene;
if(CxeSettingIds::IMAGE_SCENE == key) {
- err = mSettingsModel.setImageScene(newValue);
+ error = mSettingsModel.setImageScene(newValue);
scene = mSettingsModel.currentImageScene();
} else if(CxeSettingIds::VIDEO_SCENE == key) {
- err = mSettingsModel.setVideoScene(newValue);
+ error = mSettingsModel.setVideoScene(newValue);
scene = mSettingsModel.currentVideoScene();
} else {
- err = CxeError::NotFound;
+ error = CxeError::NotFound;
}
- if (err == CxeError::None) {
+ if (error == CxeError::None) {
// scene mode set, inform clients about scene mode change
emit sceneChanged(scene);
}
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
/*!
@@ -316,7 +321,7 @@
/*
* CxeSettingsImp::CxeSettingsImp
*/
-CxeSettingsImp::CxeSettingsImp(CxeSettingsModel& settingsModel)
+CxeSettingsImp::CxeSettingsImp(CxeSettingsModel &settingsModel)
: mSettingsModel(settingsModel)
{
CX_DEBUG_IN_FUNCTION();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp
--- a/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -36,7 +36,7 @@
using namespace Cxe;
-/*
+/*!
* CxeSettingsModel::CxeSettingsModel
*/
CxeSettingsModelImp::CxeSettingsModelImp(CxeSettingsStore *settingsStore)
@@ -51,28 +51,26 @@
}
-/*
+/*!
* CxeSettingsModelImp::init
*/
void CxeSettingsModelImp::init()
{
CX_DEBUG_ENTER_FUNCTION();
+ mCurrentImgScene.clear();
+ mCurrentVidScene.clear();
+
loadRuntimeSettings();
loadImageScenes();
loadVideoScenes();
- // TODO: for now the current image scene when we start camera is SceneAuto
- mCameraMode = Cxe::ImageMode;
- setImageScene(CxeSettingIds::IMAGE_SCENE_AUTO);
- setVideoScene(CxeSettingIds::VIDEO_SCENE_AUTO);
-
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* CxeSettingsModelImp::~CxeSettingsModelImp()
*/
CxeSettingsModelImp::~CxeSettingsModelImp()
@@ -94,7 +92,7 @@
-/*
+/*!
* Loads all run-time settings
*/
void CxeSettingsModelImp::loadRuntimeSettings()
@@ -112,7 +110,7 @@
}
-/*
+/*!
* Get setting value associated with the key.
* @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h )
* @Param value - contains the value associated with the key.
@@ -123,17 +121,17 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mSettingStore);
- // Try first to find the item from scene settings.
- // These need to override the common setting values.
- CxeError::Id err = sceneSettingValue(key, value);
- CX_DEBUG(( "status reading from scene data: %d", err));
+ // Try first to find the item from cenrep store.
+
+ CxeError::Id err = mSettingStore->get(key, value);
- // If scene does not control this setting, read it from settings store.
- if (err == CxeError::NotFound) {
+ // If setting is not in cenrep store, try fetching it from scene settings.
+ if (err) {
// setting not found in setting store, try finding if its scene specific setting.
- CX_DEBUG(( "fetching value from settings store" ));
- err = mSettingStore->get(key, value);
+ CX_DEBUG(( "fetching value from scene settings" ));
+ err = sceneSettingValue(key, value);
}
+
CX_DEBUG_EXIT_FUNCTION();
return err;
@@ -142,7 +140,7 @@
-/*
+/*!
* Get setting value associated with the key.
* @param uid - UID of component that owns the setting key
* @Param key - key id of the setting
@@ -157,7 +155,7 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mSettingStore);
- mSettingStore->get(uid, key, type, value);
+ mSettingStore->startMonitoring(uid, key, type, value);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -165,7 +163,7 @@
-/*
+/*!
* Set a value to the key.
* @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h )
* @Param value - contains the value associated with the key.
@@ -176,15 +174,12 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mSettingStore);
- // If this is one of scene settings,
- // store it as modification of current scene.
- CxeError::Id err = setSceneSettingValue(key, newValue);
- CX_DEBUG(( "status storing to scene data: %d", err));
+ // Try storing new value to cenrep
+ CxeError::Id err = mSettingStore->set(key, newValue);
- // If not scene specific, store the setting value.
- if (err == CxeError::NotFound) {
- CX_DEBUG(( "writing value to settings store" ));
- err = mSettingStore->set(key, newValue);
+ if (err) {
+ CX_DEBUG(( "Key not found in cenrepstore, writing value to scene settings" ));
+ err = setSceneSettingValue(key, newValue);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -193,7 +188,7 @@
}
-/*
+/*!
* Reset all settings
*/
void CxeSettingsModelImp::reset()
@@ -205,7 +200,7 @@
}
-/*
+/*!
* Get the configured run-time value associated with the key.
* @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h )
* @Param value - contains the value associated with the key.
@@ -230,7 +225,7 @@
}
-/*
+/*!
* Set new Image scene mode.
* @returns CxeError::None if successful or any CxeError specific error code.
*/
@@ -238,16 +233,20 @@
{
CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id err = CxeError::None;
+ // load scene specific settings
+ CxeError::Id err = loadSceneData(newScene, mCurrentImgScene);
+
+ if (!err) {
+ // saving current image scene to cenrep
+ err = set(CxeSettingIds::IMAGE_SCENE, newScene);
- // load the scene setting default values for the new scene id = "newScene"
- CxeScene sceneSettings;
- err = imageScene(newScene, sceneSettings);
+ // saving flash value from scene to cenrep
+ QString key(CxeSettingIds::FLASH_MODE);
+ err = set(key, mCurrentImgScene[key].toInt());
- // create of copy of the new scene as we use it for accessing the scene settings later.
- if (CxeError::None == err) {
- mCurrentImgScene.clear();
- loadSceneData(mCurrentImgScene, sceneSettings);
+ // saving face tracking value from scene to cenrep
+ key = CxeSettingIds::FACE_TRACKING;
+ err = set(key, mCurrentImgScene[key].toInt());
}
CX_DEBUG_EXIT_FUNCTION();
@@ -256,7 +255,7 @@
}
-/*
+/*!
* Set new video scene mode.
* @returns CxeError::None if successful or any CxeError specific error code.
*/
@@ -264,16 +263,11 @@
{
CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id err = CxeError::None;
+ CxeError::Id err = loadSceneData(newScene, mCurrentVidScene);
- // load the scene setting default values for the new scene id = "newScene"
- CxeScene sceneSettings;
- err = videoScene(newScene, sceneSettings);
-
- // create of copy of the new scene as we use it for accessing the scene settings later.
- if (CxeError::None == err) {
- mCurrentVidScene.clear();
- loadSceneData(mCurrentVidScene, sceneSettings);
+ if (!err) {
+ // video scene loaded successfully, store the scene value to cenrep
+ err = set(CxeSettingIds::VIDEO_SCENE, newScene);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -283,7 +277,7 @@
-/*
+/*!
* Loads Image scene settings for the given Scene ID
*/
CxeError::Id CxeSettingsModelImp::imageScene(const QString &sceneId, CxeScene &sceneSettings)
@@ -304,8 +298,10 @@
}
-/*
+/*!
* Loads Video scene settings for the given Scene ID
+* \param sceneId
+* \param sceneSettings
*/
CxeError::Id CxeSettingsModelImp::videoScene(const QString &sceneId, CxeScene &sceneSettings)
{
@@ -325,27 +321,46 @@
}
-/*
+/*!
* Creates a copy of the selected scene that we use for accessing specific scene settings.
+* \param newScene
+* \param currentSceneSettings
*/
-void CxeSettingsModelImp::loadSceneData(CxeScene ¤tScene, CxeScene &sceneDefaultSettings)
+CxeError::Id CxeSettingsModelImp::loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings)
{
CX_DEBUG_ENTER_FUNCTION();
- // creating a deep copy of the scene mode selected.
+ CxeScene sceneDefaultSettings;
+ CxeError::Id err = imageScene(newScene, sceneDefaultSettings);
+
+ if (err == CxeError::NotFound) {
+ // not still scene, try in video scene.
+ err = videoScene(newScene, sceneDefaultSettings);
+ }
- CxeScene::const_iterator scene = sceneDefaultSettings.constBegin();
- while (scene != sceneDefaultSettings.constEnd()) {
- currentScene.insert(scene.key(), scene.value());
- ++scene;
- }
+ if (!err) {
+ // We have a new scene available, so we can clear the old values.
+ currentSceneSettings.clear();
+
+ // creating a deep copy of the scene mode selected.
+ CxeScene::const_iterator scene = sceneDefaultSettings.constBegin();
+ while (scene != sceneDefaultSettings.constEnd()) {
+ currentSceneSettings.insert(scene.key(), scene.value());
+ ++scene;
+ }
+ }
CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
}
-/*
-* returns value associated with the key
+/*!
+* Returns scene setting value
+* \param key Settings key
+* \param[out] value Value associated with the key
+* \return Error id. CxeError::None if no errors.
*/
CxeError::Id CxeSettingsModelImp::sceneSettingValue(const QString &key, QVariant &value)
{
@@ -375,29 +390,33 @@
}
-/*
-* set scene setting value associated with the key
+/*!
+* Sets new value to settings specific to the scene.
+* @param key - setting id.
+* @param newValue - new setting value
+* @param error Error code. CxeError::None if operation has been successful.
+* @return Error id. CxeError::None if no errors.
*/
CxeError::Id CxeSettingsModelImp::setSceneSettingValue(const QString &key, QVariant newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CxeError::Id err = CxeError::None;
+ CxeScene *scene(0);
- if(mCameraMode == Cxe::ImageMode) {
+ if (mCameraMode == Cxe::ImageMode) {
CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Image mode Setting"));
- if(mCurrentImgScene.contains(key)) {
- mCurrentImgScene[key] = newValue;
- } else {
- err = CxeError::NotFound;
- }
+ scene = &mCurrentImgScene;
} else {
CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Video mode Setting"));
- if(mCurrentVidScene.contains(key)) {
- mCurrentVidScene[key] = newValue;
- } else {
- err = CxeError::NotFound;
- }
+ scene = &mCurrentVidScene;
+ }
+
+ if (scene && scene->contains(key)) {
+ CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue KEY found, writing value"));
+ scene->insert(key, newValue);
+ } else {
+ err = CxeError::NotFound;
}
CX_DEBUG_EXIT_FUNCTION();
@@ -406,7 +425,10 @@
}
-// appending the run-time keys to an array
+/*!
+* Appending the run-time keys to an array
+* \param[in,out] runtimeKeys QList where the supported runtimekeys will be added to
+*/
void CxeSettingsModelImp::supportedKeys(QList& runtimeKeys)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -422,7 +444,7 @@
}
-/*
+/*!
* Loads all video scene modes
*/
void CxeSettingsModelImp::loadVideoScenes()
@@ -433,7 +455,7 @@
CxeScene vidSceneAuto;
- vidSceneAuto.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_AUTO);
+ vidSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
vidSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
vidSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
vidSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -442,12 +464,12 @@
vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0);
vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
- mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_AUTO,vidSceneAuto);
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_AUTO,vidSceneAuto);
CxeScene vidSceneNight;
- vidSceneNight.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_NIGHT);
+ vidSceneNight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT);
vidSceneNight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
vidSceneNight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
vidSceneNight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
@@ -456,12 +478,12 @@
vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0);
vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
- mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_NIGHT, vidSceneNight);
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_NIGHT, vidSceneNight);
CxeScene vidSceneLowLight;
- vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_LOWLIGHT);
+ vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT);
vidSceneLowLight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
vidSceneLowLight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
vidSceneLowLight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -470,14 +492,14 @@
vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps
vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
- mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight);
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight);
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Loads all Image Scene Modes
*/
void CxeSettingsModelImp::loadImageScenes()
@@ -488,7 +510,7 @@
CxeScene imgSceneAuto;
- imgSceneAuto.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_AUTO);
+ imgSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO);
imgSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto);
imgSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -499,13 +521,14 @@
imgSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imgSceneAuto.insert(CxeSettingIds::BRIGHTNESS, 0);
imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto);
+ imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_AUTO, imgSceneAuto);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_AUTO, imgSceneAuto);
CxeScene imgSceneSports;
- imgSceneSports.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_SPORTS);
+ imgSceneSports.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS);
imgSceneSports.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
imgSceneSports.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgSceneSports.insert(CxeSettingIds::EXPOSURE_MODE, ExposureSport);
@@ -516,13 +539,14 @@
imgSceneSports.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imgSceneSports.insert(CxeSettingIds::BRIGHTNESS, 0);
imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff);
+ imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, imgSceneSports);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_SPORTS, imgSceneSports);
CxeScene imgSceneCloseUp;
- imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_MACRO);
+ imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO);
imgSceneCloseUp.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Macro);
imgSceneCloseUp.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgSceneCloseUp.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -533,12 +557,13 @@
imgSceneCloseUp.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imgSceneCloseUp.insert(CxeSettingIds::BRIGHTNESS, 0);
imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto);
+ imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_MACRO, imgSceneCloseUp);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_MACRO, imgSceneCloseUp);
CxeScene imgPortraitscene;
- imgPortraitscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_PORTRAIT);
+ imgPortraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT);
imgPortraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait);
imgPortraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgPortraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureBacklight);
@@ -549,12 +574,13 @@
imgPortraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imgPortraitscene.insert(CxeSettingIds::BRIGHTNESS, 0);
imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye);
+ imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
CxeScene imglandscapescene;
- imglandscapescene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_SCENERY);
+ imglandscapescene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY);
imglandscapescene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Infinity);
imglandscapescene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceSunny);
imglandscapescene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -565,13 +591,14 @@
imglandscapescene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imglandscapescene.insert(CxeSettingIds::BRIGHTNESS, 0);
imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff);
+ imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, imglandscapescene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_SCENERY, imglandscapescene);
CxeScene imgNightscene;
- imgNightscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHT);
+ imgNightscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
imgNightscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto);
imgNightscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgNightscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
@@ -582,12 +609,13 @@
imgNightscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imgNightscene.insert(CxeSettingIds::BRIGHTNESS, 0);
imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff);
+ imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, imgNightscene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHT, imgNightscene);
CxeScene imgNightpotraitscene;
- imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT);
+ imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT);
imgNightpotraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait);
imgNightpotraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgNightpotraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
@@ -598,13 +626,14 @@
imgNightpotraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
imgNightpotraitscene.insert(CxeSettingIds::BRIGHTNESS, 0);
imgNightpotraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye);
+ imgNightpotraitscene.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Returns the current image scene mode.
*/
CxeScene& CxeSettingsModelImp::currentImageScene()
@@ -616,7 +645,7 @@
}
-/*
+/*!
* Returns the current video scene mode.
*/
CxeScene& CxeSettingsModelImp::currentVideoScene()
@@ -628,13 +657,96 @@
}
-/*
-* Updating settings model whenever mode is changed from image to video and vice-versa.
+/*!
+* Restores settings whenever we switch between Image/Video modes or
+* during startup.
*/
void CxeSettingsModelImp::cameraModeChanged(Cxe::CameraMode newMode)
{
CX_DEBUG_ENTER_FUNCTION();
+
+ if (newMode == Cxe::ImageMode) {
+ restoreImageSettings();
+ } else {
+ restoreVideoSettings();
+ }
+
mCameraMode = newMode;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Restores image settings, during mode change or during startup.
+*/
+void CxeSettingsModelImp::restoreImageSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeError::Id err = CxeError::None;
+ QVariant currentSceneInUse = mCurrentImgScene[CxeSettingIds::SCENE_ID];
+
+ // get the image scene value from cenrep and load the scene settings
+ QVariant cenrepSceneValue;
+ QString key(CxeSettingIds::IMAGE_SCENE);
+ err = getSettingValue(key, cenrepSceneValue);
+
+ bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse);
+
+ if (!err && ok2LoadSceneSettings) {
+ // loading scene settings
+ err = loadSceneData(cenrepSceneValue.toString(), mCurrentImgScene);
+ }
+
+ // Updating Flash setting from cenrep
+ QVariant value;
+ key = CxeSettingIds::FLASH_MODE;
+ err = getSettingValue(key, value);
+
+ if (!err && mCurrentImgScene.contains(key)) {
+ // update local datastructure with flash setting value from cenrep.
+ CX_DEBUG(( "flash setting value %d", value.toInt()));
+ mCurrentImgScene[key] = value;
+ }
+
+ // Updating Face Tracking setting from cenrep
+ key = CxeSettingIds::FACE_TRACKING;
+ err = getSettingValue(key, value);
+
+ if (!err && mCurrentImgScene.contains(key)) {
+ // update local datastructure with flash setting value from cenrep.
+ CX_DEBUG(( "Face Tracking setting value %d", value.toInt()));
+ mCurrentImgScene[key] = value;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Restores video settings, during mode change or during startup.
+*/
+void CxeSettingsModelImp::restoreVideoSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeError::Id err = CxeError::None;
+ QVariant currentSceneInUse = mCurrentVidScene[CxeSettingIds::SCENE_ID];
+
+ // get the video scene value from cenrep and load the scene settings
+ QVariant cenrepSceneValue;
+ err = getSettingValue(CxeSettingIds::VIDEO_SCENE, cenrepSceneValue);
+
+ bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse);
+
+ if (!err && ok2LoadSceneSettings) {
+ // loading video scene settings
+ loadSceneData(cenrepSceneValue.toString(), mCurrentVidScene);
+ }
+
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesnapshotcontrol.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxesnapshotcontrol.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include
+#include "cxutils.h"
+#include "cxesnapshotcontrol.h"
+#include "cxesnapshotcontrolprivate.h"
+
+/*!
+* Constructor.
+* @param device Camera device interface, used for getting hold of adaptation snapshot API.
+*/
+CxeSnapshotControl::CxeSnapshotControl(CxeCameraDevice& device)
+{
+ d = new CxeSnapshotControlPrivate(this, device);
+ CX_ASSERT_ALWAYS(d);
+}
+
+/*!
+* Destructor.
+*/
+CxeSnapshotControl::~CxeSnapshotControl()
+{
+ delete d;
+}
+
+/*!
+* Get the state of Snapshot Control.
+* @return The current state.
+*/
+CxeSnapshotControl::State CxeSnapshotControl::state() const
+{
+ return d->state();
+}
+
+/*!
+* Calculate snapshot size based on diplay size and image / video output resolution.
+* @param displaySize Display size in pixels.
+* @param outputResolution Resolution of the output image / video in pixels.
+* @return Proposed best snapshot size.
+*/
+QSize CxeSnapshotControl::calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const
+{
+ return d->calculateSnapshotSize(displaySize, aspectRatio);
+}
+
+/*!
+* Start snapshot events. Snapshots will be signalled
+* through snapshotReady() signal.
+* @param size Size of the snapshot image.
+*/
+void CxeSnapshotControl::start(const QSize& size)
+{
+ d->start(size);
+}
+
+/*!
+* Stop snapshot events.
+*/
+void CxeSnapshotControl::stop()
+{
+ d->stop();
+}
+
+/*!
+* Handle camera events.
+* @param id Event uid.
+* @param error Status code of the event.
+*/
+void CxeSnapshotControl::handleCameraEvent(int eventUid, int error)
+{
+ d->handleCameraEvent(eventUid, error);
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesnapshotcontrolprivate.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxesnapshotcontrolprivate.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include
+#include
+// Note: Keep atleast one Qt include before preprocessor flags
+#ifdef Q_OS_SYMBIAN
+#include
+#include
+#include
+#include
+#endif // Q_OS_SYMBIAN
+
+#include "cxutils.h"
+#include "cxeerror.h"
+#include "cxeexception.h"
+#include "cxeerrormappingsymbian.h"
+#include "cxecameradevice.h"
+#include "cxestate.h"
+#include "cxesnapshotcontrol.h"
+#include "cxesnapshotcontrolprivate.h"
+
+
+namespace
+{
+ const int MAINTAIN_ASPECT = false;
+
+ const QSize ASPECT_RATIO_SIZE_4BY3 = QSize(4,3);
+ const QSize ASPECT_RATIO_SIZE_16BY9 = QSize(16, 9);
+ const QSize ASPECT_RATIO_SIZE_11BY9 = QSize(11, 9);
+
+#ifdef Q_OS_SYMBIAN
+ /*!
+ * Helper class for cleaning up MCameraBuffer instances.
+ */
+ class CxeCameraBufferCleanup
+ {
+ public:
+ explicit CxeCameraBufferCleanup(MCameraBuffer *buffer)
+ : mBuffer(buffer)
+ {
+ }
+
+ ~CxeCameraBufferCleanup()
+ {
+ if (mBuffer) {
+ CX_DEBUG(("CxeCameraBufferCleanup - releasing MCameraBuffer.."));
+ mBuffer->Release();
+ mBuffer = NULL;
+ }
+ }
+ private:
+ Q_DISABLE_COPY(CxeCameraBufferCleanup)
+ MCameraBuffer *mBuffer;
+ };
+#endif // Q_OS_SYMBIAN
+}
+
+
+/*!
+* Constructor.
+* @param parent Public interface of Snapshot control.
+* @param device Camera device interface, used for getting hold of adaptation snapshot API.
+*/
+CxeSnapshotControlPrivate::CxeSnapshotControlPrivate(CxeSnapshotControl *parent,
+ CxeCameraDevice& device)
+ : CxeStateMachine("CxeSnapshotControlPrivate"),
+ q(parent),
+ mDevice(device)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_ASSERT_ALWAYS(q);
+ initializeStates();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Destructor.
+*/
+CxeSnapshotControlPrivate::~CxeSnapshotControlPrivate()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ stop();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Called when state changes.
+* @param newStateId Id of the new state.
+* @param error Error code or CxeError::None in successful case.
+*/
+void CxeSnapshotControlPrivate::handleStateChanged(int newStateId, CxeError::Id error)
+{
+ emit q->stateChanged(static_cast(newStateId), error);
+}
+
+
+/*!
+* Get the state of Snapshot Control.
+* @return The current state.
+*/
+CxeSnapshotControl::State CxeSnapshotControlPrivate::state() const
+{
+ return static_cast (stateId());
+}
+
+/*!
+* Initialize Snapshot Control states
+*/
+void CxeSnapshotControlPrivate::initializeStates()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // addState( id, name, allowed next states )
+ addState(new CxeState(CxeSnapshotControl::Idle, "Idle", CxeSnapshotControl::Active));
+ addState(new CxeState(CxeSnapshotControl::Active, "Active", CxeSnapshotControl::Idle));
+
+ setInitialState(CxeSnapshotControl::Idle);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Calculate snapshot size based on diplay size and image / video output resolution.
+* @param displaySize Display size in pixels.
+* @param Cxe::AspectRatio Aspect ratio of image/video resolution.
+* @return Proposed best snapshot size.
+*/
+
+QSize CxeSnapshotControlPrivate::calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG(("CxeSnapshotControlPrivate - display size (%d,%d)", displaySize.width(), displaySize.height()));
+
+ // Take resolution as reference for aspect ratio.
+ // Scale keeping aspect ratio to just fit display.
+ QSize size;
+
+ if (aspectRatio == Cxe::AspectRatio4to3) {
+ size = ASPECT_RATIO_SIZE_4BY3;
+ } else if (aspectRatio == Cxe::AspectRatio16to9) {
+ size = ASPECT_RATIO_SIZE_16BY9;
+ } else if (aspectRatio == Cxe::AspectRatio11to9) {
+ size = ASPECT_RATIO_SIZE_11BY9;
+ }
+ size.scale(displaySize, Qt::KeepAspectRatio);
+
+ CX_DEBUG(("CxeSnapshotControlPrivate - adjusted final size, (%d,%d)", size.width(), size.height()));
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return size;
+}
+
+
+/*!
+* Start getting snapshots from camera.
+* Throws CxeException with CxeError::Id if error encountered.
+* @param size Size of the snapshot in pixels.
+*/
+void CxeSnapshotControlPrivate::start(const QSize &size)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+#ifdef Q_OS_SYMBIAN
+ CCamera::CCameraSnapshot *ss = mDevice.cameraSnapshot();
+ CX_ASSERT_ALWAYS(ss);
+
+ if (ss->IsSnapshotActive()) {
+ CX_DEBUG(("Stop currently active snapshot.."));
+ ss->StopSnapshot();
+ }
+
+ // Prepare snapshot
+ CCamera::TFormat snapFormat = CCamera::EFormatFbsBitmapColor16MU;
+ TSize snapSize = TSize(size.width(), size.height());
+
+ CX_DEBUG(("Prepare snapshot, size (%d x %d)..", size.width(), size.height()));
+ TRAPD(status, ss->PrepareSnapshotL(snapFormat, snapSize, MAINTAIN_ASPECT));
+ CxeException::throwIfError(CxeErrorHandlingSymbian::map(status));
+ CX_DEBUG(("After prepare ECAM modified size to (%d x %d)..", size.width(), size.height()));
+
+ CX_DEBUG(("Start snapshot.."));
+ ss->StartSnapshot();
+#else
+ Q_UNUSED(size);
+#endif // Q_OS_SYMBIAN
+ setState(CxeSnapshotControl::Active);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Stop getting snapshots from camera.
+*/
+void CxeSnapshotControlPrivate::stop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+#ifdef Q_OS_SYMBIAN
+ if (mDevice.cameraSnapshot()) {
+ mDevice.cameraSnapshot()->StopSnapshot();
+ }
+#endif // Q_OS_SYMBIAN
+ setState(CxeSnapshotControl::Idle);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Helper method for getting the snapshot.
+* Throws exception if fetching the snapshot fails.
+* @return QImage containing the snapshot.
+*/
+QImage CxeSnapshotControlPrivate::snapshot()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QImage image;
+
+ #ifdef Q_OS_SYMBIAN
+
+ CFbsBitmap *snapshot = NULL;
+ TRAPD(status, {
+ RArray frameIndex;
+ CleanupClosePushL(frameIndex);
+
+ MCameraBuffer &buffer(mDevice.cameraSnapshot()->SnapshotDataL(frameIndex));
+ // Make sure buffer is released on leave / exception.
+ // Buffer is released once the cleanup item goes out of scope.
+ CxeCameraBufferCleanup cleaner(&buffer);
+
+ TInt firstImageIndex(frameIndex.Find(0));
+ snapshot = &buffer.BitmapL(firstImageIndex);
+
+ CleanupStack::PopAndDestroy(); // frameIndex
+
+ TSize size = snapshot->SizeInPixels();
+ TInt sizeInWords = size.iHeight * CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU) / sizeof(TUint32);
+ CX_DEBUG(("size %d x %d, sizeInWords = %d", size.iWidth, size.iHeight, sizeInWords ));
+
+ CX_DEBUG(("Creating QImage"));
+ image = QImage(size.iWidth, size.iHeight, QImage::Format_RGB32);
+
+ // Convert to QImage
+ snapshot->LockHeap();
+ const uchar *dataPtr = (const uchar*) snapshot->DataAddress();
+ uchar *dst = image.bits();
+ memcpy(dst, dataPtr, image.numBytes());
+ snapshot->UnlockHeap();
+
+ });
+ // We throw error with the Symbian error code if there was problems.
+ CxeException::throwIfError(status);
+
+
+ #endif // Q_OS_SYMBIAN
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return image;
+}
+
+/*!
+* Handle camera snapshot events.
+* @param id Event uid.
+* @param error Status code of the event.
+*/
+void CxeSnapshotControlPrivate::handleCameraEvent(int id, int error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Ignoring all events if not active.
+ if (state() == CxeSnapshotControl::Active) {
+#ifdef Q_OS_SYMBIAN
+ if (id == KUidECamEventSnapshotUidValue) {
+ QImage ss;
+
+ if (!error) {
+ try {
+ ss = snapshot();
+ } catch (const CxeException& e) {
+ // Note: Normally CxeException carries CxeError::Id,
+ // but we intentionally use Symbian code in getSnapshot
+ // as it's easier to handle here.
+ error = e.error();
+ } catch (...) {
+ error = KErrGeneral;
+ }
+ }
+
+ // Emit snapshot ready signal through the public interface.
+ emit q->snapshotReady(CxeErrorHandlingSymbian::map(error), ss);
+ }
+#else
+ Q_UNUSED(id)
+ Q_UNUSED(error)
+#endif // Q_OS_SYMBIAN
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -16,12 +16,14 @@
*/
#include
#include
+#include
#include "cxutils.h"
#include "cxecameradevicecontrolsymbian.h"
#include "cxestate.h"
+#include "cxesettings.h"
+
const TUint KCxeAudioPriority = KAudioPriorityCameraTone;
-//const TUint KCxeAudioPriority = KAudioPriorityVideoRecording;
_LIT(KCxeCaptureSound, "z:\\system\\sounds\\digital\\capture.wav");
_LIT(KCxeVideoStartSound, "z:\\system\\sounds\\digital\\videoStart.wav");
@@ -29,13 +31,25 @@
_LIT(KCxeAutoFocusSound, "z:\\system\\sounds\\digital\\autoFocus.wav");
-CxeSoundPlayerSymbian::CxeSoundPlayerSymbian(CaptureSound soundId) :
+CxeSoundPlayerSymbian::CxeSoundPlayerSymbian(CaptureSound soundId,
+ CxeSettings &settings) :
CxeStateMachine("CxeSoundPlayerSymbian"),
mAudioPlayer(NULL),
- mSoundId(soundId)
+ mSoundId(soundId),
+ mUseSound(true),
+ mCaptureSoundForced(false),
+ mSettings(settings)
{
CX_DEBUG_ENTER_FUNCTION();
+ checkCaptureSoundSettings();
+
+ // connect to setting changed signal in order to monitor
+ // profile warning tone changes
+ connect(&mSettings,
+ SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
+ this, SLOT(enableSound(long int, unsigned long int, QVariant)));
+
qRegisterMetaType();
initializeStates();
@@ -52,6 +66,11 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ * Plays the current sound file if soundplayer is in correct state. Once
+ * playing is finished or there is an error playComplete signal is emitted.
+ * \sa playComplete()
+ */
void CxeSoundPlayerSymbian::play()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -59,15 +78,25 @@
// Only play the capture sound if CMdaAudioPlayerUtility is initialised
if (state() == Ready) {
- //! @todo: Define & implement what to do, when sound is already playing.
- // Important for sequence mode.
- setState(Playing);
- mAudioPlayer->Play();
+
+ if (mUseSound) {
+ //! @todo: Define & implement what to do, when sound is already playing.
+ // Important for sequence mode.
+ setState(Playing);
+ mAudioPlayer->Play();
+ } else {
+ CX_DEBUG(("CxeSoundPlayerSymbian::play capture sounds turned off"));
+
+ // sounds are off and we don't play the sound,
+ // act as the sound has been played
+ emit playComplete(KErrNone);
+ }
+
} else if( state() == NotReady ) {
// Here sound loading has failed.
// Emit signal with error code.
emit playComplete(KErrNotReady);
- }
+ }
CX_DEBUG_EXIT_FUNCTION();
}
@@ -131,9 +160,10 @@
delete mAudioPlayer;
mAudioPlayer = 0;
}
- TRAP( error, mAudioPlayer =
- CMdaAudioPlayerUtility::NewFilePlayerL(*filename, *this, KCxeAudioPriority,
- TMdaPriorityPreference(KAudioPrefCamera)) );
+ TRAP(error, mAudioPlayer =
+ CMdaAudioPlayerUtility::NewFilePlayerL(*filename,
+ *this, KCxeAudioPriority,
+ TMdaPriorityPreference(KAudioPrefCamera)));
if (!error) {
setState(Opening);
} else {
@@ -145,16 +175,25 @@
}
-void CxeSoundPlayerSymbian::handleStateChanged(int /*newStateId*/, CxeError::Id /*error*/)
+void CxeSoundPlayerSymbian::handleStateChanged(int newStateId, CxeError::Id error)
{
+ Q_UNUSED(newStateId);
+ Q_UNUSED(error);
// No implementation needed, because state is not visible outside of this class
}
+/*!
+ * Returns the current sound player state.
+ * \return Current state
+ */
CxeSoundPlayerSymbian::State CxeSoundPlayerSymbian::state() const
{
return static_cast(stateId());
}
+/*!
+ * Initialize CxeStateMachine.
+ */
void CxeSoundPlayerSymbian::initializeStates()
{
// addState(id, name, allowed next states)
@@ -165,3 +204,75 @@
setInitialState(NotReady);
}
+
+/*!
+ * Enables or disables the capture sound. If capture sound is forced to
+ * be always on, then the capture sound cannot be disabled.
+ *
+ * \param uid UID of the changed setting
+ * \param key Key of the changed setting
+ * \param value New setting value
+ */
+void CxeSoundPlayerSymbian::enableSound(long int uid, unsigned long int key, QVariant value)
+{
+
+ // selftimer is only interested in warning tones
+ if (uid == KCRUidProfileEngine.iUid && key == KProEngActiveWarningTones) {
+ CX_DEBUG_IN_FUNCTION();
+ // possible values are:
+ // 0 -> warning tones off
+ // 1 -> warning tones on
+ bool warningTonesEnabled = (value.toInt() == 1);
+
+ // update sound
+ mUseSound = mCaptureSoundForced || warningTonesEnabled;
+ }
+
+ CX_DEBUG(("CxeSoundPlayerSymbian::enableSound <> Use sound [%d]",
+ mUseSound));
+}
+
+/*!
+ * Checks the initial capture sound settings based on profile warning tones
+ * and whether the capture sound is forced to be always on. Connects settings
+ * signal for capture sounds changes to enableCaptureSound slot.
+ *
+ * \sa enableCaptureSound()
+ */
+void CxeSoundPlayerSymbian::checkCaptureSoundSettings()
+{
+
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVariant value(0);
+
+ // get current profile setting for using camerasound
+ // camera sound follows warning tone setting
+ unsigned long int key = KProEngActiveWarningTones;
+ long int uid = KCRUidProfileEngine.iUid;
+ mSettings.get(uid, key, Cxe::Repository, value);
+
+ // possible values are:
+ // 0 -> warning tones off
+ // 1 -> warning tones on
+ bool warningTonesEnabled = (value.toInt() == 1);
+ CX_DEBUG(("Warning tones enabled [%d]", value.toInt()));
+
+ // check whether capture sound is forced or not
+ int forced = 0;
+ mSettings.get(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, forced);
+ // 0 -> capture sound not forced
+ // 1 -> capture sound forced on
+ mCaptureSoundForced = (forced == 1);
+ CX_DEBUG(("Capture sound forced [%d]", forced));
+
+ // use sound if forced on or warningtones are enabled
+ mUseSound = mCaptureSoundForced || warningTonesEnabled;
+ CX_DEBUG(("Use sound [%d]", mUseSound));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+// end of file
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -18,11 +18,9 @@
#include
#include
-#include
#include
#include
#include
-#include
#include
#include "cxestillcapturecontrolsymbian.h"
@@ -34,8 +32,8 @@
#include "cxecameradevice.h"
#include "cxesoundplayersymbian.h"
#include "cxestillimagesymbian.h"
-#include "cxeviewfindercontrol.h"
#include "cxeviewfindercontrolsymbian.h"
+#include "cxesnapshotcontrol.h"
#include "cxesettingsmappersymbian.h"
#include "cxestate.h"
#include "cxesettings.h"
@@ -53,16 +51,18 @@
// constants
-const int KMaintainAspectRatio = false;
-const TInt64 KMinRequiredSpaceImage = 2000000;
+namespace
+{
+ const TInt64 KMinRequiredSpaceImage = 2000000;
+}
-
-/**
+/*!
* Constructor.
*/
CxeStillCaptureControlSymbian::CxeStillCaptureControlSymbian(
CxeCameraDevice &cameraDevice,
CxeViewfinderControl &viewfinderControl,
+ CxeSnapshotControl &snapshotControl,
CxeCameraDeviceControl &cameraDeviceControl,
CxeFilenameGenerator &nameGenerator,
CxeSensorEventHandler &sensorEventHandler,
@@ -74,6 +74,7 @@
: CxeStateMachine("CxeStillCaptureControlSymbian"),
mCameraDevice(cameraDevice),
mViewfinderControl(viewfinderControl),
+ mSnapshotControl(snapshotControl),
mCameraDeviceControl(cameraDeviceControl),
mFilenameGenerator(nameGenerator),
mSensorEventHandler(sensorEventHandler),
@@ -116,21 +117,21 @@
// Connect ECam image buffer ready event
connect(&mCameraDeviceControl, SIGNAL(imageBufferReady(MCameraBuffer*,int)),
this, SLOT(handleImageData(MCameraBuffer*,int)));
- // Connect signals for ECam events
- connect(&mCameraDeviceControl, SIGNAL(cameraEvent(int,int)),
- this, SLOT(handleCameraEvent(int,int)));
+ // connect snapshot ready signal
+ connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)),
+ this, SLOT(handleSnapshotReady(CxeError::Id, const QImage&)));
OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
mImageDataQueue = new CxeImageDataQueueSymbian();
- mAutoFocusSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::AutoFocus);
- mCaptureSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::StillCapture);
+ mAutoFocusSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::AutoFocus, mSettings);
+ mCaptureSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::StillCapture, mSettings);
OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_CREATE_OUT, "msg: e_CX_STILLCAPTURECONTROL_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Destructor.
*/
CxeStillCaptureControlSymbian::~CxeStillCaptureControlSymbian()
@@ -148,7 +149,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Return the current state.
*/
CxeStillCaptureControl::State CxeStillCaptureControlSymbian::state() const
@@ -156,7 +157,7 @@
return static_cast( stateId() );
}
-/**
+/*!
* Handle state changed event. Normally just emits the signal
* for observers to react appropriately.
*/
@@ -165,7 +166,7 @@
emit stateChanged( static_cast( newStateId ), error );
}
-/**
+/*!
* Initialize the control states.
*/
void CxeStillCaptureControlSymbian::initializeStates()
@@ -178,7 +179,7 @@
setInitialState(Uninitialized);
}
-/**
+/*!
* Initialize the still image capture control.
*/
void CxeStillCaptureControlSymbian::init()
@@ -196,7 +197,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Un-initialize the image mode.
*/
void CxeStillCaptureControlSymbian::deinit()
@@ -208,7 +209,7 @@
return;
}
- OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILL_CAPCONT_DEINIT 1" );
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" );
// Stop monitoring disk space.
mDiskMonitor.stop();
@@ -217,24 +218,23 @@
//stop viewfinder
mViewfinderControl.stop();
+ if (state() == Capturing) {
+ mCameraDevice.camera()->CancelCaptureImage();
+ }
+
// disable sensor event handler.
mSensorEventHandler.deinit();
- if (mCameraDevice.cameraSnapshot()) {
- mCameraDevice.cameraSnapshot()->StopSnapshot();
- }
+ mSnapshotControl.stop();
- if (state() == Capturing) {
- mCameraDevice.camera()->CancelCaptureImage();
- }
setState(Uninitialized);
- OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILL_CAPCONT_DEINIT 0" );
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" );
CX_DEBUG_EXIT_FUNCTION();
}
-/**!
+/*!
* Prepare still capture mode.
*/
void CxeStillCaptureControlSymbian::prepare()
@@ -246,7 +246,7 @@
return;
}
- OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1" );
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1");
int err = KErrNone;
CxeError::Id cxErr = getImageQualityDetails(mCurrentImageDetails);
@@ -271,9 +271,9 @@
// Prepare Image capture
CCamera::TFormat imgFormat = supportedStillFormat(mCameraDeviceControl.cameraIndex());
- OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1");
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1");
TRAP(err, mCameraDevice.camera()->PrepareImageCaptureL(imgFormat, ecamStillResolutionIndex));
- OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0");
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0");
CX_DEBUG(("PrepareImageCaptureL done, err=%d, resolution index = %d", err, ecamStillResolutionIndex));
@@ -318,63 +318,47 @@
// Inform interested parties that image mode has been prepared for capture
emit imagePrepareComplete(CxeErrorHandlingSymbian::map(err));
- OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_OUT, "msg: e_CX_STILLCAPCONT_PREPARE 0" );
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 0");
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_OUT, "msg: e_CX_STILLCAPCONT_PREPARE 0");
CX_DEBUG_EXIT_FUNCTION();
}
-/**!
+/*!
Prepare still snapshot
Returns symbian error code.
*/
int CxeStillCaptureControlSymbian::prepareStillSnapshot()
{
CX_DEBUG_ENTER_FUNCTION();
-
- CCamera::CCameraSnapshot *cameraSnapshot = mCameraDevice.cameraSnapshot();
- CX_ASSERT_ALWAYS(cameraSnapshot);
-
- int err = KErrNone;
- // Whether or not we have postcapture on, we need the snapshot for Thumbnail Manager.
- if (cameraSnapshot) {
- // Cancel active snapshot
- cameraSnapshot->StopSnapshot();
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_1, "msg: e_CX_PREPARE_SNAPSHOT 1" );
- // Prepare snapshot
- CCamera::TFormat snapFormat = CCamera::EFormatFbsBitmapColor16MU;
- OstTrace0( camerax_performance, DUP4_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 1" );
- TRAP(err, cameraSnapshot->PrepareSnapshotL(snapFormat,
- getSnapshotSize(),
- KMaintainAspectRatio));
- OstTrace0( camerax_performance, DUP5_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 0" );
- CX_DEBUG(("PrepareSnapshotL done, err=%d", err));
-
- // Start snapshot if no errors encountered.
- if (err == KErrNone) {
- CX_DEBUG(("Start still snapshot"));
- cameraSnapshot->StartSnapshot();
- }
- } else {
- // No snapshot interface available. Report error.
- // Assert above takes care of this, but keeping this as an option.
- err = KErrNotReady;
+ int status(KErrNone);
+ try {
+ QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
+ mViewfinderControl.deviceDisplayResolution(),
+ mCurrentImageDetails.mAspectRatio);
+ mSnapshotControl.start(snapshotSize);
+ } catch (...) {
+ status = KErrGeneral;
}
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_2, "msg: e_CX_PREPARE_SNAPSHOT 0" );
CX_DEBUG_EXIT_FUNCTION();
-
- return err;
+ return status;
}
-/**!
+/*!
imageInfo contains image qualities details
Returns CxeError error code.
*/
CxeError::Id CxeStillCaptureControlSymbian::getImageQualityDetails(CxeImageDetails &imageInfo)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_GETQUALITYDETAILS_1, "msg: e_CX_GET_QUALITY_DETAILS 1" );
int imageQuality = 0;
CxeError::Id err = CxeError::None;
@@ -396,37 +380,14 @@
imageInfo = mIcmSupportedImageResolutions.at(imageQuality);
}
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_GETQUALITYDETAILS_2, "msg: e_CX_GET_QUALITY_DETAILS 0" );
CX_DEBUG_EXIT_FUNCTION();
return err;
}
-
/*!
-* Returns snapshot size. Snapshot size is calculated based on the
-* display resolution and current image aspect ratio.
-*/
-TSize CxeStillCaptureControlSymbian::getSnapshotSize() const
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- TSize snapshotSize;
-
- QSize deviceResolution = mViewfinderControl.deviceDisplayResolution();
- QSize size = QSize(mCurrentImageDetails.mWidth, mCurrentImageDetails.mHeight);
-
- // scale according to aspect ratio.
- size.scale(deviceResolution.width(), deviceResolution.height(), Qt::KeepAspectRatio);
- CX_DEBUG(("Still Snapshot size, (%d,%d)", size.width(), size.height()));
- snapshotSize.SetSize(size.width(), deviceResolution.height());
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return snapshotSize;
-}
-
-
-/**
* Command to start image capture now.
+ * @sa handleCameraEvent
*/
void CxeStillCaptureControlSymbian::capture()
{
@@ -435,10 +396,10 @@
// Start the image capture as fast as possible to minimize lag.
// Check e.g. space available *after* this.
+ // Capture sound will be played when we receive "image capture event" from ECAM.
mCameraDevice.camera()->CaptureImage();
if (imagesLeft() > 0) {
- mCaptureSoundPlayer->play();
setState(Capturing);
//! @todo: NOTE: This call may not stay here. It can move depending on the implementation for burst capture.
@@ -464,7 +425,7 @@
}
-/* !
+/*!
@Param cameraIndex indicates which camera we are in use, primary/secondary
Returns the format we use for specific camera index.
*/
@@ -481,115 +442,62 @@
return imgFormat;
}
-
-/**
- * Camera events. Only relevant one(s) are handled.
+/*!
+ * Snapshot ready notification. Ask the snapshot from snapshot interface.
+ * NB: Typically snapshot arrives before image data but can be in reverse
+ * order as well.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code.
+ * @param snapshot Snapshot as QImage
*/
-void CxeStillCaptureControlSymbian::handleCameraEvent(int eventUid, int error)
+void CxeStillCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
{
CX_DEBUG_ENTER_FUNCTION();
+ if (mCameraDeviceControl.mode() == Cxe::ImageMode) {
- if (eventUid == KUidECamEventSnapshotUidValue &&
- mCameraDeviceControl.mode() == Cxe::ImageMode) {
- handleSnapshotEvent(CxeErrorHandlingSymbian::map(error));
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_1, "msg: e_CX_HANDLE_SNAPSHOT 1");
+
+ QPixmap ss = QPixmap::fromImage(snapshot);
+ // Get image container for current snapshot index.
+ // Remember to increment counter.
+ CxeStillImageSymbian* stillImage = getImageForIndex(mNextSnapshotIndex++);
+ if (status == CxeError::None) {
+ stillImage->setSnapshot(ss);
+ }
+
+ // Emit snapshotReady signal in all cases (error or not)
+ emit snapshotReady(status, snapshot, stillImage->id());
+
+ // When the snapshot ready event is handled, prepare new filename.
+ if (stillImage->filename().isEmpty()) {
+ // Error ignored at this point, try again when image data arrives.
+ prepareFilename(stillImage);
+ }
+
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0");
}
CX_DEBUG_EXIT_FUNCTION();
}
-/**
- * Snapshot ready notification. Ask the snapshot from snapshot interface.
- * NB: Typically snapshot arrives before image data but can be in reverse
- * order as well.
- */
-void CxeStillCaptureControlSymbian::handleSnapshotEvent(CxeError::Id error)
+/*!
+* Handle ECAM events.
+* Needed only for capture sound synchronization.
+* @param eventUid ECAM event id.
+* @param error Error code. KErrNone if operation has been successful.
+*/
+void CxeStillCaptureControlSymbian::handleCameraEvent(int eventUid, int error)
{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (state() == CxeStillCaptureControl::Uninitialized) {
- // we ignore this event, when we are not active
- return;
- }
-
- OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 1" );
-
- // Get image container for current snapshot index.
- // Remember to increment counter.
- CxeStillImageSymbian* stillImage = getImageForIndex(mNextSnapshotIndex++);
-
- if (error == CxeError::None) {
- try {
- stillImage->setSnapshot(extractSnapshot());
- } catch (const std::exception& ex) {
- error = CxeError::General;
+ if (eventUid == KUidECamEventImageCaptureEventUidValue && error == KErrNone) {
+ CX_DEBUG(("CxeStillCaptureControlSymbian::handleCameraEvent - image capture event"));
+ if (state() == CxeStillCaptureControl::Capturing) {
+ mCaptureSoundPlayer->play();
}
}
-
- // Emit snapshotReady signal in all cases (error or not)
- emit snapshotReady(error, stillImage->snapshot(), stillImage->id());
-
- // When the snapshot ready event is handled, prepare new filename.
- if (stillImage->filename().isEmpty()) {
- // Error ignored at this point, try again when image data arrives.
- prepareFilename(stillImage);
- }
-
- OstTrace0( camerax_performance, DUP1_CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 0" );
- CX_DEBUG_EXIT_FUNCTION();
}
-/**
-* Gets QPixmap snapshot from ECAM buffer, if available.
-* @param buffer ECAM buffer containing the snapshot data. Will be released when this
-* method returns, even on exception.
-*/
-QPixmap CxeStillCaptureControlSymbian::extractSnapshot()
-{
- CX_DEBUG_ENTER_FUNCTION();
- QPixmap pixmap;
- if (mCameraDevice.cameraSnapshot()) {
-
- QT_TRAP_THROWING({
- RArray frameIndex;
- CleanupClosePushL(frameIndex);
-
- MCameraBuffer &buffer(mCameraDevice.cameraSnapshot()->SnapshotDataL(frameIndex));
-
- // Make sure buffer is released on leave / exception
- CxeCameraBufferCleanup cleaner(&buffer);
- TInt firstImageIndex(frameIndex.Find(0));
- CFbsBitmap &snapshot(buffer.BitmapL(firstImageIndex));
-
- CleanupStack::PopAndDestroy(); // frameIndex
-
- TSize size = snapshot.SizeInPixels();
- TInt sizeInWords = size.iHeight * CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU) / sizeof(TUint32);
- CX_DEBUG(("size %d x %d, sizeInWords = %d", size.iWidth, size.iHeight, sizeInWords ));
-
- TUint32* pixelData = new (ELeave) TUint32[ sizeInWords ];
- // Convert to QImage
- snapshot.LockHeap();
- TUint32* dataPtr = snapshot.DataAddress();
- memcpy(pixelData, dataPtr, sizeof(TUint32)*sizeInWords);
- snapshot.UnlockHeap();
-
- CX_DEBUG(("Creating QImage"));
- QImage *snapImage = new QImage((uchar*)pixelData, size.iWidth, size.iHeight,
- CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU),
- QImage::Format_RGB32);
-
- pixmap = QPixmap::fromImage(*snapImage);
- delete [] pixelData;
- delete snapImage;
- });
- }
-
- CX_DEBUG_EXIT_FUNCTION();
- return pixmap;
-}
-
-/**
+/*!
* handleImageData: Image data received from ECam
*/
void CxeStillCaptureControlSymbian::handleImageData(MCameraBuffer* cameraBuffer, int error)
@@ -638,8 +546,15 @@
QByteArray byteArray( reinterpret_cast( data->Ptr() ), data->Size() );
data = NULL;
+ // get geotagging setting value and check if we have to add location trail to image data.
+ int value = Cxe::GeoTaggingOff;
+ mSettings.get(CxeSettingIds::GEOTAGGING, value);
+
// Save the image data
- CxeImageDataItemSymbian* dataItem = mImageDataQueue->startSave(byteArray, stillImage->filename(), stillImage->id());
+ CxeImageDataItemSymbian* dataItem = mImageDataQueue->startSave(byteArray,
+ stillImage->filename(),
+ stillImage->id(),
+ value == Cxe::GeoTaggingOn);
stillImage->setDataItem(dataItem);
mFileSaveThread.save(dataItem); // Saving thread takes ownership of dataItem.
}
@@ -660,7 +575,7 @@
}
-/**
+/*!
* Settings changed, needs updated
*/
void CxeStillCaptureControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
@@ -705,7 +620,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* ECam reference changing, release resources
*/
void CxeStillCaptureControlSymbian::prepareForCameraDelete()
@@ -715,7 +630,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Camera being released. Cancel ongoing capture, if any.
*/
void CxeStillCaptureControlSymbian::prepareForRelease()
@@ -725,7 +640,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* New camera available,
*/
void CxeStillCaptureControlSymbian::handleCameraAllocated(CxeError::Id error)
@@ -759,7 +674,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Return number of images captured (during current capture operation only).
*/
int CxeStillCaptureControlSymbian::imageCount() const
@@ -767,7 +682,7 @@
return mImages.count();
}
-/**
+/*!
* Reset the image array.
*/
void CxeStillCaptureControlSymbian::reset()
@@ -783,7 +698,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* This should cancel any ongoing image captures.
*/
void CxeStillCaptureControlSymbian::cancelAll()
@@ -792,7 +707,7 @@
reset();
}
-/**
+/*!
* Sets the current capture mode: SingleImageCapture / BurstCapture.
*/
void CxeStillCaptureControlSymbian::setMode( CaptureMode mode )
@@ -800,7 +715,7 @@
mMode = mode;
}
-/**
+/*!
* Returns the current capture mode.
*/
CxeStillCaptureControl::CaptureMode CxeStillCaptureControlSymbian::mode() const
@@ -808,7 +723,7 @@
return mMode;
}
-/**
+/*!
* Operator [] - returns the indexed image from capture array.
*/
CxeStillImage &CxeStillCaptureControlSymbian::operator[]( int index )
@@ -816,7 +731,7 @@
return *mImages[ index ];
}
-/**
+/*!
* Getter for image data queue.
*/
CxeImageDataQueue &CxeStillCaptureControlSymbian::imageDataQueue()
@@ -824,7 +739,7 @@
return *mImageDataQueue;
}
-/**
+/*!
* Generates a filename and sets it in the still image object.
* Skips the process if filename already copied exists in the object. This
* behaviour is required in rare cases where image data arrives before snapshot.
@@ -832,6 +747,8 @@
CxeError::Id
CxeStillCaptureControlSymbian::prepareFilename(CxeStillImageSymbian *stillImage)
{
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_1, "msg: e_CX_PREPARE_FILENAME 1" );
+
CxeError::Id err = CxeError::None;
if (stillImage->filename().isEmpty()) {
QString path;
@@ -855,6 +772,8 @@
CX_DEBUG(("ERROR in filename generation. err:%d", err));
}
}
+
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_2, "msg: e_CX_PREPARE_FILENAME 0" );
return err;
}
@@ -887,7 +806,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Get the image container at given index or create a new one if needed.
*/
CxeStillImageSymbian* CxeStillCaptureControlSymbian::getImageForIndex(int index)
@@ -921,8 +840,7 @@
// if focused and in correct mode, play sound
if (newState == CxeAutoFocusControl::Ready &&
- mode != CxeAutoFocusControl::Hyperfocal &&
- mode != CxeAutoFocusControl::Infinity &&
+ !mAutoFocusControl.isFixedFocusMode(mode) &&
mAutoFocusControl.isSoundEnabled()) {
mAutoFocusSoundPlayer->play();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxesysutil.cpp
--- a/camerauis/cameraxui/cxengine/src/cxesysutil.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesysutil.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -154,12 +154,6 @@
CX_DEBUG(("status getting volume info: %d", status));
qt_symbian_throwIfError(status);
- CX_DEBUG(("TVolumeInfo.iDrive.iType: %d", volumeInfo.iDrive.iType));
- CX_DEBUG((" EMediaNotPresent: %d", EMediaNotPresent));
- CX_DEBUG((" EMediaUnknown: %d", EMediaUnknown));
- CX_DEBUG(("TVolumeInfo.iDrive.iMediaAtt: %d", volumeInfo.iDrive.iMediaAtt));
- CX_DEBUG((" KMediaAttLocked: %d", KMediaAttLocked));
-
// Get critical treshold for free space on the drive.
// We must leave the free space above this.
QVariant criticalThreshold;
@@ -174,6 +168,7 @@
freeSpace = 0;
}
+ CX_DEBUG(("CxeSysUtil - free space: %d", freeSpace));
CX_DEBUG_EXIT_FUNCTION();
return freeSpace;
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -21,7 +21,7 @@
#include "cxutils.h"
#include "cxethumbnailmanagersymbian.h"
-//#define CXE_USE_THUMBNAIL_MANAGER
+
/*!
@@ -31,14 +31,11 @@
{
CX_DEBUG_ENTER_FUNCTION();
-#ifdef CXE_USE_THUMBNAIL_MANAGER
-
mThumbnailManager = new ThumbnailManager();
// connect thumbnail ready signal from thumbnailmanager
connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
this, SLOT(thumbnailReady(QPixmap, void *, int, int)));
-#endif
CX_DEBUG_EXIT_FUNCTION();
}
@@ -51,10 +48,8 @@
{
CX_DEBUG_ENTER_FUNCTION();
-#ifdef CXE_USE_THUMBNAIL_MANAGER
mThumbnailRequests.clear();
delete mThumbnailManager;
-#endif
CX_DEBUG_EXIT_FUNCTION();
}
@@ -66,20 +61,17 @@
@param filename - name of the image/video filename
@param snapshot - snapshot data from image/video
*/
-void CxeThumbnailManagerSymbian::createThumbnail(const QString& filename,
- QPixmap /*snapshot*/)
+void CxeThumbnailManagerSymbian::createThumbnail(const QString &filename,
+ const QImage &snapshot)
{
CX_DEBUG_ENTER_FUNCTION();
-#ifdef CXE_USE_THUMBNAIL_MANAGER
TPtrC16 fName(reinterpret_cast(filename.utf16()));
CX_DEBUG(("Create thumbnail! filename = %s", filename.toAscii().constData()));
if (mThumbnailManager) {
CX_DEBUG(("creating thumbnails"));
- //!@todo Thumbnail manager interface needs to be changed to use QImage
- // instead of QPixmap for setThumbnail. Until then, using qetThumbnail.
- int thumbnailId = mThumbnailManager->getThumbnail(filename, 0);
+ int thumbnailId = mThumbnailManager->setThumbnail(snapshot, filename);
if (thumbnailId != -1) {
CX_DEBUG(("Thumbnail ID = %d", thumbnailId));
mThumbnailRequests.insert(filename, thumbnailId);
@@ -87,9 +79,6 @@
CX_DEBUG(("error initializing data to thumbnail manager"));
}
}
-#else
- Q_UNUSED(filename);
-#endif
CX_DEBUG_EXIT_FUNCTION();
}
@@ -103,7 +92,6 @@
{
CX_DEBUG_ENTER_FUNCTION();
-#ifdef CXE_USE_THUMBNAIL_MANAGER
if (mThumbnailRequests.contains(filename)) {
int thumbnailId = mThumbnailRequests.value(filename);
if (mThumbnailManager &&
@@ -112,9 +100,7 @@
mThumbnailRequests.remove(filename);
}
}
-#else
- Q_UNUSED(filename);
-#endif
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -131,8 +117,9 @@
CX_DEBUG_ENTER_FUNCTION();
+ Q_UNUSED(thumbnail);
Q_UNUSED(data);
-#ifdef CXE_USE_THUMBNAIL_MANAGER
+
CX_DEBUG(("CxeThumbnailManagerSymbian::thumbnailReady error = %d", error));
QString key;
@@ -149,13 +136,7 @@
if (mThumbnailRequests.contains(key)) {
CX_DEBUG(("Thumbnail created for filename = %s", key.toAscii().constData()));
mThumbnailRequests.remove(key);
- emit thumbnailReady(thumbnail, error);
}
-#else
- Q_UNUSED(thumbnail);
- Q_UNUSED(id);
- Q_UNUSED(error);
-#endif
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -14,19 +14,22 @@
* Description:
*
*/
+
+#include
+#include
#include
-#include
#include
#include
#include
-#include
+#include "cxeexception.h"
#include "cxevideocapturecontrolsymbian.h"
#include "cxevideorecorderutilitysymbian.h"
#include "cxecameradevicecontrolsymbian.h"
#include "cxefilenamegeneratorsymbian.h"
#include "cxeerrormappingsymbian.h"
#include "cxeviewfindercontrol.h"
+#include "cxesnapshotcontrol.h"
#include "cxestillimagesymbian.h"
#include "cxecameradevice.h"
#include "cxutils.h"
@@ -47,26 +50,11 @@
// constants
namespace
{
- // Controller UId, can be used by the client to identify the controller, e.g. if the custom command can be used
- const TUid KCamCControllerImplementationUid = {0x101F8503};
// TMMFEvent UIDs for Async stop
const TUid KCamCControllerCCVideoRecordStopped = {0x2000E546};
const TUid KCamCControllerCCVideoFileComposed = {0x2000E547};
- // Custom command for setting a new filename without closing & reopening the controller
- enum TCamCControllerCustomCommands
- {
- ECamCControllerCCNewFilename = 0,
- ECamCControllerCCVideoStopAsync
- };
-
- const TInt KOneSecond = 1000000;
- const int KMaintainAspectRatio = false;
const TInt64 KMinRequiredSpaceVideo = 4000000;
- const uint KOneMillion = 1000000;
- const qreal KMetaDataCoeff = 1.03; // Coefficient to estimate metadata amount
- const uint KCamCMaxClipDurationInSecs = 5400; // Maximun video clip duration in seconds
- const qreal KCMRAvgVideoBitRateScaler = 0.9; // avg video bit rate scaler
}
@@ -76,6 +64,7 @@
CxeVideoCaptureControlSymbian::CxeVideoCaptureControlSymbian(
CxeCameraDevice &cameraDevice,
CxeViewfinderControl &viewfinderControl,
+ CxeSnapshotControl &snapshotControl,
CxeCameraDeviceControl &cameraDeviceControl,
CxeFilenameGenerator &nameGenerator,
CxeSettings &settings,
@@ -86,12 +75,14 @@
mCameraDevice(cameraDevice),
mCameraDeviceControl(cameraDeviceControl),
mViewfinderControl(viewfinderControl),
+ mSnapshotControl(snapshotControl),
mFilenameGenerator(nameGenerator),
mSettings(settings),
mQualityPresets(qualityPresets),
mDiskMonitor(diskMonitor),
mSnapshot(),
- mNewFileName(""),
+ mVideoStartSoundPlayer(NULL),
+ mVideoStopSoundPlayer(NULL),
mCurrentFilename("")
{
CX_DEBUG_ENTER_FUNCTION();
@@ -101,9 +92,11 @@
initializeStates();
mVideoStopSoundPlayer = new
- CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStop);
+ CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStop,
+ mSettings);
mVideoStartSoundPlayer = new
- CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStart);
+ CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStart,
+ mSettings);
// If camera is already allocated, call the slot ourselves.
if (mCameraDevice.camera()) {
@@ -118,23 +111,26 @@
this, SLOT(prepareForRelease()) );
connect(&cameraDevice, SIGNAL(cameraAllocated(CxeError::Id)),
this, SLOT(handleCameraAllocated(CxeError::Id)));
+
// connect playing sound signals
connect(mVideoStartSoundPlayer, SIGNAL(playComplete(int)),
this, SLOT(handleSoundPlayed()));
+ // connect snapshot ready signal
+ connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)),
+ this, SLOT(handleSnapshotReady(CxeError::Id, const QImage&)));
+
// enabling setting change callbacks to videocapturecontrol
connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
-
- connect(&mSettings, SIGNAL(sceneChanged(CxeScene&)), this, SLOT(handleSceneChanged(CxeScene&)));
-
+ connect(&mSettings, SIGNAL(sceneChanged(CxeScene&)),
+ this, SLOT(handleSceneChanged(CxeScene&)));
OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_CREATE_M2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_CREATE_OUT, "msg: e_CX_VIDEOCAPTURECONTROL_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* CxeVideoCaptureControlSymbian::~CxeVideoCaptureControlSymbian()
*/
@@ -150,7 +146,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Initializes resources for video recording.
*/
@@ -168,51 +163,47 @@
}
OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_INIT, "msg: e_CX_VIDEO_CAPCONT_INIT 0" );
-
CX_DEBUG_EXIT_FUNCTION();
}
-
-/*
+/*!
* Releases all resources
*/
void CxeVideoCaptureControlSymbian::deinit()
{
CX_DEBUG_ENTER_FUNCTION();
- if(state() == Idle) {
- // nothing to do
- return;
- }
+ // Nothing to do if already idle.
+ if(state() != Idle) {
+ OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 1" );
- OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 1" );
+ // first stop viewfinder
+ mViewfinderControl.stop();
- // first stop viewfinder
- mViewfinderControl.stop();
-
- // stop video-recording in-case if its ongoing.
- stop();
+ // stop video-recording in-case if its ongoing.
+ stop();
- if (mCameraDevice.cameraSnapshot()) {
- mCameraDevice.cameraSnapshot()->StopSnapshot();
- }
-
- if (mVideoRecorder) {
- mVideoRecorder->Close();
- }
+ // Check if state is stopping, in which case we have to inform the
+ // file harvester that a file is to be completed. We would not
+ // call harvestFile otherwise in this case.
+ // Otherwise the video will not be found from videos app.
+ if (state() == Stopping) {
+ emit videoComposed(CxeError::None, mCurrentFilename);
+ }
- // revert back the new filename to empty string so that we generate a new file name
- // when we init again
- mNewFileName = QString("");
+ mSnapshotControl.stop();
- setState(Idle);
+ if (mVideoRecorder) {
+ mVideoRecorder->close();
+ }
- OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 0" );
+ setState(Idle);
+ OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 0" );
+ }
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Intializes VideoRecorder for recording.
*/
@@ -220,52 +211,28 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (state() != Idle) {
- // not valid state to start "open" operation
- return;
- }
-
- if(!mVideoRecorder) {
- // if video recorder is not created, do it now.
- createVideoRecorder();
- }
-
- // update current video quality details from icm
- CxeError::Id err = getVideoQualityDetails(mCurrentVideoDetails);
+ // Init needed only in Idle state
+ if (state() == Idle) {
+ try {
+ // if video recorder is not created, do it now.
+ createVideoRecorder();
- if (!err) {
- // read videofile mime type
- QByteArray videoFileData =
- mCurrentVideoDetails.mVideoFileMimeType.toLatin1();
- TPtrC8 videoFileMimeType(reinterpret_cast
- (videoFileData.constData()), videoFileData.size());
+ // update current video quality details from icm.
+ // Throws an error if unable to get the quality.
+ getVideoQualityDetails(mCurrentVideoDetails);
- // read preferred supplier
- TPtrC16 supplier(reinterpret_cast
- (mCurrentVideoDetails.mPreferredSupplier.utf16()));
-
- err = findVideoController(videoFileMimeType, supplier);
-
- if (!err) {
- // video recorder is ready to open video file for recording.
+ // Video recorder is ready to open video file for recording.
setState(Initialized);
open();
+ } catch (const std::exception &e) {
+ // Handle error
+ handlePrepareFailed();
}
- } else {
- err = CxeErrorHandlingSymbian::map(KErrNotReady);
- }
-
- if (err) {
- // In case of error
- emit videoPrepareComplete(err);
- deinit();
}
CX_DEBUG_EXIT_FUNCTION();
}
-
-
/*!
* Opens file for video recording.
*/
@@ -273,92 +240,53 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (state() != Initialized) {
- // not valid state to start "open" operation
- return;
- }
-
- CxeError::Id err = CxeError::None;
+ // Check valid state to start "open" operation
+ if (state() == Initialized) {
+ try {
+ // generate video file name, if necessary
+ generateFilename();
+ CX_DEBUG(( "Next video file path: %s", mCurrentFilename.toAscii().constData() ));
- // generate video file name, if necessary
- if (mNewFileName.isEmpty()) {
- QStringList list = mCurrentVideoDetails.mVideoFileMimeType.split("/");
- QString fileExt(".");
- if (list.count() == 2) {
- fileExt = fileExt + list[1];
- }
- // Generate new filename and open the file for writing video data
- err = mFilenameGenerator.generateFilename(mNewFileName, fileExt);
- if (err == CxeError::None) {
- mCurrentFilename = mNewFileName;
- } else {
- // file name is not valid, re-initialize the value of current string
- // back to empty string
- mCurrentFilename = QString("");
- }
- }
+ // Start preparing..
+ setState(CxeVideoCaptureControl::Preparing);
- if (!err &&
- mVideoRecorder &&
- !mCurrentFilename.isEmpty()) {
-
- TPtrC16 fName(reinterpret_cast(mCurrentFilename.utf16()));
- CX_DEBUG(( "Next video file path: %s", mCurrentFilename.toAscii().constData() ));
-
- // read video codec mime type
- QByteArray videoCodecData =
- mCurrentVideoDetails.mVideoCodecMimeType.toLatin1();
- TPtrC8 videoCodecMimeType(reinterpret_cast
- (videoCodecData.constData()), videoCodecData.size());
-
- setState(CxeVideoCaptureControl::Preparing);
-
- TRAPD(openErr, mVideoRecorder->OpenFileL(fName,
- mCameraDevice.camera()->Handle(),
- mVideoControllerUid,
- mVideoFormatUid,
- videoCodecMimeType,
- audioType(mCurrentVideoDetails.mAudioType)));
-
- err = CxeErrorHandlingSymbian::map(openErr);
- }
- if (err) {
- // error occured.
- deinit();
- emit videoPrepareComplete(err);
+ // Exception thrown if open fails.
+ mVideoRecorder->open(mCameraDevice.camera()->Handle(),
+ mCurrentFilename,
+ mCurrentVideoDetails.mVideoFileMimeType,
+ mCurrentVideoDetails.mPreferredSupplier,
+ mCurrentVideoDetails.mVideoCodecMimeType,
+ mCurrentVideoDetails.mAudioType);
+ } catch (const std::exception &e) {
+ handlePrepareFailed();
+ }
}
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
-* Prepare Video Recorder with necessary settings for video capture.
+* Helper method for generating filename.
+* Throws exception, if file type mime is formatted wrong or
+* filename generation fails.
*/
-TFourCC CxeVideoCaptureControlSymbian::audioType(const QString& str)
+void CxeVideoCaptureControlSymbian::generateFilename()
{
CX_DEBUG_ENTER_FUNCTION();
-
- QByteArray audioType = str.toAscii();
-
- quint8 char1(' ');
- quint8 char2(' ');
- quint8 char3(' ');
- quint8 char4(' ');
+ mCurrentFilename = QString("");
- if (audioType.count() > 3) {
- char1 = audioType[0];
- char2 = audioType[1];
- char3 = audioType[2];
+ QStringList list = mCurrentVideoDetails.mVideoFileMimeType.split("/");
+ // Throw exception if mime string is formatted wrong.
+ if (list.count() != 2) {
+ throw new CxeException(CxeError::General);
+ }
+ QString fileExt = "." + list[1];
- if (audioType.count() == 4) {
- char4 = audioType[3];
- }
- }
+ // Generate new filename and open the file for writing video data
+ CxeException::throwIfError(mFilenameGenerator.generateFilename(mCurrentFilename, fileExt));
- return TFourCC(char1, char2, char3, char4);
+ CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Prepare Video Recorder with necessary settings for video capture.
*/
@@ -371,13 +299,8 @@
return;
}
- CX_DEBUG(("Video resoulution (%d,%d)", mCurrentVideoDetails.mWidth,
- mCurrentVideoDetails.mHeight));
- CX_DEBUG(("Video bitrate = %d)", mCurrentVideoDetails.mVideoBitRate));
-
- OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 1");
- TSize frameSize;
- frameSize.SetSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight);
+ OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_PREPARE_1, "msg: e_CX_VIDCAPCONT_PREPARE 1");
+ QSize frameSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight);
int muteSetting = 0; // audio enabled
mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
@@ -390,227 +313,67 @@
frameRate = mCurrentVideoDetails.mVideoFrameRate;
}
+ CX_DEBUG(("Video resolution (%d,%d)", mCurrentVideoDetails.mWidth,
+ mCurrentVideoDetails.mHeight));
+ CX_DEBUG(("Video bitrate = %d)", mCurrentVideoDetails.mVideoBitRate));
CX_DEBUG(("Video frame rate = %d)", frameRate));
- TRAPD(err,
- {
- mVideoRecorder->SetVideoFrameSizeL(frameSize);
- mVideoRecorder->SetVideoFrameRateL(frameRate);
- mVideoRecorder->SetVideoBitRateL(mCurrentVideoDetails.mVideoBitRate);
- mVideoRecorder->SetAudioEnabledL(muteSetting == 0);
- // "No limit" value is handled in video recorder wrapper.
- mVideoRecorder->SetMaxClipSizeL(mCurrentVideoDetails.mMaximumSizeInBytes);
- }
- );
+ try {
+ mVideoRecorder->setVideoFrameSize(frameSize);
+ mVideoRecorder->setVideoFrameRate(frameRate);
+ mVideoRecorder->setVideoBitRate(mCurrentVideoDetails.mVideoBitRate);
+ mVideoRecorder->setAudioEnabled(muteSetting == 0);
+ // "No limit" value is handled in video recorder wrapper.
+ mVideoRecorder->setVideoMaxSize(mCurrentVideoDetails.mMaximumSizeInBytes);
+
+ // Settings have been applied successfully, start to prepare.
+ mVideoRecorder->prepare();
- if (!err) {
- // settings have been applied successfully, start to prepare
- mVideoRecorder->Prepare();
- // prepare snapshot
- err = prepareVideoSnapshot();
+ // Prepare snapshot. Snapshot control throws error if problems.
+ QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
+ mViewfinderControl.deviceDisplayResolution(),
+ mCurrentVideoDetails.mAspectRatio);
+ mSnapshotControl.start(snapshotSize);
+
+ // Prepare zoom only when there are no errors during prepare.
+ emit prepareZoomForVideo();
+ emit videoPrepareComplete(CxeError::None);
+ } catch (const std::exception &e) {
+ // Handle error.
+ handlePrepareFailed();
}
- if (!err) {
- // prepare zoom only when there are no errors during prepare.
- emit prepareZoomForVideo();
- }
- // emit video prepare status
- emit videoPrepareComplete(CxeErrorHandlingSymbian::map(err));
-
- OstTrace0(camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 0");
-
+ OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_PREPARE_2, "msg: e_CX_VIDCAPCONT_PREPARE 0");
CX_DEBUG_EXIT_FUNCTION();
}
-
-
/*!
-Fetches video qualites details based on video quality setting.
-Returns CxeError codes if any.
+* Fetches video qualites details based on video quality setting.
*/
-CxeError::Id
+void
CxeVideoCaptureControlSymbian::getVideoQualityDetails(CxeVideoDetails &videoInfo)
{
CX_DEBUG_ENTER_FUNCTION();
-
- int videoQuality = 0;
- CxeError::Id err = CxeError::None;
-
- if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex) {
- err = mSettings.get(CxeSettingIds::VIDEO_QUALITY, videoQuality);
+ OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROL_GETQUALITYDETAILS_1, "msg: e_CX_GET_QUALITY_DETAILS 1" );
- bool validQuality = (videoQuality >= 0 &&
- videoQuality < mIcmSupportedVideoResolutions.count());
- if (err == CxeError::None && validQuality) {
- // get video quality details
- videoInfo = mIcmSupportedVideoResolutions.at(videoQuality);
- } else {
- // not valid video quality
- err = CxeError::NotFound;
- }
- } else {
- // get secondary camera video quality index
- if (mIcmSupportedVideoResolutions.count() > 0) {
- videoInfo = mIcmSupportedVideoResolutions.at(videoQuality);
- } else {
- // not valid video quality
- err = CxeError::NotFound;
- }
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
+ int quality(0);
-/**!
- Prepare snapshot
- Returns symbian error code.
- */
-int CxeVideoCaptureControlSymbian::prepareVideoSnapshot()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CCamera::CCameraSnapshot *cameraSnapshot = mCameraDevice.cameraSnapshot();
- CX_ASSERT_ALWAYS(cameraSnapshot);
-
- int err = KErrNone;
- // Whether or not we have postcapture on, we need the snapshot for Thumbnail Manager.
- if (cameraSnapshot) {
- // Cancel active snapshot
- cameraSnapshot->StopSnapshot();
-
- // Prepare snapshot
- CCamera::TFormat snapFormat = CCamera::EFormatFbsBitmapColor16MU;
- TRAP(err, cameraSnapshot->PrepareSnapshotL(snapFormat,
- getSnapshotSize(),
- KMaintainAspectRatio));
- CX_DEBUG(("PrepareSnapshotL done, err=%d", err));
- // Start snapshot if no errors encountered.
- if (err == KErrNone) {
- CX_DEBUG(("Start video snapshot"));
- cameraSnapshot->StartSnapshot();
- }
- } else {
- // No snapshot interface available. Report error.
- // Assert above takes care of this, but keeping this as an option.
- err = KErrNotReady;
+ // Get quality index for primary camera. Only one quality for secondary camera.
+ if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex) {
+ CxeException::throwIfError(mSettings.get(CxeSettingIds::VIDEO_QUALITY, quality));
}
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-
-/*!
-* Returns snapshot size. Snapshot size is calculated based on the
-* display resolution and current video aspect ratio.
-*/
-TSize CxeVideoCaptureControlSymbian::getSnapshotSize() const
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- TSize snapshotSize;
-
- QSize deviceResolution = mViewfinderControl.deviceDisplayResolution();
- QSize size = QSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight);
+ if (quality < 0 || quality >= mIcmSupportedVideoResolutions.count()) {
+ throw new CxeException(CxeError::NotFound);
+ }
- // scale according to aspect ratio.
- size.scale(deviceResolution.width(),
- deviceResolution.height(),
- Qt::KeepAspectRatio);
- CX_DEBUG(("Video Snapshot size, (%d,%d)", size.width(), size.height()));
- snapshotSize.SetSize(size.width(), deviceResolution.height());
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return snapshotSize;
-}
+ // get video quality details
+ videoInfo = mIcmSupportedVideoResolutions.at(quality);
-
-
-/**!
-* Camera events coming from ecam.
-*/
-void CxeVideoCaptureControlSymbian::handleCameraEvent(int eventUid, int error)
-{
- CX_DEBUG_ENTER_FUNCTION();
- if (eventUid == KUidECamEventSnapshotUidValue) {
- handleSnapshotEvent(CxeErrorHandlingSymbian::map(error));
- }
+ OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROL_GETQUALITYDETAILS_2, "msg: e_CX_GET_QUALITY_DETAILS 0" );
CX_DEBUG_EXIT_FUNCTION();
}
-
-/*!
-* Handle Snapshot event from ecam
-*/
-void CxeVideoCaptureControlSymbian::handleSnapshotEvent(CxeError::Id error)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (state() == Idle) {
- // we ignore this event, when we are not in active state(s)
- CX_DEBUG(( "wrong state, ignoring snapshot" ));
- CX_DEBUG_EXIT_FUNCTION();
- return;
- }
-
- if (error) {
- mSnapshot = QPixmap();
- emit snapshotReady(error, mSnapshot, filename());
- return;
- }
-
- RArray snapList;
- MCameraBuffer* buffer(NULL);
- // Note: Cleanup not required in this function
- CFbsBitmap *snapshot = NULL;
- TRAPD(snapErr,
- buffer = &mCameraDevice.cameraSnapshot()->SnapshotDataL(snapList));
- if (!snapErr) {
- TInt firstImageIndex = snapList.Find(0);
- snapList.Close();
- TRAP(snapErr, snapshot = &(buffer->BitmapL(firstImageIndex)));
- }
- if (!snapErr) {
- TSize size = snapshot->SizeInPixels();
- TInt sizeInWords = size.iHeight * CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU)
- / sizeof(TUint32);
-
- TUint32 *snapshotData = NULL;
- snapshotData = new TUint32[sizeInWords];
-
- if (snapshotData) {
- // Convert to QImage
- snapshot->LockHeap();
- TUint32* dataPtr = snapshot->DataAddress();
- memcpy(snapshotData, dataPtr, sizeof(TUint32) * sizeInWords);
- snapshot->UnlockHeap();
-
-
- QImage *img = new QImage((uchar*) snapshotData, size.iWidth, size.iHeight,
- CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU),
- QImage::Format_RGB32);
-
- mSnapshot = QPixmap::fromImage(*img);
- delete [] snapshotData;
- delete img;
- }
- }
- if (buffer) {
- buffer->Release();
- }
- // Snapshot ready
- emit snapshotReady(CxeErrorHandlingSymbian::map(snapErr), mSnapshot, filename());
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
/*!
* Resets the video snapshot and current video filename
*/
@@ -627,7 +390,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Returns current video filename
*/
@@ -639,7 +401,6 @@
return mCurrentFilename;
}
-
/*!
* Returns current video snapshot
*/
@@ -648,7 +409,6 @@
return mSnapshot;
}
-
/*!
* Starts video recording if we are in appropriate state.
*/
@@ -666,30 +426,23 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Pauses video recording.
*/
void CxeVideoCaptureControlSymbian::pause()
{
CX_DEBUG_ENTER_FUNCTION();
-
- setState(CxeVideoCaptureControl::Paused);
- TRAPD(pauseErr, mVideoRecorder->PauseL());
- // play the sound, but not changing the state
- mVideoStopSoundPlayer->play();
- if (pauseErr) {
- CX_DEBUG(("[WARNING] Error %d pausing!", pauseErr));
- //pause operation failed, report it
- emit videoComposed(CxeErrorHandlingSymbian::map(pauseErr), filename());
- // release resources.
- deinit();
+ try {
+ mVideoRecorder->pause();
+ setState(CxeVideoCaptureControl::Paused);
+ // play the sound, but not changing the state
+ mVideoStopSoundPlayer->play();
+ } catch (const std::exception &e) {
+ handleComposeFailed(qt_symbian_exception2Error(e));
}
-
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Stops video recording.
*/
@@ -701,35 +454,28 @@
// first stop viewfinder
mViewfinderControl.stop();
- TInt asyncStopErr = mVideoRecorder->CustomCommandSync(
- TMMFMessageDestination(KCamCControllerImplementationUid,
- KMMFObjectHandleController),
- ECamCControllerCCVideoStopAsync,
- KNullDesC8,
- KNullDesC8 );
- CX_DEBUG(("ECamCControllerCCVideoStopAsync sent, err=%d", asyncStopErr));
- if (asyncStopErr) { // fall back to synchronous stop
- TInt syncStopErr = mVideoRecorder->Stop();
- if (syncStopErr) {
- // error during stop operation, release resources
- emit videoComposed(CxeErrorHandlingSymbian::map(asyncStopErr), filename());
- deinit();
- } else {
- // stop operation went fine, set back the state to Initialized.
- setState(Initialized);
- mFilenameGenerator.raiseCounterValue();
+ try {
+ // Try asynchronous stopping first.
+ mVideoRecorder->stop(true);
+ // No error from asynchronous stop -> wait for stop event
+ setState(Stopping);
+ } catch (const std::exception &e) {
+ CX_DEBUG(("CxeVideoCaptureControlSymbian - async stop failed, try sync.."));
+ try {
+ mVideoRecorder->stop(false);
+ // stopping went ok
+ emulateNormalStopping();
+ } catch (const std::exception &e) {
+ // Even synchronous stopping failed -> release resources.
+ CX_DEBUG(("CxeVideoCaptureControlSymbian - sync stop failed, too!"));
+ handleComposeFailed(qt_symbian_exception2Error(e));
}
- } else {
- // No error from asynch stop custom command... wait for stop event
- setState(Stopping);
- mFilenameGenerator.raiseCounterValue();
}
}
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Callback when "Open" operation is complete.
*/
@@ -739,20 +485,16 @@
CX_DEBUG(("CxeVideoCaptureControlSymbian::MvruoOpenComplete, err=%d", aError));
if (state() == Preparing) {
- if (aError != KErrNone) {
- deinit();
- CxeError::Id err = CxeErrorHandlingSymbian::map(KErrNotReady);
- // report error to interested parties
- emit videoPrepareComplete(CxeErrorHandlingSymbian::map(err));
+ if (!aError) {
+ prepare();
} else {
- prepare();
+ handlePrepareFailed();
}
}
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Callback when "Prepare" request is complete.
*/
@@ -767,17 +509,13 @@
mViewfinderControl.start();
OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_GOTOVIDEO, "msg: e_CX_GO_TO_VIDEO_MODE 0" );
} else {
- deinit();
- // report error to interested parties
- CxeError::Id err = CxeErrorHandlingSymbian::map(KErrNotReady);
- emit videoPrepareComplete(CxeErrorHandlingSymbian::map(err));
+ handlePrepareFailed();
}
}
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Callback when "Record" operation is complete.
*/
@@ -793,20 +531,16 @@
// KErrCompletion is received when video recording stops
// because of maximum clip size is reached. Emulate
// normal stopping.
- setState(Stopping);
- MvruoEvent(TMMFEvent(KCamCControllerCCVideoRecordStopped, KErrNone));
- MvruoEvent(TMMFEvent(KCamCControllerCCVideoFileComposed, KErrNone));
+ emulateNormalStopping();
}
else {
// error during recording, report to client
- deinit();
- emit videoComposed(CxeErrorHandlingSymbian::map(aError), filename());
+ handleComposeFailed(aError);
}
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Callback from MVideoRecorderUtilityObserver
*/
@@ -824,11 +558,9 @@
// stop operation went fine, set back the state to intialized.
setState(Initialized);
}
+ mFilenameGenerator.raiseCounterValue();
// video file has composed, everything went well, inform the client
emit videoComposed(CxeError::None, filename());
- // revert back the new filename to empty string, since recording
- // is complete and we need to generate a new file name
- mNewFileName = QString("");
} else {
CX_DEBUG(("ignoring unknown MvruoEvent 0x%08x", aEvent.iEventType.iUid ));
}
@@ -836,85 +568,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
-/*!
-Get corresponding controller for video capture.
-@param aMimeType denotes videofile mimetype,
-@param aPreferredSupplier denotes supplier.
-Returns CxeError::Id if any.
-*/
-CxeError::Id
-CxeVideoCaptureControlSymbian::findVideoController(const TDesC8& aMimeType,
- const TDesC& aSupplier)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CX_DEBUG(("video file mime type : %s", &aMimeType));
- CX_DEBUG(("supplier name: %s", &aSupplier));
-
- mVideoControllerUid.iUid = 0;
- mVideoFormatUid.iUid = 0;
-
- // Retrieve a list of possible controllers from ECOM.
- // Controller must support recording the requested mime type.
- // Controller must be provided by preferred supplier.
-
- CMMFControllerPluginSelectionParameters* cSelect(NULL);
- CMMFFormatSelectionParameters* fSelect(NULL);
- RMMFControllerImplInfoArray controllers;
-
- TRAPD(err, cSelect = CMMFControllerPluginSelectionParameters::NewL());
- if (err) {
- return CxeErrorHandlingSymbian::map(err);
- }
-
- TRAP(err, fSelect = CMMFFormatSelectionParameters::NewL());
- if (err) {
- if(cSelect) {
- delete cSelect;
- }
- return CxeErrorHandlingSymbian::map(err);
- }
-
- TRAP( err, {
- fSelect->SetMatchToMimeTypeL(aMimeType);
- cSelect->SetRequiredRecordFormatSupportL(*fSelect);
- cSelect->SetPreferredSupplierL(aSupplier,
- CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned);
- cSelect->ListImplementationsL(controllers);
- } );
-
- if (!err && controllers.Count() >= 1) {
- // KErrNotFound is returned unless a controller is found
- err = KErrNotFound;
- // Get the controller UID.
- mVideoControllerUid = controllers[0]->Uid();
-
- // Inquires the controller about supported formats.
- // We use the first controller found having index 0.
- RMMFFormatImplInfoArray formats;
- formats = controllers[0]->RecordFormats();
-
- // Get the first format that supports our mime type.
- int count = formats.Count();
- for (int i=0; iSupportsMimeType(aMimeType)) {
- mVideoFormatUid = formats[i]->Uid(); // set the UID
- err = KErrNone;
- break;
- }
- }
- }
- delete cSelect;
- delete fSelect;
- controllers.ResetAndDestroy();
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return CxeErrorHandlingSymbian::map(err);
-}
-
-
/*!
* camera reference changing, release resources
*/
@@ -935,19 +588,24 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
-* new camera available,
+* new camera available
*/
void CxeVideoCaptureControlSymbian::handleCameraAllocated(CxeError::Id error)
{
CX_DEBUG_ENTER_FUNCTION();
if (!error) {
- // initialize the video recorder utility
- createVideoRecorder();
+ try {
+ // Create the video recorder utility
+ createVideoRecorder();
+ } catch (...) {
+ // We are just trying to create the recorder early.
+ // Retry later when preparing, and fail then if
+ // error still persists.
+ }
// new camera available, read supported video qualities from icm
- // load all still qualities supported by icm
+ // load all video qualities supported by icm
mIcmSupportedVideoResolutions.clear();
Cxe::CameraIndex cameraIndex = mCameraDeviceControl.cameraIndex();
// get list of supported image qualities based on camera index
@@ -958,73 +616,46 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
* Initializes video recorder.
+* May throw exception.
*/
void CxeVideoCaptureControlSymbian::createVideoRecorder()
{
CX_DEBUG_ENTER_FUNCTION();
-
- // init video recoder
- if (state() == CxeVideoCaptureControl::Idle) {
- if (mVideoRecorder == NULL) {
- TRAPD(initErr, mVideoRecorder =
- new CxeVideoRecorderUtilitySymbian( *this ,
- KAudioPriorityVideoRecording,
- TMdaPriorityPreference( KAudioPrefVideoRecording )));
- if (initErr) {
- CX_DEBUG(("WARNING - VideoRecorderUtility could not be reserved. Failed with err:%d", initErr));
- mVideoRecorder = NULL;
- }
- }
+ if (mVideoRecorder == NULL) {
+ mVideoRecorder = new CxeVideoRecorderUtilitySymbian(*this);
}
-
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
-* releases resources used by videocapture
+* releases resources used by video capture control
*/
void CxeVideoCaptureControlSymbian::releaseResources()
{
CX_DEBUG_ENTER_FUNCTION();
- // Save the state and filename before releasing.
- QString filenameCopy(filename());
- CxeVideoCaptureControl::State stateCopy(state());
-
// first de-init videocapture control
deinit();
reset();
- // Check if state is stopping, in which case we have to inform the
- // file harvester that a file is to be completed. We would not
- // call harvestFile otherwise in this case.
- // Otherwise the video will not be found from videos app.
- if (stateCopy == CxeVideoCaptureControl::Stopping) {
- emit videoComposed(CxeError::None, filenameCopy);
- }
-
delete mVideoRecorder;
mVideoRecorder = NULL;
CX_DEBUG_EXIT_FUNCTION();
}
-
/*!
-Returns current state of videocapture
+* Returns current state of video capture control
*/
CxeVideoCaptureControl::State CxeVideoCaptureControlSymbian::state() const
{
return static_cast (stateId());
}
-
/*!
-* slot called when state is changed.
+* Called when state is changed.
*/
void CxeVideoCaptureControlSymbian::handleStateChanged(int newStateId, CxeError::Id error)
{
@@ -1047,7 +678,6 @@
emit stateChanged(static_cast (newStateId), error);
}
-
/*!
* Initialize states for videocapturecontrol
*/
@@ -1066,7 +696,6 @@
setInitialState(Idle);
}
-
/*!
* Updates remaining video recordng time counter to all the video qualities supported by ICM
* this should be done whenever storage location setting changes and when values are
@@ -1078,13 +707,13 @@
for( int index = 0; index < mIcmSupportedVideoResolutions.count(); index++) {
CxeVideoDetails &qualityDetails = mIcmSupportedVideoResolutions[index];
- calculateRemainingTime(qualityDetails, qualityDetails.mRemainingTime);
+ qualityDetails.mRemainingTime = calculateRemainingTime(qualityDetails);
}
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* calculates remaining video recording time.
*/
void CxeVideoCaptureControlSymbian::remainingTime(int &time)
@@ -1093,14 +722,12 @@
if (state() == CxeVideoCaptureControl::Recording ||
state() == CxeVideoCaptureControl::Paused) {
- TTimeIntervalMicroSeconds remaining = 0;
- remaining = mVideoRecorder->RecordTimeAvailable();
- time = remaining.Int64() * 1.0 / KOneSecond;
- CX_DEBUG(( "timeRemaining2: %d", time ));
+ time = mVideoRecorder->availableRecordingTime();
+ CX_DEBUG(("CxeVideoCaptureControlSymbian - time remaining: %d", time));
} else {
// Check if we need to recalculate the remaining time.
if (mCurrentVideoDetails.mRemainingTime == CxeVideoDetails::UNKNOWN) {
- calculateRemainingTime(mCurrentVideoDetails, mCurrentVideoDetails.mRemainingTime);
+ mCurrentVideoDetails.mRemainingTime = calculateRemainingTime(mCurrentVideoDetails);
}
time = mCurrentVideoDetails.mRemainingTime;
}
@@ -1108,99 +735,41 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
-
/*!
-* algorithm to calculate remaining recording time
-@ param videoDetails contains the current video resolution that is in use.
-@ time contains the remaining recording time
+* Get the remaining recording time
+* @param videoDetails Contains the current video resolution that is in use.
+* @return The remaining recording time
*/
-void CxeVideoCaptureControlSymbian::calculateRemainingTime(CxeVideoDetails videoDetails, int &time)
+int CxeVideoCaptureControlSymbian::calculateRemainingTime(const CxeVideoDetails& videoDetails)
{
CX_DEBUG_ENTER_FUNCTION();
-
- TTimeIntervalMicroSeconds remaining = 0;
-
- // get available space in the drive selected in the settings
- // for storing videos
- qint64 availableSpace = mDiskMonitor.free();
-
- availableSpace = availableSpace - KMinRequiredSpaceVideo;
-
- // Maximum clip size may be limited for mms quality.
- // If mMaximumSizeInBytes == 0, no limit is specified.
- if (videoDetails.mMaximumSizeInBytes > 0 && videoDetails.mMaximumSizeInBytes < availableSpace) {
- availableSpace = videoDetails.mMaximumSizeInBytes;
- }
-
- // Use average audio/video bitrates to estimate remaining time
- quint32 averageBitRate = 0;
- quint32 averageByteRate = 0;
- qreal scaler = mQualityPresets.avgVideoBitRateScaler();
-
- if (scaler == 0) {
- // video bit rate scaler is 0, use the constant value
- scaler = KCMRAvgVideoBitRateScaler;
- }
-
- int avgVideoBitRate = (videoDetails.mVideoBitRate * scaler);
- int avgAudioBitRate = videoDetails.mAudioBitRate;
-
- int muteSetting = 0; // audio enabled
- mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
-
- if (muteSetting == 1) {
- // audio disabled from setting. hence no audio
- avgAudioBitRate = 0;
- }
-
- averageBitRate = (quint32)(
- (avgVideoBitRate + avgAudioBitRate) * KMetaDataCoeff);
-
- averageByteRate = averageBitRate / 8;
-
- if (availableSpace <= 0) {
- remaining = 0;
- } else {
- // converting microseconds to seconds
- remaining = availableSpace * KOneMillion / averageByteRate;
- if ( (remaining.Int64()) > (quint64(KCamCMaxClipDurationInSecs) * KOneMillion) ) {
- remaining = (quint64(KCamCMaxClipDurationInSecs) * KOneMillion);
- }
- }
- if ( remaining <= quint64(0) ) {
- remaining = 0;
- }
-
- time = remaining.Int64() * 1.0 / KOneSecond;
-
- CX_DEBUG(( "remaining time from algorithm: %d", time ));
-
+ qint64 availableSpace = mDiskMonitor.free() - KMinRequiredSpaceVideo;
+ int time = mQualityPresets.recordingTimeAvailable(videoDetails, availableSpace);
CX_DEBUG_EXIT_FUNCTION();
+ return time;
}
-
/*!
-* Calculates remaining recording time during video recording
+* Calculates elapsed recording time during video recording
+* @return Did fetching elapsed time succeed.
*/
bool CxeVideoCaptureControlSymbian::elapsedTime(int &time)
{
CX_DEBUG_ENTER_FUNCTION();
- TTimeIntervalMicroSeconds timeElapsed = 0;
bool ok = false;
if (state() == CxeVideoCaptureControl::Recording ||
state() == CxeVideoCaptureControl::Paused) {
- TRAPD( err, timeElapsed = mVideoRecorder->DurationL() );
- if (!err) {
- time = timeElapsed.Int64() * 1.0 / KOneSecond;
- CX_DEBUG(("timeElapsed2: %d", time));
+ try {
+ time = mVideoRecorder->duration();
+ CX_DEBUG(("CxeVideoCaptureControlSymbian - elapsed: %d", time));
ok = true;
+ } catch (const std::exception &e) {
+ // Returning false.
}
}
CX_DEBUG_EXIT_FUNCTION();
-
return ok;
}
@@ -1214,8 +783,7 @@
// start recording, if we were playing capture sound
if (state() == CxeVideoCaptureControl::PlayingStartSound) {
setState(CxeVideoCaptureControl::Recording);
-
- mVideoRecorder->Record();
+ mVideoRecorder->record();
}
// in case of video capture stop sound playing, nothing needs to be done
@@ -1224,6 +792,27 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Handle new snapshot.
+* @param status Status code for getting the snapshot.
+* @param snapshot Snapshot pixmap. Empty if error code reported.
+*/
+void CxeVideoCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mCameraDeviceControl.mode() == Cxe::VideoMode) {
+ OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_HANDLESNAPSHOT_1, "msg: e_CX_HANDLE_SNAPSHOT 1");
+
+ // Need to store snapshot for ui to be able to get it also later.
+ mSnapshot = QPixmap::fromImage(snapshot);
+ emit snapshotReady(status, snapshot, filename());
+
+ OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0");
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
/*!
* setting has changed, check if we are interested.
@@ -1247,7 +836,7 @@
// mute setting changed, apply the new setting and re-prepare.
setState(Preparing);
prepare();
- } else if (settingId == CxeSettingIds::FRAME_RATE){
+ } else if (settingId == CxeSettingIds::FRAME_RATE) {
// Frame rate setting changed. Need to re-prepare if we are prepared already.
// Otherwise can wait for next init call.
if (state() == Ready) {
@@ -1268,6 +857,7 @@
*/
void CxeVideoCaptureControlSymbian::handleSceneChanged(CxeScene& scene)
{
+ Q_UNUSED(scene)
CX_DEBUG_ENTER_FUNCTION();
// make sure we are in video mode
@@ -1293,8 +883,7 @@
// Ignore updates on preparing phase.
if (state() == CxeVideoCaptureControl::Ready) {
- int time(0);
- calculateRemainingTime(mCurrentVideoDetails, time);
+ int time(calculateRemainingTime(mCurrentVideoDetails));
if (time != mCurrentVideoDetails.mRemainingTime) {
mCurrentVideoDetails.mRemainingTime = time;
@@ -1316,4 +905,46 @@
return mIcmSupportedVideoResolutions;
}
+/*!
+* Helper method to handle error during preparing phase.
+*/
+void CxeVideoCaptureControlSymbian::handlePrepareFailed()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG(("[ERROR] Preparing video failed!"));
+ // Cleanup
+ deinit();
+ // Inform client
+ emit videoPrepareComplete(CxeError::InitializationFailed);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Helper method to handle error from video composing.
+* @param error Symbian error code.
+*/
+void CxeVideoCaptureControlSymbian::handleComposeFailed(int error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG(("[ERROR] Composing video failed!"));
+ // Inform client
+ emit videoComposed(CxeErrorHandlingSymbian::map(error), filename());
+ // Cleanup
+ deinit();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Helper method to emulate video stopping events.
+ */
+void CxeVideoCaptureControlSymbian::emulateNormalStopping()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ setState(Stopping);
+ MvruoEvent(TMMFEvent(KCamCControllerCCVideoRecordStopped, KErrNone));
+ MvruoEvent(TMMFEvent(KCamCControllerCCVideoFileComposed, KErrNone));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
// End of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxevideorecorderutilitysymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxevideorecorderutilitysymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxevideorecorderutilitysymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -17,6 +17,22 @@
#include "cxevideorecorderutilitysymbian.h"
#include "cxenamespace.h"
#include "cxutils.h"
+#include
+
+namespace
+{
+ // Controller UId, can be used by the client to identify the controller, e.g. if the custom command can be used
+ const TUid KCamCControllerImplementationUid = {0x101F8503};
+
+ // Custom command for setting a new filename without closing & reopening the controller
+ enum TCamCControllerCustomCommands
+ {
+ ECamCControllerCCNewFilename = 0,
+ ECamCControllerCCVideoStopAsync
+ };
+
+ const uint KOneMillion = 1000000;
+}
CxeVideoRecorderUtilitySymbian::~CxeVideoRecorderUtilitySymbian()
@@ -27,121 +43,296 @@
CX_DEBUG_EXIT_FUNCTION();
}
-CxeVideoRecorderUtilitySymbian::CxeVideoRecorderUtilitySymbian(MVideoRecorderUtilityObserver& aObserver,
- TInt aPriority,
- TMdaPriorityPreference aPref)
+CxeVideoRecorderUtilitySymbian::CxeVideoRecorderUtilitySymbian(MVideoRecorderUtilityObserver& aObserver)
{
CX_DEBUG_ENTER_FUNCTION();
- TRAPD(initErr, mVideoRecorder = CVideoRecorderUtility::NewL(aObserver, aPriority, aPref));
- mStartuperror = initErr;
+ QT_TRAP_THROWING(mVideoRecorder =
+ CVideoRecorderUtility::NewL(aObserver,
+ KAudioPriorityVideoRecording,
+ TMdaPriorityPreference(KAudioPrefVideoRecording)));
CX_DEBUG_EXIT_FUNCTION();
}
-TInt CxeVideoRecorderUtilitySymbian::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
- TInt aFunction,
- const TDesC8& aDataTo1,
- const TDesC8& aDataTo2)
-{
- CX_DEBUG_IN_FUNCTION();
- return mVideoRecorder->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
-}
-
-void CxeVideoRecorderUtilitySymbian::OpenFileL(const TDesC& aFileName,
- TInt aCameraHandle,
- TUid aControllerUid,
- TUid aVideoFormat,
- const TDesC8& aVideoType,
- TFourCC aAudioType)
+/*!
+* Open new file for recording.
+* @param cameraHandle Handle for camera.
+* @param filename Full filename of the video file to open.
+* @param fileMimeType MIME type for the video file.
+* @param supplier Preferred supplier.
+* @param videoType Video codec MIME type.
+* @param audioType Audio FourCC type.
+*/
+void CxeVideoRecorderUtilitySymbian::open(int cameraHandle,
+ const QString &filename,
+ const QString &fileMimeType,
+ const QString &supplier,
+ const QString &videoType,
+ const QString &audioType)
{
CX_DEBUG_ENTER_FUNCTION();
- mVideoRecorder->OpenFileL(aFileName, aCameraHandle, aControllerUid, aVideoFormat, aVideoType, aAudioType);
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - filename [%s]", filename.toAscii().constData()));
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - file mime [%s]", fileMimeType.toAscii().constData()));
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - supplier [%s]", supplier.toAscii().constData()));
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - codec mime [%s]", videoType.toAscii().constData()));
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - audio FourCC [%s]", audioType.toAscii().constData()));
+
+ QByteArray bytes = videoType.toLatin1();
+ TPtrC8 videoTypeDesC(reinterpret_cast(bytes.constData()), bytes.size());
+ TPtrC16 filenameDesC(reinterpret_cast(filename.utf16()));
+
+ TUid controllerId;
+ TUid formatId;
+ QT_TRAP_THROWING({
+ // Find the video controller id and video format id.
+ findControllerL(fileMimeType, supplier, controllerId, formatId);
+
+ // Try to open new video file with given parameters.
+ mVideoRecorder->OpenFileL(filenameDesC, cameraHandle, controllerId,
+ formatId, videoTypeDesC, audioFourCC(audioType));
+ });
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::SetVideoFrameSizeL(TSize aSize)
+/*!
+* Set frame size.
+* @param size The video frame size.
+*/
+void CxeVideoRecorderUtilitySymbian::setVideoFrameSize(const QSize &size)
{
CX_DEBUG_ENTER_FUNCTION();
- mVideoRecorder->SetVideoFrameSizeL(aSize);
+ TSize frameSize(size.width(), size.height());
+ QT_TRAP_THROWING(mVideoRecorder->SetVideoFrameSizeL(frameSize));
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::SetVideoFrameRateL(TInt aRate)
+/*!
+* Set video frame rate.
+* @param rate The video frame rate.
+*/
+void CxeVideoRecorderUtilitySymbian::setVideoFrameRate(int rate)
{
CX_DEBUG_ENTER_FUNCTION();
- mVideoRecorder->SetVideoFrameRateL(aRate);
+ QT_TRAP_THROWING(mVideoRecorder->SetVideoFrameRateL(rate));
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::SetVideoBitRateL(TInt aRate)
+/*!
+* Set video bit rate.
+* @param The video bit rate.
+*/
+void CxeVideoRecorderUtilitySymbian::setVideoBitRate(int rate)
{
CX_DEBUG_ENTER_FUNCTION();
- mVideoRecorder->SetVideoBitRateL(aRate);
+ QT_TRAP_THROWING(mVideoRecorder->SetVideoBitRateL(rate));
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::SetAudioEnabledL(TBool aEnable)
+/*!
+* Set if audio recording is on or not.
+* @param enabled Is audio recording enabled.
+*/
+void CxeVideoRecorderUtilitySymbian::setAudioEnabled(bool enabled)
{
CX_DEBUG_ENTER_FUNCTION();
- mVideoRecorder->SetAudioEnabledL(aEnable);
+ QT_TRAP_THROWING(mVideoRecorder->SetAudioEnabledL(enabled));
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::SetMaxClipSizeL(TInt aClipSizeInBytes)
+/*!
+* Set maximum video clip size in bytes.
+* @param sizeInBytes Video clip size limit.
+*/
+void CxeVideoRecorderUtilitySymbian::setVideoMaxSize(int sizeInBytes)
{
CX_DEBUG_ENTER_FUNCTION();
- if (aClipSizeInBytes <= 0) {
- aClipSizeInBytes = KMMFNoMaxClipSize;
+ if (sizeInBytes <= 0) {
+ sizeInBytes = KMMFNoMaxClipSize;
}
- mVideoRecorder->SetMaxClipSizeL(aClipSizeInBytes);
+ QT_TRAP_THROWING(mVideoRecorder->SetMaxClipSizeL(sizeInBytes));
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::Close()
+/*!
+* Close video recorder, freeing its resources.
+*/
+void CxeVideoRecorderUtilitySymbian::close()
{
CX_DEBUG_ENTER_FUNCTION();
mVideoRecorder->Close();
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::Prepare()
+/*!
+* Prepare for video recording.
+*/
+void CxeVideoRecorderUtilitySymbian::prepare()
{
CX_DEBUG_ENTER_FUNCTION();
mVideoRecorder->Prepare();
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::Record()
+/*!
+* Start recording.
+*/
+void CxeVideoRecorderUtilitySymbian::record()
{
CX_DEBUG_ENTER_FUNCTION();
mVideoRecorder->Record();
CX_DEBUG_EXIT_FUNCTION();
}
-int CxeVideoRecorderUtilitySymbian::Stop()
+/*!
+* Stop recording.
+* @param asynchronous Use asynchronous (true) or synchronous (false) stopping.
+*/
+void CxeVideoRecorderUtilitySymbian::stop(bool asynchronous)
{
- CX_DEBUG_IN_FUNCTION();
- return mVideoRecorder->Stop();
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (asynchronous) {
+ TMMFMessageDestination dest(KCamCControllerImplementationUid, KMMFObjectHandleController);
+ qt_symbian_throwIfError(mVideoRecorder->CustomCommandSync(
+ dest, ECamCControllerCCVideoStopAsync, KNullDesC8, KNullDesC8));
+ } else {
+ qt_symbian_throwIfError(mVideoRecorder->Stop());
+ }
+ CX_DEBUG_EXIT_FUNCTION();
}
-void CxeVideoRecorderUtilitySymbian::PauseL()
+/*!
+* Pause recording.
+*/
+void CxeVideoRecorderUtilitySymbian::pause()
{
CX_DEBUG_ENTER_FUNCTION();
- mVideoRecorder->PauseL();
+ QT_TRAP_THROWING(mVideoRecorder->PauseL());
CX_DEBUG_EXIT_FUNCTION();
}
-TTimeIntervalMicroSeconds CxeVideoRecorderUtilitySymbian::RecordTimeAvailable()
+/*!
+* Get estimated available recording time.
+* @return Available recording time estimate in seconds.
+*/
+int CxeVideoRecorderUtilitySymbian::availableRecordingTime()
{
CX_DEBUG_IN_FUNCTION();
- return mVideoRecorder->RecordTimeAvailable();
+ // Convert microseconds to seconds.
+ return mVideoRecorder->RecordTimeAvailable().Int64() * 1.0 / KOneMillion;
+}
+
+/*!
+* Get elapsed duration of the recorded video.
+* @return Duration of the video in seconds.
+*/
+int CxeVideoRecorderUtilitySymbian::duration()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ int time(0);
+ // Convert microseconds to seconds.
+ QT_TRAP_THROWING(time = mVideoRecorder->DurationL().Int64() * 1.0 / KOneMillion);
+ CX_DEBUG_EXIT_FUNCTION();
+ return time;
}
-TTimeIntervalMicroSeconds CxeVideoRecorderUtilitySymbian::DurationL()
+/*!
+* Find video controller and format UIDs based on file mime type and preferred supplier.
+* @param fileMimeType MIME type for the video file.
+* @param supplier Preferred supplier.
+* @param controllerId Returns found controller UID.
+* @param formatId Returns found format UID.
+*/
+void CxeVideoRecorderUtilitySymbian::findControllerL(const QString& fileMimeType,
+ const QString& supplier,
+ TUid& controllerId,
+ TUid& formatId)
{
- CX_DEBUG_IN_FUNCTION();
- return mVideoRecorder->DurationL();
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Retrieve a list of possible controllers from ECOM.
+ // Controller must support recording the requested mime type.
+ // Controller must be provided by preferred supplier.
+ controllerId = KNullUid;
+ formatId = KNullUid;
+
+ QByteArray bytes = fileMimeType.toLatin1();
+ TPtrC8 mimeTPtr(reinterpret_cast(bytes.constData()), bytes.size());
+ TPtrC16 supplierTPtr(reinterpret_cast(supplier.utf16()));
+
+ CMMFControllerPluginSelectionParameters* cSelect(NULL);
+ CMMFFormatSelectionParameters* fSelect(NULL);
+ RMMFControllerImplInfoArray controllers;
+
+ cSelect = CMMFControllerPluginSelectionParameters::NewLC();
+ fSelect = CMMFFormatSelectionParameters::NewLC();
+
+ fSelect->SetMatchToMimeTypeL(mimeTPtr);
+ cSelect->SetRequiredRecordFormatSupportL(*fSelect);
+ cSelect->SetPreferredSupplierL(supplierTPtr,
+ CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned);
+ cSelect->ListImplementationsL(controllers);
+ CleanupResetAndDestroyPushL(controllers);
+
+ if (controllers.Count() <= 0) {
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - zero controllers found, leaving!"));
+ User::Leave(KErrNotFound);
+ }
+
+ // Inquires the controller about supported formats.
+ // We use the first controller found having index 0.
+ const RMMFFormatImplInfoArray& formats = controllers[0]->RecordFormats();
+
+ // Get the first format that supports our mime type.
+ int count(formats.Count());
+ for (int i=0; iSupportsMimeType(mimeTPtr)) {
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - found controller"));
+ // Store the format UID
+ formatId = formats[i]->Uid();
+ // Store the controller UID
+ controllerId = controllers[0]->Uid();
+ break;
+ }
+ }
+
+ // Check that we found the uids.
+ if (controllerId == KNullUid) {
+ CX_DEBUG(("CxeVideoRecorderUtilitySymbian - no matching controller found, leaving!"));
+ User::Leave(KErrNotFound);
+ }
+
+ CleanupStack::PopAndDestroy(3); // controllers, fSelect, cSelect
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Helper method to convert QString to TFourCC.
+* @param str String to convert.
+*/
+TFourCC CxeVideoRecorderUtilitySymbian::audioFourCC(const QString& str)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QByteArray audioType = str.toAscii();
+
+ quint8 char1(' ');
+ quint8 char2(' ');
+ quint8 char3(' ');
+ quint8 char4(' ');
+
+ if (audioType.count() > 3) {
+ char1 = audioType[0];
+ char2 = audioType[1];
+ char3 = audioType[2];
+
+ if (audioType.count() == 4) {
+ char4 = audioType[3];
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return TFourCC(char1, char2, char3, char4);
}
-
// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -163,6 +163,8 @@
CxeError::Id CxeViewfinderControlSymbian::start()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_START_1, "msg: e_CX_VIEWFINDER_START 1");
+
TInt err = KErrNone;
if ( state() == Running ) {
@@ -211,7 +213,7 @@
CCoeEnv::Static()->WsSession(),
*CCoeEnv::Static()->ScreenDevice(),
*mVideoWindow, activeViewfinderRect));
- OstTrace0(camerax_performance, CXEVIEWFINDERCONTROLSYMBIAN_START, "msg: e_CX_STARTUP 0");
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_STARTUP, "msg: e_CX_STARTUP 0");
setState(Running);
break;
}
@@ -248,7 +250,7 @@
// vf already running. nothing to do
}
- CX_DEBUG( ("CxeViewfinderControlSymbian::start symbian error code : %d", err ) );
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_START_2, "msg: e_CX_VIEWFINDER_START 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(err);
}
@@ -260,6 +262,7 @@
int CxeViewfinderControlSymbian::initViewfinder()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_INIT_1, "msg: e_CX_VIEWFINDER_INIT 1");
TInt err = KErrNone;
if (state() != Uninitialized) {
@@ -298,6 +301,7 @@
setState( Ready );
#endif
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_INIT_2, "msg: e_CX_VIEWFINDER_INIT 0");
CX_DEBUG_EXIT_FUNCTION();
return err;
}
@@ -309,6 +313,7 @@
void CxeViewfinderControlSymbian::createViewfinderWindowL()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_CREATE_WINDOW_1, "msg: e_CX_VIEWFINDER_CREATE_WINDOW 1");
if (!mUiWindow) {
CX_DEBUG( ( "mUiWindow not set - cannot create VF window!" ) );
@@ -339,6 +344,7 @@
CX_DEBUG(("mVideoWindow ordinal position is: %d", mVideoWindow->OrdinalPosition()));
CX_DEBUG(("mUiWindow ordinal position is: %d", mUiWindow->OrdinalPosition()));
+ OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_CREATE_WINDOW_2, "msg: e_CX_VIEWFINDER_CREATE_WINDOW 0");
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -209,7 +209,7 @@
if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
init();
// if CxeCameraDeviceControl is ready, this pointer is valid
- CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings())
+ CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings());
int error = KErrNone;
TRAP(error,
mCameraDevice.advancedSettings()->GetDigitalZoomStepsL(mDigitalZoomValues, mDigitalZoomValueInfo);
@@ -256,7 +256,7 @@
mMaxZoomLevel = cameraInfo.iMaxDigitalZoom;
}
// change the state, since zoom is now ready
- setState(Ready, KErrNone);
+ setState(Ready);
mCameraDevice.advancedSettings()->SetDigitalZoom(mDigitalZoomValues[mCurrentZoomLevel]);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp
--- a/camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -43,6 +43,8 @@
TSize(640,480)
};
static const int IMAGE_CAPTURE_SIZE_COUNT = sizeof(IMAGE_CAPTURE_SIZES)/sizeof(TSize);
+
+ _LIT( PANICDUMMYCAMERA, "DummyCamera" );
}
@@ -78,7 +80,11 @@
void CxeDummyCamera::doCommand( TCxeDummyCommand aCmd )
{
- iCommandBuf.Insert( aCmd, 0 );
+ TInt status = iCommandBuf.Insert( aCmd, 0 );
+ if ( status != KErrNone )
+ {
+ User::Panic(PANICDUMMYCAMERA, 1);
+ }
if ( !iCommandTimer->IsActive() )
{
iCommandTimer->Start(100, 100, TCallBack(CxeDummyCamera::callBack, this));
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -35,7 +35,7 @@
CX_DEBUG_IN_FUNCTION();
}
-CxeError::Id CxeFakeAutoFocusControl::start()
+CxeError::Id CxeFakeAutoFocusControl::start(bool soundEnabled)
{
CX_DEBUG_IN_FUNCTION();
return CxeError::None;
@@ -59,11 +59,22 @@
return mAfMode;
}
+bool CxeFakeAutoFocusControl::isFixedFocusMode(Mode mode) const
+{
+ return (mode == CxeAutoFocusControl::Hyperfocal
+ || mode == CxeAutoFocusControl::Infinity);
+}
+
bool CxeFakeAutoFocusControl::supported() const
{
return true;
}
+bool CxeFakeAutoFocusControl::isSoundEnabled() const
+{
+ return true;
+}
+
CxeAutoFocusControl::State CxeFakeAutoFocusControl::state() const
{
return static_cast(stateId());
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -32,12 +32,14 @@
CxeFakeAutoFocusControl();
virtual ~CxeFakeAutoFocusControl();
- CxeError::Id start();
+ CxeError::Id start(bool soundEnabled = true);
void cancel();
void setMode(CxeAutoFocusControl::Mode newMode);
CxeAutoFocusControl::Mode mode() const;
+ bool isFixedFocusMode(Mode mode) const;
CxeAutoFocusControl::State state() const;
bool supported() const;
+ bool isSoundEnabled() const;
public: // methods for testing
void setFakeState(CxeAutoFocusControl::State);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -191,6 +191,11 @@
return mFakeCameraDeviceControl->mode();
}
+void CxeFakeEngine::setMode(Cxe::CameraMode mode)
+{
+ mFakeCameraDeviceControl->setMode(mode);
+}
+
void CxeFakeEngine::initModeFake(Cxe::CameraMode cameraMode)
{
mFakeCameraDeviceControl->setMode( cameraMode );
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.h Thu Jul 15 01:55:05 2010 +0300
@@ -63,6 +63,7 @@
CxeSettings &settings();
CxeFeatureManager &featureManager();
Cxe::CameraMode mode() const;
+ void setMode(Cxe::CameraMode mode);
void initMode(Cxe::CameraMode cameraMode);
bool isEngineReady();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -34,14 +34,14 @@
}
-void CxeFakeFileSaveThread::handleVideoSaved(CxeError::Id status, const QString& filename)
+void CxeFakeFileSaveThread::handleVideoSaved(CxeError::Id status, const QString &filename)
{
}
-void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename)
+void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename)
{
}
-void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id)
+void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id)
{
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.h Thu Jul 15 01:55:05 2010 +0300
@@ -30,9 +30,9 @@
void save(CxeImageDataItem *data);
public slots:
- void handleVideoSaved(CxeError::Id status, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id);
+ void handleVideoSaved(CxeError::Id status, const QString &filename);
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename);
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id);
};
#endif // CXEFAKEFILESAVETHREAD_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -22,11 +22,12 @@
#include "cxeimagedataitem.h"
#include "cxutils.h"
-CxeFakeImageDataItem::CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id)
+CxeFakeImageDataItem::CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id, bool addLocation)
: mId(id),
mIndex(index),
mData(data),
mFileName(filename),
+ mAddLocationInfo(addLocation),
mState(CxeImageDataItem::SavePending)
{
CX_DEBUG_IN_FUNCTION();
@@ -64,4 +65,10 @@
return mFileName;
}
+
+bool CxeFakeImageDataItem::addLocation() const
+{
+ return mAddLocationInfo;
+}
+
// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.h Thu Jul 15 01:55:05 2010 +0300
@@ -26,7 +26,7 @@
Q_OBJECT
public: // constructor and destructor
- CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id);
+ CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id, bool addLocation);
virtual ~CxeFakeImageDataItem();
public: // from CxeImageDataItem
@@ -34,12 +34,14 @@
CxeImageDataItem::State state() const;
int id() const;
QString path() const;
+ bool addLocation() const;
private:
int mId;
int mIndex;
QByteArray mData;
QString mFileName;
+ bool mAddLocationInfo;
CxeImageDataItem::State mState;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakequalitypresets.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakequalitypresets.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakequalitypresets.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -47,9 +47,15 @@
return list;
}
-qreal CxeFakeQualityPresets::avgVideoBitRateScaler()
+int CxeFakeQualityPresets::recordingTimeAvailable(const CxeVideoDetails& details, qint64 space)
{
- return 1.0;
+ int time(0);
+ if (details.mMaximumSizeInBytes > 0 && details.mMaximumSizeInBytes < space) {
+ time = details.mMaximumSizeInBytes / 1000; // 1 kB/s
+ } else {
+ time = space / 1000;
+ }
+ return time;
}
CxeImageDetails CxeFakeQualityPresets::fakeImageDetails()
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakequalitypresets.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakequalitypresets.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakequalitypresets.h Thu Jul 15 01:55:05 2010 +0300
@@ -28,7 +28,7 @@
virtual ~CxeFakeQualityPresets();
QList imageQualityPresets(Cxe::CameraIndex cameraId);
QList videoQualityPresets(Cxe::CameraIndex cameraId);
- qreal avgVideoBitRateScaler();
+ int recordingTimeAvailable(const CxeVideoDetails& details, qint64 space);
public:
static CxeImageDetails fakeImageDetails();
static CxeVideoDetails fakeVideoDetails();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -58,12 +58,14 @@
CxeError::Id CxeFakeSettings::set(const QString& key, int newValue)
{
mSettingKeyHash[key] = QVariant(newValue);
+ emit settingValueChanged(key, newValue);
return CxeError::None;
}
CxeError::Id CxeFakeSettings::set(const QString &key, const QString &newValue)
{
mSettingKeyHash[key] = QVariant(newValue);
+ emit settingValueChanged(key, newValue);
return CxeError::None;
}
@@ -72,6 +74,7 @@
CxeError::Id CxeFakeSettings::set(const QString &key, qreal newValue)
{
mSettingKeyHash[key] = QVariant(newValue);
+ emit settingValueChanged(key, newValue);
return CxeError::None;
}
@@ -80,3 +83,8 @@
{
}
+
+void CxeFakeSettings::emulate(long int uid, unsigned long int key, QVariant value)
+{
+ emit settingValueChanged(uid, key, value);
+}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h Thu Jul 15 01:55:05 2010 +0300
@@ -41,7 +41,8 @@
void reset();
public: // methods for unit testing
- // ??
+
+ void emulate(long int uid, unsigned long int key, QVariant value);
private: // data
QHash mSettingKeyHash;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -20,7 +20,12 @@
CxeFakeSettingsModel::CxeFakeSettingsModel()
{
- CX_DEBUG_IN_FUNCTION();
+ CX_DEBUG_ENTER_FUNCTION();
+
+ initDefaultCameraSettings();
+ initRuntimeSettings();
+
+ CX_DEBUG_EXIT_FUNCTION();
}
CxeFakeSettingsModel::~CxeFakeSettingsModel()
@@ -34,8 +39,8 @@
CxeError::Id err = CxeError::None;
// read run-time configuration value
- if (mStore.contains(key)) {
- value = qVariantFromValue > (mStore[key]);
+ if (mRuntimeSettings.contains(key)) {
+ value = qVariantFromValue (mRuntimeSettings.value(key));
} else {
err = CxeError::NotFound;
}
@@ -72,7 +77,7 @@
}
-/* This is a helper method for this fake class that can be used to set key-value pairs
+/*! This is a helper method for this fake class that can be used to set key-value pairs
* to local mStore database. Key-value pairs don't have to refer any real values used
* in camera application as the fake class is used only for testing purposes
*/
@@ -95,29 +100,29 @@
CxeError::Id CxeFakeSettingsModel::setImageScene(const QString &newScene)
{
- mDummyScene.clear();
+ mDummyImageScene.clear();
// image scene mode key values
- if(newScene == CxeSettingIds::IMAGE_SCENE_AUTO) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_AUTO);
+ if(newScene == Cxe::IMAGE_SCENE_AUTO) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_PORTRAIT) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_PORTRAIT);
+ else if(newScene == Cxe::IMAGE_SCENE_PORTRAIT) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_SCENERY) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_SCENERY);
+ else if(newScene == Cxe::IMAGE_SCENE_SCENERY) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_MACRO) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_MACRO);
+ else if(newScene == Cxe::IMAGE_SCENE_MACRO) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_SPORTS) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_SPORTS);
+ else if(newScene == Cxe::IMAGE_SCENE_SPORTS) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_NIGHT) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_NIGHT);
+ else if(newScene == Cxe::IMAGE_SCENE_NIGHT) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT);
+ else if(newScene == Cxe::IMAGE_SCENE_NIGHTPORTRAIT) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT);
}
else {
return CxeError::NotFound;
@@ -128,20 +133,20 @@
CxeError::Id CxeFakeSettingsModel::setVideoScene(const QString &newScene)
{
- mDummyScene.clear();
+ mDummyVideoScene.clear();
// image scene mode key values
- if(newScene == CxeSettingIds::VIDEO_SCENE_AUTO) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_AUTO);
+ if(newScene == Cxe::VIDEO_SCENE_AUTO) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
}
- else if(newScene == CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT);
+ else if(newScene == Cxe::VIDEO_SCENE_NIGHTPORTRAIT) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHTPORTRAIT);
}
- else if(newScene == CxeSettingIds::VIDEO_SCENE_LOWLIGHT) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_LOWLIGHT);
+ else if(newScene == Cxe::VIDEO_SCENE_LOWLIGHT) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT);
}
- else if(newScene == CxeSettingIds::VIDEO_SCENE_NIGHT) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_NIGHT);
+ else if(newScene == Cxe::VIDEO_SCENE_NIGHT) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT);
}
else {
return CxeError::NotFound;
@@ -151,6 +156,24 @@
}
+CxeScene& CxeFakeSettingsModel::currentImageScene()
+{
+ return mDummyImageScene;
+}
+
+
+CxeScene& CxeFakeSettingsModel::currentVideoScene()
+{
+ return mDummyVideoScene;
+}
+
+
+void CxeFakeSettingsModel::cameraModeChanged(Cxe::CameraMode newMode)
+{
+ mDummyCameraMode = newMode;
+}
+
+
/* This helper method initializes fake store for default camera settings
*/
void CxeFakeSettingsModel::initDefaultCameraSettings()
@@ -171,34 +194,47 @@
mSettingStore.insert(CxeSettingIds::FRAME_RATE, QVariant(1));
mSettingStore.insert(CxeSettingIds::IMAGE_QUALITY, QVariant(1));
mSettingStore.insert(CxeSettingIds::IMAGE_SCENE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_AUTO, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_MACRO, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, QVariant(1));
mSettingStore.insert(CxeSettingIds::LIGHT_SENSITIVITY, QVariant(1));
mSettingStore.insert(CxeSettingIds::SCENE_ID, QVariant(1));
mSettingStore.insert(CxeSettingIds::SECONDARY_CAMERA, QVariant(1));
mSettingStore.insert(CxeSettingIds::SELF_TIMER, QVariant(1));
mSettingStore.insert(CxeSettingIds::VIDEO_SCENE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_AUTO, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_NIGHT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, QVariant(1));
mSettingStore.insert(CxeSettingIds::WHITE_BALANCE, QVariant(1));
+
+ // default scene
+ setImageScene(Cxe::IMAGE_SCENE_AUTO);
+ setVideoScene(Cxe::VIDEO_SCENE_AUTO);
+
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFakeSettingsModel::testSetCurrenImageScene()
+
+
+/* This helper method initializes fake runtime setting values for the keys
+ */
+void CxeFakeSettingsModel::initRuntimeSettings()
{
- mDummyScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE);
-}
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVariantList supported;
+ supported.append(QVariant(1));
+
+ QVariantList notSupported;
+ notSupported.append(QVariant(0));
-void CxeFakeSettingsModel::testSetCurrenVideoScene()
-{
- mDummyScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE);
+ QVariantList values;
+ values.append(QVariant(1));
+ values.append(QVariant(2));
+ values.append(QVariant(3));
+
+ mRuntimeSettings.insert(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS, supported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS, supported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::SECONDARY_CAMERA_CAPTURE_KEYS, notSupported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::FREE_MEMORY_LEVELS, notSupported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS, values);
+ mRuntimeSettings.insert(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, values);
+
+ CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -17,7 +17,7 @@
#ifndef CXEFAKESETTINGSMODEL_H
#define CXEFAKESETTINGSMODEL_H
-#include
+#include
#include "cxesettingsmodel.h"
class CxeFakeSettingsModel : public CxeSettingsModel
@@ -34,15 +34,16 @@
CxeError::Id getRuntimeValue(const QString &key, QVariant &value);
CxeError::Id set(const QString &key,const QVariant newValue);
- CxeScene& currentImageScene() {return mDummyScene;}
- CxeScene& currentVideoScene() {return mDummyScene;}
- void cameraModeChanged(Cxe::CameraMode newMode) {mDummyCameraMode = newMode;}
+ CxeScene& currentImageScene();
+ CxeScene& currentVideoScene();
+ void cameraModeChanged(Cxe::CameraMode newMode);
CxeError::Id setImageScene(const QString &newScene);
CxeError::Id setVideoScene(const QString &newScene);
public: // own helper methods
void setRuntimeValues(QString &key, QList value);
void initDefaultCameraSettings();
+ void initRuntimeSettings();
void testSetCurrenImageScene();
void testSetCurrenVideoScene();
@@ -50,9 +51,10 @@
private:
- QMap > mStore;
QHash mSettingStore;
- CxeScene mDummyScene;
+ QHash mRuntimeSettings;
+ CxeScene mDummyImageScene;
+ CxeScene mDummyVideoScene;
Cxe::CameraMode mDummyCameraMode;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -30,13 +30,28 @@
mSettingKeyHash.insert(CxeSettingIds::FNAME_MONTH_FOLDER, QVariant("08042009"));
mSettingKeyHash.insert(CxeSettingIds::FNAME_IMAGE_COUNTER, QVariant(0));
mSettingKeyHash.insert(CxeSettingIds::FNAME_VIDEO_COUNTER, QVariant(0));
+
+ mSettingKeyHash.insert(CxeSettingIds::CAMERA_MODE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::FLASH_MODE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::IMAGE_SCENE, QVariant("image_scene_auto"));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_SCENE, QVariant("video_scene_auto"));
+ mSettingKeyHash.insert(CxeSettingIds::STILL_SHOWCAPTURED, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_SHOWCAPTURED, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_MUTE_SETTING, QVariant(0));
+
+ mSettingKeyHash.insert(CxeSettingIds::GEOTAGGING, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::GEOTAGGING_DISCLAIMER, QVariant(1));
+ mSettingKeyHash.insert(CxeSettingIds::FACE_TRACKING, QVariant(1));
+ mSettingKeyHash.insert(CxeSettingIds::IMAGE_QUALITY, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_QUALITY, QVariant(0));
+
}
CxeFakeSettingsStore::~CxeFakeSettingsStore()
{
}
-/*
+/*!
* Reads a value from cenrep
* @param "key" - setting key
* @param "value" - setting value read from cenrep
@@ -55,14 +70,14 @@
return error;
}
-/*
+/*!
* Reads a value from cenrep
* @param "uid" - UID of the component that own setting key
* @param "key" - setting key id
* @param "type" - type of setting key
* @param "value" - setting value read from cenrep
*/
-void CxeFakeSettingsStore::get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value)
+void CxeFakeSettingsStore::startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value)
{
Q_UNUSED(uid);
Q_UNUSED(key);
@@ -72,7 +87,7 @@
// no support yet
}
-/*
+/*!
* Reads/loads all run-time settings values from cenrep
* @param QList contains list of all runtime key ids which we use to load values from cenrep.
* returns: QHash container, "contains" values associated with each key that are read from cenrep
@@ -106,7 +121,7 @@
}
-/*
+/*!
* Sets a new value to cenrep
* @param "key" - setting key
* @param "newValue" - new value set to the key in cenrep
@@ -121,7 +136,7 @@
return error;
}
-/*
+/*!
* resets the cenrep store
*/
void CxeFakeSettingsStore::reset()
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h Thu Jul 15 01:55:05 2010 +0300
@@ -30,7 +30,7 @@
public: // from base class
void reset();
CxeError::Id get(const QString& key, QVariant &value);
- void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
+ void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
CxeError::Id set(const QString& key,const QVariant newValue);
QHash loadRuntimeSettings(QList& keylist);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideocapturecontrol.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideocapturecontrol.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideocapturecontrol.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -16,6 +16,7 @@
*/
#include
+#include
#include "cxefakequalitypresets.h"
#include "cxefakevideocapturecontrol.h"
#include "cxutils.h"
@@ -61,7 +62,7 @@
CX_DEBUG_ENTER_FUNCTION();
emit videoComposed(CxeError::None, filename());
- emit snapshotReady(CxeError::None, snapshot(), filename());
+ emit snapshotReady(CxeError::None, QImage(), filename());
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -35,104 +35,86 @@
: mObserver( &aObserver )
{
CX_DEBUG_IN_FUNCTION();
- //return new (ELeave) CxeFakeVideoRecorderUtility(aObserver);
}
-/*CxeVideoRecorderUtility* CxeFakeVideoRecorderUtility::NewL(MVideoRecorderUtilityObserver& aObserver,
- TInt aPriority,
- TMdaPriorityPreference aPref)
-{
- CX_DEBUG_IN_FUNCTION();
- return new (ELeave) CxeFakeVideoRecorderUtility(aObserver);
-}*/
-
-TInt CxeFakeVideoRecorderUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
- TInt aFunction,
- const TDesC8& aDataTo1,
- const TDesC8& aDataTo2)
-{
- CX_DEBUG_IN_FUNCTION();
- return KErrNone;
-}
-
-void CxeFakeVideoRecorderUtility::OpenFileL(const TDesC& aFileName,
- TInt aCameraHandle,
- TUid aControllerUid,
- TUid aVideoFormat,
- const TDesC8& aVideoType,
- TFourCC aAudioType)
+void CxeFakeVideoRecorderUtility::open(int cameraHandle,
+ const QString &/*filename*/,
+ const QString &/*fileMimeType*/,
+ const QString &/*supplier*/,
+ const QString &/*videoType*/,
+ const QString &/*audioType*/)
{
CX_DEBUG_ENTER_FUNCTION();
mObserver->MvruoOpenComplete(KErrNone);
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::SetVideoFrameSizeL(TSize aSize)
+void CxeFakeVideoRecorderUtility::setVideoFrameSize(const QSize &/*size*/)
{
CX_DEBUG_IN_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::SetVideoFrameRateL(TInt aRate)
+void CxeFakeVideoRecorderUtility::setVideoFrameRate(int rate)
{
CX_DEBUG_IN_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::SetVideoBitRateL(TInt aRate)
+void CxeFakeVideoRecorderUtility::setVideoBitRate(int rate)
{
CX_DEBUG_IN_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::SetAudioEnabledL(TBool aEnable)
+void CxeFakeVideoRecorderUtility::setAudioEnabled(bool enabled)
{
CX_DEBUG_IN_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::SetMaxClipSizeL(TInt aClipSizeInBytes)
+void CxeFakeVideoRecorderUtility::setVideoMaxSize(int sizeInBytes)
{
CX_DEBUG_IN_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::Close()
+void CxeFakeVideoRecorderUtility::close()
{
CX_DEBUG_IN_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::Prepare()
+void CxeFakeVideoRecorderUtility::prepare()
{
CX_DEBUG_ENTER_FUNCTION();
mObserver->MvruoPrepareComplete(KErrNone);
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::Record()
+void CxeFakeVideoRecorderUtility::record()
{
CX_DEBUG_IN_FUNCTION();
}
-int CxeFakeVideoRecorderUtility::Stop()
+void CxeFakeVideoRecorderUtility::stop(bool asynchronous)
{
- CX_DEBUG_IN_FUNCTION();
+ CX_DEBUG_ENTER_FUNCTION();
mObserver->MvruoRecordComplete(KErrNone);
- return KErrNone;
+ CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFakeVideoRecorderUtility::PauseL()
+void CxeFakeVideoRecorderUtility::pause()
{
CX_DEBUG_IN_FUNCTION();
}
-TTimeIntervalMicroSeconds CxeFakeVideoRecorderUtility::RecordTimeAvailable()
+int CxeFakeVideoRecorderUtility::availableRecordingTime()
{
CX_DEBUG_IN_FUNCTION();
// 100 s
- return TTimeIntervalMicroSeconds(100000000);
+ return 100;
}
-TTimeIntervalMicroSeconds CxeFakeVideoRecorderUtility::DurationL()
+int CxeFakeVideoRecorderUtility::duration()
{
CX_DEBUG_IN_FUNCTION();
// 10 s
- return TTimeIntervalMicroSeconds(10000000);
+ return 10;
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.h
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.h Thu Jul 15 01:55:05 2010 +0300
@@ -29,32 +29,25 @@
TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);
~CxeFakeVideoRecorderUtility();
+ virtual void open(int cameraHandle,
+ const QString &filename,
+ const QString &fileMimeType,
+ const QString &supplier,
+ const QString &videoType,
+ const QString &audioType);
+ virtual void setVideoFrameSize(const QSize& size);
+ virtual void setVideoFrameRate(int rate);
+ virtual void setVideoBitRate(int rate);
+ virtual void setAudioEnabled(bool enabled);
+ virtual void setVideoMaxSize(int sizeInBytes);
+ virtual void close();
+ virtual void prepare();
+ virtual void record();
+ virtual void stop(bool asynchronous = false);
+ virtual void pause();
+ virtual int availableRecordingTime();
+ virtual int duration();
- //CxeVideoRecorderUtility* NewL(MVideoRecorderUtilityObserver& aObserver,
- // TInt aPriority=EMdaPriorityNormal,
- // TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);
- TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination,
- TInt aFunction,
- const TDesC8& aDataTo1,
- const TDesC8& aDataTo2);
- void OpenFileL(const TDesC& aFileName,
- TInt aCameraHandle,
- TUid aControllerUid,
- TUid aVideoFormat,
- const TDesC8& aVideoType = KNullDesC8,
- TFourCC aAudioType = KMMFFourCCCodeNULL);
- void SetVideoFrameSizeL(TSize aSize);
- void SetVideoFrameRateL(TInt aRate);
- void SetVideoBitRateL(TInt aRate);
- void SetAudioEnabledL(TBool aEnable);
- void SetMaxClipSizeL(TInt aClipSizeInBytes);
- void Close();
- void Prepare();
- void Record();
- int Stop();
- void PauseL();
- TTimeIntervalMicroSeconds RecordTimeAvailable();
- TTimeIntervalMicroSeconds DurationL();
private:
CxeFakeVideoRecorderUtility(MVideoRecorderUtilityObserver& aObserver);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -66,7 +66,11 @@
<< "unittest_cxethumbnailmanagersymbian"
<< "unittest_cxeharvestercontrolsymbian"
<< "unittest_cxesettingscontrolsymbian"
- << "unittest_cxeenginesymbian";
+ << "unittest_cxesnapshotcontrol"
+ << "unittest_cxeenginesymbian"
+ << "unittest_cxegeotaggingtrail"
+ << "unittest_cxememorymonitor"
+ << "unittest_cxediskmonitor";
QDir dir;
dir.mkpath(logFileFolder);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/system_include/locationtrailpskeys.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/locationtrailpskeys.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Definition file for Location Trail PS keys.
+*
+*/
+
+#ifndef __LOCATIONTRAILPSKEYS_H__
+#define __LOCATIONTRAILPSKEYS_H__
+
+const TUid KPSUidLocationTrail = { 0x200071BE };
+
+/**
+ * Used by location trail, indicating location trail state changes.
+ *
+ * Possible values:
+ * 0: Location trail stopped.
+ * 1: Location trail started, waiting for valid GPS data.
+ * 2: Location trail started, searching GPS device.
+ * 3: Location trail started.
+ */
+const TUint32 KLocationTrailState = 0x00000001;
+
+
+#endif // __LOCATIONTRAILPSKEYS_H__
+
+// End of file.
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "rlocationtrail.h"
+
+RLocationTrail::RLocationTrail()
+{
+}
+
+RLocationTrail::~RLocationTrail()
+{
+}
+
+TInt RLocationTrail::Connect()
+{
+ return KErrNone;
+}
+
+void RLocationTrail::Close()
+{
+}
+
+TInt RLocationTrail::StartLocationTrail(TTrailCaptureSetting aState)
+{
+ return KErrNone;
+}
+
+TInt RLocationTrail::StopLocationTrail()
+{
+ return KErrNone;
+}
+
+TInt RLocationTrail::GetLocationTrailState( TTrailState& aState )
+{
+ return KErrNone;
+}
+
+void RLocationTrail::NotifyLocationTrailStateChange( TRequestStatus& aStatus )
+{
+}
+
+void RLocationTrail::CancelNotificationRequest()
+{
+}
+
+TInt RLocationTrail::RetrieveLocation( const TTime& aTimeStamp,
+ TLocationData& aLocationData,
+ TTrailState& aState )
+{
+ return KErrNone;
+}
+
+void RLocationTrail::CurrentLocation( TRequestStatus& aStatus,
+ TLocationData& aLocationData)
+{
+}
+
+void RLocationTrail::CancelLocationRequest()
+{
+}
+
+TInt RLocationTrail::GetTrailCaptureSetting( TTrailCaptureSetting& aCaptureSetting )
+{
+ return KErrNone;
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef R_RLOCATIONTRAIL_H
+#define R_RLOCATIONTRAIL_H
+
+#include
+#include
+#include
+#include
+
+typedef TPckg TLocalityPckg;
+
+/**
+ * RLocationManager dummy.
+ */
+class RLocationTrail
+ {
+public:
+
+ enum TTrailState
+ {
+ ETrailStopped,
+ EWaitingGPSData,
+ ESearchingGPS,
+ ETrailStarted,
+ ETrailStopping,
+ ETrailStarting
+ };
+ enum TTrailCaptureSetting
+ {
+ EOff,
+ ECaptureNetworkInfo,
+ ECaptureAll
+ };
+
+public:
+ RLocationTrail();
+ ~RLocationTrail();
+
+ TInt Connect();
+ void Close();
+
+ TInt StartLocationTrail(TTrailCaptureSetting aState);
+ TInt StopLocationTrail();
+ TInt GetLocationTrailState( TTrailState& aState );
+ void NotifyLocationTrailStateChange( TRequestStatus& aStatus );
+ void CancelNotificationRequest();
+ TInt RetrieveLocation( const TTime& aTimeStamp,
+ TLocationData& aLocationData,
+ TTrailState& aState );
+ void CurrentLocation( TRequestStatus& aStatus,
+ TLocationData& aLocationData);
+ void CancelLocationRequest();
+ TInt GetTrailCaptureSetting( TTrailCaptureSetting& aCaptureSetting );
+ };
+
+#endif // R_RLOCATIONTRAIL_H
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -27,11 +27,15 @@
* ThumbnailManager::ThumbnailManager
*/
ThumbnailManager::ThumbnailManager(QObject* parentPtr)
+ : mTimer(this)
{
Q_UNUSED(parentPtr);
mCurrentThumbnailId = 0;
mThumbnailManagerIds.clear();
+ mTimer.setSingleShot(true);
+ connect(&mTimer, SIGNAL(timeout()),
+ this, SLOT(emulateThumbnailReady()));
}
@@ -53,9 +57,33 @@
Q_UNUSED(priority);
+ int id = 0;
+
+ if (filename.isNull() || filename.isEmpty()) {
+ id = -1;
+ } else {
+ // generate thumbnail id
+ id = mCurrentThumbnailId;
+ mThumbnailManagerIds.append(mCurrentThumbnailId++);
+ }
+
+ // try emulating thumbnail ready
+ mTimer.start(1000);
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return id;
+}
+
+int ThumbnailManager::setThumbnail( const QImage& source, const QString& fileName,
+ void *clientData, int priority)
+{
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+
int status = KErrNone;
- if (filename.isNull() || filename.isEmpty()) {
+ if (fileName.isNull() || fileName.isEmpty()) {
status = KErrNotFound;
} else {
// generate thumbnail id
@@ -65,14 +93,12 @@
emit thumbnailReady(QPixmap(), clientData, mCurrentThumbnailId, status);
mCurrentThumbnailId++;
-
+
CX_DEBUG_EXIT_FUNCTION();
- return status;
+ return mCurrentThumbnailId;
}
-
-
/*!
* start canceling creating thumbnail operation
*/
@@ -80,3 +106,21 @@
{
return mThumbnailManagerIds.contains(id);
}
+
+
+/*!
+* slot that emulates thumbnail ready
+*/
+void ThumbnailManager::emulateThumbnailReady()
+{
+ // get the current thumbnail id
+ int id = mCurrentThumbnailId - 1;
+ int status = KErrNone;
+
+ if (id == -1) {
+ // if there are no valid thumbnails
+ status = KErrNotFound;
+ }
+ emit thumbnailReady(QPixmap(), 0, id, status);
+}
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.h Thu Jul 15 01:55:05 2010 +0300
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
class ThumbnailManager : public QObject
@@ -63,6 +64,24 @@
int priority = 0);
/**
+ * Set a thumbnail for an object file generated from pixmap delivered.
+ * thumbnailReady() signal will be emited when the operation is complete.
+ *
+ * @param source QImage from which the thumbnail will be created
+ * @param fileName file name
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady callback.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ *
+ */
+ int setThumbnail( const QImage& source, const QString& fileName,
+ void * clientData = NULL, int priority = 0 );
+
+ /**
* Cancel a thumbnail operation.
*
* @param id Request ID for the operation to be cancelled.
@@ -82,9 +101,13 @@
*/
void thumbnailReady( QPixmap , void * , int , int );
+private slots:
+ void emulateThumbnailReady();
+
private:
int mCurrentThumbnailId;
QList mThumbnailManagerIds;
+ QTimer mTimer;
};
#endif // THUMBNAILMANAGER_QT
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unit.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Thu Jul 15 01:55:05 2010 +0300
@@ -42,6 +42,10 @@
unittest_cxequalitypresetssymbian \
unittest_cxethumbnailmanagersymbian \
unittest_cxeharvestercontrolsymbian \
- unittest_cxesettingscontrolsymbian
+ unittest_cxesettingscontrolsymbian \
+ unittest_cxesnapshotcontrol \
+ unittest_cxegeotaggingtrail \
+ unittest_cxediskmonitor \
+ unittest_cxememorymonitor
CONFIG *= ordered
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -23,13 +23,15 @@
#include "cxetestutils.h"
#include "cxefakecameradevicecontrol.h"
#include "cxefakecameradevice.h"
+#include "cxefakesettings.h"
#include "cxeautofocuscontrolsymbian.h"
#include "unittest_cxeautofocuscontrolsymbian.h"
UnitTestCxeAutoFocusControlSymbian::UnitTestCxeAutoFocusControlSymbian()
- : mAutoFocusControl(0),
- mCameraDeviceControl(0),
- mCameraDevice(0)
+ : mAutoFocusControl(NULL),
+ mCameraDeviceControl(NULL),
+ mCameraDevice(NULL),
+ mFakeSettings(NULL)
{
}
@@ -43,11 +45,13 @@
{
qDebug() << "UnitTestCxeAutoFocusControlSymbian::init =>";
+ mFakeSettings = new CxeFakeSettings();
+
mCameraDeviceControl = new CxeFakeCameraDeviceControl();
mCameraDevice = new CxeFakeCameraDevice();
mCameraDevice->newCamera(mCameraDeviceControl->cameraIndex(), mCameraDeviceControl);
- mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice);
+ mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, *mFakeSettings);
//mAutoFocusControl->initializeResources();
connect(mCameraDeviceControl, SIGNAL(cameraEvent(int,int)),
@@ -61,15 +65,18 @@
{
qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup =>";
delete mAutoFocusControl;
- mAutoFocusControl = 0;
+ mAutoFocusControl = NULL;
delete mCameraDeviceControl;
- mCameraDeviceControl = 0;
+ mCameraDeviceControl = NULL;
delete mCameraDevice;
- mCameraDevice = 0;
+ mCameraDevice = NULL;
+
+ delete mFakeSettings;
+ mFakeSettings = NULL;
+
qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup <=";
-
}
@@ -108,6 +115,15 @@
QVERIFY(mAutoFocusControl->mode() == CxeAutoFocusControl::Portrait);
}
+void UnitTestCxeAutoFocusControlSymbian::testIsFixedFocusMode()
+{
+ QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Auto) == false);
+ QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Hyperfocal) == true);
+ QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Macro) == false);
+ QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Infinity) == true);
+ QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Portrait) == false);
+}
+
void UnitTestCxeAutoFocusControlSymbian::testSupported()
{
bool supported = mAutoFocusControl->supported();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -24,6 +24,7 @@
class CxeAutoFocusControlSymbian;
class CxeFakeCameraDeviceControl;
class CxeFakeCameraDevice;
+class CxeFakeSettings;
class UnitTestCxeAutoFocusControlSymbian : public QObject
{
@@ -40,6 +41,7 @@
void testStart();
void testCancel();
void testMode();
+ void testIsFixedFocusMode();
void testSupported();
@@ -52,6 +54,7 @@
CxeAutoFocusControlSymbian *mAutoFocusControl;
CxeFakeCameraDeviceControl *mCameraDeviceControl;
CxeFakeCameraDevice *mCameraDevice;
+ CxeFakeSettings *mFakeSettings;
};
#endif // UNITTEST_CXEAUTOFOCUSCONTROLSYMBIAN_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -33,7 +33,9 @@
cxecameradevice.cpp \
cxefakecameradevice.cpp \
cxecameradevicecontrolsymbian.cpp \
- cxefakecameradevicecontrol.cpp
+ cxefakecameradevicecontrol.cpp \
+ cxefakesettings.cpp
+
HEADERS *= unittest_cxeautofocuscontrolsymbian.h \
cxeautofocuscontrol.h \
cxeautofocuscontrolsymbian.h \
@@ -48,4 +50,6 @@
cxecameradevicecontrol.h \
cxecameradevicecontrolsymbian.h \
cxefakecameradevicecontrol.h \
- cxutils.h
+ cxutils.h \
+ cxefakesettings.h \
+ cxesettings.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/unittest_cxecameradevicecontrolsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/unittest_cxecameradevicecontrolsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/unittest_cxecameradevicecontrolsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -26,6 +26,8 @@
LIBS *= -lfbscli
LIBS *= -lbitgdi
LIBS *= -lsysutil
+LIBS *= -lefsrv
+LIBS *= -lcone
DEFINES *= CXE_USE_DUMMY_CAMERA
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,1 @@
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXEDISKMONITORPRIVATEUNIT_H
+#define CXEDISKMONITORPRIVATEUNIT_H
+
+// Include files
+
+#include "cxediskmonitorprivate.h"
+
+class CxeDiskMonitorPrivateUnit;
+
+
+
+#endif // CXEDISKMONITORPRIVATEUNIT_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cxesysutil.h"
+#include "cxutils.h"
+
+qint64 CxeSysUtil::mSpaceAvailable = 0;
+
+ /**
+ * Checks if free disk drive storage space is or will fall below critical
+ * level. Static configuration values stored in Central Repository are
+ * used to determine a critical level for each drive.
+ *
+ * If aBytesToWrite is more than zero, function returns false otherwise true.
+ * By defining aBytesToWrite to zero it is possible to get fake fulldisk error.
+ *
+ */
+TBool CxeSysUtil::DiskSpaceBelowCriticalLevel(
+ RFs* /*aFs*/,
+ TInt aBytesToWrite,
+ TInt /*aDrive*/ )
+{
+ CX_DEBUG_IN_FUNCTION();
+
+ if (aBytesToWrite > 0) {
+ return EFalse;
+ }
+ else {
+ return ETrue;
+ }
+}
+
+qint64 CxeSysUtil::spaceAvailable(
+ RFs & /*fs*/,
+ int /*index*/,
+ CxeSettings & /*settings*/)
+{
+ CX_DEBUG_IN_FUNCTION();
+ return CxeSysUtil::mSpaceAvailable;
+}
+
+void CxeSysUtil::setSpaceAvailable(qint64 aSpaceAvailable)
+{
+ CX_DEBUG_IN_FUNCTION();
+ mSpaceAvailable = aSpaceAvailable;
+}
+
+int CxeSysUtil::getCameraDrive(RFs & /*fs*/)
+{
+ CX_DEBUG_IN_FUNCTION();
+ return 1;
+}
+
+// End of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub class for testing purposes
+*
+*/
+
+#ifndef CXESYSUTIL_H
+#define CXESYSUTIL_H
+
+#include
+#include
+
+class RFs;
+class CxeSettings;
+
+class CxeSysUtil
+ {
+
+public:
+
+ static TBool DiskSpaceBelowCriticalLevel(
+ RFs* aFs,
+ TInt aBytesToWrite,
+ TInt aDrive);
+
+ static qint64 spaceAvailable(RFs &fs, int index, CxeSettings &settings);
+ static void setSpaceAvailable(qint64 aSpaceAvailable);
+
+ static int getCameraDrive(RFs &fs);
+
+public:
+ static qint64 mSpaceAvailable;
+ };
+
+#endif // CXESYSUTIL_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include
+#include
+#include
+#include
+#include
+
+#include "cxetestutils.h"
+#include "cxefakesettings.h"
+#include "cxesysutil.h"
+#include "cxediskmonitor.h"
+#include "unittest_cxediskmonitor.h"
+
+UnitTestCxeDiskMonitor::UnitTestCxeDiskMonitor()
+ : mFakeSettings(NULL),
+ mDiskMonitor(NULL)
+{
+}
+
+UnitTestCxeDiskMonitor::~UnitTestCxeDiskMonitor()
+{
+ cleanup();
+}
+
+// Run before each individual test case
+void UnitTestCxeDiskMonitor::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mFakeSettings = new CxeFakeSettings();
+ mDiskMonitor = new CxeDiskMonitor(*mFakeSettings);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// Run after each individual test case
+void UnitTestCxeDiskMonitor::cleanup()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ delete mDiskMonitor;
+ mDiskMonitor = NULL;
+
+ delete mFakeSettings;
+ mFakeSettings = NULL;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testStart()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mDiskMonitor->start();
+ mDiskMonitor->start(); // testing double run - should not crash
+ QVERIFY(mDiskMonitor->isMonitoring() == true);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testStop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mDiskMonitor->stop();
+ QVERIFY(mDiskMonitor->isMonitoring() == false);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testIsMonitoring()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mDiskMonitor->start();
+ mDiskMonitor->start();
+ QVERIFY(mDiskMonitor->isMonitoring() == true);
+
+ mDiskMonitor->stop();
+ QVERIFY(mDiskMonitor->isMonitoring() == false);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testFree()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CxeSysUtil::setSpaceAvailable(0);
+ QVERIFY(mDiskMonitor->free(false) == 0);
+ CxeSysUtil::setSpaceAvailable(100000);
+ QVERIFY(mDiskMonitor->free(false) == 100000);
+ QVERIFY(mDiskMonitor->free(true) == 100000);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testSetLowWarningLevelZero()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mDiskMonitor->setLowWarningLevel(0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testSetLowWarningLevelTenMegabytes()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mDiskMonitor->setLowWarningLevel(10485760);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testSetLowWarningLevelFiveGigabyte()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mDiskMonitor->setLowWarningLevel(5368709120);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testLowLevelWarningSignal()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QSignalSpy spy(mDiskMonitor, SIGNAL(diskSpaceLow()));
+ mDiskMonitor->stop();
+ mDiskMonitor->setLowWarningLevel(100);
+ mDiskMonitor->start();
+ CxeSysUtil::setSpaceAvailable(90);
+ CxeTestUtils::waitForSignal(spy, 10000, 1, true);
+ QVERIFY(spy.count() > 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeDiskMonitor::testFreeSpaceChangedSignal()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QSignalSpy spy(mDiskMonitor, SIGNAL(diskSpaceChanged()));
+ mDiskMonitor->stop();
+ mDiskMonitor->setLowWarningLevel(100);
+ mDiskMonitor->start();
+ CxeSysUtil::setSpaceAvailable(110);
+ CxeSysUtil::setSpaceAvailable(120);
+ CxeTestUtils::waitForSignal(spy, 10000, 1, true);
+ QVERIFY(spy.count() > 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+QTEST_MAIN(UnitTestCxeDiskMonitor);
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef UNITTEST_CXEDISKMONITOR_H
+#define UNITTEST_CXEDISKMONITOR_H
+
+#include
+
+#include "cxenamespace.h"
+
+class CxeDiskMonitor;
+class CxeFakeSettings;
+
+class UnitTestCxeDiskMonitor : public QObject
+{
+ Q_OBJECT
+
+public:
+ UnitTestCxeDiskMonitor();
+ ~UnitTestCxeDiskMonitor();
+
+private slots:
+ void init();
+ void cleanup();
+
+ void testStart();
+ void testStop();
+ void testIsMonitoring();
+ void testFree();
+ void testSetLowWarningLevelZero();
+ void testSetLowWarningLevelTenMegabytes();
+ void testSetLowWarningLevelFiveGigabyte();
+ void testLowLevelWarningSignal();
+ void testFreeSpaceChangedSignal();
+
+private:
+ CxeFakeSettings *mFakeSettings;
+ CxeDiskMonitor *mDiskMonitor;
+};
+
+#endif // UNITTEST_CXEDISKMONITOR_H
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.pro Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,32 @@
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+include(../unittest.pri)
+
+TARGET = unittest_cxediskmonitor
+
+DEPENDPATH = . ../../fakeclasses ../../../src/dummyengine ../utils
+INCLUDEPATH = . ../../fakeclasses ../../../src/dummyengine ../utils ../../../traces
+
+DEFINES *= CXE_USE_DUMMY_CAMERA
+
+SOURCES *= unittest_cxediskmonitor.cpp \
+ ./cxesysutil.cpp \
+ cxefakesettings.cpp \
+ ../../../src/cxediskmonitor.cpp \
+ ../../../src/cxediskmonitorprivate.cpp
+
+HEADERS *= unittest_cxediskmonitor.h \
+ ./cxesysutil.h \
+ ../../../inc/api/cxesettings.h \
+ cxefakesettings.h \
+ ../../../inc/cxediskmonitor.h \
+ ../../../inc/cxediskmonitorprivate.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -27,15 +27,18 @@
#include "cxefakesensoreventhandler.h"
#include "cxefakefilenamegenerator.h"
#include "cxutils.h"
+#include "cxefakesettingsmodel.h"
// Member Functions
CxeEngineSymbianUnit::CxeEngineSymbianUnit()
{
+ CX_DEBUG_IN_FUNCTION();
}
CxeEngineSymbianUnit::~CxeEngineSymbianUnit()
{
+ CX_DEBUG_IN_FUNCTION();
}
@@ -67,6 +70,10 @@
mVideoCaptureControl = new CxeFakeVideoCaptureControl();
+ mSettingsModel = new CxeFakeSettingsModel();
+
+ mFeatureManager = new CxeFakeFeatureManager();
+
}
CX_DEBUG_EXIT_FUNCTION();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.h Thu Jul 15 01:55:05 2010 +0300
@@ -27,6 +27,7 @@
CxeEngineSymbianUnit();
virtual ~CxeEngineSymbianUnit();
+protected:
void createControls();
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -42,6 +42,7 @@
delete mEngine;
mEngine = NULL;
mEngine = new CxeEngineSymbianUnit();
+ mEngine->construct();
mEngine->initMode(Cxe::ImageMode);
mCameraDeviceControl = qobject_cast(
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -41,10 +41,9 @@
LIBS *= -lsensrvclient
LIBS *= -lsensrvutil
LIBS *= -limagingconfigmanager
-LIBS *= -lalfclient
-LIBS *= -lalfdecoderserverclient
LIBS *= -lxqserviceutil
LIBS *= -loommonitor
+LIBS += -llocationmanager
SOURCES *= unittest_cxeenginesymbian.cpp \
@@ -102,7 +101,12 @@
cxediskmonitor.cpp \
cxediskmonitorprivate.cpp \
cxememorymonitor.cpp \
- cxememorymonitorprivate.cpp
+ cxememorymonitorprivate.cpp \
+ cxesnapshotcontrol.cpp \
+ cxesnapshotcontrolprivate.cpp \
+ cxefakesettingsmodel.cpp \
+ cxegeotaggingtrail.cpp \
+ cxegeotaggingtrailprivate.cpp
@@ -174,4 +178,9 @@
cxediskmonitor.h \
cxediskmonitorprivate.h \
cxememorymonitor.h \
- cxememorymonitorprivate.h
+ cxememorymonitorprivate.h \
+ cxesnapshotcontrol.h \
+ cxesnapshotcontrolprivate.h \
+ cxefakesettingsmodel.h \
+ cxegeotaggingtrail.h \
+ cxegeotaggingtrailprivate.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -20,6 +20,12 @@
#include "unittest_cxefeaturemanagerimp.h"
#include "cxefakesettingsmodel.h"
#include "cxefeaturemanagerimp.h"
+#include "cxenamespace.h"
+
+
+static const char* INVALID_KEY = "invalid key";
+static const char* EMPTY_KEY = "";
+
UnitTestCxeFeatureManager::UnitTestCxeFeatureManager()
: mFakeSettingsModel(NULL), mFeatureManager(NULL)
@@ -34,6 +40,7 @@
// Run before each individual test case
void UnitTestCxeFeatureManager::init()
{
+ // fake model contains initialized test data.
mFakeSettingsModel = new CxeFakeSettingsModel();
mFeatureManager = new CxeFeatureManagerImp(*mFakeSettingsModel);
}
@@ -49,34 +56,25 @@
}
// Testing that isFeatureSupported function returns correct values
-void UnitTestCxeFeatureManager::testSupportedKeys()
+void UnitTestCxeFeatureManager::testIsFeatureSupported()
{
- // Create a key that won't be added to test data
- QString falseKey = QString("testKeyFalse");
bool isSupported;
CxeError::Id err;
+ QString key;
- // Test that key that is not added to test data is not found
- // also boolean value isSupported should return false as key is not found
- err = mFeatureManager->isFeatureSupported(falseKey, isSupported);
+ // test that invalid key is not found.
+ err = mFeatureManager->isFeatureSupported(INVALID_KEY, isSupported);
+ QVERIFY(!isSupported);
+ QCOMPARE(err, CxeError::NotFound);
+
+ // try with empty key
+ err = mFeatureManager->isFeatureSupported(EMPTY_KEY, isSupported);
QVERIFY(!isSupported);
QCOMPARE(err, CxeError::NotFound);
- // create and set test data with "testKeyTrue" key
- QString trueKey = QString("testKeyTrue");
- QList value;
- value.append(1);
- value.append(2);
- value.append(3);
- mFakeSettingsModel->set(trueKey, value);
-
- // the false key should return the same values as before adding true key to test data
- err = mFeatureManager->isFeatureSupported(falseKey, isSupported);
- QVERIFY(!isSupported);
- QCOMPARE(err, CxeError::NotFound);
-
- // check that just added key can be found from test data and no error occurs
- err = mFeatureManager->isFeatureSupported(trueKey, isSupported);
+ // test with right key
+ key = CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS;
+ err = mFeatureManager->isFeatureSupported(key, isSupported);
QVERIFY(isSupported);
QCOMPARE(err, CxeError::None);
@@ -84,82 +82,30 @@
// test that configuredValues function returns a correct error code and not any values
// with any arbitrary key when there is no data set
-void UnitTestCxeFeatureManager::testConfiguredValuesEmptyData()
+void UnitTestCxeFeatureManager::testconfiguredValues()
{
- QString falseKey = QString("testKeyFalse");
QList values;
CxeError::Id err;
+ QString key;
- // no data
- err = mFeatureManager->configuredValues(falseKey,values);
+ // case 1: test with invalid key
+ err = mFeatureManager->configuredValues(INVALID_KEY, values);
QCOMPARE(err, CxeError::NotFound);
QCOMPARE(values.count(), 0);
-
-}
-
-// test that configuredValues function returns a correct error code and not any values
-// with any arbitrary key when there is data set but not for false key
-void UnitTestCxeFeatureManager::testConfiguredValuesFalseKey()
-{
- QString falseKey = QString("testKeyFalse");
- QString trueKey = QString("testKeyTrue");
- QList value;
- value.append(1);
- value.append(2);
- value.append(3);
- mFakeSettingsModel->set(trueKey, value);
-
- CxeError::Id err;
- QList values;
-
- // false key
- err = mFeatureManager->configuredValues(falseKey, values);
+
+ // case 2: test with empty key
+ err = mFeatureManager->configuredValues(EMPTY_KEY, values);
QCOMPARE(err, CxeError::NotFound);
- // as key is not found values list should be empty
QCOMPARE(values.count(), 0);
+
+ // case 3: test with right key
+ key = CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS;
+ err = mFeatureManager->configuredValues(key, values);
+ QCOMPARE(err, CxeError::None);
+ QVERIFY(values.count() > 0);
+
}
-// test data is set with the same key that is used for fetching configured values
-// Now error code should be None as the key should be found from the data
-// Also value count should match with the amount of set values
-void UnitTestCxeFeatureManager::testConfiguredValuesTrueKeyAndData()
-{
- QString trueKey = QString("testKeyTrue");
- QList value;
- // values added to key
- value.append(1);
- value.append(2);
- value.append(3);
- mFakeSettingsModel->set(trueKey, value);
-
- CxeError::Id err;
- QList values;
-
- // true key
- err = mFeatureManager->configuredValues(trueKey, values);
- QCOMPARE(err, CxeError::None);
- QCOMPARE(values.count(), 3);
-}
-
-// Currently only integer type values can be fetched with configuredValues-function.
-// Test that proper error code is returned when data values are something else than integers
-void UnitTestCxeFeatureManager::testConfiguredValuesFalseData()
-{
- QString trueKey = QString("testKeyTrue");
- QList value;
- value.append(1);
- value.append(2);
- value.append(true); // add boolean value which is not supported
- mFakeSettingsModel->set(trueKey, value);
-
- CxeError::Id err;
- QList values;
-
- // getting configured values should fail as boolean values are not supported
- err = mFeatureManager->configuredValues(trueKey, values);
- QCOMPARE(err, CxeError::NotSupported);
-
-}
// main() function non-GUI testing
QTEST_MAIN(UnitTestCxeFeatureManager);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h Thu Jul 15 01:55:05 2010 +0300
@@ -34,11 +34,8 @@
void init();
void cleanup();
- void testSupportedKeys();
- void testConfiguredValuesEmptyData();
- void testConfiguredValuesFalseKey();
- void testConfiguredValuesTrueKeyAndData();
- void testConfiguredValuesFalseData();
+ void testIsFeatureSupported();
+ void testconfiguredValues();
private:
CxeFakeSettingsModel *mFakeSettingsModel;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro Thu Jul 15 01:55:05 2010 +0300
@@ -19,4 +19,5 @@
HEADERS *= unittest_cxefeaturemanagerimp.h \
cxefeaturemanagerimp.h \
cxefakesettingsmodel.h \
- cxeerror.h
+ cxeerror.h \
+ cxenamespace.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -20,6 +20,8 @@
LIBS *= -lplatformenv
LIBS *= -lsysutil
+LIBS *= -lefsrv
+LIBS *= -lcone
SOURCES *= unittest_cxefilenamegeneratorsymbian.cpp \
cxefakesettings.cpp \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -72,7 +72,7 @@
// Case 0: Checking if a file is saved with all valid parameters
const int index(2);
const int id(7);
- CxeImageDataItem *imageDataItem = new CxeFakeImageDataItem(index, QByteArray("unit test successful"), filename, id);
+ CxeImageDataItem *imageDataItem = new CxeFakeImageDataItem(index, QByteArray("unit test successful"), filename, id, false);
QSignalSpy imageItemStateSpy(imageDataItem, SIGNAL(imageSaved(CxeError::Id, const QString&, int)));
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -21,7 +21,8 @@
LIBS *= -lsysutil
LIBS *= -lplatformenv
-
+LIBS *= -lefsrv
+LIBS *= -lcone
SOURCES *= unittest_cxefilesavethreadsymbian.cpp \
thumbnailmanager_qt.cpp \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -22,9 +22,12 @@
#include "unittest_cxeharvestercontrolsymbian.h"
#include "cxeharvestercontrolsymbian.h"
#include "cxutils.h"
+#include "cxeerror.h"
UnitTestCxeHarvesterControlSymbian::UnitTestCxeHarvesterControlSymbian()
+ : mHarvesterControl(NULL)
{
+ qRegisterMetaType("CxeError::Id");
}
@@ -49,35 +52,30 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QSignalSpy harvestCompleteSpy(mHarvesterControl, SIGNAL(fileHarvested(const QString&, int)));
+ QSignalSpy harvestCompleteSpy(mHarvesterControl, SIGNAL(fileHarvested(CxeError::Id, const QString&)));
QString filename;
+ QVariantList initModeArguments;
QVERIFY(harvestCompleteSpy.isValid());
// case 1: testing with wrong dummy file, we should get an error code with harvestcomplete
// since filename is invalid
mHarvesterControl->harvestFile(filename, 0, 0);
-
QCOMPARE( harvestCompleteSpy.count(), 1 );
- if (harvestCompleteSpy.count() > 0) {
- QList initModeArguments = harvestCompleteSpy.takeFirst();
- // we are only interested in error code in this case 1
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNotFound);
- }
-
+ initModeArguments = harvestCompleteSpy.takeFirst();
+ // we are only interested in error code in this case 1
+ QCOMPARE(initModeArguments.at(0).value(), CxeError::NotFound);
// case 2: testing with real filename, harvesting should go fine, callback without errors
filename = QString("test.jpg");
mHarvesterControl->harvestFile(filename, 0, 0);
QCOMPARE( harvestCompleteSpy.count(), 1 );
- if (harvestCompleteSpy.count() > 0) {
- QList initModeArguments = harvestCompleteSpy.takeFirst();
- // we check both the filename, since in this case harvesting should go fine
- // and error returned is KErrNone.
- QCOMPARE(initModeArguments.at(1).toString(), filename);
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNone);
- }
+ initModeArguments = harvestCompleteSpy.takeFirst();
+ // we check both the filename, since in this case harvesting should go fine
+ // and error returned is KErrNone.
+ QCOMPARE(initModeArguments.at(0).value(), CxeError::None);
+ QCOMPARE(initModeArguments.at(1).toString(), filename);
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -22,7 +22,8 @@
cxeerrormappingsymbian.h \
cxeharvestercontrolsymbian.h \
harvesterclient.h \
- cxutils.h
+ cxutils.h \
+ cxeerror.h
SOURCES *= unittest_cxeharvestercontrolsymbian.cpp \
cxeerrormappingsymbian.cpp \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -19,8 +19,8 @@
#include "cxutils.h"
#include "cxefakesysutil.h"
-CxeImageDataItemUnit::CxeImageDataItemUnit(int index, QByteArray data, QString filename)
- : CxeImageDataItemSymbian(data, filename, index)
+CxeImageDataItemUnit::CxeImageDataItemUnit(int index, QByteArray data, QString filename, bool addLocation)
+ : CxeImageDataItemSymbian(data, filename, index, addLocation)
{
CX_DEBUG_IN_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h Thu Jul 15 01:55:05 2010 +0300
@@ -36,7 +36,7 @@
Q_OBJECT
public:
- CxeImageDataItemUnit(int index, QByteArray data, QString filename);
+ CxeImageDataItemUnit(int index, QByteArray data, QString filename, bool addLocation);
virtual ~CxeImageDataItemUnit();
int checkDiskSpace(RFs* aFs,
TInt aBytesToWrite,
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -44,7 +44,7 @@
mPath = generateImageFileName(index);
QByteArray data = "1234";
- mImageDataItem = new CxeImageDataItemUnit(index, data, mPath);
+ mImageDataItem = new CxeImageDataItemUnit(index, data, mPath, false);
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SavePending);
CX_DEBUG_EXIT_FUNCTION();
@@ -96,7 +96,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
- mImageDataItem = new CxeImageDataItemUnit( index, data, path );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, path, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue == KErrArgument);
@@ -104,7 +104,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
QString filename = generateImageFileNameWithLetter(++index, "C");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
@@ -113,7 +113,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
filename = generateImageFileNameWithLetter(++index, "");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
@@ -122,7 +122,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
filename = generateImageFileNameWithLetter(++index, "12");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
@@ -131,7 +131,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
filename = generateImageFileNameWithLetter(++index, "Edata");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,8 @@
LIBS *= -lsysutil
LIBS *= -lbitgdi
LIBS *= -lws32
-LIBS *= -lsysutil
+LIBS *= -lefsrv
+LIBS *= -lcone
LIBS *= -lecom
LIBS *= -lecampluginsupport
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/cxeimagedataqueueunit.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/cxeimagedataqueueunit.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/cxeimagedataqueueunit.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -32,5 +32,5 @@
CxeImageDataItem *CxeImageDataQueueUnit::createDataItem( int index, const QByteArray& data, const QString& path ) const
{
static int id = 0;
- return new CxeFakeImageDataItem(index, data, path, id++);
+ return new CxeFakeImageDataItem(index, data, path, id++, false);
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -83,8 +83,8 @@
{
// Add some items
QByteArray data("test");
- mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0);
- mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1);
+ mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0, false);
+ mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1, false);
// Test that clearing works also with some content.
mImageDataQueue->clear();
@@ -97,8 +97,8 @@
void UnitTestCxeImageDataQueueSymbian::testOperatorAtIndex()
{
QByteArray data("test");
- CxeImageDataItemSymbian* itemIn1 = mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0);
- CxeImageDataItemSymbian* itemIn2 = mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1);
+ CxeImageDataItemSymbian* itemIn1 = mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0, false);
+ CxeImageDataItemSymbian* itemIn2 = mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1, false);
CxeImageDataItem& itemOut1 = (*mImageDataQueue)[0];
CxeImageDataItem& itemOut2 = (*mImageDataQueue)[1];
QVERIFY(itemIn1 == &itemOut1);
@@ -111,7 +111,7 @@
void UnitTestCxeImageDataQueueSymbian::testStartSave()
{
QByteArray data("test");
- CxeImageDataItemSymbian* itemIn = mImageDataQueue->startSave(data, "C:\\Images\\unittest.jpeg", 0);
+ CxeImageDataItemSymbian* itemIn = mImageDataQueue->startSave(data, "C:\\Images\\unittest.jpeg", 0, false);
QVERIFY(itemIn != NULL);
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,8 @@
LIBS *= -lsysutil
LIBS *= -lplatformenv
+LIBS *= -lefsrv
+LIBS *= -lcone
SOURCES *= unittest_cxeimagedataqueuesymbian.cpp \
cxeimagedataqueuesymbian.cpp \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub implementation of the HAL class for testing purposes
+*
+*/
+
+#include "hal.h"
+
+TInt HAL::Get(TAttribute /*aAttribute*/, TInt& /*aValue*/)
+{
+ return KErrNone;
+}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,206 @@
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Stub class for testing purposes
+//
+// WARNING: This file contains some APIs which are internal and are subject
+// to change without notice. Such APIs should therefore not be used
+// outside the Kernel and Hardware Services package.
+//
+
+#ifndef __HAL_H__
+#define __HAL_H__
+
+#include
+#include
+#include "hal_data.h"
+
+/**
+@publishedPartner
+@released
+
+A set of static functions to get and set hardware attributes.
+
+@see HALData
+*/
+class HAL : public HALData
+ {
+public:
+
+ /**
+ Synonyms for the attribute properties
+ HALData::TAttributeProperty, and used in SEntry.
+ */
+ enum TEntryProperty
+ {
+ /**
+ When set, means that an attribute is meaningful on this device.
+ */
+ EEntryValid=0x1,
+
+
+ /**
+ When set, means that an attribute is modifiable.
+ */
+ EEntryDynamic=0x2,
+ };
+
+ /**
+ Defines an entry in the array that is returned in a call to HAL::GetAll().
+ */
+ struct SEntry
+ {
+ /**
+ The properties of the attribute.
+
+ @see HAL::TEntryProperty
+ */
+ TInt iProperties;
+
+ /**
+ The attribute value.
+
+ @see HALData::TAttribute
+ */
+ TInt iValue;
+ };
+public:
+ /**
+ Gets the value of the specified HAL attribute.
+
+ @param aAttribute The HAL attribute.
+ @param aValue On successful return, contains the attribute value.
+ Some attributes may accept aValue as an input as well, to select
+ one of several alternate values. See the documentation for the
+ individual HAL attributes for details of this.
+
+ @return KErrNone, if successful;
+ KErrNotSupported, if the attribute is not defined in the list
+ of attributes, or is not meaningful for this device.
+ KErrArgument, if aValue was invalid (for attributes
+ which take an argument).
+
+ @see HALData::TAttribute
+ @see HALData::TAttributeProperty
+ */
+ static TInt Get(TAttribute aAttribute, TInt& aValue);
+
+
+ /**
+ Sets the specified HAL attribute.
+
+ @param aAttribute The HAL attribute.
+ @param aValue The attribute value.
+
+ @return KErrNone, if successful;
+ KErrNotSupported, if the attribute is not defined in the list
+ of attributes, or is not meaningful for this device, or is
+ not settable.
+
+ @see HALData::TAttribute
+ @see HALData::TAttributeProperty
+
+ @capability WriteDeviceData or other capability specified
+ for individual attributes in TAttribute
+ */
+ static TInt Set(TAttribute aAttribute, TInt aValue);
+
+
+ /**
+ Gets all HAL attributes, and their properties.
+
+ For attributes that are not meaningful on this device (ie. those which have
+ not been defined in the config.hcf file), the attribute value and its
+ associated property value are set to zero in the returned array.
+
+ Attributes for which multiple values can be retrieved
+ ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel,
+ EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in
+ the returned array.
+
+ Attributes that allocate resources and open handles are also not returned
+ by this API. Their value and property values will be set to zero in the
+ returned array. Use HAL::Get() for these attributes.
+
+ @param aNumEntries On successful return, contains the total number
+ of HAL attributes.
+ If the function returns KErrNoMemory, this value is set
+ to zero.
+ @param aData On successful return, contains a pointer to an array
+ of SEntry objects, each of which contains an attribute value
+ and its property value. Note that the property value is
+ defined by the HAL::TEntry synonym.
+ If the function returns KErrNoMemory, this pointer is set
+ to NULL.
+
+ @return KErrNone, if succesful;
+ KErrNoMemory, if there is insufficient memory.
+ */
+ static TInt GetAll(TInt& aNumEntries, SEntry*& aData);
+
+
+ /**
+ Gets the value of the specified HAL attribute.
+
+ @param aDeviceNumber The device number. (eg: screen number)
+ @param aAttribute The HAL attribute.
+ @param aValue On successful return, contains the attribute value.
+ Some attributes may accept aValue as an input as well, to select
+ one of several alternate values. See the documentation for the
+ individual HAL attributes for details of this.
+
+
+ @return KErrNone, if successful;
+ KErrNotSupported, if the attribute is not defined in the list
+ of attributes, or is not meaningful for this device.
+ KErrArgument, if aValue was invalid (for attributes
+ which take an argument).
+
+ @see HALData::TAttribute
+ @see HALData::TAttributeProperty
+ */
+ static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue);
+
+
+ /**
+ Sets the specified HAL attribute.
+
+ @param aDeviceNumber The device number. (eg: screen number)
+ @param aAttribute The HAL attribute.
+ @param aValue The attribute value.
+
+ @return KErrNone, if successful;
+ KErrNotSupported, if the attribute is not defined in the list
+ of attributes, or is not meaningful for this device, or is
+ not settable.
+
+ @see HALData::TAttribute
+ @see HALData::TAttributeProperty
+
+ @capability WriteDeviceData or other capability specified
+ for individual attributes in TAttribute
+ */
+ static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue);
+ };
+
+
+/**
+@internalComponent
+*/
+static const TInt32 KUidHalPropertyKeyBase = 0x1020E306;
+
+__ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys
+
+
+
+#endif
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal_data.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal_data.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,1363 @@
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of the License "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// hal\inc\hal_data.h
+// This is a test version of the header, for testing purposes only
+//
+
+
+#ifndef __HAL_DATA_H__
+#define __HAL_DATA_H__
+#define bitmask enum
+
+class HALData
+/**
+@publishedPartner
+@released
+
+Sets of attributes and values used by HAL functions.
+*/
+ {
+public:
+ /**
+ A set of enumerators that identifies hardware attributes.
+ The enumerators are passed to HAL::Get() and HAL::Set().
+
+ They are also used by the HAL accessor functions.
+
+ Note: It is not recommended to use HAL attributes to pass handles from the
+ kernel to user-side clients due to resource overhead's that will affect
+ existing clients of HAL. HAL is designed to allow simply hardware parameters
+ to be shared with user-side clients without resource allocation overheads.
+
+ @see HAL::Get()
+ @see HAL::Set()
+ */
+ enum TAttribute
+ {
+ /**
+ Identifies the manufacturer of a device.
+ If this is not enumerated in TManufacturer, then the manufacturer must
+ obtain a value from the Symbian registry.
+
+ @see HALData::TManufacturer
+ */
+ EManufacturer,
+
+
+ /**
+ The device specific hardware version number, as defined by
+ the device manufacturer.
+ */
+ EManufacturerHardwareRev,
+
+
+ /**
+ The device specific version number, as defined by
+ the device manufacturer.
+ */
+ EManufacturerSoftwareRev,
+
+
+ /**
+ The device specific software version number, as defined by
+ the device manufacturer.
+ */
+ EManufacturerSoftwareBuild,
+
+
+ /**
+ The device specific model number, as defined by
+ the device manufacturer.
+ */
+ EModel,
+
+
+ /**
+ This is the device specific UID, It is unique to the class /model
+ of device. A value must be obtained from Symbian's UID registry for
+ this attribute.
+ */
+ EMachineUid,
+
+
+ /**
+ The Symbian OS specified device family identifier.
+ If the device family is not one of those enumerated by TDeviceFamily,
+ then the licensee must obtain a UID from Symbian for this attribute.
+
+ @see HALData::TDeviceFamily
+ */
+ EDeviceFamily,
+
+
+ /**
+ The Symbian OS specified device family version.
+ */
+ EDeviceFamilyRev,
+
+
+ /**
+ The CPU architecture used by this device. The values are enumerated
+ by TCPU.
+
+ @see HALData::TCPU
+ */
+ ECPU,
+
+
+ /**
+ A revision number for the CPU architecture.
+ */
+ ECPUArch,
+
+
+ /**
+ This is the default ABI used by CPU for user applications.
+ The values are enumerated by HALData::TCPUABI.
+ */
+ ECPUABI,
+
+
+ /**
+ The processor speed in KHz.
+ */
+ ECPUSpeed,
+
+
+ /**
+ The reason for most recent system boot.
+ This is dynamic and readonly; the values are enumerated by
+ TSystemStartupReason.
+
+ @see HALData::TSystemStartupReason
+ */
+ ESystemStartupReason,
+
+
+ /**
+ This is the last exception code, in the case of system reboot.
+ This is dynamic and readonly.
+ */
+ ESystemException,
+
+
+ /**
+ The time between system ticks, in microseconds.
+ */
+ ESystemTickPeriod,
+
+
+ /**
+ The total system RAM, in bytes.
+ */
+ EMemoryRAM,
+
+
+ /**
+ The currently free system RAM.
+
+ This is dynamic and readonly.
+ */
+ EMemoryRAMFree,
+
+
+ /**
+ The total System ROM, in bytes.
+ */
+ EMemoryROM,
+
+
+ /**
+ The MMU page size in bytes.
+ */
+ EMemoryPageSize,
+
+
+ /**
+ Indicates the state of the power supply.
+
+ It has the values:
+ 1 = Power is good (i.e. external power is available,
+ or the 'power' battery is >= low);
+ 0 = otherwise.
+
+ This is dynamic and readonly.
+ */
+ EPowerGood,
+
+
+ /**
+ The System (or 'Main') battery power level.
+ The allowable values are enumerated by TPowerBatteryStatus
+
+ This is dynamic and readonly,
+
+ @see HALData::TPowerBatteryStatus
+ */
+ EPowerBatteryStatus,
+
+
+ /**
+ Indicates whether a backup power supply is available.
+ It has the values:
+ 0 = the device does not support (or need) a backup battery source;
+ 1 = a backup batter source is present.
+ This is dynamic and readonly
+ */
+ EPowerBackup,
+
+
+ /**
+ The power level for backup power.
+
+ It has the values enumerated by TPowerBackupStatus.
+
+ This is dynamic and readonly.
+
+ @see HALData::TPowerBackupStatus
+ */
+ EPowerBackupStatus,
+
+
+ /**
+ Indicates the state of the external power.
+
+ It has the values:
+ 0 = external power is not in use;
+ 1 = external power is in use.
+
+ This is dynamic and readonly.
+ */
+ EPowerExternal,
+
+
+ /**
+ A bitmask that describes the available keyboard types (it may support
+ more than one).
+
+ @see HALData::TKeyboard
+ */
+ EKeyboard,
+
+
+ /**
+ */
+ EKeyboardDeviceKeys,
+
+
+ /**
+ */
+ EKeyboardAppKeys,
+
+
+ /**
+ Indicates whether the device can produce a click sound for
+ each keypress.
+
+ It has the values:
+ 0 = the device cannot produce a click sound for each keypress;
+ 1 = the device can produce a click sound.
+ */
+ EKeyboardClick,
+
+
+ /**
+ The state of keyboard clicking.
+
+ It has the values:
+ 0 = key click disabled;
+ 1 = key click enabled.
+
+ This is dynamic and writeable.
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EKeyboardClickState,
+
+
+ /**
+ The keyboard click volume level.
+
+ It can take a value in the range 0 to EKeyboardClickVolumeMax.
+
+ This is dynamic and writeable.
+
+ @see HALData::EKeyboardClickVolumeMax
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EKeyboardClickVolume,
+
+
+ /**
+ The maximum value for EKeyboardClickVolume.
+
+ @see HALData::EKeyboardClickVolume
+ */
+ EKeyboardClickVolumeMax,
+
+
+ /**
+ The screen horizontal dimension in pixels.
+ */
+ EDisplayXPixels,
+
+
+ /**
+ The screen vertical dimension in pixels.
+ */
+ EDisplayYPixels,
+
+
+ /**
+ The screen horizontal dimension in twips.
+ */
+ EDisplayXTwips,
+
+
+ /**
+ The screen vertical dimension in twips.
+ */
+ EDisplayYTwips,
+
+
+ /**
+ The number of hues (colors or shades of grey) displayable on
+ the screen.
+ */
+ EDisplayColors,
+
+
+ /**
+ The state of the display.
+
+ It has the values:
+ 0 = screen is turned off;
+ 1 = screen is on.
+
+ This is dynamic and writeable.
+
+ @capability PowerMgmt needed to Set this attribute
+ */
+ EDisplayState,
+
+
+ /**
+ The screen contrast level.
+ It can take a value in the range 0 to EDisplayContrastMax.
+
+ This is dynamic and writeable
+
+ @see HALData::EDisplayContrastMax
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EDisplayContrast,
+
+
+ /**
+ The maximum value for EDisplayContrast
+
+ @see HALData::EDisplayContrast
+ */
+ EDisplayContrastMax,
+
+
+ /**
+ Indicates whether there is a backlight on the device.
+
+ It has the values:
+ 0 = there is no screen backlight;
+ 1 = a screen backlight is present.
+ */
+ EBacklight,
+
+
+ /**
+ The current status of the backlight.
+
+ It has the values:
+ 0 = off;
+ 1 = on.
+
+ This is dynamic and writeable.
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EBacklightState,
+
+
+ /**
+ Indicates whether a pen or digitizer is available for input.
+
+ It has the values:
+ 0 = a pen/digitizer is not available for input;
+ 1 = a pen/digitizeris present.
+ */
+ EPen,
+
+
+ /**
+ The pen/digitizer horizontal resolution, in pixels.
+ */
+ EPenX,
+
+
+ /**
+ The pen/digitizer vertical resolution, in pixels.
+ */
+ EPenY,
+
+
+ /**
+ Indicates whether a pen tap will turn the display on.
+
+ It has the values:
+ 0 = a pen tap has no effect;
+ 1 = a pent tap or press enables the display.
+
+ This is dynamic and writeable.
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EPenDisplayOn,
+
+
+ /**
+ Indicates whether the device can produce a click sound for
+ each pen tap.
+
+ It has the values:
+ 0 = the device cannot produce a click sound
+ 1 = production of a click sound is supported by the device.
+ */
+ EPenClick,
+
+
+ /**
+ The state of pen clicking.
+
+ It has the values:
+ 0 = pen clicking is disabled;
+ 1 = pen clicking is enabled.
+
+ This is dynamic and writable.
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EPenClickState,
+
+
+ /**
+ The pen click volume level.
+ It can take a value in the range 0 to EPenClickVolumeMax.
+
+ This value is dynamic and writable.
+
+ @see HALData::EPenClickVolumeMax
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EPenClickVolume,
+
+
+ /**
+ The maximum value for EPenClickVolume.
+
+ @see HALData::EPenClickVolume
+ */
+ EPenClickVolumeMax,
+
+
+ /**
+ Indicates whether a mouse is available for input.
+
+ It has the values:
+ 0 = there is no mouse available pen/digitizer is present;
+ 1 = a mouse is available for input.
+ */
+ EMouse,
+
+
+ /**
+ The mouse horizontal resolution, in pixels.
+ */
+ EMouseX,
+
+
+ /**
+ The mouse vertical resolution, in pixels.
+ */
+ EMouseY,
+
+
+ /**
+ Describes the mouse cursor visibility.
+
+ The value is enumerated by TMouseState.
+
+ This is dynamic and writable.
+ @see HALData::TMouseState
+
+ @capability MultimediaDD needed to Set this attribute
+ */
+ EMouseState,
+
+
+ /**
+ Reserved for future use.
+ @capability MultimediaDD needed to Set this attribute
+ */
+ EMouseSpeed,
+
+
+ /**
+ Reserved for future use.
+ @capability MultimediaDD needed to Set this attribute
+ */
+ EMouseAcceleration,
+
+
+ /**
+ The number of buttons on the mouse.
+ */
+ EMouseButtons,
+
+
+ /**
+ A bitmask defining the state of each button.
+
+ For each bit, it has values:
+ 0 = up;
+ 1 = down.
+
+ This is dynamic and read only.
+ */
+ EMouseButtonState,
+
+
+ /**
+ Defines the state of the case.
+
+ It has the values:
+ 0 = case closed;
+ 1 = case opened.
+
+ This is dynamic and read only.
+ */
+ ECaseState,
+
+
+ /**
+ Indicates whether the device has a case switch, that actions when
+ the case opens and closes.
+
+ It has values:
+ 0 = no;
+ 1 = yes.
+ */
+ ECaseSwitch,
+
+
+ /**
+ Indicates whether the device is to switch on when case opens.
+
+ It has the values:
+ 0 = disable device switchon when the case opens;
+ 1 = enable device switchon when the case opens.
+
+ This is dynamic and writeable.
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ ECaseSwitchDisplayOn,
+
+
+ /**
+ Indicates whether the device is to switch off when case close.
+
+ It has the values:
+ 0 = disable device switchoff when the case closes;
+ 1 = enable device switchoff when the case closes.
+
+ This is dynamic and writeable.
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ ECaseSwitchDisplayOff,
+
+
+ /**
+ The number of LEDs on the device.
+ */
+ ELEDs,
+
+
+ /**
+ A bitmask defining the state of each LED.
+
+ For each bit, it has values:
+ 0 = off;
+ 1 = on.
+
+ This is dynamic and writeable.
+ */
+ ELEDmask,
+
+
+ /**
+ Indicates how the phone hardware is connected.
+
+ It has the values:
+ 0 = phone hardware is not permanently connected;
+ 1 = phone hardware is permanently connected.
+ */
+ EIntegratedPhone,
+
+
+ /**
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EDisplayBrightness,
+
+
+ /**
+ */
+ EDisplayBrightnessMax,
+
+
+ /**
+ Indicates the state of the keyboard backlight.
+
+ It has the values:
+ 0 = keyboard backlight is off;
+ 1 = keyboard backlight is on.
+
+ This is dynamic and writeable.
+
+ @capability PowerMgmt needed to Set this attribute
+ */
+ EKeyboardBacklightState,
+
+
+ /**
+ Power supply to an accessory port.
+
+ It has the values:
+ 0 = turn off power to an accessory port on the device;
+ 1 = turn on power.
+
+ This is dynamic and writeable.
+
+ @capability PowerMgmt needed to Set this attribute
+ */
+ EAccessoryPower,
+
+
+ /**
+ A 2 decimal digit language index.
+
+ It is used as the two digit language number that is the suffix of
+ language resource DLLs, e.g ELOCL.01.
+
+ The locale with this language index is loaded the next time that
+ the device boots.
+
+ This is dynamic and writeable.
+
+ @see TLanguage
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ ELanguageIndex,
+
+
+ /**
+ A 2 decimal digit (decimal) language keyboard index.
+ It is used as the two digit language number that is the suffix of
+ language resource DLLs, e.g. EKDATA.01.
+
+ @see TLanguage
+
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EKeyboardIndex,
+
+
+ /**
+ The maximum allowable size of RAM drive, in bytes.
+ */
+ EMaxRAMDriveSize,
+
+
+ /**
+ Indicates the state of the keyboard.
+
+ It has the values:
+ 0 = keyboard is disabled;
+ 1 = Keyboard is enabled.
+
+ This is dynamic and writeable.
+
+ @capability PowerMgmt needed to Set this attribute
+ */
+ EKeyboardState,
+
+ /**
+ Defines the system drive & custom resource drive.
+ Legacy attribute which is no longer supported.
+
+ @deprecated Attribute is no longer the primary mechanism to define the
+ System Drive or the Custom Resource Drive.
+ @see RFs::GetSystemDrive.
+ @see BaflUtils::NearestLanguageFile
+ @see HALData::ECustomResourceDrive
+ */
+ ESystemDrive,
+
+ /**
+ Indicates the state of the pen or digitiser.
+
+ It has the values:
+ 1 = pen/digitiser is enabled;
+ 0 = pen/digitiser is disabled.
+
+ This is dynamic and writeable.
+
+ @capability PowerMgmt needed to Set this attribute
+ */
+ EPenState,
+
+
+ /**
+ On input: aInOut contains the mode number.
+ On output: aInOut contains: 0 = display is colour;
+ 1 = display is black & white.
+
+ aInOut is the 3rd parameter passed to accessor functions
+ for derived attributes.
+ */
+ EDisplayIsMono,
+
+
+ /**
+ On input: aInOut contains the mode number;
+ On output, aInOut contains: 0 = display is not palettised;
+ 1 = display is palettised.
+
+ aInOut is the 3rd parameter passed to accessor functions
+ for derived attributes.
+ */
+ EDisplayIsPalettized,
+
+
+ /**
+ The display bits per pixel.
+
+ On input, aInOut contains the mode number.
+ On output, aInOut contains the bits per pixel for that mode.
+
+ aInOut is the 3rd parameter passed to accessor functions
+ for derived attributes.
+
+ It is read only data.
+ */
+ EDisplayBitsPerPixel,
+
+
+ /**
+ The number of display modes available.
+ */
+ EDisplayNumModes,
+
+
+ /**
+ The address of the display memory.
+ */
+ EDisplayMemoryAddress,
+
+
+ /**
+ The offset, in bytes, to the pixel area of the screen from the start of screen memory.
+
+ This is used to account for the fact that the palette is sometimes at
+ the beginning of the display memory.
+
+ On input, aInOut contains the mode number.
+ On output, aInOut contains the offset to the first pixel for that mode.
+
+ aInOut is the 3rd parameter passed to accessor functions
+ for derived attributes.
+ */
+ EDisplayOffsetToFirstPixel,
+
+
+ /**
+ The separation, in bytes, of successive lines of display in memory.
+
+ On input, aInOut contains the mode number.
+ On output, aInOut contains the display offset between lines.
+
+ aInOut is the 3rd parameter passed to accessor functions
+ for derived attributes.
+ */
+ EDisplayOffsetBetweenLines,
+
+
+ /**
+ @capability MultimediaDD needed to Set this attribute
+ */
+ EDisplayPaletteEntry,
+
+
+ /**
+ It has the values:
+ 1 = order of pixels in display is RGB;
+ 0 = otherwise.
+ */
+ EDisplayIsPixelOrderRGB,
+
+
+ /**
+ It has the values:
+ 1 = pixel order is landscape;
+ 0 = pixel order is portrait.
+ */
+ EDisplayIsPixelOrderLandscape,
+
+
+ /**
+ This indicates or sets the current display mode where
+ EDisplayNumModes-1 is the maximum value for the display mode.
+ The properties of a particular display mode are entirely defined by
+ the base port software associated with the hardware upon which the OS
+ is running.
+
+ @capability MultimediaDD needed to Set this attribute
+ */
+ EDisplayMode,
+
+
+ /**
+ If the target hardware upon which Symbian OS is running has switches
+ which can be read by the base port software, this interface allows
+ the current status of those switches to be read.
+ */
+ ESwitches,
+
+
+ /**
+ The port number of the debug port.
+ */
+ EDebugPort,
+
+
+ /**
+ The language code of the Locale which was loaded at device boot time.
+
+ This is dynamic and writeable.
+
+ @see ELanguageIndex
+
+ @capability WriteSystemData needed to Set this attribute
+ */
+ ELocaleLoaded,
+
+
+ /**
+ The drive number to use for storage of Clipboard data.
+ 0 = Drive A, 1 = Drive B, etc...
+ */
+ EClipboardDrive,
+
+ /**
+ Custom restart
+ @capability PowerMgmt
+ */
+ ECustomRestart,
+
+ /**
+ Custom restart reason
+ */
+ ECustomRestartReason,
+
+ /**
+ The number of screens.
+ */
+ EDisplayNumberOfScreens,
+
+ /**
+ The time between nanokernel ticks, in microseconds.
+ */
+ ENanoTickPeriod,
+
+ /**
+ The frequency of the fast counter.
+ */
+ EFastCounterFrequency,
+
+ /**
+ Indicates the whether the fast counter counts up or down.
+ */
+ EFastCounterCountsUp,
+
+ /**
+ Indicates whether a 3 dimensional pointing device is available for input and Z coordinate
+ is provided in appropriate pointer-related TRawEvents generated by the driver.
+
+ It has the values:
+ 0 = a 3D pointer is not available for input and Z coordinate is not provided in TRawEvents;
+ 1 = a 3D pointer is present and Z coordinate is provided in TRawEvents.
+ */
+ EPointer3D,
+
+ /**
+ The furthest detectable 3D pointing device's proximity above the screen.
+ As proximity values above the screen are negative, this will be a negative value.
+
+ This is dynamic and writeable.
+ */
+ EPointer3DMaxProximity,
+
+ /**
+ Indicates whether a 3 dimensional pointing device supports Theta polar angle reading.
+
+ It has the values:
+ 0 = a 3D pointer does not support Theta polar angle reading;
+ 1 = a 3D pointer supports Theta polar angle reading.
+ */
+ EPointer3DThetaSupported,
+
+ /**
+ Indicates whether a 3 dimensional pointing device supports Phi polar angle reading.
+
+ It has the values:
+ 0 = a 3D pointer does not support Phi polar angle reading;
+ 1 = a 3D pointer supports Phi polar angle reading.
+ */
+ EPointer3DPhiSupported,
+
+ /**
+ Indicates whether a 3 dimensional pointing device supports rotation angle along its main axis reading.
+
+ It has the values:
+ 0 = a 3D pointer does not support alpha (rotation) reading;
+ 1 = a 3D pointer supports alpha (rotation) reading.
+ */
+ EPointer3DRotationSupported,
+
+ /**
+ Indicates whether a 3 dimensional pointing device supports readings of pressure applied on screen.
+
+ It has the values:
+ 0 = a 3D pointer does not support pressure reading;
+ 1 = a 3D pointer supports pressure reading.
+ */
+ EPointer3DPressureSupported,
+
+ /**
+ Indicates whether hardware floating point is available, and what type.
+
+ If no hardware floating point is available, reading this attribute will return KErrNotSupported.
+ If hardware floating point is available, reading this attribute will return KErrNone and the type
+ available. These types are specified in TFloatingPointType.
+ */
+ EHardwareFloatingPoint,
+
+ /**
+ The offset between secure and nonsecure clocks. If this attribute is undefined no secure clock
+ will be available.
+ */
+ ETimeNonSecureOffset,
+
+ /**
+ Persist startup mode.
+
+ If no variant specific implementation exists, the startup mode will be stored in platform
+ specific values.hda file.
+ */
+ EPersistStartupModeKernel,
+
+ /**
+ Maximum restart reasons.
+
+ Returns the maximum number of values that can be used to store the restart reason required for a custom restart.
+ */
+ EMaximumCustomRestartReasons,
+
+ /**
+ Maximum startup modes.
+
+ Returns the maximum number of values that can be used to store the startup mode requires for a system restart.
+ */
+ EMaximumRestartStartupModes,
+
+ /**
+ Defines the custom resource drive.
+
+ This drive attribute should be set if an additional drive is required for use in the search
+ algorithm for language files.
+
+ @see TDriveNumber
+ @see BaflUtils::NearestLanguageFile for how this attribute is used
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ ECustomResourceDrive,
+
+ /**
+ Step size of Z distance data.
+
+ Returns the minimum size of the step between two resolvable z positions
+ */
+ EPointer3DProximityStep,
+
+ /**
+ Maximum Number of Pointers supported by hardware/driver
+
+ Returns the maximum number of pointers for a multi-touch configuration (or KErrNotSupported or 0 or 1 for single-touch legacy configuration)
+ */
+ EPointerMaxPointers,
+
+ /**
+ Maximum Number of Pointers
+
+ Sets and reads back the number of pointers as requested by the UI (<=EPointerMaxPointers)
+ */
+ EPointerNumberOfPointers,
+
+ /**
+ Maximum Pressure Value
+
+ Returns the maximum pressure value
+ */
+ EPointer3DMaxPressure,
+
+ /**
+ Step size of pressure data.
+
+ Returns the minimum size of the step between two resolvable pressure readings
+ */
+ EPointer3DPressureStep,
+
+ /**
+ The threshold on pointer's Z coordinate above which EEnterHighPressure pointer event is sent to WSERV's clients.
+ This value is intended to be preconfigured in build time and modified by Window Server only
+
+ @prototype 9.5
+ */
+ EPointer3DEnterHighPressureThreshold,
+
+ /**
+ The threshold on pointer's Z coordinate below which EExitHighPressure pointer event is sent to WSERV's clients.
+ This value is intended to be preconfigured in build time and modified by Window Server only
+
+ @prototype 9.5
+ */
+ EPointer3DExitHighPressureThreshold,
+
+ /**
+ The threshold on pointer's Z coordinate above which EEnterCloseProximity pointer event is sent to WSERV's clients.
+ This value is intended to be preconfigured in build time and modified by Window Server only
+
+ @prototype 9.5
+ */
+ EPointer3DEnterCloseProximityThreshold,
+
+
+ /**
+ The threshold on pointer's Z coordinate below which EExitCloseProximity pointer event is sent to WSERV's clients.
+ This value is intended to be preconfigured in build time and modified by Window Server only
+
+ @prototype 9.5
+ */
+ EPointer3DExitCloseProximityThreshold,
+
+ /**
+ A Handle to the display memory.
+ This attribute opens a chunk, the client is responsible for closing it.
+ Using HAL attribtues to open handles is not recommended and this
+ attribute may be removed in the future.
+
+ @prototype 9.5
+ */
+ EDisplayMemoryHandle,
+
+ /**
+ Serial number of this board
+ */
+ ESerialNumber,
+
+
+ /**
+ Interrupt used by sampling profiler - applicable for SMP only. Each CPU_i is interrupted by interrupt number ECpuProfilingInterrupt + i
+ */
+ ECpuProfilingDefaultInterruptBase,
+
+
+ /**
+ Number of processors present on the device. Returns 1 on unicore. This number is constant and does not take account of power management
+ */
+ ENumCpus,
+
+ /**
+ The orientation of the Digitiser. Usually mirrors device orientation.
+
+ @see TDigitiserOrientation for allowed values
+ @capability WriteDeviceData needed to Set this attribute
+ */
+ EDigitiserOrientation,
+
+ /*
+ * NOTE:
+ * When updating this list, please also update hal/rom/hal.hby and hal/tsrc/t_newhal.cpp.
+ */
+
+ /**
+
+ The number of HAL attributes per screen.
+
+ It is simply defined by its position in the enumeration.
+ */
+ ENumHalAttributes
+
+ };
+
+
+
+ /**
+ Defines properties for the hardware attributes.
+
+ @see HALData::TAttribute
+ */
+ enum TAttributeProperty
+ {
+ /**
+ When set, means that an attribute is meaningful on this device.
+
+ @see HAL::Get()
+ @see HAL::Set()
+ */
+ EValid=0x1,
+
+
+ /**
+ When set, means that an attribute is modifiable.
+ A call to HAL::Set() for an attribute that does not have this property,
+ returns KErrNotSupported.
+
+ @see HAL::Get()
+ @see HAL::Set()
+ */
+ ESettable=0x2,
+ };
+
+
+
+ /**
+ UIDs for a defined set of device manufacturers.
+
+ Note that any manufacturer not represented in this list must obtain
+ a value from the Symbian registry.
+
+ @see HALData::TAttribute
+ */
+ enum TManufacturer // UID for manufacturer
+ {
+ EManufacturer_Ericsson=0x00000000,
+ EManufacturer_Motorola=0x00000001,
+ EManufacturer_Nokia=0x00000002,
+ EManufacturer_Panasonic=0x00000003,
+ EManufacturer_Psion=0x00000004,
+ EManufacturer_Intel=0x00000005,
+ EManufacturer_Cogent=0x00000006,
+ EManufacturer_Cirrus=0x00000007,
+ EManufacturer_Linkup=0x00000008,
+ EManufacturer_TexasInstruments=0x00000009,
+ // New manufacturers must obtain an official UID to identify themselves
+ };
+
+
+
+ /**
+ Defines the Symbian OS device families.
+
+ @see HALData::TAttribute
+ */
+ enum TDeviceFamily
+ {
+ EDeviceFamily_Crystal,
+ EDeviceFamily_Pearl,
+ EDeviceFamily_Quartz,
+ };
+
+
+
+ /**
+ Defines the set of CPU architectures.
+
+ @see HALData::TAttribute
+ */
+ enum TCPU
+ {
+ ECPU_ARM,
+ ECPU_MCORE,
+ ECPU_X86,
+ };
+
+
+
+ /**
+ Defines the set of ABIs used by the CPU for user applications.
+
+ @see HALData::TAttribute
+ */
+ enum TCPUABI
+ {
+ ECPUABI_ARM4,
+ ECPUABI_ARMI,
+ ECPUABI_THUMB,
+ ECPUABI_MCORE,
+ ECPUABI_MSVC,
+ ECPUABI_ARM5T,
+ ECPUABI_X86,
+ };
+
+
+
+ /**
+ Defines the set of reasons for a system boot.
+
+ @see HALData::TAttribute
+ */
+ enum TSystemStartupReason
+ {
+ ESystemStartupReason_Cold,
+ ESystemStartupReason_Warm,
+ ESystemStartupReason_Fault,
+ };
+
+
+
+ /**
+ Defines the set of available keyboard types.
+
+ @see HALData::TAttribute
+ */
+ bitmask TKeyboard
+ {
+ EKeyboard_Keypad=0x1,
+ EKeyboard_Full=0x2,
+ };
+
+
+
+ /**
+ Defines the mouse cursor visibility.
+
+ @see HALData::TAttribute
+ */
+ enum TMouseState
+ {
+ EMouseState_Invisible=0,
+ EMouseState_Visible=1,
+ };
+
+
+
+ /**
+ Defines a set of UIDs for specific devices, reference boards etc
+
+ @see HALData::TAttribute
+ */
+ enum TMachineUid
+ {
+ EMachineUid_Series5mx=0x1000118a,
+ EMachineUid_Brutus=0x10005f60,
+ EMachineUid_Cogent=0x10005f61,
+ EMachineUid_Win32Emulator=0x10005f62,
+ EMachineUid_WinC=0x10005f63,
+ EMachineUid_CL7211_Eval=0x1000604f,
+ EMachineUid_LinkUp=0x00000000,
+ EMachineUid_Assabet=0x100093f3,
+ EMachineUid_Zylonite=0x101f7f27,
+ EMachineUid_IQ80310=0x1000a681,
+ EMachineUid_Lubbock=0x101f7f26,
+ EMachineUid_Integrator=0x1000AAEA,
+ EMachineUid_Helen=0x101F3EE3,
+ EMachineUid_X86PC=0x100000ad,
+ EMachineUid_OmapH2=0x1020601C,
+ EMachineUid_OmapH4=0x102734E3,
+ EMachineUid_NE1_TB=0x102864F7,
+ EMachineUid_EmuBoard=0x1200afed,
+ EMachineUid_OmapH6=0x10286564,
+ EMachineUid_OmapZoom=0x10286565,
+ EMachineUid_STE8500=0x101FF810,
+ };
+
+
+
+ /**
+ Defines power levels for the system (or 'Main') battery.
+
+ @see HALData::TAttribute
+ */
+ enum TPowerBatteryStatus
+ {
+ EPowerBatteryStatus_Zero,
+ EPowerBatteryStatus_Replace,
+ EPowerBatteryStatus_Low,
+ EPowerBatteryStatus_Good,
+ };
+
+
+
+ /**
+ Defines power levels for the backup power.
+
+ @see HALData::TAttribute
+ */
+ enum TPowerBackupStatus
+ {
+ EPowerBackupStatus_Zero,
+ EPowerBackupStatus_Replace,
+ EPowerBackupStatus_Low,
+ EPowerBackupStatus_Good,
+ };
+
+
+ /**
+ Describes the orientation of the screen digitiser, usually mirrors the
+ device orientation not necessarily the display rotation as this might be
+ limited to upright and left 90 only. The values in degrees measures
+ the anti-clockwise angle from the left edge of the digitiser from the
+ normal default position of the device.
+
+ User-side clients can use attribute to inform the digitiser driver of the
+ digitiser orientation. The driver may then use this information to adjust
+ X.Y sampling depending on input pointer type.
+
+ @see HALData::TAttribute
+ */
+ enum TDigitiserOrientation
+ {
+ EDigitiserOrientation_default, ///< Driver using build-in default
+ EDigitiserOrientation_000, ///< Device normal 'make-call' position
+ EDigitiserOrientation_090, ///< Device rotated left 90 degrees
+ EDigitiserOrientation_180, ///< Device rotated 180 degrees
+ EDigitiserOrientation_270 ///< Device rotated right 90 degrees
+ };
+
+ };
+
+#endif
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Fake ROomMonitorSession class implementation
+*
+*/
+
+#include "oommonitorsession.h"
+
+TInt ROomMonitorSession::Connect()
+{
+ return KErrNone;
+}
+
+TInt ROomMonitorSession::RequestFreeMemory(TInt aBytesRequested)
+{
+ return KErrNone;
+}
+
+void ROomMonitorSession::RequestFreeMemory(TInt /*aBytesRequested*/, TRequestStatus& /*aStatus*/)
+{
+ // do nothing
+}
+
+TInt ROomMonitorSession::RequestOptionalRam(TInt /*aBytesRequested*/, TInt /*aMinimumBytesNeeded*/, TInt /*aPluginId*/, TInt& /*aBytesAvailable*/)
+{
+ return KErrNone;
+}
+
+void ROomMonitorSession::RequestOptionalRam(TInt /*aBytesRequested*/, TInt /*aMinimumBytesNeeded*/, TInt aPluginId, TRequestStatus& /*aStatus*/)
+{
+ // do nothing
+}
+
+void ROomMonitorSession::CancelRequestFreeMemory()
+{
+ // do nothing
+}
+
+void ROomMonitorSession::ThisAppIsNotExiting(TInt /*aWgId*/)
+{
+ // do nothing
+}
+
+void ROomMonitorSession::SetOomPriority(TOomPriority /*aPriority*/)
+{
+ // do nothing
+}
+
+void ROomMonitorSession::Close()
+{
+ // do nothing
+}
+
+//End of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Fake class for testing
+*
+*/
+
+#ifndef OOMMONITORSESSION_H
+#define OOMMONITORSESSION_H
+
+#include
+
+const TInt KOomMaxAllocationWithoutPermission = 1048576;
+const TUid KOomMemoryMonitorStatusPropertyCategory = {0x10207218};
+const TUint32 KOomMemoryMonitorStatusPropertyKey = 0;
+enum TMemoryMonitorStatusPropertyValues
+ {
+ // Above Treshhold: Free Ram is above good treshhold point and memory monitor isn't freeing any memory
+ EAboveTreshHold,
+
+ // Freeing Memory: Memory monitor is in the middle of freeing memory
+ EFreeingMemory,
+
+ // Below Treshhold: Memory monitor has tried to free some RAM but total memory is still below treshhold and memory monitor has given up freeing more memory.
+ EBelowTreshHold
+ };
+class ROomMonitorSession
+ {
+public:
+
+ /** Defines the application priorities of OOM monitor. */
+ enum TOomPriority
+ {
+ /**
+ * Application can be closed if needed.
+ */
+ EOomPriorityNormal = 0,
+
+ /**
+ * Application should not be closed if possible.
+ */
+ EOomPriorityHigh,
+
+ /**
+ * Application is busy and should not be closed.
+ */
+ EOomPriorityBusy
+ };
+
+public:
+ /**
+ * Connects a new session.
+ * Sessions must be connected before any other APIs can be used.
+ * When the client has finished using a session, Close() must be called.
+ * @return KErrNone if successful, error code otherwise.
+ */
+ TInt Connect();
+
+ /**
+ * Request that the OOM monitor attempts to free some paged memory.
+ * This function may take several seconds to execute, depending on
+ * the memory state. It will not return until the attempt to recover
+ * memory has completed.
+ * @param aBytesRequested The number of bytes of free memory that the client requests.
+ * @return KErrNone if the request memory is free. KErrNoMemory if that
+ * amount of memory could not be recovered. Other error codes may
+ * also be returned.
+ */
+ TInt RequestFreeMemory(TInt aBytesRequested);
+
+ /**
+ * Request that the OOM monitor attempts to free some paged memory.
+ * This is an asynchronous version of the request for free paged memory.
+ * @param aBytesRequested The number of bytes of free memory that the client requests.
+ * @param aStatus will be completed when the attempt to recover memory
+ * has finished. This may take several seconds, depending on
+ * the memory state. On completion, aStatus will be set to
+ * KErrNone if the request memory is free. KErrNoMemory if that
+ * amount of memory could not be recovered. Other error codes may
+ * also be set.
+ */
+ void RequestFreeMemory(TInt aBytesRequested, TRequestStatus& aStatus);
+
+ /**
+ * Request that the OOM monitor attempts to free some memory for an optional allocation.
+ * The passed in plugin ID is used to determine the priority for this allocation.
+ * Lower priority OOM actions may be executed to free enough RAM for this allocation.
+ * This function may take several seconds to execute, depending on
+ * the memory state. It will not return until the attempt to recover
+ * memory has completed.
+ * @param aBytesRequested The number of bytes of free memory that the client requests.
+ * @param aPluginId The ID of the plugin that may delete the allocation in event of low memory.
+ * @return KErrNone if the request memory is free. KErrNoMemory if that
+ * amount of memory could not be recovered. Other error codes may
+ * also be returned.
+ */
+ TInt RequestOptionalRam(TInt aBytesRequested, TInt aMinimumBytesNeeded, TInt aPluginId, TInt& aBytesAvailable);
+
+ /**
+ * Request that the OOM monitor attempts to free some memory for an optional allocation.
+ * The passed in plugin ID is used to determine the priority for this allocation.
+ * Lower priority OOM actions may be executed to free enough RAM for this allocation.
+ * This function may take several seconds to execute, depending on
+ * the memory state. It will not return until the attempt to recover
+ * memory has completed.
+ * @param aBytesRequested The number of bytes of free memory that the client requests.
+ * @param aPluginId The ID of the plugin that may delete the allocation in event of low memory.
+ * @param aStatus The TRequestStatus (completes with the number of bytes freed (aStatus >= 0) or an error (aStatus <= 0))
+ * @return None
+ */
+ void RequestOptionalRam(TInt aBytesRequested, TInt aMinimumBytesNeeded, TInt aPluginId, TRequestStatus& aStatus);
+
+ /**
+ * Cancels the asynchronous request for free memory.
+ */
+ void CancelRequestFreeMemory();
+
+ /**
+ * Notify the OOM monitor that this application is not responding
+ * to the EEikCmdExit request to exit the application.
+ * This function is used by the Avkon framework's app shutter.
+ * @param aWgId the window group identifier of the app that is not exiting.
+ */
+ void ThisAppIsNotExiting(TInt aWgId);
+
+ /**
+ * Notify the OOM monitor that this application has the specified priority
+ * @param aPriority the priority of the application
+ */
+ void SetOomPriority(TOomPriority aPriority);
+
+ void Close();
+
+ };
+
+#endif // OOMMONITORSESSION_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#include
+#include
+#include
+#include
+
+#include "cxetestutils.h"
+#include "cxefakefeaturemanager.h"
+#include "cxememorymonitor.h"
+#include "unittest_cxememorymonitor.h"
+
+UnitTestCxeMemoryMonitor::UnitTestCxeMemoryMonitor()
+ : mMemoryMonitor(NULL),
+ mFakeFeatureManager(NULL)
+{
+}
+
+UnitTestCxeMemoryMonitor::~UnitTestCxeMemoryMonitor()
+{
+ cleanup();
+}
+
+// Run before each individual test case
+void UnitTestCxeMemoryMonitor::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mFakeFeatureManager = new CxeFakeFeatureManager();
+ mMemoryMonitor = new CxeMemoryMonitor(*mFakeFeatureManager);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// Run after each individual test case
+void UnitTestCxeMemoryMonitor::cleanup()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ delete mMemoryMonitor;
+ mMemoryMonitor = NULL;
+
+ delete mFakeFeatureManager;
+ mFakeFeatureManager = NULL;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeMemoryMonitor::testFree()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVERIFY(mMemoryMonitor->free() > 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeMemoryMonitor::testStartMonitoring()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mMemoryMonitor->startMonitoring();
+ QVERIFY(mMemoryMonitor->free() > 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeMemoryMonitor::testStopMonitoring()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mMemoryMonitor->stopMonitoring();
+ QVERIFY(mMemoryMonitor->free() > 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeMemoryMonitor::testStartStopMonitoring()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mMemoryMonitor->startMonitoring();
+ mMemoryMonitor->stopMonitoring();
+ QVERIFY(mMemoryMonitor->free() > 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// main() function - Need event loop for waiting signals,
+// so can't use QTEST_APPLESS_MAIN.
+QTEST_MAIN(UnitTestCxeMemoryMonitor);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef UNITTEST_CXEMEMORYMONITOR_H
+#define UNITTEST_CXEMEMORYMONITOR_H
+
+#include
+
+#include "cxenamespace.h"
+
+class CxeMemoryMonitor;
+class CxeFakeFeatureManager;
+
+class UnitTestCxeMemoryMonitor : public QObject
+{
+ Q_OBJECT
+
+public:
+ UnitTestCxeMemoryMonitor();
+ ~UnitTestCxeMemoryMonitor();
+
+private slots:
+ void init();
+ void cleanup();
+
+ void testFree();
+ void testStartMonitoring();
+ void testStopMonitoring();
+ void testStartStopMonitoring();
+
+private:
+ CxeFakeFeatureManager *mFakeFeatureManager;
+ CxeMemoryMonitor *mMemoryMonitor;
+};
+
+#endif // UNITTEST_CXEMEMORYMONITOR_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.pro Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,32 @@
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+include(../unittest.pri)
+TARGET = unittest_cxememorymonitor
+
+DEPENDPATH = . ../../fakeclasses ../../../src/dummyengine ../utils
+INCLUDEPATH = . ../../fakeclasses ../../../src/dummyengine ../utils ../../../traces
+
+DEFINES *= CXE_USE_DUMMY_CAMERA
+
+SOURCES *= unittest_cxememorymonitor.cpp \
+ cxefakefeaturemanager.cpp \
+ ../../../src/cxememorymonitor.cpp \
+ ../../../src/cxememorymonitorprivate.cpp \
+ ./oommonitorsession.cpp \
+ ./hal.cpp
+
+HEADERS *= unittest_cxememorymonitor.h \
+ cxefakefeaturemanager.h \
+ ../../../inc/api/cxememorymonitor.h \
+ ../../../inc/cxememorymonitorprivate.h \
+ ./oommonitorsession.h \
+ ./hal.h \
+ ./hal_data.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -95,6 +95,40 @@
CX_DEBUG_EXIT_FUNCTION();
}
+
+void UnitTestCxeQualityPresetsSymbian::testRecordingTimeAvailable()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ int time(0);
+
+ CxeVideoDetails details;
+ details.mAudioBitRate = 100;
+ details.mVideoBitRate = 100;
+
+ // Check zero time when disk full.
+ time = mQualityPresets->recordingTimeAvailable(details, qint64(0));
+ QVERIFY(time == 0);
+
+ // Common time limit is 90 minutes
+ time = mQualityPresets->recordingTimeAvailable(details, qint64(1000*1000*1000));
+ QVERIFY(time == 5400);
+
+ // Normal case, no quality specific limit
+ time = mQualityPresets->recordingTimeAvailable(details, qint64(1000*1000));
+ QVERIFY(time > 0);
+ QVERIFY(time < 5400);
+
+ // Normal case, quality specifies limit
+ details.mMaximumSizeInBytes = 10*1000;
+ time = mQualityPresets->recordingTimeAvailable(details, qint64(1000*1000));
+ QVERIFY(time > 0);
+ QVERIFY(time < 5400);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
// main() function non-GUI testing
QTEST_MAIN(UnitTestCxeQualityPresetsSymbian);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -39,6 +39,7 @@
void testImageQualityPresets();
void testVideoQualityPresets();
+ void testRecordingTimeAvailable();
private:
//data members
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.pro Thu Jul 15 01:55:05 2010 +0300
@@ -10,18 +10,25 @@
# Description:
+CONFIG *= cxeunit_no_system_paths
+
include(../unittest.pri)
TARGET = unittest_cxesettingscenrepstore
-LIBS *= -lxqsettingsmanager
+INCLUDEPATH *= ../system_include
+DEPENDPATH *= ../system_include
SOURCES *= unittest_cxesettingscenrepstore.cpp \
- cxesettingscenrepstore.cpp
+ cxesettingscenrepstore.cpp \
+ xqsettingsmanager.cpp \
+ xqsettingskey.cpp
HEADERS *= unittest_cxesettingscenrepstore.h \
cxutils.h \
cxeerror.h \
+ xqsettingskey.h \
+ xqsettingsmanager.h \
cxenamespace.h \
cxecenrepkeys.h \
cxesettingscenrepstore.h \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingskey.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingskey.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/*!
+* XQSettingsKey class fake implementation
+*/
+
+#include
+#include
+#include
+#include
+
+#include "cxutils.h"
+#include "xqsettingskey.h"
+#include "cxenamespace.h"
+
+
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+long int XQSettingsKey::uid() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return mUid;
+}
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+unsigned long int XQSettingsKey::key() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return mKey;
+}
+
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+XQSettingsKey::Target XQSettingsKey::target() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return mTarget;
+}
+
+
+
+/*!
+* XQSettingsKey::XQSettingsKey
+*/
+XQSettingsKey::XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key)
+:mTarget(target),
+ mUid(uid),
+ mKey(key)
+{
+}
+
+
+
+/*!
+* XQSettingsKey::close
+*/
+XQSettingsKey::~XQSettingsKey()
+{
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingskey.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingskey.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef XQSETTINGSKEY_H
+#define XQSETTINGSKEY_H
+
+// INCLUDES
+
+
+// CLASS DECLARATION
+class XQSettingsKey
+{
+public:
+ enum Target
+ {
+ TargetCentralRepository = 0,
+ TargetPublishAndSubscribe
+ };
+
+ XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key);
+ ~XQSettingsKey();
+
+ XQSettingsKey::Target target() const;
+ long int uid() const;
+ unsigned long int key() const;
+
+protected:
+ XQSettingsKey::Target mTarget;
+ long int mUid;
+ unsigned long int mKey;
+};
+
+#endif //XQSETTINGSKEY_H
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingsmanager.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingsmanager.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/*!
+* XQSettingsManager class fake implementation
+*/
+
+#include
+#include
+#include
+#include
+
+#include "xqsettingsmanager.h"
+#include "xqsettingskey.h"
+#include "cxenamespace.h"
+#include "cxutils.h"
+
+
+
+
+/*!
+* write value to cenrep key
+*/
+bool XQSettingsManager::writeItemValue(const XQSettingsKey& key, const QVariant& value)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mError = XQSettingsManager::NoError;
+ mStore[key.key()] = value;
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return true;
+}
+
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+QVariant XQSettingsManager::readItemValue(const XQSettingsKey& settkey, XQSettingsManager::Type /*type*/)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mError = XQSettingsManager::NoError;
+ if(mStore.contains(settkey.key())) {
+ return mStore[settkey.key()];
+ }
+ return QVariant(1);
+}
+
+
+XQSettingsManager::Error XQSettingsManager::error() const
+{
+ return mError;
+}
+
+
+/*!
+* XQSettingsManager::XQSettingsManager
+*/
+XQSettingsManager::XQSettingsManager(QObject* /*parent*/)
+{
+}
+
+
+
+/*!
+* XQSettingsManager::close
+*/
+XQSettingsManager::~XQSettingsManager()
+{
+}
+
+
+/*! Instead of monitoring value changes for a P&S key
+* this fake class implementation emits valueChanged signal for the given key
+*/
+bool XQSettingsManager::startMonitoring(const XQSettingsKey& key, XQSettingsManager::Type type)
+{
+ emit valueChanged(key, type);
+ return true;
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingsmanager.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingsmanager.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef XQSETTINGSMANAGER_H
+#define XQSETTINGSMANAGER_H
+
+// INCLUDES
+#include
+#include
+#include "xqsettingskey.h"
+
+
+
+
+// CLASS DECLARATION
+class XQSettingsManager : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ enum Type
+ {
+ TypeVariant = 0,
+ TypeInt,
+ TypeDouble,
+ TypeString,
+ TypeByteArray
+ };
+
+ enum Error
+ {
+ NoError = 0,
+ OutOfMemoryError,
+ NotFoundError,
+ AlreadyExistsError,
+ PermissionDeniedError,
+ BadTypeError,
+ NotSupportedError,
+ UnknownError = -1
+ };
+
+ XQSettingsManager(QObject* parent = 0);
+ ~XQSettingsManager();
+
+ QVariant readItemValue(const XQSettingsKey& key, XQSettingsManager::Type type = XQSettingsManager::TypeVariant);
+ bool writeItemValue(const XQSettingsKey& key, const QVariant& value);
+ XQSettingsManager::Error error() const;
+ bool startMonitoring(const XQSettingsKey& key, XQSettingsManager::Type type = XQSettingsManager::TypeVariant);
+
+
+signals:
+ void valueChanged(const XQSettingsKey& key, const QVariant& value);
+
+private:
+ XQSettingsManager::Error mError;
+ QHash mStore;
+
+};
+
+#endif // XQSETTINGSMANAGER_H
+
+// End of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscontrolsymbian/unittest_cxesettingscontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscontrolsymbian/unittest_cxesettingscontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscontrolsymbian/unittest_cxesettingscontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -96,7 +96,7 @@
CxeScene videoScene;
- videoScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_AUTO);
+ videoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
videoScene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
videoScene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
videoScene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -109,7 +109,7 @@
CxeScene imageScene;
- imageScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHT);
+ imageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
imageScene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto);
imageScene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imageScene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -41,7 +41,6 @@
void UnitTestCxeSettingsImp::init()
{
mSettingsModel = new CxeFakeSettingsModel;
- mSettingsModel->initDefaultCameraSettings();
mSettingsImp = new CxeSettingsImp(*mSettingsModel);
}
@@ -164,43 +163,8 @@
err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE, stringValue);
QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_AUTO, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_AUTO, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_MACRO, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_MACRO, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_NIGHT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_PORTRAIT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_PORTRAIT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_SCENERY, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SCENERY, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_SPORTS, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SPORTS, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ CxeScene scene = mSettingsModel->currentImageScene();
+ QCOMPARE(stringValue, scene[CxeSettingIds::SCENE_ID].toString());
err = mSettingsImp->get(CxeSettingIds::LIGHT_SENSITIVITY, stringValue);
QCOMPARE(err, CxeError::None);
@@ -229,28 +193,8 @@
err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE, stringValue);
QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_AUTO, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_AUTO, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_NIGHT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ scene = mSettingsModel->currentVideoScene();
+ QCOMPARE(stringValue, scene[CxeSettingIds::SCENE_ID].toString());
err = mSettingsImp->get(CxeSettingIds::WHITE_BALANCE, stringValue);
QCOMPARE(err, CxeError::None);
@@ -392,7 +336,7 @@
mSettingsModel->getSettingValue(CxeSettingIds::FNAME_IMAGE_COUNTER, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::FNAME_MONTH_FOLDER, string);
+ error = mSettingsImp->set(CxeSettingIds::FNAME_MONTH_FOLDER, range);
QCOMPARE(error, CxeError::None);
mSettingsModel->getSettingValue(CxeSettingIds::FNAME_MONTH_FOLDER, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
@@ -417,41 +361,6 @@
mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_AUTO, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_AUTO, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_MACRO, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_MACRO, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_NIGHT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_PORTRAIT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_PORTRAIT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_SCENERY, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SCENERY, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_SPORTS, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SPORTS, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityAutomatic);
QCOMPARE(error, CxeError::None);
mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue);
@@ -507,26 +416,6 @@
mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_AUTO, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_AUTO, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_NIGHT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceAutomatic);
QCOMPARE(error, CxeError::None);
mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsmodelimp/unittest_cxesettingsmodelimp.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsmodelimp/unittest_cxesettingsmodelimp.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsmodelimp/unittest_cxesettingsmodelimp.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -146,7 +146,7 @@
QCOMPARE(result.toInt(), 0);
// case 1: setting a value to a valid key
- error = mSettingsModel->set(CxeSettingIds::SHARPNESS, 100);
+ error = mSettingsModel->set(CxeSettingIds::SHARPNESS, QVariant(100));
QVERIFY(error == CxeError::None);
// case 2: testing if the value set is right to sharpness key
@@ -233,20 +233,23 @@
{
CxeScene result;
CxeError::Id error;
+
+ // do initialization
+ mSettingsModel->cameraModeChanged(Cxe::ImageMode);
+
// case 1: check the default image scene sharpness value
result = mSettingsModel->currentImageScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == CxeSettingIds::IMAGE_SCENE_AUTO);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == Cxe::IMAGE_SCENE_AUTO);
QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessNormal);
- QString key = CxeSettingIds::IMAGE_SCENE_PORTRAIT;
-
// case 2: trying to set a new image scene
- error = mSettingsModel->setImageScene(key);
+ QString sceneId = Cxe::IMAGE_SCENE_PORTRAIT;
+ error = mSettingsModel->setImageScene(sceneId);
QVERIFY(error == CxeError::None);
// case 3: testing if NIGHT image scene is set correctly. checking its sharpness value
result = mSettingsModel->currentImageScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == key);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == sceneId);
QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessSoft);
// case 3: trying to set a image scene with invalid value
@@ -268,20 +271,23 @@
{
CxeScene result;
CxeError::Id error;
+
+ // do initialization
+ mSettingsModel->cameraModeChanged(Cxe::VideoMode);
+
// case 1: check the default image scene
result = mSettingsModel->currentVideoScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == CxeSettingIds::VIDEO_SCENE_AUTO);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == Cxe::VIDEO_SCENE_AUTO);
QVERIFY(result[CxeSettingIds::FRAME_RATE] == 0);
- QString key = CxeSettingIds::VIDEO_SCENE_LOWLIGHT;
-
// case 2: trying to set a new image scene
- error = mSettingsModel->setVideoScene(key);
+ QString sceneId = Cxe::VIDEO_SCENE_LOWLIGHT;
+ error = mSettingsModel->setVideoScene(sceneId);
QVERIFY(error == CxeError::None);
// case 3: testing if NIGHT image scene is set correctly
result = mSettingsModel->currentVideoScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == key);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == sceneId);
QVERIFY(result[CxeSettingIds::FRAME_RATE] == 15);
// case 3: trying to set a image scene with invalid value
@@ -296,5 +302,4 @@
// main() function non-GUI testing
-QTEST_APPLESS_MAIN(UnitTestCxeSettingsModelImp)
-;
+QTEST_APPLESS_MAIN(UnitTestCxeSettingsModelImp);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+#include
+#include
+#include
+#include
+
+#include "cxefakecameradevice.h"
+#include "cxefakecameradevicecontrol.h"
+#include "cxeerror.h"
+#include "cxetestutils.h"
+#include "cxesnapshotcontrol.h"
+#include "cxesnapshotcontrolprivate.h"
+#include "unittest_cxesnapshotcontrol.h"
+
+
+UnitTestCxeSnapshotControl::UnitTestCxeSnapshotControl()
+ : mSnapshotControl(NULL),
+ mCameraDevice(NULL),
+ mCameraDeviceControl(NULL)
+{
+}
+
+UnitTestCxeSnapshotControl::~UnitTestCxeSnapshotControl()
+{
+ cleanup();
+}
+
+
+void UnitTestCxeSnapshotControl::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mCameraDeviceControl = new CxeFakeCameraDeviceControl;
+ mCameraDevice = new CxeFakeCameraDevice;
+ mCameraDevice->newCamera(Cxe::PrimaryCameraIndex, mCameraDeviceControl);
+ mCameraDeviceControl->setState(CxeCameraDeviceControl::Ready);
+
+ mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeSnapshotControl::cleanup()
+{
+ delete mSnapshotControl;
+ mSnapshotControl = NULL;
+
+ delete mCameraDevice;
+ mCameraDevice = NULL;
+
+ delete mCameraDeviceControl;
+ mCameraDeviceControl = NULL;
+}
+
+void UnitTestCxeSnapshotControl::testState()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Idle);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeSnapshotControl::testCalculateSnapshotSize()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QSize snapshotSize;
+ QSize displaySize;
+
+ // 16:9 display, 4:3 capture format
+ displaySize = QSize(1600, 900);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio4to3);
+ QVERIFY(snapshotSize == QSize(1200, 900));
+
+ // 16:9 display, 16:9 capture format
+ displaySize = QSize(640, 360);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio16to9);
+ QVERIFY(snapshotSize == QSize(640, 360));
+
+
+ // 4:3 display, 16:9 capture format
+ displaySize = QSize(640, 480);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio16to9);
+ QVERIFY(snapshotSize == QSize(640, 360));
+
+ // 4:3 display, 4:3 capture format
+ displaySize = QSize(640, 480);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio4to3);
+ QVERIFY(snapshotSize == QSize(640, 480));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeSnapshotControl::testStart()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Idle);
+ mSnapshotControl->start(QSize(640,360));
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Active);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeSnapshotControl::testStop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Idle);
+ mSnapshotControl->stop();
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Idle);
+ mSnapshotControl->start(QSize(640,360));
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Active);
+ mSnapshotControl->stop();
+ QVERIFY(mSnapshotControl->state() == CxeSnapshotControl::Idle);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void UnitTestCxeSnapshotControl::testHandleCameraEvent()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QSignalSpy spySnapshotReady(mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)));
+
+ // Snapshot not started, camera events should not effect in any way.
+ mSnapshotControl->handleCameraEvent(KUidECamEventSnapshotUidValue, KErrNone);
+ QVERIFY(!CxeTestUtils::waitForSignal(spySnapshotReady, 1000));
+
+ // After starting we are supposed to get the snapshotReady signal.
+ mSnapshotControl->start(QSize(640,360));
+ mSnapshotControl->handleCameraEvent(KUidECamEventSnapshotUidValue, KErrNone);
+ QVERIFY(CxeTestUtils::waitForSignal(spySnapshotReady, 1000));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+QTEST_MAIN(UnitTestCxeSnapshotControl);
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef UNITTEST_CXESNAPSHOTCONTROL_H
+#define UNITTEST_CXESNAPSHOTCONTROL_H
+
+#include
+
+class CxeSnapshotControl;
+class CxeFakeCameraDevice;
+class CxeFakeCameraDeviceControl;
+
+class UnitTestCxeSnapshotControl : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ UnitTestCxeSnapshotControl();
+ virtual ~UnitTestCxeSnapshotControl();
+
+private slots:
+
+ void init();
+ void cleanup();
+
+ void testState();
+ void testCalculateSnapshotSize();
+ void testStart();
+ void testStop();
+ void testHandleCameraEvent();
+
+private:
+
+ CxeSnapshotControl *mSnapshotControl;
+ CxeFakeCameraDevice *mCameraDevice;
+ CxeFakeCameraDeviceControl *mCameraDeviceControl;
+};
+
+#endif /* UNITTEST_CXESNAPSHOTCONTROL_H */
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.pro Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,48 @@
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# Contributors:
+# Description:
+
+DEFINES *= CXE_USE_DUMMY_CAMERA
+
+include(../unittest.pri)
+
+TARGET = unittest_cxesnapshotcontrol
+
+LIBS *= -lecamsnapshot
+LIBS *= -lecamadvsettings
+LIBS *= -lecam
+LIBS *= -lecampluginsupport
+LIBS *= -lfbscli
+LIBS *= -lbitgdi
+
+SOURCES *= unittest_cxesnapshotcontrol.cpp
+SOURCES *= cxesnapshotcontrol.cpp
+SOURCES *= cxesnapshotcontrolprivate.cpp
+SOURCES *= cxedummycamera.cpp
+SOURCES *= cxecameradevice.cpp
+SOURCES *= cxefakecameradevice.cpp
+SOURCES *= cxefakecameradevicecontrol.cpp
+SOURCES *= cxeerrormappingsymbian.cpp
+SOURCES *= cxestate.cpp
+SOURCES *= cxestatemachine.cpp
+SOURCES *= cxestatemachinebase.cpp
+
+HEADERS *= unittest_cxesnapshotcontrol.h
+HEADERS *= cxesnapshotcontrol.h
+HEADERS *= cxesnapshotcontrolprivate.h
+HEADERS *= cxedummycamera.h
+HEADERS *= cxecameradevice.h
+HEADERS *= cxefakecameradevice.h
+HEADERS *= cxecameradevicecontrol.h
+HEADERS *= cxefakecameradevicecontrol.h
+HEADERS *= cxeerrormappingsymbian.h
+HEADERS *= cxestate.h
+HEADERS *= cxestatemachine.h
+HEADERS *= cxestatemachinebase.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -19,14 +19,18 @@
#include "unittest_cxestatemachine.h"
#include "cxestate.h"
#include "cxestatemachineunit.h"
-#include "cxeerrormappingsymbian.h" // CxeErrorHandlingSymbian
// -----------------------------------
// CxsStateMachine
// -----------------------------------
UnitTestCxeStateMachine::UnitTestCxeStateMachine()
-: mStateMachine(NULL), mStartState(NULL), mMiddleState(NULL), mEndState(NULL), mIsolatedState(NULL)
+: mStateMachine(NULL),
+ mStartState(NULL),
+ mMiddleState(NULL),
+ mEndState(NULL),
+ mIsolatedState(NULL)
{
+ qRegisterMetaType("CxeError::Id");
}
UnitTestCxeStateMachine::~UnitTestCxeStateMachine()
@@ -106,25 +110,25 @@
// set state, when initial state is not set -> NOK
// check that handleStateChange is not called
// current state is undefined
- QVERIFY(!mStateMachine->setState(StartId, 2));
+ QVERIFY(!mStateMachine->setState(StartId));
QCOMPARE(mStateMachine->mHandleStateChangedCounter, 0);
- QCOMPARE(mStateMachine->stateId(), 0);
+ QCOMPARE(mStateMachine->stateId(), 0); // 0 - undefined state
// set start state as initial state, change to another state (allowed change) -> OK
// (there should be a call to state change, check the error code)
mStateMachine->setInitialState(StartId);
- QVERIFY(mStateMachine->setState(MiddleId, 0));
+ QVERIFY(mStateMachine->setState(MiddleId, CxeError::None));
QCOMPARE(mStateMachine->mHandleStateChangedCounter, 1);
QVERIFY(mStateMachine->mStateChangeStateId == MiddleId);
- QVERIFY(mStateMachine->mStateChangeErrorId == CxeErrorHandlingSymbian::map(0));
+ QCOMPARE(mStateMachine->mStateChangeErrorId, CxeError::None);
QVERIFY(mStateMachine->stateId() == MiddleId);
// set another state (allowed change) -> OK
- // check the error code is correct one (return value is mapped error value)
- QVERIFY(mStateMachine->setState(EndId, -1));
+ // check the error code is correct one
+ QVERIFY(mStateMachine->setState(EndId, CxeError::NotFound));
QCOMPARE(mStateMachine->mHandleStateChangedCounter, 2);
QVERIFY(mStateMachine->mStateChangeStateId == EndId);
- QVERIFY(mStateMachine->mStateChangeErrorId == CxeErrorHandlingSymbian::map(-1));
+ QCOMPARE(mStateMachine->mStateChangeErrorId, CxeError::NotFound);
QVERIFY(mStateMachine->stateId() == EndId);
// reset the counter for handleStateChanged slot
@@ -132,7 +136,7 @@
// set same state again -> OK
// but state change should not be called
- QVERIFY(mStateMachine->setState(EndId, 0));
+ QVERIFY(mStateMachine->setState(EndId, CxeError::None));
QCOMPARE(mStateMachine->mHandleStateChangedCounter, 0);
// setstate to a state that does not exists -> NOK
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro Thu Jul 15 01:55:05 2010 +0300
@@ -18,13 +18,11 @@
SOURCES *= unittest_cxestatemachine.cpp \
cxestatemachineunit.cpp \
cxestatemachinebase.cpp \
- cxeerrormappingsymbian.cpp \
cxestate.cpp
HEADERS *= unittest_cxestatemachine.h \
cxestatemachineunit.h \
cxestatemachinebase.h \
- cxeerrormappingsymbian.h \
cxestate.h \
cxeerror.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -26,6 +26,7 @@
#include "cxestillcapturecontrolsymbian.h"
#include "unittest_cxestillcapturecontrolsymbian.h"
#include "cxefakeviewfindercontrol.h"
+#include "cxesnapshotcontrol.h"
#include "cxesettingsmodel.h"
#include "cxesensoreventhandlersymbian.h"
#include "cxefilenamegeneratorsymbian.h"
@@ -64,20 +65,21 @@
mFakeCameraDeviceControl = new CxeFakeCameraDeviceControl();
mFakeCameraDevice = new CxeFakeCameraDevice();
mFakeCameraDevice->newCamera(mFakeCameraDeviceControl->cameraIndex(), mFakeCameraDeviceControl);
-
mViewfinderControl = new CxeFakeViewfinderControl();
+ mSnapshotControl = new CxeSnapshotControl(*mFakeCameraDevice);
mFilenameGenerator = new CxeFakeFilenameGenerator();
mSensorEventHandler = new CxeFakeSensorEventHandler();
mFakeAutoFocusControl = new CxeFakeAutoFocusControl();
mFakeQualityPresets = new CxeFakeQualityPresets();
mFakeFileSaveThread = new CxeFakeFileSaveThread();
-
+
mDiskMonitor = new CxeDiskMonitor(*mFakeSettings);
mStillCaptureControl = new CxeStillCaptureControlSymbian(
*mFakeCameraDevice,
*mViewfinderControl,
+ *mSnapshotControl,
*mFakeCameraDeviceControl,
*mFilenameGenerator,
*mSensorEventHandler,
@@ -106,6 +108,8 @@
mFilenameGenerator = 0;
delete mViewfinderControl;
mViewfinderControl = 0;
+ delete mSnapshotControl;
+ mSnapshotControl = 0;
delete mFakeCameraDeviceControl;
mFakeCameraDeviceControl = 0;
delete mFakeCameraDevice;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -26,6 +26,7 @@
class CxeFakeCameraDeviceControl;
class CxeStillCaptureControlSymbian;
class CxeFakeViewfinderControl;
+class CxeSnapshotControl;
class CxeFakeFilenameGenerator;
class CxeFilenameGenerator;
class CxeFakeSensorEventHandler;
@@ -68,6 +69,7 @@
CxeFakeCameraDeviceControl *mFakeCameraDeviceControl;
CxeFakeCameraDevice *mFakeCameraDevice;
CxeFakeViewfinderControl *mViewfinderControl;
+ CxeSnapshotControl *mSnapshotControl;
CxeFakeFilenameGenerator *mFilenameGenerator;
CxeFakeSensorEventHandler *mSensorEventHandler;
CxeStillCaptureControlSymbian *mStillCaptureControl;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -30,6 +30,8 @@
LIBS *= -lsensrvclient
LIBS *= -lsensrvutil
LIBS *= -lplatformenv
+LIBS *= -lefsrv
+LIBS *= -lcone
DEFINES *= CXE_USE_DUMMY_CAMERA
@@ -68,6 +70,8 @@
cxefilesavethread.cpp \
cxediskmonitor.cpp \
cxediskmonitorprivate.cpp \
+ cxesnapshotcontrol.cpp \
+ cxesnapshotcontrolprivate.cpp \
cxefakefilesavethread.cpp
HEADERS *= unittest_cxestillcapturecontrolsymbian.h \
@@ -116,4 +120,6 @@
cxefilesavethread.h \
cxediskmonitor.h \
cxediskmonitorprivate.h \
+ cxesnapshotcontrol.h \
+ cxesnapshotcontrolprivate.h \
cxequalitypresets.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -118,7 +118,7 @@
QVERIFY(!mCxeStillImageSymbian->dataItem());
QByteArray data("124343423423456e74576");
QString path = "\\Images\\Camera\\blaah.jpg";
- CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, mCxeStillImageSymbian->id());
+ CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, mCxeStillImageSymbian->id(), false);
mCxeStillImageSymbian->setDataItem(dataItem);
QVERIFY(mCxeStillImageSymbian->dataItem() == dataItem);
CX_DEBUG_EXIT_FUNCTION();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,7 @@
LIBS *= -lplatformenv
LIBS *= -lsysutil
+LIBS *= -lefsrv
SOURCES *= unittest_cxestillimagesymbian.cpp \
cxeimagedataitemsymbian.cpp \
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -48,33 +48,17 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QSignalSpy thumbnailReadySpy(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, int)));
QString filename;
- QVERIFY(thumbnailReadySpy.isValid());
-
// case 1: testing with wrong dummy file, we should get an error code with thumbnailready
// since filename is invalid
- mThumbnailManager->createThumbnail(filename, QPixmap());
-
- QCOMPARE(thumbnailReadySpy.count(), 1 );
- if (thumbnailReadySpy.count() > 0) {
- QList initModeArguments = thumbnailReadySpy.takeFirst();
- // we are only interested in error code in this case 1
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNotFound);
- }
+ mThumbnailManager->createThumbnail(filename, QImage());
+
// case 1: testing with proper file name, we shouldnt get an error code with thumbnailready
// since filename is valid
filename = QString("c:\\test.jpg");
- mThumbnailManager->createThumbnail(filename, QPixmap());
-
- QCOMPARE( thumbnailReadySpy.count(), 1 );
- if (thumbnailReadySpy.count() > 0) {
- QList initModeArguments = thumbnailReadySpy.takeFirst();
- // we are only interested in error code in this case 1
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNone);
- }
+ mThumbnailManager->createThumbnail(filename, QImage());
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/cxevideocapturecontrolsymbianunit.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/cxevideocapturecontrolsymbianunit.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/cxevideocapturecontrolsymbianunit.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -23,15 +23,16 @@
#include "cxutils.h"
#include "cxediskmonitor.h"
-CxeVideoCaptureControlSymbianUnit::CxeVideoCaptureControlSymbianUnit(
+CxeVideoCaptureControlSymbianUnit::CxeVideoCaptureControlSymbianUnit(
CxeCameraDevice &cameraDevice,
CxeViewfinderControl &viewfinderControl,
+ CxeSnapshotControl &snapshotControl,
CxeCameraDeviceControl &cameraDeviceControl,
CxeFilenameGenerator &nameGenerator,
CxeSettings &settings,
CxeQualityPresets &qualityPresets,
CxeDiskMonitor &diskMonitor)
- : CxeVideoCaptureControlSymbian(cameraDevice, viewfinderControl,
+ : CxeVideoCaptureControlSymbian(cameraDevice, viewfinderControl, snapshotControl,
cameraDeviceControl, nameGenerator,
settings, qualityPresets, diskMonitor)
{
@@ -50,7 +51,7 @@
// init video recoder
if (state() == CxeVideoCaptureControl::Idle) {
if (mVideoRecorder == NULL) {
- TRAPD(initErr, mVideoRecorder =
+ TRAPD(initErr, mVideoRecorder =
new CxeFakeVideoRecorderUtility( *this ,
KAudioPriorityVideoRecording,
TMdaPriorityPreference( KAudioPrefVideoRecording )));
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/cxevideocapturecontrolsymbianunit.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/cxevideocapturecontrolsymbianunit.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/cxevideocapturecontrolsymbianunit.h Thu Jul 15 01:55:05 2010 +0300
@@ -27,13 +27,14 @@
* CxeCameraDeviceControlSymbian except for that CxeFakeCameraDevice is used
* instead of the real implementation.
*/
-class CxeVideoCaptureControlSymbianUnit : public CxeVideoCaptureControlSymbian
+class CxeVideoCaptureControlSymbianUnit : public CxeVideoCaptureControlSymbian
{
Q_OBJECT
public:
CxeVideoCaptureControlSymbianUnit(CxeCameraDevice &cameraDevice,
CxeViewfinderControl &viewfinderControl,
+ CxeSnapshotControl &snapshotControl,
CxeCameraDeviceControl &cameraDeviceControl,
CxeFilenameGenerator &nameGenerator,
CxeSettings &settings,
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -21,6 +21,7 @@
#include "unittest_cxevideocapturecontrolsymbian.h"
#include "cxevideocapturecontrolsymbian.h"
#include "cxevideocapturecontrolsymbianunit.h"
+#include "cxesnapshotcontrol.h"
#include "cxefakefilenamegenerator.h"
#include "cxedummycamera.h"
#include "cxefakecameradevice.h"
@@ -65,6 +66,7 @@
mCameraDeviceControl->setMode(Cxe::VideoMode);
mCameraDevice = new CxeFakeCameraDevice();
mViewfinderControl = new CxeFakeViewfinderControl();
+ mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
mSettings = new CxeFakeSettings();
mSettings->set(CxeSettingIds::VIDEO_SHOWCAPTURED, -1);
mFilenameGeneratorSymbian = new CxeFakeFilenameGenerator();
@@ -73,6 +75,7 @@
mDiskMonitor = new CxeDiskMonitor(*mSettings);
mCxeVideoCaptureControlSymbian = new CxeVideoCaptureControlSymbianUnit(*mCameraDevice,
*mViewfinderControl,
+ *mSnapshotControl,
*mCameraDeviceControl,
*mFilenameGeneratorSymbian,
*mSettings,
@@ -102,6 +105,8 @@
mFilenameGeneratorSymbian = 0;
delete mViewfinderControl;
mViewfinderControl = 0;
+ delete mSnapshotControl;
+ mSnapshotControl = 0;
delete mCameraDeviceControl;
mCameraDeviceControl = 0;
delete mCameraDevice;
@@ -230,21 +235,22 @@
CX_DEBUG_EXIT_FUNCTION();
}
-void UnitTestCxeVideoCaptureControlSymbian::testHandleSnapshotEvent()
+void UnitTestCxeVideoCaptureControlSymbian::testHandleSnapshotReady()
{
CX_DEBUG_ENTER_FUNCTION();
+ QImage snapshot;
- QSignalSpy spy(mCxeVideoCaptureControlSymbian, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)));
+ QSignalSpy spy(mCxeVideoCaptureControlSymbian, SIGNAL(snapshotReady(CxeError::Id, const QImage&, const QString&)));
mCxeVideoCaptureControlSymbian->deinit();
doPrepareStuff();
- mCxeVideoCaptureControlSymbian->handleSnapshotEvent(CxeError::OutOfMemory);
+ mCxeVideoCaptureControlSymbian->handleSnapshotReady(CxeError::OutOfMemory, snapshot);
QCOMPARE(mCxeVideoCaptureControlSymbian->state(), CxeVideoCaptureControl::Ready);
// check that we receive this signal once the snapshot is ready
QVERIFY(CxeTestUtils::waitForSignal(spy, 1000));
doPrepareStuff();
- mCxeVideoCaptureControlSymbian->handleSnapshotEvent(CxeError::None);
+ mCxeVideoCaptureControlSymbian->handleSnapshotReady(CxeError::None, snapshot);
QVERIFY(CxeTestUtils::waitForSignal(spy, 1000));
CX_DEBUG_EXIT_FUNCTION();
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.h Thu Jul 15 01:55:05 2010 +0300
@@ -23,6 +23,7 @@
class CxeFakeCameraDevice;
class CxeFakeViewfinderControl;
+class CxeSnapshotControl;
class CxeFakeCameraDeviceControl;
class CxeFakeSettings;
class CxeFakeFilenameGenerator;
@@ -53,7 +54,7 @@
void testReset();
void testFilename();
void testSnapshot();
- void testHandleSnapshotEvent();
+ void testHandleSnapshotReady();
void testInit();
void testDeinit();
void testHandleSoundPlayed();
@@ -70,6 +71,7 @@
CxeVideoCaptureControlSymbianUnit *mCxeVideoCaptureControlSymbian;
CxeFakeCameraDevice *mCameraDevice;
CxeFakeViewfinderControl *mViewfinderControl;
+ CxeSnapshotControl *mSnapshotControl;
CxeFakeCameraDeviceControl *mCameraDeviceControl;
CxeFakeSettings *mSettings;
CxeFakeFilenameGenerator *mFilenameGeneratorSymbian;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -25,7 +25,8 @@
LIBS *= -lmmfcontrollerframework
LIBS *= -lplatformenv
LIBS *= -lsysutil
-
+LIBS *= -lefsrv
+LIBS *= -lcone
DEFINES *= CXE_USE_DUMMY_CAMERA
@@ -52,6 +53,8 @@
cxefakequalitypresets.cpp \
cxediskmonitor.cpp \
cxediskmonitorprivate.cpp \
+ cxesnapshotcontrol.cpp \
+ cxesnapshotcontrolprivate.cpp \
cxesysutil.cpp
HEADERS *= unittest_cxevideocapturecontrolsymbian.h \
@@ -83,4 +86,6 @@
cxutils.h \
cxediskmonitor.h \
cxediskmonitorprivate.h \
+ cxesnapshotcontrol.h \
+ cxesnapshotcontrolprivate.h \
cxesysutil.h
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeviewfindercontrolsymbian/unittest_cxeviewfindercontrolsymbian.pro
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeviewfindercontrolsymbian/unittest_cxeviewfindercontrolsymbian.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeviewfindercontrolsymbian/unittest_cxeviewfindercontrolsymbian.pro Thu Jul 15 01:55:05 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -21,8 +21,8 @@
LIBS *= -lfbscli
LIBS *= -lbitgdi
LIBS *= -lcone
-LIBS *= -lalfclient
-LIBS *= -lalfdecoderserverclient
+LIBS *= -lws32
+LIBS *= -lgdi
DEFINES *= CXE_USE_DUMMY_CAMERA
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/cxui.pro
--- a/camerauis/cameraxui/cxui/cxui.pro Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.pro Thu Jul 15 01:55:05 2010 +0300
@@ -24,13 +24,19 @@
TARGET.UID3 = 0x101f857a
TARGET.VID = VID_DEFAULT
TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
- ICON = ./icons/cxui.svg
+ SKINICON = qtg_large_camera
RSS_RULES = "group_name=\"Qt Camera\";"
# Fix for QMake translating INCLUDEPATH to SYSTEMINCLUDE
# and TraceCompiler needing USERINCLUDE.
MMP_RULES += "USERINCLUDE traces"
}
+# export sound file
+symbian {
+ CXUI_DIR = $$section(PWD,":",1)
+ BLD_INF_RULES.prj_exports += "$$CXUI_DIR/data/selftimer.wav /epoc32/data/z/system/sounds/digital/selftimer.wav"
+}
+
DEPENDPATH += ../cxengine/inc/api
VPATH += src \
inc
@@ -45,7 +51,6 @@
-lcxengine \
-lapmime \
-lcommonui \
- -lxqsettingsmanager \
-lxqutils \
-lxqservice \
-lxqserviceutil \
@@ -54,7 +59,9 @@
-lefsrv \
-lws32 \
-lgdi \
- -lapgrfx
+ -lapgrfx \
+ -lusbman \
+ -lthumbnailmanagerqt
CONFIG += hb
CONFIG += service
@@ -68,6 +75,8 @@
HEADERS += cxuiapplication.h \
cxuiapplicationframeworkmonitor.h \
cxuiapplicationframeworkmonitorprivate.h \
+ cxuiapplicationstate.h \
+ cxuiview.h \
cxuiprecaptureview.h \
cxuistillprecaptureview.h \
cxuivideoprecaptureview.h \
@@ -83,19 +92,22 @@
cxuisettingradiobuttonlist.h \
cxuiscenelabel.h \
cxuierrormanager.h \
- cxuistandby.h \
cxuisettingradiobuttonlistmodel.h \
cxuisettingsinfo.h \
cxuisettingxmlreader.h \
cxuiserviceprovider.h \
cxuiscenemodeview.h \
cxuizoomslider.h \
+ cxuifullscreenpopup.h \
+ cxuieventlog.h \
traces/OstTraceDefinitions.h
SOURCES += main.cpp \
cxuiapplication.cpp \
cxuiapplicationframeworkmonitor.cpp \
cxuiapplicationframeworkmonitorprivate.cpp \
+ cxuiapplicationstate.cpp \
+ cxuiview.cpp \
cxuiprecaptureview.cpp \
cxuivideoprecaptureview.cpp \
cxuistillprecaptureview.cpp \
@@ -110,13 +122,14 @@
cxuisettingradiobuttonlist.cpp \
cxuiscenelabel.cpp \
cxuierrormanager.cpp \
- cxuistandby.cpp \
cxuisettingradiobuttonlistmodel.cpp \
cxuisettingsinfo.cpp \
cxuisettingxmlreader.cpp \
cxuiserviceprovider.cpp \
cxuiscenemodeview.cpp \
- cxuizoomslider.cpp
+ cxuizoomslider.cpp \
+ cxuifullscreenpopup.cpp \
+ cxuieventlog.cpp
RESOURCES += cxui.qrc
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/cxui.qrc
--- a/camerauis/cameraxui/cxui/cxui.qrc Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.qrc Thu Jul 15 01:55:05 2010 +0300
@@ -1,15 +1,16 @@
+ layouts/cxui.css
layouts/setting_scenemode.docml
- layouts/standbymode_popup.docml
layouts/view_still_precapture.docml
layouts/view_video_precapture.docml
layouts/view_postcapture.docml
layouts/errornote_popup.docml
layouts/setting.docml
layouts/setting_slider.docml
+ layouts/full_screen_popup.docml
layouts/image_setting.xml
layouts/video_setting.xml
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/data/selftimer.wav
Binary file camerauis/cameraxui/cxui/data/selftimer.wav has changed
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/icons/cxui.svg
--- a/camerauis/cameraxui/cxui/icons/cxui.svg Thu May 13 21:30:19 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-
-
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiapplication.h
--- a/camerauis/cameraxui/cxui/inc/cxuiapplication.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplication.h Thu Jul 15 01:55:05 2010 +0300
@@ -35,6 +35,11 @@
#endif // Q_WS_S60
signals:
+ /*!
+ * Testing framework support.
+ * Application ready signal is emitted after startup when UI is fully loaded and functional.
+ */
+ void applicationReady();
#if defined(Q_WS_S60)
void symbianEvent(const QSymbianEvent *e);
#endif // Q_WS_S60
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h
--- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h Thu Jul 15 01:55:05 2010 +0300
@@ -46,11 +46,12 @@
};
public:
- CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings& settings);
+ CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings &settings);
virtual ~CxuiApplicationFrameworkMonitor();
public:
ForegroundState foregroundState() const;
+ bool isUsbMassMemoryModeActive() const;
signals:
/*!
@@ -64,8 +65,18 @@
*/
void batteryEmpty();
+ /*!
+ * USB mass memory mode was just activated or deactivated.
+ * @param active If true, mass memory mode was activated, and mass memory cannot be accessed.
+ * Otherwise mass memory mode was deactivated, and mass memory is again accessible.
+ */
+ void usbMassMemoryModeToggled(bool active);
+
+
private:
- CxuiApplicationFrameworkMonitorPrivate* p;
+ CxuiApplicationFrameworkMonitorPrivate *p;
+
+ friend class CxuiApplicationFrameworkMonitorPrivate;
};
#endif // CXUIAPPLICATIONFRAMEWORKMONITOR_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h
--- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Thu Jul 15 01:55:05 2010 +0300
@@ -21,6 +21,7 @@
#include
#include "cxuiapplicationframeworkmonitor.h"
+
class CxeSettings;
class CxuiApplication;
#ifdef Q_OS_SYMBIAN
@@ -28,6 +29,7 @@
class RWindowGroup;
class QString;
class QSymbianEvent;
+class CxuiEventLog;
#endif // Q_OS_SYMBIAN
@@ -35,16 +37,14 @@
{
Q_OBJECT
-public:
- CxuiApplicationFrameworkMonitorPrivate(CxuiApplication &application, CxeSettings& settings);
+private:
+ CxuiApplicationFrameworkMonitorPrivate(CxuiApplicationFrameworkMonitor *parent,
+ CxuiApplication &application,
+ CxeSettings &settings);
virtual ~CxuiApplicationFrameworkMonitorPrivate();
-public:
CxuiApplicationFrameworkMonitor::ForegroundState foregroundState() const;
-
-signals:
- void foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState t);
- void batteryEmpty();
+ bool isUsbMassMemoryModeActive() const;
#ifdef Q_OS_SYMBIAN
private slots:
@@ -53,25 +53,33 @@
private:
void init();
- bool handleWindowServerEvent(const QSymbianEvent *event);
+ void handleWindowServerEvent(const QSymbianEvent *event);
+ void handleUsbPropertyEvent(unsigned long int key, QVariant value);
void setState(CxuiApplicationFrameworkMonitor::ForegroundState state);
CxuiApplicationFrameworkMonitor::ForegroundState getCurrentState();
unsigned int focusedApplicationUid();
#endif // Q_OS_SYMBIAN
-
private:
+ CxuiApplicationFrameworkMonitor *q;
CxuiApplication &mApplication;
- CxeSettings& mSettings;
+ CxeSettings &mSettings;
#ifdef Q_OS_SYMBIAN
RWsSession &mWsSession;
RWindowGroup &mWindowGroup;
int mWindowGroupId;
QString mWindowGroupName;
+
int mKeyLockState;
int mBatteryStatus;
+ int mUsbPersonality;
+
+ CxuiEventLog *mEventLog;
#endif // Q_OS_SYMBIAN
+
CxuiApplicationFrameworkMonitor::ForegroundState mState;
+
+ friend class CxuiApplicationFrameworkMonitor;
};
#endif // CXUIAPPLICATIONFRAMEWORKMONITORPRIVATE_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXUIAPPLICATIONSTATE_H
+#define CXUIAPPLICATIONSTATE_H
+
+#include
+#include "cxeerror.h"
+#include "cxuiapplicationframeworkmonitor.h"
+
+class CxuiApplication;
+class CxuiCaptureKeyHandler;
+class CxeSettings;
+class CxuiDocumentLoader;
+class CxuiErrorManager;
+class CxuiEventLog;
+
+
+/*!
+* @brief Class maintaining application overall state.
+*/
+class CxuiApplicationState : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(State)
+
+public:
+
+ enum State {
+ Normal,
+ Standby,
+ Error,
+ Background
+ };
+
+ CxuiApplicationState(CxuiApplication &application,
+ CxeSettings &settings,
+ CxuiDocumentLoader *documentLoader);
+ ~CxuiApplicationState();
+
+
+public:
+ State currentState() const;
+
+signals:
+ void stateChanged(CxuiApplicationState::State newState,
+ CxuiApplicationState::State oldState);
+
+public slots:
+ void startMonitoring();
+ void handleApplicationError(CxeError::Id error);
+ void enterStandby();
+ void exitStandby();
+
+private slots:
+ void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
+ void handleUsbMassMemoryModeChanged(bool active);
+ void handleBatteryEmpty();
+ void handleSevereError();
+ void handleErrorCleared();
+
+private:
+ void setState(State newState);
+ void checkErrors();
+
+private:
+ State mState;
+ CxuiApplicationFrameworkMonitor *mApplicationMonitor;
+ CxuiErrorManager *mErrorManager;
+ CxuiEventLog *mEventLog;
+};
+
+#endif // CXUIAPPLICATIONSTATE_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuienums.h
--- a/camerauis/cameraxui/cxui/inc/cxuienums.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuienums.h Thu Jul 15 01:55:05 2010 +0300
@@ -48,15 +48,19 @@
static const char *SCENEMODE_SETTING_XML = ":/xml/setting_scenemode.docml";
- static const char *STANDBY_POPUP_XML = ":/xml/standbymode_popup.docml";
static const char *ERROR_POPUP_XML = ":/xml/errornote_popup.docml";
static const char *SETTINGS_SLIDER_DIALOG_XML = ":/xml/setting_slider.docml";
+ static const char *FULL_SCREEN_POPUP_XML = ":/xml/full_screen_popup.docml";
+
+
// Graphics
static const char *TRANSPARENT_BACKGROUND_GRAPHIC = "qtg_fr_popup_trans";
// Sections
+ static const char *STILL_PRE_CAPTURE_INDICATORS_SECTION = "still_capture_indicators";
static const char *STILL_PRE_CAPTURE_WIDGETS_SECTION = "still_capture_with_widgets";
+ static const char *VIDEO_PRE_CAPTURE_INDICATORS_SECTION = "video_capture_indicators";
static const char *VIDEO_PRE_CAPTURE_WIDGETS_SECTION = "video_capture_with_widgets";
static const char *POST_CAPTURE_WIDGETS_SECTION = "post_capture_with_widgets";
static const char *STILL_PRE_CAPTURE_EMBEDDED_SECTION = "still_embedded_mode";
@@ -71,7 +75,6 @@
// Widgets
// In order to be able to refer to a widget, we need to know its object name.
static const char *STILL_PRE_CAPTURE_VIEW = "still_capture_view";
- static const char *STILL_SCENES_VIEW = "settings_scenes_view";
static const char *STILL_PRE_CAPTURE_TOOLBAR = "toolbar";
static const char *STILL_PRE_CAPTURE_FLASH_ACTION = "cxui_action_flash";
static const char *STILL_PRE_CAPTURE_SCENE_MODE_ACTION = "cxui_action_scenemodes";
@@ -82,9 +85,12 @@
static const char *STILL_PRE_CAPTURE_GOTO_VIDEO_ACTION = "cxui_action_goto_video";
static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL = "images_remaining";
static const char *STILL_PRE_CAPTURE_QUALITY_ICON = "quality_indicator";
+ static const char *STILL_PRE_CAPTURE_FACE_TRACKING_ICON = "face_tracking_indicator";
static const char *STILL_PRE_CAPTURE_POST_CAPTURE_ACTION = "cxui_action_stillpostcapture";
static const char *STILL_PRE_CAPTURE_INDICATOR_CONTAINER = "indicatorContainer";
static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER = "images_left_container";
+ static const char *STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON = "still_geotagging_indicator";
+ static const char *STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON = "flash_indicator";
static const char *STILL_PRE_CAPTURE_SELFTIMER_CONTAINER = "still_precapture_selftimer_container";
static const char *STILL_PRE_CAPTURE_SELFTIMER_COUNTER = "still_selftimer_counter";
@@ -92,15 +98,14 @@
static const char *STILL_PRE_CAPTURE_SELFTIMER_CANCEL_BUTTON = "still_selftimer_cancel_button";
static const char *VIDEO_PRE_CAPTURE_VIEW = "video_capture_view";
-
+
static const char *SETTINGS_DIALOG_OK_ACTION = "action_ok";
-
+
// video
// In order to be able to refer to a widget, we need to know its object name.
static const char *VIDEO_PRE_CAPTURE_TOOLBAR = "video_toolbar";
static const char *VIDEO_PRE_CAPTURE_TOOLBAR_REC = "video_toolbar_recording";
static const char *VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED = "video_toolbar_paused";
- static const char *VIDEO_PRE_CAPTURE_FLASH_ACTION = "cxui_video_action_light";
static const char *VIDEO_PRE_CAPTURE_VIEWFINDER = "video_viewfinder_widget";
static const char *VIDEO_PRE_CAPTURE_ZOOM_SLIDER = "video_zoom";
static const char *VIDEO_PRE_CAPTURE_RECORDING_ICON = "video_recording_icon";
@@ -112,13 +117,22 @@
static const char *VIDEO_PRE_CAPTURE_POST_CAPTURE_ACTION = "cxui_video_action_showcapturedvideo";
static const char *VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP = "video_indicator_container_top";
static const char *VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_BOTTOM = "video_indicator_container_bottom";
+ static const char *VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION = "cxui_video_action_scene";
static const char *VIDEO_PRE_CAPTURE_QUALITY_ICON = "video_quality_indicator";
+ static const char *VIDEO_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON = "video_geotagging_indicator";
+ static const char *VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON = "video_audio_mute_indicator";
+ static const char *VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON = "video_stability_indicator";
// standby
static const char *STANDBY_POPUP = "standbymode_popup";
static const char *STANDBY_TEXT_WIDGET = "standby_text";
+ // Full screen popup
+ static const char *FULL_SCREEN_POPUP = "full_screen_popup";
+ static const char *FULL_SCREEN_POPUP_TEXT = "full_screen_popup_text";
+ static const char *FULL_SCREEN_POPUP_BUTTON = "full_screen_popup_button";
+
// error manager
static const char *ERROR_POPUP = "errornote_popup";
static const char *ERROR_TEXT_WIDGET = "errornote_text";
@@ -142,13 +156,15 @@
static const char *SETTINGS_SLIDER_DIALOG_HEADING_WIDGET = "slider_settings_dialog_heading";
static const char *SETTINGS_SLIDER_DIALOG_CONTENT_WIDGET = "settings_dialog_slider";
- // scene setting
- static const char *SCENE_VIEW_CONTAINER = "scene_view_container";
- static const char *SCENE_VIEW_BG_IMAGE = "scene_view_bg_icon";
- static const char *SCENE_VIEW_BG_IMAGE2 = "scene_view_bg_icon2";
- static const char *SCENE_VIEW_RADIOBUTTONS = "scene_view_radioButtonList";
- static const char *SCENE_VIEW_OK_BUTTON = "scene_ok_button";
- static const char *SCENE_VIEW_CANCEL_BUTTON = "scene_cancel_button";
+ // scene mode view
+ static const char *SCENE_MODE_VIEW = "settings_scenes_view";
+ static const char *SCENE_MODE_VIEW_CONTAINER = "scene_view_container";
+ static const char *SCENE_MODE_VIEW_BG_IMAGE = "scene_view_bg_icon";
+ static const char *SCENE_MODE_VIEW_BG_IMAGE2 = "scene_view_bg_icon2";
+ static const char *SCENE_MODE_VIEW_RADIOBUTTONS = "scene_view_radioButtonList";
+ static const char *SCENE_MODE_VIEW_OK_BUTTON = "scene_ok_button";
+ static const char *SCENE_MODE_VIEW_CANCEL_BUTTON = "scene_cancel_button";
+ static const char *SCENE_MODE_VIEW_HEADING_WIDGET = "scene_title";
}
namespace CxUiInternal
@@ -160,6 +176,15 @@
static const char *PROPERTY_KEY_TRUE = "1";
}
+namespace CxuiActivityIds
+{
+ static const QString STILL_PRECAPTURE_ACTIVITY = "CameraViewfinderShow";
+ static const QString STILL_POSTCAPTURE_ACTIVITY = "CameraPostCaptureShow";
+
+ static const QString VIDEO_PRECAPTURE_ACTIVITY = "CamcorderViewfinderShow";
+ static const QString VIDEO_POSTCAPTURE_ACTIVITY = "CamcorderPostCaptureShow";
+}
+
Q_DECLARE_METATYPE(CxUi::CameraView)
#endif // CXUIENUMS_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuierrormanager.h
--- a/camerauis/cameraxui/cxui/inc/cxuierrormanager.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuierrormanager.h Thu Jul 15 01:55:05 2010 +0300
@@ -20,9 +20,9 @@
#include
#include "cxeerror.h"
+class HbAction;
class HbDialog;
class CxuiDocumentLoader;
-class CxuiCaptureKeyHandler;
/*
@@ -34,18 +34,21 @@
public:
- CxuiErrorManager(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader);
+ CxuiErrorManager(CxuiDocumentLoader *documentLoader);
~CxuiErrorManager();
signals:
- void aboutToRecoverError();
- void errorRecovered();
+ void errorPopupShown();
+ void errorPopupClosed();
+
+public slots:
+
+ void check(CxeError::Id error);
+ void clear();
private slots:
-
- void analyze(CxeError::Id error);
- void aboutToClosePopup();
+ void popupClosed(HbAction *action);
void closeApp();
private:
@@ -54,22 +57,21 @@
enum ErrorSeverity
{
None = 0,
- Warning, // Low severity, just warning user needed
- Severe, // when error cannot be recovered
- Critical // when error can be recovered, but needs actions e.g. camera in use
+ Warning,
+ Error
};
- void launchPopup(QString& errorMsgTxt);
- void showHighSeverityNote(QString& errorMsgTxt);
- void showLowSeverityNote(QString& errorMsgTxt);
- QString getErrorDetails(CxeError::Id error);
+ void launchPopup(const QString &errorText, const QString &buttonText);
+ void showErrorPopup(const QString &errorText, const QString &buttonText);
+ void showWarningPopup(const QString &errorText);
+ void getErrorDetails(QString &errorText, QString &buttonText);
private:
//data
- CxuiCaptureKeyHandler &mKeyHandler;
CxuiDocumentLoader *mDocumentLoader; // not own
HbDialog* mErrorMsgPopup;
+ CxeError::Id mErrorId;
CxuiErrorManager::ErrorSeverity mErrorSeverity;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuieventlog.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuieventlog.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXUIEVENTLOG_H
+#define CXUIEVENTLOG_H
+
+#include
+#include
+#include
+
+/*!
+* Class for saving events in run-time to be printed / traced out later.
+* Useful when tracing is not possible when the events occur, but can be done later.
+*/
+class CxuiEventLog
+{
+public:
+ CxuiEventLog(const QString &name, int size = 10);
+ ~CxuiEventLog();
+
+ void append(const QString &type, const QString &value);
+ void print() const;
+
+private:
+ struct CxuiEvent
+ {
+ public:
+ CxuiEvent(const QString &type, const QString &value);
+
+ QTime mTime;
+ QString mType;
+ QString mValue;
+ };
+
+ QLinkedList mEvents;
+ int mSize;
+ QString mName;
+};
+
+#endif // CXUIEVENTLOG_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuifullscreenpopup.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuifullscreenpopup.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXUFULLSCREENPOPUP_H
+#define CXUFULLSCREENPOPUP_H
+
+
+#include
+#include
+
+class QString;
+class QGraphicsScene;
+
+/*!
+* Class for showing simple full screen popups.
+*/
+class CxuiFullScreenPopup : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ static CxuiFullScreenPopup *create(QGraphicsScene *scene,
+ const QString &message,
+ const QString &action = QString());
+ ~CxuiFullScreenPopup();
+
+ void handleMousePress();
+ void handleMouseRelease();
+
+public slots:
+ void show();
+ void hide();
+
+private:
+ qreal topZValue() const;
+ void setScene(QGraphicsScene *scene);
+
+private:
+ CxuiFullScreenPopup();
+
+ /*!
+ * Internal custom DocML loader.
+ */
+ class CxuiFullScreenPopupLoader : public HbDocumentLoader
+ {
+ public:
+ CxuiFullScreenPopupLoader();
+ QObject *createObject(const QString& type, const QString &name);
+ };
+
+private:
+ QGraphicsScene *mScene;
+ bool mPopupShown;
+
+ Q_DISABLE_COPY(CxuiFullScreenPopup)
+};
+
+#endif // CXUFULLSCREENPOPUP_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h
--- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -20,42 +20,50 @@
#include
#include
#include
-#include
#include
+#include "cxuiview.h"
class QGraphicsRectItem;
class HbMainWindow;
class HbAction;
class HbLabel;
+class ShareUi;
class CxeEngine;
class CxuiDocumentLoader;
-
+class ThumbnailManager;
/**
* Post-capture view
*/
-class CxuiPostcaptureView : public HbView
+class CxuiPostcaptureView : public CxuiView
{
Q_OBJECT
public:
CxuiPostcaptureView(QGraphicsItem *parent = 0);
virtual ~CxuiPostcaptureView();
- void construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader);
+ void construct(HbMainWindow *mainwindow, CxeEngine *engine,
+ CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void restoreActivity(const QString &activityId, const QVariant &data);
+ void saveActivity();
+ void clearActivity();
+
signals:
void changeToPrecaptureView();
public slots:
+ void enterStandby();
+ void exitStandby();
void handleCaptureKeyPressed();
void handleAutofocusKeyPressed();
protected:
bool eventFilter(QObject *object, QEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
void showEvent(QShowEvent *event);
void hideEvent(QHideEvent *event);
void showToolbar();
@@ -66,42 +74,35 @@
protected slots:
void goToPrecaptureView();
void stopViewfinder();
- void releaseCamera();
- // Control visibility
- void hideControls();
- void showControls();
- void toggleControls();
+ void hideToolbar();
// toolbar actions
- void launchPhotosApp();
void select();
void launchShare();
void playVideo();
void showDeleteNote();
- void launchVideosApp();
- void handleDeleteDialogClosed(HbAction *action);
+ void handleDeleteDialogClosed(int action);
private:
- void launchNotSupportedNotification();
QString getCurrentFilename();
+ void startTimers();
+ void startPostcaptureTimer();
+ void startReleaseTimers();
+
private slots:
- void startTimers();
- void handleFocusLost();
+ void handleThumbnailReady(QPixmap thumbnail, void *clientData, int id, int errorCode);
private: // data
- HbMainWindow *mMainWindow; // not own
- CxeEngine *mEngine; // not own
- CxuiDocumentLoader *mDocumentLoader; // not own
HbToolBar *mStillToolbar;
HbToolBar *mVideoToolbar;
HbToolBar *mEmbeddedToolbar;
QGraphicsRectItem *mBackgroundItem;
HbLabel *mImageLabel;
- QTimer mHideControlsTimeout;
+ ShareUi *mShareUi;
/**
* Timer used to stop viewfinder after a delay if the user remains in
@@ -125,12 +126,15 @@
*/
QTimer mPostcaptureTimer;
- bool mControlsVisible;
+ bool mTimersStarted;
- bool mTimersStarted;
-
XQApplicationManager mAppManager;
+ bool mDeleteNoteOpen;
+
+ QString mFilename;
+
+ ThumbnailManager *mThumbnailManager;
};
#endif // CXUIPOSTCAPTUREVIEW_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h
--- a/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -25,8 +25,10 @@
#include
#include "cxezoomcontrol.h"
+#include "cxegeotaggingtrail.h"
#include "cxeviewfindercontrol.h"
#include "cxuidisplaypropertyhandler.h"
+#include "cxuiview.h"
class HbAction;
@@ -46,11 +48,13 @@
class HbToolBarExtension;
class HbWidget;
class CxuiZoomSlider;
+class CxuiFullScreenPopup;
+
/**
* Pre-capture view
*/
-class CxuiPrecaptureView : public HbView
+class CxuiPrecaptureView : public CxuiView
{
Q_OBJECT
@@ -61,96 +65,26 @@
public:
- /**
- * Construct-method handles initialisation tasks for this class.
- * @param mainwindow
- * @param engine
- * @param documentLoader
- * @param keyHandler
- */
- virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
+ virtual void construct(HbMainWindow *mainWindow,
+ CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler);
-
- /**
- * Loads widgets that are not part of the default section in layouts xml.
- * Widgets are created at the time they are first loaded.
- */
- virtual void loadWidgets() = 0;
- void prepareWindow();
- virtual void updateOrientation(Qt::Orientation orient) = 0;
-
-public slots:
-
- void releaseCamera();
- void initCamera();
- void requestCameraSwitch();
-
- // whenever a setting is changed on the engine side, an icon might need updating
- // connects to the settingValueChanged signal of CxeSettings
- virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
-
-protected slots:
-
- // Key events
- virtual void handleAutofocusKeyPressed();
-
- // Camera / Engine
- void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error);
- void handleZoomLevelChange(int);
- void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error);
- virtual void handleFocusGained();
- virtual void handleFocusLost() = 0;
- // UI: Zoom slider change notification
- void zoomTo(int value);
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
- // Control visibility of all UI items at the same time: toolbar, zoom and titlepane items
- virtual void hideControls();
- virtual void showControls();
- void toggleControls();
-
- void disableControlsTimeout();
-
- void toggleZoom();
- void hideToolbar();
-
- void launchPhotosApp();
- void launchVideosApp();
-
- // Settings related
- void launchNotSupportedNotification();
- void launchDiskFullNotification();
- void showSettingsGrid();
- void hideSettingsGrid();
- void launchSliderSetting();
- void prepareToShowDialog(HbAction *action);
- void prepareToCloseDialog(HbAction *action);
-
-protected:
-
- virtual void initializeSettingsGrid() = 0;
-
- void hideZoom();
- void showZoom();
- void hideIndicators();
- void showIndicators();
- void showEvent(QShowEvent *event);
- void hideEvent(QHideEvent *event);
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- virtual void showToolbar();
- bool eventFilter(QObject *object, QEvent *event);
- void launchSettingsDialog(QObject *action);
- bool isPostcaptureOn() const;
- void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
- QString getSettingItemIcon(const QString &key, QVariant value);
- void updateQualityIcon();
- void createWidgetBackgroundGraphic(HbWidget *widget,
- const QString &graphicName,
- HbFrameDrawer::FrameType frameType =
- HbFrameDrawer::NinePieces);
+ virtual bool isStandbyModeSupported() const;
+ /**
+ * Loads widgets that are not part of the default section in layouts xml.
+ * Widgets are created at the time they are first loaded.
+ */
+ virtual void loadWidgets() = 0;
signals:
+ /*!
+ * Signal that view is ready to be used.
+ */
+ void viewReady();
+
// signals to switch to post/pre-capture view.
void changeToPostcaptureView();
void changeToPrecaptureView();
@@ -163,32 +97,80 @@
void stopStandbyTimer();
// signal to report error to ErrorManager for further actions.
- void reportError(CxeError::Id errorId);
- void showScenesView();
+ void errorEncountered(CxeError::Id id);
+
+public slots:
+
+ void initCamera();
+ void requestCameraSwitch();
+
+ // whenever a setting is changed on the engine side, an icon might need updating
+ // connects to the settingValueChanged signal of CxeSettings
+ virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
+
+ // From CxuiView
+ virtual void enterStandby();
+ virtual void exitStandby();
+
+protected slots:
+
+ // Key events
+ virtual void handleAutofocusKeyPressed();
+
+ // Camera / Engine
+ void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error);
+ void handleZoomLevelChange(int);
+ void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error);
+ // UI: Zoom slider change notification
+ void zoomTo(int value);
+
+ void disableControlsTimeout();
+
+ void toggleZoom();
+
+ // Settings related
+ void showSettingsGrid();
+ void hideSettingsGrid();
+ void launchSliderSetting();
+ void prepareToShowDialog(HbAction *action);
+ void prepareToCloseDialog(HbAction *action);
+ void updateLocationIndicator(CxeGeoTaggingTrail::State newState, CxeError::Id error);
+
+private slots:
+ void disableGeotaggingDisclaimer();
+ void launchGeoTaggingSetting();
protected:
- CxeEngine *mEngine; // not own
- HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
- HbMainWindow *mMainWindow; // not own
- CxuiDocumentLoader *mDocumentLoader; // not own
- CxuiDisplayPropertyHandler *mDisplayHandler;
- bool mControlsVisible;
- QTimer mHideControlsTimeout;
- CxuiZoomSlider *mSlider; // zoom slider, not own, owned by the graphics scene
- HbToolBar *mToolBar; // not own, owned by the graphics scene
- HbToolBarExtension *mSettingsGrid;
- bool mZoomVisible;
- bool mWidgetsLoaded;
- CxuiSettingDialog *mSettingsDialog;
- CxuiSettingRadioButtonList *mSettingsDialogList;
- CxuiCaptureKeyHandler *mKeyHandler;
- HbLabel *mQualityIcon;
- HbWidget *mIndicators;
+ void toggleControls();
+ virtual void initializeSettingsGrid() = 0;
+ void showEvent(QShowEvent *event);
+ void hideEvent(QHideEvent *event);
+ bool eventFilter(QObject *object, QEvent *event);
+ void launchSettingsDialog(QObject *action);
+ virtual bool isPostcaptureOn() const = 0;
+ void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
+ QString getSettingItemIcon(const QString &key, QVariant value);
+ virtual void updateQualityIcon() = 0;
+ virtual void updateSceneIcon(const QString& sceneId) = 0;
+ void launchGeoTaggingDisclaimerDialog();
private:
CxuiSettingDialog* createSettingsDialog();
CxuiSettingDialog* createSliderSettingsDialog();
QPointF getDialogPosition();
+
+protected:
+ HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
+ CxuiDisplayPropertyHandler *mDisplayHandler;
+ HbToolBarExtension *mSettingsGrid;
+ bool mWidgetsLoaded;
+ CxuiSettingDialog *mSettingsDialog;
+ CxuiSettingRadioButtonList *mSettingsDialogList;
+ HbLabel *mQualityIcon;
+ HbLabel *mGeoTaggingIndicatorIcon;
+ HbLabel *mFaceTrackingIcon;
+ CxuiFullScreenPopup *mStandbyPopup;
+
private:
HbLabel *mSettingsDialogHeading;
@@ -197,7 +179,7 @@
CxuiSettingSlider *mSettingsSlider;
CxuiSettingsInfo *mSettingsInfo;
-
+
HbAction *mSettingsDialogOkAction;
HbAction *mSliderSettingsDialogOkAction;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h
--- a/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -31,6 +31,7 @@
#include "cxuisettingsinfo.h"
#include "cxuienums.h"
#include "cxeengine.h"
+#include "cxuiview.h"
class CxuiCaptureKeyHandler;
class CxuiDocumentLoader;
@@ -45,7 +46,7 @@
*/
-class CxuiSceneModeView : public HbView
+class CxuiSceneModeView : public CxuiView
{
Q_OBJECT
@@ -59,11 +60,12 @@
void construct(HbMainWindow *mainwindow,
CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler = NULL);
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
void loadDefaultWidgets();
void loadBackgroundImages();
-
+ void saveActivity();
signals:
void viewCloseEvent();
@@ -76,28 +78,21 @@
void finishScenesTransition();
void handleOkButtonPress();
void handleCancelButtonPress();
- void releaseCameraHw();
protected:
void showEvent(QShowEvent *event);
+ bool allowShowControls() const;
+ bool isFeedbackEnabled() const;
private:
QString backgroundForScene(const QString& sceneId);
void startBackgroundTransition();
- void createWidgetBackgroundGraphic(HbWidget *widget,
- const QString &graphicName,
- HbFrameDrawer::FrameType frameType =
- HbFrameDrawer::NinePieces);
void connectSignals();
void closeView();
private:
- HbMainWindow *mMainWindow; //not own
CxuiSettingsInfo *mSettingsInfo;
- CxeEngine *mEngine; //not own
- CxuiDocumentLoader *mDocumentLoader; //not own
- CxuiCaptureKeyHandler *mCaptureKeyHandler;
HbLabel* mScenesBackground;
HbLabel* mScenesBackground2;
@@ -106,6 +101,7 @@
HbPushButton* mScenesOkButton;
HbPushButton* mScenesCancelButton;
HbWidget* mScenesContainer;
+ HbLabel *mScenesHeading;
QTimer mCameraReleaseTimer;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiselftimer.h
--- a/camerauis/cameraxui/cxui/inc/cxuiselftimer.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiselftimer.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -19,6 +19,8 @@
#include
#include
+#include
+#include
class CxeSettings;
class CxuiDocumentLoader;
@@ -38,6 +40,7 @@
bool isEnabled();
bool isOngoing();
+ int getTimeout() const;
signals:
void timerFinished();
void cancelled();
@@ -45,17 +48,18 @@
public slots:
void changeTimeOut(int seconds);
void startTimer();
- void reset();
+ void reset(bool update = true);
void cancel();
+ void enableSound(long int uid, unsigned long int key, QVariant value);
protected slots:
void timeout();
private:
- void reset(bool update);
void updateWidgets();
void showWidgets();
void hideWidgets();
+ void playSound();
private:
Q_DISABLE_COPY(CxuiSelfTimer)
@@ -74,6 +78,8 @@
// settings, not own
CxeSettings &mSettings;
+ QSound mSound;
+ bool mUseSound;
};
#endif // CXUISELFTIMER_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h
--- a/camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -43,7 +43,7 @@
explicit CxuiSettingRadioButtonList(QGraphicsItem *parent, CxeEngine *engine);
void init(CxUiSettings::RadioButtonListParams *data);
-
+ void setOriginalSelectedItemByValue(const QVariant &value);
signals:
void valueSelected(int value);
void selectionCommitted();
@@ -55,10 +55,6 @@
protected slots:
void handleItemSelected(int index);
-protected:
- void showEvent(QShowEvent *event); // From QGraphicsWidget
- virtual void initOriginalSelectedItem();
-
private:
// helper methods
void setSettingId(const QString &id);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuisettingsinfo.h
--- a/camerauis/cameraxui/cxui/inc/cxuisettingsinfo.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuisettingsinfo.h Thu Jul 15 01:55:05 2010 +0300
@@ -18,6 +18,11 @@
#ifndef CXUISETTINGSINFO_H
#define CXUISETTINGSINFO_H
+/*!
+* @file
+* @brief CxUi settings related classes and constants.
+*/
+
#include
#include
#include
@@ -31,12 +36,23 @@
class CxeEngine;
class CxuiSettingXmlReader;
+/*!
+* @namespace CxUiSettings
+* @brief Namespace for UI settings related constants and classes.
+*/
namespace CxUiSettings
{
- // Setting mappings
+ /*! Image setting definitions. */
static const char *IMAGE_SETTING_MAPPING_FILE = ":/xml/image_setting.xml";
+ /*! Video setting definitions. */
static const char *VIDEO_SETTING_MAPPING_FILE = ":/xml/video_setting.xml";
+ /*!
+ * Character used to separate lines within a single string.
+ * E.g. SettingItem::mItem can be split with this character to get multi-line item.
+ */
+ static const char NEW_LINE_CHAR = '\n';
+
struct SettingItem
{
QString mItem;
@@ -98,10 +114,11 @@
void getVideoQualitySettings(CxUiSettings::RadioButtonListParams &settings);
void handleQualitySettings(const QString &key, CxUiSettings::RadioButtonListParams &settings);
-private slots:
- void initForCurrentMode(CxeError::Id status);
+private:
+ void checkMode();
private: // data members
+ int mMode;
CxeEngine *mEngine;
CxuiSettingXmlReader *mXmlReader;
};
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuistandby.h
--- a/camerauis/cameraxui/cxui/inc/cxuistandby.h Thu May 13 21:30:19 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef CXUISTANDBY_H
-#define CXUISTANDBY_H
-
-#include
-
-// constants
-
-const int CXUI_STANDBY_CAMERA_TIMEOUT = 60000; // 60 seconds
-
-// forward declaration
-class HbDialog;
-class QTimer;
-class CxeEngine;
-class CxuiDocumentLoader;
-class CxuiCaptureKeyHandler;
-
-
-/*
-* class CxuiStandby continuously monitors for releasing camera when there are no user actions
-* for a specific time period. Timer is used to release the camera HW and switching to stanby mode
-* after a delay.Releasing the camera improves power efficiency, but creates additional latency
-* when returning to pre-capture view.
-*/
-class CxuiStandby : public QObject
-{
- Q_OBJECT
-
-public:
- CxuiStandby(CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader, CxeEngine *engine);
- ~CxuiStandby();
-
-signals:
-
- /*
- * signal to prepare for standby
- */
- void aboutToEnterStandby();
-
- /*
- * signal to prepare UI for exiting standby
- */
- void aboutToExitStandby();
-
-public slots:
-
- /*
- * starts standby timer
- */
- void startTimer();
-
- /*
- * stops standby timer
- */
- void stopTimer();
-
- /*
- * handles focus gain event
- */
- bool handleMouseEvent();
-
-private slots:
-
- void dismissStandby();
- void toStandby();
-
-private: // helper methods
-
- bool proceedToStandy();
- bool eventFilter(QObject *object, QEvent *event);
-
-private:
-
- CxuiCaptureKeyHandler &mKeyHandler;
- CxuiDocumentLoader *mDocumentLoader; // not own
- CxeEngine *mEngine; // not own
- HbDialog *mStandbyPopup;
- QTimer *mStandbyTimer;
- bool mStandbyDialogVisible;
-};
-
-#endif // CXUISTANDBY_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h
--- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -37,11 +37,10 @@
class CxuiSelfTimerRadioButtonList;
class HbToolBarExtension;
class HbWidget;
+
/**
* Pre-capture view for still image mode
*/
-
-
class CxuiStillPrecaptureView : public CxuiPrecaptureView
{
Q_OBJECT
@@ -53,34 +52,23 @@
public:
- /**
- * Construct-method handles initialisation tasks for this class. Needs to be called
- * before the instance of this class is used.
- * @param mainwindow
- * @param engine
- * @param documentLoader
- * @param keyHandler
- */
- virtual void construct(HbMainWindow *mainwindow, CxeEngine *engine,
- CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler = NULL);
+ virtual void construct(HbMainWindow *mainwindow,
+ CxeEngine *engine,
+ CxuiDocumentLoader *documentLoader,
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
- /**
- * Loads default widgets in layouts xml.
- */
virtual void loadDefaultWidgets();
-
- /**
- * Loads widgets that are not part of the default section in layouts xml.
- * Widgets are created at the time they are first loaded.
- */
virtual void loadWidgets();
- void updateOrientation(Qt::Orientation orientation);
+ void restoreActivity(const QString &activityId, const QVariant &data);
+ void saveActivity();
+ void clearActivity();
protected:
void showEvent(QShowEvent *event);
- virtual void showToolbar();
+ virtual bool allowShowControls() const;
public slots:
@@ -91,14 +79,15 @@
// connects to the sceneChanged signal of CxeSettings
void handleSceneChanged(CxeScene &scene);
+ // From CxuiPrecaptureView
+ virtual void enterStandby();
+
protected slots:
void focusAndCapture();
void capture();
void setCapturePending();
void goToVideo();
- void launchSceneModesPopup();
-
// Key events
void handleCaptureKeyPressed();
void handleAutofocusKeyPressed();
@@ -110,27 +99,21 @@
void handleStillCaptureStateChanged(CxeStillCaptureControl::State newState, CxeError::Id error);
void handleSnapshot(CxeError::Id error);
- /**
- * Signal used to reset mCapturePending after a short timeout. If the image
- * cannot be captured within a given time of the key press, it is better to cancel
- * the whole operation.
- */
void resetCapturePendingFlag();
- void showControls();
-
- /**
- * Application focus slots are called if focus state is changed.
- * Camera is released or reserved according to new state.
- */
- void handleFocusLost();
- void handleFocusGained();
void launchSetting();
void updateImagesLeftLabel();
protected:
void initializeSettingsGrid();
+ bool isPostcaptureOn() const;
+ void updateSceneIcon(const QString& sceneId);
+ void updateQualityIcon();
void closeDialogs();
+ void updateFaceTrackingIcon();
+
+private:
+ void reloadIndicatorWidgets();
protected:
CxuiSelfTimer *mSelfTimer;
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h
--- a/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -45,35 +45,25 @@
public:
- /**
- * Construct-method handles initialisation tasks for this class.
- * @param mainwindow
- * @param engine
- * @param documentLoader
- * @param keyHandler
- */
void construct(HbMainWindow *mainwindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler = NULL);
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
- /**
- * Loads widgets that are needed right from the start.
- */
virtual void loadDefaultWidgets();
- /**
- * Loads widgets that are not part of the default section in layouts xml.
- * Widgets are created at the time they are first loaded.
- */
virtual void loadWidgets();
- void updateOrientation(Qt::Orientation orientation);
+ void restoreActivity(const QString &activityId, const QVariant &data);
+ void saveActivity();
+ void clearActivity();
public slots:
// from CxuiPrecaptureView
virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
+ void handleSceneChanged(CxeScene &scene);
void handleQuitClicked();
protected slots:
@@ -82,28 +72,13 @@
void record();
void pause();
void stop();
- void stopAndPrepareNewVideo();
void goToStill();
void showEvent(QShowEvent *event);
void handleVideoStateChanged(CxeVideoCaptureControl::State newState, CxeError::Id error);
void handleCaptureKeyPressed();
void prepareNewVideo(CxeError::Id error = CxeError::None);
- void toggleLight();
void launchVideoScenePopup();
void launchSetting();
-
- /**
- * Application focus slots are called if focus state is changed.
- * Recording is stopped and camera released or reserved according to new state.
- */
- void handleFocusLost();
-
- /**
- * Battery almost empty warning signal.
- * Need to stop ongoing recording.
- */
- void handleBatteryEmpty();
-
void updateTimeLabels();
// from CxuiPrecaptureView
@@ -114,15 +89,24 @@
void setVideoTime(HbLabel* label, int time);
bool getElapsedTime();
void getRemainingTime();
- virtual void showToolbar();
+ bool allowShowControls() const;
+ bool isFeedbackEnabled() const;
+ void showToolbar();
void disableFeedback();
void enableFeedback();
void initializeSettingsGrid();
+ bool isPostcaptureOn() const;
+ void updateSceneIcon(const QString& sceneId);
+ void updateQualityIcon();
void setRecordingItemsVisibility(bool visible);
// from QObject
bool eventFilter(QObject *object, QEvent *event);
+
+private:
+ void reloadIndicatorWidgets();
+
protected:
QTimer mElapsedTimer;
int mTimeElapsed;
@@ -132,9 +116,9 @@
HbLabel *mRemainingTimeText; // not own
HbLabel *mRecordingIcon; // not own
HbAction *mGoToStillAction; // not own
- HbToolBar *mToolBarIdle; // not own
- HbToolBar *mToolBarRec; // not own
- HbToolBar *mToolBarPaused; // not own
+ HbToolBar *mToolbarIdle; // not own
+ HbToolBar *mToolbarRec; // not own
+ HbToolBar *mToolbarPaused; // not own
HbDialog *mVideoScenePopup;
CxeVideoCaptureControl *mVideoCaptureControl;
HbMenu *mMenu; // own
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiview.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuiview.h Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is a header file for a CxuiView class
+*
+*/
+
+#ifndef CXUIVIEW_H
+#define CXUIVIEW_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class CxuiDocumentLoader;
+class CxuiCaptureKeyHandler;
+class CxuiZoomSlider;
+class CxuiCaptureKeyHandler;
+class CxeEngine;
+class HbWidget;
+class HbActivityManager;
+
+// CONSTANTS
+const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds
+
+/**
+ * A base class for all views in the Camera UI
+ * The class is for deriving only
+ */
+class CxuiView : public HbView
+{
+ Q_OBJECT
+
+public:
+ CxuiView(QGraphicsItem *parent = 0);
+ virtual ~CxuiView();
+
+ virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
+ CxuiDocumentLoader *documentLoader,
+ CxuiCaptureKeyHandler * keyHandler,
+ HbActivityManager *activityManager);
+
+public:
+ virtual bool isStandbyModeSupported() const;
+ virtual void updateOrientation(Qt::Orientation orientation);
+
+ virtual void restoreActivity(const QString &activityId, const QVariant &data);
+ virtual void saveActivity();
+ virtual void clearActivity();
+
+protected:
+ virtual bool allowShowControls() const;
+ virtual bool isFeedbackEnabled() const;
+ virtual void toggleControls();
+ virtual void showToolbar();
+ virtual void hideZoom();
+ virtual void showZoom();
+ virtual void hideIndicators();
+ virtual void showIndicators();
+ virtual void createWidgetBackgroundGraphic(HbWidget *widget,
+ const QString &graphicName,
+ HbFrameDrawer::FrameType frameType =
+ HbFrameDrawer::NinePieces);
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+public slots:
+ virtual void enterStandby();
+ virtual void exitStandby();
+
+protected slots:
+ virtual void launchNotSupportedNotification();
+ virtual void launchPhotosApp();
+ virtual void launchVideosApp();
+ virtual void releaseCamera();
+
+ virtual void launchScenesView();
+
+ // Control visibility of all UI items at the same time: toolbar, zoom and titlepane items
+ virtual void hideControls();
+ virtual void showControls();
+
+ virtual void hideToolbar();
+
+
+signals:
+ void viewCloseEvent();
+ void showScenesView();
+
+protected: //common data
+ HbMainWindow *mMainWindow; // not own
+ CxeEngine *mEngine; // not own
+ CxuiDocumentLoader *mDocumentLoader; // not own
+ CxuiCaptureKeyHandler* mCaptureKeyHandler;
+
+ CxuiZoomSlider *mSlider; // zoom slider, not own, owned by the graphics scene
+ HbToolBar *mToolbar; // not own, owned by the graphics scene
+ HbWidget *mIndicators;
+
+ bool mControlsVisible;
+ bool mZoomVisible;
+ QTimer mHideControlsTimeout;
+
+ HbInstantFeedback mControlsFeedback;
+ HbActivityManager *mActivityManager;
+};
+
+#endif // CXUIVIEW_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuiviewmanager.h
--- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Thu Jul 15 01:55:05 2010 +0300
@@ -24,22 +24,17 @@
#include "cxeviewfindercontrol.h"
#include "cxenamespace.h"
#include "cxeerror.h"
-#include "cxuiapplicationframeworkmonitor.h"
-
+#include "cxuiapplicationstate.h"
class QGraphicsSceneMouseEvent;
class HbMainWindow;
class CxuiApplication;
class CxuiCaptureKeyHandler;
class CxuiPrecaptureView;
-class CxuiStillPrecaptureView;
-class CxuiVideoPrecaptureView;
-class CxuiPostcaptureView;
class CxeEngine;
class CxuiDocumentLoader;
-class CxuiErrorManager; // class that handles all errors in ui.
-class CxuiStandby;
-class CxuiSceneModeView;
+class CxuiErrorManager;
+class CxuiView;
class CxuiViewManager : public QObject
{
@@ -49,83 +44,57 @@
CxuiViewManager(CxuiApplication &application, HbMainWindow &mainWindow, CxeEngine &engine);
~CxuiViewManager();
- void prepareWindow();
-
- /**
- * Get a pointer to the document loader instance.
- */
- CxuiDocumentLoader* documentLoader();
-
public slots:
void changeToPostcaptureView();
void changeToPrecaptureView();
void switchCamera();
- void createPostcaptureView();
void showScenesView();
private slots:
void toForeground();
- void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
- void handleBatteryEmpty();
- void aboutToLooseFocus();
- void aboutToGainFocus();
+ void handleApplicationStateChanged(CxuiApplicationState::State newState,
+ CxuiApplicationState::State oldState);
+ void startStandbyTimer();
+ void stopStandbyTimer();
signals:
- void focusGained();
- void focusLost();
- void batteryEmpty();
- void disableStandbyTimer();
- void startStandbyTimer();
+ void normalStateEntered();
+ void normalStateExited();
+ void standbyExitRequested();
protected:
bool eventFilter(QObject *object, QEvent *event);
private:
- void createStillPrecaptureView();
- void createVideoPrecaptureView();
+ CxuiView *currentView() const;
+ void initStartupView();
+ CxuiView *createView(const QString &viewName);
CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera);
- void createSceneModesView();
-
- /*
- * connects all necessary signals for precapture view
- */
+ void connectSignals(QObject *view);
+ void disconnectSignals(QObject *view = NULL);
void connectPreCaptureSignals();
+ void connectPostCaptureSignals();
+ void connectSceneModeSignals();
+ void connectCaptureKeySignals();
- /*
- * disconnects signals
- */
- void disconnectSignals();
-
- /*
- * connects all necessary signals for postcapture view
- */
- void connectPostCaptureSignals();
-
-
- /*
- * connects capture key handler signals to the current view.
- */
- void connectCaptureKeySignals();
+ void handleExitingNormalState();
+ void clearAllActivities();
private:
//data
CxuiApplication &mApplication;
HbMainWindow &mMainWindow;
- CxuiStillPrecaptureView *mStillPrecaptureView;
- CxuiVideoPrecaptureView *mVideoPrecaptureView;
- CxuiPostcaptureView *mPostcaptureView;
+ QMap mViews;
+ QMap mDocmlFilesByView;
CxeEngine &mEngine;
CxuiCaptureKeyHandler *mKeyHandler;
- CxuiApplicationFrameworkMonitor *mApplicationMonitor;
-
-private:
CxuiDocumentLoader *mCameraDocumentLoader;
- CxuiStandby *mStandbyHandler;
+ CxuiApplicationState *mApplicationState;
CxuiErrorManager *mErrorManager;
- CxuiSceneModeView *mSceneModeView;
+ QTimer mStandbyTimer;
};
#endif // CXUIVIEWMANAGER_H
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/inc/cxuizoomslider.h
--- a/camerauis/cameraxui/cxui/inc/cxuizoomslider.h Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuizoomslider.h Thu Jul 15 01:55:05 2010 +0300
@@ -30,6 +30,9 @@
explicit CxuiZoomSlider(QGraphicsItem *parentItem = NULL);
~CxuiZoomSlider();
+public:
+ void addZoomButtons();
+
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/cxui.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/layouts/cxui.css Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,73 @@
+/*
+Mode/setting indicators in still precapture
+All HbLabel icons and text inside indicatorContainer
+*/
+HbWidget#indicatorContainer > HbLabel::icon
+{
+color: var(qtc_popup_trans_normal);
+}
+HbWidget#indicatorContainer > HbLabel::text
+{
+color: var(qtc_popup_trans_normal);
+}
+/*
+Selftimer
+All HbLabel text and icons inside still_precapture_selftimer_container
+*/
+HbWidget#still_precapture_selftimer_container > HbLabel::icon
+{
+color: var(qtc_popup_trans_normal);
+}
+HbWidget#still_precapture_selftimer_container > HbLabel::text
+{
+color: var(qtc_popup_trans_normal);
+}
+/*
+Images left
+All HbLabel text and icons inside images_left_container
+*/
+HbWidget#images_left_container > HbLabel::text
+{
+color: var(qtc_popup_trans_normal);
+}
+/*
+Mode/setting indicators
+All HbLabel icons and text inside video_indicator_container_top
+*/
+HbWidget#video_indicator_container_top > HbLabel::icon
+{
+color: var(qtc_popup_trans_normal);
+}
+HbWidget#video_indicator_container_top > HbLabel::text
+{
+color: var(qtc_popup_trans_normal);
+}
+/*
+Bottom indicators (recording icon, time elapsed & left)
+HbLabels defined separately since they should be colored differently
+*/
+/* Elapsed time is a special case, it will always be red */
+HbLabel#video_elapsed_time::text
+{
+color: red;
+}
+HbLabel#video_remaining_time::text
+{
+color: var(qtc_popup_trans_normal);
+}
+HbWidget#video_indicator_container_bottom > HbLabel::icon
+{
+color: var(qtc_popup_trans_normal);
+}
+/*
+Zoom sliders
+Decrement and increase icons both
+*/
+CxuiZoomSlider::decrement-icon
+{
+color: var(qtc_popup_trans_normal);
+}
+CxuiZoomSlider::increment-icon
+{
+color: var(qtc_popup_trans_normal);
+}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/errornote_popup.docml
--- a/camerauis/cameraxui/cxui/layouts/errornote_popup.docml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/errornote_popup.docml Thu Jul 15 01:55:05 2010 +0300
@@ -1,11 +1,15 @@
-
+
+
+
+
+
-
+
@@ -24,14 +28,12 @@
-
+
-
-
-
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/full_screen_popup.docml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/layouts/full_screen_popup.docml Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/image_setting.xml
--- a/camerauis/cameraxui/cxui/layouts/image_setting.xml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/image_setting.xml Thu Jul 15 01:55:05 2010 +0300
@@ -19,8 +19,8 @@
setting_icon="">
-
-
+
+
@@ -32,7 +32,7 @@
-
+
@@ -41,7 +41,7 @@
preview="0"
type="SingleLineListBox"
setting_icon="">
-
+
@@ -70,7 +70,6 @@
-
@@ -80,25 +79,35 @@
type="SingleLineListBox"
setting_icon="">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -115,6 +124,16 @@
+
+
+
+
+
+
\ No newline at end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/setting_scenemode.docml
--- a/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
-
+
@@ -15,20 +15,17 @@
-
-
-
-
+
+
-
-
+
+
-
@@ -40,13 +37,13 @@
-
-
+
-
-
+
+
+
@@ -62,6 +59,7 @@
+
@@ -69,11 +67,10 @@
-
-
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/setting_slider.docml
--- a/camerauis/cameraxui/cxui/layouts/setting_slider.docml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/setting_slider.docml Thu Jul 15 01:55:05 2010 +0300
@@ -6,7 +6,7 @@
@@ -15,8 +15,9 @@
+
-
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/standbymode_popup.docml
--- a/camerauis/cameraxui/cxui/layouts/standbymode_popup.docml Thu May 13 21:30:19 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/video_setting.xml
--- a/camerauis/cameraxui/cxui/layouts/video_setting.xml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/video_setting.xml Thu Jul 15 01:55:05 2010 +0300
@@ -8,10 +8,10 @@
-
-
-
-
+
+
+
+
@@ -37,23 +37,32 @@
-
-
+
-
+
+
+
+
+
+
+
-
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/view_postcapture.docml
--- a/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Thu Jul 15 01:55:05 2010 +0300
@@ -77,7 +77,6 @@
-
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/view_still_precapture.docml
--- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:55:05 2010 +0300
@@ -1,5 +1,5 @@
-
+
@@ -14,18 +14,6 @@
-
-
-
-
@@ -33,9 +21,10 @@
-
+
@@ -54,23 +43,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -80,21 +93,16 @@
+
+
-
+
-
-
-
-
-
-
-
-
+
@@ -105,14 +113,14 @@
-
-
-
-
+
+
+
+
-
+
@@ -133,6 +141,8 @@
+
+
@@ -140,6 +150,9 @@
+
+
+
@@ -187,8 +200,6 @@
-
-
@@ -202,16 +213,13 @@
+
+
-
-
-
-
-
-
+
@@ -220,46 +228,40 @@
-
+
-
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
-
-
-
+
-
+
\ No newline at end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/layouts/view_video_precapture.docml
--- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:55:05 2010 +0300
@@ -1,11 +1,8 @@
-
+
-
@@ -22,9 +19,6 @@
-
@@ -41,15 +35,6 @@
-
-
-
@@ -57,35 +42,47 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
@@ -99,18 +96,11 @@
-
+
-
-
-
-
-
-
-
-
+
@@ -121,23 +111,21 @@
-
-
-
-
+
+
+
-
-
-
+
+
-
+
@@ -145,9 +133,8 @@
-
-
-
+
+
@@ -159,7 +146,7 @@
-
+
@@ -180,8 +167,6 @@
-
-
@@ -203,18 +188,16 @@
+
+
-
-
-
-
@@ -222,37 +205,33 @@
-
-
+
+
+
+
@@ -263,12 +242,37 @@
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
@@ -280,31 +284,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuiapplication.cpp
--- a/camerauis/cameraxui/cxui/src/cxuiapplication.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplication.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -33,7 +33,7 @@
*/
CxuiApplication::CxuiApplication(int &argc, char *argv[])
- : HbApplication(argc, argv, Hb::NoSplash)
+ : HbApplication(argc, argv, Hb::SplashFixedHorizontal)
{
CX_DEBUG_IN_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp
--- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -28,13 +28,7 @@
CxuiApplicationFrameworkMonitor::CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings &settings)
{
CX_DEBUG_ENTER_FUNCTION();
- p = new CxuiApplicationFrameworkMonitorPrivate(application, settings);
-
- connect(p, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)),
- this, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)));
- connect(p, SIGNAL(batteryEmpty()), this, SIGNAL(batteryEmpty()));
-
-
+ p = new CxuiApplicationFrameworkMonitorPrivate(this, application, settings);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -57,4 +51,13 @@
return p->foregroundState();
}
+/*!
+* Is USB connected in mass memory mode?
+* @return True if USB mass memory mode is active and connected, false otherwise.
+*/
+bool CxuiApplicationFrameworkMonitor::isUsbMassMemoryModeActive() const
+{
+ return p->isUsbMassMemoryModeActive();
+}
+
// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp
--- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -25,14 +25,19 @@
#include
#include // keyguard state
#include // battery status
+#include // usb status
+#include
+#include
#include
#include
#include
#include
+
#endif // Q_OS_SYMBIAN
#include "cxutils.h"
+#include "cxuieventlog.h"
#include "cxuiapplication.h"
#include "cxesettings.h"
#include "cxuiapplicationframeworkmonitorprivate.h"
@@ -64,6 +69,11 @@
return convertTDesC2QString(name);
}
+ inline QString bitString(int number, char fill = '0', int width = 32)
+ {
+ return QString::number(number, 2).rightJustified(width, fill);
+ }
+
//!@todo: Avkon UIDs not needed once device dialogs fully implemented in Orbit.
// AknCapServer
@@ -75,6 +85,10 @@
static const unsigned int UID_TASKSWITCHER = 0x2002677D;
// Dialog server
static const unsigned int UID_DIALOGAPPSERVER = 0x20022FC5;
+
+ // Log event types
+ static const char *EVENT_USB = "usb";
+ static const char *EVENT_FOREGROUND = "foreground";
}
#endif // Q_OS_SYMBIAN
@@ -82,8 +96,11 @@
/*!
* Constructor
*/
-CxuiApplicationFrameworkMonitorPrivate::CxuiApplicationFrameworkMonitorPrivate(CxuiApplication &application, CxeSettings& settings)
- : mApplication(application),
+CxuiApplicationFrameworkMonitorPrivate::CxuiApplicationFrameworkMonitorPrivate(CxuiApplicationFrameworkMonitor *parent,
+ CxuiApplication &application,
+ CxeSettings& settings)
+ : q(parent),
+ mApplication(application),
mSettings(settings),
#ifdef Q_OS_SYMBIAN
mWsSession(CCoeEnv::Static()->WsSession()),
@@ -92,17 +109,18 @@
mWindowGroupName(),
mKeyLockState(EKeyguardNotActive),
mBatteryStatus(EBatteryStatusUnknown),
+ mUsbPersonality(0),
+ mEventLog(NULL),
#endif // Q_OS_SYMBIAN
mState(CxuiApplicationFrameworkMonitor::ForegroundOwned)
{
CX_DEBUG_ENTER_FUNCTION();
-
#ifdef Q_OS_SYMBIAN
mWindowGroup.EnableFocusChangeEvents();
mWindowGroupName = windowGroupName(mWsSession, mWindowGroupId);
+ mEventLog = new CxuiEventLog("CxuiApplicationFrameworkMonitorPrivate");
init();
#endif // Q_OS_SYMBIAN
-
CX_DEBUG_EXIT_FUNCTION();
}
@@ -111,7 +129,11 @@
*/
CxuiApplicationFrameworkMonitorPrivate::~CxuiApplicationFrameworkMonitorPrivate()
{
- CX_DEBUG_IN_FUNCTION();
+ CX_DEBUG_ENTER_FUNCTION();
+#ifdef Q_OS_SYMBIAN
+ delete mEventLog;
+#endif // Q_OS_SYMBIAN
+ CX_DEBUG_EXIT_FUNCTION();
}
/*!
@@ -123,6 +145,24 @@
return mState;
}
+/*!
+* Is USB connected in mass memory mode?
+* @return True if USB mass memory mode is active and connected, false otherwise.
+*/
+bool CxuiApplicationFrameworkMonitorPrivate::isUsbMassMemoryModeActive() const
+{
+ bool active(false);
+#ifdef Q_OS_SYMBIAN
+ // Mass memory mode activity can be seen from the KUsbWatcherSelectedPersonality property.
+ // When USB is connected in Mass Memory Mode, we get KUsbPersonalityIdMS as personality id.
+ // If USB is not connected, personality id is KUsbWatcherSelectedPersonalityNone.
+ active = (mUsbPersonality == KUsbPersonalityIdMS);
+#endif // Q_OS_SYMBIAN
+ return active;
+}
+
+
+
#ifdef Q_OS_SYMBIAN
/*!
* Slot to handle Symbian event.
@@ -153,7 +193,7 @@
CX_DEBUG_ENTER_FUNCTION();
if (uid == KPSUidAvkonDomain.iUid && key == KAknKeyguardStatus) {
- CX_DEBUG(("CxuiApplicationFrameworkMonitor - keylock status changed: %d -> %d", value.toInt(), mKeyLockState));
+ CX_DEBUG(("CxuiApplicationFrameworkMonitor - keylock status changed: %d -> %d", mKeyLockState, value.toInt()));
// Check if the keylock value has actually changed
const int newKeyLockState = value.toInt();
@@ -163,7 +203,7 @@
setState(getCurrentState());
}
} else if (uid == KPSUidHWRMPowerState.iUid && key == KHWRMBatteryStatus ) {
- CX_DEBUG(("CxuiApplicationFrameworkMonitor - battery status changed: %d -> %d", value.toInt(), mBatteryStatus));
+ CX_DEBUG(("CxuiApplicationFrameworkMonitor - battery status changed: %d -> %d", mBatteryStatus, value.toInt() ));
// If status changed, check if battery is going empty.
const int newBatteryStatus = value.toInt();
@@ -172,8 +212,29 @@
// Notify that battery is almost empty,
// need to stop any recordings etc.
- if( mBatteryStatus == EBatteryStatusEmpty ) {
- emit batteryEmpty();
+ if(mBatteryStatus == EBatteryStatusEmpty) {
+ emit q->batteryEmpty();
+ }
+ }
+ } else if (uid == KPSUidUsbWatcher.iUid && key == KUsbWatcherSelectedPersonality) {
+ CX_DEBUG(("CxuiApplicationFrameworkMonitor - usb personality changed: %d -> %d", mUsbPersonality, value.toInt()));
+
+ const int newUsbPersonality(value.toInt());
+ if (newUsbPersonality != mUsbPersonality) {
+ // Check before saving the new state if mass memory mode was active,
+ // so we know when to emit the unactivated signal.
+ const bool wasUsbMassMemoryModeActive(isUsbMassMemoryModeActive());
+ // Store new state.
+ mUsbPersonality = newUsbPersonality;
+
+ // Save state to log.
+ if (mEventLog) {
+ mEventLog->append(EVENT_USB, QString::number(mUsbPersonality));
+ }
+
+ // Check if mass memory mode activity changed.
+ if (wasUsbMassMemoryModeActive != isUsbMassMemoryModeActive()) {
+ emit q->usbMassMemoryModeToggled(isUsbMassMemoryModeActive());
}
}
}
@@ -201,6 +262,10 @@
mSettings.get(KPSUidAvkonDomain.iUid, KAknKeyguardStatus, Cxe::PublishAndSubscribe, value);
mKeyLockState = value.toInt();
+ // Get current USB personality
+ mSettings.get(KPSUidUsbWatcher.iUid, KUsbWatcherSelectedPersonality, Cxe::PublishAndSubscribe, value);
+ mUsbPersonality = value.toInt();
+
bool ok = connect(&mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
this, SLOT(handlePropertyEvent(long int, unsigned long int, QVariant)));
CX_DEBUG_ASSERT(ok);
@@ -215,7 +280,7 @@
* Helper method to handle Symbian event that specificly is of type QSymbianEvent::WindowServerEvent.
* @param event Symbian event to be handled. (Ownership not taken.)
*/
-bool CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event)
+void CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event)
{
// We receive tons of these events, so function start and end traces
// are intentionally left out.
@@ -242,13 +307,13 @@
const TWsVisibilityChangedEvent *visibilityEvent = wsEvent->VisibilityChanged();
if (visibilityEvent) {
CX_DEBUG(("CxuiApplicationFrameworkMonitor - EFullyVisible: bits[%s]",
- QString::number(TWsVisibilityChangedEvent::EFullyVisible, 2).toAscii().constData() ));
+ bitString(TWsVisibilityChangedEvent::EFullyVisible).toAscii().constData() ));
CX_DEBUG(("CxuiApplicationFrameworkMonitor - EPartiallyVisible: bits[%s]",
- QString::number(TWsVisibilityChangedEvent::EPartiallyVisible, 2).toAscii().constData() ));
+ bitString(TWsVisibilityChangedEvent::EPartiallyVisible).toAscii().constData() ));
CX_DEBUG(("CxuiApplicationFrameworkMonitor - ENotVisible: bits[%s]",
- QString::number(TWsVisibilityChangedEvent::ENotVisible, 2).toAscii().constData() ));
+ bitString(TWsVisibilityChangedEvent::ENotVisible).toAscii().constData() ));
CX_DEBUG(("CxuiApplicationFrameworkMonitor - event: bits[%s]",
- QString::number(visibilityEvent->iFlags, 2).toAscii().constData() ));
+ bitString(visibilityEvent->iFlags).toAscii().constData() ));
}
break;
}
@@ -256,8 +321,6 @@
break;
}
}
-
- return false;
}
/*!
@@ -287,14 +350,17 @@
}
if (mState != original) {
- CX_DEBUG(("CxuiApplicationFrameworkMonitor - state change [%s] -> [%s]",
- CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator(
- CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(original),
- CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator(
- CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState) ));
+ // Print the event log with this foreground event included.
+ if (mEventLog) {
+ mEventLog->append(
+ EVENT_FOREGROUND,
+ CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator(
+ CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState));
+ mEventLog->print();
+ }
// If state was changed, signal it to listeners.
- emit foregroundStateChanged(mState);
+ emit q->foregroundStateChanged(mState);
}
}
}
@@ -312,6 +378,7 @@
if (mKeyLockState != EKeyguardNotActive) {
// Keylock enabled is the same as if other application is in foreground.
+ CX_DEBUG(("CxuiApplicationFrameworkMonitor - key lock on"));
state = CxuiApplicationFrameworkMonitor::ForegroundFullyLost;
} else if (focusWindowGroupId == mWindowGroupId) {
// If our window group has focus, we clearly are the foreground owning application.
@@ -374,7 +441,6 @@
#ifdef CX_DEBUG
QString name(windowGroupName(mWsSession, focusWgId));
-
CX_DEBUG(("CxuiApplicationFrameworkMonitor - Own window group id: 0x%08x", mWindowGroupId));
CX_DEBUG(("CxuiApplicationFrameworkMonitor - Focused window group id: 0x%08x", focusWgId));
CX_DEBUG(("CxuiApplicationFrameworkMonitor - Own window group name: [%s]", mWindowGroupName.toAscii().constData()));
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include
+
+#include "cxutils.h"
+#include "cxuieventlog.h"
+#include "cxuierrormanager.h"
+#include "cxuiapplicationstate.h"
+
+namespace
+{
+ static const char *EVENT_APPLICATION_STATE = "application state";
+}
+
+/*!
+* Constructor.
+*/
+CxuiApplicationState::CxuiApplicationState(CxuiApplication &application,
+ CxeSettings &settings,
+ CxuiDocumentLoader *documentLoader)
+ : mState(Background), mApplicationMonitor(NULL), mErrorManager(NULL), mEventLog(NULL)
+{
+ mApplicationMonitor = new CxuiApplicationFrameworkMonitor(application, settings);
+ mErrorManager = new CxuiErrorManager(documentLoader);
+
+ // Foreground state change signals
+ connect(mApplicationMonitor, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)),
+ this, SLOT(handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)));
+
+ // Battery empty signal
+ connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty()));
+
+ // USB mass memory mode signal
+ connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)),
+ this, SLOT(handleUsbMassMemoryModeChanged(bool)));
+
+ // Severe error signals
+ connect(mErrorManager, SIGNAL(errorPopupShown()), this, SLOT(handleSevereError()));
+ connect(mErrorManager, SIGNAL(errorPopupClosed()), this, SLOT(handleErrorCleared()));
+
+#ifdef CX_DEBUG
+ mEventLog = new CxuiEventLog("CxuiApplicationState");
+#endif
+}
+
+/*!
+* Destructor.
+*/
+CxuiApplicationState::~CxuiApplicationState()
+{
+ delete mErrorManager;
+ delete mApplicationMonitor;
+ delete mEventLog;
+}
+
+/*!
+* Get current application state.
+*/
+CxuiApplicationState::State CxuiApplicationState::currentState() const
+{
+ return mState;
+}
+
+/*!
+* Start monitoring the application state.
+* Initial state is checked and signal emitted about state change *unless* state is Background.
+*/
+void CxuiApplicationState::startMonitoring()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // Foreground handling checks for errors if needed.
+ handleForegroundStateChanged(mApplicationMonitor->foregroundState());
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle error from UI or engine.
+* Error will be checked and if it is severe, application state will become Error and error note will be shown.
+* If error is not severe, a warning note will be shown.
+* @param error The error id.
+*/
+void CxuiApplicationState::handleApplicationError(CxeError::Id error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (error != CxeError::None) {
+ mErrorManager->check(error);
+ // If error manager sees this error as severe one, it will signal that back.
+ // We will handle updating state in handleSevereError().
+ // If only warning note (or nothing) is needed, application state is not changed.
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle change in application foreground status.
+* @param state New foreground status.
+*/
+void CxuiApplicationState::handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (state == CxuiApplicationFrameworkMonitor::ForegroundFullyLost) {
+ CX_DEBUG(("CxuiApplicationState - application is in background"));
+ // Background overwrites even any error. We clear any active errors.
+ // When returning to background, error situation will be re-checked.
+ setState(Background);
+ mErrorManager->clear();
+ } else {
+ CX_DEBUG(("CxuiApplicationState - application is in partial / full foreground"));
+ // Check that we were in background. Switching between partial and full background
+ // needs no actions.
+ if (currentState() == Background) {
+ CX_DEBUG(("CxuiApplicationState - application was in background before, moving to foreground"));
+ // Check that there's no active errors that have been ignored in background.
+ checkErrors();
+ if (currentState() != Error) {
+ setState(Normal);
+ }
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle USB mass memory mode (USB MMM) activating or deactivating.
+* If USB MMM activates, we enter error state and display error note.
+* When USB MMM deactivates, we hide the note and move to standby mode.
+* @param active Is the USB mass memory mode active.
+*/
+void CxuiApplicationState::handleUsbMassMemoryModeChanged(bool active)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (active) {
+ // USB error is not handled if:
+ // (a) other severe error already active
+ // (b) application is in background
+ if (currentState() == Normal || currentState() == Standby) {
+ // Emulate memory not accessible error.
+ handleApplicationError(CxeError::MemoryNotAccessible);
+ }
+ } else {
+ // If we had USB error, clear it now.
+ if (currentState() == Error) {
+ setState(Standby);
+ // Clear memory not accessible error.
+ mErrorManager->clear();
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle battery emptying. We need to stop all activity and exit the application.
+*/
+void CxuiApplicationState::handleBatteryEmpty()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ setState(Background);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle a severe error after Error Manager has analyzed it.
+*/
+void CxuiApplicationState::handleSevereError()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // In background we do not change the state from Background to anything else.
+ if (currentState() != Background) {
+ setState(Error);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Severe error has been cleared.
+* Check if we should return to normal or background state.
+*/
+void CxuiApplicationState::handleErrorCleared()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // No state change if we are not currently in Error state.
+ if (currentState() == Error) {
+ setState(Normal);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot for requesting Standby state to be entered.
+* Request is accepted only if current state is Normal. Otherwise call has no effect.
+*/
+void CxuiApplicationState::enterStandby()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (currentState() == Normal) {
+ setState(Standby);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot for requesting state change from Standby to Normal state.
+* Request is accepted only if current state is Standby. Otherwise call has no effect.
+*/
+void CxuiApplicationState::exitStandby()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (currentState() == Standby) {
+ setState(Normal);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Set new state.
+* If state is actually changing, stateChanged() signal is emitted.
+*/
+void CxuiApplicationState::setState(State newState)
+{
+ if (mState != newState) {
+#ifdef CX_DEBUG
+ if (mEventLog) {
+ mEventLog->append(EVENT_APPLICATION_STATE,
+ CxuiApplicationState::staticMetaObject.enumerator(
+ CxuiApplicationState::staticMetaObject.
+ indexOfEnumerator("State")).valueToKey(newState));
+ mEventLog->print();
+ }
+#endif // CX_DEBUG
+
+ State oldState = mState;
+ mState = newState;
+ emit stateChanged(newState, oldState);
+ }
+}
+
+/*!
+* Check if we have known errors active at the moment.
+* State is set to CxuiApplicationState::Error, if error is found.
+*/
+void CxuiApplicationState::checkErrors()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (mApplicationMonitor->isUsbMassMemoryModeActive()) {
+ // Force Error state even if Background is still the current state.
+ // We use this method to check errors also when returning from background.
+ // Normally in Background state we do not enter Error state.
+ setState(Error);
+ handleApplicationError(CxeError::MemoryNotAccessible);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp
--- a/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -45,7 +45,7 @@
QObject *CxuiDocumentLoader::createObject(const QString& type, const QString &name)
{
- OstTrace0( camerax_performance, CXUIDOCUMENTLOADER_CREATEOBJECT, "msg: e_CX_DOCLOADER_CREATEOBJECT 1" );
+ OstTrace0(camerax_performance, CXUIDOCUMENTLOADER_1, "msg: e_CX_DOCUMENTLOADER_CREATEOBJECT 1");
QObject *object = NULL;
if (type == "HbView") {
@@ -55,7 +55,7 @@
object = new CxuiVideoPrecaptureView();
} else if (name == CxUiLayout::POSTCAPTURE_VIEW) {
object = new CxuiPostcaptureView();
- } else if (name == CxUiLayout::STILL_SCENES_VIEW) {
+ } else if (name == CxUiLayout::SCENE_MODE_VIEW) {
object = new CxuiSceneModeView(NULL);
}
} else if (type == "HbDialog") {
@@ -66,13 +66,13 @@
} else if (type == "HbSlider") {
if (name == CxUiLayout::SETTINGS_SLIDER_DIALOG_CONTENT_WIDGET) {
object = new CxuiSettingSlider(NULL, mEngine);
- } else if (name == CxUiLayout::STILL_PRE_CAPTURE_ZOOM_SLIDER
+ } else if (name == CxUiLayout::STILL_PRE_CAPTURE_ZOOM_SLIDER
|| name == CxUiLayout::VIDEO_PRE_CAPTURE_ZOOM_SLIDER) {
object = new CxuiZoomSlider();
}
} else if (type == "HbRadioButtonList") {
if (name == CxUiLayout::SETTINGS_DIALOG_CONTENT_WIDGET
- || name == CxUiLayout::SCENE_VIEW_RADIOBUTTONS) {
+ || name == CxUiLayout::SCENE_MODE_VIEW_RADIOBUTTONS) {
object = new CxuiSettingRadioButtonList(NULL, mEngine);
}
}
@@ -83,7 +83,7 @@
object = HbDocumentLoader::createObject(type, name);
}
- OstTrace0( camerax_performance, DUP1_CXUIDOCUMENTLOADER_CREATEOBJECT, "msg: e_CX_DOCLOADER_CREATEOBJECT 0" );
+ OstTrace0(camerax_performance, CXUIDOCUMENTLOADER_2, "msg: e_CX_DOCUMENTLOADER_CREATEOBJECT 0");
return object;
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuierrormanager.cpp
--- a/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp Thu May 13 21:30:19 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -16,6 +16,7 @@
*/
#include
+#include
#include
#include
#include
@@ -33,10 +34,10 @@
/*!
* Constructor
*/
-CxuiErrorManager::CxuiErrorManager(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader) :
- mKeyHandler(keyHandler),
+CxuiErrorManager::CxuiErrorManager(CxuiDocumentLoader *documentLoader) :
mDocumentLoader(documentLoader),
mErrorMsgPopup(NULL),
+ mErrorId(CxeError::None),
mErrorSeverity(CxuiErrorManager::None)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -54,23 +55,31 @@
/*!
-* Analyze the error code and act accordingly.
-* @param error Error code.
+* Check the error code and show either error popup, warning popup or do nothing,
+* if "no error" code is given.
+* @param error Error id. If CxeError::None, no action is taken. Otherwise
+* either warning or error popup is shown based on the severity of error.
+*
*/
-void CxuiErrorManager::analyze(CxeError::Id error)
+void CxuiErrorManager::check(CxeError::Id error)
{
CX_DEBUG_ENTER_FUNCTION();
-
- mErrorMsgPopup = NULL;
mErrorSeverity = CxuiErrorManager::None;
if (error != CxeError::None) {
+ mErrorId = error;
+
// start evaluating the error.
- QString errorMsgTxt = getErrorDetails(error);
+ QString errorText;
+ QString buttonText;
+ getErrorDetails(errorText, buttonText);
- if(mErrorSeverity != CxuiErrorManager::None) {
+ if (mErrorSeverity != CxuiErrorManager::None) {
+ // Clear the old error if one for some reason exists.
+ clear();
+
// show the error note to the user.
- launchPopup(errorMsgTxt);
+ launchPopup(errorText, buttonText);
} else {
// ignore
}
@@ -79,15 +88,32 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Close the open error popup.
+*/
+void CxuiErrorManager::clear()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (mErrorMsgPopup) {
+ mErrorMsgPopup->close();
+ mErrorMsgPopup = NULL;
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
/*!
* Slot that gets called when error note is closed.
*/
-void CxuiErrorManager::aboutToClosePopup()
+void CxuiErrorManager::popupClosed(HbAction *action)
{
+ Q_UNUSED(action)
+
CX_DEBUG_ENTER_FUNCTION();
+ // Dialog or action instance cannot be used anymore.
+ mErrorMsgPopup = NULL;
+
// handle any use-cases when the error can be recovered
- emit errorRecovered();
+ emit errorPopupClosed();
CX_DEBUG_EXIT_FUNCTION();
}
@@ -109,59 +135,71 @@
* and set the severity level, based on given error code.
* @param error Error code to be analyzed.
*/
-QString CxuiErrorManager::getErrorDetails(CxeError::Id error)
+void CxuiErrorManager::getErrorDetails(QString &errorText, QString &buttonText)
{
CX_DEBUG_ENTER_FUNCTION();
- QString msg("No Error");
- switch(error) {
+ switch (mErrorId) {
+ case CxeError::MemoryNotAccessible:
+ mErrorSeverity = CxuiErrorManager::Error;
+ errorText = hbTrId("txt_cam_info_error_usb_disconnected");
+ buttonText = hbTrId("txt_cam_info_error_usb_disconnected_button");
+ break;
+ case CxeError::InUse:
+ mErrorSeverity = CxuiErrorManager::Error;
+ errorText = hbTrId("txt_cam_info_camera_already_in_use");
+ buttonText = hbTrId("txt_common_button_close");
+ break;
+ case CxeError::DiskFull:
+ mErrorSeverity = CxuiErrorManager::Warning;
+ errorText = hbTrId("txt_cam_info_memory_full");
+ break;
+ case CxeError::OutOfMemory:
+ mErrorSeverity = CxuiErrorManager::Error;
+ errorText = hbTrId("txt_cam_info_error_ram_full");
+ buttonText = hbTrId("txt_common_ok");
+ break;
case CxeError::Died:
case CxeError::InitializationFailed:
case CxeError::HwNotAvailable:
case CxeError::NotReady:
- mErrorSeverity = CxuiErrorManager::Severe;
- msg = hbTrId("txt_cam_info_error");
- break;
- case CxeError::InUse:
- mErrorSeverity = CxuiErrorManager::Severe;
- msg = hbTrId("txt_cam_info_camera_already_in_use");
- break;
- case CxeError::DiskFull:
- mErrorSeverity = CxuiErrorManager::Warning;
- msg = hbTrId("txt_cam_info_memory_full");
default:
+ mErrorSeverity = CxuiErrorManager::Error;
+ errorText = hbTrId("txt_cam_info_error");
+ buttonText = hbTrId("txt_common_button_close");
break;
}
CX_DEBUG_EXIT_FUNCTION();
-
- return msg;
}
/*!
-*
+* Show warning or error popup.
+* @param errorText Message to be shown in the popup.
+* @param buttonText Button text to be shown in the action button of the popup. Not used on warning popup.
*/
-void CxuiErrorManager::launchPopup(QString& errorMsgTxt)
+void CxuiErrorManager::launchPopup(const QString &errorText, const QString &buttonText)
{
CX_DEBUG_ENTER_FUNCTION();
switch (mErrorSeverity) {
- case CxuiErrorManager::Warning:
- showLowSeverityNote(errorMsgTxt);
+ case CxuiErrorManager::None:
break;
- case CxuiErrorManager::Severe:
- case CxuiErrorManager::Critical:
- showHighSeverityNote(errorMsgTxt);
+ case CxuiErrorManager::Warning:
+ showWarningPopup(errorText);
break;
default:
+ showErrorPopup(errorText, buttonText);
break;
}
+ mErrorSeverity = CxuiErrorManager::None;
+
CX_DEBUG_EXIT_FUNCTION();
}
/*!
-* Show error note for high severity error.
+* Show error note for severe error.
*/
-void CxuiErrorManager::showHighSeverityNote(QString& errorMsgTxt)
+void CxuiErrorManager::showErrorPopup(const QString &errorText, const QString &buttonText)
{
// we always prepare the popup for the new message and hence we load the
// popup everytime from document loader
@@ -175,6 +213,8 @@
mErrorMsgPopup = qobject_cast(mDocumentLoader->findWidget(CxUiLayout::ERROR_POPUP));
CX_ASSERT_ALWAYS(mErrorMsgPopup);
+ mErrorMsgPopup->setAttribute(Qt::WA_DeleteOnClose, true);
+ mErrorMsgPopup->setTimeout(HbDialog::NoTimeout);
// HbDialog's default background item is replaced with black rectangle
QGraphicsRectItem *backgroundItem = new QGraphicsRectItem();
@@ -184,36 +224,32 @@
backgroundItem->setRect(origBgItem->boundingRect());
mErrorMsgPopup->setBackgroundItem(backgroundItem);
- mErrorMsgPopup->setTimeout(HbDialog::NoTimeout);
- mErrorMsgPopup->setBackgroundFaded(false);
// color of standby text is set in the code. It cannot be done in docml
HbLabel* label = qobject_cast(mDocumentLoader->findWidget(CxUiLayout::ERROR_TEXT_WIDGET));
label->setTextColor(Qt::white);
- label->setPlainText(errorMsgTxt);
+ label->setPlainText(errorText);
HbPushButton *exitButton = qobject_cast(mDocumentLoader->findWidget(CxUiLayout::ERROR_BUTTON_WIDGET));
-
- if(mErrorSeverity == CxuiErrorManager::Severe) {
+ if (!buttonText.isEmpty()) {
// inform ui about error recovery
- emit aboutToRecoverError();
- QObject::connect(mErrorMsgPopup, SIGNAL(aboutToClose()), this, SLOT(closeApp()));
+ exitButton->setText(buttonText);
+ connect(exitButton, SIGNAL(released()), this, SLOT(closeApp()));
exitButton->show();
- } else {
- // TODO handle other severity cases here.
}
- mErrorMsgPopup->show();
+ emit errorPopupShown();
+ mErrorMsgPopup->open(this, SLOT(popupClosed(HbAction*)));
CX_DEBUG_EXIT_FUNCTION();
}
/*!
-* Show error note for low severity error.
+* Show warning note for low severity error.
*/
-void CxuiErrorManager::showLowSeverityNote(QString& errorMsgTxt)
+void CxuiErrorManager::showWarningPopup(const QString &errorText)
{
CX_DEBUG_ENTER_FUNCTION();
- HbMessageBox::warning(errorMsgTxt);
+ HbMessageBox::warning(errorText);
CX_DEBUG_EXIT_FUNCTION();
}
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuieventlog.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuieventlog.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cxutils.h"
+#include "cxuieventlog.h"
+
+/*!
+* Event log item constructor.
+* @param type Event type description
+* @param id Event id description
+*/
+CxuiEventLog::CxuiEvent::CxuiEvent(const QString &type, const QString &value)
+ : mTime(QTime::currentTime()), mType(type), mValue(value)
+{
+}
+
+
+/*!
+* Event log constructor.
+* @param name Event log name.
+* @param size Maximum number of events stored to log. After maximum size is encountered,
+* old events are discarded as new ones are added.
+*/
+CxuiEventLog::CxuiEventLog(const QString& name, int size)
+ : mSize(size),
+ mName(name)
+{
+}
+
+/*!
+* Event log destructor.
+*/
+CxuiEventLog::~CxuiEventLog()
+{
+}
+
+/*!
+* Append new event to the log.
+* @param type Event type description
+* @param id Event id description
+*/
+void CxuiEventLog::append(const QString &type, const QString &value)
+{
+ if (mSize) {
+ if (mEvents.size() >= mSize) {
+ mEvents.removeFirst();
+ }
+ mEvents.append(CxuiEvent(type, value));
+ }
+}
+
+/*!
+* Print out the event log.
+*/
+void CxuiEventLog::print() const
+{
+ if (mEvents.size()) {
+
+ CX_DEBUG(("[INFO] >>> CameraX event log[%s]", mName.toAscii().constData()));
+ foreach(CxuiEvent e, mEvents) {
+ CX_DEBUG(("[INFO] <-> event: time[%s] type[%s] value[%s]",
+ e.mTime.toString("HH:mm:ss.zzz").toAscii().constData(),
+ e.mType.toAscii().constData(),
+ e.mValue.toAscii().constData()));
+ }
+ CX_DEBUG(("[INFO] <<< CameraX event log[%s]", mName.toAscii().constData()));
+ }
+}
+
+// end of file
diff -r 3075d9b614e6 -r 0e652f8f1fbd camerauis/cameraxui/cxui/src/cxuifullscreenpopup.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuifullscreenpopup.cpp Thu Jul 15 01:55:05 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include
+#include