--- a/camerauis/cameraxui/camerax.pri Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/camerax.pri Wed Aug 18 09:37:18 2010 +0300
@@ -16,8 +16,13 @@
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
# FORCE_SECONDARY_CAMERA
# Configuration flag for forcing secondary camera hw to be used also for primary camera ui.
-# To be removed
-#DEFINES += FORCE_SECONDARY_CAMERA
-#DEFINES = $$unique(DEFINES)
\ No newline at end of file
+
+# DEFINES += FORCE_SECONDARY_CAMERA
+# DEFINES = $$unique(DEFINES)
+
+!symbian {
+ DEFINES += CAMERAX_ENGINE_NO_LIBRARY
+}
--- a/camerauis/cameraxui/cxengine/cxengine.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/cxengine.pro Wed Aug 18 09:37:18 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"
@@ -15,9 +15,17 @@
#
include(../camerax.pri)
+!symbian {
+ CONFIG += staticlib
+ CONFIG += HB
+ HB += hbcore hbwidgets
+} else {
+ CONFIG += dll
+ DEFINES += CAMERAX_ENGINE_LIBRARY
+}
TEMPLATE = lib
-TARGET =
+TARGET =
DEPENDPATH += inc inc/api src/dummyengine
INCLUDEPATH += inc \
inc/sensor \
@@ -27,7 +35,6 @@
../extensions/inc
VPATH += src
-CONFIG += dll
MOC_DIR = tmp
symbian {
@@ -36,40 +43,39 @@
# Fix for QMake translating INCLUDEPATH to SYSTEMINCLUDE
# and TraceCompiler needing USERINCLUDE.
MMP_RULES += "USERINCLUDE traces"
-}
+ MMP_RULES += SMPSAFE
-# Libs
-LIBS += -lecam
-LIBS += -lecamadvsettings
-LIBS += -lecamsnapshot
-LIBS += -lfbscli
-LIBS += -lbitgdi
-LIBS += -lgdi
-LIBS += -lws32
-LIBS += -lcone
-LIBS += -lecamdirectviewfinder
-LIBS += -lmediaclientvideo
-LIBS += -lefsrv
-LIBS += -lsysutil
-LIBS += -lbafl
-LIBS += -lmediaclientaudio
-LIBS += -lecom
-LIBS += -lecampluginsupport
-LIBS += -lmmfcontrollerframework
-LIBS += -lplatformenv
-LIBS += -lxqsettingsmanager
-LIBS += -lsensrvclient
-LIBS += -lsensrvutil
-LIBS += -limagingconfigmanager
-LIBS += -lharvesterclient
-LIBS += -lthumbnailmanagerqt
-LIBS += -lxqserviceutil
-LIBS += -loommonitor
-LIBS += -lhal
-LIBS += -llocationmanager
+ # Libs
+ LIBS += -lecam
+ LIBS += -lecamadvsettings
+ LIBS += -lecamsnapshot
+ LIBS += -lfbscli
+ LIBS += -lbitgdi
+ LIBS += -lgdi
+ LIBS += -lws32
+ LIBS += -lcone
+ LIBS += -lecamdirectviewfinder
+ LIBS += -lmediaclientvideo
+ LIBS += -lefsrv
+ LIBS += -lsysutil
+ LIBS += -lbafl
+ LIBS += -lmediaclientaudio
+ LIBS += -lecom
+ LIBS += -lecampluginsupport
+ LIBS += -lmmfcontrollerframework
+ LIBS += -lplatformenv
+ LIBS += -lxqsettingsmanager
+ LIBS += -lsensrvclient
+ LIBS += -lsensrvutil
+ LIBS += -limagingconfigmanager
+ LIBS += -lharvesterclient
+ LIBS += -lthumbnailmanagerqt
+ LIBS += -lxqserviceutil
+ LIBS += -loommonitor
+ LIBS += -lhal
+ LIBS += -llocationmanager
-symbian {
- TARGET.EPOCALLOWDLLDATA = 1 // TODO: check this out??
+ TARGET.EPOCALLOWDLLDATA = 1 // TODO: check this out??
}
# dependencies
@@ -101,67 +107,72 @@
# Input
-HEADERS += cxecameradevicecontrol.h \
- cxecameradevicecontrolsymbian.h \
+HEADERS += cxengine_global.h \
+ cxememorymonitor.h \
+ cxememorymonitorprivate.h \
+ cxecameradevicecontrol.h \
cxeengine.h \
- cxeenginesymbian.h \
- cxeviewfindercontrol.h \
- cxeviewfindercontrolsymbian.h \
- cxestillcapturecontrol.h \
- cxestillcapturecontrolsymbian.h \
- cxevideocapturecontrol.h \
- cxevideocapturecontrolsymbian.h \
- cxesettingscontrolsymbian.h \
- cxeautofocuscontrol.h \
- cxeautofocuscontrolsymbian.h \
- cxezoomcontrol.h \
- cxezoomcontrolsymbian.h \
- cxeimagedataqueue.h \
- cxeimagedataqueuesymbian.h \
- cxeimagedataitem.h \
- cxeimagedataitemsymbian.h \
- cxefilenamegeneratorsymbian.h \
- cxecameradevice.h \
cxutils.h \
cxeerror.h \
- cxeerrormappingsymbian.h \
- cxesoundplayersymbian.h \
cxenamespace.h \
cxesettings.h \
cxesettingsimp.h \
cxefeaturemanager.h \
cxefeaturemanagerimp.h \
- cxesettingsmodel.h \
- cxesettingsmodelimp.h \
cxestatemachine.h \
cxestate.h \
cxestatemachinebase.h \
cxestillimage.h \
- cxestillimagesymbian.h \
+ cxestillcapturecontrol.h \
+ cxefilesavethread.h \
+ cxesensoreventhandler.h \
+ cxesettingsstore.h \
+ cxequalitydetails.h \
+ cxequalitypresets.h \
+ cxeautofocuscontrol.h \
+ cxevideocapturecontrol.h \
+ cxeimagedataitem.h \
+ cxeimagedataqueue.h \
+ cxezoomcontrol.h \
+ cxeviewfindercontrol.h \
+ cxegeotaggingtrail.h \
+ cxeexception.h \
+ cxescenemodestore.h
+
+symbian {
+
+HEADERS+= cxequalitypresetssymbian.h \
+ cxecameradevicecontrolsymbian.h \
+ cxecameradevice.h \
+ cxeviewfindercontrolsymbian.h \
+ cxevideocapturecontrolsymbian.h \
+ cxesettingscontrolsymbian.h \
+ cxestillcapturecontrolsymbian.h \
+ cxeenginesymbian.h \
+ cxeautofocuscontrolsymbian.h \
+ cxezoomcontrolsymbian.h \
+ cxeimagedataqueuesymbian.h \
+ cxeimagedataitemsymbian.h \
+ cxefilenamegeneratorsymbian.h \
+ cxeerrormappingsymbian.h \
+ cxesoundplayersymbian.h \
cxevideorecorderutility.h \
cxevideorecorderutilitysymbian.h \
- cxedummycamera.h \
+ cxestillimagesymbian.h \
cxesettingsmappersymbian.h \
- cxefilesavethread.h \
cxefilesavethreadsymbian.h \
- cxesensoreventhandler.h \
cxesensoreventhandlersymbian.h \
cxesettingscenrepstore.h \
cxesysutil.h \
cxevideocontainer.h \
- cxequalitydetails.h \
- cxequalitypresets.h \
- cxequalitypresetssymbian.h \
+ cxedummycamera.h \
cxeharvestercontrolsymbian.h \
cxethumbnailmanagersymbian.h \
- cxememorymonitor.h \
- cxememorymonitorprivate.h \
cxediskmonitor.h \
cxediskmonitorprivate.h \
cxesnapshotcontrol.h \
cxesnapshotcontrolprivate.h \
- cxegeotaggingtrail.h \
- cxegeotaggingtrailprivate.h \
+ cxegeotaggingtrail_symbian_p.h \
sensor/xqsensor.h \
sensor/xqaccsensor.h \
sensor/xqdeviceorientation.h \
@@ -169,9 +180,45 @@
sensor/xqsensor_p.h \
sensor/xqaccsensor_p.h \
traces/OstTraceDefinitions.h
+
+} else {
+HEADERS += cxeautofocuscontroldesktop.h \
+ cxecameradevicecontroldesktop.h \
+ cxeviewfindercontroldesktop.h \
+ cxezoomcontroldesktop.h \
+ cxefilenamegeneratordesktop.h \
+ cxefilesavethreaddesktop.h \
+ cxeimagedataitemdesktop.h \
+ cxeimagedataqueuedesktop.h \
+ cxevideocapturecontroldesktop.h \
+ cxestillimagedesktop.h \
+ cxestillcapturecontroldesktop.h \
+ cxequalitypresets.h \
+ cxequalitypresetsdesktop.h \
+ cxesensoreventhandlerdesktop.h \
+ cxesettingsstoredesktop.h \
+ cxecameradevicedesktop.h \
+ cxeviewfinderwidgetdesktop.h \
+ cxegeotaggingtrail_desktop_p.h \
+ cxeenginedesktop.h
+}
-SOURCES += cxecameradevicecontrolsymbian.cpp \
- cxeengine.cpp \
+SOURCES += cxeengine.cpp \
+ cxefeaturemanagerimp.cpp \
+ cxememorymonitor.cpp \
+ cxememorymonitorprivate.cpp \
+ cxestatemachine.cpp \
+ cxestate.cpp \
+ cxestatemachinebase.cpp \
+ cxefilesavethread.cpp \
+ cxegeotaggingtrail.cpp \
+ cxesettingsimp.cpp \
+ cxescenemodestore.cpp
+
+symbian {
+SOURCES += cxedummycamera.cpp \
+ cxesysutil.cpp \
+ cxevideocontainer.cpp \
cxeenginesymbian.cpp \
cxeviewfindercontrolsymbian.cpp \
cxestillcapturecontrolsymbian.cpp \
@@ -184,41 +231,46 @@
cxefilenamegeneratorsymbian.cpp \
cxecameradevice.cpp \
cxesoundplayersymbian.cpp \
- cxesettingsmodelimp.cpp \
- cxesettingsimp.cpp \
- cxefeaturemanagerimp.cpp \
- cxestatemachine.cpp \
- cxestate.cpp \
- cxestatemachinebase.cpp \
+ cxecameradevicecontrolsymbian.cpp \
cxeerrormappingsymbian.cpp \
cxestillimagesymbian.cpp \
cxevideorecorderutilitysymbian.cpp \
cxesettingsmappersymbian.cpp \
- cxedummycamera.cpp \
- cxefilesavethread.cpp \
cxefilesavethreadsymbian.cpp \
cxesensoreventhandlersymbian.cpp \
cxesettingscenrepstore.cpp \
- cxesysutil.cpp \
- cxevideocontainer.cpp \
cxequalitypresetssymbian.cpp \
cxeharvestercontrolsymbian.cpp \
cxethumbnailmanagersymbian.cpp \
- cxememorymonitor.cpp \
- cxememorymonitorprivate.cpp \
cxediskmonitor.cpp \
cxediskmonitorprivate.cpp \
cxesnapshotcontrol.cpp \
cxesnapshotcontrolprivate.cpp \
- cxegeotaggingtrail.cpp \
- cxegeotaggingtrailprivate.cpp \
+ cxegeotaggingtrail_symbian_p.cpp \
sensor/xqsensor.cpp \
sensor/xqaccsensor.cpp \
sensor/xqdeviceorientation.cpp \
sensor/xqdeviceorientation_p.cpp \
sensor/xqsensor_p.cpp \
sensor/xqaccsensor_p.cpp
-
-
-
-
+
+} else {
+SOURCES += cxeautofocuscontroldesktop.cpp \
+ cxecameradevicecontroldesktop.cpp \
+ cxeviewfindercontroldesktop.cpp \
+ cxezoomcontroldesktop.cpp \
+ cxefilenamegeneratordesktop.cpp \
+ cxefilesavethreaddesktop.cpp \
+ cxeimagedataqueuedesktop.cpp \
+ cxeimagedataitemdesktop.cpp \
+ cxevideocapturecontroldesktop.cpp \
+ cxestillimagedesktop.cpp \
+ cxestillcapturecontroldesktop.cpp \
+ cxequalitypresetsdesktop.cpp \
+ cxesensoreventhandlerdesktop.cpp \
+ cxesettingsstoredesktop.cpp \
+ cxecameradevicedesktop.cpp \
+ cxeviewfinderwidgetdesktop.cpp \
+ cxegeotaggingtrail_desktop_p.cpp \
+ cxeenginedesktop.cpp
+}
--- a/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Wed Aug 18 09:37:18 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,7 @@
#include <QObject>
#include "cxenamespace.h"
+#include "cxengine_global.h"
class CxeCameraDeviceControl;
class CxeViewfinderControl;
@@ -46,7 +47,7 @@
* Create a new engine instance. This is the first call the client needs to
* do when using CxeEngine.
*/
- IMPORT_C static CxeEngine* createEngine();
+ CAMERAX_ENGINE_EXPORT static CxeEngine* createEngine();
virtual ~CxeEngine();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeexception.h Wed Aug 18 09:37:18 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>
+
+/*!
+* 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
--- a/camerauis/cameraxui/cxengine/inc/api/cxefeaturemanager.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxefeaturemanager.h Wed Aug 18 09:37:18 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,9 +21,6 @@
#include <QMetaType>
#include "cxeerror.h"
-// forward declarations
-class CxeSettingsModel;
-
/*!
* Handling and accessing configured run-time values for specific features
--- a/camerauis/cameraxui/cxengine/inc/api/cxeimagedataitem.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeimagedataitem.h Wed Aug 18 09:37:18 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,9 +23,6 @@
#include "cxeerror.h"
-class CxeImageDataItem;
-class QImage;
-
/**
* CxeImageDataItem represents a single object that is in a queue to be saved to
* the file system.
@@ -67,8 +64,8 @@
virtual QString path() const = 0;
signals:
- void imageSaved(CxeError::Id error, const QString& filename, int id);
- void stateChanged( State newState, CxeError::Id error );
+ void imageSaved(CxeError::Id error, const QString &filename, int id);
+ void stateChanged(State newState, CxeError::Id error);
protected:
CxeImageDataItem() {}
--- a/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Wed Aug 18 09:37:18 2010 +0300
@@ -120,7 +120,7 @@
};
/*!
- * Index to CxeRuntimeKeys::FREE_MEMORY_LEVELS comma separated values
+ * Index to CxeVariationKeys::FREE_MEMORY_LEVELS comma separated values
*/
enum FreeMemoryIndex
{
@@ -193,9 +193,13 @@
static const char* FNAME_IMAGE_COUNTER = "image_counter";
static const char* FNAME_VIDEO_COUNTER = "video_counter";
- // scene mode keys
- static const char* IMAGE_SCENE = "still_scene_modes";
- static const char* VIDEO_SCENE = "video_scene_modes";
+ // scene modes. these ids are used to access scene data in settings (CxeScene)
+ static const char* IMAGE_SCENE_DATA = "still_scene_mode_data";
+ static const char* VIDEO_SCENE_DATA = "video_scene_mode_data";
+
+ // these setting ids are used to access scene id
+ static const char* IMAGE_SCENE = "still_scene_mode";
+ static const char* VIDEO_SCENE = "video_scene_mode";
// setting keys for post capture timeout
static const char* STILL_SHOWCAPTURED = "still_showcaptured";
@@ -206,12 +210,9 @@
}
-namespace CxeRuntimeKeys
+namespace CxeVariationKeys
{
- // Runtime keys
- static const char* PRIMARY_CAMERA_CAPTURE_KEYS = "primary_camera_capture_keys";
- static const char* PRIMARY_CAMERA_AUTOFOCUS_KEYS = "primary_camera_autofocus_keys";
- static const char* SECONDARY_CAMERA_CAPTURE_KEYS = "secondary_camera_capture_keys";
+ // Runtime variation keys
static const char* FREE_MEMORY_LEVELS = "free_memory_levels";
static const char* STILL_MAX_ZOOM_LIMITS = "still_max_zoom_limits";
static const char* VIDEO_MAX_ZOOM_LIMITS = "video_max_zoom_limits";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/api/cxengine_global.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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 CXENGINE_GLOBAL_H
+#define CXENGINE_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(CAMERAX_ENGINE_LIBRARY)
+# define CAMERAX_ENGINE_EXPORT Q_DECL_EXPORT
+#else
+# if defined(CAMERAX_ENGINE_NO_LIBRARY)
+# define CAMERAX_ENGINE_EXPORT
+# else
+# define CAMERAX_ENGINE_EXPORT Q_DECL_IMPORT
+# endif
+#endif
+
+#endif // CXENGINE_GLOBAL_H
--- a/camerauis/cameraxui/cxengine/inc/api/cxesettings.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxesettings.h Wed Aug 18 09:37:18 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,114 +27,164 @@
#include <QString>
#include <QVariant>
+#include "cxeerror.h"
#include "cxenamespace.h"
-#include "cxeerror.h"
-
+#include "cxeexception.h"
-// forward declaration
-class CxeSettingsModel;
-
-
-
-/*
+/*!
* Class to access all kind of Camera Settings
+*
+* There are templated get() and set() methods for accessing and modifying settings.
+* Supported types are int, qreal, QString, QVariantMap and enums.
+*
+* It is possible to monitor changes in settings, either by connecting to settingValueChanged() signal
+* or registering a slot as listener to a specific setting using listenForSetting(). With the latter
+* method you will only be notified of the change in the requested setting, as opposed to the settingValueChanged()
+* which will be emitted for any setting change.
*/
class CxeSettings : public QObject
{
Q_OBJECT
- public:
-
- /*
- * returns the current integer setting value for the given key
- */
- virtual CxeError::Id get(const QString &key, int &value) const = 0;
+public:
+
+
+ /*!
+ * Returns value of external setting item which is not owned by camera
+ */
+ virtual void get(long int uid,
+ unsigned long int key,
+ Cxe::SettingKeyType type,
+ QVariant &value) const = 0;
- /*
- * returns the current real setting value for the given key
- */
- virtual CxeError::Id get(const QString &key, qreal &value) const = 0;
+ /*!
+ * Get a value of a certain setting. Template method that can be used
+ * with any enumeration (well actually, anything that can be cast to from int),
+ * int, QString and QVariantMap. Will throw CxeException in case of error.
+ *
+ * An example:
+ * \code
+ * try {
+ * Cxe::Whitebalance wb = settings.get<Cxe::Whitebalance>(CxeSettingIds::WHITE_BALANCE);
+ * catch (CxeException &e) {
+ * CX_DEBUG(("Error getting white balance"));
+ * }
+ * \endcode
+ * @param settingId Setting key
+ * @return Setting value
+ */
+ template<typename T>
+ inline T get(const QString &key) const {
+ QVariant v;
+ getValue(key, v);
+ return (T)v.value<int>();
+ }
+
+ /*!
+ * Same as above but with default value in case of error. No exceptions are thrown.
+ *
+ *An example:
+ * \code
+ *
+ * Cxe::Whitebalance wb = settings.get<Cxe::Whitebalance>(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceAutomatic);
+ *
+ * \endcode
+ * @param key Setting key
+ * @param defaultValue Default value returned in case of error
+ * @return Value of the setting
+ */
+ template<typename T>
+ inline T get(const QString &key, const T &defaultValue) const {
+ try {
+ return get<T>(key);
+ } catch (CxeException &e) {
+ return defaultValue;
+ }
+ }
+
+
- /*
- * returns the current string setting value for the given key
- */
- virtual CxeError::Id get(const QString &key, QString &stringValue) const = 0;
-
- /*
- * Returns value of external setting item which is not owned by camera
- */
- virtual void get(long int uid,
- unsigned long int key,
- Cxe::SettingKeyType type,
- QVariant &value) const = 0;
-
- /**
- * Get a value of a certain setting. A convenience method with a template
- * parameter to be used with enumerations.
- *
- * An example:
- * \code
- * Cxe::Whitebalance wb = Cxe::WhitebalanceAutomatic;
- * if (settings.get<Cxe::Whitebalance>(CxeSettingIds::WHITE_BALANCE, wb)) {
- * CX_DEBUG(("Error getting white balance - using default"));
- * }
- * \endcode
- * @param settingId Setting key
- * @param value Reference to a variable where to put the setting value
- * @return Error code
- */
- template<typename T>
- inline CxeError::Id get(const QString &key, T &value) const {
- int intValue = value; // This will not compile if T cannot be converted to an int
- CxeError::Id err = get(key, intValue);
- value = static_cast<T>(intValue); // Convert to enum
- return err;
- }
-
- /*
- * Set new values for the given key
- */
- virtual CxeError::Id set(const QString &key, int newValue) = 0;
+ /*!
+ * Set a value of a certain setting. Template method that can be used
+ * with any enumeration (well actually, anything that can be cast to from int),
+ * int, QString and QVariantMap.
+ *
+ * An example:
+ * \code
+ * try {
+ * Cxe::Whitebalance wb = Cxe::WhiteBalanceAutomatic;
+ * settings.get<Cxe::Whitebalance>(CxeSettingIds::WHITE_BALANCE, wb);
+ * catch (CxeException &e) {
+ * CX_DEBUG(("Error setting white balance"));
+ * }
+ * \endcode
+ * @param settingId Setting key
+ * @param value Setting value
+ */
+ template<typename T>
+ inline void set(const QString &key, const T &value) {
+ QVariant v;
+ v.setValue((int)value);
+ setValue(key, v);
+ }
+
+ /*!
+ * Resets settings to default values.
+ */
+ virtual void reset() = 0;
+
+ /*!
+ * Get value of variation setting.
+ */
+ virtual CxeError::Id getVariationValue(const QString &key, QVariant &value) = 0;
- /*
- * Set new values for the given key
- */
- virtual CxeError::Id set(const QString &key, qreal newValue) = 0;
+ /*!
+ * Add listener for changes in one setting. When the value of the setting changes, the given
+ * slot is invoked on given object.
+ *
+ * @param settingKey Setting to listen to
+ * @param target Object that the slot will be invoked for
+ * @param slot Slot that will be invoked. The slot can have either of these two signatures:
+ * slotName(const QVariant&) only new value of setting is passed as parameter
+ * slotName(const QString&, const QVariant&) both setting key and new value are passed as parameter
+ * @return boolean to indicate success
+ */
+ virtual bool listenForSetting(const QString &settingKey, QObject *target, const char *slot) = 0;
- /*
- * Set new values for the given key
- */
- virtual CxeError::Id set(const QString &key, const QString &newValue) = 0;
+protected:
+ /*!
+ * returns the setting as QVariant
+ */
+ virtual void getValue(const QString &key, QVariant &value) const = 0;
- /*
- * Resets only virtual settings( persistent settings )
- */
- virtual void reset() = 0;
-
- signals:
- /*
- * to notify engine and ui components for a change in a setting value
- */
- void settingValueChanged(const QString &key, QVariant newValue);
+ /*!
+ * Set new value for the given key
+ */
+ virtual void setValue(const QString &key, const QVariant &newValue) = 0;
+
+signals:
+
+ /*!
+ * to notify engine and ui components for a change in a setting value
+ */
+ void settingValueChanged(const QString &key, QVariant newValue);
- /*
- * to notify engine and ui components for a change in a setting value
- */
- void settingValueChanged(long int uid, unsigned long int key, QVariant value);
+ /*!
+ * to notify engine and ui components for a change in a setting value
+ */
+ void settingValueChanged(long int uid, unsigned long int key, QVariant value);
- /*
- * to update engine and ui components of new image scene
- */
- void sceneChanged(CxeScene &scene);
+protected:
+ CxeSettings() {}
- protected:
- CxeSettings() {}
-
- private:
- Q_DISABLE_COPY( CxeSettings )
+private:
+ Q_DISABLE_COPY( CxeSettings )
};
+// include set/get function specializations
+#include "cxesettings.inl"
+
#endif /*CXESETTINGS_H_*/
// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/api/cxesettings.inl Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* 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:
+*
+*/
+
+
+// specializations for getters
+// throwing versions
+template<>
+inline int CxeSettings::get<int>(const QString &key) const {
+ QVariant v;
+ getValue(key, v);
+ return v.value<int>();
+}
+
+template<>
+inline bool CxeSettings::get<bool>(const QString &key) const {
+ QVariant v;
+ getValue(key, v);
+ return v.value<bool>();
+}
+
+template<>
+inline qreal CxeSettings::get<qreal>(const QString &key) const {
+ QVariant v;
+ getValue(key, v);
+ return v.value<qreal>();
+}
+
+template<>
+inline QString CxeSettings::get<QString>(const QString &key) const {
+ QVariant v;
+ getValue(key, v);
+ return v.value<QString>();
+}
+
+template<>
+inline QVariantMap CxeSettings::get<QVariantMap>(const QString &key) const {
+ QVariant v;
+ getValue(key, v);
+ return v.value<QVariantMap>();
+}
+
+// non-throwing versions
+template<>
+inline int CxeSettings::get<int>(const QString &key, const int &defaultValue) const {
+ try {
+ return get<int>(key);
+ } catch (CxeException &e) {
+ return defaultValue;
+ }
+}
+
+template<>
+inline bool CxeSettings::get<bool>(const QString &key, const bool &defaultValue) const {
+ try {
+ return get<bool>(key);
+ } catch (CxeException &e) {
+ return defaultValue;
+ }
+}
+
+template<>
+inline qreal CxeSettings::get<qreal>(const QString &key, const qreal &defaultValue) const {
+ try {
+ return get<qreal>(key);
+ } catch (CxeException &e) {
+ return defaultValue;
+ }
+}
+
+template<>
+inline QString CxeSettings::get<QString>(const QString &key, const QString &defaultValue) const {
+ try {
+ return get<QString>(key);
+ } catch (CxeException &e) {
+ return defaultValue;
+ }
+}
+
+template<>
+inline QVariantMap CxeSettings::get<QVariantMap>(const QString &key, const QVariantMap &defaultValue) const {
+ try {
+ return get<QVariantMap>(key);
+ } catch (CxeException &e) {
+ return defaultValue;
+ }
+}
+
+// specializations for setters
+template<>
+inline void CxeSettings::set<int>(const QString &key, const int &value) {
+ QVariant v;
+ v.setValue(value);
+ setValue(key, v);
+}
+
+template<>
+inline void CxeSettings::set<bool>(const QString &key, const bool &value) {
+ QVariant v;
+ v.setValue(value);
+ setValue(key, v);
+}
+
+template<>
+inline void CxeSettings::set<qreal>(const QString &key, const qreal &value) {
+ QVariant v;
+ v.setValue(value);
+ setValue(key, v);
+}
+
+template<>
+inline void CxeSettings::set<QString>(const QString &key, const QString &value) {
+ QVariant v;
+ v.setValue(value);
+ setValue(key, v);
+}
+
+template<>
+inline void CxeSettings::set<QVariantMap>(const QString &key, const QVariantMap &value) {
+ QVariant v;
+ v.setValue(value);
+ setValue(key, v);
+}
--- a/camerauis/cameraxui/cxengine/inc/api/cxutils.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxutils.h Wed Aug 18 09:37:18 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,38 +25,53 @@
#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 <QDebug> // Qt Debug
+#ifdef Q_OS_SYMBIAN
#include <e32debug.h> // 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()
#define CX_DEBUG_IN_FUNCTION()
#define CX_DEBUG_EXIT_FUNCTION()
#define CX_DEBUG_ASSERT(x)
+
+#ifdef Q_OS_SYMBIAN
#define CX_ASSERT_ALWAYS(x) ASSERT(x)
+#else // !Q_OS_SYMBIAN
+ #define CX_ASSERT_ALWAYS(x) Q_ASSERT(x)
+ #define OstTrace0(x,y,z)
+#endif // Q_OS_SYMBIAN
#endif // _DEBUG
-
-
#endif // CXUTILS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeautofocuscontroldesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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 CXEAUTOFOCUSCONTROLDESKTOP_H
+#define CXEAUTOFOCUSCONTROLDESKTOP_H
+
+#include <QVariant>
+#include "cxenamespace.h"
+#include "cxeautofocuscontrol.h"
+
+/**
+ * CxeAutoFocusControl is responsible for handling Autofocus events from the camera adaptation.
+ * It also routes the Autofocus successful and failed events to the clients interested in ´knowing the
+ * status of Autofocus.
+ */
+class CxeAutoFocusControlDesktop: public CxeAutoFocusControl
+{
+ Q_OBJECT
+public:
+
+ CxeAutoFocusControlDesktop();
+ virtual ~CxeAutoFocusControlDesktop();
+
+ CxeError::Id start(bool soundEnabled = true);
+ void cancel();
+ void setMode(CxeAutoFocusControl::Mode newMode);
+ CxeAutoFocusControl::Mode mode() const;
+ virtual bool isFixedFocusMode(Mode mode) const;
+
+
+ CxeAutoFocusControl::State state() const;
+ bool supported() const;
+ bool isSoundEnabled() const;
+
+protected:
+ void initializeStates();
+ // intializes all the resources we need for AF functionality
+ void initializeResources();
+
+protected:
+ CxeAutoFocusControl::Mode mAfMode;
+ CxeAutoFocusControl::State mState;
+ bool mCancelled;
+};
+
+#endif // CXEAUTOFOCUSCONTROLDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Wed Aug 18 09:37:18 2010 +0300
@@ -82,7 +82,7 @@
// Handle ECam events
void handleCameraEvent( int eventUid, int error );
- void handleSceneChanged(CxeScene &scene);
+ void handleSceneChanged(const QVariant &scene);
void handleSettingValueChanged(const QString &settingId, QVariant newValue);
private:
--- a/camerauis/cameraxui/cxengine/inc/cxecameradevice.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxecameradevice.h Wed Aug 18 09:37:18 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"
@@ -28,6 +28,7 @@
class MCameraOrientation;
class MCameraFaceTracking;
+class MCameraUseCaseHint;
// Class Definitions
class CxeCameraDevice : public QObject
@@ -44,10 +45,12 @@
MCameraOrientation *cameraOrientation();
CCamera::CCameraSnapshot *cameraSnapshot();
MCameraFaceTracking *faceTracking();
+ MCameraUseCaseHint *useCaseHintApi();
virtual void setCamera( CCamera *aCamera );
virtual void deleteCamera();
virtual void releaseCamera();
+ virtual void reserveCamera();
virtual CxeError::Id newCamera(Cxe::CameraIndex cameraIndex, MCameraObserver2 *observer);
protected:
@@ -56,7 +59,7 @@
void prepareForCameraDelete();
void cameraAllocated(CxeError::Id error);
void prepareForRelease();
-
+ void aboutToReserve();
private:
CxeError::Id initResources();
@@ -69,6 +72,7 @@
CCamera::CCameraSnapshot *mCameraSnapshot;
MCameraOrientation *mCameraOrientation; // not owned
MCameraFaceTracking *mFaceTracking; // not owned
+ MCameraUseCaseHint *mUseCaseHintApi; // not owned
friend class CxeCameraDeviceControlSymbian;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxecameradevicecontroldesktop.h Wed Aug 18 09:37:18 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 CXECAMERADEVICECONTROLDESKTOP_H
+#define CXECAMERADEVICECONTROLDESKTOP_H
+
+#include <QObject>
+#include <QMetaType>
+#include "cxecameradevicecontrol.h"
+#include "cxenamespace.h"
+#include "cxeerror.h"
+
+class CxeCameraDeviceControlDesktop : public CxeCameraDeviceControl
+{
+ Q_OBJECT
+
+public:
+
+ CxeCameraDeviceControlDesktop();
+ ~CxeCameraDeviceControlDesktop();
+
+public: // from CxeCameraDeviceControl
+ virtual Cxe::CameraMode mode() const;
+ virtual void setMode(Cxe::CameraMode mode);
+ virtual void init();
+ virtual void reserve();
+ virtual void release();
+ virtual Cxe::CameraIndex cameraIndex() const;
+ virtual CxeError::Id switchCamera(Cxe::CameraIndex index);
+ virtual CxeCameraDeviceControl::State state() const;
+
+private:
+ void setState(CxeCameraDeviceControl::State stateId, CxeError::Id error = CxeError::None);
+
+private:
+ Cxe::CameraIndex mIndex;
+ Cxe::CameraMode mMode;
+ State mState;
+
+};
+
+#endif // CXECAMERADEVICECONTROLDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxecameradevicedesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 CXECAMERADEVICEDESKTOP_H
+#define CXECAMERADEVICEDESKTOP_H
+
+#include <QGraphicsWidget>
+#include <QList>
+
+class QTimer;
+class QPixmap;
+
+class CxeCameraDeviceDesktop : public QObject
+{
+ Q_OBJECT
+public:
+ CxeCameraDeviceDesktop();
+ virtual ~CxeCameraDeviceDesktop();
+ void start();
+ void stop();
+ const QPixmap ¤tSnaphot();
+
+signals:
+ void imageChanged(const QPixmap &newImage);
+
+protected slots:
+ void handleTimeout();
+
+private:
+ void loadPictures();
+ void setupTimer();
+
+ QTimer *mSwitchPictureTimer;
+ QList<QPixmap> mPictureList;
+ QList<QPixmap>::size_type mPictureIndex;
+};
+
+#endif // CXECAMERADEVICEDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeenginedesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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 CXEENGINEDESKTOP_H
+#define CXEENGINEDESKTOP_H
+
+#include <QObject>
+#include "cxeengine.h"
+
+class CxeCameraDeviceControl;
+class CxeViewfinderControl;
+class CxeSnapshotControl;
+class CxeStillCaptureControl;
+class CxeVideoCaptureControl;
+class CxeAutoFocusControl;
+class CxeZoomControl;
+class CxeImageDataQueue;
+class CxeFeatureManager;
+class CxeSettings;
+class CxeFilenameGenerator;
+class CxeFileSaveThread;
+class CxeSensorEventHandler;
+class CxeQualityPresets;
+class CxeCameraDeviceDesktop;
+class CxeDiskMonitor;
+class CxeMemoryMonitor;
+class CxeGeoTaggingTrail;
+
+class CxeEngineDesktop : public CxeEngine
+{
+ Q_OBJECT
+public:
+ CxeEngineDesktop();
+ virtual ~CxeEngineDesktop();
+
+ void construct();
+
+ void createControls();
+
+ void connectSignals();
+public: // from CxeEngine
+ virtual CxeCameraDeviceControl &cameraDeviceControl();
+ virtual CxeViewfinderControl &viewfinderControl();
+ virtual CxeSnapshotControl &snapshotControl();
+ virtual CxeStillCaptureControl &stillCaptureControl();
+ virtual CxeVideoCaptureControl &videoCaptureControl();
+ virtual CxeAutoFocusControl &autoFocusControl();
+ virtual CxeZoomControl &zoomControl();
+ virtual CxeSettings &settings();
+ virtual CxeFeatureManager &featureManager();
+ virtual CxeMemoryMonitor &memoryMonitor();
+ virtual CxeGeoTaggingTrail &geoTaggingTrail();
+ virtual Cxe::CameraMode mode() const;
+ void setMode(Cxe::CameraMode mode);
+ virtual void initMode(Cxe::CameraMode cameraMode);
+ virtual bool isEngineReady();
+
+protected:
+ CxeCameraDeviceControl *mCameraDeviceControl;
+ CxeViewfinderControl *mViewfinderControl;
+ CxeSnapshotControl *mSnapshotControl;
+ CxeStillCaptureControl *mStillCaptureControl;
+ CxeVideoCaptureControl *mVideoCaptureControl;
+ CxeAutoFocusControl *mAutoFocusControl;
+ CxeZoomControl *mZoomControl;
+ CxeImageDataQueue *mImageDataQueue;
+ CxeSettings *mSettings;
+ CxeFeatureManager *mFeatureManager;
+ CxeFilenameGenerator *mFilenameGenerator;
+ CxeSensorEventHandler *mSensorEventHandler;
+ CxeQualityPresets *mQualityPresets;
+ CxeFileSaveThread *mFileSaveThread;
+ CxeCameraDeviceDesktop *mCameraDevice;
+ CxeDiskMonitor *mDiskMonitor;
+ CxeMemoryMonitor *mMemoryMonitor;
+ CxeGeoTaggingTrail *mGeoTaggingTrail;
+
+};
+
+#endif // CXEENGINEDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h Wed Aug 18 09:37:18 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"
@@ -33,7 +33,6 @@
class CxeAutoFocusControl;
class CxeSettings;
class CxeFeatureManager;
-class CxeSettingsModel;
class CxeSensorEventHandler;
class CxeFilenameGenerator;
class CxeQualityPresets;
@@ -77,6 +76,7 @@
private slots:
void doInit();
+ void initGeotagging();
private:
void connectSignals();
@@ -85,7 +85,6 @@
bool startViewfinderNeeded();
void reserve();
void saveMode();
- void startGeotaggingTrail();
protected:
CxeCameraDeviceControl *mCameraDeviceControl;
@@ -99,7 +98,6 @@
CxeZoomControl *mZoomControl;
CxeSettings *mSettings;
CxeFeatureManager *mFeatureManager;
- CxeSettingsModel *mSettingsModel;
CxeFilenameGenerator *mFilenameGenerator;
CxeSensorEventHandler* mSensorEventHandler;
CxeQualityPresets *mQualityPresets;
--- a/camerauis/cameraxui/cxengine/inc/cxeexception.h Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
-* 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>
-
-/*!
-* 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
--- a/camerauis/cameraxui/cxengine/inc/cxefeaturemanagerimp.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxefeaturemanagerimp.h Wed Aug 18 09:37:18 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"
@@ -28,7 +28,7 @@
#include "cxeerror.h"
// forward declarations
-class CxeSettingsModel;
+class CxeSettings;
@@ -41,24 +41,14 @@
public:
- CxeFeatureManagerImp(CxeSettingsModel& settingsModel);
+ CxeFeatureManagerImp(CxeSettings &settings);
virtual ~CxeFeatureManagerImp();
- /*
- * returns if a feature is supported or not
- * true -> supported
- * false -> not supported
- */
- CxeError::Id isFeatureSupported(const QString& key, bool& value) const;
-
-
- /*
- * We retrieve all the configured values for the given key
- */
- CxeError::Id configuredValues(const QString& key,QList<int>& values);
+ CxeError::Id isFeatureSupported(const QString &key, bool &value) const;
+ CxeError::Id configuredValues(const QString &key, QList<int> &values);
-private: // not owned
- CxeSettingsModel& mSettingsModel;
+private:
+ CxeSettings &mSettings;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxefilenamegeneratordesktop.h Wed Aug 18 09:37:18 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 CXEFILENAMEGENERATORDESKTOP_H
+#define CXEFILENAMEGENERATORDESKTOP_H
+
+#include "cxefilenamegenerator.h"
+
+class CxeFilenameGeneratorDesktop : public CxeFilenameGenerator
+{
+public:
+ CxeFilenameGeneratorDesktop();
+ virtual ~CxeFilenameGeneratorDesktop();
+
+public: // from CxeFilenameGenerator
+ virtual CxeError::Id init(Cxe::CameraMode mode);
+ virtual void startNewImageFilenameSequence();
+ virtual CxeError::Id nextImageFilenameInSequence(QString &filename, const QString &fileExt);
+ virtual CxeError::Id generateFilename(QString &filename, const QString &fileExt);
+ virtual void raiseCounterValue();
+
+private:
+ void getNextVideoFilename(QString &filename);
+ void getNextImageFilename(QString &filename);
+
+ QString assembleFilename(const QString &baseName, int sequenceNumber, const QString &extension);
+
+ Cxe::CameraMode mMode;
+
+ QString mImageBaseFolder;
+ QString mVideoBaseFolder;
+
+ QString mImageExtension;
+ QString mVideoExtension;
+
+ int mImageSequenceNumber;
+ int mVideoSequenceNumber;
+
+};
+
+#endif // CXEFILENAMEGENERATORDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethreaddesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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: Still image saving thread
+*
+*/
+
+#ifndef CXEFILESAVETHREADDESKTOP_H
+#define CXEFILESAVETHREADDESKTOP_H
+
+#include <QObject>
+#include <QThread>
+#include <QMutex>
+#include <QWaitCondition>
+#include "cxefilesavethread.h"
+
+class CxeImageDataItem;
+
+
+class CxeFileSaveThreadDesktop : public CxeFileSaveThread
+{
+ Q_OBJECT
+public:
+
+ CxeFileSaveThreadDesktop(QObject *parent = 0);
+ ~CxeFileSaveThreadDesktop();
+
+ void save(CxeImageDataItem *data);
+
+public slots:
+ 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);
+
+private:
+ /**
+ * This method includes saving in own thread.
+ * Functions called from this method are running in "saving thread"
+ */
+ void run();
+ void read();
+
+private: // data shared between the threads
+
+ bool mExitThread;
+ QList<CxeImageDataItem*> mDataList; //! @todo Consider QQueue
+
+ QMutex mMutex;
+ QWaitCondition mDataToSave;
+
+private: // thread private data
+ int mCount;
+ bool mExit;
+};
+
+#endif // CXEFILESAVETHREADDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxegeotaggingtrail_desktop_p.h Wed Aug 18 09:37:18 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:
+*
+*/
+
+#ifndef CXEGEOTAGGINGTRAIL_DESKTOP_P_H
+#define CXEGEOTAGGINGTRAIL_DESKTOP_P_H
+
+#include <QTimer>
+#include <QObject>
+#include <QVariant>
+#include <QString>
+
+#include "cxeerror.h"
+#include "cxestatemachine.h"
+#include "cxegeotaggingtrail.h"
+
+// Forward declarations
+class CxeSettings;
+
+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:
+ void start();
+ void initializeStates();
+ CxeGeoTaggingTrail::State state() const;
+
+private slots:
+ void handleSettingValueChanged(const QString&, QVariant);
+ void stop(bool closeSession = false);
+
+private:
+ CxeSettings &mSettings;
+
+ friend class CxeGeoTaggingTrail;
+};
+
+#endif // CXEGEOTAGGINGTRAIL_DESKTOP_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxegeotaggingtrail_symbian_p.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 CXEGEOTAGGINGTRAIL_SYMBIAN_P_H
+#define CXEGEOTAGGINGTRAIL_SYMBIAN_P_H
+
+#include <QTimer>
+#include <QObject>
+#include <QVariant>
+#include <QString>
+
+#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:
+ void start();
+ void initializeStates();
+ bool canStopTrail() const;
+ CxeGeoTaggingTrail::State state() const;
+
+private slots:
+ void handleSettingValueChanged(const QString&, QVariant);
+ void handleGeoTaggingPropertyEvent(long int uid, unsigned long int key, QVariant value);
+ void timeout();
+ void stop();
+
+private:
+ CxeStillCaptureControl &mStillCaptureControl;
+ CxeVideoCaptureControl &mVideoCaptureControl;
+ CxeSettings &mSettings;
+ QTimer mStopLocationTrailTimer;
+ bool mPendingStopTrailSession;
+ RLocationTrail mLocationTrail;
+
+ friend class CxeGeoTaggingTrail;
+};
+
+#endif // CXEGEOTAGGINGTRAIL_SYMBIAN_P_H
--- a/camerauis/cameraxui/cxengine/inc/cxegeotaggingtrailprivate.h Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +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 CXEGEOTAGGINGTRAILPRIVATE_H
-#define CXEGEOTAGGINGTRAILPRIVATE_H
-
-#include <QTimer>
-#include <QObject>
-#include <QVariant>
-#include <QString>
-
-#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataitemdesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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 CXEIMAGEDATAITEMDESKTOP_H
+#define CXEIMAGEDATAITEMDESKTOP_H
+
+#include <QPixmap>
+#include "cxeimagedataitem.h"
+
+
+/**
+ * CxeImageDataItem represents a single object that is in a queue to be saved to
+ * the file system.
+ */
+class CxeImageDataItemDesktop : public CxeImageDataItem
+{
+ Q_OBJECT
+
+public:
+ CxeImageDataItemDesktop(int index, QByteArray data, QString filename, int id);
+ CxeImageDataItemDesktop(int index, QPixmap pixmapData, QString filename, int id);
+public: // from CxeImageDataItem
+ virtual CxeError::Id save();
+ virtual CxeImageDataItem::State state() const;
+ virtual int id() const;
+ virtual QString path() const;
+
+protected:
+ int mIndex;
+ int mId;
+ QByteArray mData;
+ QString mFilename;
+ QPixmap mPixmapData;
+ CxeImageDataItem::State mState;
+};
+
+#endif // CXEIMAGEDATAITEMDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h Wed Aug 18 09:37:18 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,8 +23,6 @@
#include "cxestatemachine.h"
-class RFs;
-
class CxeImageDataItemSymbian : public CxeImageDataItem,
public CxeStateMachine
{
@@ -42,27 +40,24 @@
CxeError::Id save();
int id() const;
bool isLocationEnabled() const;
-
+
public: // new methods
QString path() const;
protected: // from CxeStateMachine
- void handleStateChanged( int newStateId, CxeError::Id error );
-
-
-protected:
+ void handleStateChanged(int newStateId, CxeError::Id error);
void initializeStates();
-private: // private member functions
+protected:
+ virtual bool checkDiskSpace(RFs *aFs, TInt aBytesToWrite, TInt aDrive);
- void saveCleanup(); // delete data and report
- int checkDiskSpace(RFs* aFs, TInt aBytesToWrite, TInt aDrive);
-
+private: // private member functions
+ void trySave();
+ void closeHandles();
private: // private data members
int mIndex;
- int mError;
int mId;
// used for image saving
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataqueuedesktop.h Wed Aug 18 09:37:18 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 CXEIMAGEDATAQUEUEDESKTOP_H
+#define CXEIMAGEDATAQUEUEDESKTOP_H
+
+// Include Files
+
+#include <QList>
+
+#include "cxeimagedataqueue.h"
+
+// Constants
+
+
+// Class Definitions
+
+class QImage;
+class CxeImageDataItem;
+
+class CxeImageDataQueueDesktop : public CxeImageDataQueue
+{
+ Q_OBJECT
+
+public:
+ CxeImageDataQueueDesktop();
+ virtual ~CxeImageDataQueueDesktop();
+
+
+public: // from CxeImageDataQueue
+ int size() const;
+ void clear();
+ CxeImageDataItem &operator[](int index);
+
+public: // public member functions, not in client API
+ CxeImageDataItem *startSave(QByteArray data, QString path, int id);
+
+private: // private data members
+ QList<CxeImageDataItem *> mList;
+};
+
+#endif // __CXEIMAGEDATAQUEUEDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxequalitypresets.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxequalitypresets.h Wed Aug 18 09:37:18 2010 +0300
@@ -17,7 +17,7 @@
#ifndef CXEQUALITYPRESETS_H
#define CXEQUALITYPRESETS_H
-#include <imagingconfigmanager.h>
+
#include "cxequalitydetails.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxequalitypresetsdesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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 CXEQUALITYPRESETSDESKTOP_H
+#define CXEQUALITYPRESETSDESKTOP_H
+
+// Include Files
+#include "cxequalitypresets.h"
+
+class CxeQualityPresetsDesktop : public CxeQualityPresets
+{
+public:
+ CxeQualityPresetsDesktop();
+ virtual ~CxeQualityPresetsDesktop();
+ QList<CxeImageDetails> imageQualityPresets(Cxe::CameraIndex cameraId);
+ QList<CxeVideoDetails> videoQualityPresets(Cxe::CameraIndex cameraId);
+ int recordingTimeAvailable(const CxeVideoDetails &details, qint64 space);
+
+};
+
+#endif // CXEQUALITYPRESETSDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxequalitypresetssymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxequalitypresetssymbian.h Wed Aug 18 09:37:18 2010 +0300
@@ -23,6 +23,8 @@
// forward declarations
class CImagingConfigManager;
+class TImageQualitySet;
+class TVideoQualitySet;
class CxeSettings;
/**!
@@ -43,11 +45,11 @@
qreal avgVideoBitRateScaler();
Cxe::AspectRatio calculateAspectRatio(int width, int height) const;
QString toString(const TUint8* aData);
- CxeVideoDetails createVideoPreset(TVideoQualitySet set);
- CxeImageDetails createImagePreset(TImageQualitySet set);
+ CxeVideoDetails createVideoPreset(const TVideoQualitySet &set);
+ CxeImageDetails createImagePreset(const TImageQualitySet &set);
QString calculateMegaPixelCount(int imageWidth, int imageHeight);
- void debugPrints(CxeVideoDetails preset);
- void debugPrints(CxeImageDetails newPreset);
+ void debugPrints(const CxeVideoDetails &preset);
+ void debugPrints(const CxeImageDetails &newPreset);
private:
CImagingConfigManager *mIcm;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxescenemodestore.h Wed Aug 18 09:37:18 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 CXESCENEMODESTORE_H
+#define CXESCENEMODESTORE_H
+
+#include <QObject>
+
+#include "cxenamespace.h"
+#include "cxeerror.h"
+
+class CxeSceneModeStore
+{
+
+public:
+
+ CxeSceneModeStore();
+ ~CxeSceneModeStore();
+
+ CxeError::Id sceneSettingValue(Cxe::CameraMode cameraMode, const QString &key, QVariant &value) const;
+ CxeError::Id setSceneSettingValue(Cxe::CameraMode cameraMode, const QString &key, const QVariant &newValue);
+
+ QString currentSceneId(Cxe::CameraMode cameraMode) const;
+ CxeScene& currentScene(Cxe::CameraMode cameraMode);
+ const CxeScene& currentScene(Cxe::CameraMode cameraMode) const;
+
+ void setCurrentScene(Cxe::CameraMode cameraMode, const QString &sceneId);
+ CxeScene getScene(Cxe::CameraMode cameraMode, const QString &sceneId) const;
+private:
+
+ void loadImageScenes();
+ void loadVideoScenes();
+
+
+private:
+
+ QHash<QString, CxeScene> mImageSceneModes;
+ QHash<QString, CxeScene> mVideoSceneModes;
+
+ CxeScene mCurrentImageScene;
+ CxeScene mCurrentVideoScene;
+};
+
+
+
+#endif /* CXESCENEMODESTORE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxesensoreventhandlerdesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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 CXESENSOREVENTHANDLERDESKTOP_H_
+#define CXESENSOREVENTHANDLERDESKTOP_H_
+
+#include <QObject>
+#include <QMetaType>
+
+#include "cxesensoreventhandler.h"
+
+class CxeSensorEventHandlerDesktop : public CxeSensorEventHandler
+{
+ Q_OBJECT
+
+public:
+
+ // ! Sensor types handled and supported in cxengine.
+ enum SensorType
+ {
+ //! Listening to orientation sensor events
+ OrientationSensor
+ };
+
+ CxeSensorEventHandlerDesktop();
+ virtual ~CxeSensorEventHandlerDesktop();
+
+ /**
+ * Data read from sensor. The "type" of data embedded in QVariant is specific to sensor type.
+ */
+ virtual QVariant sensorData(CxeSensorEventHandler::SensorType type);
+
+public slots:
+ virtual void init();
+ virtual void deinit();
+
+signals:
+ /*
+ * A signal indicating that there is new sensor event data available.
+ */
+ void sensorEvent(CxeSensorEventHandler::SensorType type, QVariant data);
+
+};
+#endif /* CXESENSOREVENTHANDLERDESKTOP_H_ */
--- a/camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h Wed Aug 18 09:37:18 2010 +0300
@@ -25,72 +25,15 @@
#include "cxeerror.h"
#include "cxenamespace.h"
#include "xqsettingsmanager.h"
+#include "cxesettingsstore.h"
// forward declarations
class XQSettingsManager;
class XQSettingsKey;
-
/*!
-* \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
- * results in User-42 panic!
- */
- 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;
+* CxeSettingsCenRepStore class implements CxeSettingsStore.
- /*!
- * 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 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<QString> 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.
- */
- virtual QHash<QString, QVariantList> loadRuntimeSettings(QList<QString>& settingKeys) = 0;
-};
-
-
-
-/*!
-* \class CxeSettingsCenRepStore
-* \brief Class implements CxeSettingsStore.
* This class uses CenRep key mechanism for storing and retrieving settings information.
*/
class CxeSettingsCenRepStore : public QObject,
@@ -107,10 +50,10 @@
public: // from base class
void reset();
- CxeError::Id get(const QString& key, QVariant &value);
+ CxeError::Id get(const QString &key, 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<QString, QVariantList> loadRuntimeSettings(QList<QString>& settingKeys);
+ CxeError::Id set(const QString &key, const QVariant newValue);
+ QHash<QString, QVariantList> loadVariationSettings(QList<QString> &settingKeys);
signals:
--- a/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h Wed Aug 18 09:37:18 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"
@@ -39,7 +39,7 @@
public slots:
void handleSettingValueChanged(const QString& settingId, QVariant newValue);
- void handleSceneChanged(CxeScene& scene);
+ void handleSceneChanged(const QVariant &scene);
private:
--- a/camerauis/cameraxui/cxengine/inc/cxesettingsimp.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingsimp.h Wed Aug 18 09:37:18 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,13 +17,17 @@
#ifndef CXESETTINGSIMP_H
#define CXESETTINGSIMP_H
+#include <QMetaMethod>
#include "cxesettings.h"
#include "cxeerror.h"
+#include "cxescenemodestore.h"
+
+// forward declaration
+class CxeSettingsStore;
-// forward declaration
-class CxeSettingsModel;
-
+typedef QPair<QObject*, QMetaMethod> CxeSettingListener;
+typedef QList<CxeSettingListener> CxeSettingListenerList;
/*
* Class to access all kind of Settings
@@ -34,28 +38,45 @@
public:
- CxeSettingsImp(CxeSettingsModel &settingsModel);
+ CxeSettingsImp(CxeSettingsStore *settingStore);
virtual ~CxeSettingsImp();
- CxeError::Id get(const QString &key, int &value) const;
- CxeError::Id get(const QString &key, QString &stringValue) const;
- CxeError::Id get(const QString &key, qreal &value) const;
void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) const;
- CxeError::Id set(const QString &key, int newValue);
- CxeError::Id set(const QString &key,const QString &newValue);
- CxeError::Id set(const QString &key, qreal newValue);
void reset();
+ CxeError::Id getVariationValue(const QString &key, QVariant &value);
+ bool listenForSetting(const QString &settingKey, QObject *target, const char *slot);
public slots:
void loadSettings(Cxe::CameraMode mode);
+protected:
+ void getValue(const QString &key, QVariant &value) const;
+ void setValue(const QString &key, const QVariant &newValue);
+
private: // helper methods
- CxeError::Id getSceneMode(const QString &key, QString &stringValue) const;
- CxeError::Id setSceneMode(const QString &key, const QString &stringValue);
+
+ void restoreImageSettings();
+ void restoreVideoSettings();
+
+ void setImageScene(const QString &newScene);
+ void setVideoScene(const QString &newScene);
+
+ void loadVariationSettings();
+
+ void notifyListeners(const QString &settingKey, const QVariant &newValue);
+
+private slots:
+ void handleListenerDestroyed(QObject *object);
private:
- CxeSettingsModel &mSettingsModel; // not owned
+
+ CxeSettingsStore *mSettingStore;
+ QHash<QString, QVariantList> mVariationSettings;
+ CxeSceneModeStore mSceneModeStore;
+ Cxe::CameraMode mCameraMode;
+
+ QMap<QString, CxeSettingListenerList> mSettingListeners;
};
#endif // CXESETTINGSIMP_H
--- a/camerauis/cameraxui/cxengine/inc/cxesettingsmappersymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingsmappersymbian.h Wed Aug 18 09:37:18 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,35 +14,39 @@
* Description:
*
*/
-/*
- * cxesettings.h
- *
- * Created on: Dec 30, 2008
- *
- */
-#ifndef CXESETTINGSMAPPERSYMBIAN_H_
-#define CXESETTINGSMAPPERSYMBIAN_H_
+#ifndef CXESETTINGSMAPPERSYMBIAN_H
+#define CXESETTINGSMAPPERSYMBIAN_H
#include <ecam.h>
#include <ecamadvsettings.h>
#include <ECamOrientationCustomInterface2.h>
+#include <ecamusecasehintcustomapi.h>
#include "cxeautofocuscontrol.h"
#include "cxenamespace.h"
-/*
-* Class to access all kind of Settings
+#include "cxequalitydetails.h"
+
+/*!
+ Map CameraX specific enums to ECam equivalents
*/
class CxeSettingsMapperSymbian
{
-
- public: // mappings functions that maps UI enum value to CCamera specific enum
- static CCamera::TWhiteBalance Map2CameraWb(int aWbId );
- static CCamera::TFlash Map2CameraFlash(int aFlashId );
- static CCamera::TExposure Map2CameraExposureMode(int aExpModeId );
- static CCamera::CCameraImageProcessing::TEffect Map2CameraEffect(int aColourFilterId );
- static CCamera::CCameraAdvancedSettings::TFocusRange Map2CameraAutofocus(CxeAutoFocusControl::Mode afMode);
- static MCameraOrientation::TOrientation Map2CameraOrientation(Cxe::DeviceOrientation orientation);
+public:
+ static CCamera::TWhiteBalance Map2CameraWb(Cxe::Whitebalance whiteBalance);
+ static CCamera::TFlash Map2CameraFlash(Cxe::FlashMode flashMode);
+ static CCamera::TExposure Map2CameraExposureMode(
+ Cxe::ExposureMode exposureMode);
+ static CCamera::CCameraImageProcessing::TEffect Map2CameraEffect(
+ Cxe::Colortone colorTone);
+ static CCamera::CCameraAdvancedSettings::TFocusRange Map2CameraAutofocus(
+ CxeAutoFocusControl::Mode afMode);
+ static MCameraOrientation::TOrientation Map2CameraOrientation(
+ Cxe::DeviceOrientation orientation);
+ static void Map2UseCaseHintVideoParameters(
+ const CxeVideoDetails &videoDetails,
+ MCameraUseCaseHint::TVideoCodec &codec,
+ MCameraUseCaseHint::TVideoProfile &profile);
};
-#endif /*CXESETTINGSMAPPERSYMBIAN_H_*/
+#endif /*CXESETTINGSMAPPERSYMBIAN_H*/
// end of file
--- a/camerauis/cameraxui/cxengine/inc/cxesettingsmodel.h Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +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 CXESETTINGSMODEL_H_
-#define CXESETTINGSMODEL_H_
-
-// Include Files
-#include <QVariant>
-#include "cxeerror.h"
-#include "cxenamespace.h"
-
-/*
-* Settings model class handles all settings data i.e. loading, saving, getting settings data based on the settings key.
-*/
-class CxeSettingsModel
-{
-
-public:
-
- virtual ~CxeSettingsModel() {};
-
- /*
- * resets and reload settings that qualify reseting
- * return CxeEngine specific error code
- */
- virtual void reset() = 0;
-
- /*
- * 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.
- * @returns CxeError::None if successful or any CxeError specific error code.
- */
- virtual CxeError::Id getSettingValue(const QString &key, QVariant &value) = 0;
-
- /*
- * Get setting value associated with the key.
- * @param uid - UID of component that owns the setting key
- * @Param key - key id of the setting
- * @param type - the type of key
- * @Param value - contains the value associated with the key.
- */
- virtual void getSettingValue(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) = 0;
-
- /*
- * 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.
- * @returns CxeError::None if successful or any CxeError specific error code.
- */
- virtual CxeError::Id getRuntimeValue(const QString &key, QVariant &value) = 0;
-
- /*
- * 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.
- * @returns CxeError::None if successful or any CxeError specific error code.
- */
- virtual CxeError::Id set(const QString &key,const QVariant newValue) = 0;
-
-
- /*
- * Returns the current image scene mode.
- */
- virtual CxeScene& currentImageScene() = 0;
-
- /*
- * Returns the current video scene mode.
- */
- virtual CxeScene& currentVideoScene() = 0;
-
- /*
- * Updating settings model whenever mode is changed from image to video and vice-versa.
- */
- virtual void cameraModeChanged(Cxe::CameraMode newMode) = 0;
-
- /*
- * Set a new image scene mode
- * @returns CxeError::None if successful or any CxeError specific error code.
- */
- virtual CxeError::Id setImageScene(const QString &newScene) = 0;
-
- /*
- * Set a new video scene mode
- * @returns CxeError::None if successful or any CxeError specific error code.
- */
- virtual CxeError::Id setVideoScene(const QString &newScene) = 0;
-
-};
-
-#endif // CXESETTINGSMODEL_H_
-
--- a/camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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 CXESETTINGSMODELIMP_H
-#define CXESETTINGSMODELIMP_H
-
-// Include Files
-#include <QHash>
-#include <QVariant>
-#include <QMetaType>
-#include "cxesettingsmodel.h"
-#include "cxenamespace.h"
-#include "cxeerror.h"
-
-// forward declarations
-class QVariant;
-class CxeSettingsStore;
-
-/*
-* Settings model class handles all settings data i.e. loading, saving, getting settings data based on the settings key.
-*/
-class CxeSettingsModelImp : public CxeSettingsModel
-{
-
-public:
-
- CxeSettingsModelImp(CxeSettingsStore *settingsStore);
- ~CxeSettingsModelImp();
-
-public:
-
- void reset();
- CxeError::Id getSettingValue(const QString &key, QVariant &value);
- void getSettingValue(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
- CxeError::Id getRuntimeValue(const QString &key, QVariant &value);
- CxeError::Id set(const QString &key, const QVariant newValue);
- CxeScene& currentImageScene();
- CxeScene& currentVideoScene();
- void cameraModeChanged(Cxe::CameraMode newMode);
- CxeError::Id setImageScene(const QString& newScene);
- CxeError::Id setVideoScene(const QString& newScene);
-
-private:
-
- void init();
- void loadRuntimeSettings();
-
- void loadImageScenes();
- void loadVideoScenes();
-
- CxeError::Id loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings);
- CxeError::Id sceneSettingValue(const QString &key, QVariant &value);
- CxeError::Id setSceneSettingValue(const QString &key, QVariant newValue);
-
- void supportedKeys(QList<QString> &runtimeKeys);
-
- CxeError::Id videoScene(const QString &sceneId, CxeScene &sceneSettings);
- CxeError::Id imageScene(const QString &sceneId, CxeScene &sceneSettings);
-
- void restoreImageSettings();
- void restoreVideoSettings();
-
-
-private:
-
- CxeSettingsStore *mSettingStore;
- QHash<QString, QVariantList> mRuntimeSettings;
-
- QHash<QString, CxeScene> mImageSceneModes;
- QHash<QString, CxeScene> mVideoSceneModes;
-
- CxeScene mCurrentImgScene;
- CxeScene mCurrentVidScene;
-
- Cxe::CameraMode mCameraMode;
-};
-
-Q_DECLARE_METATYPE(QVariantList)
-Q_DECLARE_METATYPE(CxeScene)
-
-#endif /* CXESETTINGSMODELIMP_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingsstore.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* 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 CXESETTINGSSTORE_H_
+#define CXESETTINGSSTORE_H_
+
+// Include Files
+#include <QHash>
+#include <QVariant>
+#include <QMetaType>
+#include "cxeerror.h"
+#include "cxenamespace.h"
+
+/*!
+* Settings store intrerface.
+*/
+class CxeSettingsStore
+{
+public:
+
+ /*!
+ * Destructor. Needs to be virtual.
+ */
+ 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 the settings store and starts monitoring it.
+ * \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 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 variation settings values from cenrep
+ * @param QList<QString> contains list of all runtime variation 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 variation settings should be done only ONCE at start-up. Its an overhead to read variation keys
+ * unnecessarily multiple times as the values of the runtime keys are not changed.
+ * Variation keys are only used to configure camerax application.
+ */
+ virtual QHash<QString, QVariantList> loadVariationSettings(QList<QString> &settingKeys) = 0;
+};
+
+
+#endif // CXESETTINGSSTORE_H_
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingsstoredesktop.h Wed Aug 18 09:37:18 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 CXESETTINGSSTOREDESKTOP_H_
+#define CXESETTINGSSTOREDESKTOP_H_
+
+// Include Files
+#include <QHash>
+#include <QVariant>
+#include <QMetaType>
+#include "cxesettingsstore.h"
+#include "cxeerror.h"
+
+/*!
+* CxeSettingsStoreDesktop class implements CxeSettingsStore.
+*/
+class CxeSettingsStoreDesktop : public QObject,
+ public CxeSettingsStore
+{
+ Q_OBJECT
+
+public:
+
+ CxeSettingsStoreDesktop();
+ ~CxeSettingsStoreDesktop();
+
+public: // from base class
+ void reset();
+ CxeError::Id get(const QString &key, 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<QString, QVariantList> loadVariationSettings(QList<QString> &settingKeys);
+
+private:
+ void initSettings();
+
+private:
+ QHash<QString, QVariant> mSettings;
+
+};
+
+#endif // CXESETTINGSSTOREDESKTOP_H_
+
--- a/camerauis/cameraxui/cxengine/inc/cxestatemachine.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestatemachine.h Wed Aug 18 09:37:18 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,6 +14,7 @@
* Description:
*
*/
+
#ifndef CXESTATEMACHINE_H
#define CXESTATEMACHINE_H
@@ -40,7 +41,7 @@
* @sa addState setInitialState
* @param stateMachineName Name for this state machine (used for debug prints)
*/
- CxeStateMachine(const char* stateMachineName);
+ CxeStateMachine(const char *stateMachineName);
virtual ~CxeStateMachine();
protected:
@@ -62,7 +63,7 @@
* @param stateId State ID of the new state
* @param error Optional error code to be associated with the transition
*/
- bool setState(int stateId, int error = 0);
+ bool setState(int stateId, CxeError::Id error = CxeError::None);
/**
* Set the initial state of the state machine. Can be called only once.
@@ -87,5 +88,3 @@
};
#endif // CXESTATEMACHINE_H
-
-
--- a/camerauis/cameraxui/cxengine/inc/cxestatemachinebase.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestatemachinebase.h Wed Aug 18 09:37:18 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,6 +14,7 @@
* Description:
*
*/
+
#ifndef CXESTATEMACHINEBASE_H
#define CXESTATEMACHINEBASE_H
@@ -52,7 +53,7 @@
* @sa addState setInitialState
* @param stateMachineName Name for this state machine (used for debug prints)
*/
- CxeStateMachineBase(const char* stateMachineName);
+ CxeStateMachineBase(const char *stateMachineName);
virtual ~CxeStateMachineBase();
protected:
@@ -76,7 +77,7 @@
* @return False if state change fails. True if changing is allowed, or the current state is same
* as the new state.
*/
- virtual bool setState(int stateId, int error = 0);
+ virtual bool setState(int stateId, CxeError::Id error = CxeError::None);
/**
* Set the initial state of the state machine. Can be called only once.
@@ -116,7 +117,7 @@
private:
//! Hash table of all states. stateId as key
- QHash<int, CxeState*> mStates;
+ QHash<int, CxeState *> mStates;
//! All states ORed together
int mStateBitsUsed;
@@ -130,5 +131,3 @@
};
#endif // CXESTATEMACHINEBASE_H
-
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxestillcapturecontroldesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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 CXESTILLCAPTURECONTROLDESKTOP_H
+#define CXESTILLCAPTURECONTROLDESKTOP_H
+
+#include <QList>
+#include <QVariant>
+
+#include "cxestillcapturecontrol.h"
+#include "cxeimagedataqueuedesktop.h"
+#include "cxenamespace.h"
+#include "cxeerror.h"
+#include "cxeautofocuscontrol.h"
+
+class CxeFilenameGenerator;
+class CxeFileSaveThread;
+class CxeStillImageDesktop;
+class CxeViewfinderControl;
+class CxeCameraDeviceControl;
+class CxeCameraDeviceDesktop;
+
+
+
+/**
+ * Class CxeStillCaptureControlSymbian.
+ * Inherits/implements CxeStillCaptureControl.
+ */
+class CxeStillCaptureControlDesktop : public CxeStillCaptureControl
+{
+ Q_OBJECT
+
+public: // constructors
+
+ CxeStillCaptureControlDesktop(CxeCameraDeviceDesktop &cameraDevice,
+ CxeViewfinderControl &viewfinderControl,
+ CxeCameraDeviceControl &cameraDeviceControl,
+ CxeFilenameGenerator &nameGenerator,
+ CxeAutoFocusControl &autoFocusControl,
+ CxeFileSaveThread &saveThread);
+
+ virtual ~CxeStillCaptureControlDesktop();
+
+public: // from CxeStillCaptureControl
+
+ void capture();
+ State state() const;
+ int imageCount() const;
+ void reset();
+ void cancelAll();
+ void setMode(CaptureMode mode);
+ CaptureMode mode() const;
+ CxeStillImage &operator[](int index);
+ CxeImageDataQueue &imageDataQueue();
+ QList<CxeImageDetails> supportedImageQualities();
+ int imagesLeft();
+
+signals:
+ void imagePrepareComplete(CxeError::Id error);
+ void prepareZoomForStill(int ecamStillResolutionIndex);
+
+public slots:
+ void init();
+ void deinit();
+
+protected slots:
+ // notifications when camera reference is changed
+ void prepareForCameraDelete();
+ void handleCameraAllocated(CxeError::Id error);
+
+ // notification for when camera is released
+ void prepareForRelease();
+
+ // settings call back
+ void handleSettingValueChanged(const QString &settingId, QVariant newValue);
+ void handleSceneChanged(CxeScene &scene);
+
+ // Autofocus events
+ void handleAutofocusStateChanged(CxeAutoFocusControl::State newState, CxeError::Id error);
+
+private: // helper functions
+ void updateFlashSetting(QVariant newValue);
+ void updateISOSetting(QVariant newValue);
+ void updateEVCompensationSetting(QVariant newValue);
+ CxeError::Id prepareFilename(CxeStillImageDesktop *stillImage);
+ void setOrientation(QVariant sensorData);
+ CxeStillImageDesktop *getImageForIndex(int index);
+ int prepareStillSnapshot();
+ CxeError::Id getImageQualityDetails(CxeImageDetails &imageInfo);
+ void handleSnapshotEvent(CxeError::Id error);
+ void initializeStates();
+ void prepare();
+
+private: // private data
+
+ State mState;
+ CxeImageDataQueueDesktop *mImageDataQueue; // own
+ CxeCameraDeviceDesktop &mCameraDevice;
+ CxeViewfinderControl &mViewfinderControl;
+ CxeCameraDeviceControl &mCameraDeviceControl;
+ CxeFilenameGenerator &mFilenameGenerator; //! @todo could be shared with video capture control?
+ CxeAutoFocusControl &mAutoFocusControl;
+ CaptureMode mMode;
+ CxeAutoFocusControl::State mAfState;
+ QList<CxeStillImageDesktop*> mImages;
+ CxeFileSaveThread &mSaveThread;
+
+ int mNextSnapshotIndex;
+ int mNextImageDataIndex;
+ //still resolutions supported by ICM
+ QList<CxeImageDetails> mSupportedImageQualities;
+ //still resolutions supported by ecam
+ //current image quality details
+ CxeImageDetails mCurrentImageDetails;
+};
+
+#endif // CXESTILLCAPTURECONTROLDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Wed Aug 18 09:37:18 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"
@@ -127,14 +127,18 @@
// sensor events
void handleSensorEvent(CxeSensorEventHandler::SensorType type,QVariant data);
+ // Use ECam Use Case Hint Custom API to inform ECam of our intended use case
+ // before calling Reserve()
+ void hintUseCase();
+
private: // helper functions
CxeError::Id prepareFilename(CxeStillImageSymbian *stillImage);
void setOrientation(QVariant sensorData);
CxeStillImageSymbian* getImageForIndex(int index);
CCamera::TFormat supportedStillFormat(Cxe::CameraIndex cameraIndex);
- int prepareStillSnapshot();
- CxeError::Id getImageQualityDetails(CxeImageDetails &imageInfo);
+ void prepareSnapshot();
+ void updateStillCaptureParameters();
void handleSnapshotEvent(CxeError::Id error);
void initializeStates();
void prepare();
@@ -168,6 +172,8 @@
QList<TSize> mECamSupportedImageResolutions;
//current image quality details in use
CxeImageDetails mCurrentImageDetails;
+ CCamera::TFormat mCaptureFormat;
+ int mSizeIndex; //!< ECam still capture size index
};
#endif // CXESTILLCAPTURECONTROLSYMBIAN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxestillimagedesktop.h Wed Aug 18 09:37:18 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 CXESTILLIMAGEDESKTOP_H
+#define CXESTILLIMAGEDESKTOP_H
+
+// Include Files
+#include <QString>
+#include <QPixmap>
+#include "cxestillimage.h"
+
+class CxeImageDataItem;
+
+class CxeStillImageDesktop : public CxeStillImage
+{
+public:
+ CxeStillImageDesktop();
+ virtual ~CxeStillImageDesktop();
+
+public: // from CxeStillImage
+ CxeImageDataItem *dataItem(); // NULL if already saved
+ QString filename() const;
+ QPixmap snapshot() const;
+ bool saved() const;
+ int id() const;
+
+public:
+ void setSnapshot(QPixmap pixmap);
+ void setFilename(const QString &filename);
+ void setSaved(bool saved);
+ void setDataItem(CxeImageDataItem *dataItem);
+
+private:
+ QPixmap mSnapshot;
+ CxeImageDataItem *mDataItem; // not own
+ QString mFilename;
+ bool mSaved;
+ const int mId;
+ static int mNextId;
+};
+
+#endif // CXESTILLIMAGEDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxestillimagesymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestillimagesymbian.h Wed Aug 18 09:37:18 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,30 +18,37 @@
#define CXESTILLIMAGESYMBIAN_H
// Include Files
-#include <QString>
-#include <QPixmap>
+#include <QObject>
+#include "cxeerror.h"
#include "cxestillimage.h"
+class QString;
+class QPixmap;
class CxeImageDataItem;
-class CxeStillImageSymbian : public CxeStillImage
+class CxeStillImageSymbian : public QObject,
+ public CxeStillImage
{
+ Q_OBJECT
public:
CxeStillImageSymbian();
virtual ~CxeStillImageSymbian();
public: // from CxeStillImage
- CxeImageDataItem* dataItem(); // NULL if already saved
+ CxeImageDataItem *dataItem(); // NULL if already saved
QString filename() const;
QPixmap snapshot() const;
bool saved() const;
int id() const;
public:
- void setSnapshot( QPixmap pixmap );
- void setFilename( const QString& filename );
- void setSaved( bool saved );
- void setDataItem( CxeImageDataItem* dataItem );
+ void setSnapshot(QPixmap pixmap);
+ void setFilename(const QString &filename);
+ void setSaved(bool saved);
+ void setDataItem(CxeImageDataItem *dataItem);
+
+private slots:
+ void imageDataSaved(CxeError::Id status);
private:
QPixmap mSnapshot;
--- a/camerauis/cameraxui/cxengine/inc/cxesysutil.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesysutil.h Wed Aug 18 09:37:18 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,7 +32,7 @@
public:
- static TBool DiskSpaceBelowCriticalLevel(
+ static bool DiskSpaceBelowCriticalLevel(
RFs* aFs,
TInt aBytesToWrite,
TInt aDrive );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxevideocapturecontroldesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* 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 CXEVIDEOCAPTURECONTROLDESKTOP_H_
+#define CXEVIDEOCAPTURECONTROLDESKTOP_H_
+
+#include <QTime>
+#include <QPixmap>
+#include <QTimer>
+
+#include "cxesettings.h"
+#include "cxevideocapturecontrol.h"
+#include "cxestatemachine.h"
+#include "cxenamespace.h"
+
+
+// Custom command for setting a new filename without closing & reopening the controller
+enum TCamCControllerCustomCommands
+ {
+ ECamCControllerCCNewFilename = 0,
+ ECamCControllerCCVideoStopAsync
+ };
+
+
+// forward declarations
+class CxeCameraDeviceDesktop;
+class CxeQualityPresets;
+class CxeFilenameGenerator;
+class CxeViewfinderControl;
+class CxeCameraDeviceControl;
+
+
+class CxeVideoCaptureControlDesktop : public CxeVideoCaptureControl
+{
+ Q_OBJECT
+
+public: // constructors
+
+ CxeVideoCaptureControlDesktop( CxeCameraDeviceDesktop &cameraDevice,
+ CxeViewfinderControl &viewfinderControl,
+ CxeCameraDeviceControl &cameraDeviceControl,
+ CxeFilenameGenerator &nameGenerator,
+ CxeQualityPresets &qualityPresets);
+
+ virtual ~CxeVideoCaptureControlDesktop();
+
+public: // functions from CxeVideoCaptureControl
+ CxeVideoCaptureControl::State state() const;
+ void record();
+ void pause();
+ void stop();
+ void remainingTime(int &time);
+ bool elapsedTime(int &time);
+ void reset();
+ QString filename() const;
+ QPixmap snapshot() const;
+ QList<CxeVideoDetails> supportedVideoQualities();
+
+public: // public member functions, not in client API
+ void handleSnapshotEvent(CxeError::Id error);
+
+signals:
+ void videoPrepareComplete(CxeError::Id error);
+ void prepareZoomForVideo();
+
+public slots:
+ //! Notification for when camera device is ready and we're entering video mode
+ void init();
+ //! Notification for when we're exiting video mode
+ void deinit();
+ //! Notification that videocapture sound has been played
+ void handleSoundPlayed();
+
+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);
+ void handleSceneChanged(CxeScene &scene);
+
+private: // helper methods
+ void releaseResources();
+ void initializeStates();
+ int prepareVideoSnapshot();
+ void initVideoRecorder();
+ void open();
+ void prepare();
+ void createVideoRecorder();
+ void setupElapseTimer();
+ void setState(CxeVideoCaptureControl::State stateId, CxeError::Id error = CxeError::None);
+
+private slots:
+ void handleElapseTimeout();
+
+private: // private data
+
+ CxeCameraDeviceDesktop &mCameraDevice;
+ CxeCameraDeviceControl &mCameraDeviceControl;
+ CxeViewfinderControl &mViewfinderControl;
+ CxeFilenameGenerator &mFilenameGenerator;
+ CxeQualityPresets &mQualityPresets;
+ //! Snapshot image.
+ QPixmap mSnapshot;
+ //! New file name generated for the video prepare.
+ QString mNewFileName;
+ //! Current video file name
+ QString mCurrentFilename;
+ CxeVideoCaptureControl::State mState;
+ //current video quality details in use
+ CxeVideoDetails mCurrentVideoDetails;
+
+ //timer for simulating elapsing time
+ QTimer mRecordElapseTimer;
+
+ //elapsed recording time in seconds
+ int mElapsedTime;
+};
+
+#endif /* CXEVIDEOCAPTURECONTROLDESKTOP_H_ */
--- a/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Wed Aug 18 09:37:18 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"
@@ -106,21 +106,23 @@
void handleCameraAllocated(CxeError::Id error);
void prepareForRelease();
// settings call back
- void handleSettingValueChanged(const QString& settingId,QVariant newValue);
+ void handleSettingValueChanged(const QString &settingId, QVariant newValue);
// scene mode change
- void handleSceneChanged(CxeScene& scene);
+ void handleSceneChanged(const QVariant &scene);
// Disk space change
void handleDiskSpaceChanged();
+ void hintUseCase();
private: // helper methods
void releaseResources();
void initializeStates();
- void getVideoQualityDetails(CxeVideoDetails &videoInfo);
+ void updateVideoCaptureParameters();
void initVideoRecorder();
void open();
void prepare();
+ void prepareSnapshot();
virtual void createVideoRecorder();
- int calculateRemainingTime(const CxeVideoDetails& videoDetails);
+ int calculateRemainingTime(const CxeVideoDetails &videoDetails);
void updateRemainingRecordingTimeCounter();
void generateFilename();
void handlePrepareFailed();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeviewfindercontroldesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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 CXEVIEWFINDERCONTROLDESKTOP_H_
+#define CXEVIEWFINDERCONTROLDESKTOP_H_
+
+#include "cxeviewfindercontrol.h"
+
+class CxeCameraDeviceDesktop;
+class CxeViewfinderWidgetDesktop;
+
+class CxeViewfinderControlDesktop : public CxeViewfinderControl
+{
+ Q_OBJECT
+public:
+
+ CxeViewfinderControlDesktop(CxeCameraDeviceDesktop &cameraDevice);
+ virtual ~CxeViewfinderControlDesktop();
+
+ virtual void setWindow(WId windowId);
+
+ virtual CxeError::Id start();
+
+ virtual void stop();
+
+ virtual CxeViewfinderControl::State state() const;
+
+ virtual QSize deviceDisplayResolution() const;
+
+private:
+ State mState;
+ WId mWindowId;
+ QSize mResolution;
+ CxeCameraDeviceDesktop &mCameraDevice;
+ CxeViewfinderWidgetDesktop *mViewfinderWidget;
+
+};
+
+#endif /*CXEVIEWFINDERCONTROLDESKTOP_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxeviewfinderwidgetdesktop.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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 CXEVIEWFINDERWIDGETDESKTOP_H
+#define CXEVIEWFINDERWIDGETDESKTOP_H
+
+#include <QGraphicsWidget>
+
+class QPixmap;
+
+class CxeViewfinderWidgetDesktop : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ CxeViewfinderWidgetDesktop();
+ virtual ~CxeViewfinderWidgetDesktop();
+
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+public slots:
+ void handleImageChange(const QPixmap &newImage);
+
+private:
+ QPixmap mCurrentPixmap;
+};
+
+#endif // CXEVIEWFINDERWIDGETDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxezoomcontroldesktop.h Wed Aug 18 09:37:18 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:
+*
+*/
+
+#ifndef CXEZOOMCONTROLDESKTOP_H
+#define CXEZOOMCONTROLDESKTOP_H
+
+#include "cxezoomcontrol.h"
+#include "cxestatemachine.h"
+#include "cxecameradevicecontrol.h"
+
+class CxeCameraDeviceControl;
+class CxeSettings;
+class CxeFeatureManager;
+
+class CxeZoomControlDesktop : public CxeZoomControl
+{
+ Q_OBJECT
+
+public: // constructors
+
+ CxeZoomControlDesktop(CxeCameraDeviceControl &cameraDeviceControl);
+
+ virtual ~CxeZoomControlDesktop();
+
+public:
+ // from CxeZoomControl
+ CxeZoomControl::State state() const;
+ int min() const;
+ int max() const;
+ void zoomTo(int value);
+
+protected slots:
+
+ // Slot to react to still capture signal:
+ // prepares the zoom control for still.
+ void prepareZoomForStill(int ecamStillResolutionIndex);
+
+ // Slot to react to video capture signal:
+ // prepares the zoom control for video.
+ void prepareZoomForVideo();
+
+ // Slot to prepare for camera delete signal.
+ void reset();
+
+private:
+ // private member functions
+ void init();
+ void finalizeZoomPreparation(int error);
+
+private:
+ // private data
+
+ CxeCameraDeviceControl &mCameraDeviceControl;
+
+ // Zoom levels
+ int mCurrentZoomLevel;
+ int mMinZoomLevel;
+ int mMaxZoomLevel;
+
+ // values ready from feature manager.
+ QList<int> mStillMaxZoomLimits;
+ QList<int> mVideoMaxZoomLimits;
+
+ CxeZoomControl::State mState;
+};
+
+#endif // CXEZOOMCONTROLDESKTOP_H
--- a/camerauis/cameraxui/cxengine/inc/cxezoomcontrolsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxezoomcontrolsymbian.h Wed Aug 18 09:37:18 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"
@@ -63,9 +63,6 @@
// Slot to prepare for camera delete signal.
void reset();
- // slot for setting value change
- void handleSettingValueChanged(const QString& settingId,QVariant newValue);
-
private:
// private member functions
void init();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontroldesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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 <QMetaType>
+#include <QImage>
+
+//#include "cxesettings.h"
+#include "cxeautofocuscontroldesktop.h"
+#include "cxutils.h"
+#include "cxestate.h"
+
+/*
+* CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian
+*/
+CxeAutoFocusControlDesktop::CxeAutoFocusControlDesktop()
+ : mCancelled(false),
+ mState(Unknown)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qRegisterMetaType<CxeAutoFocusControl::State>();
+
+ initializeStates();
+ initializeResources();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*
+* CxeAutoFocusControlDesktop::~CxeAutoFocusControlDesktop
+*/
+CxeAutoFocusControlDesktop::~CxeAutoFocusControlDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*
+* Start Autofocus
+*/
+CxeError::Id CxeAutoFocusControlDesktop::start(bool soundEnabled)
+{
+ Q_UNUSED(soundEnabled);
+
+ CX_DEBUG( ("CxeAutoFocusControlDesktop::start() <> state: %d", state() ) );
+
+ CxeError::Id err = CxeError::None;
+
+ if (state() != CxeAutoFocusControl::InProgress && state() != CxeAutoFocusControl::Canceling) {
+ CX_DEBUG(("CxeAutoFocusControlDesktop::start() calling SetAutoFocusType"));
+ mCancelled = false;
+ mState = Ready;
+ emit stateChanged(mState, CxeError::None);
+ } else { // AF was started earlier, can't start until it completes
+ err = CxeError::InUse;
+ }
+
+ CX_DEBUG( ("CxeAutoFocusControlDesktop::start() <= err : %d", err ) );
+
+ return err;
+}
+
+/*
+* Cancel Autofocus
+*/
+void CxeAutoFocusControlDesktop::cancel()
+{
+ CX_DEBUG( ("CxeAutoFocusControlSymbian::cancel <> state: %d", state() ) );
+
+ if (!mCancelled) {
+ if (state() == CxeAutoFocusControl::InProgress) {
+ // Need to stop current AF first. Wait for AF event to proceed.
+ mState = Canceling;
+ emit stateChanged(mState, CxeError::None);
+ } else if (state() != CxeAutoFocusControl::Canceling) {
+ // Cancel means move to hyperfocal.
+ mState = Canceling;
+ emit stateChanged(mState, CxeError::None);
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*
+* Set Autofocus mode
+*/
+void CxeAutoFocusControlDesktop::setMode(CxeAutoFocusControl::Mode newMode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mAfMode = newMode;
+ mCancelled = false;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*
+* returns Autofocus mode
+*/
+CxeAutoFocusControl::Mode CxeAutoFocusControlDesktop::mode() const
+{
+ return mAfMode;
+}
+
+/**
+* Is the given mode a fixed focus mode?
+*/
+bool CxeAutoFocusControlDesktop::isFixedFocusMode(CxeAutoFocusControl::Mode mode) const
+{
+ return (mode == CxeAutoFocusControl::Hyperfocal
+ || mode == CxeAutoFocusControl::Infinity);
+}
+
+/*
+* To check if Autofocus is supported
+*/
+bool CxeAutoFocusControlDesktop::supported() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ bool supported = true;
+ CX_DEBUG_EXIT_FUNCTION();
+ return supported;
+}
+
+/*
+* CxeAutoFocusControlDesktop::state
+*/
+CxeAutoFocusControl::State CxeAutoFocusControlDesktop::state() const
+{
+ return mState;
+}
+
+/*
+* CxeAutoFocusControlDesktop::initializeStates
+*/
+void CxeAutoFocusControlDesktop::initializeStates()
+{
+}
+
+/*
+* CxeAutoFocusControlDesktop::initializeResources
+*/
+void CxeAutoFocusControlDesktop::initializeResources()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Public method for checking if auto focus sound is enabled
+ * \return true if enabled
+ */
+bool CxeAutoFocusControlDesktop::isSoundEnabled() const
+{
+ return false; // should actually return mSoundEnabled
+}
+
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -401,10 +401,11 @@
/*
* Image Scene mode changed, get the new autofocus value
*/
-void CxeAutoFocusControlSymbian::handleSceneChanged(CxeScene& scene)
+void CxeAutoFocusControlSymbian::handleSceneChanged(const QVariant& sceneData)
{
CX_DEBUG_ENTER_FUNCTION();
+ CxeScene scene = sceneData.value<CxeScene>();
// whenever scene mode is changed we set the state to unknown
setState(CxeAutoFocusControl::Unknown);
@@ -442,14 +443,14 @@
if (KErrNone == error) {
setState(CxeAutoFocusControl::Ready);
} else {
- setState(CxeAutoFocusControl::Failed, error);
+ setState(CxeAutoFocusControl::Failed, CxeErrorHandlingSymbian::map(error));
}
} else if (eventUid == KUidECamEventCameraSettingFocusRangeUidValue) {
// check for error, we don't need this event for anything else
if (error != KErrNone) {
CX_DEBUG(("CxeAutofocusControlSymbian::handleAfEvent <> "
"KUidECamEventCameraSettingFocusRangeUidValue: autofocus failed %d", error));
- setState(CxeAutoFocusControl::Failed, error);
+ setState(CxeAutoFocusControl::Failed, CxeErrorHandlingSymbian::map(error));
}
}
break;
--- a/camerauis/cameraxui/cxengine/src/cxecameradevice.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxecameradevice.cpp Wed Aug 18 09:37:18 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,6 +16,7 @@
*/
#include <ECamOrientationCustomInterface2.h>
#include <ecamfacetrackingcustomapi.h>
+#include <ecamusecasehintcustomapi.h>
#include "cxecameradevice.h"
#include "cxeerrormappingsymbian.h"
@@ -72,6 +73,18 @@
CX_DEBUG_EXIT_FUNCTION();
}
+void CxeCameraDevice::reserveCamera()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mCamera) {
+ emit aboutToReserve();
+ mCamera->Reserve();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
void CxeCameraDevice::setCamera( CCamera *camera )
{
CX_DEBUG_ENTER_FUNCTION();
@@ -124,6 +137,11 @@
return mFaceTracking;
}
+MCameraUseCaseHint *CxeCameraDevice::useCaseHintApi()
+{
+ return mUseCaseHintApi;
+}
+
CxeError::Id CxeCameraDevice::initResources()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -131,6 +149,8 @@
TInt status = KErrNone;
if (mCamera) {
+ OstTrace0(camerax_performance, CXECAMERADEVICE_EXTENSIONS_1, "msg: e_CX_GET_CCAMERA_EXTENSIONS 1");
+
CX_DEBUG(("Get CCamera extensions.."));
mCameraOrientation = static_cast<MCameraOrientation*>(
@@ -141,6 +161,10 @@
mCamera->CustomInterface(KCameraFaceTrackingUid));
CX_DEBUG(("MCameraFaceTracking interface 0x%08x", mFaceTracking));
+ mUseCaseHintApi = static_cast<MCameraUseCaseHint*>(
+ mCamera->CustomInterface(KCameraUseCaseHintUid));
+ CX_DEBUG(("MCameraUseCaseHint interface 0x%08x", mUseCaseHintApi));
+
TRAPD(errorAdvSet, mAdvancedSettings =
CCamera::CCameraAdvancedSettings::NewL(*mCamera));
CX_DEBUG(("CCameraAdvancedSettings status: %d", errorAdvSet));
@@ -148,6 +172,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));
@@ -158,6 +183,8 @@
status = errorAdvSet != KErrNone
? errorAdvSet : errorSnap;
CX_DEBUG(("Total status: %d", status));
+
+ OstTrace0(camerax_performance, CXECAMERADEVICE_EXTENSIONS_2, "msg: e_CX_GET_CCAMERA_EXTENSIONS 0");
}
CX_DEBUG_EXIT_FUNCTION();
@@ -171,6 +198,7 @@
// not owned.
mCameraOrientation = NULL;
mFaceTracking = NULL;
+ mUseCaseHintApi = NULL;
delete mCameraSnapshot;
mCameraSnapshot = NULL;
@@ -190,7 +218,7 @@
CxeError::Id CxeCameraDevice::newCamera( Cxe::CameraIndex cameraIndex, MCameraObserver2 *observer )
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_IN, "msg: e_CX_CAMERADEVICE_CREATE_CCAMERA 1");
+ OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_IN, "msg: e_CX_CREATE_CCAMERA 1");
CX_DEBUG(("Cxe: using camera index %d", cameraIndex));
@@ -206,11 +234,12 @@
CX_DEBUG(("CxeCameraDevice::newCamera <> new CCamera"));
#endif
+ OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_OUT, "msg: e_CX_CREATE_CCAMERA 0");
+
if (!err) {
setCamera(camera);
}
- OstTrace0(camerax_performance, CXECAMERADEVICE_NEWCAMERA_OUT, "msg: e_CX_CAMERADEVICE_CREATE_CCAMERA 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(err);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxecameradevicecontroldesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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 "cxecameradevicecontroldesktop.h"
+#include "cxeviewfindercontroldesktop.h"
+#include "cxutils.h"
+
+CxeCameraDeviceControlDesktop::CxeCameraDeviceControlDesktop() : mIndex(Cxe::PrimaryCameraIndex), mMode(Cxe::ImageMode), mState(Idle)
+{
+ CX_DEBUG_IN_FUNCTION()
+}
+
+CxeCameraDeviceControlDesktop::~CxeCameraDeviceControlDesktop()
+{
+ CX_DEBUG_IN_FUNCTION()
+}
+
+/**
+ * Get current camera mode.
+ */
+Cxe::CameraMode CxeCameraDeviceControlDesktop::mode() const
+{
+ return mMode;
+}
+/**
+ * Set current camera mode.
+ */
+void CxeCameraDeviceControlDesktop::setMode(Cxe::CameraMode mode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mMode = mode;
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void CxeCameraDeviceControlDesktop::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ setState(CxeCameraDeviceControl::Ready);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Reserve camera device for exclusive use.
+ */
+void CxeCameraDeviceControlDesktop::reserve()
+{
+ CX_DEBUG_IN_FUNCTION()
+}
+
+/**
+ * Cancel all operations and release camera for other applications to use.
+ * Camera module is also powered off.
+ */
+void CxeCameraDeviceControlDesktop::release()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ setState(CxeCameraDeviceControl::Idle);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Get current camera index (primary or secondary).
+ *
+ * @return Current camera index
+ */
+Cxe::CameraIndex CxeCameraDeviceControlDesktop::cameraIndex() const
+{
+ return mIndex;
+}
+
+/**
+ * Switch between primary and secondary camera.
+ *
+ * @param index New camera index
+ */
+CxeError::Id CxeCameraDeviceControlDesktop::switchCamera(Cxe::CameraIndex index)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mIndex = index;
+ setState(CxeCameraDeviceControl::Ready);
+ return CxeError::None;
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Get current device control state.
+ *
+ * @return Current state
+ */
+CxeCameraDeviceControl::State CxeCameraDeviceControlDesktop::state() const
+{
+ return mState;
+}
+
+void CxeCameraDeviceControlDesktop::setState(CxeCameraDeviceControl::State stateId, CxeError::Id error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mState = stateId;
+ emit stateChanged(mState, error);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxecameradevicecontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxecameradevicecontrolsymbian.cpp Wed Aug 18 09:37:18 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,6 @@
#include "cxecameradevicecontrolsymbian.h"
#include "cxesettingsimp.h"
#include "cxefeaturemanagerimp.h"
-#include "cxesettingsmodel.h"
#include "cxutils.h"
#include "cxenamespace.h"
#include "cxeerrormappingsymbian.h"
@@ -82,7 +81,7 @@
if (state() == Idle) {
setState(Initializing);
- mCameraDevice->camera()->Reserve();
+ mCameraDevice->reserveCamera();
OstTrace0(camerax_performance, CXECAMERADEVICECONTROLSYMBIAN_RESERVE, "msg: e_CX_RESERVE 1");
} else if (state() == PendingRelease) {
// if we get a reserve request and if there is a pending release
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxecameradevicedesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* 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 "cxecameradevicedesktop.h"
+
+#include <QTimer>
+#include <QDir>
+#include "cxutils.h"
+
+
+/*!
+* Constructor
+*/
+CxeCameraDeviceDesktop::CxeCameraDeviceDesktop() :
+ mSwitchPictureTimer(0),
+ mPictureIndex(0)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ loadPictures();
+ setupTimer();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Destructor
+*/
+CxeCameraDeviceDesktop::~CxeCameraDeviceDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mSwitchPictureTimer->stop();
+ delete mSwitchPictureTimer;
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Start the camera device
+*/
+void CxeCameraDeviceDesktop::start()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (!mSwitchPictureTimer->isActive()) {
+ mSwitchPictureTimer->start();
+ CX_DEBUG_EXIT_FUNCTION();
+ }
+}
+
+/*!
+* Stop the camera device
+*/
+void CxeCameraDeviceDesktop::stop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mSwitchPictureTimer->stop();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Get current picture
+* @ Return current picture
+*/
+const QPixmap &CxeCameraDeviceDesktop::currentSnaphot()
+{
+ return mPictureList.at(mPictureIndex);
+}
+
+/*!
+* Handle timeout
+*/
+void CxeCameraDeviceDesktop::handleTimeout()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mPictureIndex++;
+
+ if (mPictureIndex >= mPictureList.count()) {
+ mPictureIndex = 0;
+ }
+
+ emit imageChanged(mPictureList.at(mPictureIndex));
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Load pictures
+*/
+void CxeCameraDeviceDesktop::loadPictures()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QDir currentDir(".","*.jpg");
+
+ if (!currentDir.count()) {
+ mPictureList.append(QPixmap(360, 640));
+ return;
+ }
+
+ foreach (QString entry, currentDir.entryList()){
+ mPictureList.append(QPixmap(entry).scaledToHeight(360));
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Create timer
+*/
+void CxeCameraDeviceDesktop::setupTimer()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mSwitchPictureTimer = new QTimer(this);
+ mSwitchPictureTimer->setInterval(500);
+ mSwitchPictureTimer->setSingleShot(false);
+ connect(mSwitchPictureTimer, SIGNAL(timeout()), this, SLOT(handleTimeout()));
+ CX_DEBUG_EXIT_FUNCTION();
+}
--- a/camerauis/cameraxui/cxengine/src/cxeengine.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeengine.cpp Wed Aug 18 09:37:18 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,15 +17,23 @@
#include "cxutils.h"
#include "cxeengine.h"
+#ifdef Q_OS_SYMBIAN
#include "cxeenginesymbian.h"
-
+#else
+#include "cxeenginedesktop.h"
+#endif
// This should be the only exported method
-EXPORT_C CxeEngine* CxeEngine::createEngine()
+CAMERAX_ENGINE_EXPORT CxeEngine* CxeEngine::createEngine()
{
CX_DEBUG_ENTER_FUNCTION();
+#ifdef Q_OS_SYMBIAN
CxeEngineSymbian *res = new CxeEngineSymbian();
+#else // Q_OS_SYMBIAN
+ CxeEngineDesktop *res = new CxeEngineDesktop();
+#endif // Q_OS_SYMBIAN
+
res->construct();
CX_DEBUG_EXIT_FUNCTION();
return res;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxeenginedesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,356 @@
+/*
+* 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 "cxeenginedesktop.h"
+#include "cxecameradevicecontroldesktop.h"
+#include "cxestillcapturecontroldesktop.h"
+#include "cxevideocapturecontroldesktop.h"
+#include "cxeviewfindercontroldesktop.h"
+#include "cxefilenamegeneratordesktop.h"
+#include "cxeautofocuscontroldesktop.h"
+#include "cxezoomcontroldesktop.h"
+#include "cxequalitypresetsdesktop.h"
+#include "cxutils.h"
+#include "cxesettingsimp.h"
+#include "cxefeaturemanagerimp.h"
+#include "cxesettingsstoredesktop.h"
+#include "cxesensoreventhandlerdesktop.h"
+#include "cxefilesavethreaddesktop.h"
+#include "cxecameradevicedesktop.h"
+#include "cxememorymonitor.h"
+#include "cxegeotaggingtrail.h"
+
+
+// Member Functions
+
+CxeEngineDesktop::CxeEngineDesktop()
+ : mCameraDeviceControl(NULL),
+ mViewfinderControl(NULL),
+ mSnapshotControl(NULL),
+ mStillCaptureControl(NULL),
+ mVideoCaptureControl(NULL),
+ mAutoFocusControl(NULL),
+ mZoomControl(NULL),
+ mImageDataQueue(NULL),
+ mSettings(NULL),
+ mFeatureManager(NULL),
+ mFilenameGenerator(NULL),
+ mSensorEventHandler(NULL),
+ mQualityPresets(NULL),
+ mFileSaveThread(NULL),
+ mCameraDevice(NULL),
+ mDiskMonitor(NULL),
+ mMemoryMonitor(NULL),
+ mGeoTaggingTrail(NULL)
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+
+/*!
+ Create all control classes and connect relevant signals
+*/
+void CxeEngineDesktop::construct()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ createControls();
+ connectSignals();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+ Create all control classes
+*/
+void CxeEngineDesktop::createControls()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (!mVideoCaptureControl) {
+ CxeCameraDeviceControlDesktop *deviceControl =
+ new CxeCameraDeviceControlDesktop();
+
+ mCameraDeviceControl = deviceControl;
+
+ mQualityPresets = new CxeQualityPresetsDesktop();
+ CX_DEBUG_ASSERT(mQualityPresets);
+
+ CxeSettingsStoreDesktop *settingsStore = new CxeSettingsStoreDesktop();
+
+ //ownership of settings store transferred to the settings.
+ mSettings = new CxeSettingsImp(settingsStore);
+
+ // Loading current camera mode value from settings store and updating
+ // devicecontrol
+ Cxe::CameraMode cameraMode = mSettings->get<Cxe::CameraMode>(CxeSettingIds::CAMERA_MODE, Cxe::ImageMode);
+ // set current camera mode to devicecontrol.
+ mCameraDeviceControl->setMode(cameraMode);
+
+ static_cast<CxeSettingsImp*>(mSettings)->loadSettings(mode());
+
+ mFeatureManager = new CxeFeatureManagerImp(*mSettings);
+
+ mMemoryMonitor = new CxeMemoryMonitor(*mFeatureManager);
+
+ // sensor event handler initialization
+ mSensorEventHandler = new CxeSensorEventHandlerDesktop();
+
+ mFilenameGenerator = new CxeFilenameGeneratorDesktop();
+
+ mFileSaveThread = new CxeFileSaveThreadDesktop(this);
+
+ mCameraDevice = new CxeCameraDeviceDesktop();
+
+ mViewfinderControl = new CxeViewfinderControlDesktop(*mCameraDevice);
+
+ mAutoFocusControl = new CxeAutoFocusControlDesktop();
+
+ mStillCaptureControl = new CxeStillCaptureControlDesktop(
+ *mCameraDevice, *mViewfinderControl,
+ *mCameraDeviceControl, *mFilenameGenerator,
+ *mAutoFocusControl, *mFileSaveThread);
+
+ mZoomControl = new CxeZoomControlDesktop(*mCameraDeviceControl);
+
+ mVideoCaptureControl = new CxeVideoCaptureControlDesktop(
+ *mCameraDevice,*mViewfinderControl,
+ *mCameraDeviceControl, *mFilenameGenerator,
+ *mQualityPresets);
+
+ mGeoTaggingTrail = new CxeGeoTaggingTrail(*mStillCaptureControl,
+ *mVideoCaptureControl, *mSettings);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ Connect internal signals for control classes
+*/
+
+void CxeEngineDesktop::connectSignals()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // connecting scene setting change callbacks to ViewfinderControl
+ connect(mSettings,
+ SIGNAL(settingValueChanged(const QString&,QVariant)),
+ mViewfinderControl,
+ SLOT(handleSettingValueChanged(const QString&,QVariant)));
+
+ connect(mSettings,
+ SIGNAL(sceneChanged(CxeScene&)),
+ mViewfinderControl,
+ SLOT(handleSceneChanged(CxeScene&)));
+
+ // enabling scene setting change callbacks to Autofocus control
+ connect(mSettings,
+ SIGNAL(sceneChanged(CxeScene&)),
+ mAutoFocusControl,
+ SLOT(handleSceneChanged(CxeScene&)));
+
+ // connecting Autofocus state change callbacks to stillcapturecontrol
+ connect(mAutoFocusControl,
+ SIGNAL(stateChanged(CxeAutoFocusControl::State, CxeError::Id)),
+ mStillCaptureControl,
+ SLOT(handleAutofocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
+
+ // Connect signals for ECam events
+ connect(mCameraDeviceControl,
+ SIGNAL(cameraEvent(int,int)),
+ mVideoCaptureControl,
+ SLOT(handleCameraEvent(int,int)));
+
+ connect(mCameraDeviceControl,
+ SIGNAL(cameraEvent(int,int)),
+ mAutoFocusControl,
+ SLOT(handleCameraEvent(int,int)));
+
+ // Connect signal for device ready events
+ connect(mCameraDeviceControl,
+ SIGNAL(deviceReady()),
+ this,
+ SLOT(doInit()));
+
+ // Connect image and video init complete signals to
+ // CameraDeviceControl initModeComplete
+ connect(mStillCaptureControl,
+ SIGNAL(imagePrepareComplete(CxeError::Id)),
+ mCameraDeviceControl,
+ SIGNAL(initModeComplete(CxeError::Id)));
+
+ connect(mVideoCaptureControl,
+ SIGNAL(videoPrepareComplete(CxeError::Id)),
+ mCameraDeviceControl,
+ SIGNAL(initModeComplete(CxeError::Id)));
+
+ // Zoom is prepared once the image/video emits prepare zoom signals
+ connect(mStillCaptureControl,
+ SIGNAL(prepareZoomForStill(int)),
+ mZoomControl,
+ SLOT(prepareZoomForStill(int)));
+
+ connect(mVideoCaptureControl,
+ SIGNAL(prepareZoomForVideo()),
+ mZoomControl,
+ SLOT(prepareZoomForVideo()));
+
+ // connect camera device control prepare for release signal to stop location trail slot
+ connect(mCameraDevice,
+ SIGNAL(prepareForRelease()),
+ mGeoTaggingTrail,
+ SLOT(stop()), Qt::UniqueConnection);
+
+ // init camera device control. We init the camera device control
+ // when all necessary engine classes are constructed.
+ mCameraDeviceControl->init();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+CxeEngineDesktop::~CxeEngineDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ delete mGeoTaggingTrail;
+ delete mAutoFocusControl;
+ delete mZoomControl;
+ delete mStillCaptureControl;
+ delete mVideoCaptureControl;
+ delete mViewfinderControl;
+ delete mFilenameGenerator;
+ delete mMemoryMonitor;
+ delete mFeatureManager;
+ delete mSettings;
+ delete mCameraDeviceControl;
+ delete mQualityPresets;
+ delete mCameraDevice;
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+CxeCameraDeviceControl &CxeEngineDesktop::cameraDeviceControl()
+{
+ return *mCameraDeviceControl;
+}
+
+CxeViewfinderControl &CxeEngineDesktop::viewfinderControl()
+{
+ return *mViewfinderControl;
+}
+
+CxeSnapshotControl &CxeEngineDesktop::snapshotControl()
+{
+ return *mSnapshotControl;
+}
+
+CxeStillCaptureControl &CxeEngineDesktop::stillCaptureControl()
+{
+ return *mStillCaptureControl;
+}
+
+CxeVideoCaptureControl &CxeEngineDesktop::videoCaptureControl()
+{
+ return *mVideoCaptureControl;
+}
+
+CxeAutoFocusControl &CxeEngineDesktop::autoFocusControl()
+{
+ return *mAutoFocusControl;
+}
+
+CxeZoomControl &CxeEngineDesktop::zoomControl()
+{
+ return *mZoomControl;
+}
+
+// Get the settings handle
+CxeSettings &CxeEngineDesktop::settings()
+{
+ return *mSettings;
+}
+
+CxeFeatureManager& CxeEngineDesktop::featureManager()
+{
+ return *mFeatureManager;
+}
+
+/*
+* Returns true, if the engine is ready or else false.
+*/
+bool CxeEngineDesktop::isEngineReady()
+{
+ bool ready = true;
+ return ready;
+}
+
+/*!
+* Get memory monitor utility handle.
+*/
+CxeMemoryMonitor &CxeEngineDesktop::memoryMonitor()
+{
+ return *mMemoryMonitor;
+}
+
+/*!
+ * Get geotaggingtrail handle
+ */
+CxeGeoTaggingTrail &CxeEngineDesktop::geoTaggingTrail()
+{
+ return *mGeoTaggingTrail;
+}
+
+Cxe::CameraMode CxeEngineDesktop::mode() const
+{
+ return mCameraDeviceControl->mode();
+}
+
+/*!
+ * Set camera mode.
+ */
+void CxeEngineDesktop::setMode(Cxe::CameraMode mode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mCameraDeviceControl->setMode(mode);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void CxeEngineDesktop::initMode(Cxe::CameraMode cameraMode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mCameraDeviceControl->setMode(cameraMode);
+
+ // load settings whenever we change mode or start camera or switch camera
+ CxeSettingsImp *settingsImp = qobject_cast<CxeSettingsImp*>(mSettings);
+ if (settingsImp) {
+ settingsImp->loadSettings(mode());
+ }
+
+ if (cameraMode == Cxe::ImageMode) {
+ mVideoCaptureControl->deinit();
+ mStillCaptureControl->init();
+ } else {
+ mStillCaptureControl->deinit();
+ mVideoCaptureControl->init();
+ }
+ mFilenameGenerator->init(cameraMode);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// End of file
--- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -31,7 +31,6 @@
#include "cxutils.h"
#include "cxesettingsimp.h"
#include "cxefeaturemanagerimp.h"
-#include "cxesettingsmodelimp.h"
#include "cxesettingscenrepstore.h"
#include "cxesoundplayersymbian.h"
#include "cxesensoreventhandlersymbian.h"
@@ -40,6 +39,7 @@
#include "cxememorymonitor.h"
#include "cxediskmonitor.h"
#include "cxegeotaggingtrail.h"
+#include "cxeexception.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
@@ -61,7 +61,6 @@
mZoomControl(NULL),
mSettings(NULL),
mFeatureManager(NULL),
- mSettingsModel(NULL),
mFilenameGenerator(NULL),
mSensorEventHandler(NULL),
mQualityPresets(NULL),
@@ -97,8 +96,8 @@
CX_DEBUG_ENTER_FUNCTION();
// Check we do this only once.
- if (!mSettingsModel) {
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "e_CX_ENGINE_CREATE_CONTROLS 1");
+ if (!mSettings) {
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "msg: e_CX_ENGINE_CREATE_CONTROLS 1");
CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian();
mCameraDeviceControl = deviceControl;
@@ -115,24 +114,23 @@
} else {
settingsStore = new CxeSettingsCenRepStore();
}
- //ownership of settings store transferred to the settings model.
- mSettingsModel = new CxeSettingsModelImp(settingsStore);
- // assert if settings model fails to intialize
- CX_DEBUG_ASSERT(mSettingsModel);
- mSettings = new CxeSettingsImp(*mSettingsModel);
+ //ownership of settings store transferred to the settings
+ mSettings = new CxeSettingsImp(settingsStore);
- // Loading current camera mode value from settings store and updating
- // devicecontrol
+ // 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<Cxe::CameraMode>(value);
+
+ try {
+ cameraMode = mSettings->get<Cxe::CameraMode>(CxeSettingIds::CAMERA_MODE);
+ } catch (CxeException &e) {
+ CX_DEBUG(("Failed to read camera mode from settings, using image mode. Error code: %d", e.error()));
}
+
// set current camera mode to devicecontrol.
mCameraDeviceControl->setMode(cameraMode);
-
+
//! @todo a temporary hack to change the startup sequence to avoid GOOM problems
static_cast<CxeSettingsImp*>(mSettings)->loadSettings(mode());
@@ -141,7 +139,7 @@
connect(settingsStore, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)));
- mFeatureManager = new CxeFeatureManagerImp(*mSettingsModel);
+ mFeatureManager = new CxeFeatureManagerImp(*mSettings);
// Memory monitor needed as early as possible to request free memory.
// Note: Throws error if enough memory cannot be freed!
@@ -163,7 +161,7 @@
mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
- mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice,
+ mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice,
*mSettings);
mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread();
@@ -186,7 +184,7 @@
*mVideoCaptureControl,
*mSettings);
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0");
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "msg: e_CX_ENGINE_CREATE_CONTROLS 0");
}
CX_DEBUG_EXIT_FUNCTION();
@@ -198,13 +196,11 @@
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,
- SIGNAL(sceneChanged(CxeScene&)),
- mAutoFocusControl,
- SLOT(handleSceneChanged(CxeScene&)));
+ mSettings->listenForSetting(CxeSettingIds::IMAGE_SCENE_DATA, mAutoFocusControl, SLOT(handleSceneChanged(const QVariant&)));
+ mSettings->listenForSetting(CxeSettingIds::VIDEO_SCENE_DATA, mAutoFocusControl, SLOT(handleSceneChanged(const QVariant&)));
// connecting Autofocus state change callbacks to stillcapturecontrol
connect(mAutoFocusControl,
@@ -272,7 +268,6 @@
mFileSaveThread,
SLOT(handleSnapshotReady(CxeError::Id, const QImage&, const QString&)));
-
// stop location trail when releasing camera.
connect(mCameraDevice,
SIGNAL(prepareForRelease()),
@@ -280,7 +275,30 @@
SLOT(stop()),
Qt::UniqueConnection);
- OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "e_CX_ENGINE_CONNECT_SIGNALS 0");
+ // Use MCameraUseCaseHint API before calling Reserve()
+ connect(mCameraDevice,
+ SIGNAL(aboutToReserve()),
+ mStillCaptureControl,
+ SLOT(hintUseCase()),
+ Qt::UniqueConnection);
+ connect(mCameraDevice,
+ SIGNAL(aboutToReserve()),
+ mVideoCaptureControl,
+ SLOT(hintUseCase()),
+ Qt::UniqueConnection);
+
+ // Start / stop geotagging based on mode.
+ // Do this later to reduce startup time.
+ connect(mStillCaptureControl,
+ SIGNAL(imagePrepareComplete(CxeError::Id)),
+ this,
+ SLOT(initGeotagging()));
+ connect(mVideoCaptureControl,
+ SIGNAL(videoPrepareComplete(CxeError::Id)),
+ this,
+ SLOT(initGeotagging()));
+
+ OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -288,10 +306,10 @@
CxeEngineSymbian::~CxeEngineSymbian()
{
CX_DEBUG_ENTER_FUNCTION();
-
+
// Saving current camera mode to cenrep
saveMode();
-
+
delete mGeoTaggingTrail;
delete mAutoFocusControl;
delete mZoomControl;
@@ -305,7 +323,6 @@
delete mMemoryMonitor;
delete mFeatureManager;
delete mSettings;
- delete mSettingsModel;
delete mCameraDeviceControl;
delete mQualityPresets;
delete mFileSaveThread;
@@ -356,7 +373,7 @@
return *mSettings;
}
-/*!
+/*!
Returns the sensor event handle
*/
CxeSensorEventHandler &CxeEngineSymbian::sensorEventHandler()
@@ -415,7 +432,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
@@ -425,20 +442,14 @@
}
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();
}
@@ -526,6 +537,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"));
@@ -577,12 +589,14 @@
}
}
+ OstTrace0(camerax_performance, CXEENGINE_INITMODE_OUT, "msg: e_CX_ENGINE_INIT_MODE 0");
CX_DEBUG_EXIT_FUNCTION();
}
void CxeEngineSymbian::reserve()
{
CX_DEBUG_ENTER_FUNCTION();
+ // Start reserving camera HW.
mCameraDeviceControl->reserve();
emit reserveStarted();
CX_DEBUG_EXIT_FUNCTION();
@@ -597,8 +611,11 @@
CX_DEBUG_ENTER_FUNCTION();
if (mCameraDeviceControl && mSettings) {
- int value = mCameraDeviceControl->mode();
- mSettings->set(CxeSettingIds::CAMERA_MODE, value);
+ try {
+ mSettings->set(CxeSettingIds::CAMERA_MODE, mCameraDeviceControl->mode());
+ } catch (CxeException &e) {
+ CX_DEBUG(("Failed to save camera mode, error=%d", e.error()));
+ }
}
CX_DEBUG_EXIT_FUNCTION();
@@ -606,23 +623,32 @@
/*!
-* Start geotagging trail.
+* Initialize geotagging.
+* Check if we are allowed to start the geotagging and if it's supported in current mode.
*/
-void CxeEngineSymbian::startGeotaggingTrail()
+void CxeEngineSymbian::initGeotagging()
{
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);
+ if (mode() == Cxe::ImageMode) {
+ // Location trail is limited to image mode only for now.
+ Cxe::GeoTaggingDisclaimer value =
+ mSettings->get<Cxe::GeoTaggingDisclaimer>(
+ CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled);
- // we start location trail only when Geotagging First-time-use note is accepted by user.
- if (value == Cxe::GeoTaggingDisclaimerDisabled) {
- mGeoTaggingTrail->start();
+ // we start location trail only when Geotagging First-time-use note is accepted by user.
+ if (value == Cxe::GeoTaggingDisclaimerDisabled) {
+ mGeoTaggingTrail->start();
+ }
+ } else {
+ // Geotagging is not (yet) supported in video mode.
+ mGeoTaggingTrail->stop();
}
}
-
+
+ OstTrace0(camerax_performance, CXEENGINE_START_GEO_OUT, "msg: e_CX_ENGINE_START_GEOTAGGING 0");
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/src/cxefeaturemanagerimp.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefeaturemanagerimp.cpp Wed Aug 18 09:37:18 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,21 +23,24 @@
#include <QList>
#include <QMetaType>
-#include "cxesettingsmodel.h"
+#include "cxesettings.h"
#include "cxefeaturemanagerimp.h"
#include "cxutils.h"
#include "cxeerror.h"
-/*
-* CxeFeatureManagerImp::isFeatureSupported
+/*!
+* Returns if a feature is supported or not
+* @param key Feature key
+* @param supported Returned boolean to indicate whether feature is supported or not
+* @return Error code
*/
CxeError::Id CxeFeatureManagerImp::isFeatureSupported(const QString& key, bool& supported) const
{
CX_DEBUG_ENTER_FUNCTION();
QVariant value;
- CxeError::Id err = mSettingsModel.getRuntimeValue(key, value);
+ CxeError::Id err = mSettings.getVariationValue(key, value);
if (err == CxeError::None) {
QList<QVariant> values = qVariantValue<QList<QVariant> >(value);
supported = values[0].toInt();
@@ -52,8 +55,11 @@
-/*
-* CxeFeatureManagerImp::configuredValues
+/*!
+* Retrieves all the configured values for the given key
+* @param key Feature key
+* @param values Returned values
+* @return Error code
*/
CxeError::Id CxeFeatureManagerImp::configuredValues(const QString& key,QList<int>& values)
{
@@ -62,7 +68,7 @@
values.clear();
QVariant variant;
- CxeError::Id err = mSettingsModel.getRuntimeValue(key, variant);
+ CxeError::Id err = mSettings.getVariationValue(key, variant);
if(CxeError::None == err) {
QVariantList list;
@@ -94,8 +100,8 @@
/*
*CxeFeatureManagerImp::CxeFeatureManagerImp
*/
-CxeFeatureManagerImp::CxeFeatureManagerImp(CxeSettingsModel& settingsModel)
-: mSettingsModel(settingsModel)
+CxeFeatureManagerImp::CxeFeatureManagerImp(CxeSettings &settings)
+: mSettings(settings)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_EXIT_FUNCTION();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxefilenamegeneratordesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* 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 "cxefilenamegeneratordesktop.h"
+
+#include <QDate>
+#include <qdebug.h>
+
+#ifdef Q_OS_WIN32
+const char* IMAGE_BASE_FOLDER = "C:\\Users\\My Pictures\\CameraX";
+const char* VIDEO_BASE_FOLDER = "C:\\Users\\My Videos\\CameraX";
+const char* IMAGE_EXTENSION = "jpg";
+const char* VIDEO_EXTENSION = "mp4";
+const char* FOLDER_SEPARATOR = "\\";
+const char* FILE_SUFFIX = ".";
+#else
+const char* IMAGE_BASE_FOLDER = "";
+const char* VIDEO_BASE_FOLDER = "";
+const char* IMAGE_EXTENSION = "";
+const char* VIDEO_EXTENSION = "";
+const char* FOLDER_SEPARATOR = "/";
+const char* FILE_SUFFIX = ".";
+#endif
+
+CxeFilenameGeneratorDesktop::CxeFilenameGeneratorDesktop() : mMode(Cxe::ImageMode),
+ mImageBaseFolder(IMAGE_BASE_FOLDER),
+ mVideoBaseFolder(VIDEO_BASE_FOLDER),
+ mImageExtension(IMAGE_EXTENSION),
+ mVideoExtension(VIDEO_EXTENSION),
+ mImageSequenceNumber(0),
+ mVideoSequenceNumber(0)
+{
+
+}
+
+CxeFilenameGeneratorDesktop::~CxeFilenameGeneratorDesktop()
+{
+
+}
+
+/**
+ * Initialize the file name generator for the given mode.
+ * @param mode: current camera mode (image/video)
+ * @return error id, Id::None if no error
+ */
+CxeError::Id CxeFilenameGeneratorDesktop::init(Cxe::CameraMode mode)
+{
+ mMode = mode;
+ return CxeError::None;
+}
+
+/**
+ * This must be called for every burst capture.
+ */
+void CxeFilenameGeneratorDesktop::startNewImageFilenameSequence()
+{
+ mImageSequenceNumber = 0;
+}
+
+/**
+ * Generates the next file name in the sequence.
+ * @param filename: A QString reference to hold the filename
+ * @return error id, Id::None if no error
+ */
+CxeError::Id CxeFilenameGeneratorDesktop::nextImageFilenameInSequence(QString &filename, const QString &fileExt)
+{
+ mImageExtension = fileExt;
+ getNextImageFilename(filename);
+ raiseCounterValue();
+ return CxeError::None;
+}
+
+/**
+ * Generates image/video file name depending on the current active mode.
+ * @param filename: A QString reference to hold the filename
+ * @return error id, CxeError::None if no error.
+ */
+CxeError::Id CxeFilenameGeneratorDesktop::generateFilename(QString &filename, const QString &fileExt)
+{
+ mImageExtension = fileExt;
+ if (Cxe::ImageMode == mMode) {
+ nextImageFilenameInSequence(filename, fileExt);
+ } else {
+ getNextVideoFilename(filename);
+ }
+
+ return CxeError::None;
+}
+
+void CxeFilenameGeneratorDesktop::getNextImageFilename(QString& filename)
+{
+ filename = assembleFilename(mImageBaseFolder, mImageSequenceNumber, mImageExtension);
+ return;
+}
+
+void CxeFilenameGeneratorDesktop::getNextVideoFilename(QString &filename)
+{
+ filename = assembleFilename(mVideoBaseFolder, mVideoSequenceNumber, mVideoExtension);
+ return;
+}
+
+QString CxeFilenameGeneratorDesktop::assembleFilename(const QString& baseFolder, int sequenceNumber, const QString &extension)
+{
+ QString fileName;
+ QDate current = QDate::currentDate();
+
+ fileName = QString("%1%2").arg(current.toString("yyyyMM")).arg(sequenceNumber,3,16,QLatin1Char('0'));
+
+ QString assembledName = baseFolder + FOLDER_SEPARATOR + fileName + FILE_SUFFIX + extension;
+
+ return assembledName;
+}
+
+/**
+ * Raises file number counter value by one
+ */
+void CxeFilenameGeneratorDesktop::raiseCounterValue()
+{
+ if (Cxe::ImageMode == mMode) {
+ mImageSequenceNumber++;
+ } else {
+ mVideoSequenceNumber++;
+ }
+}
--- a/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Wed Aug 18 09:37:18 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"
@@ -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;
@@ -79,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 = "";
@@ -88,10 +94,11 @@
mVideoCounter = 0;
// Retrieve last used counter values from settings
- mSettings.get(CxeSettingIds::FNAME_MONTH_FOLDER, mCurrentMonth);
- mSettings.get(CxeSettingIds::FNAME_IMAGE_COUNTER, mImageCounter);
- mSettings.get(CxeSettingIds::FNAME_VIDEO_COUNTER, mVideoCounter);
+ mCurrentMonth = mSettings.get<QString>(CxeSettingIds::FNAME_MONTH_FOLDER, "");
+ mImageCounter = mSettings.get<int>(CxeSettingIds::FNAME_IMAGE_COUNTER, 0);
+ mVideoCounter = mSettings.get<int>(CxeSettingIds::FNAME_VIDEO_COUNTER, 0);
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATOR_2, "msg: e_CX_FILENAMEGENERATOR_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -152,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;
@@ -167,6 +175,7 @@
}
}
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_GENERATENAME_2, "msg: e_CX_GENERATE_FILENAME 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(err);
}
@@ -353,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\\";
@@ -428,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,
@@ -444,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");
@@ -489,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;
}
@@ -596,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;
@@ -620,6 +634,7 @@
}
}
+ OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INIT_2, "msg: e_CX_FILENAMEGENERATOR_INIT 0");
CX_DEBUG_EXIT_FUNCTION();
return CxeErrorHandlingSymbian::map(err);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxefilesavethreaddesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* 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 "cxefilesavethreaddesktop.h"
+#include "cxeimagedataitem.h" // item
+#include "cxutils.h" // debug
+
+/*!
+ \class CxeFileSaveThreadDesktop
+ \brief Still image saving thread
+*/
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CxeFileSaveThreadDesktop::CxeFileSaveThreadDesktop(QObject *parent)
+ : CxeFileSaveThread(parent), mExitThread(false), mExit(false)
+{
+ start(IdlePriority);
+}
+
+CxeFileSaveThreadDesktop::~CxeFileSaveThreadDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mMutex.lock();
+ mExitThread = true;
+ mDataToSave.wakeOne();
+ mMutex.unlock();
+
+ wait(); // until the thread has finished execution.
+ qDeleteAll(mDataList); // Ensure destruction
+ mDataList.clear();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void CxeFileSaveThreadDesktop::save(CxeImageDataItem *data)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Ensure safe data adding.
+ // Saving thread will wait if needed, in read method, until mutex is unlocked
+ mMutex.lock();
+ mDataList.append(data);
+ // Wake up saving thread if it's sleeping
+ mDataToSave.wakeOne();
+ mMutex.unlock();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void CxeFileSaveThreadDesktop::handleVideoSaved(CxeError::Id status, const QString &filename)
+{
+ Q_UNUSED(status);
+ Q_UNUSED(filename);
+}
+
+void CxeFileSaveThreadDesktop::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename)
+{
+ Q_UNUSED(status);
+ Q_UNUSED(snapshot);
+ Q_UNUSED(filename);
+}
+
+void CxeFileSaveThreadDesktop::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id)
+{
+ Q_UNUSED(status);
+ Q_UNUSED(snapshot);
+ Q_UNUSED(id);
+}
+
+void CxeFileSaveThreadDesktop::read()
+{
+ mMutex.lock();
+ mCount = mDataList.count();
+ mExit = mExitThread;
+ mMutex.unlock();
+}
+
+void CxeFileSaveThreadDesktop::run()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeImageDataItem *item = NULL;
+ int i = 0;
+ // Check if there is data to save.
+ // There should not be any, because the thread is just contructed
+ read();
+
+ while (!mExit || i < mCount) { // Complete save before exit
+ CX_DEBUG(("CxeFileSaveThreadDesktop: index %d", i));
+ // Wait data
+ if (!mExit && i >= mCount) {
+ // If there isn't any data to save, put the thread sleeping
+ CX_DEBUG(("CxeFileSaveThreadDesktop: set thread sleeping"));
+ mMutex.lock();
+ //! @todo: read datalist count here before clearing, because there is some machine cycles after previous read
+ // Clear the datalist, since all items are saved
+ mDataList.clear();
+ i = 0;
+ mDataToSave.wait(&mMutex); // waiting "wakeOne"
+ mMutex.unlock();
+ CX_DEBUG(("CxeFileSaveThreadDesktop: woken up"));
+ }
+
+ // There should be data now, because the thread is woken up
+ read();
+
+ if (i < mCount) {
+ item = mDataList[i];
+ } else {
+ CX_DEBUG(("CxeFileSaveThreadDesktop: ERROR - woke up without data"));
+ continue;
+ }
+
+ // Check that item is not saved already
+ if (item && item->state() == CxeImageDataItem::SavePending) {
+ item->save();// Error ignored since it is emitted from CxeImageDataItemSymbian
+ // Delete item, since we own it
+ delete item;
+ item = NULL;
+ }
+
+ // Saving takes some seconds, there might be new data available.
+ read();
+ ++i;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
--- a/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail.cpp Wed Aug 18 09:37:18 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,11 @@
#include "cxutils.h"
#include "cxegeotaggingtrail.h"
-#include "cxegeotaggingtrailprivate.h"
+#ifdef Q_OS_SYMBIAN
+#include "cxegeotaggingtrail_symbian_p.h"
+#else
+#include "cxegeotaggingtrail_desktop_p.h"
+#endif // ifdef Q_OS_SYMBIAN
/*!
* Constructor
@@ -33,7 +37,6 @@
Qt::UniqueConnection);
}
-
/*!
* Destructor
*/
@@ -60,8 +63,6 @@
d->stop();
}
-
-
/*!
* Returns current state of Geo-tagging trail.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail_desktop_p.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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 "cxestate.h"
+#include "cxesettings.h"
+#include "cxenamespace.h"
+#include "cxestillcapturecontrol.h"
+#include "cxevideocapturecontrol.h"
+#include "cxegeotaggingtrail_desktop_p.h"
+
+
+namespace
+{
+ // in milliseconds
+ const int STOP_TRAIL_INTERVAL = 10*1000;
+}
+
+
+/*!
+* Constructor
+*/
+CxeGeoTaggingTrailPrivate::CxeGeoTaggingTrailPrivate(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings)
+ : CxeStateMachine("CxeGeoTaggingTrailPrivate"),
+ mSettings(settings)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ Q_UNUSED(stillControl);
+ Q_UNUSED(videoControl);
+
+ qRegisterMetaType<CxeGeoTaggingTrail::State>();
+ initializeStates();
+
+ connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
+ this, SLOT(handleSettingValueChanged(const QString&,QVariant)));
+
+ 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();
+
+ setState(CxeGeoTaggingTrail::Connected);
+ setState(CxeGeoTaggingTrail::TrailStarted);
+
+ 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();
+
+ setState(CxeGeoTaggingTrail::NotConnected);
+
+ 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();
+}
+
+/*!
+Returns current state of Location trail
+*/
+CxeGeoTaggingTrail::State CxeGeoTaggingTrailPrivate::state() const
+{
+ return static_cast<CxeGeoTaggingTrail::State> (stateId());
+}
+
+/*!
+* slot called when state is changed.
+*/
+void CxeGeoTaggingTrailPrivate::handleStateChanged(int newStateId, CxeError::Id error)
+{
+ emit stateChanged(static_cast<CxeGeoTaggingTrail::State> (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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail_symbian_p.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,279 @@
+/*
+* 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 "cxestate.h"
+#include "cxesettings.h"
+#include "cxenamespace.h"
+#include "cxestillcapturecontrol.h"
+#include "cxevideocapturecontrol.h"
+#include "cxegeotaggingtrail_symbian_p.h"
+
+#include <locationtrailpskeys.h>
+
+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<CxeGeoTaggingTrail::State>();
+ initializeStates();
+
+ 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)));
+
+
+ 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();
+
+ // close the location utility session
+ mLocationTrail.Close();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Start location trail.
+*/
+void CxeGeoTaggingTrailPrivate::start()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ int err = KErrNone;
+ int settingValue = Cxe::GeoTaggingOff;
+ settingValue = 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));
+ mLocationTrail.Close();
+ }
+ } else {
+ // geotagging setting off, do nothing.
+ CX_DEBUG(("CxeGeoTaggingTrail <> start -- Geotagging setting OFF, do nothing.."));
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Stop location trail.
+*/
+void CxeGeoTaggingTrailPrivate::stop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ 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);
+ }
+
+ } else {
+ // not ready to stop the location trail, TrailStarted the timer.
+ mStopLocationTrailTimer.start(STOP_TRAIL_INTERVAL);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* 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();
+
+ 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();
+ bool stateOk = (state() == CxeGeoTaggingTrail::DataAvailable || state() == CxeGeoTaggingTrail::TrailStarted);
+ if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState && stateOk) {
+ CX_DEBUG(("Location trail: new state = %d ", value.toInt()));
+
+ RLocationTrail::TTrailState newState =
+ static_cast<RLocationTrail::TTrailState>(value.toInt());
+
+ if (newState == RLocationTrail::ETrailStarted) {
+ CX_DEBUG(("CxeGeoTaggingTrail <> location trail started, data available."));
+ setState(CxeGeoTaggingTrail::DataAvailable);
+ } else {
+ // ignoring all other state changes.
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+Returns current state of Location trail
+*/
+CxeGeoTaggingTrail::State CxeGeoTaggingTrailPrivate::state() const
+{
+ return static_cast<CxeGeoTaggingTrail::State> (stateId());
+}
+
+/*!
+* slot called when state is changed.
+*/
+void CxeGeoTaggingTrailPrivate::handleStateChanged(int newStateId, CxeError::Id error)
+{
+ emit stateChanged(static_cast<CxeGeoTaggingTrail::State> (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
--- a/camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/*
-* 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 "cxutils.h"
-#include "cxestate.h"
-#include "cxesettings.h"
-#include "cxenamespace.h"
-#include "cxestillcapturecontrol.h"
-#include "cxevideocapturecontrol.h"
-#include "cxegeotaggingtrailprivate.h"
-
-#include <locationtrailpskeys.h>
-
-
-
-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<CxeGeoTaggingTrail::State>();
- 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();
-
-#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
-
- 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();
-
-#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
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/*!
-* 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<RLocationTrail::TTrailState>(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<CxeGeoTaggingTrail::State> (stateId());
-}
-
-
-
-/*!
-* slot called when state is changed.
-*/
-void CxeGeoTaggingTrailPrivate::handleStateChanged(int newStateId, CxeError::Id error)
-{
- emit stateChanged(static_cast<CxeGeoTaggingTrail::State> (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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataitemdesktop.cpp Wed Aug 18 09:37:18 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 "cxeimagedataitemdesktop.h"
+
+CxeImageDataItemDesktop::CxeImageDataItemDesktop(int index, QByteArray data, QString filename, int id) :
+ mIndex(index),
+ mData(data),
+ mFilename(filename),
+ mPixmapData(QPixmap()),
+ mState(CxeImageDataItem::SavePending),
+ mId(id)
+
+{
+
+}
+
+CxeImageDataItemDesktop::CxeImageDataItemDesktop(int index, QPixmap pixmapData, QString filename, int id) :
+ mIndex(index),
+ mData(QByteArray()),
+ mFilename(filename),
+ mPixmapData(pixmapData),
+ mState(CxeImageDataItem::SavePending),
+ mId(id)
+{
+
+}
+
+
+/**
+ * Helper method to save file to Fs
+ * @return CameraX error code
+ */
+CxeError::Id CxeImageDataItemDesktop::save()
+{
+ CxeError::Id errorId = CxeError::None;
+
+ mPixmapData.save(mFilename);
+
+ mState = CxeImageDataItem::Saved;
+ emit stateChanged(mState, errorId);
+
+ return errorId;
+}
+
+/**
+ * Get the current state for this item.
+ *
+ * @return State
+ */
+CxeImageDataItem::State CxeImageDataItemDesktop::state() const
+{
+ return mState;
+}
+
+/**
+ * Get the id of this item.
+ */
+int CxeImageDataItemDesktop::id() const
+{
+ return mId;
+}
+
+/**
+ * Get the id of this item.
+ */
+QString CxeImageDataItemDesktop::path() const
+{
+ return mFilename;
+}
--- a/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Wed Aug 18 09:37:18 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"
@@ -15,7 +15,6 @@
*
*/
-#include <bautils.h> // for deleting files
#include "cxeimagedataitemsymbian.h"
#include "cxeerrormappingsymbian.h"
#include "cxesysutil.h"
@@ -27,14 +26,15 @@
#include "cxeimagedataitemsymbianTraces.h"
#endif
-
+/*!
+* Constructor.
+*/
CxeImageDataItemSymbian::CxeImageDataItemSymbian(QByteArray data,
QString filename,
int id,
bool addLocation,
CxeImageDataItem::State state)
: CxeStateMachine("CxeImageDataItemSymbian"),
- mError(KErrNone),
mId(id),
mData(data),
mAddLocationInfo(addLocation),
@@ -47,201 +47,109 @@
// Init mState
initializeStates();
setInitialState(state);
- // Init delayer variables
- //mDelayedDelete = false;
- //mDelayedRename = false;
- //mDelayedFileName = NULL;
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-CxeImageDataItemSymbian::~CxeImageDataItemSymbian()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- // Close file
- mFile.Close();
-
- // Close file system
- mFs.Close();
CX_DEBUG_EXIT_FUNCTION();
}
-/*
-void CxeImageDataItemSymbian::deleteImage()
- {
+/*!
+* Destructor.
+*/
+CxeImageDataItemSymbian::~CxeImageDataItemSymbian()
+{
CX_DEBUG_ENTER_FUNCTION();
-
- int err = KErrNone;
-
- //! @todo: make this function return a KErrNotReady if below
- if ( mState != CxeImageDataItem::Idle )
- {
- CX_DEBUG(("Error: This data item has no data..."));
- CX_DEBUG_ASSERT(0); // panics
- return;
- }
-
- // do delete or delayed delete
- if (( mState == CxeImageDataItem::Waiting ) || ( mState == CxeImageDataItem::Saving ))
- {
- // we are currently saving, so we have to delete later
- CX_DEBUG(("delayed delete"));
- mDelayedDelete = true;
- }
- else
- {
- // delete now
- CX_DEBUG(("deleting now..."));
- err = KErrNotFound;
-
-
- //! @todo: this is horrible for performance... there is no need to create multiple server sessions
- RFs fs;
- TInt connectError = fs.Connect();
- BaflUtils ba;
- if( !connectError && ba.FileExists( fs, *mPath ) )
- {
- err = KErrNone;
- ba.DeleteFile( fs, *mPath );
- }
- fs.Close();
- }
-
- CX_DEBUG(("err: %d", err));
-
+ closeHandles();
CX_DEBUG_EXIT_FUNCTION();
- //return err; //! @todo
- }
+}
-void CxeImageDataItemSymbian::renameImage( const TDesC& newPath )
- {
- CX_DEBUG_ENTER_FUNCTION();
-
- int err = KErrNone;
-
- //! @todo: make this function return a KErrNotReady if below
- if ( mState != CxeImageDataItem::Idle )
- {
- CX_DEBUG(("Error: This data item has no data..."));
- CX_DEBUG_ASSERT(0); // panics
- return;
- }
-
- // do rename or delayed rename
- if (( mState == CxeImageDataItem::Waiting ) || ( mState == CxeImageDataItem::Saving ))
- {
- // we are currently saving, so we have to rename later
- CX_DEBUG(("delayed rename"));
- mDelayedRename = true;
-
- TRAP( err,
- mDelayedFileName = HBufC::NewL( newPath.Length() );
- mDelayedFileName->Des().Append( newPath );
- );
- }
- else
- {
- // rename now
- CX_DEBUG(("delayed rename"));
- err = KErrNotFound;
- RFs fs;
- TInt connectError = fs.Connect();
- BaflUtils ba;
- if( !connectError && ba.FileExists( fs, *mPath ) )
- {
- err = KErrNone;
- ba.RenameFile( fs, *mPath, newPath );
- }
- fs.Close();
- }
-
- CX_DEBUG(("err: %d", err));
-
- CX_DEBUG_EXIT_FUNCTION();
- //return err; //! @todo
- }
+/*!
+* Save the data now.
+* @return Status code.
*/
-
CxeError::Id CxeImageDataItemSymbian::save()
{
CX_DEBUG_ENTER_FUNCTION();
- mError = KErrNone;
+ CxeError::Id status(CxeError::None);
+ try {
+ setState(CxeImageDataItem::Saving);
+ trySave();
+ setState(CxeImageDataItem::Saved);
+ } catch (const std::exception &e) {
+ closeHandles();
+ status = CxeErrorHandlingSymbian::map(qt_symbian_exception2Error(e));
+ setState(CxeImageDataItem::SaveFailed);
+ }
- CX_DEBUG(( "Starting to save %s", mPath.toAscii().constData() ));
+ emit imageSaved(status, mPath, mId);
+ CX_DEBUG_EXIT_FUNCTION();
+ return status;
+}
+
+/*!
+* Helper method for trying to save the data.
+* If any error is encountered during the saving process, exception is thrown.
+*/
+void CxeImageDataItemSymbian::trySave()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_IN, "msg: e_CX_IMAGEDATAITEM_SAVE 1");
+
+ CX_DEBUG(("CxeImageDataItemSymbian - Starting to save [%s]", qPrintable(mPath)));
+
+ // Check we have the path set.
if (mPath.isEmpty()) {
- CX_DEBUG(("Filename not set !"));
- mError = KErrArgument;
+ CX_DEBUG(("CxeImageDataItemSymbian - Filename not set!"));
+ qt_symbian_throwIfError(KErrArgument);
}
TPtrC16 filename;
-
- if (!mError) {
- filename.Set(reinterpret_cast<const TUint16*>(mPath.utf16()));
- // Init
- mError = mFs.Connect();
- CX_DEBUG(("mFsSession.Connect mError=%d", mError));
- }
+ filename.Set(reinterpret_cast<const TUint16*>(mPath.utf16()));
+ // Init
+ CX_DEBUG(("CxeImageDataItemSymbian - connect to RFs.."));
+ qt_symbian_throwIfError(mFs.Connect());
// Get drive number
TInt drive = 0;
- if (!mError) {
- mError = RFs::CharToDrive(filename[0], drive);
- CX_DEBUG(("CharToDrive mError=%d", mError));
- }
+ CX_DEBUG(("CxeImageDataItemSymbian - Get drive number.."));
+ qt_symbian_throwIfError(RFs::CharToDrive(filename[0], drive));
- // Check disk space
- if (!mError) {
- TBool fullDisk = EFalse;
- fullDisk = checkDiskSpace(&mFs, mData.size(), drive);
- if (fullDisk) {
- CX_DEBUG(("SysUtil::FullDisk"));
- mError = KErrDiskFull;
- }
+ // Check disk has space
+ bool fullDisk = checkDiskSpace(&mFs, mData.size(), drive);
+ if (fullDisk) {
+ CX_DEBUG(("CxeImageDataItemSymbian - Disk is full!"));
+ qt_symbian_throwIfError(KErrDiskFull);
}
// Attempt to create the file
- if (!mError) {
- // Note: In sake of MDS not starting harvesting here,
- // do not use RFile::Replace. If harvesting is started now,
- // our later call to harvest may be ignored and
- // file may be missing from "Captured" album.
- mError = mFile.Create(mFs, filename, EFileWrite);
- CX_DEBUG(("file.Create mError=%d", mError));
- }
+ // Note: In sake of MDS not starting harvesting here,
+ // do not use RFile::Replace. If harvesting is started now,
+ // our later call to harvest may be ignored and
+ // file may be missing from "Captured" album.
+ CX_DEBUG(("CxeImageDataItemSymbian - Create the file.."));
+ qt_symbian_throwIfError(mFile.Create(mFs, filename, EFileWrite));
- // Write the file
- if (!mError) {
- // Update state
- setState(CxeImageDataItem::Saving);
+ // Write data to the file.
+ CX_DEBUG(("CxeImageDataItemSymbian - Starting to write the file.."));
+ TPtrC8 data(reinterpret_cast<const TUint8*> (mData.constData()), mData.size());
+ qt_symbian_throwIfError(mFile.Write(data)); // synchronous
- CX_DEBUG(("about to write to file"));
- TPtrC8 data(reinterpret_cast<const TUint8*> (mData.constData()), mData.size());
- mError = mFile.Write(data); // synchronous
- saveCleanup();
- CX_DEBUG(("file write completed"));
- }
-
- mFile.Close(); //~400us
- mFs.Close(); //~450us
- OstTrace0(camerax_performance, CXEIMAGEDATAIMTEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0");
+ // Flush all the data to file now.
+ // This may take a while depending on buffer sizes and file server load.
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_FLUSH_1, "msg: e_CX_SAVE_FLUSH_FILE 1");
+ qt_symbian_throwIfError(mFile.Flush());
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_FLUSH_2, "msg: e_CX_SAVE_FLUSH_FILE 0");
- if (mError == KErrNone) {
- setState(CxeImageDataItem::Saved);
- } else {
- setState(CxeImageDataItem::SaveFailed);
- }
- emit imageSaved(CxeErrorHandlingSymbian::map(mError), mPath, mId);
+ // Close the file and server handles.
+ closeHandles();
+ CX_DEBUG(("CxeImageDataItemSymbian - Saving to file completed.."));
- CX_DEBUG(("mError: %d", mError));
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0");
+ OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_OUT, "msg: e_CX_IMAGEDATAITEM_SAVE 0");
CX_DEBUG_EXIT_FUNCTION();
- return CxeErrorHandlingSymbian::map(mError);
}
-/**
+/*!
* Get the id number of this data item.
*/
int CxeImageDataItemSymbian::id() const
@@ -249,7 +157,7 @@
return mId;
}
-/**
+/*!
* Get the path of this data item.
*/
QString CxeImageDataItemSymbian::path() const
@@ -257,84 +165,54 @@
return mPath;
}
-
-int CxeImageDataItemSymbian::checkDiskSpace(RFs* aFs,
+/*!
+* Check that there's enough space in the drive.
+* @param aFs File server session
+* @param aBytesToWrite Amount of bytes to be written.
+* @param aDrive Drive number.
+* @return True, if given amount of bytes can be written to the drive, false otherwise.
+*/
+bool CxeImageDataItemSymbian::checkDiskSpace(RFs* aFs,
TInt aBytesToWrite,
TInt aDrive)
{
CX_DEBUG_ENTER_FUNCTION();
- int value = CxeSysUtil::DiskSpaceBelowCriticalLevel(
+ bool value = CxeSysUtil::DiskSpaceBelowCriticalLevel(
aFs,
aBytesToWrite,
aDrive );
return value;
}
-void CxeImageDataItemSymbian::saveCleanup()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CX_DEBUG_ASSERT( state() == CxeImageDataItem::Saving );
-
- // Flush file.
- if (!mError) {
- CX_DEBUG(("flushing..."));
- mError = mFile.Flush();
- CX_DEBUG(("flushed"));
- }
-
-
- /*
- // Delayed rename, if needed
- if (( !mError ) && ( mDelayedRename ))
- {
- CX_DEBUG(("doing delayed rename..."));
- mError = KErrNotFound;
- BaflUtils ba;
- if( ba.FileExists( mFs, *mPath ) )
- {
- mError = KErrNone;
- TPtrC newPath = *mDelayedFileName;
- ba.RenameFile( mFs, *mPath, newPath );
- }
- mDelayedRename = false;
- CX_DEBUG(("rename done, mError: %d", mError));
- }
-
- // Delayed delete, if needed
- if (( !mError ) && ( mDelayedDelete ))
- {
- CX_DEBUG(("doing delayed delete..."));
- mError = KErrNotFound;
- BaflUtils ba;
- if( ba.FileExists( mFs, *mPath ) )
- {
- mError = KErrNone;
- ba.DeleteFile( mFs, *mPath );
- }
- mDelayedDelete = false;
- CX_DEBUG(("delete done, mError: %d", mError));
- }*/
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
+/*!
+* State of this item.
+* @return The state.
+*/
CxeImageDataItem::State CxeImageDataItemSymbian::state() const
{
return static_cast<CxeImageDataItem::State> (stateId());
}
+/*!
+* Handle state change.
+*/
void CxeImageDataItemSymbian::handleStateChanged(int newStateId, CxeError::Id error)
{
emit stateChanged(static_cast<State> (newStateId), error);
}
-
+/*!
+* Is location tagging enabled for this item.
+* @return True if location tagging is enabled, false otherwise.
+*/
bool CxeImageDataItemSymbian::isLocationEnabled() const
{
return mAddLocationInfo;
}
+/*!
+* Init the state machine.
+*/
void CxeImageDataItemSymbian::initializeStates()
{
// addState( id, name, allowed next states )
@@ -343,3 +221,14 @@
addState(new CxeState(Saved, "Saved", 0));
addState(new CxeState(SaveFailed, "SaveFailed", 0));
}
+
+/*!
+* Close the file server and file handles.
+*/
+void CxeImageDataItemSymbian::closeHandles()
+{
+ mFile.Close();
+ mFs.Close();
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataqueuedesktop.cpp Wed Aug 18 09:37:18 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:
+*
+*/
+#include <QImage>
+#include <QList>
+
+#include "cxeimagedataqueuedesktop.h"
+#include "cxeimagedataitemdesktop.h"
+#include "cxutils.h"
+
+
+CxeImageDataQueueDesktop::CxeImageDataQueueDesktop()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+CxeImageDataQueueDesktop::~CxeImageDataQueueDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // This will delete all remaining items!
+ clear();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+int CxeImageDataQueueDesktop::size() const
+{
+ return mList.size();
+}
+
+void CxeImageDataQueueDesktop::clear()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // This will delete all remaining items!
+ mList.clear();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+CxeImageDataItem &CxeImageDataQueueDesktop::operator[](int index)
+{
+ CX_DEBUG_ASSERT( index >= 0 && index < mList.count() );
+ return *mList[index];
+}
+
+CxeImageDataItem *CxeImageDataQueueDesktop::startSave(QByteArray data, QString path, int id)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ int index = mList.size();
+ CxeImageDataItem *dataItem = new CxeImageDataItemDesktop(index, data, path, id);
+ mList.append(dataItem);
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return dataItem;
+}
--- a/camerauis/cameraxui/cxengine/src/cxememorymonitorprivate.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxememorymonitorprivate.cpp Wed Aug 18 09:37:18 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"
@@ -15,12 +15,15 @@
*
*/
+#include "cxememorymonitorprivate.h"
+
+#ifdef Q_OS_SYMBIAN
#include <hal.h>
+#endif // Q_OS_SYMBIAN
#include "cxutils.h"
#include "cxenamespace.h"
#include "cxefeaturemanager.h"
-#include "cxememorymonitorprivate.h"
namespace
{
@@ -36,7 +39,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
- mFeatures.configuredValues(CxeRuntimeKeys::FREE_MEMORY_LEVELS, mLevels);
+ mFeatures.configuredValues(CxeVariationKeys::FREE_MEMORY_LEVELS, mLevels);
CX_DEBUG(("CxeMemoryMonitorPrivate - trigger level: %d bytes", mLevels.value(Cxe::FreeMemoryTrigger)));
CX_DEBUG(("CxeMemoryMonitorPrivate - target level: %d bytes", mLevels.value(Cxe::FreeMemoryTarget)));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxequalitypresetsdesktop.cpp Wed Aug 18 09:37:18 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:
+*
+*/
+
+#include "cxutils.h"
+#include "cxequalitydetails.h"
+#include "cxequalitypresetsdesktop.h"
+
+/*!
+* Intializes ImagingConfigManager
+*/
+CxeQualityPresetsDesktop::CxeQualityPresetsDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+
+}
+
+/*!
+* CxeQualityPresetsDesktop::~CxeQualityPresetsDesktop()
+*/
+CxeQualityPresetsDesktop::~CxeQualityPresetsDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+This function returns sorted list of image qualities from highest to lowest resolution.
+i.e. first element in the list represent highest supported image resolution and so on.
+@param cameraId The CameraIndex which defines which camera we are using primary/secondary.
+Returns sorted list of image qualities in descending order.
+*/
+QList<CxeImageDetails> CxeQualityPresetsDesktop::imageQualityPresets(Cxe::CameraIndex cameraId)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return QList<CxeImageDetails>();
+}
+
+
+
+/*!
+This function returns sorted list of video qualities from highest to lowest resolution.
+i.e. first element in the list represent highest supported video resolution and so on.
+@param cameraId The CameraIndex which defines which camera we are using primary/secondary.
+Returns sorted list if image qualities in descending order.
+*/
+QList<CxeVideoDetails> CxeQualityPresetsDesktop::videoQualityPresets(Cxe::CameraIndex cameraId)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return QList<CxeVideoDetails>();
+}
+
+int CxeQualityPresetsDesktop::recordingTimeAvailable(const CxeVideoDetails &details, qint64 space)
+{
+ Q_UNUSED(details);
+ Q_UNUSED(space);
+
+ return 0;
+}
+
+/*!
+Operator to sort values in ascending order.
+@param s1 type of data to be sorted.
+*/
+bool CxeImageDetails::operator<(const CxeImageDetails &s1) const
+{
+ return mHeight < s1.mHeight;
+}
+
+
+/*!
+Operator to sort values in ascending order.
+@param s1 type of data to be sorted.
+*/
+bool CxeVideoDetails::operator<(const CxeVideoDetails &s1) const
+{
+ return mHeight < s1.mHeight;
+}
--- a/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Wed Aug 18 09:37:18 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,7 @@
#include <algorithm>
#include <e32std.h> // For Symbian types used in mmsenginedomaincrkeys.h
#include <MmsEngineDomainCRKeys.h>
+#include <imagingconfigmanager.h>
#include "cxutils.h"
#include "cxenamespace.h"
@@ -64,6 +65,7 @@
: mSettings(settings)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEQUALITYPRESETSSYMBIAN_1, "msg: e_CX_QUALITYPRESETS_NEW 1");
TRAPD(err, mIcm = CImagingConfigManager::NewL());
@@ -72,8 +74,8 @@
mIcm = NULL;
}
+ OstTrace0(camerax_performance, CXEQUALITYPRESETSSYMBIAN_2, "msg: e_CX_QUALITYPRESETS_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
-
}
/* !
@@ -221,7 +223,7 @@
@ param set contains the ICM configuration data
@ returns CxeImageQuality struct
*/
-CxeImageDetails CxeQualityPresetsSymbian::createImagePreset(TImageQualitySet set)
+CxeImageDetails CxeQualityPresetsSymbian::createImagePreset(const TImageQualitySet &set)
{
CxeImageDetails newPreset;
// set setting values from quality set
@@ -243,7 +245,7 @@
/*!
* Creates a new video preset based on TVideoQualitySet values from ICM.
*/
-CxeVideoDetails CxeQualityPresetsSymbian::createVideoPreset(TVideoQualitySet set)
+CxeVideoDetails CxeQualityPresetsSymbian::createVideoPreset(const TVideoQualitySet &set)
{
CX_DEBUG_ENTER_FUNCTION();
CxeVideoDetails newPreset;
@@ -311,10 +313,10 @@
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()));
-
+
// get the closest aspect ratio
int minValue = qMin(qMin(delta16by9, delta11by9), delta4by3);
-
+
if (minValue == delta16by9) {
aspectRatio = Cxe::AspectRatio16to9;
} else if (minValue == delta11by9) {
@@ -383,11 +385,10 @@
scaler = VIDEO_AVG_BITRATE_SCALER;
}
- int muteSetting = 0; // audio enabled
- mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
+ bool muteSetting = mSettings.get<bool>(CxeSettingIds::VIDEO_MUTE_SETTING, false); // false = audio enabled
int avgVideoBitRate = (details.mVideoBitRate * scaler);
- int avgAudioBitRate = (muteSetting == 1) ? 0 : details.mAudioBitRate;
+ int avgAudioBitRate = muteSetting ? 0 : details.mAudioBitRate;
quint32 averageBitRate = (quint32)((avgVideoBitRate + avgAudioBitRate) * VIDEO_METADATA_COEFF);
quint32 averageByteRate = averageBitRate / 8;
@@ -436,7 +437,7 @@
* Helper method to enable debug prints.
@ param Video quality preset values are printed out for debugging
*/
-void CxeQualityPresetsSymbian::debugPrints(CxeVideoDetails preset)
+void CxeQualityPresetsSymbian::debugPrints(const CxeVideoDetails &preset)
{
CX_DEBUG(("Video quality details"));
CX_DEBUG(("Video resolution (%d,%d)", preset.mWidth, preset.mHeight));
@@ -461,7 +462,7 @@
* Helper method to enable debug prints.
@ param Image quality preset values are printed out for debugging
*/
-void CxeQualityPresetsSymbian::debugPrints(CxeImageDetails newPreset)
+void CxeQualityPresetsSymbian::debugPrints(const CxeImageDetails &newPreset)
{
CX_DEBUG(("Image quality details"));
CX_DEBUG(("Image resolution (%d,%d)", newPreset.mWidth, newPreset.mHeight));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxescenemodestore.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,397 @@
+/*
+* 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 "cxescenemodestore.h"
+#include "cxutils.h"
+#include "cxenamespace.h"
+#include "cxeautofocuscontrol.h"
+#include "cxeexception.h"
+
+using namespace Cxe;
+
+/*!
+ * Constructor.
+ */
+CxeSceneModeStore::CxeSceneModeStore()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ loadImageScenes();
+ loadVideoScenes();
+
+ mCurrentImageScene = mImageSceneModes[Cxe::IMAGE_SCENE_AUTO];
+ mCurrentVideoScene = mVideoSceneModes[Cxe::VIDEO_SCENE_AUTO];
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Destructor.
+ */
+CxeSceneModeStore::~CxeSceneModeStore()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
+* Returns scene setting value from current scene.
+* @param cameraMode Camera mode used to determine which scene mode to use
+* @param key Settings key
+* @param[out] value Value associated with the key
+* @return Error id. CxeError::None if no errors.
+*/
+CxeError::Id CxeSceneModeStore::sceneSettingValue(Cxe::CameraMode cameraMode, const QString &key, QVariant &value) const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeScene scene;
+ CxeError::Id err = CxeError::None;
+
+ if(cameraMode == Cxe::ImageMode) {
+ CX_DEBUG(( "CxeSceneModeStore::sceneSettingValue - Image mode Setting"));
+ scene = mCurrentImageScene;
+ } else {
+ CX_DEBUG(( "CxeSceneModeStore::sceneSettingValue - Video mode Setting"));
+ scene = mCurrentVideoScene;
+ }
+
+ if (scene.contains(key)) {
+ value = scene[key];
+ } else {
+ err = CxeError::NotFound;
+ }
+
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
+}
+
+/*!
+* Sets new value to settings specific to the scene to the current scene.
+* @param cameraMode Camera mode used to determine which scene mode to use
+* @param key - setting id.
+* @param newValue - new setting value
+* @return Error id. CxeError::None if no errors.
+*/
+CxeError::Id CxeSceneModeStore::setSceneSettingValue(Cxe::CameraMode cameraMode, const QString &key, const QVariant &newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeError::Id err = CxeError::None;
+ CxeScene *scene(0);
+
+ if (cameraMode == Cxe::ImageMode) {
+ CX_DEBUG(( "CxeSettingsImp::setSceneSettingValue - Image mode Setting"));
+ scene = &mCurrentImageScene;
+ } else {
+ CX_DEBUG(( "CxeSettingsImp::setSceneSettingValue - Video mode Setting"));
+ scene = &mCurrentVideoScene;
+ }
+
+ if (scene && scene->contains(key)) {
+ CX_DEBUG(( "CxeSettingsImp::setSceneSettingValue KEY found, writing value"));
+ scene->insert(key, newValue);
+ } else {
+ err = CxeError::NotFound;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
+}
+
+/*!
+ * Returns id of current scene.
+ * @param cameraMode Camera mode used to determine which scene mode to use
+ * @return id of current scene mode
+ */
+QString CxeSceneModeStore::currentSceneId(Cxe::CameraMode cameraMode) const
+{
+ if (cameraMode == Cxe::ImageMode) {
+ return mCurrentImageScene[CxeSettingIds::SCENE_ID].toString();
+ } else {
+ return mCurrentVideoScene[CxeSettingIds::SCENE_ID].toString();
+ }
+}
+/*!
+ * Returns current scene mode.
+ * @param cameraMode Camera mode used to determine which scene mode to use
+ * @return Current scene mode
+ */
+CxeScene& CxeSceneModeStore::currentScene(Cxe::CameraMode cameraMode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (cameraMode == Cxe::ImageMode) {
+ CX_DEBUG_EXIT_FUNCTION();
+ return mCurrentImageScene;
+ } else {
+ CX_DEBUG_EXIT_FUNCTION();
+ return mCurrentVideoScene;
+ }
+}
+
+/*!
+ * Returns current scene mode. Overloaded const version.
+ */
+const CxeScene& CxeSceneModeStore::currentScene(Cxe::CameraMode cameraMode) const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (cameraMode == Cxe::ImageMode) {
+ CX_DEBUG_EXIT_FUNCTION();
+ return mCurrentImageScene;
+ } else {
+ CX_DEBUG_EXIT_FUNCTION();
+ return mCurrentVideoScene;
+ }
+}
+/*!
+ * Set current scene mode.
+ * @param cameraMode Camera mode used to determine which scene mode to use
+ * @sceneId id of the scene mode to set
+ */
+void CxeSceneModeStore::setCurrentScene(Cxe::CameraMode cameraMode, const QString &sceneId)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG(("Setting scene mode: %s", sceneId.toAscii().data()));
+ // @todo check that scene is valid
+ if (cameraMode == Cxe::ImageMode) {
+ if (!mImageSceneModes.contains(sceneId)) {
+ throw CxeException(CxeError::NotFound);
+ }
+ mCurrentImageScene = mImageSceneModes[sceneId];
+ } else {
+ if (!mVideoSceneModes.contains(sceneId)) {
+ throw CxeException(CxeError::NotFound);
+ }
+ mCurrentVideoScene = mVideoSceneModes[sceneId];
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Returns scene mode based on id.
+ * @param cameraMode Camera mode used to determine which scene mode to use
+ * @param sceneId id of the scene mode
+ * @return scene mode
+ */
+CxeScene CxeSceneModeStore::getScene(Cxe::CameraMode cameraMode, const QString &sceneId) const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG(("Getting scene mode: %s", sceneId.toAscii().data()));
+ if (cameraMode == Cxe::ImageMode) {
+ if (!mImageSceneModes.contains(sceneId)) {
+ throw CxeException(CxeError::NotFound);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+ return mImageSceneModes[sceneId];
+ } else {
+ if (!mVideoSceneModes.contains(sceneId)) {
+ throw CxeException(CxeError::NotFound);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+ return mVideoSceneModes[sceneId];
+ }
+}
+
+/*!
+* Loads all Image Scene Modes
+*/
+void CxeSceneModeStore::loadImageScenes()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mImageSceneModes.clear();
+
+ CxeScene imgSceneAuto;
+
+ 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);
+ imgSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imgSceneAuto.insert(CxeSettingIds::CONTRAST, 0);
+ imgSceneAuto.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
+ imgSceneAuto.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_AUTO, imgSceneAuto);
+
+
+ CxeScene imgSceneSports;
+
+ 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);
+ imgSceneSports.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imgSceneSports.insert(CxeSettingIds::CONTRAST, 0);
+ imgSceneSports.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
+ imgSceneSports.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_SPORTS, imgSceneSports);
+
+
+ CxeScene imgSceneCloseUp;
+
+ 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);
+ imgSceneCloseUp.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imgSceneCloseUp.insert(CxeSettingIds::CONTRAST, 0);
+ imgSceneCloseUp.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
+ imgSceneCloseUp.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_MACRO, imgSceneCloseUp);
+
+ CxeScene imgPortraitscene;
+
+ 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);
+ imgPortraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imgPortraitscene.insert(CxeSettingIds::CONTRAST, 0);
+ imgPortraitscene.insert(CxeSettingIds::SHARPNESS, SharpnessSoft);
+ imgPortraitscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
+
+ CxeScene imglandscapescene;
+
+ 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);
+ imglandscapescene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imglandscapescene.insert(CxeSettingIds::CONTRAST, 0);
+ imglandscapescene.insert(CxeSettingIds::SHARPNESS, SharpnessHard);
+ imglandscapescene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_SCENERY, imglandscapescene);
+
+
+ CxeScene imgNightscene;
+
+ 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);
+ imgNightscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imgNightscene.insert(CxeSettingIds::CONTRAST, 0);
+ imgNightscene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
+ imgNightscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_NIGHT, imgNightscene);
+
+ CxeScene imgNightpotraitscene;
+
+ 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);
+ imgNightpotraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ imgNightpotraitscene.insert(CxeSettingIds::CONTRAST, 0);
+ imgNightpotraitscene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
+ imgNightpotraitscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
+ 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(Cxe::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Loads all video scene modes
+*/
+void CxeSceneModeStore::loadVideoScenes()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mVideoSceneModes.clear();
+
+ CxeScene vidSceneAuto;
+
+ 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);
+ vidSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ vidSceneAuto.insert(CxeSettingIds::CONTRAST, 0);
+ vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0);
+ vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
+
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_AUTO,vidSceneAuto);
+
+
+ CxeScene vidSceneNight;
+
+ 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);
+ vidSceneNight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ vidSceneNight.insert(CxeSettingIds::CONTRAST, 0);
+ vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0);
+ vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
+
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_NIGHT, vidSceneNight);
+
+
+ CxeScene vidSceneLowLight;
+
+ 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);
+ vidSceneLowLight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
+ vidSceneLowLight.insert(CxeSettingIds::CONTRAST, 0);
+ vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps
+ vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
+
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight);
+
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxesensoreventhandlerdesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 "cxesensoreventhandlerdesktop.h"
+#include "cxutils.h"
+
+
+CxeSensorEventHandlerDesktop::CxeSensorEventHandlerDesktop()
+: CxeSensorEventHandler()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+CxeSensorEventHandlerDesktop::~CxeSensorEventHandlerDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+* Data read from sensor. The "type" of data embedded in QVariant is specific to sensor type.
+*/
+QVariant CxeSensorEventHandlerDesktop::sensorData(CxeSensorEventHandler::SensorType type)
+{
+ QVariant sensorData;
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return sensorData;
+}
+
+/*
+* initializes and enables all supported sensor events
+*/
+void CxeSensorEventHandlerDesktop::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*
+* closes all supported sensors.
+*/
+void CxeSensorEventHandlerDesktop::deinit()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -25,6 +25,9 @@
#include <QString>
#include <QStringList>
#include <QVariant>
+#ifdef Q_OS_SYMBIAN
+#include <ProfileEngineSDKCRKeys.h>
+#endif
#include "xqsettingsmanager.h" // Settings Manager API
#include "xqsettingskey.h"
@@ -35,10 +38,11 @@
#include "cxeerror.h"
#include "cxecenrepkeys.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cxesettingscenrepstoreTraces.h"
+#endif
-#ifdef Q_OS_SYMBIAN
-#include <ProfileEngineSDKCRKeys.h>
-#endif
using namespace CxeSettingIds;
@@ -49,6 +53,7 @@
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();
@@ -56,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();
}
@@ -81,7 +86,7 @@
/*!
* Generates XQSettingsKey from given setting/runtime key
-* \param key Name of the setting from which to generate the XQSettingsKey
+* \param key Name of the setting from which to generate the XQSettingsKey
* \param[out] error Error code. CxeError::None if everything went fine.
*/
XQSettingsKey
@@ -111,22 +116,23 @@
/*!
-* Reads/loads all run-time settings values from cenrep
-* @param QList<QString> contains list of all runtime key ids which we use to load values from cenrep.
+* Reads/loads all run-time variation settings values from cenrep
+* @param QList<QString> contains list of all variation 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.
+* NOTE: loading variation settings should be done only ONCE at start-up.
*/
-QHash<QString, QVariantList> CxeSettingsCenRepStore::loadRuntimeSettings(QList<QString>& runtimeKeys)
+QHash<QString, QVariantList> CxeSettingsCenRepStore::loadVariationSettings(QList<QString>& variationKeys)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_1, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 1");
QHash<QString, QVariantList> settings;
CxeError::Id err = CxeError::None;
QVariantList list;
QVariant data;
- // parsing through the list of run-time keys and reading values from cenrep.
- foreach (QString key, runtimeKeys) {
+ // parsing through the list of run-time variation keys and reading values from cenrep.
+ foreach (QString key, variationKeys) {
// read the data from cenrep
err = get(key, data);
@@ -152,6 +158,7 @@
CX_DEBUG_EXIT_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_2, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 0");
return settings;
}
@@ -216,14 +223,20 @@
}
XQSettingsKey settingsKey(keyType, uid, key);
- CX_DEBUG(("reading values from XQSettingsManager.."));
+ CX_DEBUG(("reading value from XQSettingsManager.."));
value = mSettingsManager->readItemValue(settingsKey);
// start monitoring changes for the key
// both P&S and Repository keys are monitored
- bool ok = false;
- ok = mSettingsManager->startMonitoring(settingsKey);
- CX_DEBUG_ASSERT(ok);
+ 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();
}
@@ -284,6 +297,8 @@
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
@@ -322,7 +337,7 @@
addKeyMapping(CxeSettingIds::VIDEO_MUTE_SETTING,
AudioMuteCr,
XQSettingsManager::TypeInt);
-
+
addKeyMapping(CxeSettingIds::GEOTAGGING,
GeoTaggingCr,
XQSettingsManager::TypeInt);
@@ -346,7 +361,7 @@
addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON,
CaptureSoundAlwaysOnCr,
XQSettingsManager::TypeInt);
-
+
addKeyMapping(CxeSettingIds::CAMERA_MODE,
CameraModeCr,
XQSettingsManager::TypeInt);
@@ -355,37 +370,23 @@
GeoTaggingDisclaimerCr,
XQSettingsManager::TypeInt);
- // mapping run-time keys
- addKeyMapping(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS,
- PrimaryCameraCaptureKeysCr,
- XQSettingsManager::TypeString,
- true);
-
- addKeyMapping(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS,
- PrimaryCameraAutofocusKeysCr,
- XQSettingsManager::TypeString,
- true);
-
- addKeyMapping(CxeRuntimeKeys::SECONDARY_CAMERA_CAPTURE_KEYS,
- SecondaryCameraCaptureKeysCr,
- XQSettingsManager::TypeString,
- true);
-
- addKeyMapping(CxeRuntimeKeys::FREE_MEMORY_LEVELS,
+ // mapping run-time variation keys
+ addKeyMapping(CxeVariationKeys::FREE_MEMORY_LEVELS,
FreeMemoryLevelsCr,
XQSettingsManager::TypeString,
true);
- addKeyMapping(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS,
+ addKeyMapping(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS,
StillMaxZoomLimitsCr,
XQSettingsManager::TypeString,
true);
- addKeyMapping(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS,
+ addKeyMapping(CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS,
VideoMaxZoomLimitsCr,
XQSettingsManager::TypeString,
true);
+ OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_2, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 0");
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Wed Aug 18 09:37:18 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,10 +31,17 @@
#include "cxesettingsmappersymbian.h"
#include "cxesettingscontrolsymbian.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cxesettingscontrolsymbianTraces.h"
+#endif
+
+
/*!
* Constructor
*/
-CxeSettingsControlSymbian::CxeSettingsControlSymbian(CxeCameraDevice &cameraDevice, CxeSettings &settings)
+CxeSettingsControlSymbian::CxeSettingsControlSymbian(
+ CxeCameraDevice &cameraDevice, CxeSettings &settings)
: mCameraDevice(cameraDevice),
mSettings(settings)
{
@@ -44,10 +51,9 @@
this,
SLOT(handleSettingValueChanged(const QString&,QVariant)));
- connect(&mSettings,
- SIGNAL(sceneChanged(CxeScene&)),
- this,
- SLOT(handleSceneChanged(CxeScene&)));
+ mSettings.listenForSetting(CxeSettingIds::IMAGE_SCENE_DATA, this, SLOT(handleSceneChanged(const QVariant&)));
+ mSettings.listenForSetting(CxeSettingIds::VIDEO_SCENE_DATA, this, SLOT(handleSceneChanged(const QVariant&)));
+
}
/*!
@@ -63,7 +69,8 @@
* \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)
+void CxeSettingsControlSymbian::handleSettingValueChanged(
+ const QString &settingId, QVariant newValue)
{
CX_DEBUG_ENTER_FUNCTION();
if (settingId == CxeSettingIds::COLOR_TONE) {
@@ -100,9 +107,13 @@
* Scene settings are checked and new values are set to camera.
* \param scene New scene containing scene specific settings.
*/
-void CxeSettingsControlSymbian::handleSceneChanged(CxeScene& scene)
+void CxeSettingsControlSymbian::handleSceneChanged(const QVariant &sceneData)
{
CX_DEBUG_ENTER_FUNCTION();
+
+ CxeScene scene = sceneData.value<CxeScene>();
+ 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<QString>().toAscii().constData()));
@@ -110,6 +121,7 @@
handleSettingValueChanged(settingId, scene[settingId]);
}
+ OstTrace0(camerax_performance, CXESETTINGSCONTROL_SCENE_2, "msg: e_CX_SCENE_SETTINGS_TO_CAMERA 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -127,13 +139,12 @@
CX_ASSERT_ALWAYS(mCameraDevice.imageProcessor());
CCamera::CCameraImageProcessing::TEffect effect =
- CxeSettingsMapperSymbian::Map2CameraEffect(newValue.toInt());
+ CxeSettingsMapperSymbian::Map2CameraEffect(
+ static_cast<Cxe::Colortone>(newValue.toInt()));
- if (effect != mCameraDevice.imageProcessor()->TransformationValue(KUidECamEventImageProcessingEffect)) {
- mCameraDevice.imageProcessor()->SetTransformationValue(KUidECamEventImageProcessingEffect, effect);
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ mCameraDevice.imageProcessor()->SetTransformationValue(
+ KUidECamEventImageProcessingEffect, effect);
+
#else
Q_UNUSED(newValue)
#endif
@@ -150,13 +161,10 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mCameraDevice.camera());
- CCamera::TWhiteBalance wb = CxeSettingsMapperSymbian::Map2CameraWb(newValue.toInt());
+ CCamera::TWhiteBalance wb = CxeSettingsMapperSymbian::Map2CameraWb(
+ static_cast<Cxe::Whitebalance>(newValue.toInt()));
- if (wb != mCameraDevice.camera()->WhiteBalance()) {
- TRAP_IGNORE( mCameraDevice.camera()->SetWhiteBalanceL(wb) );
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ TRAP_IGNORE(mCameraDevice.camera()->SetWhiteBalanceL(wb));
CX_DEBUG_EXIT_FUNCTION();
}
@@ -172,17 +180,15 @@
int iso = newValue.toInt();
- if (iso != mCameraDevice.advancedSettings()->IsoRate()) {
- CCamera::CCameraAdvancedSettings::TISORateType type;
- if(iso == 0) {
- // Automatic ISO rate
- type = CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised;
- } else {
- // Manual ISO rate
- type = CCamera::CCameraAdvancedSettings::EISOManual;
- }
- TRAP_IGNORE(mCameraDevice.advancedSettings()->SetISORateL(type, iso));
+ CCamera::CCameraAdvancedSettings::TISORateType type;
+ if (iso == 0) {
+ // Automatic ISO rate
+ type = CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised;
+ } else {
+ // Manual ISO rate
+ type = CCamera::CCameraAdvancedSettings::EISOManual;
}
+ TRAP_IGNORE(mCameraDevice.advancedSettings()->SetISORateL(type, iso));
CX_DEBUG_EXIT_FUNCTION();
}
@@ -201,16 +207,13 @@
CX_ASSERT_ALWAYS(mCameraDevice.imageProcessor());
// Scale UI values of -2..2 to ECAM range -100..100.
- int currentSharpness = mCameraDevice.imageProcessor()->TransformationValue(KUidECamEventImageProcessingAdjustSharpness);
- int newSharpness = newValue.toReal()*50;
+ int newSharpness = newValue.toReal() * 50;
- CX_DEBUG(("Current sharpness [uid:0x%08x] value is [%d]", KUidECamEventImageProcessingAdjustSharpness, currentSharpness));
- CX_DEBUG(("Setting sharpness [uid:0x%08x] to value [%d]", KUidECamEventImageProcessingAdjustSharpness, newSharpness));
- if (newSharpness != currentSharpness) {
- mCameraDevice.imageProcessor()->SetTransformationValue(KUidECamEventImageProcessingAdjustSharpness, newSharpness);
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ CX_DEBUG(("Setting sharpness [uid:0x%08x] to value [%d]",
+ KUidECamEventImageProcessingAdjustSharpness, newSharpness));
+ mCameraDevice.imageProcessor()->SetTransformationValue(
+ KUidECamEventImageProcessingAdjustSharpness, newSharpness);
+
#else
Q_UNUSED(newValue)
#endif
@@ -228,16 +231,13 @@
CX_ASSERT_ALWAYS(mCameraDevice.imageProcessor());
// Scale UI values of -2..2 to ECAM range -100..100.
- int currentContrast = mCameraDevice.imageProcessor()->TransformationValue(KUidECamEventImageProcessingAdjustContrast);
- int newContrast = newValue.toReal()*50;
+ int newContrast = newValue.toReal() * 50;
- CX_DEBUG(("Current contrast [uid:0x%08x] value is [%d]", KUidECamEventImageProcessingAdjustContrast, currentContrast));
- CX_DEBUG(("Setting contrast [uid:0x%08x] to value [%d]", KUidECamEventImageProcessingAdjustContrast, newContrast));
- if (newContrast != currentContrast) {
- mCameraDevice.imageProcessor()->SetTransformationValue(KUidECamEventImageProcessingAdjustContrast, newContrast);
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ CX_DEBUG(("Setting contrast [uid:0x%08x] to value [%d]",
+ KUidECamEventImageProcessingAdjustContrast, newContrast));
+
+ mCameraDevice.imageProcessor()->SetTransformationValue(
+ KUidECamEventImageProcessingAdjustContrast, newContrast);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -252,16 +252,13 @@
CX_ASSERT_ALWAYS(mCameraDevice.imageProcessor());
// Scale UI values of -10..10 to ECAM range -100..100.
- int currentBrightness = mCameraDevice.imageProcessor()->TransformationValue(KUidECamEventImageProcessingAdjustBrightness);
- int newBrightness = newValue.toInt()*10;
+ int newBrightness = newValue.toInt() * 10;
- CX_DEBUG(("Current brightness [uid:0x%08x] value is [%d]", KUidECamEventImageProcessingAdjustBrightness, currentBrightness));
- CX_DEBUG(("Setting brightness [uid:0x%08x] to value [%d]", KUidECamEventImageProcessingAdjustBrightness, newBrightness));
- if (newBrightness != currentBrightness) {
- mCameraDevice.imageProcessor()->SetTransformationValue(KUidECamEventImageProcessingAdjustBrightness, newBrightness);
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ CX_DEBUG(("Setting brightness [uid:0x%08x] to value [%d]",
+ KUidECamEventImageProcessingAdjustBrightness, newBrightness));
+
+ mCameraDevice.imageProcessor()->SetTransformationValue(
+ KUidECamEventImageProcessingAdjustBrightness, newBrightness);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -275,13 +272,11 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mCameraDevice.advancedSettings());
- CCamera::TExposure exposure = CxeSettingsMapperSymbian::Map2CameraExposureMode(newValue.toInt());
+ CCamera::TExposure exposure =
+ CxeSettingsMapperSymbian::Map2CameraExposureMode(
+ static_cast<Cxe::ExposureMode>(newValue.toInt()));
- if(exposure != mCameraDevice.advancedSettings()->ExposureMode()) {
- mCameraDevice.advancedSettings()->SetExposureMode(exposure);
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ mCameraDevice.advancedSettings()->SetExposureMode(exposure);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -298,13 +293,9 @@
// Exposure compensation is a float value, e.g. "-1.5".
// ECAM interface takes integer values, so KECamFineResolutionFactor from
// ecamconstants.h needs to be used as scaler.
- int ev = newValue.toReal()*KECamFineResolutionFactor;
+ int ev = newValue.toReal() * KECamFineResolutionFactor;
- if (ev != mCameraDevice.advancedSettings()->ExposureCompensationStep()) {
- mCameraDevice.advancedSettings()->SetExposureCompensationStep(ev);
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ mCameraDevice.advancedSettings()->SetExposureCompensationStep(ev);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -318,13 +309,10 @@
CX_DEBUG_ENTER_FUNCTION();
CX_ASSERT_ALWAYS(mCameraDevice.camera());
- CCamera::TFlash flash = CxeSettingsMapperSymbian::Map2CameraFlash(newValue.toInt());
+ CCamera::TFlash flash = CxeSettingsMapperSymbian::Map2CameraFlash(
+ static_cast<Cxe::FlashMode>(newValue.toInt()));
- if (flash != mCameraDevice.camera()->Flash()) {
- TRAP_IGNORE(mCameraDevice.camera()->SetFlashL(flash));
- } else {
- CX_DEBUG(("CxeSettingsControlSymbian: value up-to-date"));
- }
+ TRAP_IGNORE(mCameraDevice.camera()->SetFlashL(flash));
CX_DEBUG_EXIT_FUNCTION();
}
@@ -337,7 +325,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking();
- if(faceTracking) {
+ if (faceTracking) {
TRAP_IGNORE(faceTracking->SetFaceTrackingL(newValue.toInt()));
}
CX_DEBUG_EXIT_FUNCTION();
--- a/camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -22,130 +22,55 @@
#include <QVariant>
#include <QList>
#include <QMetaType>
-#include <ecam.h>
-#include <ecamadvsettingsuids.hrh>
-#include <ecamadvsettings.h>
#include <QObject>
-#include "cxesettingsmodel.h"
#include "cxesettingsimp.h"
-#include "cxesettings.h"
#include "cxutils.h"
#include "cxenamespace.h"
#include "cxeerror.h"
+#include "cxesettingsstore.h"
+#include "cxeexception.h"
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxesettingsimpTraces.h"
#endif
+#endif // Q_OS_SYMBIAN
+// signatures for setting listener slots
+const char *SETTING_LISTENER_SIGNATURE1 = "settingChanged(const QString &, const QVariant &)";
+const char *SETTING_LISTENER_SIGNATURE2 = "settingChanged(const QVariant &)";
-/*!
- Load image/video specific settings during mode change or startup
+/*
+* CxeSettingsImp::CxeSettingsImp
*/
-void CxeSettingsImp::loadSettings(Cxe::CameraMode mode)
+CxeSettingsImp::CxeSettingsImp(CxeSettingsStore *settingStore)
+: mSettingStore(settingStore),
+ mVariationSettings(),
+ mSceneModeStore(),
+ mCameraMode(Cxe::ImageMode)
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0(camerax_performance, CXESETTINGSIMP_LOADSETTINGS_IN, "msg: e_CX_SETTINGS_LOADSETTINGS 1");
-
-
- // inform the settings model for the change in mode.
- mSettingsModel.cameraModeChanged(mode);
+ loadVariationSettings();
- if (mode == Cxe::ImageMode) {
- emit sceneChanged(mSettingsModel.currentImageScene());
- } else {
- emit sceneChanged(mSettingsModel.currentVideoScene());
- }
-
- OstTrace0(camerax_performance, CXESETTINGSIMP_LOADSETTINGS_OUT, "msg: e_CX_SETTINGS_LOADSETTINGS 0");
CX_DEBUG_EXIT_FUNCTION();
}
-
-
-/*!
- Return the current integer setting value for the given key
+/*
+* CxeSettingsImp::close
*/
-CxeError::Id CxeSettingsImp::get(const QString &key, int &value) const
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- QVariant v;
- CxeError::Id err = mSettingsModel.getSettingValue(key, v);
-
- bool isInt;
- value = v.toInt(&isInt); // 0 denotes base, check the API
-
- if (isInt) {
- CX_DEBUG(("CxeSettingsImp::get - key: %s value: %d",
- key.toAscii().data(), value ));
- } else {
- err = CxeError::NotSupported;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-
-
-/*!
- Return the current real setting value for the given key
-*/
-CxeError::Id CxeSettingsImp::get(const QString &key, qreal &value) const
+CxeSettingsImp::~CxeSettingsImp()
{
CX_DEBUG_ENTER_FUNCTION();
-
- QVariant v;
- CxeError::Id err = mSettingsModel.getSettingValue(key, v);
-
- bool isReal;
- value = v.toReal(&isReal);
-
- if (isReal) {
- CX_DEBUG(("CxeSettingsImp::get - key: %s value: %f",
- key.toAscii().data(), value ));
- } else {
- err = CxeError::NotSupported;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
+ delete mSettingStore;
-/*!
- Return the current string setting value for the given key
-*/
-CxeError::Id CxeSettingsImp::get(
- const QString &key, QString &stringValue) const
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- QVariant value;
- CxeError::Id err = getSceneMode(key, stringValue);
-
- if (err == CxeError::NotFound) {
- // read from settings store
- err = mSettingsModel.getSettingValue(key, value);
- stringValue = value.toString();
- }
-
- CX_DEBUG(("CxeSettingsImp::get - key: %s value: %s",
- key.toAscii().data(), stringValue.toAscii().data()));
+ mVariationSettings.clear();
CX_DEBUG_EXIT_FUNCTION();
-
- return err;
}
-
-
/*
* Reads a value from cenrep
* @param key - setting key
@@ -160,41 +85,47 @@
QVariant &value) const
{
CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_ASSERT(mSettingStore);
- mSettingsModel.getSettingValue(uid, key, type, value);
+ mSettingStore->startMonitoring(uid, key, type, value);
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ Reset static settings (persistent settings)
+*/
+void CxeSettingsImp::reset()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_DEBUG_ASSERT(mSettingStore);
+ mSettingStore->reset();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
/*!
- Get the current scene mode setting value for the given key
+* 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.
+* @returns CxeError::None if successful or any CxeError specific error code.
*/
-CxeError::Id CxeSettingsImp::getSceneMode(
- const QString &key, QString &stringValue) const
+CxeError::Id CxeSettingsImp::getVariationValue(const QString &key, QVariant &value)
{
CX_DEBUG_ENTER_FUNCTION();
CxeError::Id err = CxeError::None;
- CxeScene scene;
- if(CxeSettingIds::IMAGE_SCENE == key) {
- scene = mSettingsModel.currentImageScene();
- } else if(CxeSettingIds::VIDEO_SCENE == key) {
- scene = mSettingsModel.currentVideoScene();
+ // read run-time configuration value
+ if ( mVariationSettings.contains(key) ) {
+ value = qVariantFromValue<QVariantList > (mVariationSettings.value(key));
} else {
err = CxeError::NotFound;
}
- if (err == CxeError::None) {
- stringValue = scene["sceneId"].toString();
- }
-
- CX_DEBUG(("CxeSettingsImp::get - key: %s value: %s",
- key.toAscii().data(), stringValue.toAscii().data()));
-
CX_DEBUG_EXIT_FUNCTION();
return err;
@@ -202,139 +133,401 @@
/*!
- Set new int value for the given key
-*/
-CxeError::Id CxeSettingsImp::set(const QString &key, int newValue)
+ * Add listener for changes in one setting. When the value of the setting changes, the given
+ * slot is invoked on given object.
+ *
+ * @param settingKey Setting to listen to
+ * @param target Object that the slot will be invoked for
+ * @param slot Slot that will be invoked. The slot can have either of these two signatures:
+ * slotName(const QVariant&) only new value of setting is passed as parameter
+ * slotName(const QString&, const QVariant&) both setting key and new value are passed as parameter
+ *
+ * @return boolean to indicate success
+ *
+ */
+bool CxeSettingsImp::listenForSetting(const QString &settingKey, QObject *target, const char *slot)
{
+
CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_ASSERT(target && slot);
+
+ // SLOT() macro adds '1' to the beginning of string so we use slot+1 to get the name of the slot
+ CX_DEBUG(("Adding listener %s::%s for key %s", target->metaObject()->className(), slot+1, settingKey.toAscii().data()));
+ QByteArray normalizedSlotName = QMetaObject::normalizedSignature(slot+1);
+
+ int slotIndex = target->metaObject()->indexOfSlot(normalizedSlotName);
- CX_DEBUG(("CxeSettingsImp::set - key: %s value: %d",
- key.toAscii().data(), newValue));
+ bool ok = false;
+ if (slotIndex > -1) {
+ CX_DEBUG(("Slot found, checking signature"));
+ // verify that slot is correct type
+ if (QMetaObject::checkConnectArgs(QMetaObject::normalizedSignature(SETTING_LISTENER_SIGNATURE1), normalizedSlotName) ||
+ QMetaObject::checkConnectArgs(QMetaObject::normalizedSignature(SETTING_LISTENER_SIGNATURE2), normalizedSlotName)) {
+
+ CX_DEBUG(("Slot signature ok, adding listener"));
+
+ // check if list for given key already exists
+ if (!mSettingListeners.contains(settingKey)) {
+ mSettingListeners.insert(settingKey, CxeSettingListenerList());
+ }
- CxeError::Id error = mSettingsModel.set(key, newValue);
- if (error == CxeError::None) {
- emit settingValueChanged(key, newValue);
+ // get QMetaMethod object
+ QMetaMethod method = target->metaObject()->method(slotIndex);
+ // add listener to the list
+ CxeSettingListenerList& list = mSettingListeners[settingKey];
+ list.append(CxeSettingListener(target, method));
+
+ // connect to destroyed() signal so we can remove listener if it's deleted
+ connect(target, SIGNAL(destroyed(QObject*)), this, SLOT(handleListenerDestroyed(QObject*)));
+
+ ok = true;
+ } else {
+ CX_DEBUG(("Slot signature doesn't match, can't add listener"));
+ }
+
+ } else {
+ CX_DEBUG(("Slot not found, can't add listener"));
}
CX_DEBUG_EXIT_FUNCTION();
-
- return error;
+ return ok;
}
+/*!
+ Load image/video specific settings during mode change or startup
+*/
+void CxeSettingsImp::loadSettings(Cxe::CameraMode mode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXESETTINGSIMP_LOADSETTINGS_IN, "msg: e_CX_SETTINGS_LOADSETTINGS 1");
+ mCameraMode = mode;
+
+ // inform the settings model for the change in mode.
+ if (mode == Cxe::ImageMode) {
+ restoreImageSettings();
+ notifyListeners(CxeSettingIds::IMAGE_SCENE_DATA, mSceneModeStore.currentScene(Cxe::ImageMode));
+ notifyListeners(CxeSettingIds::IMAGE_SCENE, mSceneModeStore.currentSceneId(Cxe::ImageMode));
+ emit settingValueChanged(CxeSettingIds::IMAGE_SCENE, mSceneModeStore.currentSceneId(Cxe::ImageMode));
+ } else {
+ restoreVideoSettings();
+ notifyListeners(CxeSettingIds::VIDEO_SCENE_DATA, mSceneModeStore.currentScene(Cxe::VideoMode));
+ notifyListeners(CxeSettingIds::VIDEO_SCENE, mSceneModeStore.currentSceneId(Cxe::VideoMode));
+ emit settingValueChanged(CxeSettingIds::VIDEO_SCENE, mSceneModeStore.currentSceneId(Cxe::VideoMode));
+ }
+
+ OstTrace0(camerax_performance, CXESETTINGSIMP_LOADSETTINGS_OUT, "msg: e_CX_SETTINGS_LOADSETTINGS 0");
+ CX_DEBUG_EXIT_FUNCTION();
+}
/*!
- Set new int value for the given key
+* 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.
+* @returns CxeError::None if successful or any CxeError specific error code.
*/
-CxeError::Id CxeSettingsImp::set(const QString &key, qreal newValue)
+void CxeSettingsImp::getValue(const QString &key, QVariant &value) const
{
CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_ASSERT(mSettingStore);
- CX_DEBUG(("CxeSettingsImp::set - key: %s value: %f",
- key.toAscii().data(), newValue));
+
+ CxeError::Id err = CxeError::None;
- CxeError::Id error = mSettingsModel.set(key, newValue);
+ // check if getting scene mode
+ if(key == CxeSettingIds::IMAGE_SCENE_DATA) {
+ value = mSceneModeStore.currentScene(Cxe::ImageMode);
+ } else if(key == CxeSettingIds::VIDEO_SCENE_DATA) {
+ value = mSceneModeStore.currentScene(Cxe::VideoMode);
+ } else {
+ // Try first to find the item from cenrep store.
+ err = mSettingStore->get(key, value);
- if (error == CxeError::None) {
- emit settingValueChanged(key, newValue);
+ // If setting is not in cenrep store, try fetching it from scene settings.
+ if (!err) {
+ CX_DEBUG(("Got value %s from settings store", value.toString().toAscii().data()));
+ } else {
+ // setting not found in setting store, try finding if its scene specific setting.
+ CX_DEBUG(( "fetching value from scene settings" ));
+ err = mSceneModeStore.sceneSettingValue(mCameraMode, key, value);
+ }
+ if (err) {
+ throw CxeException(err);
+ }
}
CX_DEBUG_EXIT_FUNCTION();
- return error;
}
-
/*!
- Set new string value for the given key
+* 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.
+* @returns CxeError::None if successful or any CxeError specific error code.
*/
-CxeError::Id CxeSettingsImp::set(const QString &key, const QString &newValue)
+void CxeSettingsImp::setValue(const QString &key, const QVariant &newValue)
{
CX_DEBUG_ENTER_FUNCTION();
-
- CX_DEBUG(("CxeSettingsImp::set - key: %s value: %s",
- key.toAscii().data(), newValue.toAscii().data()));
+ CX_DEBUG_ASSERT(mSettingStore);
- CxeError::Id error = setSceneMode(key, newValue);
+ CxeError::Id err;
+ // check if setting scene mode
+ if(key == CxeSettingIds::IMAGE_SCENE) {
+ setImageScene(newValue.toString());
+ } else if(key == CxeSettingIds::VIDEO_SCENE) {
+ setVideoScene(newValue.toString());
+ } else if(key == CxeSettingIds::IMAGE_SCENE_DATA || key == CxeSettingIds::VIDEO_SCENE_DATA) {
+ // setting whole scene by value is not supported
+ throw CxeException(CxeError::NotSupported);
+ } else {
+ // Try storing new value to cenrep
+ err = mSettingStore->set(key, newValue);
- if (error == CxeError::NotFound) {
- // not scene mode setting, try setting value to settings store
- mSettingsModel.set(key, newValue);
+ if (err) {
+ CX_DEBUG(( "Key not found in cenrepstore, writing value to scene settings" ));
+ err = mSceneModeStore.setSceneSettingValue(mCameraMode, key, newValue);
+ }
+
+ if (err) {
+ throw CxeException(err);
+ }
+
+ // send notifications
emit settingValueChanged(key, newValue);
+ notifyListeners(key, newValue);
}
CX_DEBUG_EXIT_FUNCTION();
- return error;
}
-
-
/*!
- Set the current scene mode setting value for the given key
+* Restores image settings, during mode change or during startup.
*/
-CxeError::Id CxeSettingsImp::setSceneMode(
- const QString &key,const QString &newValue)
+void CxeSettingsImp::restoreImageSettings()
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG(("CxeSettingsImp::set - key: %s value: %s",
- key.toAscii().data(), newValue.toAscii().data()));
+ QString currentSceneInUse = mSceneModeStore.currentSceneId(Cxe::ImageMode);
- CxeError::Id error = CxeError::None;
- CxeScene scene;
+ // get the image scene value from cenrep and load the scene settings
+ QString key(CxeSettingIds::IMAGE_SCENE);
+ QString cenrepSceneValue = CxeSettings::get<QString>(key);
- if(CxeSettingIds::IMAGE_SCENE == key) {
- error = mSettingsModel.setImageScene(newValue);
- scene = mSettingsModel.currentImageScene();
- } else if(CxeSettingIds::VIDEO_SCENE == key) {
- error = mSettingsModel.setVideoScene(newValue);
- scene = mSettingsModel.currentVideoScene();
- } else {
- error = CxeError::NotFound;
+ bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse);
+
+ if (ok2LoadSceneSettings) {
+ // loading scene settings
+ mSceneModeStore.setCurrentScene(Cxe::ImageMode, cenrepSceneValue);
}
- if (error == CxeError::None) {
- // scene mode set, inform clients about scene mode change
- emit sceneChanged(scene);
- }
+ // Updating Flash setting from cenrep
+ key = CxeSettingIds::FLASH_MODE;
+ int flashMode = CxeSettings::get<int>(key);
- CX_DEBUG_EXIT_FUNCTION();
+ // update local datastructure with flash setting value from cenrep.
+ CX_DEBUG(( "flash setting value %d", flashMode));
+ mSceneModeStore.setSceneSettingValue(Cxe::ImageMode, key, flashMode);
- return error;
-}
+ // Updating Face Tracking setting from cenrep
+ key = CxeSettingIds::FACE_TRACKING;
+ int faceTracking = CxeSettings::get<int>(key);
-/*!
- Reset static settings (persistent settings)
-*/
-void CxeSettingsImp::reset()
-{
- CX_DEBUG_ENTER_FUNCTION();
+ // update local datastructure with flash setting value from cenrep.
+ CX_DEBUG(( "Face Tracking setting value %d", faceTracking));
+ mSceneModeStore.setSceneSettingValue(Cxe::ImageMode, key, faceTracking);
- mSettingsModel.reset();
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Restores video settings, during mode change or during startup.
+*/
+void CxeSettingsImp::restoreVideoSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
-/*
-* CxeSettingsImp::CxeSettingsImp
+ QString currentSceneInUse = mSceneModeStore.currentSceneId(Cxe::VideoMode);
+
+ // get the video scene value from cenrep and load the scene settings
+ QString cenrepSceneValue = CxeSettings::get<QString>(CxeSettingIds::VIDEO_SCENE);
+
+ bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse);
+
+ if (ok2LoadSceneSettings) {
+ // loading video scene settings
+ mSceneModeStore.setCurrentScene(Cxe::VideoMode, cenrepSceneValue);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Set new Image scene mode.
+* @returns CxeError::None if successful or any CxeError specific error code.
+*/
+void CxeSettingsImp::setImageScene(const QString &newScene)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // load scene specific settings
+ mSceneModeStore.setCurrentScene(Cxe::ImageMode, newScene);
+
+ // saving current image scene to cenrep
+ CxeError::Id err = mSettingStore->set(CxeSettingIds::IMAGE_SCENE, newScene);
+ CxeException::throwIfError(err);
+
+ // saving flash value from scene to cenrep
+ // call CxeSettingStore::set directly because we don't want to send notifications
+ // about these changes
+ QString key(CxeSettingIds::FLASH_MODE);
+ err = mSettingStore->set(key, mSceneModeStore.currentScene(Cxe::ImageMode)[key].toInt());
+
+ CxeException::throwIfError(err);
+ // saving face tracking value from scene to cenrep
+ key = CxeSettingIds::FACE_TRACKING;
+ err = mSettingStore->set(key, mSceneModeStore.currentScene(Cxe::ImageMode)[key].toInt());
+ CxeException::throwIfError(err);
+
+ // send notifications
+ emit settingValueChanged(CxeSettingIds::IMAGE_SCENE, mSceneModeStore.currentSceneId(Cxe::ImageMode));
+ notifyListeners(CxeSettingIds::IMAGE_SCENE, mSceneModeStore.currentSceneId(Cxe::ImageMode));
+ notifyListeners(CxeSettingIds::IMAGE_SCENE_DATA, mSceneModeStore.currentScene(Cxe::ImageMode));
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+}
+
+/*!
+* Set new video scene mode.
+* @returns CxeError::None if successful or any CxeError specific error code.
*/
-CxeSettingsImp::CxeSettingsImp(CxeSettingsModel &settingsModel)
-: mSettingsModel(settingsModel)
+void CxeSettingsImp::setVideoScene(const QString &newScene)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mSceneModeStore.setCurrentScene(Cxe::VideoMode, newScene);
+
+ // video scene set successfully, store the scene value to cenrep
+ CxeError::Id err = mSettingStore->set(CxeSettingIds::VIDEO_SCENE, newScene);
+ CxeException::throwIfError(err);
+
+ emit settingValueChanged(CxeSettingIds::VIDEO_SCENE, mSceneModeStore.currentSceneId(Cxe::VideoMode));
+ notifyListeners(CxeSettingIds::VIDEO_SCENE, mSceneModeStore.currentSceneId(Cxe::VideoMode));
+ notifyListeners(CxeSettingIds::VIDEO_SCENE_DATA, mSceneModeStore.currentScene(Cxe::VideoMode));
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+}
+
+/*!
+* Loads all run-time variation settings
+*/
+void CxeSettingsImp::loadVariationSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_ASSERT( mSettingStore );
+
+ QList<QString> variationKeys;
+ // all supported runtime variation keys are fetched from here.
+ variationKeys.append(CxeVariationKeys::FREE_MEMORY_LEVELS);
+ variationKeys.append(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS);
+ variationKeys.append(CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS);
+
+ // load all run-time setting values from cenrep.
+ mVariationSettings = mSettingStore->loadVariationSettings(variationKeys);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Notify setting listeners that setting has changed
+ * @param settingKey Setting that has changed
+ * @param newValue New value of the setting
+ */
+void CxeSettingsImp::notifyListeners(const QString &settingKey, const QVariant &newValue)
{
- CX_DEBUG_IN_FUNCTION();
-}
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_DEBUG(("CxeSettingsImp::notifyListeners settingKey=%s", settingKey.toAscii().data()));
+
+ if (mSettingListeners.contains(settingKey)) {
+ CX_DEBUG(("Listeners found"));
+ // get list of listener
+ CxeSettingListenerList& list = mSettingListeners[settingKey];
+
+ // iterate through the list and call all listeners
+ CxeSettingListenerList::const_iterator i = list.constBegin();
+ for(; i != list.constEnd(); ++i) {
+
+ QObject *object = (*i).first;
+ QMetaMethod slot = (*i).second;
+
+ CX_DEBUG_ASSERT(object);
+
+ // invoke the slot
+ CX_DEBUG(("Calling slot %s::%s", object->metaObject()->className(), slot.signature()));
+
+ bool ok = false;
+ if (slot.parameterTypes().size() == 2) {
+ // slot has two parameters, send settingKey as well
+ ok = slot.invoke(object,
+ Qt::AutoConnection,
+ Q_ARG(QString, settingKey),
+ Q_ARG(QVariant, newValue));
+ } else {
+ // don't send settingKey as parameter
+ ok = slot.invoke(object,
+ Qt::AutoConnection,
+ Q_ARG(QVariant, newValue));
+ }
+
+ if (!ok) {
+ CX_DEBUG(("QMetaMethod::invoke() failed, listener not notified"))
+ }
+
+ }
+
+ } else {
+ CX_DEBUG(("NO listeners found"));
+ }
-/*
-* CxeSettingsImp::close
-*/
-CxeSettingsImp::~CxeSettingsImp()
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Handle deletion of registered listener.
+ */
+void CxeSettingsImp::handleListenerDestroyed(QObject *object)
{
- CX_DEBUG_IN_FUNCTION();
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QList<QString> keyList = mSettingListeners.keys();
+
+ for (int i = 0; i < keyList.size(); i++) {
+
+ QString key = keyList[i];
+ CxeSettingListenerList& list = mSettingListeners[key];
+
+ for (int j = 0; j < list.size(); j++) {
+ CxeSettingListener &listener = list[j];
+ if (listener.first == object) {
+ list.removeAt(j--);
+ }
+ }
+
+ // removed last listener for this key
+ if (list.size() == 0) {
+ mSettingListeners.remove(key);
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
}
// end of file
--- a/camerauis/cameraxui/cxengine/src/cxesettingsmappersymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsmappersymbian.cpp Wed Aug 18 09:37:18 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,10 +14,8 @@
* Description:
*
*/
-/*
-* Symbian specific settings handling
-*/
+#include <QRegExp>
#include <ecamadvsettingsuids.hrh>
#include "cxeautofocuscontrol.h"
@@ -27,149 +25,279 @@
using namespace Cxe;
-/*
-* Map White balance UI value to its corresponding CCamera value
+
+
+/*!
+ Map Cxe::Whitebalance value to its corresponding CCamera value.
*/
+CCamera::TWhiteBalance CxeSettingsMapperSymbian::Map2CameraWb(
+ Cxe::Whitebalance whiteBalance )
+{
+ CCamera::TWhiteBalance wb(CCamera::EWBAuto);
-CCamera::TWhiteBalance
-CxeSettingsMapperSymbian::Map2CameraWb(int wbId )
+ switch (whiteBalance) {
+ case WhitebalanceSunny:
+ wb = CCamera::EWBDaylight;
+ break;
+ case WhitebalanceCloudy:
+ wb = CCamera::EWBCloudy;
+ break;
+ case WhitebalanceIncandescent:
+ wb = CCamera::EWBTungsten;
+ break;
+ case WhitebalanceFluorescent:
+ wb = CCamera::EWBFluorescent;
+ break;
+ case WhitebalanceAutomatic:
+ default:
+ wb = CCamera::EWBAuto;
+ break;
+ }
+ return wb;
+}
+
+
+/*!
+ Map Cxe::FlashMode to its corresponding CCamera value.
+*/
+CCamera::TFlash CxeSettingsMapperSymbian::Map2CameraFlash(
+ Cxe::FlashMode flashMode)
+{
+ CCamera::TFlash flash(CCamera::EFlashAuto);
+
+ switch (flashMode) {
+ case FlashAntiRedEye:
+ flash = CCamera::EFlashRedEyeReduce;
+ break;
+ case FlashOn:
+ flash = CCamera::EFlashForced;
+ break;
+ case FlashOff:
+ flash = CCamera::EFlashNone;
+ break;
+ case FlashAuto:
+ default:
+ flash = CCamera::EFlashAuto;
+ break;
+ }
+ return flash;
+}
+
+
+/*!
+ Map Cxe::ExposureMode to its corresponding CCamera value.
+*/
+CCamera::TExposure CxeSettingsMapperSymbian::Map2CameraExposureMode(
+ Cxe::ExposureMode exposureMode)
{
- CCamera::TWhiteBalance wb( CCamera::EWBAuto );
- switch(wbId) {
- case WhitebalanceAutomatic: wb = CCamera::EWBAuto; break;
- case WhitebalanceSunny: wb = CCamera::EWBDaylight; break;
- case WhitebalanceCloudy: wb = CCamera::EWBCloudy; break;
- case WhitebalanceIncandescent: wb = CCamera::EWBTungsten; break;
- case WhitebalanceFluorescent: wb = CCamera::EWBFluorescent; break;
- default:
- break;
- }
- return wb;
+ CCamera::TExposure expo(CCamera::EExposureAuto);
+
+ switch (exposureMode) {
+ case ExposureNight:
+ expo = CCamera::EExposureNight;
+ break;
+ case ExposureBacklight:
+ expo = CCamera::EExposureBacklight;
+ break;
+ case ExposureSport:
+ expo = CCamera::EExposureSport;
+ break;
+ case ExposureAuto:
+ default:
+ expo = CCamera::EExposureAuto;
+ break;
+ }
+
+ return expo;
+}
+
+
+/*!
+ Map Cxe::ExposureMode to its corresponding CCamera value.
+*/
+CCamera::CCameraImageProcessing::TEffect
+ CxeSettingsMapperSymbian::Map2CameraEffect(Cxe::Colortone colorTone)
+{
+ CCamera::CCameraImageProcessing::TEffect effect(
+ CCamera::CCameraImageProcessing::EEffectNone);
+
+ switch(colorTone) {
+ case ColortoneBlackAndWhite:
+ effect = CCamera::CCameraImageProcessing::EEffectMonochrome;
+ break;
+ case ColortoneSepia:
+ effect = CCamera::CCameraImageProcessing::EEffectSepia;
+ break;
+ case ColortoneNegative:
+ effect = CCamera::CCameraImageProcessing::EEffectNegative;
+ break;
+ case ColortoneVivid:
+ effect = CCamera::CCameraImageProcessing::EEffectVivid;
+ break;
+ case ColortoneNormal:
+ default:
+ effect = CCamera::CCameraImageProcessing::EEffectNone;
+ break;
+ }
+ return effect;
+}
+
+/*!
+ Map CxeAutoFocusControl::Mode to its corresponding CCamera value.
+*/
+CCamera::CCameraAdvancedSettings::TFocusRange
+CxeSettingsMapperSymbian::Map2CameraAutofocus(CxeAutoFocusControl::Mode afMode)
+{
+ CCamera::CCameraAdvancedSettings::TFocusRange value;
+
+ switch (afMode) {
+ case CxeAutoFocusControl::Macro:
+ value = CCamera::CCameraAdvancedSettings::EFocusRangeMacro;
+ break;
+ case CxeAutoFocusControl::Portrait:
+ value = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
+ break;
+ case CxeAutoFocusControl::Infinity:
+ value = CCamera::CCameraAdvancedSettings::EFocusRangeInfinite;
+ break;
+ case CxeAutoFocusControl::Hyperfocal:
+ value = CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal;
+ break;
+ case CxeAutoFocusControl::Auto: // Fall through
+ default:
+ value = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
+ break;
+ }
+ return value;
}
-// Map2CameraFlash
-
-CCamera::TFlash
-CxeSettingsMapperSymbian::Map2CameraFlash(int flashId)
+/*!
+ Map Cxe::DeviceOrientation to MCameraOrientation.
+*/
+MCameraOrientation::TOrientation
+ CxeSettingsMapperSymbian::Map2CameraOrientation(Cxe::DeviceOrientation
+ uiOrientation)
{
- CCamera::TFlash flash( CCamera::EFlashAuto );
- switch (flashId) {
- case FlashAuto: flash = CCamera::EFlashAuto; break;
- case FlashAntiRedEye: flash = CCamera::EFlashRedEyeReduce; break;
- case FlashOn: flash = CCamera::EFlashForced; break;
- case FlashOff: flash = CCamera::EFlashNone; break;
- default:
- break;
- }
- return flash;
+ MCameraOrientation::TOrientation cameraOrientation;
+
+ switch (uiOrientation) {
+ case Orientation90:
+ cameraOrientation = MCameraOrientation::EOrientation90;
+ break;
+ case Orientation180:
+ cameraOrientation = MCameraOrientation::EOrientation180;
+ break;
+ case Orientation270:
+ cameraOrientation = MCameraOrientation::EOrientation270;
+ break;
+ case Orientation0: // default
+ default:
+ cameraOrientation = MCameraOrientation::EOrientation0;
+ break;
+ }
+ return cameraOrientation;
}
-
-// ---------------------------------------------------------------------------
-// Map2CameraExposureMode
-// ---------------------------------------------------------------------------
-//
-CCamera::TExposure
-CxeSettingsMapperSymbian::Map2CameraExposureMode(int expModeId )
- {
- CCamera::TExposure expo( CCamera::EExposureAuto );
-
- switch ( expModeId )
+/*!
+ Helper data structure to define how MIME types are mapped to
+ MCameraUseCaseHint enumerations.
+*/
+class CxeCodecMapping
+{
+public:
+ CxeCodecMapping(const char *regexp, MCameraUseCaseHint::TVideoCodec codec,
+ MCameraUseCaseHint::TVideoProfile profile) :
+ mRegExp(regexp),
+ mCodec(codec),
+ mProfile(profile)
{
- case ExposureAuto: expo = CCamera::EExposureAuto; break;
- case ExposureNight: expo = CCamera::EExposureNight; break;
- case ExposureBacklight: expo = CCamera::EExposureBacklight; break;
- case ExposureSport: expo = CCamera::EExposureSport; break;
- default:
- break;
+ // No implementation needed
}
- return expo;
- }
-
-
-
+public:
+ QString mRegExp;
+ MCameraUseCaseHint::TVideoCodec mCodec;
+ MCameraUseCaseHint::TVideoProfile mProfile;
+};
-// ---------------------------------------------------------------------------
-// Map2CameraEffect
-// ---------------------------------------------------------------------------
-//
-CCamera::CCameraImageProcessing::TEffect
-CxeSettingsMapperSymbian::Map2CameraEffect(int colourFilterId)
- {
- CCamera::CCameraImageProcessing::TEffect effect(
- CCamera::CCameraImageProcessing::EEffectNone );
+/*!
+ Map video codec MIME type from ICM to enumerations used by the
+ MCameraUseCaseHint custom interface
- switch( colourFilterId )
- {
- case ColortoneNormal: effect = CCamera::CCameraImageProcessing::EEffectNone; break;
- case ColortoneBlackAndWhite: effect = CCamera::CCameraImageProcessing::EEffectMonochrome; break;
- case ColortoneSepia: effect = CCamera::CCameraImageProcessing::EEffectSepia; break;
- case ColortoneNegative: effect = CCamera::CCameraImageProcessing::EEffectNegative; break;
- case ColortoneVivid: effect = CCamera::CCameraImageProcessing::EEffectVivid; break;
- default:
- break;
- }
- return effect;
- }
-
-
-
-// ---------------------------------------------------------------------------
-// CxeSettingsMapperSymbian::Map2CameraAutofocus
-// ---------------------------------------------------------------------------
-//
-CCamera::CCameraAdvancedSettings::TFocusRange
-CxeSettingsMapperSymbian::Map2CameraAutofocus(CxeAutoFocusControl::Mode afMode )
+ \param[in] videoDetails CxeVideoDetails defining the current video quality.
+ \param[out] codec Reference where to store the video codec info.
+ MCameraUseCaseHint::ECodecUnknown if not known.
+ \param[out] profile Reference where to store the video profile info.
+ MCameraUseCaseHint::EProfileUnknown if not known.
+*/
+void CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(
+ const CxeVideoDetails &videoDetails,
+ MCameraUseCaseHint::TVideoCodec &codec,
+ MCameraUseCaseHint::TVideoProfile &profile)
{
- CCamera::CCameraAdvancedSettings::TFocusRange value;
- switch( afMode ) {
- case CxeAutoFocusControl::Macro:
- value = CCamera::CCameraAdvancedSettings::EFocusRangeMacro;
- break;
- case CxeAutoFocusControl::Portrait:
- value = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
- break;
- case CxeAutoFocusControl::Infinity:
- value = CCamera::CCameraAdvancedSettings::EFocusRangeInfinite;
- break;
- case CxeAutoFocusControl::Hyperfocal:
- value = CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal;
- break;
- case CxeAutoFocusControl::Auto: // Fall through
- default:
- value = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
- break;
- }
- return value;
-}
+ typedef QPair<MCameraUseCaseHint::TVideoCodec,
+ MCameraUseCaseHint::TVideoProfile> CxeCodecAndProfile;
+
+ codec = MCameraUseCaseHint::ECodecUnknown;
+ profile = MCameraUseCaseHint::EProfileUnknown;
+
+ // Create a mapping table for mapping from the MIME type string
+ // to MCameraUseCaseHint codec and profile enums using QRegExp. Specific
+ // rules should be before more generic ones because the map is iterated in
+ // order.
+ QList<CxeCodecMapping> mappingTable;
+ mappingTable << CxeCodecMapping("^video/H263-2000",
+ MCameraUseCaseHint::ECodecH263,
+ MCameraUseCaseHint::EProfileH263P0L10)
+
+ << CxeCodecMapping("^video/H264.*profile-level-id=42801E",
+ MCameraUseCaseHint::ECodecH264,
+ MCameraUseCaseHint::EProfileH264BpL3)
+
+ << CxeCodecMapping("^video/H264.*profile-level-id=42801F",
+ MCameraUseCaseHint::ECodecH264,
+ MCameraUseCaseHint::EProfileH264BpL3_1)
+
+ << CxeCodecMapping("^video/H264", // Other H.264 profile
+ MCameraUseCaseHint::ECodecH264,
+ MCameraUseCaseHint::EProfileUnknown)
+ << CxeCodecMapping("^video/mp4v-es.*profile-level-id=2",
+ MCameraUseCaseHint::ECodecMpeg4,
+ MCameraUseCaseHint::EProfileMPEG4SpL2)
-// CxeSettingsMapperSymbian::Map2CameraOrientation
+ << CxeCodecMapping("^video/mp4v-es.*profile-level-id=3",
+ MCameraUseCaseHint::ECodecMpeg4,
+ MCameraUseCaseHint::EProfileMPEG4SpL3)
+
+ << CxeCodecMapping("^video/mp4v-es.*profile-level-id=4",
+ MCameraUseCaseHint::ECodecMpeg4,
+ MCameraUseCaseHint::EProfileMPEG4SpL4a)
+
+ << CxeCodecMapping("^video/mp4v-es", // Other MPEG-4 profile
+ MCameraUseCaseHint::ECodecMpeg4,
+ MCameraUseCaseHint::EProfileUnknown);
-MCameraOrientation::TOrientation
-CxeSettingsMapperSymbian::Map2CameraOrientation(DeviceOrientation uiOrientation)
-{
- MCameraOrientation::TOrientation cameraOrientation;
- switch(uiOrientation) {
- case Orientation90:
- cameraOrientation = MCameraOrientation::EOrientation90;
- break;
- case Orientation180:
- cameraOrientation = MCameraOrientation::EOrientation180;
- break;
- case Orientation270:
- cameraOrientation = MCameraOrientation::EOrientation270;
- break;
- case Orientation0: // default
- default:
- cameraOrientation = MCameraOrientation::EOrientation0;
- break;
+ bool found = false;
+ for (int i = 0; i < mappingTable.count() && !found; i++) {
+ QRegExp regExp(mappingTable[i].mRegExp, Qt::CaseInsensitive);
+ if (regExp.indexIn(videoDetails.mVideoCodecMimeType) >= 0) {
+ found = true;
+ codec = mappingTable[i].mCodec;
+ profile = mappingTable[i].mProfile;
+
+ CX_DEBUG(("Matched codec %d, profile 0x%x for '%s'", codec, profile,
+ videoDetails.mVideoCodecMimeType.toAscii().constData()));
+ }
}
- return cameraOrientation;
+
+ if (!found) {
+ CX_DEBUG(("No codec/profile found for '%s'",
+ videoDetails.mVideoCodecMimeType.toAscii().constData()));
+ }
}
// end of file
--- a/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,753 +0,0 @@
-/*
-* 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:
-*
-*/
-/*
-* Symbian specific settings handling
-*/
-
-#include <QVariant>
-#include <QFile>
-#include <QList>
-#include <QMultiMap>
-#include <QMetaType>
-
-#include "cxesettingsmodelimp.h"
-#include "cxesettingscenrepstore.h"
-#include "cxesettings.h"
-#include "cxutils.h"
-#include "cxenamespace.h"
-#include "cxeerror.h"
-#include "cxeautofocuscontrol.h"
-
-
-using namespace Cxe;
-
-
-/*!
-* CxeSettingsModel::CxeSettingsModel
-*/
-CxeSettingsModelImp::CxeSettingsModelImp(CxeSettingsStore *settingsStore)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_ASSERT_ALWAYS(settingsStore);
- // we take ownership of the settings store.
- mSettingStore = settingsStore;
- init();
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
-* CxeSettingsModelImp::init
-*/
-void CxeSettingsModelImp::init()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- mCurrentImgScene.clear();
- mCurrentVidScene.clear();
-
- loadRuntimeSettings();
- loadImageScenes();
- loadVideoScenes();
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/*!
-* CxeSettingsModelImp::~CxeSettingsModelImp()
-*/
-CxeSettingsModelImp::~CxeSettingsModelImp()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- delete mSettingStore;
-
- mCurrentImgScene.clear();
- mCurrentVidScene.clear();
-
- mImageSceneModes.clear();
- mVideoSceneModes.clear();
-
- mRuntimeSettings.clear();
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/*!
-* Loads all run-time settings
-*/
-void CxeSettingsModelImp::loadRuntimeSettings()
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT( mSettingStore );
-
- QList<QString> runtimeKeys;
- // all supported runtime keys are fetched from here.
- supportedKeys(runtimeKeys);
- // load all run-time setting values from cenrep.
- mRuntimeSettings = mSettingStore->loadRuntimeSettings(runtimeKeys);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
-* 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.
-* @returns CxeError::None if successful or any CxeError specific error code.
-*/
-CxeError::Id CxeSettingsModelImp::getSettingValue(const QString &key, QVariant &value)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mSettingStore);
-
- // Try first to find the item from cenrep store.
-
- CxeError::Id err = mSettingStore->get(key, value);
-
- // 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 scene settings" ));
- err = sceneSettingValue(key, value);
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-
-
-/*!
-* Get setting value associated with the key.
-* @param uid - UID of component that owns the setting key
-* @Param key - key id of the setting
-* @param type - the type of key
-* @Param value - contains the value associated with the key.
-*/
-void CxeSettingsModelImp::getSettingValue(long int uid,
- unsigned long int key,
- Cxe::SettingKeyType type,
- QVariant &value)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mSettingStore);
-
- mSettingStore->startMonitoring(uid, key, type, value);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-
-/*!
-* 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.
-* @returns CxeError::None if successful or any CxeError specific error code.
-*/
-CxeError::Id CxeSettingsModelImp::set(const QString &key, const QVariant newValue)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mSettingStore);
-
- // Try storing new value to cenrep
- CxeError::Id 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();
-
- return err;
-}
-
-
-/*!
-* Reset all settings
-*/
-void CxeSettingsModelImp::reset()
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mSettingStore);
- mSettingStore->reset();
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
-* 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.
-* @returns CxeError::None if successful or any CxeError specific error code.
-*/
-CxeError::Id CxeSettingsModelImp::getRuntimeValue(const QString &key, QVariant &value)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeError::Id err = CxeError::None;
-
- // read run-time configuration value
- if ( mRuntimeSettings.contains(key) ) {
- value = qVariantFromValue<QVariantList > (mRuntimeSettings.value(key));
- } else {
- err = CxeError::NotFound;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-/*!
-* Set new Image scene mode.
-* @returns CxeError::None if successful or any CxeError specific error code.
-*/
-CxeError::Id CxeSettingsModelImp::setImageScene(const QString &newScene)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- // load scene specific settings
- CxeError::Id err = loadSceneData(newScene, mCurrentImgScene);
-
- if (!err) {
- // saving current image scene to cenrep
- err = set(CxeSettingIds::IMAGE_SCENE, newScene);
-
- // saving flash value from scene to cenrep
- QString key(CxeSettingIds::FLASH_MODE);
- err = set(key, mCurrentImgScene[key].toInt());
-
- // saving face tracking value from scene to cenrep
- key = CxeSettingIds::FACE_TRACKING;
- err = set(key, mCurrentImgScene[key].toInt());
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-/*!
-* Set new video scene mode.
-* @returns CxeError::None if successful or any CxeError specific error code.
-*/
-CxeError::Id CxeSettingsModelImp::setVideoScene(const QString &newScene)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeError::Id err = loadSceneData(newScene, mCurrentVidScene);
-
- if (!err) {
- // video scene loaded successfully, store the scene value to cenrep
- err = set(CxeSettingIds::VIDEO_SCENE, newScene);
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-
-/*!
-* Loads Image scene settings for the given Scene ID
-*/
-CxeError::Id CxeSettingsModelImp::imageScene(const QString &sceneId, CxeScene &sceneSettings)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeError::Id err = CxeError::None;
-
- if(mImageSceneModes.contains(sceneId)) {
- sceneSettings = mImageSceneModes[sceneId];
- } else {
- err = CxeError::NotFound;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-/*!
-* Loads Video scene settings for the given Scene ID
-* \param sceneId
-* \param sceneSettings
-*/
-CxeError::Id CxeSettingsModelImp::videoScene(const QString &sceneId, CxeScene &sceneSettings)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeError::Id err = CxeError::None;
-
- if(mVideoSceneModes.contains(sceneId)) {
- sceneSettings = mVideoSceneModes[sceneId];
- } else {
- err = CxeError::NotFound;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-/*!
-* Creates a copy of the selected scene that we use for accessing specific scene settings.
-* \param newScene
-* \param currentSceneSettings
-*/
-CxeError::Id CxeSettingsModelImp::loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeScene sceneDefaultSettings;
- CxeError::Id err = imageScene(newScene, sceneDefaultSettings);
-
- if (err == CxeError::NotFound) {
- // not still scene, try in video scene.
- err = videoScene(newScene, sceneDefaultSettings);
- }
-
- 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 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)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeScene scene;
- CxeError::Id err = CxeError::None;
-
- if(mCameraMode == Cxe::ImageMode) {
- CX_DEBUG(( "CxeSettingsModelImp::sceneSettingValue - Image mode Setting"));
- scene = mCurrentImgScene;
- } else {
- CX_DEBUG(( "CxeSettingsModelImp::sceneSettingValue - Video mode Setting"));
- scene = mCurrentVidScene;
- }
-
- if (scene.contains(key)) {
- value = scene[key];
- } else {
- err = CxeError::NotFound;
- }
-
-
- CX_DEBUG_EXIT_FUNCTION();
-
- return err;
-}
-
-
-/*!
-* 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) {
- CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Image mode Setting"));
- scene = &mCurrentImgScene;
- } else {
- CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Video mode Setting"));
- 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();
-
- return err;
-}
-
-
-/*!
-* 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<QString>& runtimeKeys)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- runtimeKeys.append(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS);
- runtimeKeys.append(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS);
- runtimeKeys.append(CxeRuntimeKeys::SECONDARY_CAMERA_CAPTURE_KEYS);
- runtimeKeys.append(CxeRuntimeKeys::FREE_MEMORY_LEVELS);
- runtimeKeys.append(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS);
- runtimeKeys.append(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
-* Loads all video scene modes
-*/
-void CxeSettingsModelImp::loadVideoScenes()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- mVideoSceneModes.clear();
-
- CxeScene vidSceneAuto;
-
- 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);
- vidSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- vidSceneAuto.insert(CxeSettingIds::CONTRAST, 0);
- vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0);
- vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
-
- mVideoSceneModes.insert(Cxe::VIDEO_SCENE_AUTO,vidSceneAuto);
-
-
- CxeScene vidSceneNight;
-
- 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);
- vidSceneNight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- vidSceneNight.insert(CxeSettingIds::CONTRAST, 0);
- vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0);
- vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
-
- mVideoSceneModes.insert(Cxe::VIDEO_SCENE_NIGHT, vidSceneNight);
-
-
- CxeScene vidSceneLowLight;
-
- 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);
- vidSceneLowLight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- vidSceneLowLight.insert(CxeSettingIds::CONTRAST, 0);
- vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps
- vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
-
- mVideoSceneModes.insert(Cxe::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight);
-
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
-* Loads all Image Scene Modes
-*/
-void CxeSettingsModelImp::loadImageScenes()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- mImageSceneModes.clear();
-
- CxeScene imgSceneAuto;
-
- 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);
- imgSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imgSceneAuto.insert(CxeSettingIds::CONTRAST, 0);
- imgSceneAuto.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
- imgSceneAuto.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_AUTO, imgSceneAuto);
-
-
- CxeScene imgSceneSports;
-
- 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);
- imgSceneSports.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imgSceneSports.insert(CxeSettingIds::CONTRAST, 0);
- imgSceneSports.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
- imgSceneSports.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_SPORTS, imgSceneSports);
-
-
- CxeScene imgSceneCloseUp;
-
- 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);
- imgSceneCloseUp.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imgSceneCloseUp.insert(CxeSettingIds::CONTRAST, 0);
- imgSceneCloseUp.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
- imgSceneCloseUp.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_MACRO, imgSceneCloseUp);
-
- CxeScene imgPortraitscene;
-
- 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);
- imgPortraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imgPortraitscene.insert(CxeSettingIds::CONTRAST, 0);
- imgPortraitscene.insert(CxeSettingIds::SHARPNESS, SharpnessSoft);
- imgPortraitscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
-
- CxeScene imglandscapescene;
-
- 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);
- imglandscapescene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imglandscapescene.insert(CxeSettingIds::CONTRAST, 0);
- imglandscapescene.insert(CxeSettingIds::SHARPNESS, SharpnessHard);
- imglandscapescene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_SCENERY, imglandscapescene);
-
-
- CxeScene imgNightscene;
-
- 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);
- imgNightscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imgNightscene.insert(CxeSettingIds::CONTRAST, 0);
- imgNightscene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
- imgNightscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_NIGHT, imgNightscene);
-
- CxeScene imgNightpotraitscene;
-
- 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);
- imgNightpotraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal);
- imgNightpotraitscene.insert(CxeSettingIds::CONTRAST, 0);
- imgNightpotraitscene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal);
- imgNightpotraitscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic);
- 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(Cxe::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-/*!
-* Returns the current image scene mode.
-*/
-CxeScene& CxeSettingsModelImp::currentImageScene()
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_EXIT_FUNCTION();
-
- return mCurrentImgScene;
-}
-
-
-/*!
-* Returns the current video scene mode.
-*/
-CxeScene& CxeSettingsModelImp::currentVideoScene()
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_EXIT_FUNCTION();
-
- return mCurrentVidScene;
-}
-
-
-/*!
-* 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();
-}
-
-// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsstoredesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* 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: Desktop specific settings handling
+*
+*/
+
+#include <QVariant>
+#include <QList>
+#include <QMultiMap>
+#include <QMetaType>
+#include <QString>
+#include <QStringList>
+#include <QVariant>
+
+#include "cxesettingsstoredesktop.h"
+#include "cxenamespace.h"
+#include "cxutils.h"
+#include "cxenamespace.h"
+#include "cxeerror.h"
+
+using namespace Cxe;
+using namespace CxeSettingIds;
+
+
+/*!
+* Constructor
+*/
+CxeSettingsStoreDesktop::CxeSettingsStoreDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ initSettings();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Destructor
+*/
+CxeSettingsStoreDesktop::~CxeSettingsStoreDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Initalizes settings with default values.
+*/
+void CxeSettingsStoreDesktop::initSettings()
+{
+ mSettings[CAMERA_MODE] = QVariant(0);
+ mSettings[FLASH_MODE] = QVariant(0);
+ mSettings[WHITE_BALANCE] = QVariant(0);
+ mSettings[LIGHT_SENSITIVITY] = QVariant(0);
+ mSettings[EXPOSURE_MODE] = QVariant(0);
+ mSettings[SHARPNESS] = QVariant(0);
+ mSettings[COLOR_TONE] = QVariant(0);
+ mSettings[EV_COMPENSATION_VALUE] = QVariant(0);
+ mSettings[CONTRAST] = QVariant(0);
+ mSettings[BRIGHTNESS] = QVariant(0);
+ mSettings[SCENE_ID] = QVariant(IMAGE_SCENE_AUTO);
+ mSettings[IMAGE_QUALITY] = QVariant(0);
+ mSettings[VIDEO_QUALITY] = QVariant(0);
+ mSettings[SELF_TIMER] = QVariant(-1);
+ mSettings[FACE_TRACKING] = QVariant(0);
+ mSettings[GEOTAGGING] = QVariant(0);
+ mSettings[IMAGE_SCENE] = QVariant(IMAGE_SCENE_AUTO);
+ mSettings[VIDEO_SCENE] = QVariant(VIDEO_SCENE_AUTO);
+ mSettings[STILL_SHOWCAPTURED] = QVariant(2000);
+ mSettings[VIDEO_SHOWCAPTURED] = QVariant(2000);
+}
+
+
+
+/*!
+* Reads all run-time settings values from the internal hash
+* \param QList<QString> contains list of all runtime key ids.
+* \return QHash containing value associated to the keys
+* \note loading runtime settings should be done only ONCE at start-up.
+*/
+QHash<QString, QVariantList> CxeSettingsStoreDesktop::loadVariationSettings(QList<QString>& runtimeKeys)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QHash<QString, QVariantList> settings;
+ CxeError::Id err = CxeError::None;
+ QVariantList list;
+ QVariant data;
+
+ // parsing through the list of run-time keys and reading values from the settings array.
+ foreach (QString key, runtimeKeys) {
+
+ // read the data from cenrep
+ err = get(key, data);
+
+ // clear the list
+ list.clear();
+
+ if (CxeError::None == err) {
+ if (data.type() == QMetaType::QString ) {
+ QString str = data.toString();
+ QVariant strListVariant = qVariantFromValue(str.split(","));
+ //generate qvariantlist from strListVariant
+ list = strListVariant.toList();
+ } else {
+ // if its of any other type, then just append to the list
+ list.append(data);
+ }
+ }
+ // append the values associated with the key to the list.
+ settings.insert(key, list);
+
+ } // end for
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return settings;
+}
+
+
+
+/*!
+* Reads a setting from the internal hash
+* \param "key" - setting key
+* \param "value" - setting value read from cenrep
+* \return Error code
+*/
+
+CxeError::Id CxeSettingsStoreDesktop::get(const QString& key, QVariant &value)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_DEBUG(("CxeSettingsStoreDesktop::get - key: %s", key.toAscii().constData()));
+
+ if (mSettings.contains(key) )
+ {
+ value.setValue(mSettings.value(key));
+ }
+
+ CxeError::Id err = CxeError::None;
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
+}
+
+/*!
+* Reads a value from the settings store and starts monitoring it.
+* \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
+* \note Not only dummy implementation in desktop.
+*/
+void CxeSettingsStoreDesktop::startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ value = QVariant::Invalid;
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Sets a new value to the internal hash
+* \param "key" - setting key
+* \param "newValue" - new value set to the key in cenrep
+* \return Error code, in this case, always CxeError::None
+*/
+CxeError::Id CxeSettingsStoreDesktop::set(const QString& key, const QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mSettings.contains(key) )
+ {
+ mSettings[key] = newValue;
+ }
+ CxeError::Id err = CxeError::None;
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
+}
+
+
+
+/*!
+* resets the cenrep store
+*/
+void CxeSettingsStoreDesktop::reset()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ //!@Todo: How to reset the repository.
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -259,12 +259,8 @@
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));
+ mCaptureSoundForced = mSettings.get<bool>(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, false);
+ CX_DEBUG(("Capture sound forced [%d]", mCaptureSoundForced));
// use sound if forced on or warningtones are enabled
mUseSound = mCaptureSoundForced || warningTonesEnabled;
--- a/camerauis/cameraxui/cxengine/src/cxestatemachine.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestatemachine.cpp Wed Aug 18 09:37:18 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,11 +14,12 @@
* Description:
*
*/
+
#include "cxestatemachine.h"
#include "cxestate.h"
#include "cxutils.h"
-CxeStateMachine::CxeStateMachine( const char* stateMachineName ) :
+CxeStateMachine::CxeStateMachine(const char *stateMachineName) :
CxeStateMachineBase(stateMachineName)
{
}
@@ -28,7 +29,7 @@
}
-bool CxeStateMachine::addState( CxeState* state )
+bool CxeStateMachine::addState(CxeState *state)
{
CX_DEBUG_ENTER_FUNCTION();
bool success = CxeStateMachineBase::addState(state);
@@ -37,7 +38,7 @@
return success;
}
-bool CxeStateMachine::setState( int stateId, int error )
+bool CxeStateMachine::setState(int stateId, CxeError::Id error)
{
CX_DEBUG_ENTER_FUNCTION();
bool success = CxeStateMachineBase::setState(stateId, error);
@@ -46,7 +47,7 @@
return success;
}
-bool CxeStateMachine::setInitialState( int stateId )
+bool CxeStateMachine::setInitialState(int stateId)
{
CX_DEBUG_ENTER_FUNCTION();
bool success = CxeStateMachineBase::setInitialState(stateId);
@@ -54,8 +55,3 @@
CX_DEBUG_EXIT_FUNCTION();
return success;
}
-
-
-
-
-
--- a/camerauis/cameraxui/cxengine/src/cxestatemachinebase.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestatemachinebase.cpp Wed Aug 18 09:37:18 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,12 +14,12 @@
* Description:
*
*/
+
#include "cxestatemachinebase.h"
#include "cxutils.h"
-#include "cxeerrormappingsymbian.h"
#include "cxestate.h"
-CxeStateMachineBase::CxeStateMachineBase( const char* stateMachineName ) :
+CxeStateMachineBase::CxeStateMachineBase(const char *stateMachineName) :
mStateBitsUsed(0), mStateId(0), mName(stateMachineName)
{
}
@@ -30,7 +30,7 @@
mStates.clear();
}
-bool CxeStateMachineBase::addState( CxeState* state )
+bool CxeStateMachineBase::addState(CxeState *state)
{
bool success( state // non-null state object
&& state->stateId() // state id is not zero
@@ -46,7 +46,7 @@
return success;
}
-bool CxeStateMachineBase::setState( int stateId, int error )
+bool CxeStateMachineBase::setState(int stateId, CxeError::Id error)
{
bool success = true;
@@ -76,13 +76,13 @@
if (success) {
mStateId = stateId;
- handleStateChanged(mStateId, CxeErrorHandlingSymbian::map(error));
+ handleStateChanged(mStateId, error);
}
return success;
}
-bool CxeStateMachineBase::setInitialState( int stateId )
+bool CxeStateMachineBase::setInitialState(int stateId)
{
bool success = mStates.contains(stateId);
@@ -113,7 +113,7 @@
return mStateId;
}
-bool CxeStateMachineBase::verifyStateChange( int newStateId )
+bool CxeStateMachineBase::verifyStateChange(int newStateId)
{
bool allowStateChange = false;
@@ -126,7 +126,3 @@
return allowStateChange;
}
-
-
-
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontroldesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,594 @@
+/*
+* 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 <QPixmap>
+
+#include "cxestillcapturecontroldesktop.h"
+#include "cxeimagedataitemdesktop.h"
+#include "cxeimagedataqueuedesktop.h"
+#include "cxefilenamegenerator.h"
+#include "cxefilesavethreaddesktop.h"
+#include "cxutils.h"
+#include "cxecameradevicecontrol.h"
+#include "cxestillimagedesktop.h"
+#include "cxeviewfindercontrol.h"
+#include "cxeviewfindercontroldesktop.h"
+#include "cxeautofocuscontrol.h"
+#include "cxestate.h"
+#include "cxecameradevicedesktop.h"
+
+// constants
+const int KMaintainAspectRatio = false;
+
+
+
+/**
+ * Constructor.
+ */
+CxeStillCaptureControlDesktop::CxeStillCaptureControlDesktop(
+ CxeCameraDeviceDesktop &cameraDevice,
+ CxeViewfinderControl &viewfinderControl,
+ CxeCameraDeviceControl &cameraDeviceControl,
+ CxeFilenameGenerator &nameGenerator,
+ CxeAutoFocusControl &autoFocusControl,
+ CxeFileSaveThread &saveThread) :
+ mCameraDevice(cameraDevice),
+ mState(CxeStillCaptureControl::Uninitialized),
+ mViewfinderControl(viewfinderControl),
+ mCameraDeviceControl(cameraDeviceControl),
+ mFilenameGenerator(nameGenerator),
+ mAutoFocusControl(autoFocusControl),
+ mMode(SingleImageCapture),
+ mAfState(CxeAutoFocusControl::Unknown),
+ mSaveThread(saveThread)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qRegisterMetaType<CxeStillCaptureControl::State>();
+ initializeStates();
+ reset();
+
+ mImageDataQueue = new CxeImageDataQueueDesktop();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Destructor.
+ */
+CxeStillCaptureControlDesktop::~CxeStillCaptureControlDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ deinit();
+ reset();
+ mSupportedImageQualities.clear();
+ delete mImageDataQueue;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Return the current state.
+ */
+CxeStillCaptureControl::State CxeStillCaptureControlDesktop::state() const
+{
+ return mState;
+}
+
+/**
+ * Initialize the control states.
+ */
+void CxeStillCaptureControlDesktop::initializeStates()
+{
+
+ // addState( id, name, allowed next states )
+}
+
+/**
+ * Initialize the still image capture control.
+ */
+void CxeStillCaptureControlDesktop::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == Uninitialized) {
+ CxeImageDetails dummyDetails;
+ dummyDetails.mAspectRatio = Cxe::AspectRatio4to3;
+ dummyDetails.mEstimatedSize = 10000;
+ dummyDetails.mHeight = 360;
+ dummyDetails.mWidth = 640;
+ mSupportedImageQualities.append(dummyDetails);
+ prepare();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Un-initialize the image mode.
+ */
+void CxeStillCaptureControlDesktop::deinit()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == Uninitialized) {
+ // nothing to do
+ CX_DEBUG_EXIT_FUNCTION();
+ return;
+ }
+ mState = Uninitialized;
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+ * Prepare still capture mode.
+ */
+void CxeStillCaptureControlDesktop::prepare()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() != Uninitialized) {
+ // wrong state and we return
+ return;
+ }
+
+ int err = 0;
+ CxeError::Id cxErr = getImageQualityDetails(mCurrentImageDetails);
+ int ecamStillResolutionIndex = 0;
+
+ if (cxErr == CxeError::None) {
+ int imageWidth = mCurrentImageDetails.mWidth;
+ int imageHeight = mCurrentImageDetails.mHeight;
+ CX_DEBUG(("CxeStillCaptureControlSymbian::prepare <> resolution = (%d, %d)", imageWidth, imageHeight));
+
+ if (ecamStillResolutionIndex < 0) {
+ CX_DEBUG(("CxeStillCaptureControlSymbian::prepare - WARNING! resolution not supported, falling back to index 0"));
+ ecamStillResolutionIndex = 0;
+ }
+
+ CX_DEBUG(("PrepareImageCaptureL done, err=%d, resolution index = %d", err, ecamStillResolutionIndex));
+
+ if (!err) {
+ // still capture prepare went fine, try preparing snapshot
+ err = prepareStillSnapshot();
+ }
+ } else {
+ err = 0;
+ }
+
+ if (!err) {
+ // If viewfinder is already running, this call does nothing
+ mViewfinderControl.start();
+ // inform zoom control to prepare zoom
+ emit prepareZoomForStill(ecamStillResolutionIndex);
+ } else {
+ CX_DEBUG(("Image Prepare FAILED! symbian error = %d", err));
+ }
+ mState = Ready;
+ emit imagePrepareComplete(CxeError::None);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+ Prepare still snapshot
+ Returns symbian error code.
+ */
+int CxeStillCaptureControlDesktop::prepareStillSnapshot()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ handleSnapshotEvent(CxeError::None);
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return 0;
+}
+
+
+/*!
+ imageInfo contains image qualities details
+ Returns CxeError error code.
+ */
+CxeError::Id CxeStillCaptureControlDesktop::getImageQualityDetails(CxeImageDetails &imageInfo)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ int imageQuality = 0;
+ CxeError::Id err = CxeError::None;
+ if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex) {
+ bool validQuality = (imageQuality >= 0 && imageQuality < mSupportedImageQualities.count());
+
+ if (err == CxeError::None && validQuality ) {
+ // get image quality details
+ imageInfo = mSupportedImageQualities.at(imageQuality);
+ } else {
+ err = CxeError::NotFound;
+ CX_DEBUG(("Invalid ImageQuality = %d", imageQuality));
+ }
+ } else {
+ // we are in secondary camera
+ // get secondary camera image quality details
+ imageInfo = mSupportedImageQualities.at(imageQuality);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return err;
+}
+
+
+/**
+ * Command to start image capture now.
+ */
+void CxeStillCaptureControlDesktop::capture()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ //! @todo: NOTE: This call may not stay here. It can move depending on the implementation for burst capture.
+ if (mMode == BurstCapture) {
+ // Start a new filename sequence
+ mFilenameGenerator.startNewImageFilenameSequence();
+ }
+ emit imageCaptured(CxeError::None, 0);
+ handleSnapshotEvent(CxeError::None);
+ 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 CxeStillCaptureControlDesktop::handleSnapshotEvent(CxeError::Id error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == CxeStillCaptureControl::Uninitialized) {
+ // we ignore this event, when we are not active
+ return;
+ }
+
+ if (error) {
+ emit snapshotReady(error, QImage(), 0);
+ }
+
+ // Get image container for current snapshot index.
+ // Remember to increment counter.
+ CxeStillImageDesktop* stillImage = getImageForIndex(mNextSnapshotIndex++);
+
+ // 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);
+ }
+
+ CxeImageDataItem* dataItem = new CxeImageDataItemDesktop(mNextImageDataIndex++, stillImage->snapshot(), stillImage->filename(), stillImage->id());
+
+ stillImage->setDataItem(dataItem);
+
+ mSaveThread.save(dataItem);
+
+ emit snapshotReady(CxeError::None, QImage(), stillImage->id());
+ emit imageCaptured(CxeError::None, stillImage->id());
+
+ mState = Ready;
+ emit stateChanged(mState, CxeError::None);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/**
+ * Settings changed, needs updated
+ */
+void CxeStillCaptureControlDesktop::handleSettingValueChanged(const QString& settingId,QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (settingId == CxeSettingIds::FLASH_MODE) {
+ updateFlashSetting(newValue);
+ } else if (settingId == CxeSettingIds::LIGHT_SENSITIVITY) {
+ updateISOSetting(newValue);
+ } else if (settingId == CxeSettingIds::EV_COMPENSATION_VALUE) {
+ updateEVCompensationSetting(newValue);
+ } else if (settingId == CxeSettingIds::IMAGE_QUALITY) {
+ // re-prepare for still
+ deinit();
+ init();
+ } else {
+ // do nothing
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Image Scene mode changed, needs updated
+ */
+void CxeStillCaptureControlDesktop::handleSceneChanged(CxeScene& scene)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex){
+ CX_DEBUG_ASSERT(scene.count() != 0);
+ // we are interested only in the following settings in this class scope
+
+ if(scene.contains(CxeSettingIds::FLASH_MODE)) {
+ CX_DEBUG(("CxeStillCaptureControlSymbian::handleSceneChanged scene->mFlashMode = %d", scene[CxeSettingIds::FLASH_MODE].toInt()));
+ updateFlashSetting(scene[CxeSettingIds::FLASH_MODE]);
+ }
+
+ if(scene.contains(CxeSettingIds::LIGHT_SENSITIVITY)) {
+ updateISOSetting(scene[CxeSettingIds::LIGHT_SENSITIVITY]);
+ }
+
+ if(scene.contains(CxeSettingIds::EV_COMPENSATION_VALUE)) {
+ updateEVCompensationSetting(scene[CxeSettingIds::EV_COMPENSATION_VALUE]);
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * UpdateFlashSetting
+ */
+void CxeStillCaptureControlDesktop::updateFlashSetting(QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(newValue);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * UpdateISOSetting
+ */
+void CxeStillCaptureControlDesktop::updateISOSetting(QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(newValue);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * UpdateEVCompensationSetting
+ */
+void CxeStillCaptureControlDesktop::updateEVCompensationSetting(QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(newValue);
+
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/**
+ * ECam reference changing, release resources
+ */
+void CxeStillCaptureControlDesktop::prepareForCameraDelete()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ deinit();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Camera being released. Cancel ongoing capture, if any.
+ */
+void CxeStillCaptureControlDesktop::prepareForRelease()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ deinit();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * New camera available,
+ */
+void CxeStillCaptureControlDesktop::handleCameraAllocated(CxeError::Id error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (error == CxeError::None) {
+ // load all still resoultions supported by ecam
+ // load all still qualities supported by icm
+ mSupportedImageQualities.clear();
+ // get list of supported image qualities based on camera index
+
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Return number of images captured (during current capture operation only).
+ */
+int CxeStillCaptureControlDesktop::imageCount() const
+{
+ return mImages.count();
+}
+
+/**
+ * Reset the image array.
+ */
+void CxeStillCaptureControlDesktop::reset()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qDeleteAll(mImages);
+ mImages.clear();
+
+ mNextSnapshotIndex = 0;
+ mNextImageDataIndex = 0;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * This should cancel any ongoing image captures.
+ */
+void CxeStillCaptureControlDesktop::cancelAll()
+{
+ mImageDataQueue->clear();
+ reset();
+}
+
+/**
+ * Sets the current capture mode: SingleImageCapture / BurstCapture.
+ */
+void CxeStillCaptureControlDesktop::setMode(CaptureMode mode)
+{
+ mMode = mode;
+}
+
+/**
+ * Returns the current capture mode.
+ */
+CxeStillCaptureControl::CaptureMode CxeStillCaptureControlDesktop::mode() const
+{
+ return mMode;
+}
+
+/**
+ * Operator [] - returns the indexed image from capture array.
+ */
+CxeStillImage &CxeStillCaptureControlDesktop::operator[](int index)
+{
+ return *mImages[ index ];
+}
+
+/**
+ * Getter for image data queue.
+ */
+CxeImageDataQueue &CxeStillCaptureControlDesktop::imageDataQueue()
+{
+ 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.
+ */
+CxeError::Id CxeStillCaptureControlDesktop::prepareFilename(CxeStillImageDesktop *stillImage)
+{
+ CxeError::Id err = CxeError::None;
+ if (stillImage->filename().isEmpty()) {
+ QString path;
+
+ QString fileExt = mCurrentImageDetails.mImageFileExtension;
+
+ if (mMode == SingleImageCapture) {
+ err = mFilenameGenerator.generateFilename(path, fileExt);
+ }
+ else {
+ err = mFilenameGenerator.nextImageFilenameInSequence(path, fileExt);
+ }
+
+ if (!err) {
+ CX_DEBUG(( "Next image file path: %s", path.toAscii().constData() ));
+ stillImage->setFilename(path);
+ }
+ else {
+ //! @todo: Error ID can be returned by this function.
+ // Also error can be detected from empty filename string.
+ CX_DEBUG(("ERROR in filename generation. err:%d", err));
+ }
+ }
+ return err;
+}
+
+/*!
+* Helper method to set orientation data from the orientation sensor
+*/
+void CxeStillCaptureControlDesktop::setOrientation(QVariant sensorData)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(sensorData);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/**
+ * Get the image container at given index or create a new one if needed.
+ */
+CxeStillImageDesktop* CxeStillCaptureControlDesktop::getImageForIndex(int index)
+{
+ CxeStillImageDesktop* image(NULL);
+
+ if (mImages.count() <= index) {
+ image = new CxeStillImageDesktop();
+ image->setSnapshot(mCameraDevice.currentSnaphot());
+ mImages.append(image);
+ } else {
+ CX_DEBUG_ASSERT( mNextImageDataIndex >= 0 && index < mImages.count() );
+ image = mImages[index];
+ }
+ return image;
+}
+
+
+/*!
+* Slot to handle Autofocus events.
+*/
+void CxeStillCaptureControlDesktop::handleAutofocusStateChanged(
+ CxeAutoFocusControl::State newState,
+ CxeError::Id /*error*/ )
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mAfState = newState;
+ CxeAutoFocusControl::Mode mode = mAutoFocusControl.mode();
+
+ // if focused and in correct mode, play sound
+ if (newState == CxeAutoFocusControl::Ready &&
+ mode != CxeAutoFocusControl::Hyperfocal &&
+ mode != CxeAutoFocusControl::Infinity) {
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Returns supported image qualities based on the camera index
+* (primary/secondary).
+*/
+QList<CxeImageDetails> CxeStillCaptureControlDesktop::supportedImageQualities()
+{
+ return QList<CxeImageDetails>();
+}
+
+/*!
+* Returns the number of images left for the current image quality setting
+*/
+int CxeStillCaptureControlDesktop::imagesLeft()
+{
+ return 100; // Stub: Dummy value
+}
+
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -22,6 +22,7 @@
#include <coemain.h>
#include <ECamOrientationCustomInterface2.h>
#include <ecamfacetrackingcustomapi.h>
+#include <ecamusecasehintcustomapi.h>
#include "cxestillcapturecontrolsymbian.h"
#include "cxeimagedataqueuesymbian.h"
@@ -43,6 +44,7 @@
#include "cxesensoreventhandler.h"
#include "cxequalitypresetssymbian.h"
#include "cxediskmonitor.h"
+#include "cxeexception.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
@@ -209,7 +211,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();
@@ -229,7 +231,7 @@
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();
}
@@ -246,57 +248,33 @@
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);
- int ecamStillResolutionIndex = 0;
-
- if (cxErr == CxeError::None) {
- int imageWidth = mCurrentImageDetails.mWidth;
- int imageHeight = mCurrentImageDetails.mHeight;
- CX_DEBUG(("CxeStillCaptureControlSymbian::prepare <> resolution = (%d, %d)", imageWidth, imageHeight));
+ CxeError::Id status(CxeError::None);
- TSize imageSize;
- imageSize.SetSize(imageWidth, imageHeight);
-
- if (mECamSupportedImageResolutions.count() > 0) {
- ecamStillResolutionIndex = mECamSupportedImageResolutions.indexOf(imageSize);
- }
-
- if (ecamStillResolutionIndex < 0) {
- CX_DEBUG(("CxeStillCaptureControlSymbian::prepare - WARNING! resolution not supported, falling back to index 0"));
- ecamStillResolutionIndex = 0;
- }
+ try {
+ // Update capture parameters
+ updateStillCaptureParameters();
// Prepare Image capture
- CCamera::TFormat imgFormat = supportedStillFormat(mCameraDeviceControl.cameraIndex());
- OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_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");
-
- CX_DEBUG(("PrepareImageCaptureL done, err=%d, resolution index = %d", err, ecamStillResolutionIndex));
+ CX_DEBUG(("Calling PrepareImageCaptureL, resolution index = %d", mSizeIndex));
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1");
+ QT_TRAP_THROWING(mCameraDevice.camera()->PrepareImageCaptureL(mCaptureFormat, mSizeIndex));
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0");
- if (!err) {
- // still capture prepare went fine, try preparing snapshot
- err = prepareStillSnapshot();
- }
- } else {
- err = KErrNotFound;
- }
-
- if (!err) {
// Start viewfinder before claiming to be ready,
// as e.g. pending capture might be started by state change,
// and viewfinder start might have problems with just started capturing.
// If viewfinder is already running, this call does nothing.
mViewfinderControl.start();
+ // Prepare snapshot
+ prepareSnapshot();
+
// Start monitoring disk space.
mDiskMonitor.start();
connect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged()));
-
// Enable AF reticule drawing by adaptation
MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking();
if (faceTracking) {
@@ -308,18 +286,20 @@
setState(Ready);
// inform zoom control to prepare zoom
- emit prepareZoomForStill(ecamStillResolutionIndex);
- } else {
- CX_DEBUG(("Image Prepare FAILED! symbian error = %d", err));
- // release resources
+ emit prepareZoomForStill(mSizeIndex);
+
+ } catch (const std::exception &e) {
+ // Exception encountered, free resources.
+ CX_DEBUG(("Image Prepare FAILED! symbian error = %d", qt_symbian_exception2Error(e)));
+ status = CxeErrorHandlingSymbian::map(qt_symbian_exception2Error(e));
deinit();
}
// Inform interested parties that image mode has been prepared for capture
- emit imagePrepareComplete(CxeErrorHandlingSymbian::map(err));
+ emit imagePrepareComplete(status);
- 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();
}
@@ -327,59 +307,81 @@
/*!
Prepare still snapshot
- Returns symbian error code.
+ Throws exception on error.
*/
-int CxeStillCaptureControlSymbian::prepareStillSnapshot()
+void CxeStillCaptureControlSymbian::prepareSnapshot()
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, DUP4_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 1" );
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_1, "msg: e_CX_PREPARE_SNAPSHOT 1" );
- int status(KErrNone);
- try {
- QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
- mViewfinderControl.deviceDisplayResolution(),
- mCurrentImageDetails.mAspectRatio);
- mSnapshotControl.start(snapshotSize);
- } catch (...) {
- status = KErrGeneral;
- }
- OstTrace0( camerax_performance, DUP5_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 0" );
+ QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
+ mViewfinderControl.deviceDisplayResolution(),
+ mCurrentImageDetails.mAspectRatio);
+ mSnapshotControl.start(snapshotSize);
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_2, "msg: e_CX_PREPARE_SNAPSHOT 0" );
CX_DEBUG_EXIT_FUNCTION();
- return status;
}
/*!
- imageInfo contains image qualities details
- Returns CxeError error code.
- */
-CxeError::Id CxeStillCaptureControlSymbian::getImageQualityDetails(CxeImageDetails &imageInfo)
+ Update image capture parameters. mCurrentImageDetails, mCaptureFormat and
+ mSizeIndex are updated based on the current settings.
+*/
+void CxeStillCaptureControlSymbian::updateStillCaptureParameters()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_UPDATESTILLCAPTUREPARAMETERS_1, "msg: e_CX_UPDATE_STILL_CAPTURE_PARAMETERS 1" );
int imageQuality = 0;
CxeError::Id err = CxeError::None;
if (mCameraDeviceControl.cameraIndex() == Cxe::PrimaryCameraIndex) {
- err = mSettings.get(CxeSettingIds::IMAGE_QUALITY, imageQuality);
+ try {
+ imageQuality = mSettings.get<int>(CxeSettingIds::IMAGE_QUALITY);
- bool validQuality = (imageQuality >= 0 && imageQuality < mIcmSupportedImageResolutions.count());
+ bool validQuality = (imageQuality >= 0 &&
+ imageQuality < mIcmSupportedImageResolutions.count());
- if (err == CxeError::None && validQuality ) {
- // get image quality details
- imageInfo = mIcmSupportedImageResolutions.at(imageQuality);
- } else {
- err = CxeError::NotFound;
- CX_DEBUG(("Invalid ImageQuality = %d", imageQuality));
+ if (validQuality ) {
+ // get image quality details
+ mCurrentImageDetails = mIcmSupportedImageResolutions.at(imageQuality);
+ } else {
+ err = CxeError::NotFound;
+ CX_DEBUG(("Invalid ImageQuality = %d", imageQuality));
+ }
+ } catch (CxeException &e) {
+ err = (CxeError::Id) e.error();
}
} else {
// we are in secondary camera
// get secondary camera image quality details
- imageInfo = mIcmSupportedImageResolutions.at(imageQuality);
+ mCurrentImageDetails = mIcmSupportedImageResolutions.at(imageQuality);
}
+ mSizeIndex = 0;
+
+ if (err == CxeError::None) {
+ int imageWidth = mCurrentImageDetails.mWidth;
+ int imageHeight = mCurrentImageDetails.mHeight;
+ CX_DEBUG(("CxeStillCaptureControlSymbian::updateStillCaptureParameters <> resolution = (%d, %d)", imageWidth, imageHeight));
+
+ TSize imageSize;
+ imageSize.SetSize(imageWidth, imageHeight);
+
+ if (mECamSupportedImageResolutions.count() > 0) {
+ mSizeIndex = mECamSupportedImageResolutions.indexOf(imageSize);
+ }
+
+ if (mSizeIndex < 0) {
+ CX_DEBUG(("CxeStillCaptureControlSymbian::updateStillCaptureParameters - WARNING! resolution not supported, falling back to index 0"));
+ mSizeIndex = 0;
+ }
+
+ mCaptureFormat = supportedStillFormat(mCameraDeviceControl.cameraIndex());
+ }
+
+ OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_UPDATESTILLCAPTUREPARAMETERS_2, "msg: e_CX_UPDATE_STILL_CAPTURE_PARAMETERS 0" );
CX_DEBUG_EXIT_FUNCTION();
- return err;
}
/*!
@@ -452,7 +454,7 @@
CX_DEBUG_ENTER_FUNCTION();
if (mCameraDeviceControl.mode() == Cxe::ImageMode) {
- OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 1" );
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_1, "msg: e_CX_HANDLE_SNAPSHOT 1");
QPixmap ss = QPixmap::fromImage(snapshot);
// Get image container for current snapshot index.
@@ -471,7 +473,7 @@
prepareFilename(stillImage);
}
- OstTrace0( camerax_performance, DUP1_CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 0" );
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0");
}
CX_DEBUG_EXIT_FUNCTION();
@@ -544,8 +546,8 @@
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);
+ Cxe::GeoTagging value = mSettings.get<Cxe::GeoTagging>(CxeSettingIds::GEOTAGGING, Cxe::GeoTaggingOff);
+
// Save the image data
CxeImageDataItemSymbian* dataItem = mImageDataQueue->startSave(byteArray,
@@ -744,6 +746,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;
@@ -767,6 +771,8 @@
CX_DEBUG(("ERROR in filename generation. err:%d", err));
}
}
+
+ OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_2, "msg: e_CX_PREPARE_FILENAME 0" );
return err;
}
@@ -861,6 +867,28 @@
/*!
+ Use ECam Use Case Hint Custom API to inform ECam of our intended use case
+ before calling Reserve().
+*/
+void CxeStillCaptureControlSymbian::hintUseCase()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Make sure ECam knows we're doing still image capture so it can prepare
+ // for the correct use case.
+ if (mCameraDeviceControl.mode() == Cxe::ImageMode) {
+ MCameraUseCaseHint *useCaseHintApi = mCameraDevice.useCaseHintApi();
+ if (useCaseHintApi) {
+ updateStillCaptureParameters();
+ TRAP_IGNORE(useCaseHintApi->HintStillCaptureL(mCaptureFormat,
+ mSizeIndex));
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
* Returns supported image qualities based on the camera index
* (primary/secondary).
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxestillimagedesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 "cxestillimagedesktop.h"
+#include "cxutils.h"
+
+int CxeStillImageDesktop::mNextId = CxeStillImage::INVALID_ID + 1;
+
+CxeStillImageDesktop::CxeStillImageDesktop()
+ : mSnapshot(),
+ mDataItem(NULL),
+ mSaved(false),
+ mId(++mNextId)
+{
+}
+
+CxeStillImageDesktop::~CxeStillImageDesktop()
+{
+ mDataItem = NULL;
+}
+
+CxeImageDataItem *CxeStillImageDesktop::dataItem()
+{
+ return mDataItem;
+}
+
+QString CxeStillImageDesktop::filename() const
+{
+ return mFilename;
+}
+
+QPixmap CxeStillImageDesktop::snapshot() const
+{
+ return mSnapshot;
+}
+
+bool CxeStillImageDesktop::saved() const
+{
+ return mSaved;
+}
+
+int CxeStillImageDesktop::id() const
+{
+ return mId;
+}
+
+void CxeStillImageDesktop::setSnapshot(QPixmap pixmap)
+ {
+ mSnapshot = pixmap;
+ }
+
+void CxeStillImageDesktop::setFilename(const QString &filename)
+ {
+ mFilename = filename;
+ }
+void CxeStillImageDesktop::setSaved(bool saved)
+ {
+ mSaved = saved;
+ }
+
+void CxeStillImageDesktop::setDataItem(CxeImageDataItem *dataItem)
+ {
+ mDataItem = dataItem;
+ }
--- a/camerauis/cameraxui/cxengine/src/cxestillimagesymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestillimagesymbian.cpp Wed Aug 18 09:37:18 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"
@@ -15,11 +15,19 @@
*
*/
+#include <QString>
+#include <QPixmap>
+
+#include "cxeimagedataitem.h"
#include "cxestillimagesymbian.h"
#include "cxutils.h"
+// Static initialization
int CxeStillImageSymbian::mNextId = CxeStillImage::INVALID_ID + 1;
+/*!
+* Constructor.
+*/
CxeStillImageSymbian::CxeStillImageSymbian()
: mSnapshot(),
mDataItem(NULL),
@@ -28,53 +36,115 @@
{
}
+/*!
+* Destructor.
+*/
CxeStillImageSymbian::~CxeStillImageSymbian()
{
// Not owned.
mDataItem = NULL;
}
-CxeImageDataItem* CxeStillImageSymbian::dataItem()
+/*!
+* Get the contained data item.
+* @return Image data item.
+*/
+CxeImageDataItem *CxeStillImageSymbian::dataItem()
{
return mDataItem;
}
+/*!
+* Get the filename of this image.
+* @return The filename.
+*/
QString CxeStillImageSymbian::filename() const
{
return mFilename;
}
+/*!
+* Get snapshot for this image.
+* @return Snapshot for this image if set. Null pixmap otherwise.
+*/
QPixmap CxeStillImageSymbian::snapshot() const
{
return mSnapshot;
}
+/*!
+* Image saved status.
+* @return Is this image saved.
+*/
bool CxeStillImageSymbian::saved() const
{
return mSaved;
}
+/*!
+* Set the unique id of this image.
+* Usable in one application run context.
+*/
int CxeStillImageSymbian::id() const
{
return mId;
}
-void CxeStillImageSymbian::setSnapshot( QPixmap pixmap )
+/*!
+* Set snapshot for this image.
+* @param pixmap The snapshot.
+*/
+void CxeStillImageSymbian::setSnapshot(QPixmap pixmap)
{
mSnapshot = pixmap;
}
-void CxeStillImageSymbian::setFilename( const QString& filename )
+/*!
+* Set the filename of this image.
+* @param filename The filename.
+*/
+void CxeStillImageSymbian::setFilename(const QString &filename)
{
mFilename = filename;
}
-void CxeStillImageSymbian::setSaved( bool saved )
+/*!
+* Set this image as saved.
+* @param saved Is this item saved or not.
+*/
+void CxeStillImageSymbian::setSaved(bool saved)
{
mSaved = saved;
}
-void CxeStillImageSymbian::setDataItem( CxeImageDataItem* dataItem )
+/*!
+* Set the contained image data item.
+* @param dataItem Image data item to store. Ownership not taken.
+*/
+void CxeStillImageSymbian::setDataItem(CxeImageDataItem *dataItem)
{
+ // Disconnect from old data item if it exists.
+ if (mDataItem) {
+ disconnect(mDataItem, 0, this, 0);
+ }
+
+ // Set the new item.
mDataItem = dataItem;
+
+ // Connnect to the new item's saved signal.
+ if (mDataItem) {
+ bool ok = connect(mDataItem, SIGNAL(imageSaved(CxeError::Id, const QString&, int)),
+ this, SLOT(imageDataSaved(CxeError::Id)), Qt::UniqueConnection);
+ CX_ASSERT_ALWAYS(ok);
+ }
}
+
+/*!
+* Slot to handle saving the data item has finished.
+*/
+void CxeStillImageSymbian::imageDataSaved(CxeError::Id status)
+{
+ setSaved(status == CxeError::None);
+}
+
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxesysutil.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesysutil.cpp Wed Aug 18 09:37:18 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"
@@ -77,17 +77,17 @@
* is not enough free memory to create a temporary connection to
* file server.
*/
-TBool CxeSysUtil::DiskSpaceBelowCriticalLevel(
+bool CxeSysUtil::DiskSpaceBelowCriticalLevel(
RFs* aFs,
TInt aBytesToWrite,
TInt aDrive )
{
- TBool fullDisk = EFalse;
+ bool fullDisk = false;
TRAPD( utilErr,
fullDisk = SysUtil::DiskSpaceBelowCriticalLevelL(
aFs, aBytesToWrite, aDrive ) );
if(utilErr) {
- fullDisk = EFalse;
+ fullDisk = false;
}
return fullDisk;
}
--- a/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Wed Aug 18 09:37:18 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"
@@ -117,6 +117,7 @@
CX_DEBUG_ENTER_FUNCTION();
+ Q_UNUSED(thumbnail);
Q_UNUSED(data);
CX_DEBUG(("CxeThumbnailManagerSymbian::thumbnailReady error = %d", error));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontroldesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,550 @@
+/*
+* 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 <QTime>
+#include <QPixmap>
+
+#include "cxevideocapturecontroldesktop.h"
+#include "cxeviewfindercontrol.h"
+#include "cxutils.h"
+#include "cxestate.h"
+#include "cxenamespace.h"
+#include "cxefilenamegeneratordesktop.h"
+#include "cxecameradevicedesktop.h"
+#include "cxeexception.h"
+
+namespace
+{
+ // Unit is milliseconds
+ static const int CXENGINE_ELAPSED_TIME_TIMEOUT = 1000; // 1 second
+
+ // Unit is seconds
+ static const int CXENGINE_MAXIMUM_VIDEO_TIME = 90*60; // 90 minutes
+}
+
+
+/*!
+* Constructor
+*/
+CxeVideoCaptureControlDesktop::CxeVideoCaptureControlDesktop(CxeCameraDeviceDesktop &cameraDevice,
+ CxeViewfinderControl &viewfinderControl,
+ CxeCameraDeviceControl &cameraDeviceControl,
+ CxeFilenameGenerator &nameGenerator,
+ CxeQualityPresets &qualityPresets) :
+ mCameraDevice(cameraDevice),
+ mCameraDeviceControl(cameraDeviceControl),
+ mViewfinderControl(viewfinderControl),
+ mFilenameGenerator(nameGenerator),
+ mQualityPresets(qualityPresets),
+ mSnapshot(),
+ mNewFileName(""),
+ mCurrentFilename(""),
+ mState(Idle),
+ mElapsedTime(0)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qRegisterMetaType<CxeVideoCaptureControl::State> ();
+ initializeStates();
+ setupElapseTimer();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Destructor
+*/
+CxeVideoCaptureControlDesktop::~CxeVideoCaptureControlDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ releaseResources();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Initializes resources for video recording.
+*/
+void CxeVideoCaptureControlDesktop::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == Idle) {
+ // start initializing resources for video capture
+ initVideoRecorder();
+ } else if (state() == Initialized) {
+ // video recorder already initalized. Continue to prepare video reocording.
+ open();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Releases all resources
+*/
+void CxeVideoCaptureControlDesktop::deinit()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == Idle) {
+ // nothing to do
+ CX_DEBUG_EXIT_FUNCTION();
+ return;
+ }
+ // stop video-recording in-case if its ongoing.
+ stop();
+
+ setState(Idle);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Intializes VideoRecorder for recording.
+*/
+void CxeVideoCaptureControlDesktop::initVideoRecorder()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() != Idle) {
+ // not valid state to start "open" operation
+ CX_DEBUG_EXIT_FUNCTION();
+ return;
+ }
+
+ // update current video quality details from icm
+ CxeError::Id err = CxeError::None;
+
+ setState(Initialized);
+ open();
+
+ if (err) {
+ // In case of error
+ emit videoPrepareComplete(err);
+ deinit();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Setup the timer for elapsed time
+*/
+void CxeVideoCaptureControlDesktop::setupElapseTimer()
+{
+ mRecordElapseTimer.setSingleShot(false);
+ mRecordElapseTimer.setInterval(CXENGINE_ELAPSED_TIME_TIMEOUT);
+ connect(&mRecordElapseTimer, SIGNAL(timeout()), this, SLOT(handleElapseTimeout()));
+}
+
+
+/*!
+* Opens file for video recording.
+*/
+void CxeVideoCaptureControlDesktop::open()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() != Initialized) {
+ // not valid state to start "open" operation
+ CX_DEBUG_EXIT_FUNCTION();
+ return;
+ }
+
+ CxeError::Id err = CxeError::None;
+
+ // generate video file name, if necessary
+ if (mNewFileName.isEmpty()) {
+ QString fileExt = ".mp4";
+
+ // 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("");
+ }
+ }
+
+ if (err) {
+ // error occured.
+ deinit();
+ emit videoPrepareComplete(err);
+ } else {
+ setState(Preparing);
+ prepare();
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Prepare Video Recorder with necessary settings for video capture.
+*/
+void CxeVideoCaptureControlDesktop::prepare()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() != Preparing) {
+ // not valid state to continue prepare.
+ CX_DEBUG_EXIT_FUNCTION();
+ return;
+ }
+
+ int err = CxeError::None;
+
+ if (!err) {
+ // prepare snapshot
+ err = prepareVideoSnapshot();
+ }
+
+ if (!err) {
+ // prepare zoom only when there are no errors during prepare.
+ emit prepareZoomForVideo();
+ }
+
+ mViewfinderControl.start();
+ setState(Ready);
+
+ // emit video prepare status
+ emit videoPrepareComplete(CxeError::None);
+
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ Prepare snapshot
+@Return symbian error code.
+ */
+int CxeVideoCaptureControlDesktop::prepareVideoSnapshot()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+
+ int err = 0;
+ // Whether or not we have postcapture on, we need the snapshot for Thumbnail Manager.
+
+ mSnapshot = mCameraDevice.currentSnaphot();
+ handleSnapshotEvent(CxeError::None);
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
+}
+
+/*!
+* Camera events coming from ecam.
+*/
+void CxeVideoCaptureControlDesktop::handleCameraEvent(int eventUid, int error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(eventUid);
+ Q_UNUSED(error);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Handle Snapshot event from ecam
+*/
+void CxeVideoCaptureControlDesktop::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;
+ }
+ emit snapshotReady(error, QImage(), filename());
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Resets the video snapshot and current video filename
+*/
+void CxeVideoCaptureControlDesktop::reset()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Snapshot will consume considerably memory.
+ // Replace it with null pixmap to have it freed.
+ mSnapshot = QPixmap();
+ // reset the current file name.
+ mCurrentFilename = QString("");
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+*@Return current video filename
+*/
+QString CxeVideoCaptureControlDesktop::filename() const
+{
+ // Simply return the current contents of mCurrentFilename.
+ // If video recording was started then it returns proper filename
+ // otherwise an empty string is returned.
+ return mCurrentFilename;
+}
+
+
+/*!
+* @Return current video snapshot
+*/
+QPixmap CxeVideoCaptureControlDesktop::snapshot() const
+{
+ return mSnapshot;
+}
+
+/*!
+* @Return QList of all supported video quality details based on the camera index
+* (primary/secondary).
+*/
+QList<CxeVideoDetails> CxeVideoCaptureControlDesktop::supportedVideoQualities()
+{
+ return QList<CxeVideoDetails>();
+}
+
+/*!
+* Starts video recording if we are in appropriate state.
+*/
+void CxeVideoCaptureControlDesktop::record()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == Ready || state() == Paused) {
+ //we skip the playing of the sound in the desktop state for now
+ setState(Recording);
+ mRecordElapseTimer.start();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Pauses video recording.
+*/
+void CxeVideoCaptureControlDesktop::pause()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mRecordElapseTimer.stop();
+
+ setState(Paused);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Stops video recording.
+*/
+void CxeVideoCaptureControlDesktop::stop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (state() == Recording || state() == Paused) {
+ mFilenameGenerator.raiseCounterValue();
+ }
+
+ mViewfinderControl.stop();
+ mRecordElapseTimer.stop();
+ mElapsedTime = 0;
+
+ setState(Stopping);
+ setState(Initialized);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* camera reference changing, release resources
+*/
+void CxeVideoCaptureControlDesktop::prepareForCameraDelete()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ releaseResources();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* prepare for camera release.
+*/
+void CxeVideoCaptureControlDesktop::prepareForRelease()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ deinit();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* new camera available,
+*/
+void CxeVideoCaptureControlDesktop::handleCameraAllocated(CxeError::Id error)
+{
+ Q_UNUSED(error);
+ CX_DEBUG_IN_FUNCTION();
+}
+
+
+/*!
+* Initializes video recorder.
+*/
+void CxeVideoCaptureControlDesktop::createVideoRecorder()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+
+/*!
+* releases resources used by videocapture
+*/
+void CxeVideoCaptureControlDesktop::releaseResources()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // first de-init videocapture control
+ deinit();
+ reset();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+@Returns current state of videocapture
+*/
+CxeVideoCaptureControl::State CxeVideoCaptureControlDesktop::state() const
+{
+ return mState;
+}
+
+/*!
+* Initialize states for videocapturecontrol
+*/
+void CxeVideoCaptureControlDesktop::initializeStates()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
+* calculates remaining video recording time.
+*/
+void CxeVideoCaptureControlDesktop::remainingTime(int &time)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ time = CXENGINE_MAXIMUM_VIDEO_TIME - mElapsedTime;
+ if (time < 0) {
+ time = 0;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Calculates elapsed recording time during video recording
+* @return Did fetching elapsed time succeed.
+*/
+bool CxeVideoCaptureControlDesktop::elapsedTime(int &time)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ time = mElapsedTime;
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return true;
+}
+
+/*!
+* slot called when playing a sound has finished.
+*/
+void CxeVideoCaptureControlDesktop::handleSoundPlayed()
+{
+ // in case of video capture stop sound playing, nothing needs to be done
+ // meaning the state set elsewhere, and the video capture has been stopped already
+
+ CX_DEBUG_IN_FUNCTION();
+}
+
+
+/*!
+* setting has changed, check if we are interested.
+*/
+void CxeVideoCaptureControlDesktop::handleSettingValueChanged(const QString& settingId,
+ QVariant newValue)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(newValue);
+
+ if (settingId == CxeSettingIds::VIDEO_QUALITY) {
+ // re-prepare for video
+ deinit();
+ init();
+ } else if (settingId == CxeSettingIds::VIDEO_MUTE_SETTING) {
+ // mute setting changed, apply the new setting and re-prepare.
+ prepare();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Video Scene mode changed, needs updated
+*/
+void CxeVideoCaptureControlDesktop::handleSceneChanged(CxeScene &scene)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ Q_UNUSED(scene);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+void CxeVideoCaptureControlDesktop::handleElapseTimeout()
+{
+ mElapsedTime++;
+
+ CX_DEBUG( ("CxeVideoCaptureControlDesktop::handleElapseTimeout() <> mElapsedTime: %d", mElapsedTime ) );
+}
+
+void CxeVideoCaptureControlDesktop::setState(CxeVideoCaptureControl::State stateId, CxeError::Id error)
+{
+ mState = stateId;
+ CX_DEBUG( ("CxeVideoCaptureControlDesktop::setState <> mState: %d", mState ) );
+ emit stateChanged(mState, error);
+}
+// End of file
--- a/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -40,6 +40,7 @@
#include "cxequalitypresetssymbian.h"
#include "cxeviewfindercontrolsymbian.h"
#include "cxediskmonitor.h"
+#include "cxesettingsmappersymbian.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
@@ -123,8 +124,9 @@
// 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&)));
+
+ mSettings.listenForSetting(CxeSettingIds::VIDEO_SCENE, this, SLOT(handleSceneChanged(const QVariant&)));
+
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");
@@ -214,12 +216,12 @@
// Init needed only in Idle state
if (state() == Idle) {
try {
- // if video recorder is not created, do it now.
+ // If video recorder is not yet created, do it now.
createVideoRecorder();
- // update current video quality details from icm.
+ // Update current video quality details from ICM.
// Throws an error if unable to get the quality.
- getVideoQualityDetails(mCurrentVideoDetails);
+ updateVideoCaptureParameters();
// Video recorder is ready to open video file for recording.
setState(Initialized);
@@ -299,16 +301,14 @@
return;
}
- OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 1");
+ 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);
+ bool muteSetting = mSettings.get<bool>(CxeSettingIds::VIDEO_MUTE_SETTING, false);
// Check if scene defines frame rate.
// Use generic frame rate defined in video details, if no value is set in scene.
- int frameRate = 0;
- mSettings.get(CxeSettingIds::FRAME_RATE, frameRate);
+ int frameRate = mSettings.get<int>(CxeSettingIds::FRAME_RATE, 0);
if (frameRate <= 0) {
frameRate = mCurrentVideoDetails.mVideoFrameRate;
}
@@ -322,19 +322,13 @@
mVideoRecorder->setVideoFrameSize(frameSize);
mVideoRecorder->setVideoFrameRate(frameRate);
mVideoRecorder->setVideoBitRate(mCurrentVideoDetails.mVideoBitRate);
- mVideoRecorder->setAudioEnabled(muteSetting == 0);
+ mVideoRecorder->setAudioEnabled(!muteSetting);
// "No limit" value is handled in video recorder wrapper.
mVideoRecorder->setVideoMaxSize(mCurrentVideoDetails.mMaximumSizeInBytes);
// Settings have been applied successfully, start to prepare.
mVideoRecorder->prepare();
- // 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);
@@ -343,32 +337,52 @@
handlePrepareFailed();
}
- 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.
+* Prepare video snapshot.
+* Throws exception on error.
*/
-void
-CxeVideoCaptureControlSymbian::getVideoQualityDetails(CxeVideoDetails &videoInfo)
+void CxeVideoCaptureControlSymbian::prepareSnapshot()
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROL_PREPARESNAP_1, "msg: e_CX_PREPARE_SNAPSHOT 1" );
- int quality(0);
+ // Prepare snapshot. Snapshot control throws error if problems.
+ QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
+ mViewfinderControl.deviceDisplayResolution(),
+ mCurrentVideoDetails.mAspectRatio);
+ mSnapshotControl.start(snapshotSize);
+
+ OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROL_PREPARESNAP_2, "msg: e_CX_PREPARE_SNAPSHOT 0" );
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ Fetch video quality details based on current video quality setting.
+*/
+void CxeVideoCaptureControlSymbian::updateVideoCaptureParameters()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_UPDATEVIDEOCAPTUREPARAMETERS_1, "msg: e_CX_UPDATE_VIDEO_CAPTURE_PARAMETERS 1");
+
+ int quality = 0;
// 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));
+ quality = mSettings.get<int>(CxeSettingIds::VIDEO_QUALITY);
}
if (quality < 0 || quality >= mIcmSupportedVideoResolutions.count()) {
throw new CxeException(CxeError::NotFound);
}
- // get video quality details
- videoInfo = mIcmSupportedVideoResolutions.at(quality);
+ // Get video quality details
+ mCurrentVideoDetails = mIcmSupportedVideoResolutions.at(quality);
+ OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_UPDATEVIDEOCAPTUREPARAMETERS_2, "msg: e_CX_UPDATE_VIDEO_CAPTURE_PARAMETERS 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -502,11 +516,17 @@
CX_DEBUG(("CxeVideoCaptureControlSymbian::MvruoPrepareComplete, err=%d", aError));
if (state() == Preparing) {
- if (!aError) {
- setState(CxeVideoCaptureControl::Ready);
+ try {
+ // Check that no error coming in.
+ CxeException::throwIfError(aError);
+ // Start viewfinder
mViewfinderControl.start();
+ // Prepare snapshot (throws exception if fails).
+ prepareSnapshot();
+ // Ready for recording now.
+ setState(CxeVideoCaptureControl::Ready);
OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_GOTOVIDEO, "msg: e_CX_GO_TO_VIDEO_MODE 0" );
- } else {
+ } catch (const std::exception &e) {
handlePrepareFailed();
}
}
@@ -800,9 +820,13 @@
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();
@@ -849,7 +873,7 @@
* Scene mode changed. We need to know about it because frame rate
* might have changed.
*/
-void CxeVideoCaptureControlSymbian::handleSceneChanged(CxeScene& scene)
+void CxeVideoCaptureControlSymbian::handleSceneChanged(const QVariant& scene)
{
Q_UNUSED(scene)
CX_DEBUG_ENTER_FUNCTION();
@@ -889,6 +913,38 @@
}
/*!
+ Use ECam Use Case Hint Custom API to inform ECam of our intended use case
+ before calling Reserve().
+*/
+void CxeVideoCaptureControlSymbian::hintUseCase()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Make sure ECam knows we're doing video recording so it can prepare
+ // for the correct use case.
+ if (mCameraDeviceControl.mode() == Cxe::VideoMode) {
+ MCameraUseCaseHint *useCaseHintApi = mCameraDevice.useCaseHintApi();
+ if (useCaseHintApi) {
+ MCameraUseCaseHint::TVideoCodec codec =
+ MCameraUseCaseHint::ECodecUnknown;
+ MCameraUseCaseHint::TVideoProfile profile =
+ MCameraUseCaseHint::EProfileUnknown;
+
+ updateVideoCaptureParameters();
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(
+ mCurrentVideoDetails, codec, profile);
+
+ TSize resolution(mCurrentVideoDetails.mWidth,
+ mCurrentVideoDetails.mHeight);
+ TRAP_IGNORE(useCaseHintApi->HintDirectVideoCaptureL(codec, profile,
+ resolution));
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
* Returns QList of all supported video quality details based on the camera index
* (primary/secondary).
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxeviewfindercontroldesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* 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 <HbMainWindow>
+#include <HbView>
+#include <HbLabel>
+#include <QGraphicsLinearLayout>
+#include "cxeviewfindercontroldesktop.h"
+#include "cxecameradevicedesktop.h"
+#include "cxeviewfinderwidgetdesktop.h"
+#include "cxutils.h"
+
+const int KResWidth = 640;
+const int KResHeight = 360;
+
+CxeViewfinderControlDesktop::CxeViewfinderControlDesktop(CxeCameraDeviceDesktop &cameraDevice) :
+ mState(Uninitialized),
+ mResolution(KResWidth, KResHeight),
+ mCameraDevice(cameraDevice),
+ mViewfinderWidget(0)
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+CxeViewfinderControlDesktop::~CxeViewfinderControlDesktop()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
+* Set Window ID
+*/
+void CxeViewfinderControlDesktop::setWindow(WId windowId)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mWindowId = windowId;
+
+ if (state() != Running) {
+ mState = Ready;
+ emit stateChanged(mState, CxeError::None);
+ CX_DEBUG_EXIT_FUNCTION();
+ }
+
+
+ HbMainWindow* mainWindow = qobject_cast<HbMainWindow*>(QWidget::find(mWindowId));
+
+ if (mainWindow) {
+ if( !mViewfinderWidget) {
+ mViewfinderWidget = new CxeViewfinderWidgetDesktop();
+ connect(&mCameraDevice, SIGNAL(imageChanged(QPixmap)), mViewfinderWidget, SLOT(handleImageChange(QPixmap)));
+ }
+ HbView* view = mainWindow->currentView();
+ view->scene()->addItem(mViewfinderWidget);
+ mViewfinderWidget->setZValue(-1.0);
+ }
+}
+
+/*!
+* Start viewfinder
+* @return CxeEngine specific error code
+*/
+CxeError::Id CxeViewfinderControlDesktop::start()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (mState != Running) {
+ mState = Running;
+ emit stateChanged(mState, CxeError::None);
+ mCameraDevice.start();
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+ return CxeError::None;
+}
+
+/*!
+* Stop viewfinder
+*/
+void CxeViewfinderControlDesktop::stop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mState = Ready;
+ emit stateChanged(mState, CxeError::None);
+ mCameraDevice.stop();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Current viewfinder state
+*/
+CxeViewfinderControl::State CxeViewfinderControlDesktop::state() const
+{
+ return mState;
+}
+
+/*!
+* Returns Device's Display resolution
+*/
+QSize CxeViewfinderControlDesktop::deviceDisplayResolution() const
+{
+ return mResolution;
+}
+
+// end of file
--- a/camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp Wed Aug 18 09:37:18 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();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxeviewfinderwidgetdesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 "cxeviewfinderwidgetdesktop.h"
+#include <QPainter>
+#include "cxutils.h"
+
+const double RES_WIDTH = 640.0;
+const double RES_HEIGHT = 360.0;
+
+/*!
+* Construtor
+*/
+CxeViewfinderWidgetDesktop::CxeViewfinderWidgetDesktop() :
+ QGraphicsWidget()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mCurrentPixmap = QPixmap();
+ resize(RES_WIDTH, RES_HEIGHT);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Destrutor
+*/
+CxeViewfinderWidgetDesktop::~CxeViewfinderWidgetDesktop()
+{
+
+}
+
+/*!
+* Paint
+*/
+void CxeViewfinderWidgetDesktop::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+
+ painter->drawPixmap(rect().toRect(), mCurrentPixmap);
+}
+
+/*!
+* Handle image change
+*/
+void CxeViewfinderWidgetDesktop::handleImageChange(const QPixmap &newImage)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mCurrentPixmap = newImage;
+ update();
+ CX_DEBUG_EXIT_FUNCTION();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxezoomcontroldesktop.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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 "cxezoomcontroldesktop.h"
+#include "cxecameradevicecontrol.h"
+#include "cxutils.h"
+#include "cxenamespace.h"
+#include "cxestate.h"
+
+const int NOT_DEFINED = -1;
+
+/*!
+ * Constructor
+ */
+CxeZoomControlDesktop::CxeZoomControlDesktop(CxeCameraDeviceControl &cameraDeviceControl) :
+ mCameraDeviceControl(cameraDeviceControl)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qRegisterMetaType<CxeZoomControl::State> ();
+
+ init();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Destructor
+ */
+CxeZoomControlDesktop::~CxeZoomControlDesktop()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Get the minimum zoom index
+ */
+int CxeZoomControlDesktop::min() const
+{
+ return mMinZoomLevel;
+}
+
+/*!
+ * Get the maximum zoom index
+ */
+int CxeZoomControlDesktop::max() const
+{
+ return mMaxZoomLevel;
+}
+
+/*!
+ * Init
+ */
+void CxeZoomControlDesktop::init()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Initialize the variables
+ mMinZoomLevel = 0;
+ mMaxZoomLevel = 0;
+ mCurrentZoomLevel = 0;
+
+ mState = Idle;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Re-initializes the zoom control
+ */
+void CxeZoomControlDesktop::reset()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ init();
+ emit zoomLevelChanged(mCurrentZoomLevel);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* slot to prepare zoom control for still mode
+*/
+void CxeZoomControlDesktop::prepareZoomForStill(int ecamStillResolutionIndex)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ Q_UNUSED(ecamStillResolutionIndex);
+
+ if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
+ reset();
+ int error;
+ int imageQualityIndex;
+ CxeError::Id cxErr;
+ if (cxErr == CxeError::None && mStillMaxZoomLimits.count() > 0) {
+ // fetching the zoom limit based on the image quality
+ mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
+ } else {
+ mMaxZoomLevel = NOT_DEFINED;
+ }
+
+ finalizeZoomPreparation(error);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* slot to prepare zoom control for video mode
+*/
+void CxeZoomControlDesktop::prepareZoomForVideo()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
+ reset();
+ int error;
+ if (mVideoMaxZoomLimits.count() > 0) {
+ // fetching the zoom limit based on the video quality
+ mMaxZoomLevel = mVideoMaxZoomLimits[0];
+ } else {
+ mMaxZoomLevel = NOT_DEFINED;
+ }
+
+ finalizeZoomPreparation(error);
+ }
+
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Completes zoom control preparation.
+*/
+void CxeZoomControlDesktop::finalizeZoomPreparation(int error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_DEBUG(("Maximum zoom limit: %d", mMaxZoomLevel));
+
+ if (!error) {
+ // Note that this is called only after setting the resolution.
+ // emit the zoom changed signal so that clients can do any updates if necessary.
+ emit zoomLevelChanged(mCurrentZoomLevel);
+
+ mState = Ready;
+ emit stateChanged(mState, CxeError::None);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Zooms to the level specified in the parameter
+*/
+void CxeZoomControlDesktop::zoomTo(int value)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_DEBUG(("Zoom to: %d, current zoom: %d", value, mCurrentZoomLevel));
+
+ // If not currently zooming and value falls between min & max
+ // then zoom to the passed level. Also there's no need to zoom if new zoom
+ // level is same as the current.
+ if (state() == CxeZoomControl::Ready && (value <= mMaxZoomLevel)
+ && (value >= mMinZoomLevel) && (mCurrentZoomLevel != value)) {
+
+ // Could also check the number of values in the array to avoid out of bounds indexing,
+ // though this is done in alternate way by the min and max limits.
+ mCurrentZoomLevel = value;
+
+ // Set the appropriate zooming state
+ if (value < mCurrentZoomLevel) {
+ mState = ZoomingOut;
+ } else {
+ mState = ZoomingIn;
+ }
+ emit stateChanged(mState, CxeError::None);
+
+ //! @todo: Wait for zoom callback: ECamEventZoomStateChanged ?
+ mState = Ready;
+ emit stateChanged(mState, CxeError::None);
+
+ // Emit the zoom level change signal
+ emit zoomLevelChanged(mCurrentZoomLevel);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+CxeZoomControl::State CxeZoomControlDesktop::state() const
+{
+ return mState;
+}
--- a/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp Wed Aug 18 09:37:18 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,6 +22,7 @@
#include "cxutils.h"
#include "cxenamespace.h"
#include "cxestate.h"
+#include "cxeexception.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
@@ -55,20 +56,14 @@
initializeStates();
// getting still max zoom limits from feature manager
- featureManager.configuredValues(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS, mStillMaxZoomLimits);
- featureManager.configuredValues(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, mVideoMaxZoomLimits);
+ featureManager.configuredValues(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS, mStillMaxZoomLimits);
+ featureManager.configuredValues(CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS, mVideoMaxZoomLimits);
connect(&mCameraDevice,
SIGNAL(prepareForCameraDelete()),
this,
SLOT(reset()));
- // enabling setting value change call backs
- connect(&mSettings,
- SIGNAL(settingValueChanged(const QString&,QVariant)),
- this,
- SLOT(handleSettingValueChanged(const QString&,QVariant)));
-
init();
CX_DEBUG_EXIT_FUNCTION();
@@ -141,23 +136,6 @@
-/**
- * Settings changed, needs updated
- */
-void CxeZoomControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant /*newValue*/)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (settingId == CxeSettingIds::IMAGE_QUALITY ||
- settingId == CxeSettingIds::VIDEO_QUALITY) {
- reset();
- } else {
- // do nothing
- }
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
/*!
* slot to prepare zoom control for still mode
*/
@@ -167,7 +145,7 @@
OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPARESTILL_IN, "msg: e_CX_PREPARE_ZOOM 1");
if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
- init();
+ reset();
// For image mode
CCamera::TFormat format = CCamera::EFormatExif;
TBool isInfluencePossible = EFalse;
@@ -181,12 +159,14 @@
format,
isInfluencePossible));
- int imageQualityIndex;
- CxeError::Id cxErr = mSettings.get(CxeSettingIds::IMAGE_QUALITY, imageQualityIndex);
- if (cxErr == CxeError::None && mStillMaxZoomLimits.count() > 0) {
- // fetching the zoom limit based on the image quality
- mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
- } else {
+
+ try {
+ int imageQualityIndex = mSettings.get<int>(CxeSettingIds::IMAGE_QUALITY);
+ if (mStillMaxZoomLimits.count() > 0 && imageQualityIndex < mStillMaxZoomLimits.count()) {
+ // fetching the zoom limit based on the image quality
+ mMaxZoomLevel = mStillMaxZoomLimits[imageQualityIndex];
+ }
+ } catch (CxeException &e) {
mMaxZoomLevel = NOT_DEFINED;
}
@@ -207,9 +187,9 @@
OstTrace0(camerax_performance, CXEZOOMCONTROLSYMBIAN_PREPAREVIDEO_IN, "msg: e_CX_PREPARE_ZOOM 1");
if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) {
- init();
+ reset();
// 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 +236,7 @@
mMaxZoomLevel = cameraInfo.iMaxDigitalZoom;
}
// change the state, since zoom is now ready
- setState(Ready, KErrNone);
+ setState(Ready);
mCameraDevice.advancedSettings()->SetDigitalZoom(mDigitalZoomValues[mCurrentZoomLevel]);
--- a/camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp Wed Aug 18 09:37:18 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));
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -27,6 +27,8 @@
{
CX_DEBUG_ENTER_FUNCTION();
initializeStates();
+ qRegisterMetaType<CxeAutoFocusControl::State>("CxeAutoFocusControl::State");
+ qRegisterMetaType<CxeAutoFocusControl::Mode>("CxeAutoFocusControl::Mode");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -38,6 +40,7 @@
CxeError::Id CxeFakeAutoFocusControl::start(bool soundEnabled)
{
CX_DEBUG_IN_FUNCTION();
+ Q_UNUSED(soundEnabled);
return CxeError::None;
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -36,12 +36,20 @@
void CxeFakeFileSaveThread::handleVideoSaved(CxeError::Id status, const QString &filename)
{
+ Q_UNUSED(status);
+ Q_UNUSED(filename);
}
void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename)
{
+ Q_UNUSED(status);
+ Q_UNUSED(snapshot);
+ Q_UNUSED(filename);
}
void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id)
{
+ Q_UNUSED(status);
+ Q_UNUSED(snapshot);
+ Q_UNUSED(id);
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp Wed Aug 18 09:37:18 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,6 +17,7 @@
#include "cxefakesettings.h"
+
CxeFakeSettings::CxeFakeSettings()
{
}
@@ -25,28 +26,11 @@
{
}
-CxeError::Id CxeFakeSettings::get(const QString& key, int& value) const
-{
- value = mSettingKeyHash[key].toInt();
- return CxeError::None;
-}
-CxeError::Id CxeFakeSettings::get(const QString& key, QString &stringValue) const
-{
- stringValue = mSettingKeyHash[key].toString();
- return CxeError::None;
-}
-
-
-
-CxeError::Id CxeFakeSettings::get(const QString &key, qreal &value) const
-{
- value = mSettingKeyHash[key].toReal();
- return CxeError::None;
-}
-
-
-void CxeFakeSettings::get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) const
+void CxeFakeSettings::get(long int uid,
+ unsigned long int key,
+ Cxe::SettingKeyType type,
+ QVariant &value) const
{
Q_UNUSED(uid);
Q_UNUSED(key);
@@ -54,31 +38,34 @@
Q_UNUSED(value);
}
-
-CxeError::Id CxeFakeSettings::set(const QString& key, int newValue)
+bool CxeFakeSettings::listenForSetting(const QString &settingKey, QObject *target, const char *slot)
{
- mSettingKeyHash[key] = QVariant(newValue);
- emit settingValueChanged(key, newValue);
+ Q_UNUSED(settingKey);
+ Q_UNUSED(target);
+ Q_UNUSED(slot);
+ return true;
+}
+
+CxeError::Id CxeFakeSettings::getVariationValue(const QString &key, QVariant &value)
+{
+ int variation = mVariationKeyHash[key];
+ value = QVariant(variation);
return CxeError::None;
}
-CxeError::Id CxeFakeSettings::set(const QString &key, const QString &newValue)
+void CxeFakeSettings::getValue(const QString &key, QVariant &value) const
{
- mSettingKeyHash[key] = QVariant(newValue);
- emit settingValueChanged(key, newValue);
- return CxeError::None;
+ value = mSettingKeyHash[key];
}
-
-
-CxeError::Id CxeFakeSettings::set(const QString &key, qreal newValue)
+void CxeFakeSettings::setValue(const QString &key, const QVariant &newValue)
{
- mSettingKeyHash[key] = QVariant(newValue);
+ mSettingKeyHash[key] = newValue;
emit settingValueChanged(key, newValue);
- return CxeError::None;
}
+
void CxeFakeSettings::reset()
{
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h Wed Aug 18 09:37:18 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,22 +31,24 @@
public: // from CxeSettings
- CxeError::Id get(const QString &key, int &value) const;
- CxeError::Id get(const QString &key, QString &stringValue) const;
- void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) const;
- CxeError::Id set(const QString &key, int newValue);
- CxeError::Id set(const QString &key,const QString &newValue);
- CxeError::Id get(const QString &key, qreal &value) const;
- CxeError::Id set(const QString &key, qreal newValue);
+ void get(long int uid,
+ unsigned long int key,
+ Cxe::SettingKeyType type,
+ QVariant &value) const;
void reset();
+ CxeError::Id getVariationValue(const QString &key, QVariant &value);
+ bool listenForSetting(const QString &settingKey, QObject *target, const char *slot);
+
+ protected:
+ void getValue(const QString &key, QVariant &value) const;
+ void setValue(const QString &key, const QVariant &newValue);
public: // methods for unit testing
-
void emulate(long int uid, unsigned long int key, QVariant value);
private: // data
QHash<QString, QVariant> mSettingKeyHash;
- QHash<QString, unsigned long int> mRuntimeKeyHash;
+ QHash<QString, unsigned long int> mVariationKeyHash;
private:
Q_DISABLE_COPY(CxeFakeSettings)
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.cpp Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
-* 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 "cxefakesettingsmodel.h"
-#include "cxutils.h"
-
-CxeFakeSettingsModel::CxeFakeSettingsModel()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- initDefaultCameraSettings();
- initRuntimeSettings();
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-CxeFakeSettingsModel::~CxeFakeSettingsModel()
-{
- CX_DEBUG_IN_FUNCTION();
-}
-
-CxeError::Id CxeFakeSettingsModel::getRuntimeValue( const QString &key, QVariant &value)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id err = CxeError::None;
-
- // read run-time configuration value
- if (mRuntimeSettings.contains(key)) {
- value = qVariantFromValue<QVariantList > (mRuntimeSettings.value(key));
- } else {
- err = CxeError::NotFound;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
- return err;
-}
-
-CxeError::Id CxeFakeSettingsModel::getSettingValue( const QString &key, QVariant &value)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id err = CxeError::None;
-
- // read run-time configuration value
- if (mSettingStore.contains(key)) {
- value = mSettingStore[key];
- } else {
- err = CxeError::NotFound;
- }
-
- CX_DEBUG_EXIT_FUNCTION();
- return err;
-}
-
-void CxeFakeSettingsModel::getSettingValue(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value)
-{
- Q_UNUSED(uid);
- Q_UNUSED(key);
- Q_UNUSED(type);
- Q_UNUSED(value);
-
- // no support yet
- CX_DEBUG_IN_FUNCTION();
-}
-
-
-/*! 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
- */
-CxeError::Id CxeFakeSettingsModel::set(const QString &key, QVariant value)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id error = CxeError::None;
-
- if(mSettingStore.contains(key)) {
- mSettingStore.insert(key, value);
- } else {
- error = CxeError::NotFound;
- }
-
-
-
- CX_DEBUG_EXIT_FUNCTION();
- return error;
-}
-
-CxeError::Id CxeFakeSettingsModel::setImageScene(const QString &newScene)
-{
- mDummyImageScene.clear();
-
- // image scene mode key values
- if(newScene == Cxe::IMAGE_SCENE_AUTO) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO);
- }
- else if(newScene == Cxe::IMAGE_SCENE_PORTRAIT) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT);
- }
- else if(newScene == Cxe::IMAGE_SCENE_SCENERY) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY);
- }
- else if(newScene == Cxe::IMAGE_SCENE_MACRO) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO);
- }
- else if(newScene == Cxe::IMAGE_SCENE_SPORTS) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS);
- }
- else if(newScene == Cxe::IMAGE_SCENE_NIGHT) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
- }
- else if(newScene == Cxe::IMAGE_SCENE_NIGHTPORTRAIT) {
- mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT);
- }
- else {
- return CxeError::NotFound;
- }
-
- return CxeError::None;
-}
-
-CxeError::Id CxeFakeSettingsModel::setVideoScene(const QString &newScene)
-{
- mDummyVideoScene.clear();
-
- // image scene mode key values
- if(newScene == Cxe::VIDEO_SCENE_AUTO) {
- mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
- }
- else if(newScene == Cxe::VIDEO_SCENE_NIGHTPORTRAIT) {
- mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHTPORTRAIT);
- }
- else if(newScene == Cxe::VIDEO_SCENE_LOWLIGHT) {
- mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT);
- }
- else if(newScene == Cxe::VIDEO_SCENE_NIGHT) {
- mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT);
- }
- else {
- return CxeError::NotFound;
- }
-
- return CxeError::None;
-}
-
-
-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()
-{
- CX_DEBUG_ENTER_FUNCTION();
- mSettingStore.insert(CxeSettingIds::FNAME_FOLDER_SUFFIX, QVariant(1));
- mSettingStore.insert(CxeSettingIds::FNAME_MONTH_FOLDER, QVariant(1));
- mSettingStore.insert(CxeSettingIds::FNAME_IMAGE_COUNTER, QVariant(1));
- mSettingStore.insert(CxeSettingIds::FNAME_VIDEO_COUNTER, QVariant(1));
- mSettingStore.insert(CxeSettingIds::COLOR_TONE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::SHARPNESS, QVariant(1));
- mSettingStore.insert(CxeSettingIds::CONTRAST, QVariant(1));
- mSettingStore.insert(CxeSettingIds::BRIGHTNESS, QVariant(1));
- mSettingStore.insert(CxeSettingIds::EV_COMPENSATION_VALUE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::EXPOSURE_MODE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::FLASH_MODE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::FOCAL_RANGE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::FRAME_RATE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_QUALITY, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE, 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::WHITE_BALANCE, QVariant(1));
-
- // default scene
- setImageScene(Cxe::IMAGE_SCENE_AUTO);
- setVideoScene(Cxe::VIDEO_SCENE_AUTO);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/* This helper method initializes fake runtime setting values for the keys
- */
-void CxeFakeSettingsModel::initRuntimeSettings()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- QVariantList supported;
- supported.append(QVariant(1));
-
- QVariantList notSupported;
- notSupported.append(QVariant(0));
-
- 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();
-}
-
-
-// end of file
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.h Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef CXEFAKESETTINGSMODEL_H
-#define CXEFAKESETTINGSMODEL_H
-
-#include <QHash>
-#include "cxesettingsmodel.h"
-
-class CxeFakeSettingsModel : public CxeSettingsModel
-{
-
-public:
-
- CxeFakeSettingsModel();
- ~CxeFakeSettingsModel();
-
- void reset() {};
- CxeError::Id getSettingValue(const QString &key, QVariant &value);
- void getSettingValue(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
- CxeError::Id getRuntimeValue(const QString &key, QVariant &value);
-
- CxeError::Id set(const QString &key,const QVariant newValue);
- 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<QVariant> value);
- void initDefaultCameraSettings();
- void initRuntimeSettings();
- void testSetCurrenImageScene();
- void testSetCurrenVideoScene();
-
- Cxe::CameraMode getDummyCameraMode() {return mDummyCameraMode;}
-
-private:
-
- QHash<QString, QVariant> mSettingStore;
- QHash<QString, QVariantList> mRuntimeSettings;
- CxeScene mDummyImageScene;
- CxeScene mDummyVideoScene;
- Cxe::CameraMode mDummyCameraMode;
-};
-
-#endif // CXEFAKESETTINGSMODEL_H
-
-
-
-
-
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -24,13 +24,23 @@
CxeFakeSettingsStore::CxeFakeSettingsStore()
{
- // all supported settings are initialized here.
+ resetSettings();
+}
+
+CxeFakeSettingsStore::~CxeFakeSettingsStore()
+{
+}
+
+void CxeFakeSettingsStore::resetSettings()
+{
+ // This part should be synchronized with the current settings
+ // supported by camera and defined in cxenamespace
mSettingKeyHash.clear();
mSettingKeyHash.insert(CxeSettingIds::FNAME_FOLDER_SUFFIX, QVariant("_Nokia"));
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"));
@@ -38,17 +48,27 @@
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()
-{
+ mSettingKeyHash.insert(CxeSettingIds::FOCAL_RANGE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::WHITE_BALANCE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::LIGHT_SENSITIVITY, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::EXPOSURE_MODE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::SHARPNESS, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::COLOR_TONE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::EV_COMPENSATION_VALUE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::CONTRAST, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::BRIGHTNESS, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::FRAME_RATE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::SCENE_ID, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::SECONDARY_CAMERA, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::SELF_TIMER, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, QVariant(0));
}
/*!
@@ -61,8 +81,8 @@
CxeError::Id error = CxeError::None;
if(mSettingKeyHash.contains(key)) {
value = mSettingKeyHash[key];
- } else if(mRuntimeKeyHash.contains(key)) {
- value = mRuntimeKeyHash[key];
+ } else if(mVariationKeyHash.contains(key)) {
+ value = mVariationKeyHash[key];
} else {
error = CxeError::NotFound;
}
@@ -82,29 +102,30 @@
Q_UNUSED(uid);
Q_UNUSED(key);
Q_UNUSED(type);
- Q_UNUSED(value);
- // no support yet
+ // Instead of emulating cenrep functionality
+ // we just return a test value for verification
+ value = 42;
}
/*!
-* Reads/loads all run-time settings values from cenrep
-* @param QList<QString> contains list of all runtime key ids which we use to load values from cenrep.
+* Reads/loads all variation settings values from cenrep
+* @param QList<QString> contains list of all variation 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.
+* NOTE: loading variation settings should be done only ONCE at start-up.
*/
-QHash<QString, QVariantList> CxeFakeSettingsStore::loadRuntimeSettings(QList<QString>& keylist)
+QHash<QString, QVariantList> CxeFakeSettingsStore::loadVariationSettings(QList<QString> &settingKeys)
{
QVariant data;
CxeError::Id err = CxeError::None;
QVariantList list;
QHash<QString, QVariantList> settings;
- mRuntimeKeyHash.clear();
+ mVariationKeyHash.clear();
- foreach (QString key, keylist) {
+ foreach (QString key, settingKeys) {
// before we read from get function we set values to the key
- mRuntimeKeyHash.insert(key, QVariant(1));
+ mVariationKeyHash.insert(key, QVariant(1));
// read the data from cenrep
err = get(key, data);
@@ -141,5 +162,6 @@
*/
void CxeFakeSettingsStore::reset()
{
+ resetSettings();
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h Wed Aug 18 09:37:18 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 CXEFAKESETTINGS_H
#define CXEFAKESETTINGS_H
-#include "cxesettingscenrepstore.h"
+#include "cxesettingsstore.h"
#include "cxeerror.h"
class CxeFakeSettingsStore : public CxeSettingsStore
@@ -25,18 +25,21 @@
public:
CxeFakeSettingsStore();
- ~CxeFakeSettingsStore();
+ ~CxeFakeSettingsStore();
public: // from base class
void reset();
- CxeError::Id get(const QString& key, 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<QString, QVariantList> loadRuntimeSettings(QList<QString>& keylist);
+ CxeError::Id get(const QString& key, 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<QString, QVariantList> loadVariationSettings(QList<QString> &settingKeys);
+
+private:
+ void resetSettings();
private:
QHash<QString, QVariant> mSettingKeyHash;
- QHash<QString, QVariant> mRuntimeKeyHash;
+ QHash<QString, QVariant> mVariationKeyHash;
};
#endif /*CXEFAKESETTINGS_H*/
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideorecorderutility.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -35,6 +35,8 @@
: mObserver( &aObserver )
{
CX_DEBUG_IN_FUNCTION();
+ Q_UNUSED(aPriority);
+ Q_UNUSED(aPref);
}
void CxeFakeVideoRecorderUtility::open(int cameraHandle,
@@ -45,6 +47,7 @@
const QString &/*audioType*/)
{
CX_DEBUG_ENTER_FUNCTION();
+ Q_UNUSED(cameraHandle);
mObserver->MvruoOpenComplete(KErrNone);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -57,21 +60,25 @@
void CxeFakeVideoRecorderUtility::setVideoFrameRate(int rate)
{
CX_DEBUG_IN_FUNCTION();
+ Q_UNUSED(rate);
}
void CxeFakeVideoRecorderUtility::setVideoBitRate(int rate)
{
CX_DEBUG_IN_FUNCTION();
+ Q_UNUSED(rate);
}
void CxeFakeVideoRecorderUtility::setAudioEnabled(bool enabled)
{
CX_DEBUG_IN_FUNCTION();
+ Q_UNUSED(enabled);
}
void CxeFakeVideoRecorderUtility::setVideoMaxSize(int sizeInBytes)
{
CX_DEBUG_IN_FUNCTION();
+ Q_UNUSED(sizeInBytes);
}
void CxeFakeVideoRecorderUtility::close()
@@ -94,6 +101,7 @@
void CxeFakeVideoRecorderUtility::stop(bool asynchronous)
{
CX_DEBUG_ENTER_FUNCTION();
+ Q_UNUSED(asynchronous);
mObserver->MvruoRecordComplete(KErrNone);
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -41,6 +41,7 @@
#endif
QStringList tests;
+
tests << "unittest_cxevideocapturecontrolsymbian"
<< "unittest_cxestillimagesymbian"
<< "unittest_cxequalitypresetssymbian"
@@ -56,19 +57,21 @@
<< "unittest_cxeimagedataitemsymbian"
<< "unittest_cxeimagedataqueuesymbian"
<< "unittest_cxeerrormappersymbian"
- << "unittest_cxesettingsmodelimp"
<< "unittest_cxefilesavethreadsymbian"
<< "unittest_cxesettingscenrepstore"
<< "unittest_cxezoomcontrolsymbian"
<< "unittest_cxestillcapturecontrolsymbian"
<< "unittest_cxefeaturemanagerimp"
<< "unittest_cxesettingsimp"
+ << "unittest_cxescenemodestore"
<< "unittest_cxethumbnailmanagersymbian"
<< "unittest_cxeharvestercontrolsymbian"
<< "unittest_cxesettingscontrolsymbian"
<< "unittest_cxesnapshotcontrol"
<< "unittest_cxeenginesymbian"
- << "unittest_cxegeotaggingtrail";
+ << "unittest_cxegeotaggingtrail"
+ << "unittest_cxememorymonitor"
+ << "unittest_cxediskmonitor";
QDir dir;
dir.mkpath(logFileFolder);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/system_include/harvesterclient.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/harvesterclient.h Wed Aug 18 09:37:18 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2006-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,7 +19,7 @@
#ifndef __HARVESTER_CLIENT_H__
#define __HARVESTER_CLIENT_H__
-
+#include <e32std.h>
class MHarvestObserver
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/imagingconfigmanager.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006-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 implementation for the unittest_cxequalitypresetssymbian
+*
+*/
+
+
+#include "imagingconfigmanager.h"
+
+
+const int KNumberOfQualityLevels = 5;
+
+// ---------------------------------------------------------------------------
+// Constructor of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+CImagingConfigManager::CImagingConfigManager()
+{
+ iVideoQualitySets = new CArrayFixFlat< TVideoQualitySet >( 1 );
+ iImageQualitySets = new CArrayFixFlat< TImageQualitySet >( 1 );
+
+ // init
+ for( TInt i = 0 ; i < KNumberOfQualityLevels ; i++ )
+ {
+ TVideoQualitySet videoset;
+ initVideoQualitySet(videoset);
+ iVideoQualitySets->AppendL(videoset);
+
+ TImageQualitySet imageset;
+ initImageQualitySet(imageset);
+ iImageQualitySets->AppendL(imageset);
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// Destructor of CImagingConfigManager
+// ---------------------------------------------------------------------------
+//
+CImagingConfigManager::~CImagingConfigManager()
+{
+}
+
+
+
+
+// CImagingConfigManager::NewL
+CImagingConfigManager* CImagingConfigManager::NewL()
+{
+ return new CImagingConfigManager();
+}
+
+// returns no of video quality levels
+TInt CImagingConfigManager::NumberOfVideoQualityLevels() const
+{
+ return iVideoQualitySets->Count();
+}
+
+// ---------------------------------------------------------------------------
+// Get an array of video quality levels that are in use with the current
+// product with given Camera/Display ID. If the ID is zero, then all levels
+// dispite of the ID value are returned.
+// ---------------------------------------------------------------------------
+//
+TInt CImagingConfigManager::GetVideoQualityLevelsL(
+ CArrayFixFlat<TUint>& aLevels,
+ TUint /*aCameraDisplayID*/ )
+ {
+ aLevels.Reset();
+ aLevels.SetReserveL( iVideoQualitySets->Count() );
+ for( TInt i = 0 ; i < NumberOfVideoQualityLevels() ; i++ )
+ {
+ aLevels.AppendL(
+ iVideoQualitySets->At( i ).iVideoQualitySetLevel);
+ }
+ return KErrNone;
+ }
+
+// CImagingConfigManager::GetVideoQualitySet
+TInt CImagingConfigManager::GetVideoQualitySet( TVideoQualitySet& aSet,
+ TInt /*aLevel*/,
+ TUint /*aCameraDisplayID*/ )
+ {
+ initVideoQualitySet(aSet);
+ return KErrNone;
+ }
+
+// Get all settings for Camcorder
+TInt CImagingConfigManager::GetCamcorderMMFPluginSettings(TCamcorderMMFPluginSettings& /*aSet*/) const
+ {
+ return KErrNone;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Get number of defined image quality levels. This is always at least
+// KNumberOfNominalLevels but can be higher
+// ---------------------------------------------------------------------------
+//
+TInt CImagingConfigManager::NumberOfImageQualityLevels() const
+ {
+ return iImageQualitySets->Count();
+ }
+
+// ---------------------------------------------------------------------------
+// Get an array of image quality levels that are in use with the current
+// product with given Camera/Display ID. If the ID is zero, then all levels
+// dispite of the ID value are returned.
+// ---------------------------------------------------------------------------
+//
+TInt CImagingConfigManager::GetImageQualityLevelsL(
+ CArrayFixFlat<TUint>& aLevels,
+ TUint /*aCameraDisplayID*/ )
+ {
+ aLevels.Reset();
+ for( TInt i = 0 ; i < NumberOfImageQualityLevels() ; i++ )
+ {
+ aLevels.AppendL(
+ iImageQualitySets->At( i ).iImageQualitySetLevel );
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Get image quality set associated with the given level and Camera/Display ID
+// if it is nonzero. If the ID is zero, smallest matching ID set is returned.
+// If there is no set associated with given intermediate
+// level, then set from a nearest level is returned (dividable by
+// KBasicQualityGranularity).
+// ---------------------------------------------------------------------------
+//
+TInt CImagingConfigManager::GetImageQualitySet( TImageQualitySet& aSet,
+ TInt /*aLevel*/,
+ TUint /*aCameraDisplayID*/ )
+{
+ initImageQualitySet(aSet);
+ return KErrNone;
+}
+
+
+void CImagingConfigManager::initImageQualitySet(TImageQualitySet& aSet)
+{
+ for( TUint i = 0 ; i < KMaxStringLength ; i++ )
+ {
+ aSet.iImageFileMimeType[ i ] = NULL;
+ aSet.iImageFileExtension[ i ] = NULL;
+ }
+ aSet.iImageQualitySetLevel = 100;
+ aSet.iImageWidth = 0;
+ aSet.iImageHeight = 0;
+ aSet.iImageEncoderUID.iUid = 0;
+ aSet.iCompressionQuality = 0;
+ aSet.iEstimatedSize = 0;
+ aSet.iCameraDisplayId = 0;
+ aSet.iCamcorderVisible = 100;
+
+}
+
+void CImagingConfigManager::initVideoQualitySet(TVideoQualitySet& aSet)
+{
+ for( TUint i = 0 ; i < KMaxStringLength ; i++ )
+ {
+ aSet.iVideoFileMimeType[ i ] = NULL;
+ aSet.iVideoCodecMimeType[ i ] = NULL;
+ aSet.iPreferredSupplier[ i ] = NULL;
+ }
+ aSet.iVideoQualitySetLevel = 100;
+ aSet.iVideoWidth = 0;
+ aSet.iVideoHeight = 0;
+ aSet.iVideoFrameRate = 0.0;
+ aSet.iVideoBitRate = 0;
+ aSet.iVideoEncoderUID.iUid = 0;
+ aSet.iRandomAccessRate = 0;
+ aSet.iVideoPixelAspectRatioNum = 0;
+ aSet.iVideoPixelAspectRatioDenom = 0;
+ aSet.iAudioFourCCType = 0;
+ aSet.iAudioBitRate = 0;
+ aSet.iAudioSamplingRate = 0;
+ aSet.iAudioChannels = 0;
+ aSet.iAudioEncoderUID.iUid = 0;
+ aSet.iAVSyncStartDelay = 0;
+ aSet.iAVSyncResumeDelay = 0;
+ aSet.iCameraDisplayId = 0;
+ aSet.iCamcorderVisible = 100;
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/imagingconfigmanager.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2006-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 implementation for the unittest_cxequalitypresetssymbian
+*
+*/
+
+
+#ifndef IMAGINGCONFIGMANAGER_H
+#define IMAGINGCONFIGMANAGER_H
+
+#include <mmf\common\mmfutilities.h>
+
+const TUint KMaxStringLength = 256;
+
+/*
+ * Video quality set structure
+ */
+class TVideoQualitySet
+ {
+ public:
+ // Enum level for the Quality set, used as ID
+ TUint iVideoQualitySetLevel;
+ // Video file format mime type, e.g. "video/3gpp"
+ TText8 iVideoFileMimeType[ KMaxStringLength ];
+ // Video codec mime type, e.g. "video/mp4v-es"
+ TText8 iVideoCodecMimeType[ KMaxStringLength ];
+ // Video picture width in pixels (luminance), resolution width
+ TInt iVideoWidth;
+ // Video picture height in pixels (luminance), resolution height
+ TInt iVideoHeight;
+ // Video framerate in fps
+ TReal iVideoFrameRate;
+ // Video bitrate in bps
+ TInt iVideoBitRate;
+ // Video encoder UID
+ TUid iVideoEncoderUID;
+ // Random access point rate, in pictures per second. For example, to
+ // request a random access point every ten seconds, set the value to
+ // 0.1. Random access means in video case usually that an INTRA frame
+ // is forced by the encoder to make the video accessible at that time
+ // without depending on the previous frames
+ TReal iRandomAccessRate;
+ // Video's pixel aspect ratio numerator, e.g. in PAL 16:11 pixel
+ // aspect ratio means that this value is set to 16
+ TUint iVideoPixelAspectRatioNum;
+ // Video's pixel aspect ratio denominator, e.g. in PAL 16:11 pixel
+ // aspect ratio means that this value is set to 11
+ TUint iVideoPixelAspectRatioDenom;
+ // Preferred supplier for the MMF camcorder plug-in (e.g. "Nokia")
+ TText8 iPreferredSupplier[ KMaxStringLength ];
+
+ // Audio codec FourCC, e.g. " AMR"
+ TFourCC iAudioFourCCType;
+ // Audio bitrate in bps
+ TInt iAudioBitRate;
+ // Audio sampling rate in Hz
+ TInt iAudioSamplingRate;
+ // Number of audio channels; in practice mono(1) vs stereo(2)
+ TInt iAudioChannels;
+ // Audio encoder UID
+ TUid iAudioEncoderUID;
+ // Video recording A/V sync start delay (ms), only used by
+ // CamcorderMMFPlugIn, but depends on the qualityset
+ TInt iAVSyncStartDelay;
+ // Video recording A/V sync resume delay (ms), only used by
+ // CamcorderMMFPlugIn, but depends on the qualityset
+ TInt iAVSyncResumeDelay;
+ // A non-zero ID telling unique combination of camera (primary/
+ // secondary) and/or display (cover UI/main display) and/or rotation
+ // setting combined into a number for separating each setting set
+ // type from others
+ TUint iCameraDisplayId;
+ // Camcorder specific field that can be either 1(true) or 0(false)
+ // meaning if the current quality settings set should be shown on
+ // Camcorder UI or not
+ TUint iCamcorderVisible;
+ };
+
+
+/*
+ * Image quality set structure
+ */
+class TImageQualitySet
+ {
+ public:
+ // Enum level for the Quality set, used as ID
+ TUint iImageQualitySetLevel;
+ // Image file format mime type, e.g. "image/jpeg"
+ TText8 iImageFileMimeType[ KMaxStringLength ];
+ // Image picture width in pixels, resolution width
+ TInt iImageWidth;
+ // Image picture height in pixels, resolution height
+ TInt iImageHeight;
+ // Image extension, e.g. ".jpg"
+ TText8 iImageFileExtension[ KMaxStringLength ];
+ // Image encoder UID
+ TUid iImageEncoderUID;
+ // Compression quality, determines wether file size or image quality
+ // is preferred over the other
+ TInt iCompressionQuality;
+ // Estimated image size, in bytes
+ TInt iEstimatedSize;
+ // A non-Zero ID telling unique combination of camera (primary/
+ // secondary) and/or display (cover UI/main display) and/or rotation
+ // setting combined into a number for separating each setting set type
+ // from others
+ TUint iCameraDisplayId;
+ // Camcorder specific field that can be either 1(true) or 0(false)
+ // meaning if the current quality settings set should be shown on
+ // Camcorder UI or not
+ TUint iCamcorderVisible;
+ };
+
+/*
+ * Camcorder MMF Plug-in Specific settings structure
+ *
+ */
+class TCamcorderMMFPluginSettings
+ {
+ public:
+ // Video framerate in nightmode (fps)
+ TReal iVideoNightFrameRate;
+ // Video bitrate scaler for remaining time calculation during
+ // first 3seconds.
+ TReal iCMRAvgVideoBitRateScaler;
+ // Video Complexity Setting
+ TInt iVideoComplexitySetting;
+ // Quality is more important in camcorder than delay
+ TReal iCMRLatencyQualityTradeoff;
+ // range is [0...100]
+ TUint iCMRPictureQuality;
+ // Try to maintain the frame-rate,
+ // 1.0 means the picture quality is sacrificed
+ // "all the way" to match the target fps
+ TReal iCMRQualityTemporalTradeoff;
+ // number of camera buffers to use when using HW accelerated encoder
+ TUint iCMRNumCameraBuffers;
+ // number of camera buffers to use when using SW encoder
+ TUint iCMRNumCameraBuffersARM;
+ // min number of output (bitstream) buffers
+ TUint iCMRMinNumOutputBuffers;
+ };
+
+/**
+ * Fake API class for emulate imaging configurations and settings
+ */
+class CImagingConfigManager : public CBase
+ {
+ public:
+
+ // two phase constructor
+ static CImagingConfigManager* NewL();
+
+
+ // Destructor
+ ~CImagingConfigManager();
+
+ // Returns number of video quality levels
+ TInt NumberOfVideoQualityLevels() const;
+
+ // Get video quality levels
+ TInt GetVideoQualityLevelsL( CArrayFixFlat<TUint>& aLevels,
+ TUint aCameraDisplayID = 0 );
+
+ /// returns video quality set and symbian error code if any.
+ TInt GetVideoQualitySet( TVideoQualitySet& aSet,
+ TInt aLevel,
+ TUint aCameraDisplayID = 0 );
+
+ // Get all settings for Camcorder
+ TInt GetCamcorderMMFPluginSettings(TCamcorderMMFPluginSettings& aSet) const;
+
+ // returns number of image quality levels
+ TInt NumberOfImageQualityLevels() const;
+
+ // Get image quality levels
+ TInt GetImageQualityLevelsL( CArrayFixFlat<TUint>& aLevels,
+ TUint aCameraDisplayID = 0 );
+
+ // Get image quality set
+ TInt GetImageQualitySet( TImageQualitySet& aSet,
+ TInt aLevel,
+ TUint aCameraDisplayID = 0 );
+
+ private:
+ CImagingConfigManager();
+ // helper method to init image quality set
+ void initImageQualitySet(TImageQualitySet& aSet);
+ void initVideoQualitySet(TVideoQualitySet& aSet);
+ private:
+ CArrayFixFlat< TVideoQualitySet >* iVideoQualitySets;
+ CArrayFixFlat< TImageQualitySet >* iImageQualitySets;
+
+ };
+
+#endif //IMAGINGCONFIGMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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 <e32err.h>
+#include "rlocationtrail.h"
+
+RLocationTrail::RLocationTrail()
+ : mTrailConnected(false), mTrailStarted(false)
+{
+}
+
+RLocationTrail::~RLocationTrail()
+{
+}
+
+int RLocationTrail::StartLocationTrail(TTrailCaptureSetting /*aState*/)
+{
+ int err = KErrNone;
+
+ if (mTrailConnected) {
+ mTrailStarted = true;
+ } else {
+ err = KErrGeneral;
+ }
+
+ return err;
+}
+
+int RLocationTrail::StopLocationTrail()
+{
+ int err = KErrNone;
+ if (!mTrailConnected || !mTrailStarted) {
+ err = KErrGeneral;
+ } else {
+ mTrailStarted = false;
+ }
+ return err;
+}
+
+
+
+int RLocationTrail::Connect()
+{
+ mTrailConnected = true;
+ return KErrNone;
+}
+
+
+void RLocationTrail::Close()
+{
+ mTrailConnected = false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006-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: An interface to Location Trail.
+*
+*/
+
+#ifndef R_RLOCATIONTRAIL_H
+#define R_RLOCATIONTRAIL_H
+
+
+/**
+ * Fake implementation of RLocationManager class which is used for creating a Location Manager session.
+ * Location Manager is used to start and stop the location trail, retrieve
+ * location information and write the location information to images.
+*/
+class RLocationTrail
+ {
+public:
+ /**
+ * Location trail states.
+ */
+ enum TTrailState
+ {
+ ETrailStopped,
+ EWaitingGPSData,
+ ESearchingGPS,
+ ETrailStarted,
+ ETrailStopping,
+ ETrailStarting
+ };
+
+ enum TTrailCaptureSetting
+ {
+ EOff,
+ ECaptureNetworkInfo,
+ ECaptureAll
+ };
+
+public:
+ RLocationTrail();
+
+ ~RLocationTrail();
+
+ /**
+ * Starts recording location information to location trail.
+ * @since S60 3.2
+ * @param aState, an enumeration of ECaptureNetworkInfo
+ * (only cell ID stored) and ECaptureAll
+ * (GPS coordinates and cell ID stored).
+ * @return KErrNone if successful, otherwise one of the other
+ * system-wide error codes.
+ */
+ int StartLocationTrail(TTrailCaptureSetting aState);
+
+ /**
+ * Stops recording location information to location trail.
+ * @since S60 3.1
+ * @param None.
+ * @return KErrNone if successful, otherwise one of the other
+ * system-wide error codes.
+ */
+ int StopLocationTrail();
+
+
+ /**
+ * Connect to location trail server
+ * @return KErrNone if successful, otherwise one of the other
+ * system-wide error codes.
+ **/
+ int Connect();
+
+ void Close();
+
+private:
+ bool mTrailConnected;
+ bool mTrailStarted;
+ };
+
+#endif // R_RLOCATIONTRAIL_H
+
+//End of File
--- a/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -54,7 +54,6 @@
int ThumbnailManager::getThumbnail(const QString& filename, void * clientData, int priority)
{
CX_DEBUG_ENTER_FUNCTION();
-
Q_UNUSED(priority);
int id = 0;
@@ -80,6 +79,7 @@
{
Q_UNUSED(clientData);
Q_UNUSED(priority);
+ Q_UNUSED(source);
int status = KErrNone;
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Wed Aug 18 09:37:18 2010 +0300
@@ -31,7 +31,6 @@
unittest_cxestillimagesymbian \
unittest_cxeimagedataitemsymbian \
unittest_cxeerrormappersymbian \
- unittest_cxesettingsmodelimp \
unittest_cxefilesavethreadsymbian \
unittest_cxesettingscenrepstore \
unittest_cxestillcapturecontrolsymbian \
@@ -39,11 +38,14 @@
unittest_cxefeaturemanagerimp \
unittest_cxeenginesymbian \
unittest_cxesettingsimp \
+ unittest_cxescenemodestore \
unittest_cxequalitypresetssymbian \
unittest_cxethumbnailmanagersymbian \
unittest_cxeharvestercontrolsymbian \
unittest_cxesettingscontrolsymbian \
unittest_cxesnapshotcontrol \
- unittest_cxegeotaggingtrail
+ unittest_cxegeotaggingtrail \
+ unittest_cxediskmonitor \
+ unittest_cxememorymonitor
CONFIG *= ordered
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest.pri Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest.pri Wed Aug 18 09:37:18 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"
@@ -33,6 +33,8 @@
symbian {
TARGET.CAPABILITY = ALL -TCB -DRM
RSS_RULES = "group_name=\"Qt Camera\";"
+
+ DEFINES += CAMERAX_ENGINE_LIBRARY
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/cxeautofocuscontrolsymbianunit.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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 "cxeautofocuscontrolsymbianunit.h"
+#include "cxecameradevice.h"
+#include "cxesettings.h"
+
+CxeAutoFocusControlSymbianUnit::CxeAutoFocusControlSymbianUnit(CxeCameraDevice &cameraDevice, CxeSettings &settings)
+: CxeAutoFocusControlSymbian(cameraDevice, settings)
+{
+
+}
+
+CxeAutoFocusControlSymbianUnit::~CxeAutoFocusControlSymbianUnit()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/cxeautofocuscontrolsymbianunit.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 CXEAUTOFOCUSCONTROLSYMBIANUNIT_H_
+#define CXEAUTOFOCUSCONTROLSYMBIANUNIT_H_
+
+#include "cxeautofocuscontrolsymbian.h"
+
+/*
+ * CxeAutoFocusControlSymbianUnit is inherited from
+ * the class to be tested (CxeAutoFocusControlSymbian) so that
+ * the tester class (UnitTestCxeAutoFocusControlSymbian) can be declared
+ * as friend.
+ */
+
+class CxeCameraDevice;
+class CxeSettings;
+
+class CxeAutoFocusControlSymbianUnit: public CxeAutoFocusControlSymbian
+{
+public:
+ CxeAutoFocusControlSymbianUnit(CxeCameraDevice &cameraDevice, CxeSettings &settings);
+ virtual ~CxeAutoFocusControlSymbianUnit();
+
+ friend class UnitTestCxeAutoFocusControlSymbian;
+};
+
+#endif /* CXEAUTOFOCUSCONTROLSYMBIANUNIT_H_ */
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -24,8 +24,9 @@
#include "cxefakecameradevicecontrol.h"
#include "cxefakecameradevice.h"
#include "cxefakesettings.h"
-#include "cxeautofocuscontrolsymbian.h"
+#include "cxeautofocuscontrolsymbianunit.h"
#include "unittest_cxeautofocuscontrolsymbian.h"
+#include "cxenamespace.h"
UnitTestCxeAutoFocusControlSymbian::UnitTestCxeAutoFocusControlSymbian()
: mAutoFocusControl(NULL),
@@ -33,17 +34,19 @@
mCameraDevice(NULL),
mFakeSettings(NULL)
{
+ qRegisterMetaType<CxeError::Id>("CxeError::Id");
+ qRegisterMetaType<CxeAutoFocusControl::State>("CxeAutoFocusControl::State");
+ qRegisterMetaType<CxeAutoFocusControl::Mode>("CxeAutoFocusControl::Mode");
}
UnitTestCxeAutoFocusControlSymbian::~UnitTestCxeAutoFocusControlSymbian()
{
- cleanup();
}
// Run before each individual test case
void UnitTestCxeAutoFocusControlSymbian::init()
{
- qDebug() << "UnitTestCxeAutoFocusControlSymbian::init =>";
+ CX_DEBUG_ENTER_FUNCTION();
mFakeSettings = new CxeFakeSettings();
@@ -51,19 +54,22 @@
mCameraDevice = new CxeFakeCameraDevice();
mCameraDevice->newCamera(mCameraDeviceControl->cameraIndex(), mCameraDeviceControl);
- mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, *mFakeSettings);
- //mAutoFocusControl->initializeResources();
+ mAutoFocusControl = new CxeAutoFocusControlSymbianUnit(*mCameraDevice, *mFakeSettings);
- connect(mCameraDeviceControl, SIGNAL(cameraEvent(int,int)),
- mAutoFocusControl, SLOT(handleCameraEvent(int,int)));
+ // make sure that initialization is correct
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Hyperfocal);
+ QCOMPARE(mAutoFocusControl->isSoundEnabled(), false);
+ QCOMPARE(mAutoFocusControl->supported(), true);
- qDebug() << "UnitTestCxeAutoFocusControlSymbian::init <=";
+ CX_DEBUG_EXIT_FUNCTION();
}
// Run after each individual test case
void UnitTestCxeAutoFocusControlSymbian::cleanup()
{
- qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup =>";
+ CX_DEBUG_ENTER_FUNCTION();
+
delete mAutoFocusControl;
mAutoFocusControl = NULL;
@@ -76,52 +82,124 @@
delete mFakeSettings;
mFakeSettings = NULL;
- qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup <=";
+ CX_DEBUG_EXIT_FUNCTION();
}
void UnitTestCxeAutoFocusControlSymbian::testStart()
{
- QVERIFY(mAutoFocusControl->state() == CxeAutoFocusControl::Unknown);
- mAutoFocusControl->start();
- QVERIFY(mAutoFocusControl->state() == CxeAutoFocusControl::InProgress);
- QVERIFY(CxeTestUtils::waitForState<CxeAutoFocusControl>(*mAutoFocusControl, CxeAutoFocusControl::Ready, 500));
+ // start takes a boolean input and returns CxeError
+ // functionality depends on current state and current autofocus mode
+
+ QSignalSpy stateSpy(mAutoFocusControl,
+ SIGNAL(stateChanged(CxeAutoFocusControl::State,
+ CxeError::Id)));
+
+ CxeError::Id returnValue = CxeError::None;
+ // 1) Default input after initialisation (fixed focus) -> nothing should happen
+ returnValue = mAutoFocusControl->start();
+ // verifying the result:
+ QVERIFY(returnValue == CxeError::None);
+ QCOMPARE(mAutoFocusControl->isSoundEnabled(), true); // check for input paramete
+ // no state changes
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+
+ // 2) Input parameter false is handled correctly
+ // prequisites: not fixed mode & unknown state -> normal functionality
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto); // non-fixed
+ // function call
+ returnValue = mAutoFocusControl->start(false);
+ // verifying the result:
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress);
+ QCOMPARE(returnValue, CxeError::None);
+ QCOMPARE(mAutoFocusControl->isSoundEnabled(), false); // check for input parameter
+
+ // 3) Autofocus is not ready (state is cancelling or in progress)
+ // prequisites:
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Macro); // non-fixed mode
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress);
+ // start should return CxeError::InUse
+ returnValue = mAutoFocusControl->start();
+ QCOMPARE(returnValue, CxeError::InUse);
+
+ // 4) Camera has been released
+ mAutoFocusControl->prepareForCameraDelete();
+ stateSpy.clear();
+ returnValue = mAutoFocusControl->start();
+ // result: no signal should be emitted
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+ QCOMPARE(returnValue, CxeError::None); // should there be and error here?
}
void UnitTestCxeAutoFocusControlSymbian::testCancel()
{
+ // create signalspy to monitor that state changed signal
+ QSignalSpy spy(mAutoFocusControl,
+ SIGNAL(stateChanged(CxeAutoFocusControl::State,
+ CxeError::Id)));
+
+ // 1) after initialisation cancel does nothing
+ mAutoFocusControl->cancel();
+ // no state changes
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+
+ // 2) When in fixed focus mode, cancel does nothing
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto); // non fixed mode so that start works
mAutoFocusControl->start();
- QVERIFY(mAutoFocusControl->state() == CxeAutoFocusControl::InProgress);
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); //verify start state
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Infinity); // fixed mode
+ spy.clear();
+ mAutoFocusControl->cancel();
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress);
+
+ // 3) InProgress state and "normal cancel"
+ // set mode back to non fixed mode
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto);
mAutoFocusControl->cancel();
- QVERIFY(mAutoFocusControl->state() == CxeAutoFocusControl::Canceling);
- QVERIFY(CxeTestUtils::waitForState<CxeAutoFocusControl>(*mAutoFocusControl, CxeAutoFocusControl::Unknown, 500));
+ // -> state is changed to Canceling
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Canceling);
+ // -> focustype set correctly
+ QVERIFY(mAutoFocusControl->focusType()
+ == CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff);
+
+ // 4) Canceling state (reached when calling canceling twice in a row,
+ // now already in canceling state after previous test)
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Canceling);
+ mAutoFocusControl->cancel();
+ // -> state or focustype is not changing
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Canceling);
+ QVERIFY(mAutoFocusControl->focusType()
+ == CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff);
+
+ // 5) Ready state (cancel called after start has been called and focus
+ // found)
+ // force state to ready in order to test canceling
+ mAutoFocusControl->setState(CxeAutoFocusControl::Unknown);
+ mAutoFocusControl->start(); // changes to in progress + sets focus type & range
+ mAutoFocusControl->setState(CxeAutoFocusControl::Ready);
+ mAutoFocusControl->cancel();
+ // state is changed to canceling
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Canceling);
+
}
-void UnitTestCxeAutoFocusControlSymbian::testMode()
-{
- mAutoFocusControl->setMode(CxeAutoFocusControl::Auto);
- QVERIFY(mAutoFocusControl->mode() == CxeAutoFocusControl::Auto);
-
- mAutoFocusControl->setMode(CxeAutoFocusControl::Hyperfocal);
- QVERIFY(mAutoFocusControl->mode() == CxeAutoFocusControl::Hyperfocal);
-
- mAutoFocusControl->setMode(CxeAutoFocusControl::Macro);
- QVERIFY(mAutoFocusControl->mode() == CxeAutoFocusControl::Macro);
-
- mAutoFocusControl->setMode(CxeAutoFocusControl::Infinity);
- QVERIFY(mAutoFocusControl->mode() == CxeAutoFocusControl::Infinity);
-
- mAutoFocusControl->setMode(CxeAutoFocusControl::Portrait);
- 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);
+ // default value (hyperfocal)
+ QCOMPARE(mAutoFocusControl->isFixedFocusMode(mAutoFocusControl->mode()), true);
+
+ // set non fixed focus mode
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto);
+ QCOMPARE(mAutoFocusControl->isFixedFocusMode(mAutoFocusControl->mode()), false);
+
+ // set fixed focus mode
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Infinity);
+ QCOMPARE(mAutoFocusControl->isFixedFocusMode(mAutoFocusControl->mode()), true);
+
}
void UnitTestCxeAutoFocusControlSymbian::testSupported()
@@ -131,6 +209,242 @@
}
+void UnitTestCxeAutoFocusControlSymbian::testPrepareForCameraDelete()
+{
+ // prepareCameraDelete calls prepareCameraRelease plus sets advanced
+ // settings false (supported() will return false)
+ // this test is for both methods
+
+ // 1) initial values
+ mAutoFocusControl->prepareForCameraDelete();
+ QCOMPARE(mAutoFocusControl->supported(), false);
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+
+ // 2) test prepareForCameraDelete with non-initial values
+ mAutoFocusControl->handleCameraAllocated(CxeError::None);
+ // force state to be something else than Unknown and check that it will be changed
+ mAutoFocusControl->setState(CxeAutoFocusControl::Canceling);
+ // force mCancelled to be false and check that it will be changed
+ mAutoFocusControl->mCancelled = true;
+ mAutoFocusControl->prepareForCameraDelete();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+ QCOMPARE(mAutoFocusControl->mCancelled, false);
+ QCOMPARE(mAutoFocusControl->supported(), false);
+
+}
+
+void UnitTestCxeAutoFocusControlSymbian::testHandleCameraAllocated()
+{
+ // create signalspy to monitor that state changed signal
+ QSignalSpy stateSpy(mAutoFocusControl,
+ SIGNAL(stateChanged(CxeAutoFocusControl::State,
+ CxeError::Id)));
+
+ // 1) initial setup without an error (camera is allocated already)
+ mAutoFocusControl->handleCameraAllocated(CxeError::None);
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+ QCOMPARE(mAutoFocusControl->supported(), true);
+
+ // 2) release camera and call with an error code
+ // -> supported should return false since initializeResources is not called in error case
+ // -> state is not changed
+ mAutoFocusControl->prepareForCameraDelete();
+ stateSpy.clear();
+ mAutoFocusControl->handleCameraAllocated(CxeError::General);
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+ QCOMPARE(mAutoFocusControl->supported(), false);
+
+ // 3) release camera and call without an error
+ // (prepareForCameraDelete has been called in previous test)
+ // -> resources are initialized i.e. supported returns true
+ // first force state to something else so state change can be verified
+ mAutoFocusControl->setState(CxeAutoFocusControl::Canceling);
+ mAutoFocusControl->handleCameraAllocated(CxeError::None);
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+ QCOMPARE(mAutoFocusControl->supported(), true);
+
+}
+
+void UnitTestCxeAutoFocusControlSymbian::testPrepareForRelease()
+{
+ // see testPrepareForCameraDelete
+}
+
+void UnitTestCxeAutoFocusControlSymbian::testHandleCameraEvent()
+{
+ // handleCameraEvent handles callbacks and gets information about
+ // focus events. handleCameraEvent calls private method handleAfEvent
+ // for the focusing events that CxeAutoFocusControlSymbian needs
+
+ // testing handleAfEvent is done by calling handleCameraEvent
+ // and monitoring state changes after each "event"
+
+ QSignalSpy stateSpy(mAutoFocusControl,
+ SIGNAL(stateChanged(CxeAutoFocusControl::State,
+ CxeError::Id)));
+
+
+ // Input 1 ----------------------------------------------------
+ // Optimal focus was reached or couldn't be found
+ int eventUid = KUidECamEventCameraSettingsOptimalFocusUidValue;
+ int symbianError = 0; //KErrNone
+
+ // AutofocusControl class is not InProgress or Canceling state
+ // => event ignored, nothing is changed
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+
+ // AutoFocusControl is InProgress state (waiting for the focus)
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto); // not fixed focus
+ mAutoFocusControl->start();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); //verify start state
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ // => state should change to Ready
+ QVERIFY(CxeTestUtils::waitForSignal(stateSpy, 1000));
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Ready);
+
+ // InProgress state but focus fails
+ mAutoFocusControl->start();
+ stateSpy.clear();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); //verify start state
+ mAutoFocusControl->handleCameraEvent(eventUid, -18); // KErrNotReady
+ // => state should change to Failed
+ QVERIFY(CxeTestUtils::waitForSignal(stateSpy, 1000));
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Failed);
+
+ // AutoFocusControl is in Canceling state
+ mAutoFocusControl->start();
+ mAutoFocusControl->cancel();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Canceling); //verify start state
+ stateSpy.clear();
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ // => state should change to Unknown
+ QVERIFY(CxeTestUtils::waitForSignal(stateSpy, 1000));
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+
+ // cleanup and init to make sure that the dummy engine is not messed up
+ // and we get to initial state
+ cleanup();
+ init();
+
+ // Input 2 -----------------------------------------------------
+ // Notifies a change in autofocus type
+ eventUid = KUidECamEventCameraSettingAutoFocusType2UidValue;
+ symbianError = -18; // == KErrNotReady
+
+ // InProgress: event is ignored
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto); // not fixed focus
+ mAutoFocusControl->start();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); //verify start state
+ stateSpy.clear();
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+
+ // Canceling:
+ // error parameter is ignored, state is not changed
+ mAutoFocusControl->cancel();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Canceling); //verify start state
+ stateSpy.clear();
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+
+ // cleanup and init to make sure that the dummy engine is not messed up
+ // and we get to initial state
+ cleanup();
+ init();
+
+ // Input 3 -----------------------------------------------------
+ // Focus range have changed
+ eventUid = KUidECamEventCameraSettingFocusRangeUidValue;
+ symbianError = -2; // == KErrGeneral
+
+ // In any other state than InProgress this event is ignored
+ stateSpy.clear();
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ QVERIFY(!CxeTestUtils::waitForSignal(stateSpy, 1000));
+
+ // InProgress: because of the error parameter state changes to failed
+ // (focus range change failed because of error)
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Auto); // not fixed focus
+ mAutoFocusControl->start();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); //verify start state
+ mAutoFocusControl->handleCameraEvent(eventUid, symbianError);
+ // => state should change to Failed
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Failed);
+}
+
+void UnitTestCxeAutoFocusControlSymbian::testHandleSceneChanged()
+{
+ // changes the autofocus settings to match the new scene settings
+ QVariantMap scene;
+
+ // changes focus if new scene setting defines fixed focus
+ // otherwise sets the autofocus control to Unknown state (==initial state)
+
+ // 1) change to a scene with fixed focus mode (Infinity & Hyperfocal)
+ scene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Infinity);
+ mAutoFocusControl->handleSceneChanged(scene);
+ // states are changed and mode is set correctly ->Unknown->InProgress
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); // end state
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Infinity);
+
+ // 2) change to non-fixed mode (like Macro)
+ scene.clear();
+ scene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Macro);
+ mAutoFocusControl->handleSceneChanged(scene);
+ // states are changed and mode is set correctly
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Macro);
+
+ // 3) try with error input (scene does not contain focal_range)
+ scene.clear();
+ // change the autofocuscontrol state from Unknown (last test) to
+ // something else calling start() for example
+ mAutoFocusControl->start();
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::InProgress); //verify start state
+ mAutoFocusControl->handleSceneChanged(scene);
+ // state is changed and mode is not changed
+ QCOMPARE(mAutoFocusControl->state(), CxeAutoFocusControl::Unknown);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Macro);
+
+}
+
+void UnitTestCxeAutoFocusControlSymbian::testHandleSettingValueChanged()
+{
+ // Autofocus mode needs to be updated when face trackin is actived in
+ // scene mod which doesn't support facetracking
+
+ QVariant on = QVariant(1);
+ QVariant off = QVariant(0);
+
+ // 1) check that mode does not change when some other setting value
+ // than face tracking is given
+ mAutoFocusControl->handleSettingValueChanged(CxeSettingIds::LIGHT_SENSITIVITY, on);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Hyperfocal);
+
+ // 2) check turning facetracking on, when mode is fixed
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Infinity);
+ mAutoFocusControl->handleSettingValueChanged(CxeSettingIds::FACE_TRACKING, on);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Auto);
+ QCOMPARE(mAutoFocusControl->mFaceTrackingOverride, true);
+
+ // 3) check turning facetracking off will return the previous mode
+ mAutoFocusControl->handleSettingValueChanged(CxeSettingIds::FACE_TRACKING, off);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Infinity);
+ QCOMPARE(mAutoFocusControl->mFaceTrackingOverride, false);
+
+ // 4) check that turning facetracking off, when it is not on, won't
+ // set the previous mode
+ mAutoFocusControl->setMode(CxeAutoFocusControl::Macro);
+ mAutoFocusControl->handleSettingValueChanged(CxeSettingIds::FACE_TRACKING, off);
+ QCOMPARE(mAutoFocusControl->mode(), CxeAutoFocusControl::Macro);
+ QCOMPARE(mAutoFocusControl->mFaceTrackingOverride, false);
+
+
+}
+
+
+
// main() function - Need event loop for waiting signals,
// so can't use QTEST_APPLESS_MAIN.
QTEST_MAIN(UnitTestCxeAutoFocusControlSymbian);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Wed Aug 18 09:37:18 2010 +0300
@@ -21,7 +21,7 @@
#include "cxenamespace.h"
-class CxeAutoFocusControlSymbian;
+class CxeAutoFocusControlSymbianUnit;
class CxeFakeCameraDeviceControl;
class CxeFakeCameraDevice;
class CxeFakeSettings;
@@ -40,21 +40,28 @@
void testStart();
void testCancel();
- void testMode();
+
void testIsFixedFocusMode();
+ void testSupported();
- void testSupported();
+ // tests for protected slots?
+ void testPrepareForCameraDelete();
+ void testHandleCameraAllocated();
+ void testPrepareForRelease();
+ void testHandleCameraEvent();
+ void testHandleSceneChanged();
+ void testHandleSettingValueChanged();
private:
// Helper methods for test cases
private:
-
// Need to test with derived class to hide missing ECAM.
- CxeAutoFocusControlSymbian *mAutoFocusControl;
+ CxeAutoFocusControlSymbianUnit *mAutoFocusControl;
CxeFakeCameraDeviceControl *mCameraDeviceControl;
CxeFakeCameraDevice *mCameraDevice;
CxeFakeSettings *mFakeSettings;
+
};
#endif // UNITTEST_CXEAUTOFOCUSCONTROLSYMBIAN_H
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -24,6 +24,7 @@
SOURCES *= unittest_cxeautofocuscontrolsymbian.cpp \
cxeautofocuscontrolsymbian.cpp \
+ cxeautofocuscontrolsymbianunit.cpp \
cxestatemachine.cpp \
cxestate.cpp \
cxestatemachinebase.cpp \
@@ -39,6 +40,7 @@
HEADERS *= unittest_cxeautofocuscontrolsymbian.h \
cxeautofocuscontrol.h \
cxeautofocuscontrolsymbian.h \
+ cxeautofocuscontrolsymbianunit.h \
cxestatemachine.h \
cxestate.h \
cxestatemachinebase.h \
@@ -52,4 +54,5 @@
cxefakecameradevicecontrol.h \
cxutils.h \
cxefakesettings.h \
- cxesettings.h
+ cxesettings.h \
+ cxenamespace.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/cxecameradevicecontrolunit.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/cxecameradevicecontrolunit.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -18,7 +18,6 @@
#include "cxefakecameradevice.h"
#include "cxesettingsimp.h"
#include "cxefeaturemanagerimp.h"
-#include "cxesettingsmodel.h"
#include "cxutils.h"
#include "cxenamespace.h"
#include "cxeerrormappingsymbian.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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.
+ *
+ */
+bool CxeSysUtil::DiskSpaceBelowCriticalLevel(
+ RFs* /*aFs*/,
+ TInt aBytesToWrite,
+ TInt /*aDrive*/ )
+{
+ CX_DEBUG_IN_FUNCTION();
+
+ return (aBytesToWrite <= 0);
+}
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.h Wed Aug 18 09:37:18 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 <e32base.h>
+#include <QObject>
+
+class RFs;
+class CxeSettings;
+
+class CxeSysUtil
+ {
+
+public:
+
+ static bool 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.cpp Wed Aug 18 09:37:18 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 <QDate>
+#include <QTest>
+#include <QDebug>
+#include <QSignalSpy>
+#include <QThread>
+
+#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);
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.h Wed Aug 18 09:37:18 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 <QObject>
+
+#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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.pro Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,34 @@
+# 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
+
+LIBS += -lcone
+
+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
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/cxeenginesymbianunit.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -27,7 +27,7 @@
#include "cxefakesensoreventhandler.h"
#include "cxefakefilenamegenerator.h"
#include "cxutils.h"
-#include "cxefakesettingsmodel.h"
+
// Member Functions
@@ -52,8 +52,6 @@
if (!mVideoCaptureControl) {
mCameraDeviceControl = new CxeFakeCameraDeviceControl();
- mSettings = new CxeFakeSettings();
-
mFeatureManager = new CxeFakeFeatureManager();
mSensorEventHandler = new CxeFakeSensorEventHandler();
@@ -70,8 +68,6 @@
mVideoCaptureControl = new CxeFakeVideoCaptureControl();
- mSettingsModel = new CxeFakeSettingsModel();
-
mFeatureManager = new CxeFakeFeatureManager();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -44,6 +44,10 @@
LIBS *= -lxqserviceutil
LIBS *= -loommonitor
LIBS += -llocationmanager
+LIBS += -lcone
+LIBS *= -lws32
+LIBS += -lgdi
+LIBS += -lhal
SOURCES *= unittest_cxeenginesymbian.cpp \
@@ -67,7 +71,6 @@
cxestatemachine.cpp \
cxestatemachinebase.cpp \
cxestate.cpp \
- cxesettingsmodelimp.cpp \
cxesettingscenrepstore.cpp \
cxefilenamegeneratorsymbian.cpp \
cxefakefilenamegenerator.cpp \
@@ -104,15 +107,16 @@
cxememorymonitorprivate.cpp \
cxesnapshotcontrol.cpp \
cxesnapshotcontrolprivate.cpp \
- cxefakesettingsmodel.cpp \
cxegeotaggingtrail.cpp \
- cxegeotaggingtrailprivate.cpp
+ cxegeotaggingtrail_symbian_p.cpp \
+ cxescenemodestore.cpp
HEADERS *= unittest_cxeenginesymbian.h \
cxeenginesymbianunit.h \
cxeenginesymbian.h \
+ cxengine_global.h \
cxeengine.h \
cxeautofocuscontrol.h \
cxeautofocuscontrolsymbian.h \
@@ -140,7 +144,6 @@
cxesettings.h \
cxesettingsimp.h \
cxefakesettings.h \
- cxesettingsmodel.h \
cxesettingscenrepstore.h \
cxesettingsmappersymbian.h \
cxesettingscontrolsymbian.h \
@@ -181,6 +184,6 @@
cxememorymonitorprivate.h \
cxesnapshotcontrol.h \
cxesnapshotcontrolprivate.h \
- cxefakesettingsmodel.h \
cxegeotaggingtrail.h \
- cxegeotaggingtrailprivate.h
+ cxegeotaggingtrail_symbian_p.h \
+ cxescenemodestore.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -18,9 +18,9 @@
#include <QTest>
#include "unittest_cxefeaturemanagerimp.h"
-#include "cxefakesettingsmodel.h"
#include "cxefeaturemanagerimp.h"
#include "cxenamespace.h"
+#include "cxesettings.h"
static const char* INVALID_KEY = "invalid key";
@@ -28,7 +28,7 @@
UnitTestCxeFeatureManager::UnitTestCxeFeatureManager()
-: mFakeSettingsModel(NULL), mFeatureManager(NULL)
+: mFeatureManager(NULL)
{
}
@@ -41,16 +41,12 @@
void UnitTestCxeFeatureManager::init()
{
// fake model contains initialized test data.
- mFakeSettingsModel = new CxeFakeSettingsModel();
- mFeatureManager = new CxeFeatureManagerImp(*mFakeSettingsModel);
+ mFeatureManager = new CxeFeatureManagerImp(*mSettings);
}
// Run after each individual test case
void UnitTestCxeFeatureManager::cleanup()
{
- delete mFakeSettingsModel;
- mFakeSettingsModel = 0;
-
delete mFeatureManager;
mFeatureManager = 0;
}
@@ -73,7 +69,7 @@
QCOMPARE(err, CxeError::NotFound);
// test with right key
- key = CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS;
+ key = CxeVariationKeys::STILL_MAX_ZOOM_LIMITS;
err = mFeatureManager->isFeatureSupported(key, isSupported);
QVERIFY(isSupported);
QCOMPARE(err, CxeError::None);
@@ -99,7 +95,7 @@
QCOMPARE(values.count(), 0);
// case 3: test with right key
- key = CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS;
+ key = CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS;
err = mFeatureManager->configuredValues(key, values);
QCOMPARE(err, CxeError::None);
QVERIFY(values.count() > 0);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h Wed Aug 18 09:37:18 2010 +0300
@@ -19,8 +19,8 @@
#include <QObject>
-class CxeFakeSettingsModel;
class CxeFeatureManagerImp;
+class CxeSettings;
class UnitTestCxeFeatureManager : public QObject
{
@@ -38,8 +38,8 @@
void testconfiguredValues();
private:
- CxeFakeSettingsModel *mFakeSettingsModel;
CxeFeatureManagerImp *mFeatureManager;
+ CxeSettings *mSettings;
};
#endif // UNITTEST_CXEFEATUREMANAGER_H
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro Wed Aug 18 09:37:18 2010 +0300
@@ -14,10 +14,8 @@
TARGET = unittest_cxefeaturemanagerimp
SOURCES *= unittest_cxefeaturemanagerimp.cpp \
- cxefeaturemanagerimp.cpp \
- cxefakesettingsmodel.cpp
+ cxefeaturemanagerimp.cpp
HEADERS *= unittest_cxefeaturemanagerimp.h \
cxefeaturemanagerimp.h \
- cxefakesettingsmodel.h \
cxeerror.h \
cxenamespace.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -41,8 +41,6 @@
// Run before each individual test case
void UnitTestCxeFilenameGeneratorSymbian::init()
{
- mFakeSettings = new CxeFakeSettings();
-
mFakeSettings->set(CxeSettingIds::FNAME_MONTH_FOLDER, QDate::currentDate().toString("yyyyMM"));
mFakeSettings->set(CxeSettingIds::FNAME_IMAGE_COUNTER, 0);
mFakeSettings->set(CxeSettingIds::FNAME_VIDEO_COUNTER, 0);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp Wed Aug 18 09:37:18 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,7 +23,6 @@
#include "unittest_cxefilesavethreadsymbian.h"
#include "cxefilesavethreadsymbian.h"
#include "cxefakeimagedataitem.h"
-#include "cxeimagedataitem.h"
#include "cxetestutils.h"
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -23,6 +23,7 @@
LIBS *= -lplatformenv
LIBS *= -lefsrv
LIBS *= -lcone
+LIBS *= -lthumbnailmanagerqt
SOURCES *= unittest_cxefilesavethreadsymbian.cpp \
thumbnailmanager_qt.cpp \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp Wed Aug 18 09:37:18 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,17 +30,12 @@
CX_DEBUG_IN_FUNCTION();
}
-int CxeImageDataItemUnit::checkDiskSpace(RFs* aFs,
- TInt aBytesToWrite,
- TInt aDrive)
+bool CxeImageDataItemUnit::checkDiskSpace(RFs* aFs,
+ TInt aBytesToWrite,
+ TInt aDrive)
{
- CX_DEBUG_ENTER_FUNCTION();
- int value = CxeFakeSysUtil::DiskSpaceBelowCriticalLevel(
- aFs,
- aBytesToWrite,
- aDrive );
-
- return value;
+ CX_DEBUG_IN_FUNCTION();
+ return CxeFakeSysUtil::DiskSpaceBelowCriticalLevel(aFs, aBytesToWrite, aDrive);
}
// end of file
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h Wed Aug 18 09:37:18 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,19 +31,16 @@
* CxeCameraDeviceControlSymbian except for that CxeFakeCameraDevice is used
* instead of the real implementation.
*/
-class CxeImageDataItemUnit : public CxeImageDataItemSymbian
+class CxeImageDataItemUnit : public CxeImageDataItemSymbian
{
- Q_OBJECT
+ Q_OBJECT
public:
CxeImageDataItemUnit(int index, QByteArray data, QString filename, bool addLocation);
virtual ~CxeImageDataItemUnit();
- int checkDiskSpace(RFs* aFs,
- TInt aBytesToWrite,
- TInt aDrive);
-
-protected: // from CxeImageDataItemSymbian
- //int save();
+ bool checkDiskSpace(RFs* aFs,
+ TInt aBytesToWrite,
+ TInt aDrive);
};
#endif // CXEFAKECAMERADEVICECONTROL_H
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp Wed Aug 18 09:37:18 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,6 +16,7 @@
*/
#include <QDate>
#include <QTest>
+#include <QDir>
#include <QDebug>
#include <QSignalSpy>
@@ -25,11 +26,14 @@
#include "cxeimagedataitemunit.h"
#include "cxestillimagesymbian.h"
#include "cxutils.h"
+#include "cxeerror.h"
UnitTestCxeImageDataItemSymbian::UnitTestCxeImageDataItemSymbian()
-: mImageDataItem(NULL)
+: mImageDataItem(NULL),
+ mImageCounter(-1)
{
+ qRegisterMetaType<CxeError::Id>("CxeError::Id");
}
UnitTestCxeImageDataItemSymbian::~UnitTestCxeImageDataItemSymbian()
@@ -37,27 +41,86 @@
delete mImageDataItem;
}
+/*!
+* Initializes resources.
+*/
void UnitTestCxeImageDataItemSymbian::init()
{
CX_DEBUG_ENTER_FUNCTION();
- TInt index = 0;
- mPath = generateImageFileName(index);
+ mFilename = generateImageFileName();
QByteArray data = "1234";
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, mFilename, false);
+ QVERIFY(mImageDataItem->state() == CxeImageDataItem::SavePending);
+ QCOMPARE(mImageDataItem->isLocationEnabled(), false);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
- mImageDataItem = new CxeImageDataItemUnit(index, data, mPath, false);
+/*!
+* cleans up resources for each test case
+*/
+void UnitTestCxeImageDataItemSymbian::cleanup()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ delete mImageDataItem;
+ mImageDataItem = NULL;
- QVERIFY(mImageDataItem->state() == CxeImageDataItem::SavePending);
CX_DEBUG_EXIT_FUNCTION();
}
-void UnitTestCxeImageDataItemSymbian::cleanup()
+
+
+/*!
+* Initializes resources before any test cases.
+*/
+void UnitTestCxeImageDataItemSymbian::initTestCase()
{
CX_DEBUG_ENTER_FUNCTION();
- delete mImageDataItem;
- mImageDataItem = NULL;
+
+ // create folder for storing temporary image files
+ QDir dir;
+ dir.mkpath(path());
+
CX_DEBUG_EXIT_FUNCTION();
}
+
+/*!
+* cleans up resources after last test case
+*/
+void UnitTestCxeImageDataItemSymbian::cleanupTestCase()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // remove temporary image files and folder
+ QDir dir;
+ QString filepath = path();
+ dir.setPath(filepath);
+
+ QStringList filters;
+ filters << "*.jpg";
+ dir.setNameFilters(filters);
+
+ QStringList filenames = dir.entryList(filters);
+
+ // delete temporary created files
+ foreach(const QString &file, filenames) {
+ dir.remove(filepath + file);
+ }
+
+ // delete the directory created for temporary saving image files.
+ dir.rmpath(filepath);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* UnitTestCxeImageDataItemSymbian::testState
+*/
void UnitTestCxeImageDataItemSymbian::testSave()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -66,75 +129,63 @@
QSignalSpy deviceStateSpy(mImageDataItem, SIGNAL(imageSaved(CxeError::Id, const QString&, int)));
QVERIFY(deviceStateSpy.isValid());
- int returnValue = mImageDataItem->save();
+ CxeError::Id err = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::Saved);
- QVERIFY(returnValue == KErrNone);
+ QCOMPARE(err, CxeError::None);
QCOMPARE( deviceStateSpy.count(), 1 );
if (deviceStateSpy.count() > 0) {
QList<QVariant> initModeArguments = deviceStateSpy.takeFirst();
- QVERIFY( initModeArguments.at(0).toInt() == CxeError::None );
- QVERIFY( initModeArguments.at(1).toString().compare(mPath) == 0);
+ QCOMPARE(initModeArguments.at(0).value<CxeError::Id>(), CxeError::None);
+ QVERIFY( initModeArguments.at(1).toString().compare(mFilename) == 0);
QVERIFY( initModeArguments.at(2).toInt() == id);
}
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-void UnitTestCxeImageDataItemSymbian::testSaveFail()
-{
- CX_DEBUG_ENTER_FUNCTION();
- int returnValue;
- int index = 1;
- QString path = NULL;
+ // try to test possible fail cases.
+ QString filename = NULL;
QByteArray data = "";
- returnValue = mImageDataItem->save();
- QVERIFY(mImageDataItem->state() == CxeImageDataItem::Saved);
- QVERIFY(returnValue == KErrArgument);
-
- delete mImageDataItem;
- mImageDataItem = NULL;
- mImageDataItem = new CxeImageDataItemUnit( index, data, path, false );
- returnValue = mImageDataItem->save();
+ CX_DEBUG(("UnitTestCxeImageDataItemSymbian::testSave <> Invalid arguments"));
+ cleanup();
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, filename, false);
+ err = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
- QVERIFY(returnValue == KErrArgument);
+
+ // Arugments are not valid, leaves with KErrArgument which is mapped internally to CxError::General.
+ QCOMPARE(err, CxeError::General);
- delete mImageDataItem;
- mImageDataItem = NULL;
- QString filename = generateImageFileNameWithLetter(++index, "C");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
- returnValue = mImageDataItem->save();
+ CX_DEBUG(("UnitTestCxeImageDataItemSymbian::testSave <> Invalid path"));
+ cleanup();
+ filename = dummyPath("C");
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, filename, false);
+ err = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
- QVERIFY(returnValue != KErrNone);
+ QVERIFY(err != CxeError::None);
- qDebug() << "UnitTestCxeImageDataItemSymbian::testSaveFail3 =>";
- delete mImageDataItem;
- mImageDataItem = NULL;
- filename = generateImageFileNameWithLetter(++index, "");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
- returnValue = mImageDataItem->save();
+ CX_DEBUG(("UnitTestCxeImageDataItemSymbian::testSave <> invalid drive"));
+ cleanup();
+ filename = dummyPath("");
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, filename, false);
+ err = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
- QVERIFY(returnValue != KErrNone);
+ QVERIFY(err != CxeError::None);
- qDebug() << "UnitTestCxeImageDataItemSymbian::testSaveFail4 =>";
- delete mImageDataItem;
- mImageDataItem = NULL;
- filename = generateImageFileNameWithLetter(++index, "12");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
- returnValue = mImageDataItem->save();
+ CX_DEBUG(("UnitTestCxeImageDataItemSymbian::testSave <> invalid drive - 2"));
+ cleanup();
+ filename = dummyPath("12");
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, filename, false);
+ err = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
- QVERIFY(returnValue != KErrNone);
+ QVERIFY(err != CxeError::None);
- qDebug() << "UnitTestCxeImageDataItemSymbian::testSaveFail5 =>";
- delete mImageDataItem;
- mImageDataItem = NULL;
- filename = generateImageFileNameWithLetter(++index, "Edata");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
- returnValue = mImageDataItem->save();
+ CX_DEBUG(("UnitTestCxeImageDataItemSymbian::testSave <> invalid drive - 3"));
+ cleanup();
+ filename = dummyPath("Edata");
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, filename, false);
+ err = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
- QVERIFY(returnValue != KErrNone);
+ QVERIFY(err != CxeError::None);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -142,33 +193,109 @@
void UnitTestCxeImageDataItemSymbian::testPath()
{
CX_DEBUG_ENTER_FUNCTION();
- QVERIFY(mImageDataItem->path().compare(mPath) == 0);
+ QVERIFY(mImageDataItem->path().compare(mFilename) == 0);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+
+/*!
+* UnitTestCxeImageDataItemSymbian::testState
+*/
+void UnitTestCxeImageDataItemSymbian::testState()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mImageDataItem->save();
+ QVERIFY(mImageDataItem->state() == CxeImageDataItem::Saved);
+ CX_DEBUG_EXIT_FUNCTION();
}
-QString UnitTestCxeImageDataItemSymbian::generateImageFileName(int counter)
+
+/*!
+* UnitTestCxeImageDataItemSymbian::testId
+*/
+void UnitTestCxeImageDataItemSymbian::testId()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // checking if initialization of image data item is successful.
+ QCOMPARE(mImageDataItem->id(), mImageCounter);
+ mImageDataItem->save();
+ QCOMPARE(mImageDataItem->id(), mImageCounter);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* UnitTestCxeImageDataItemSymbian::testIsLocationEnabled
+*/
+void UnitTestCxeImageDataItemSymbian::testIsLocationEnabled()
{
CX_DEBUG_ENTER_FUNCTION();
- QString monthName = QDate::currentDate().toString("yyyyMM");
+
+ // spl case to check if location is enabled
+ cleanup();
+ bool enableLocation(true);
+ QByteArray data = "1234";
+ QString filename = generateImageFileName();
+ mImageDataItem = new CxeImageDataItemUnit(mImageCounter, data, filename, enableLocation);
+ QCOMPARE(mImageDataItem->isLocationEnabled(), enableLocation);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Generates filename.
+* @param counter is associated with image file name.
+*/
+QString UnitTestCxeImageDataItemSymbian::generateImageFileName()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mImageCounter++;
QString filename;
- filename.sprintf("E:\\Images\\Camera\\%s\\%sA0\\%04d_Nokia5800.jpg",
- monthName.toAscii().data(),
- monthName.toAscii().data(),
- counter);
+ filename.sprintf("%04d_Nokia.jpg", mImageCounter);
+ filename = path() + filename;
+
CX_DEBUG_EXIT_FUNCTION();
return filename;
}
-QString UnitTestCxeImageDataItemSymbian::generateImageFileNameWithLetter(int counter, QString letter)
+/*!
+* Create path for saving images to be used in testcases.
+*/
+QString UnitTestCxeImageDataItemSymbian::path()
{
CX_DEBUG_ENTER_FUNCTION();
- QString monthName = QDate::currentDate().toString("yyyyMM");
+
+ QString path;
+
+#ifdef __WINSCW__
+ path.sprintf("c:\\data\\testimages\\");
+#else
+ path.sprintf("e:\\testimages\\");
+#endif
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return path;
+}
+
+
+
+/*!
+* Create a dummy invalid path for testcases.
+*/
+QString UnitTestCxeImageDataItemSymbian::dummyPath(const QString &drive)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mImageCounter++;
QString filename;
- filename.sprintf("%s:\\Images\\Camera\\%s\\%sA0\\%04d_Nokia5800.jpg",
- letter.toAscii().data(),
- monthName.toAscii().data(),
- monthName.toAscii().data(),
- counter);
+ filename.sprintf("%s:\\Dummy\\Camera\\%04d_Nokia.jpg",
+ drive.toAscii().data(),
+ mImageCounter);
CX_DEBUG_EXIT_FUNCTION();
return filename;
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.h Wed Aug 18 09:37:18 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"
@@ -33,19 +33,33 @@
~UnitTestCxeImageDataItemSymbian();
private slots:
+
+ // for every test case
void init();
+
+ // for every test case
void cleanup();
+
+ // before any test cases
+ void initTestCase();
+ // after last test case
+ void cleanupTestCase();
+
void testSave();
- void testSaveFail();
void testPath();
+ void testState();
+ void testId();
+ void testIsLocationEnabled();
private:
- QString generateImageFileName(int counter);
- QString generateImageFileNameWithLetter(int counter, QString letter);
+ QString generateImageFileName();
+ QString dummyPath(const QString &drive);
+ QString path();
private:
CxeImageDataItemSymbian *mImageDataItem; // This will be recreated for each test
- QString mPath;
+ QString mFilename;
+ int mImageCounter;
};
#endif // UNITTEST_CXEIMAGEDATAITEMSYMBIAN_H
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -49,4 +49,5 @@
unittest_cxeimagedataitemsymbian.h \
cxeimagedataitemunit.h \
cxesysutil.h \
- cxefakesysutil.h
+ cxefakesysutil.h \
+ cxeerror.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.cpp Wed Aug 18 09:37:18 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;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.h Wed Aug 18 09:37:18 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 <e32def.h>
+#include <e32property.h>
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal_data.h Wed Aug 18 09:37:18 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.cpp Wed Aug 18 09:37:18 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.h Wed Aug 18 09:37:18 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 <e32base.h>
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.cpp Wed Aug 18 09:37:18 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 <QDate>
+#include <QTest>
+#include <QDebug>
+#include <QThread>
+
+#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);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.h Wed Aug 18 09:37:18 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 <QObject>
+
+#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.pro Wed Aug 18 09:37:18 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
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -16,8 +16,11 @@
*/
#include <QTest>
+#include <QList>
-#include <QList>
+// "fake" system include
+#include "imagingconfigmanager.h"
+
#include "cxefakesettings.h"
#include "unittest_cxequalitypresetssymbian.h"
#include "cxequalitypresetssymbian.h"
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/unittest_cxequalitypresetssymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -13,6 +13,8 @@
TARGET = unittest_cxequalitypresetssymbian
+INCLUDEPATH *= ../system_include
+DEPENDPATH *= ../system_include
HEADERS *= unittest_cxequalitypresetssymbian.h \
cxequalitypresetssymbian.h \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -67,7 +67,6 @@
*/
void UnitTestCxeSettingsCenrepStore::testSettingValues()
{
- QString runtimekey = CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS;
QString settingkey = CxeSettingIds::FNAME_MONTH_FOLDER;
QString scenekey = CxeSettingIds::COLOR_TONE;
QVariant result;
@@ -75,10 +74,6 @@
CxeError::Id error;
// case 0: check default value of a runtime key, real setting key and scene key
- error = mSettingsCenrepStore->get(runtimekey, result);
- QVERIFY(error == CxeError::None);
- QCOMPARE(result.toInt(), 1);
-
error = mSettingsCenrepStore->get(settingkey, result);
QVERIFY(error == CxeError::None);
QCOMPARE(result.toInt(), 1);
@@ -89,9 +84,6 @@
// case 1: try setting a value to a run-time key and real setting key
- error = mSettingsCenrepStore->set(runtimekey, value);
- QVERIFY(error == CxeError::NotFound);
-
error = mSettingsCenrepStore->set(settingkey, value);
QVERIFY(error == CxeError::None);
@@ -124,11 +116,10 @@
void UnitTestCxeSettingsCenrepStore::testloadSettings()
{
QList<QString> keys;
- keys.append(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS);
- keys.append(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS);
- keys.append(CxeRuntimeKeys::SECONDARY_CAMERA_CAPTURE_KEYS);
- keys.append(CxeRuntimeKeys::FREE_MEMORY_LEVELS);
- QHash<QString, QVariantList> runtimesettings = mSettingsCenrepStore->loadRuntimeSettings(keys);
+ keys.append(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS);
+ keys.append(CxeVariationKeys::VIDEO_MAX_ZOOM_LIMITS);
+ keys.append(CxeVariationKeys::FREE_MEMORY_LEVELS);
+ QHash<QString, QVariantList> runtimesettings = mSettingsCenrepStore->loadVariationSettings(keys);
foreach(QString runtimekey, keys) {
QVariant result;
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -17,16 +17,24 @@
#include <QTest>
#include <QDebug>
#include <QSignalSpy>
+#include <QMetaType>
+#include "cxutils.h"
#include "cxetestutils.h"
-#include "cxefakesettingsmodel.h"
+#include "cxefakesettingsstore.h"
#include "unittest_cxesettingsimp.h"
+#include "cxecenrepkeys.h"
const char* FAIL_TEST_SETTING = "Fail test";
+const char* EMPTY_STRING = "";
+const int CAMERA_MODE_STILL = 0;
+const int CAMERA_MODE_VIDEO = 1;
+//Default EV compensation value for auto still and auto video scene mode
+const int SCENE_AUTO_EV_VALUE = 0;
+const int SIGNAL_TIMEOUT = 3000; //milliseconds
UnitTestCxeSettingsImp::UnitTestCxeSettingsImp() :
- mSettingsModel(NULL),
- mSettingsImp(NULL)
+ mSettingsImp(NULL), mSettingsStore(NULL)
{
qRegisterMetaType<CxeScene>("CxeScene");
qRegisterMetaType<CxeError::Id>("CxeError::Id");
@@ -35,416 +43,444 @@
UnitTestCxeSettingsImp::~UnitTestCxeSettingsImp()
{
- cleanup();
}
void UnitTestCxeSettingsImp::init()
{
- mSettingsModel = new CxeFakeSettingsModel;
- mSettingsImp = new CxeSettingsImp(*mSettingsModel);
+ mSettingsStore = new CxeFakeSettingsStore();
+ mSettingsImp = new CxeSettingsImp(mSettingsStore);
}
void UnitTestCxeSettingsImp::cleanup()
{
- delete mSettingsModel;
- mSettingsModel = NULL;
-
delete mSettingsImp;
mSettingsImp = NULL;
}
-void UnitTestCxeSettingsImp::testLoadSettings()
+/*
+ * Testing loadSettings() with Cxe::ImageMode argument
+ */
+void UnitTestCxeSettingsImp::testLoadImageSettings()
{
- Cxe::CameraMode mode;
+ CX_DEBUG_ENTER_FUNCTION();
+ QSignalSpy spy(mSettingsImp, SIGNAL(settingValueChanged(QString,QVariant)));
+ mSettingsImp->loadSettings(Cxe::ImageMode);
- /* Observe sceneChanged signal from mSettingsImp
- */
- CxeScene sigSce;
- QSignalSpy spyStateChange(mSettingsImp, SIGNAL(sceneChanged(CxeScene &)));
- QVERIFY( spyStateChange.isValid() );
+ //signal should be emitted when loading settings
+ QVERIFY(spy.count() > 0);
+
+ //now let's take a look inside a signal content
+ QList<QVariant> arguments = spy.takeFirst();
+ QVERIFY(arguments.at(0).toString().toAscii() == CxeSettingIds::IMAGE_SCENE);
+ CX_DEBUG_EXIT_FUNCTION();
+}
- /* Test load settings in camera/video mode. Helpper method is used to get the
- * new camera mode to test loadSettings method has set right camera mode
- */
- mSettingsImp->loadSettings(Cxe::ImageMode);
- mode = mSettingsModel->getDummyCameraMode();
- QCOMPARE(mode, Cxe::ImageMode);
- QVERIFY(CxeTestUtils::waitForSignal(spyStateChange, 1000)); // verify statechanges
+/*
+ * Testing loadSettings() with Cxe::VideoMode argument
+ */
+void UnitTestCxeSettingsImp::testLoadVideoSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QSignalSpy spy(mSettingsImp, SIGNAL(settingValueChanged(QString,QVariant)));
+ mSettingsImp->loadSettings(Cxe::VideoMode);
- mSettingsImp->loadSettings(Cxe::VideoMode);
- mode = mSettingsModel->getDummyCameraMode();
- QCOMPARE(mode, Cxe::VideoMode);
- QVERIFY(CxeTestUtils::waitForSignal(spyStateChange, 1000)); // verify statechanges
+ //signal should be emitted when loading settings
+ QVERIFY(spy.count() > 0);
+
+ //now let's take a look inside a signal content
+ QList<QVariant> arguments = spy.takeFirst();
+ QVERIFY(arguments.at(0).toString().toAscii() == CxeSettingIds::VIDEO_SCENE);
+
+ CX_DEBUG_EXIT_FUNCTION();
}
+/*
+ * Advanced test case for loadSettings()
+ */
+void UnitTestCxeSettingsImp::testLoadImageAndVideoSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QSignalSpy spy(mSettingsImp, SIGNAL(settingValueChanged(QString,QVariant)));
+ mSettingsImp->loadSettings(Cxe::VideoMode);
+ //signal should be emitted when loading settings
+ QVERIFY(spy.count() > 0);
+
+ //now let's take a look inside a signal content
+ QList<QVariant> arguments = spy.takeFirst();
+ QVERIFY(arguments.at(0).toString().toAscii() == CxeSettingIds::VIDEO_SCENE);
+ spy.clear();
+
+ mSettingsImp->loadSettings(Cxe::ImageMode);
+
+ //signal should be emitted when loading settings
+ QVERIFY(spy.count() > 0);
+
+ //now let's take a look inside a signal content
+ arguments = spy.takeFirst();
+ QVERIFY(arguments.at(0).toString().toAscii() == CxeSettingIds::IMAGE_SCENE);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*
+ * Testing inline get(const QString &key)
+ * defined in cxesettings.h as template
+ */
void UnitTestCxeSettingsImp::testGet()
{
+ CX_DEBUG_ENTER_FUNCTION();
CxeError::Id err = CxeError::None;
- QString stringValue;
- QString expectedValue = "1";
+ // The idea of this test case is to test as much of different type of settings
+ // as possible
+
+ // Testing reading brightness setting value
+ int brightnessValue;
QVariant testValue;
- /* Test that get -method accepts key and returns correct value. Fakeclass method
- * is used to check that returned value matches with fakeclass' test values
- */
- err = mSettingsImp->get(CxeSettingIds::BRIGHTNESS, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::BRIGHTNESS, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- /* Test that returned value can be viewed as string and int, since get -method
- * may be used for both strings and integers
- */
- int num = 1;
- QCOMPARE(stringValue, expectedValue);
- QVERIFY(stringValue.toInt() == num);
+ try {
+ brightnessValue = mSettingsImp->CxeSettings::get<int>(CxeSettingIds::BRIGHTNESS);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
- err = mSettingsImp->get(CxeSettingIds::COLOR_TONE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::CONTRAST, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::CONTRAST, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::EV_COMPENSATION_VALUE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EV_COMPENSATION_VALUE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ mSettingsStore->get(CxeSettingIds::BRIGHTNESS, testValue);
+ QCOMPARE(brightnessValue, testValue.toInt());
- err = mSettingsImp->get(CxeSettingIds::EXPOSURE_MODE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::FLASH_MODE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::FNAME_FOLDER_SUFFIX, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_FOLDER_SUFFIX, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ // Testing reading color tone setting value
+ Cxe::Colortone colorTone;
+ try {
+ colorTone = mSettingsImp->CxeSettings::get<Cxe::Colortone>(CxeSettingIds::COLOR_TONE);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
- err = mSettingsImp->get(CxeSettingIds::FNAME_IMAGE_COUNTER, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_IMAGE_COUNTER, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ QVariant colorTone2;
+ mSettingsStore->get(CxeSettingIds::COLOR_TONE, colorTone2);
+ QVERIFY(colorTone2 == colorTone);
- err = mSettingsImp->get(CxeSettingIds::FNAME_MONTH_FOLDER, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_MONTH_FOLDER, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ // Testing reading contrast setting value
+ int contrastValue;
+ try {
+ contrastValue = mSettingsImp->CxeSettings::get<int>(CxeSettingIds::CONTRAST);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
- err = mSettingsImp->get(CxeSettingIds::FNAME_VIDEO_COUNTER, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_VIDEO_COUNTER, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ mSettingsStore->get(CxeSettingIds::CONTRAST, testValue);
+ QCOMPARE(testValue.toInt(), contrastValue);
- err = mSettingsImp->get(CxeSettingIds::FOCAL_RANGE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FOCAL_RANGE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::FRAME_RATE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FRAME_RATE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_QUALITY, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_QUALITY, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ // Testing reading file name folder suffix setting value
+ QString fnameValue;
+ try {
+ fnameValue = mSettingsImp->CxeSettings::get<QString>(CxeSettingIds::FNAME_FOLDER_SUFFIX);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE, stringValue);
- QCOMPARE(err, CxeError::None);
- CxeScene scene = mSettingsModel->currentImageScene();
- QCOMPARE(stringValue, scene[CxeSettingIds::SCENE_ID].toString());
+ mSettingsStore->get(CxeSettingIds::FNAME_FOLDER_SUFFIX, testValue);
+ QCOMPARE(testValue.toString(), fnameValue);
- err = mSettingsImp->get(CxeSettingIds::LIGHT_SENSITIVITY, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ // Testing reading scene data
+ QVariantMap sceneData;
- err = mSettingsImp->get(CxeSettingIds::SCENE_ID, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SCENE_ID, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ // First set the still camera scene to auto
+ mSettingsStore->set(CxeSettingIds::IMAGE_SCENE, Cxe::IMAGE_SCENE_AUTO);
- err = mSettingsImp->get(CxeSettingIds::SECONDARY_CAMERA, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SECONDARY_CAMERA, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ try {
+ sceneData = mSettingsImp->CxeSettings::get<QVariantMap>(CxeSettingIds::IMAGE_SCENE_DATA);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
- err = mSettingsImp->get(CxeSettingIds::SELF_TIMER, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SELF_TIMER, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::SHARPNESS, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ QCOMPARE(sceneData[CxeSettingIds::EV_COMPENSATION_VALUE].toInt(), SCENE_AUTO_EV_VALUE);
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE, stringValue);
- QCOMPARE(err, CxeError::None);
- scene = mSettingsModel->currentVideoScene();
- QCOMPARE(stringValue, scene[CxeSettingIds::SCENE_ID].toString());
+ // Now let's try same with video scene
+ sceneData.clear();
+ mSettingsStore->set(CxeSettingIds::VIDEO_SCENE, Cxe::VIDEO_SCENE_AUTO);
+ try {
+ sceneData = mSettingsImp->CxeSettings::get<QVariantMap>(CxeSettingIds::VIDEO_SCENE_DATA);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
- err = mSettingsImp->get(CxeSettingIds::WHITE_BALANCE, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ QCOMPARE(sceneData[CxeSettingIds::EV_COMPENSATION_VALUE].toInt(), SCENE_AUTO_EV_VALUE);
- /* Test error values
- */
- err = mSettingsImp->get(FAIL_TEST_SETTING , stringValue);
- QCOMPARE(err, CxeError::NotFound);
+ CX_DEBUG_EXIT_FUNCTION();
}
+/*
+ * Testing get(long int uid,
+ * unsigned long int key,
+ * Cxe::SettingKeyType type,
+ * QVariant &value)
+ */
void UnitTestCxeSettingsImp::testGet2()
{
+ CX_DEBUG_ENTER_FUNCTION();
QVariant value;
- QVariant reference;
- mSettingsImp->get(0, 0, Cxe::Repository, value);
- mSettingsModel->getSettingValue(0, 0, Cxe::Repository, reference);
- QCOMPARE(value, reference);
+ mSettingsImp->get(CxSettingsCrUid, FileNameSuffixCr, Cxe::Repository, value);
+ // 42 is just a test value from cxefakesettingsstore
+ // we just check that it is correctly returned
+ QCOMPARE(value.toInt(), 42);
mSettingsImp->get(0, 0, Cxe::PublishAndSubscribe, value);
- mSettingsModel->getSettingValue(0, 0, Cxe::PublishAndSubscribe, reference);
- QCOMPARE(value, reference);
+ // 42 is just a test value from cxefakesettingsstore
+ // we just check that it is correctly returned
+ QCOMPARE(value.toInt(), 42);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+/*
+ * Testing get(const QString &key, const T &defaultValue)
+ * defined in cxesettings.h as template
+ */
+void UnitTestCxeSettingsImp::testGet3()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ Cxe::Colortone defaultTone = Cxe::ColortoneNormal;
+ mSettingsStore->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneVivid);
+ Cxe::Colortone colorTone = mSettingsImp->CxeSettings::get<Cxe::Colortone>(
+ CxeSettingIds::COLOR_TONE, defaultTone);
+ QVERIFY(colorTone == Cxe::ColortoneVivid);
+
+ // Now when using this version of the overloaded get<int>()
+ // with invalid key parameter, it should internally
+ // catch the exception and not modify the default value
+ int defaultValue = 0;
+ int value = mSettingsImp->CxeSettings::get<int>(
+ FAIL_TEST_SETTING, defaultValue);
+ QVERIFY(value == defaultValue);
+ CX_DEBUG_EXIT_FUNCTION();
}
+/*
+ * Testing inputting some garbage into CxeSettingsImp::get()
+ */
+void UnitTestCxeSettingsImp::testGetGarbage()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ int intTestValue = 0;
+ CxeError::Id errorId;
+
+ try {
+ mSettingsImp->CxeSettings::get<int>(EMPTY_STRING, intTestValue);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ errorId = CxeError::Id(exception.error());
+ QCOMPARE(errorId, CxeError::NotFound);
+ }
+
+ try {
+ mSettingsImp->CxeSettings::get<int>(FAIL_TEST_SETTING, intTestValue);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ errorId = CxeError::Id(exception.error());
+ QCOMPARE(errorId, CxeError::NotFound);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*
+ * Testing inline void set(const QString &key, const T &value)
+ * defined in cxesettings.h
+ */
void UnitTestCxeSettingsImp::testSet()
{
- CxeError::Id error;
- int range = 0;
- QString string = "";
- QVariant variant(1);
- QVariant checkValue;
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Point of this test case is to try all versions of the set()
+ // method defined in cxesettings.inl
- /* Test that signal is corresponding correctly when setting value is changed
- */
- QList<QVariant> spyArguments;
- QSignalSpy signalSpy(mSettingsImp, SIGNAL(settingValueChanged(QString, QVariant)));
- QVERIFY( signalSpy.isValid() );
-
- error = mSettingsImp->set(CxeSettingIds::BRIGHTNESS, range);
- QCOMPARE(error, CxeError::None);
- QVERIFY(CxeTestUtils::waitForSignal(signalSpy, 1000)); // verify statechanges
-
- spyArguments = signalSpy.takeFirst();
- QCOMPARE(spyArguments.at(0).toString(), QString(CxeSettingIds::BRIGHTNESS));
- QCOMPARE(spyArguments.at(1).toInt(), range);
+ // Testing set<int>() version
+ QVariant value;
+ try {
+ mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneBlackAndWhite);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
+ mSettingsStore->get(CxeSettingIds::COLOR_TONE, value);
+ QCOMPARE(value.toInt(), (int)Cxe::ColortoneBlackAndWhite);
- /* Test parameters
- */
- error = mSettingsImp->set(CxeSettingIds::BRIGHTNESS, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::BRIGHTNESS, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneNormal);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneNormal));
+ // Testing set<QString>() version
+ QString stringValue = "some text";
+ try {
+ mSettingsImp->set(CxeSettingIds::FNAME_FOLDER_SUFFIX, stringValue);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
+ mSettingsStore->get(CxeSettingIds::FNAME_FOLDER_SUFFIX, value);
+ QCOMPARE(value.toString(), stringValue);
- error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneSepia);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneSepia));
-
- error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneNegative);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneNegative));
-
- error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneBlackAndWhite);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneBlackAndWhite));
-
- error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneVivid);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneVivid));
+ // Testing set<bool>() version
+ bool boolValue = true;
+ try {
+ mSettingsImp->set(CxeSettingIds::STILL_SHOWCAPTURED, boolValue);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
+ mSettingsStore->get(CxeSettingIds::STILL_SHOWCAPTURED, value);
+ QCOMPARE(value.toBool(), boolValue);
- error = mSettingsImp->set(CxeSettingIds::CONTRAST, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::CONTRAST, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::EV_COMPENSATION_VALUE, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EV_COMPENSATION_VALUE, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+ // Testing set<qreal>() version
+ qreal qrealValue = -1.25;
+ try {
+ mSettingsImp->set(CxeSettingIds::EV_COMPENSATION_VALUE, qrealValue);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append(exception.error());
+ QFAIL(message.toAscii());
+ return;
+ }
+ mSettingsStore->get(CxeSettingIds::EV_COMPENSATION_VALUE, value);
+ QCOMPARE(value.toReal(), qrealValue);
- error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureAuto);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureAuto));
+ // Testing set<QVariantMap>() version
+ CxeScene testSceneData;
- error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureBacklight);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureBacklight));
-
- error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureNight);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureNight));
+ testSceneData.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO);
+ testSceneData.insert(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceAutomatic);
+ testSceneData.insert(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureAuto);
+ testSceneData.insert(CxeSettingIds::COLOR_TONE, Cxe::ColortoneNormal);
+ testSceneData.insert(CxeSettingIds::CONTRAST, 5);
+ testSceneData.insert(CxeSettingIds::SHARPNESS, Cxe::SharpnessNormal);
+ testSceneData.insert(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityAutomatic);
+ testSceneData.insert(CxeSettingIds::EV_COMPENSATION_VALUE, -2);
+ testSceneData.insert(CxeSettingIds::BRIGHTNESS, 8);
+ testSceneData.insert(CxeSettingIds::FLASH_MODE, Cxe::FlashAuto);
+ testSceneData.insert(CxeSettingIds::FACE_TRACKING, 1);
- error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureSport);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureSport));
+ // First set the still camera scene to auto
+ mSettingsStore->set(CxeSettingIds::IMAGE_SCENE, Cxe::IMAGE_SCENE_AUTO);
- error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashAntiRedEye);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashAntiRedEye));
-
- error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashAuto);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashAuto));
+ // Now setting the value
+ try {
+ //This should throw an exception with CxeError::NotSupported
+ mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_DATA, testSceneData);
+ }
+ catch (CxeException exception) {
+ QString message = "Exception thrown, error id = ";
+ message.append((int)exception.error());
+ QCOMPARE(exception.error(), (int)CxeError::NotSupported);
+ }
- error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashOff);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashOff));
+ CX_DEBUG_EXIT_FUNCTION();
+}
- error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashOn);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashOn));
+/*
+ * This will test calling void method of reset()
+ */
+void UnitTestCxeSettingsImp::testReset()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mSettingsImp->reset();
+ CX_DEBUG_EXIT_FUNCTION();
+}
- error = mSettingsImp->set(CxeSettingIds::FNAME_FOLDER_SUFFIX, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_FOLDER_SUFFIX, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::FNAME_IMAGE_COUNTER, range);
+void UnitTestCxeSettingsImp::testGetVariationSetting()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVariant value;
+ CxeError::Id error = mSettingsImp->getVariationValue(CxeVariationKeys::STILL_MAX_ZOOM_LIMITS, value);
QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_IMAGE_COUNTER, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::FNAME_MONTH_FOLDER, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_MONTH_FOLDER, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+ error = mSettingsImp->getVariationValue(FAIL_TEST_SETTING, value);
+ QCOMPARE(error, CxeError::NotFound);
+ CX_DEBUG_EXIT_FUNCTION();
+}
- error = mSettingsImp->set(CxeSettingIds::FNAME_VIDEO_COUNTER, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FNAME_VIDEO_COUNTER, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+void UnitTestCxeSettingsImp::testListenForSetting()
+{
+ CX_DEBUG_ENTER_FUNCTION();
- error = mSettingsImp->set(CxeSettingIds::FOCAL_RANGE, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::FOCAL_RANGE, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_QUALITY, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_QUALITY, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+ // This test case will initialize listening for certain setting changes
+ // and will verify that listener has succesfully deployed the signal
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+ // First let's initialize a signal spy
+ QSignalSpy spy(mSettingsImp, SIGNAL(settingValueChanged(QString, QVariant)));
- error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityAutomatic);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityAutomatic));
-
- error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityHigh);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityHigh));
+ // Initializing the original value to make sure it changes later on
+ mSettingsStore->set(CxeSettingIds::CAMERA_MODE, Cxe::ImageMode);
- error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityLow);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityLow));
+ // Now start listening and verify that starting was succesfull
+ bool result = mSettingsImp->listenForSetting(CxeSettingIds::CAMERA_MODE, this, SLOT(testSlot()));
+ QVERIFY(result);
- error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityMedium);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityMedium));
-
- error = mSettingsImp->set(CxeSettingIds::SCENE_ID, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SCENE_ID, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+ // Now change the setting and wait for the signal
+ //mSettingsStore->set(CxeSettingIds::CAMERA_MODE, Cxe::VideoMode);
+ mSettingsImp->set(CxeSettingIds::CAMERA_MODE, Cxe::VideoMode);
- error = mSettingsImp->set(CxeSettingIds::SECONDARY_CAMERA, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SECONDARY_CAMERA, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::SELF_TIMER, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SELF_TIMER, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::SHARPNESS, Cxe::SharpnessHard);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::SharpnessHard));
+ // Check that signal was emitted
+ QVERIFY(CxeTestUtils::waitForSignal(spy, SIGNAL_TIMEOUT));
- error = mSettingsImp->set(CxeSettingIds::SHARPNESS, Cxe::SharpnessNormal);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::SharpnessNormal));
+ // One more check with invalid input parameter
+ result = mSettingsImp->listenForSetting(FAIL_TEST_SETTING, this, SLOT(testSlot()));
+ QVERIFY(!result);
- error = mSettingsImp->set(CxeSettingIds::SHARPNESS, Cxe::SharpnessSoft);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::SharpnessSoft));
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
+ // Now disconnecting the listener and checking if the signal is still emitted
+ disconnect(mSettingsImp, SIGNAL(settingValueChanged(QString,QVariant)), this, SLOT(testSlot()));
+ delete mSettingsImp;
+ mSettingsImp = NULL;
- error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceAutomatic);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceAutomatic));
+ mSettingsStore->set(CxeSettingIds::CAMERA_MODE, Cxe::ImageMode);
- error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceCloudy);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceCloudy));
-
- error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceFluorescent);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceFluorescent));
+ // Make sure that no additional signals are emitted
+ QVERIFY(!CxeTestUtils::waitForSignal(spy, SIGNAL_TIMEOUT));
- error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceIncandescent);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceIncandescent));
+ CX_DEBUG_EXIT_FUNCTION();
+}
- error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceSunny);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
- QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceSunny));
-
- /* Test fail parameter
- */
- error = mSettingsImp->set(FAIL_TEST_SETTING, Cxe::ColortoneNormal);
- QCOMPARE(error, CxeError::NotFound);
+/*
+ * Just a dummy slot
+ */
+void UnitTestCxeSettingsImp::testSlot()
+{
+ CX_DEBUG_IN_FUNCTION();
}
// main() function non-GUI testing
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.h Wed Aug 18 09:37:18 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"
@@ -11,18 +11,19 @@
*
* Contributors:
*
- * Description:
+ * Description: This test class contains unit tests for two cxengine classes:
+ * CxeSettings and CxeSettingsImp. CxeSettings is mostly a pure virtual
+ * class containing couple of overloaded versions of get() methods, and so it is
+ * tested together with CxeSettingsImp, which implements CxeSettings
*
*/
#ifndef UNITTEST_CXESETTINGSIMP_H
#define UNITTEST_CXESETTINGSIMP_H
#include <QObject>
-#include <QMetaType>
-
#include "cxesettingsimp.h"
-class CxeFakeSettingsModel;
+class CxeFakeSettingsStore;
class CxeSettingsImp;
class UnitTestCxeSettingsImp : public QObject
@@ -33,22 +34,32 @@
UnitTestCxeSettingsImp();
virtual ~UnitTestCxeSettingsImp();
+public slots:
+ void testSlot();
+
private slots:
void init();
void cleanup();
+ void testLoadImageSettings();
+ void testLoadVideoSettings();
+ void testLoadImageAndVideoSettings();
+
void testGet();
void testGet2();
+ void testGet3();
+ void testGetGarbage();
void testSet();
- void testLoadSettings();
+
+ void testReset();
+ void testGetVariationSetting();
+ void testListenForSetting();
private:
- CxeFakeSettingsModel *mSettingsModel;
+ CxeFakeSettingsStore *mSettingsStore;
CxeSettingsImp *mSettingsImp;
};
-Q_DECLARE_METATYPE(CxeScene)
-
#endif
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.pro Wed Aug 18 09:37:18 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"
@@ -14,15 +14,16 @@
TARGET = unittest_cxesettingsimp
HEADERS *= unittest_cxesettingsimp.h \
- cxefakesettingsmodel.h \
+ cxefakesettingsstore.h \
cxesettings.h \
cxesettingsimp.h \
cxutils.h \
cxenamespace.h \
cxeerror.h \
- cxesettingsmodel.h
+ cxescenemodestore.h
SOURCES *= unittest_cxesettingsimp.cpp \
cxesettingsimp.cpp \
- cxefakesettingsmodel.cpp
+ cxefakesettingsstore.cpp \
+ cxescenemodestore.cpp
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettmappersymbian/unittest_cxesettingsmappersymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettmappersymbian/unittest_cxesettingsmappersymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -22,8 +22,10 @@
#include "cxenamespace.h"
#include "cxesettingsmappersymbian.h"
+#include "cxequalitydetails.h"
#include "unittest_cxesettingsmappersymbian.h"
+
// Enums
@@ -64,7 +66,7 @@
void UnitTestCxeSettingsMapperSymbian::testMap2CameraEffect()
{
CCamera::CCameraImageProcessing::TEffect result;
- int initialData = 99999;
+ Cxe::Colortone initialData = static_cast<Cxe::Colortone>(99999);
// case 0: check with unknown value
result = CxeSettingsMapperSymbian::Map2CameraEffect(initialData);
@@ -76,7 +78,8 @@
QVERIFY(result == CCamera::CCameraImageProcessing::EEffectSepia);
// case 2: try with direct value which is invalid
- result = CxeSettingsMapperSymbian::Map2CameraEffect(-1);
+ result = CxeSettingsMapperSymbian::Map2CameraEffect(
+ static_cast<Cxe::Colortone>(-1));
QVERIFY(result == CCamera::CCameraImageProcessing::EEffectNone);
}
@@ -84,7 +87,7 @@
void UnitTestCxeSettingsMapperSymbian::testMap2CameraExposureMode()
{
CCamera::TExposure result;
- int initialData = -1;
+ Cxe::ExposureMode initialData = static_cast<Cxe::ExposureMode>(-1);
// case 0: check with unknown value
result = CxeSettingsMapperSymbian::Map2CameraExposureMode(initialData);
@@ -96,14 +99,15 @@
QVERIFY(result == CCamera::EExposureNight);
// case 2: try with direct value which is invalid
- result = CxeSettingsMapperSymbian::Map2CameraExposureMode(99999);
+ result = CxeSettingsMapperSymbian::Map2CameraExposureMode(
+ static_cast<Cxe::ExposureMode>(99999));
QVERIFY(result == CCamera::EExposureAuto);
}
void UnitTestCxeSettingsMapperSymbian::testMap2CameraFlash()
{
CCamera::TFlash result;
- int initialData = -1;
+ Cxe::FlashMode initialData = static_cast<Cxe::FlashMode>(-1);
// case 0: check with unknown value
result = CxeSettingsMapperSymbian::Map2CameraFlash(initialData);
@@ -115,7 +119,8 @@
QVERIFY(result == CCamera::EFlashForced);
// case 2: try with direct value which is invalid
- result = CxeSettingsMapperSymbian::Map2CameraFlash(99999);
+ result = CxeSettingsMapperSymbian::Map2CameraFlash(
+ static_cast<Cxe::FlashMode>(99999));
QVERIFY(result == CCamera::EFlashAuto);
}
@@ -138,7 +143,7 @@
void UnitTestCxeSettingsMapperSymbian::testMap2CameraWb()
{
CCamera::TWhiteBalance result;
- int initialData = -1;
+ Cxe::Whitebalance initialData = static_cast<Cxe::Whitebalance>(-1);
// case 0: check with unknown value
result = CxeSettingsMapperSymbian::Map2CameraWb(initialData);
@@ -150,10 +155,62 @@
QVERIFY(result == CCamera::EWBDaylight);
// case 2: try with direct value which is invalid
- result = CxeSettingsMapperSymbian::Map2CameraWb(99999);
+ result = CxeSettingsMapperSymbian::Map2CameraWb(
+ static_cast<Cxe::Whitebalance>(99999));
QVERIFY(result == CCamera::EWBAuto);
}
+void UnitTestCxeSettingsMapperSymbian::testMap2UseCaseHintVideoParameters()
+{
+ CxeVideoDetails details;
+ MCameraUseCaseHint::TVideoCodec codec = MCameraUseCaseHint::ECodecUnknown;
+ MCameraUseCaseHint::TVideoProfile profile = MCameraUseCaseHint::EProfileUnknown;
+
+ details.mVideoCodecMimeType = "video/H263-2000";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecH263);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileH263P0L10);
+
+ details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=2";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileMPEG4SpL2);
+
+ details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=3";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileMPEG4SpL3);
+
+ details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=4";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileMPEG4SpL4a);
+
+ details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=foobar";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileUnknown);
+
+ details.mVideoCodecMimeType = "video/H264; profile-level-id=42801E";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecH264);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileH264BpL3);
+
+ details.mVideoCodecMimeType = "video/H264; profile-level-id=42801F";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecH264);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileH264BpL3_1);
+
+ details.mVideoCodecMimeType = "video/H264; profile-level-id=foobar";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecH264);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileUnknown);
+
+ details.mVideoCodecMimeType = "invalid";
+ CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile);
+ QCOMPARE(codec, MCameraUseCaseHint::ECodecUnknown);
+ QCOMPARE(profile, MCameraUseCaseHint::EProfileUnknown);
+}
+
// main() function non-GUI testing
-QTEST_APPLESS_MAIN(UnitTestCxeSettingsMapperSymbian)
-;
+QTEST_APPLESS_MAIN(UnitTestCxeSettingsMapperSymbian);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettmappersymbian/unittest_cxesettingsmappersymbian.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettmappersymbian/unittest_cxesettingsmappersymbian.h Wed Aug 18 09:37:18 2010 +0300
@@ -40,6 +40,7 @@
void testMap2CameraEffect();
void testMap2CameraAutofocus();
void testMap2CameraOrientation();
+ void testMap2UseCaseHintVideoParameters();
};
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp Wed Aug 18 09:37:18 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>("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
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro Wed Aug 18 09:37:18 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
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -27,7 +27,6 @@
#include "unittest_cxestillcapturecontrolsymbian.h"
#include "cxefakeviewfindercontrol.h"
#include "cxesnapshotcontrol.h"
-#include "cxesettingsmodel.h"
#include "cxesensoreventhandlersymbian.h"
#include "cxefilenamegeneratorsymbian.h"
#include "cxefakefilenamegenerator.h"
@@ -60,7 +59,6 @@
// Run before each individual test case
void UnitTestCxeStillCaptureControlSymbian::initTestCase()
{
- mFakeSettings = new CxeFakeSettings();
mFakeSettings->set(CxeSettingIds::IMAGE_QUALITY, 0);
mFakeCameraDeviceControl = new CxeFakeCameraDeviceControl();
mFakeCameraDevice = new CxeFakeCameraDevice();
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -60,7 +60,6 @@
sensor/xqaccsensor_p.cpp \
sensor/xqsensor.cpp \
sensor/xqsensor_p.cpp \
- cxesettingsmodelimp.cpp \
cxesettingsimp.cpp \
cxefakeviewfindercontrol.cpp \
cxesoundplayersymbian.cpp \
@@ -104,7 +103,6 @@
sensor/xqsensor.h \
sensor/xqsensor_p.h \
sensor/xqaccsensor_p.h \
- cxesettingsmodel.h \
cxesettingsimp.h \
cxesettings.h \
cxecenrepkeys.h \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -48,18 +48,33 @@
{
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, QImage());
+ // we should not get any call back when we have invalid file name.
+ QCOMPARE(thumbnailReadySpy.count(), 0);
+
// 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, QImage());
+ QTest::qWait(1500);
+
+ QCOMPARE( thumbnailReadySpy.count(), 1 );
+ if (thumbnailReadySpy.count() > 0) {
+ QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst();
+ // we are only interested in error code in this case 1
+ QCOMPARE(initModeArguments.at(1).toInt(), KErrNone);
+ }
+
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -18,6 +18,8 @@
INCLUDEPATH *= ../system_include
DEPENDPATH *= ../system_include
+LIBS *= -lthumbnailmanagerqt
+
HEADERS *= unittest_cxethumbnailmanagersymbian.h \
cxethumbnailmanagersymbian.h \
thumbnailmanager_qt.h \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -67,7 +67,6 @@
mCameraDevice = new CxeFakeCameraDevice();
mViewfinderControl = new CxeFakeViewfinderControl();
mSnapshotControl = new CxeSnapshotControl(*mCameraDevice);
- mSettings = new CxeFakeSettings();
mSettings->set(CxeSettingIds::VIDEO_SHOWCAPTURED, -1);
mFilenameGeneratorSymbian = new CxeFakeFilenameGenerator();
mFilenameGeneratorSymbian->init(Cxe::VideoMode);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro Wed Aug 18 09:37:18 2010 +0300
@@ -43,7 +43,6 @@
cxefakecameradevicecontrol.cpp \
cxefakesettings.cpp \
cxesettingsimp.cpp \
- cxefakesettingsmodel.cpp \
cxestatemachine.cpp \
cxestate.cpp \
cxestatemachinebase.cpp \
@@ -75,7 +74,6 @@
cxesettingsimp.h \
cxesettings.h \
cxefakesettings.h \
- cxefakesettingsmodel.h \
cxestatemachine.h \
cxestate.h \
cxeerrormappingsymbian.h \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxezoomcontrolsymbian/unittest_cxezoomcontrolsymbian.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxezoomcontrolsymbian/unittest_cxezoomcontrolsymbian.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -52,7 +52,6 @@
mFakeCameraDeviceControl = new CxeFakeCameraDeviceControl;
mFakeCameraDeviceControl->setState(CxeCameraDeviceControl::Ready);
- mFakeSettings = new CxeFakeSettings();
mFakeFeatureManager = new CxeFakeFeatureManager();
mZoomControl = new CxeZoomControlSymbian(*mFakeCameraDevice,
--- a/camerauis/cameraxui/cxui/cxui.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.pro Wed Aug 18 09:37:18 2010 +0300
@@ -29,6 +29,7 @@
# Fix for QMake translating INCLUDEPATH to SYSTEMINCLUDE
# and TraceCompiler needing USERINCLUDE.
MMP_RULES += "USERINCLUDE traces"
+ MMP_RULES += SMPSAFE
}
# export sound file
@@ -42,26 +43,45 @@
inc
INCLUDEPATH += inc \
traces
+!symbian {
+ DEPENDPATH += stubs_desktop/inc
+ INCLUDEPATH += ../cxengine/inc/api \
+ stubs_desktop/inc
+ DEFINES += CAMERAX_ENGINE_NO_LIBRARY
+}
-LIBS += -lecam \
- -lecamsnapshot \
- -lws32 \
- -lbitgdi \
- -lfbscli \
- -lcxengine \
- -lapmime \
- -lcommonui \
- -lxqutils \
- -lxqservice \
- -lxqserviceutil \
- -lshareui \
- -lcone \
- -lefsrv \
- -lws32 \
- -lgdi \
- -lapgrfx \
- -lusbman \
- -lthumbnailmanagerqt
+symbian {
+ LIBS += -lecam \
+ -lecamsnapshot \
+ -lws32 \
+ -lbitgdi \
+ -lfbscli \
+ -lcxengine \
+ -lapmime \
+ -lcommonui \
+ -lxqutils \
+ -lxqservice \
+ -lxqserviceutil \
+ -lshareui \
+ -lcone \
+ -lefsrv \
+ -lws32 \
+ -lgdi \
+ -lapgrfx \
+ -lusbman \
+ -lthumbnailmanagerqt
+} else {
+ win32 {
+ debug {
+ LIBS += ../cxengine/debug/libcxengine.a
+
+ } else {
+ LIBS += ../cxengine/release/libcxengine.a
+ }
+ } else {
+ LIBS += ../cxengine/libcxengine.a
+ }
+}
CONFIG += hb
CONFIG += service
@@ -72,7 +92,18 @@
HB += hbcore hbwidgets hbfeedback hbutils
# Input
-HEADERS += cxuiapplication.h \
+
+DOCML += layouts/errornote_popup.docml \
+ layouts/full_screen_popup.docml \
+ layouts/setting.docml \
+ layouts/setting_scenemode.docml \
+ layouts/setting_slider.docml \
+ layouts/view_postcapture.docml \
+ layouts/view_still_precapture.docml \
+ layouts/view_video_precapture.docml
+
+HEADERS += cxengine_global.h \
+ cxuiapplication.h \
cxuiapplicationframeworkmonitor.h \
cxuiapplicationframeworkmonitorprivate.h \
cxuiapplicationstate.h \
@@ -90,7 +121,6 @@
cxuisettingslider.h \
cxuiselftimer.h \
cxuisettingradiobuttonlist.h \
- cxuiscenelabel.h \
cxuierrormanager.h \
cxuisettingradiobuttonlistmodel.h \
cxuisettingsinfo.h \
@@ -99,8 +129,21 @@
cxuiscenemodeview.h \
cxuizoomslider.h \
cxuifullscreenpopup.h \
- cxuieventlog.h \
- traces/OstTraceDefinitions.h
+ cxuieventlog.h
+
+symbian {
+ HEADERS += traces/OstTraceDefinitions.h \
+ cxuicapturekeyhandler_symbian_p.h
+}
+else {
+ HEADERS += cxuimacrosdesktop.h \
+ cxuicapturekeyhandler_desktop_p.h \
+ shareui.h \
+ thumbnailmanager_qt.h \
+ xqappmgr.h \
+ xqserviceprovider.h \
+ XQUtils
+}
SOURCES += main.cpp \
cxuiapplication.cpp \
@@ -120,7 +163,6 @@
cxuisettingslider.cpp \
cxuiselftimer.cpp \
cxuisettingradiobuttonlist.cpp \
- cxuiscenelabel.cpp \
cxuierrormanager.cpp \
cxuisettingradiobuttonlistmodel.cpp \
cxuisettingsinfo.cpp \
@@ -131,6 +173,12 @@
cxuifullscreenpopup.cpp \
cxuieventlog.cpp
+symbian {
+ SOURCES += cxuicapturekeyhandler_symbian_p.cpp
+} else {
+ SOURCES += cxuicapturekeyhandler_desktop_p.cpp
+}
+
RESOURCES += cxui.qrc
# Variating internal and external icons for scene selection view
--- a/camerauis/cameraxui/cxui/cxui.qrc Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.qrc Wed Aug 18 09:37:18 2010 +0300
@@ -3,14 +3,14 @@
<file alias="cxui.css" >layouts/cxui.css</file>
</qresource>
<qresource prefix="/xml" >
- <file alias="setting_scenemode.docml" >layouts/setting_scenemode.docml</file>
- <file alias="view_still_precapture.docml" >layouts/view_still_precapture.docml</file>
- <file alias="view_video_precapture.docml" >layouts/view_video_precapture.docml</file>
- <file alias="view_postcapture.docml" >layouts/view_postcapture.docml</file>
- <file alias="errornote_popup.docml" >layouts/errornote_popup.docml</file>
- <file alias="setting.docml" >layouts/setting.docml</file>
- <file alias="setting_slider.docml" >layouts/setting_slider.docml</file>
- <file alias="full_screen_popup.docml" >layouts/full_screen_popup.docml</file>
+ <file alias="setting_scenemode.docml" >layouts/setting_scenemode.docml.bin</file>
+ <file alias="view_still_precapture.docml" >layouts/view_still_precapture.docml.bin</file>
+ <file alias="view_video_precapture.docml" >layouts/view_video_precapture.docml.bin</file>
+ <file alias="view_postcapture.docml" >layouts/view_postcapture.docml.bin</file>
+ <file alias="errornote_popup.docml" >layouts/errornote_popup.docml.bin</file>
+ <file alias="setting.docml" >layouts/setting.docml.bin</file>
+ <file alias="setting_slider.docml" >layouts/setting_slider.docml.bin</file>
+ <file alias="full_screen_popup.docml" >layouts/full_screen_popup.docml.bin</file>
<file alias="image_setting.xml" >layouts/image_setting.xml</file>
<file alias="video_setting.xml" >layouts/video_setting.xml</file>
</qresource>
--- a/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Wed Aug 18 09:37:18 2010 +0300
@@ -49,7 +49,6 @@
CxuiApplicationState(CxuiApplication &application,
CxeSettings &settings,
- CxuiCaptureKeyHandler &keyHandler,
CxuiDocumentLoader *documentLoader);
~CxuiApplicationState();
--- a/camerauis/cameraxui/cxui/inc/cxuicapturekeyhandler.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuicapturekeyhandler.h Wed Aug 18 09:37:18 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,20 +14,19 @@
* Description:
*
*/
+
#ifndef CXUICAPTUREKEYHANDLER_H
#define CXUICAPTUREKEYHANDLER_H
#include <QObject>
-class RWsSession;
-class RWindowGroup;
class QEvent;
class CxeEngine;
-
+class CxuiCaptureKeyHandlerPrivate;
class CxuiCaptureKeyHandler : public QObject
{
-Q_OBJECT
+ Q_OBJECT
public:
CxuiCaptureKeyHandler(CxeEngine &aEngine);
virtual ~CxuiCaptureKeyHandler();
@@ -49,23 +48,8 @@
void captureKeyReleased();
private:
- void listenKey(int key);
-
-private:
- bool mAutofocusKeyPressed;
- bool mCaptureKeyPressed;
-
- QList<int> mCapturedKeyHandles;
- QList<int> mCapturedKeyUpDownHandles;
-
- QList<int> mPrimaryCameraAutofocusKeys;
- QList<int> mPrimaryCameraCaptureKeys;
- QList<int> mSecondaryCameraCaptureKeys;
-
- CxeEngine &mEngine;
-
- RWsSession &mWsSession; // not own
- RWindowGroup &mWindowGroup; // not own
+ CxuiCaptureKeyHandlerPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(CxuiCaptureKeyHandler)
};
#endif // CXUICAPTUREKEYHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuicapturekeyhandler_desktop_p.h Wed Aug 18 09:37:18 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 CXUICAPTUREKEYHANDLER_DESKTOP_P_H
+#define CXUICAPTUREKEYHANDLER_DESKTOP_P_H
+
+#include <QObject>
+
+class CxuiCaptureKeyHandler;
+class CxeEngine;
+
+class CxuiCaptureKeyHandlerPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ CxuiCaptureKeyHandlerPrivate(CxeEngine &aEngine, CxuiCaptureKeyHandler *parent);
+ virtual ~CxuiCaptureKeyHandlerPrivate();
+
+public:
+ void listenKeys(bool listen);
+
+ bool isAutofocusKeyPressed();
+ bool isCaptureKeyPressed();
+
+ bool handleKeyEvent(QEvent *event);
+
+private: //private implementation patterns
+ CxuiCaptureKeyHandler *const q_ptr;
+ Q_DECLARE_PUBLIC(CxuiCaptureKeyHandler)
+
+private:
+ CxeEngine &mEngine;
+ bool mAutofocusKeyPressed;
+ bool mCaptureKeyPressed;
+
+private: // Stub / Dummy members
+ QList<int> mPrimaryCameraAutofocusKeys;
+
+};
+
+#endif // CXUICAPTUREKEYHANDLER_DESKTOP_P_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuicapturekeyhandler_symbian_p.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 CXUICAPTUREKEYHANDLER_SYMBIAN_P_H
+#define CXUICAPTUREKEYHANDLER_SYMBIAN_P_H
+
+#include <QObject>
+
+class QEvent;
+class CxeEngine;
+class CxuiCaptureKeyHandler;
+
+class RWsSession;
+class RWindowGroup;
+
+class CxuiCaptureKeyHandlerPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ CxuiCaptureKeyHandlerPrivate(CxeEngine &aEngine, CxuiCaptureKeyHandler *parent);
+ virtual ~CxuiCaptureKeyHandlerPrivate();
+
+public:
+ void listenKeys(bool listen);
+
+ bool isAutofocusKeyPressed();
+ bool isCaptureKeyPressed();
+
+ bool handleKeyEvent(QEvent *event);
+
+private:
+ void listenKey(int key);
+
+private: //private implementation pattern
+ CxuiCaptureKeyHandler *const q_ptr;
+ Q_DECLARE_PUBLIC(CxuiCaptureKeyHandler)
+
+private:
+ CxeEngine &mEngine;
+
+ bool mAutofocusKeyPressed;
+ bool mCaptureKeyPressed;
+
+ QList<int> mCapturedKeyHandles;
+ QList<int> mCapturedKeyUpDownHandles;
+
+ QList<int> mPrimaryCameraAutofocusKeys;
+ QList<int> mPrimaryCameraCaptureKeys;
+ QList<int> mSecondaryCameraCaptureKeys;
+
+ RWsSession &mWsSession; // not own
+ RWindowGroup &mWindowGroup; // not own
+
+};
+
+#endif // CXUICAPTUREKEYHANDLER_SYMBIAN_P_H
--- a/camerauis/cameraxui/cxui/inc/cxuienums.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuienums.h Wed Aug 18 09:37:18 2010 +0300
@@ -58,7 +58,9 @@
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";
@@ -73,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";
@@ -89,6 +90,7 @@
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";
@@ -107,8 +109,7 @@
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";
- static const char *VIDEO_PRE_CAPTURE_ELAPSED_TIME_LABEL = "video_elapsed_time";
- static const char *VIDEO_PRE_CAPTURE_REMAINING_TIME_LABEL = "video_remaining_time";
+ static const char *VIDEO_PRE_CAPTURE_VIDEO_TIME_LABEL = "video_elapsed_time";
static const char *VIDEO_PRE_CAPTURE_DEFAULT_MENU = "video_view_menu";
static const char *VIDEO_PRE_CAPTURE_VIDEO_QUALITY_ACTION = "cxui_video_action_quality";
static const char *VIDEO_PRE_CAPTURE_GOTO_STILL_ACTION = "cxui_video_action_gotostill";
@@ -119,6 +120,8 @@
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";
@@ -152,14 +155,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";
- static const char *SCENE_VIEW_HEADING_WIDGET = "scene_title";
+ // 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
--- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Wed Aug 18 09:37:18 2010 +0300
@@ -83,9 +83,10 @@
void playVideo();
void showDeleteNote();
- void handleDeleteDialogClosed(HbAction *action);
+ void handleDeleteDialogClosed(int action);
private:
+ bool isFileDeleted();
QString getCurrentFilename();
void startTimers();
@@ -93,7 +94,7 @@
void startReleaseTimers();
private slots:
- void handleThumbnailReady(QPixmap thumbnail, void *clientData, int id, int errorCode);
+ void handleThumbnailReady(QPixmap thumbnail);
private: // data
HbToolBar *mStillToolbar;
--- a/camerauis/cameraxui/cxui/inc/cxuiscenelabel.h Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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 CXUISCENELABEL_H_
-#define CXUISCENELABEL_H_
-
-#include <hblabel.h>
-
-class CxeEngine;
-
-class CxuiSceneLabel : public HbLabel
-{
- Q_OBJECT
- Q_PROPERTY(QString settingId READ settingId WRITE setSettingId)
- Q_PROPERTY(QStringList itemValues READ itemValues WRITE setItemValues)
- Q_PROPERTY(QStringList items READ items WRITE setItems)
-
-public:
- explicit CxuiSceneLabel(QGraphicsItem *parent, CxeEngine *engine);
-
- QString settingId() const;
- void setSettingId(const QString &id);
-
- QStringList itemValues() const;
- void setItemValues(const QStringList &values);
-
- QStringList items() const;
- void setItems(const QStringList &values);
-
-signals:
-
-public slots:
- void changeIcon(int);
-
-private:
- void setSceneIcon();
- Q_DISABLE_COPY(CxuiSceneLabel)
-
- QString mSettingId;
- QStringList mItemValues;
- QStringList mItems;
- CxeEngine *mEngine;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-#endif /* CXUISCENELABEL_H_ */
--- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Wed Aug 18 09:37:18 2010 +0300
@@ -64,6 +64,7 @@
void restoreActivity(const QString &activityId, const QVariant &data);
void saveActivity();
void clearActivity();
+
protected:
void showEvent(QShowEvent *event);
@@ -74,9 +75,7 @@
// from CxuiPrecaptureView
virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
- // whenever a scene setting is changed on the engine side, an icon might need updating on the toolbar
- // connects to the sceneChanged signal of CxeSettings
- void handleSceneChanged(CxeScene &scene);
+ void handleSceneChanged(const QVariant &newSceneData);
// From CxuiPrecaptureView
virtual void enterStandby();
@@ -111,6 +110,9 @@
void closeDialogs();
void updateFaceTrackingIcon();
+private:
+ void reloadIndicatorWidgets();
+
protected:
CxuiSelfTimer *mSelfTimer;
HbAction *mFlashSetting;
--- a/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Wed Aug 18 09:37:18 2010 +0300
@@ -45,27 +45,13 @@
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,
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 restoreActivity(const QString &activityId, const QVariant &data);
@@ -77,12 +63,11 @@
// from CxuiPrecaptureView
virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
- void handleSceneChanged(CxeScene &scene);
+ void handleSceneChanged(const QVariant &scene);
void handleQuitClicked();
protected slots:
- void handleSnapshot(CxeError::Id error);
void record();
void pause();
void stop();
@@ -100,7 +85,7 @@
protected:
- void setVideoTime(HbLabel* label, int time);
+ void setVideoTime(HbLabel* label, int elapsedTime, int remainingTime);
bool getElapsedTime();
void getRemainingTime();
bool allowShowControls() const;
@@ -113,18 +98,19 @@
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;
int mTimeRemaining;
- HbLabel *mElapsedTimeText; // not own
- HbLabel *mRemainingTimeText; // not own
+ HbLabel *mVideoTimeText; // not own
HbLabel *mRecordingIcon; // not own
HbAction *mGoToStillAction; // not own
HbToolBar *mToolbarIdle; // not own
--- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Wed Aug 18 09:37:18 2010 +0300
@@ -31,13 +31,9 @@
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 CxuiSceneModeView;
+class CxuiErrorManager;
class CxuiView;
class CxuiViewManager : public QObject
@@ -48,11 +44,6 @@
CxuiViewManager(CxuiApplication &application, HbMainWindow &mainWindow, CxeEngine &engine);
~CxuiViewManager();
- CxuiDocumentLoader *documentLoader();
-
- CxuiApplicationState &applicationState();
-
- void initEngine();
public slots:
void changeToPostcaptureView();
void changeToPrecaptureView();
@@ -80,14 +71,12 @@
CxuiView *createView(const QString &viewName);
CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera);
- CxuiView *createSceneModesView();
-
- void connectSignals(QObject *view);
- void disconnectSignals(QObject *view = NULL);
- void connectPreCaptureSignals();
+ void connectSignals(CxuiView *view);
+ void disconnectSignals(CxuiView *view = NULL);
+ void connectPreCaptureSignals(CxuiPrecaptureView *view);
void connectPostCaptureSignals();
void connectSceneModeSignals();
- void connectCaptureKeySignals();
+ void connectCaptureKeySignals(CxuiView *view);
void handleExitingNormalState();
void clearAllActivities();
@@ -105,7 +94,6 @@
CxuiDocumentLoader *mCameraDocumentLoader;
CxuiApplicationState *mApplicationState;
CxuiErrorManager *mErrorManager;
- CxuiSceneModeView *mSceneModeView;
QTimer mStandbyTimer;
};
--- a/camerauis/cameraxui/cxui/layouts/cxui.css Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/cxui.css Wed Aug 18 09:37:18 2010 +0300
@@ -14,11 +14,11 @@
Selftimer
All HbLabel text and icons inside still_precapture_selftimer_container
*/
-HbWidget#still_precapture_selftimer_container > HbLabel::icon
+HbWidget#selftimer_icon_container > HbLabel::icon
{
color: var(qtc_popup_trans_normal);
}
-HbWidget#still_precapture_selftimer_container > HbLabel::text
+HbWidget#selftimer_icon_container > HbLabel::text
{
color: var(qtc_popup_trans_normal);
}
@@ -46,13 +46,8 @@
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
--- a/camerauis/cameraxui/cxui/layouts/image_setting.xml Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/image_setting.xml Wed Aug 18 09:37:18 2010 +0300
@@ -111,7 +111,7 @@
</setting_slider>
<!-- Still scene modes -->
- <setting_list id="still_scene_modes"
+ <setting_list id="still_scene_mode"
heading="txt_cam_title_scene_mode"
preview="0"
type="SingleLineListBox">
--- a/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Wed Aug 18 09:37:18 2010 +0300
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.0">
+<hbdocument version="1.1">
<widget name="settings_scenes_view" type="HbView">
<widget name="scene_view_content" role="HbView:widget" type="HbWidget">
<widget name="scene_view_bg_icon" type="HbLabel">
@@ -18,10 +18,12 @@
</widget>
<widget name="button_container" type="HbWidget">
<widget name="scene_ok_button" type="HbPushButton">
+ <sizehint height="7un" type="PREFERRED" width="21.875un"/>
<string locid="txt_common_button_ok" name="text" value="Ok"/>
<string name="state" value="normal"/>
</widget>
<widget name="scene_cancel_button" type="HbPushButton">
+ <sizehint height="7un" type="PREFERRED" width="21.875un"/>
<string locid="txt_common_button_cancel" name="text" value="Cancel"/>
<string name="state" value="normal"/>
</widget>
@@ -39,8 +41,9 @@
<fontspec name="fontSpec" role="Title" textheight="var(hb-param-text-height-primary)"/>
</widget>
<real name="z" value="2"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
<sizehint height="41.49254un" type="PREFERRED" width="expr(var(hb-param-widget-dialog-width) )"/>
- <layout orientation="Vertical" type="linear">
+ <layout orientation="Vertical" spacing="1un" type="linear">
<contentsmargins bottom="var(hb-param-margin-gene-bottom)" left="var(hb-param-margin-gene-left)" right="var(hb-param-margin-gene-right)" top="var(hb-param-margin-gene-top)"/>
<linearitem itemname="scene_title"/>
<linearitem itemname="scene_view_radioButtonList"/>
@@ -64,10 +67,11 @@
<string name="title" value="Scene modes"/>
<bool name="contentFullScreen" value="TRUE"/>
<enums name="focusDelegation" value="FocusDelegationNone"/>
+ <enums name="viewFlags" value="ViewTitleBarTransparent|ViewTitleBarFloating|ViewTitleBarHidden|ViewStatusBarTransparent|ViewStatusBarFloating|ViewStatusBarHidden"/>
</widget>
<connect receiver="settings_scenes_view" sender="scene_ok_button" signal="released()" slot="handleOkButtonPress()"/>
<connect receiver="settings_scenes_view" sender="scene_cancel_button" signal="released()" slot="handleCancelButtonPress()"/>
- <metadata activeUIState="Common ui state" display="NHD landscape" unit="un">
+ <metadata activeUIState="Common ui state" display="NHD-3.2-inch_landscape" unit="un">
<uistate name="Common ui state" sections="#common"/>
</metadata>
</hbdocument>
--- a/camerauis/cameraxui/cxui/layouts/video_setting.xml Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/video_setting.xml Wed Aug 18 09:37:18 2010 +0300
@@ -40,7 +40,7 @@
</setting_list>
<!-- Video scene modes -->
- <setting_list id="video_scene_modes"
+ <setting_list id="video_scene_mode"
heading="txt_cam_title_scene_mode_video"
preview="0"
type="SingleLineListBox">
--- a/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Wed Aug 18 09:37:18 2010 +0300
@@ -77,6 +77,7 @@
<string locid="txt_cam_title_camera" name="title" value="Camera"/>
<bool name="contentFullScreen" value="TRUE"/>
<bool name="visible" value="TRUE"/>
+ <enums name="viewFlags" value="ViewTitleBarTransparent|ViewTitleBarFloating|ViewTitleBarHidden|ViewStatusBarTransparent|ViewStatusBarFloating|ViewStatusBarHidden"/>
</widget>
<connect receiver="postcapture_view" sender="cxui_action_post_delete" signal="triggered(bool)" slot="showDeleteNote()"/>
<connect receiver="postcapture_view" sender="cxui_action_post_play" signal="triggered(bool)" slot="playVideo()"/>
--- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Wed Aug 18 09:37:18 2010 +0300
@@ -24,7 +24,7 @@
<object name="cxui_action_still_geotagging" type="HbAction">
<string name="settingskey" value="geotagging"/>
<string locid="txt_cam_opt_geotagging" name="text" value="Geotagging"/>
- </object>
+ </object>
<object name="cxui_action_capture" type="HbAction">
<icon iconName="qtg_mono_capture" name="icon"/>
</object>
@@ -43,6 +43,19 @@
<widget name="transparent" type="HbTransparentWindow">
<real name="z" value="0"/>
</widget>
+ <layout type="anchor">
+ <anchoritem dst="transparent" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="transparent" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="transparent" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="transparent" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ <string name="title" value="Camera"/>
+ <bool name="contentFullScreen" value="TRUE"/>
+ <enums name="viewFlags" value="ViewTitleBarTransparent|ViewTitleBarFloating|ViewTitleBarHidden|ViewStatusBarTransparent|ViewStatusBarFloating|ViewStatusBarHidden"/>
+ </widget>
+ <section name="still_capture_indicators">
+ <widget name="still_container" role="HbView:widget" type="HbWidget">
<widget name="indicatorContainer" type="HbWidget">
<widget name="mode_indicator" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
@@ -86,17 +99,15 @@
</layout>
</widget>
<layout type="anchor">
- <anchoritem dst="indicatorContainer" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
- <anchoritem dst="indicatorContainer" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
<anchoritem dst="transparent" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="transparent" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
<anchoritem dst="transparent" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
<anchoritem dst="transparent" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="indicatorContainer" dstEdge="LEFT" spacing="11un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="indicatorContainer" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
</layout>
</widget>
- <string name="title" value="Camera"/>
- <bool name="contentFullScreen" value="TRUE"/>
- </widget>
+ </section>
<section name="still_capture_with_widgets">
<widget name="still_capture_view" type="HbView">
<widget name="still_view_menu" role="HbView:menu" type="HbMenu"/>
@@ -106,7 +117,7 @@
<real name="z" value="7"/>
<sizehint type="PREFERRED" width="var(hb-param-widget-toolbar-height)"/>
<enums name="orientation" value="Vertical"/>
- <bool name="visible" value="TRUE"/>
+ <bool name="visible" value="FALSE"/>
<ref object="cxui_action_capture" role="HbWidget:addAction"/>
<ref object="cxui_action_flash" role="HbWidget:addAction"/>
<ref object="cxui_action_scenemodes" role="HbWidget:addAction"/>
@@ -135,20 +146,16 @@
<widget name="selftimer_button_container" type="HbWidget">
<widget name="still_selftimer_start_button" type="HbPushButton">
<real name="z" value="5"/>
- <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0"/>
+ <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
<sizehint type="FIXED" width="20un"/>
<string locid="txt_cam_button_start" name="text" value="Start"/>
- <bool name="visible" value="TRUE"/>
- <string name="state" value="normal"/>
<fontspec name="fontSpec" role="Undefined" textheight="var(hb-param-text-height-tiny)"/>
</widget>
<widget name="still_selftimer_cancel_button" type="HbPushButton">
<real name="z" value="4"/>
- <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0"/>
+ <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
<sizehint type="FIXED" width="20un"/>
<string locid="txt_cam_button_cancel" name="text" value="Cancel"/>
- <bool name="visible" value="TRUE"/>
- <string name="state" value="normal"/>
<fontspec name="fontSpec" role="Undefined" textheight="var(hb-param-text-height-tiny)"/>
</widget>
<real name="z" value="0"/>
@@ -193,8 +200,6 @@
</widget>
<real name="z" value="1"/>
<layout type="anchor">
- <anchoritem dst="indicatorContainer" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
- <anchoritem dst="indicatorContainer" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
<anchoritem dst="toolbar" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="toolbar" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
<anchoritem dst="toolbar" dstEdge="TOP" spacing="var(hb-param-widget-chrome-height)" src="" srcEdge="TOP"/>
@@ -208,6 +213,8 @@
<anchoritem dst="images_left_container" dstEdge="LEFT" spacing="11un" src="" srcEdge="LEFT"/>
<anchoritem dst="still_precapture_selftimer_container" dstEdge="CENTERH" spacing="0" src="" srcEdge="CENTERH"/>
<anchoritem dst="still_precapture_selftimer_container" dstEdge="CENTERV" spacing="0" src="" srcEdge="CENTERV"/>
+ <anchoritem dst="indicatorContainer" dstEdge="LEFT" spacing="11un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="indicatorContainer" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
</layout>
</widget>
</widget>
@@ -257,4 +264,4 @@
<uistate name="still_standalone_mode" sections="#common still_capture_with_widgets still_standalone_mode"/>
<uistate name="still_embedded_mode" sections="#common still_capture_with_widgets still_embedded_mode"/>
</metadata>
-</hbdocument>
+</hbdocument>
\ No newline at end of file
--- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Wed Aug 18 09:37:18 2010 +0300
@@ -47,6 +47,19 @@
<widget name="video_viewfinder_widget" type="HbTransparentWindow">
<real name="z" value="0"/>
</widget>
+ <layout type="anchor">
+ <anchoritem dst="video_viewfinder_widget" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="video_viewfinder_widget" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="video_viewfinder_widget" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="video_viewfinder_widget" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ <string locid="txt_cam_title_camera" name="title" value="Camera"/>
+ <bool name="contentFullScreen" value="TRUE"/>
+ <enums name="viewFlags" value="ViewTitleBarTransparent|ViewTitleBarFloating|ViewTitleBarHidden|ViewStatusBarTransparent|ViewStatusBarFloating|ViewStatusBarHidden"/>
+ </widget>
+ <section name="video_capture_indicators">
+ <widget name="video_container" role="HbView:widget" type="HbWidget">
<widget name="video_indicator_container_top" type="HbWidget">
<widget name="video_mode_indicator" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
@@ -71,7 +84,6 @@
<icon iconName="qtg_mono_call_mute" name="icon"/>
<sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
<sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
- <bool name="visible" value="FALSE"/>
</widget>
<real name="z" value="5"/>
<bool name="visible" value="TRUE"/>
@@ -84,17 +96,15 @@
</layout>
</widget>
<layout type="anchor">
- <anchoritem dst="video_indicator_container_top" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
- <anchoritem dst="video_indicator_container_top" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="video_indicator_container_top" dstEdge="LEFT" spacing="11un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="video_indicator_container_top" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
</layout>
</widget>
- <string locid="txt_cam_title_camera" name="title" value="Camera"/>
- <bool name="contentFullScreen" value="TRUE"/>
- </widget>
+ </section>
<section name="video_capture_with_widgets">
<widget name="video_capture_view" type="HbView">
<widget name="video_view_menu" role="HbView:menu" type="HbMenu"/>
@@ -133,36 +143,23 @@
<widget name="video_indicator_container_bottom" type="HbWidget">
<widget name="video_recording_icon" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName="qtg_small_record" name="icon"/>
+ <icon iconName="qtg_mono_pause" name="icon"/>
<sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
<sizehint height="var(hb-param-graphic-size-function)" type="FIXED" width="var(hb-param-graphic-size-function)"/>
</widget>
- <widget name="video_remaining_time" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <sizehint height="var(hb-param-graphic-size-function)" type="PREFERRED"/>
- <string name="textColor" value="#ff0000"/>
- <string name="plainText" value="00:00"/>
- <fontspec name="fontSpec" role="Undefined" textheight="var(hb-param-text-height-tiny)"/>
- </widget>
<widget name="video_elapsed_time" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
<sizehint height="var(hb-param-graphic-size-function)" type="PREFERRED"/>
- <string name="textColor" value="#ffffff"/>
- <string name="plainText" value="00:00"/>
<fontspec name="fontSpec" role="Undefined" textheight="var(hb-param-text-height-tiny)"/>
</widget>
<real name="z" value="5"/>
- <bool name="visible" value="FALSE"/>
<layout orientation="Horizontal" spacing="var(hb-param-margin-gene-middle-horizontal)" type="linear">
<contentsmargins bottom="var(hb-param-margin-gene-middle-vertical)" left="var(hb-param-margin-gene-middle-horizontal)" right="var(hb-param-margin-gene-middle-horizontal)" top="var(hb-param-margin-gene-middle-vertical)"/>
<linearitem itemname="video_recording_icon"/>
<linearitem itemname="video_elapsed_time"/>
- <linearitem itemname="video_remaining_time"/>
</layout>
</widget>
<layout type="anchor">
- <anchoritem dst="video_indicator_container_top" dstEdge="LEFT" spacing="var(hb-param-margin-gene-left)" src="" srcEdge="LEFT"/>
- <anchoritem dst="video_indicator_container_top" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
@@ -184,6 +181,8 @@
<anchoritem dst="video_viewfinder_widget" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
<anchoritem dst="video_viewfinder_widget" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="video_indicator_container_top" dstEdge="LEFT" spacing="11un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="video_indicator_container_top" dstEdge="TOP" spacing="var(hb-param-margin-gene-top)" src="" srcEdge="TOP"/>
</layout>
</widget>
</widget>
@@ -223,60 +222,21 @@
</widget>
</section>
<section name="video_idle">
- <widget name="video_elapsed_time" type="HbLabel">
- <bool name="visible" value="FALSE"/>
- </widget>
<widget name="video_recording_icon" type="HbLabel">
- <bool name="visible" value="FALSE"/>
- </widget>
- <widget name="video_indicator_container_bottom" type="HbWidget">
- <bool name="visible" value="TRUE"/>
- <layout orientation="Horizontal" spacing="var(hb-param-margin-gene-middle-horizontal)" type="linear">
- <contentsmargins bottom="var(hb-param-margin-gene-middle-vertical)" left="var(hb-param-margin-gene-middle-horizontal)" right="var(hb-param-margin-gene-middle-horizontal)" top="var(hb-param-margin-gene-middle-vertical)"/>
- <linearitem itemname="video_remaining_time"/>
- </layout>
+ <icon iconName="qtg_mono_pause" name="icon"/>
</widget>
</section>
<section name="video_recording">
- <widget name="video_elapsed_time" type="HbLabel">
- <bool name="visible" value="TRUE"/>
- </widget>
- <widget name="video_remaining_time" type="HbLabel">
- <bool name="visible" value="TRUE"/>
- </widget>
<widget name="video_recording_icon" type="HbLabel">
- <bool name="visible" value="TRUE"/>
<icon iconName="qtg_small_record" name="icon"/>
</widget>
- <widget name="video_indicator_container_bottom" type="HbWidget">
- <bool name="visible" value="TRUE"/>
- <layout orientation="Horizontal" spacing="var(hb-param-margin-gene-middle-horizontal)" type="linear">
- <contentsmargins bottom="var(hb-param-margin-gene-middle-vertical)" left="var(hb-param-margin-gene-middle-horizontal)" right="var(hb-param-margin-gene-middle-horizontal)" top="var(hb-param-margin-gene-middle-vertical)"/>
- <linearitem itemname="video_recording_icon"/>
- <linearitem itemname="video_elapsed_time"/>
- <linearitem itemname="video_remaining_time"/>
- </layout>
- </widget>
</section>
<section name="video_paused">
- <widget name="video_elapsed_time" type="HbLabel">
- <bool name="visible" value="TRUE"/>
- </widget>
<widget name="video_recording_icon" type="HbLabel">
<icon iconName="qtg_mono_pause" name="icon"/>
- <bool name="visible" value="TRUE"/>
- </widget>
- <widget name="video_indicator_container_bottom" type="HbWidget">
- <bool name="visible" value="TRUE"/>
- <layout orientation="Horizontal" spacing="var(hb-param-margin-gene-middle-horizontal)" type="linear">
- <contentsmargins bottom="var(hb-param-margin-gene-middle-vertical)" left="var(hb-param-margin-gene-middle-horizontal)" right="var(hb-param-margin-gene-middle-horizontal)" top="var(hb-param-margin-gene-middle-vertical)"/>
- <linearitem itemname="video_recording_icon"/>
- <linearitem itemname="video_elapsed_time"/>
- <linearitem itemname="video_remaining_time"/>
- </layout>
</widget>
</section>
- <metadata activeUIState="Paused" display="NHD-3.2-inch_landscape" unit="un">
+ <metadata activeUIState="Common ui state" display="NHD-3.2-inch_landscape" unit="un">
<uistate name="Common ui state" sections="#common"/>
<uistate name="All widgets" sections="#common video_capture_with_widgets"/>
<uistate name="video_standalone_mode" sections="#common video_capture_with_widgets video_standalone_mode"/>
--- a/camerauis/cameraxui/cxui/src/cxuiapplication.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplication.cpp Wed Aug 18 09:37:18 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();
}
--- a/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -32,7 +32,6 @@
*/
CxuiApplicationState::CxuiApplicationState(CxuiApplication &application,
CxeSettings &settings,
- CxuiCaptureKeyHandler &keyHandler,
CxuiDocumentLoader *documentLoader)
: mState(Background), mApplicationMonitor(NULL), mErrorManager(NULL), mEventLog(NULL)
{
--- a/camerauis/cameraxui/cxui/src/cxuicapturekeyhandler.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuicapturekeyhandler.cpp Wed Aug 18 09:37:18 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,171 +14,66 @@
* Description:
*
*/
-#include <w32std.h>
+
#include <QVariant>
#include <QKeyEvent>
-#include <eikon.hrh>
-#include <coemain.h>
-#include <e32keys.h> // for EKeyCamera
-
#include "cxuicapturekeyhandler.h"
+#ifdef Q_OS_SYMBIAN
+#include "cxuicapturekeyhandler_symbian_p.h"
+#else
+#include "cxuicapturekeyhandler_desktop_p.h"
+#endif
+
#include "cxutils.h"
#include "cxeengine.h"
#include "cxenamespace.h"
#include "cxefeaturemanager.h"
-const int CXUI_KEY_PRIORITY = 100;
+
CxuiCaptureKeyHandler::CxuiCaptureKeyHandler(CxeEngine &aEngine) :
- mAutofocusKeyPressed(false), mCaptureKeyPressed(false), mEngine(aEngine), mWsSession(CCoeEnv::Static()->WsSession()),
- mWindowGroup(CCoeEnv::Static()->RootWin())
+ d_ptr(NULL)
{
- CX_DEBUG_ENTER_FUNCTION();
-
- // Autofocus key
- mEngine.featureManager().configuredValues(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS,
- mPrimaryCameraAutofocusKeys);
-
- // Capture keys for primary camera
- mEngine.featureManager().configuredValues(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS,
- mPrimaryCameraCaptureKeys);
-
- listenKeys(true);
- CX_DEBUG_EXIT_FUNCTION();
+ d_ptr = new CxuiCaptureKeyHandlerPrivate(aEngine, this);
+
+ d_ptr->listenKeys(true);
}
CxuiCaptureKeyHandler::~CxuiCaptureKeyHandler()
-{
+{
CX_DEBUG_ENTER_FUNCTION();
- listenKeys(false);
+
+ Q_D(CxuiCaptureKeyHandler);
+ d->listenKeys(false);
+
+ delete d;
+
CX_DEBUG_EXIT_FUNCTION();
}
-/*!
-* Start or stop listening key events.
-* @param listen Should we start (true) or stop (false) listening key events.
-*/
void CxuiCaptureKeyHandler::listenKeys(bool listen)
{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (listen) {
- // Protect from multiple calls
- if (mCapturedKeyUpDownHandles.empty() && mCapturedKeyHandles.empty()) {
-
- int key(0);
- foreach (key, mPrimaryCameraAutofocusKeys) {
- CX_DEBUG(("CxuiCaptureKeyHandler - hooking autofocus key with scan / key code: %d", key));
- listenKey(key);
- }
- foreach (key, mPrimaryCameraCaptureKeys) {
- CX_DEBUG(("CxuiCaptureKeyHandler - hooking capture key with scan / key code: %d", key));
- listenKey(key);
- }
- }
- } else {
-
- int handle(0);
- foreach (handle, mCapturedKeyUpDownHandles) {
- mWindowGroup.CancelCaptureKeyUpAndDowns(handle);
- }
- mCapturedKeyUpDownHandles.clear();
-
- foreach (handle, mCapturedKeyHandles) {
- mWindowGroup.CancelCaptureKey(handle);
- }
- mCapturedKeyHandles.clear();
- }
- CX_DEBUG_EXIT_FUNCTION();
+ Q_D(CxuiCaptureKeyHandler);
+ d->listenKeys(listen);
}
bool CxuiCaptureKeyHandler::isAutofocusKeyPressed()
{
- return mAutofocusKeyPressed;
+ Q_D(CxuiCaptureKeyHandler);
+ return d->isAutofocusKeyPressed();
}
bool CxuiCaptureKeyHandler::isCaptureKeyPressed()
{
- return mCaptureKeyPressed;
+ Q_D(CxuiCaptureKeyHandler);
+ return d->isCaptureKeyPressed();
}
bool CxuiCaptureKeyHandler::handleKeyEvent(QEvent *event)
{
- CX_DEBUG_ENTER_FUNCTION();
- bool eventWasConsumed = false;
-
- if (event->type() == QEvent::KeyPress) {
- QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event);
- CX_DEBUG(("CxuiCaptureKeyHandler - key press with nativeVirtualKey(): %d", keyEvent->nativeVirtualKey()));
- CX_DEBUG(("CxuiCaptureKeyHandler - key press with nativeScanCode(): %d", keyEvent->nativeScanCode()));
-
- if ( mPrimaryCameraAutofocusKeys.contains(keyEvent->nativeScanCode())
- && !mAutofocusKeyPressed ) {
-
- mAutofocusKeyPressed = true;
- eventWasConsumed = true;
- emit autofocusKeyPressed();
-
- } else if (mPrimaryCameraCaptureKeys.contains(keyEvent->nativeScanCode())
- && !mCaptureKeyPressed) {
- mCaptureKeyPressed = true;
- eventWasConsumed = true;
- emit captureKeyPressed();
- }
- } else if (event->type() == QEvent::KeyRelease) {
- QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event);
- CX_DEBUG(("CxuiCaptureKeyHandler - key press with nativeVirtualKey(): %d", keyEvent->nativeVirtualKey()));
- CX_DEBUG(("CxuiCaptureKeyHandler - key press with nativeScanCode(): %d", keyEvent->nativeScanCode()));
-
- if ( mPrimaryCameraAutofocusKeys.contains(keyEvent->nativeScanCode())
- && mAutofocusKeyPressed ) {
-
- mAutofocusKeyPressed = false;
- eventWasConsumed = true;
- emit autofocusKeyReleased();
-
- } else if (mPrimaryCameraCaptureKeys.contains(keyEvent->nativeScanCode())
- && mCaptureKeyPressed) {
-
- mCaptureKeyPressed = false;
- eventWasConsumed = true;
- emit captureKeyReleased();
- }
- }
- CX_DEBUG_EXIT_FUNCTION();
- return eventWasConsumed;
+ Q_D(CxuiCaptureKeyHandler);
+ return d->handleKeyEvent(event);
}
-/*!
-* Helper method to listen to given key (key code or scan code).
-* We need to listen to both "key up", "key down" and "key pressed" events to
-* get all the necessary events to handleKeyEvent(). If we e.g. just listen
-* to up/down events, the way native events are translated to QKeyEvents,
-* we only get QEvent::KeyRelease event when partially in background.
-* @param key Keycode or scancode for the key to listen. Both should be listened.
-*/
-void CxuiCaptureKeyHandler::listenKey(int key)
-{
- // Capture key down and up events
- int handle = mWindowGroup.CaptureKeyUpAndDowns(key, 0, 0, CXUI_KEY_PRIORITY);
-
- // Handle < 0 means error.
- if (handle >= 0) {
- mCapturedKeyUpDownHandles.append(handle);
- } else {
- CX_DEBUG(("[WARNING] CxuiCaptureKeyHandler - Problem hooking to key-up/key-down with code: %d", key));
- }
-
- // Capture key press events
- handle = mWindowGroup.CaptureKey(key, 0, 0, CXUI_KEY_PRIORITY);
-
- if (handle >= 0) {
- mCapturedKeyHandles.append(handle);
- } else {
- CX_DEBUG(("[WARNING] CxuiCaptureKeyHandler - Problem hooking to key-press with code: %d", key));
- }
-}
-
-
// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuicapturekeyhandler_desktop_p.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:
+* Private implementation for CxuiCaptureKeyHandler
+*/
+
+#include <QVariant>
+#include <QKeyEvent>
+
+#include "cxuicapturekeyhandler.h"
+#include "cxuicapturekeyhandler_desktop_p.h"
+#include "cxutils.h"
+#include "cxeengine.h"
+#include "cxenamespace.h"
+#include "cxefeaturemanager.h"
+
+#define CXUIDESKTOP_SCANCODE_LOWERCASE_A 30
+#define CXUIDESKTOP_SCANCODE_LOWERCASE_C 46
+
+CxuiCaptureKeyHandlerPrivate::CxuiCaptureKeyHandlerPrivate(CxeEngine &aEngine, CxuiCaptureKeyHandler *parent) :
+ q_ptr(parent),
+ mEngine(aEngine),
+ mAutofocusKeyPressed(false),
+ mCaptureKeyPressed(false)
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+CxuiCaptureKeyHandlerPrivate::~CxuiCaptureKeyHandlerPrivate()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+void CxuiCaptureKeyHandlerPrivate::listenKeys(bool listen)
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+bool CxuiCaptureKeyHandlerPrivate::handleKeyEvent(QEvent *event)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ Q_Q(CxuiCaptureKeyHandler);
+
+ bool wasEventConsumed = false;
+
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event);
+ if (keyEvent->nativeScanCode() == CXUIDESKTOP_SCANCODE_LOWERCASE_A) {
+ mAutofocusKeyPressed = true;
+ wasEventConsumed = true;
+ emit q->autofocusKeyPressed();
+ } else if (keyEvent->nativeScanCode() == CXUIDESKTOP_SCANCODE_LOWERCASE_C) {
+ mCaptureKeyPressed = true;
+ wasEventConsumed = true;
+ emit q->captureKeyPressed();
+ }
+ } else if (event->type() == QEvent::KeyRelease) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event);
+ if (keyEvent->nativeScanCode() == CXUIDESKTOP_SCANCODE_LOWERCASE_A) {
+ mAutofocusKeyPressed = false;
+ wasEventConsumed = true;
+ emit q->autofocusKeyReleased();
+ } else if (keyEvent->nativeScanCode() == CXUIDESKTOP_SCANCODE_LOWERCASE_C) {
+ mCaptureKeyPressed = false;
+ wasEventConsumed = true;
+ emit q->captureKeyReleased();
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return wasEventConsumed;
+}
+
+bool CxuiCaptureKeyHandlerPrivate::isAutofocusKeyPressed()
+{
+ return mAutofocusKeyPressed;
+}
+
+bool CxuiCaptureKeyHandlerPrivate::isCaptureKeyPressed()
+{
+ return mCaptureKeyPressed;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuicapturekeyhandler_symbian_p.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,192 @@
+/*
+* 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:
+* Private implementation for CxuiCaptureKeyHandler
+*/
+
+#include <QVariant>
+#include <QKeyEvent>
+
+#include "cxuicapturekeyhandler_symbian_p.h"
+#include "cxuicapturekeyhandler.h"
+#include "cxutils.h"
+#include "cxeengine.h"
+#include "cxenamespace.h"
+#include "cxefeaturemanager.h"
+
+#include <w32std.h>
+#include <eikon.hrh>
+#include <coemain.h>
+#include <e32keys.h> // for EKeyCamera
+
+namespace {
+ const int CXUI_KEY_PRIORITY = 100;
+ const int CXUI_CAPTURE_KEY_CODE1 = 0xab;
+ const int CXUI_CAPTURE_KEY_CODE2 = 0xf849;
+ const int CXUI_AUTOFOCUS_KEY_CODE1 = 0xe2;
+ const int CXUI_AUTOFOCUS_KEY_CODE2 = 0xf880;
+
+}
+CxuiCaptureKeyHandlerPrivate::CxuiCaptureKeyHandlerPrivate(CxeEngine &aEngine, CxuiCaptureKeyHandler *parent) :
+ q_ptr(parent),
+ mEngine(aEngine),
+ mAutofocusKeyPressed(false),
+ mCaptureKeyPressed(false),
+ mWsSession(CCoeEnv::Static()->WsSession()),
+ mWindowGroup(CCoeEnv::Static()->RootWin())
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // key codes hardcoded for now
+ // Autofocus key
+ mPrimaryCameraAutofocusKeys.append(CXUI_AUTOFOCUS_KEY_CODE1);
+ mPrimaryCameraAutofocusKeys.append(CXUI_AUTOFOCUS_KEY_CODE2);
+
+ // Capture keys for primary camera
+ mPrimaryCameraCaptureKeys.append(CXUI_CAPTURE_KEY_CODE1);
+ mPrimaryCameraCaptureKeys.append(CXUI_CAPTURE_KEY_CODE2);
+
+ listenKeys(true);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+CxuiCaptureKeyHandlerPrivate::~CxuiCaptureKeyHandlerPrivate()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ listenKeys(false);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Start or stop listening key events.
+* @param listen Should we start (true) or stop (false) listening key events.
+*/
+void CxuiCaptureKeyHandlerPrivate::listenKeys(bool listen)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (listen) {
+ // Protect from multiple calls
+ if (mCapturedKeyUpDownHandles.empty() && mCapturedKeyHandles.empty()) {
+
+ int key(0);
+ foreach (key, mPrimaryCameraAutofocusKeys) {
+ CX_DEBUG(("CxuiCaptureKeyHandlerPrivate - hooking autofocus key with scan / key code: %d", key));
+ listenKey(key);
+ }
+ foreach (key, mPrimaryCameraCaptureKeys) {
+ CX_DEBUG(("CxuiCaptureKeyHandlerPrivate - hooking capture key with scan / key code: %d", key));
+ listenKey(key);
+ }
+ }
+ } else {
+
+ int handle(0);
+ foreach (handle, mCapturedKeyUpDownHandles) {
+ mWindowGroup.CancelCaptureKeyUpAndDowns(handle);
+ }
+ mCapturedKeyUpDownHandles.clear();
+
+ foreach (handle, mCapturedKeyHandles) {
+ mWindowGroup.CancelCaptureKey(handle);
+ }
+ mCapturedKeyHandles.clear();
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+bool CxuiCaptureKeyHandlerPrivate::isAutofocusKeyPressed()
+{
+ return mAutofocusKeyPressed;
+}
+
+bool CxuiCaptureKeyHandlerPrivate::isCaptureKeyPressed()
+{
+ return mCaptureKeyPressed;
+}
+
+bool CxuiCaptureKeyHandlerPrivate::handleKeyEvent(QEvent *event)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ Q_Q(CxuiCaptureKeyHandler);
+ bool eventWasConsumed = false;
+
+ if (event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event);
+ if ( mPrimaryCameraAutofocusKeys.contains(keyEvent->nativeScanCode())
+ && !mAutofocusKeyPressed ) {
+
+ mAutofocusKeyPressed = true;
+ eventWasConsumed = true;
+ emit q->autofocusKeyPressed();
+
+ } else if (mPrimaryCameraCaptureKeys.contains(keyEvent->nativeScanCode())
+ && !mCaptureKeyPressed) {
+ mCaptureKeyPressed = true;
+ eventWasConsumed = true;
+ emit q->captureKeyPressed();
+ }
+ } else if (event->type() == QEvent::KeyRelease) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent*> (event);
+
+ if ( mPrimaryCameraAutofocusKeys.contains(keyEvent->nativeScanCode())
+ && mAutofocusKeyPressed ) {
+
+ mAutofocusKeyPressed = false;
+ eventWasConsumed = true;
+ emit q->autofocusKeyReleased();
+
+ } else if (mPrimaryCameraCaptureKeys.contains(keyEvent->nativeScanCode())
+ && mCaptureKeyPressed) {
+
+ mCaptureKeyPressed = false;
+ eventWasConsumed = true;
+ emit q->captureKeyReleased();
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+ return eventWasConsumed;
+}
+
+/*!
+* Helper method to listen to given key (key code or scan code).
+* We need to listen to both "key up", "key down" and "key pressed" events to
+* get all the necessary events to handleKeyEvent(). If we e.g. just listen
+* to up/down events, the way native events are translated to QKeyEvents,
+* we only get QEvent::KeyRelease event when partially in background.
+* @param key Keycode or scancode for the key to listen. Both should be listened.
+*/
+void CxuiCaptureKeyHandlerPrivate::listenKey(int key)
+{
+ // Capture key down and up events
+ int handle = mWindowGroup.CaptureKeyUpAndDowns(key, 0, 0, CXUI_KEY_PRIORITY);
+
+ // Handle < 0 means error.
+ if (handle >= 0) {
+ mCapturedKeyUpDownHandles.append(handle);
+ } else {
+ CX_DEBUG(("[WARNING] CxuiCaptureKeyHandlerPrivate - Problem hooking to key-up/key-down with code: %d", key));
+ }
+
+ // Capture key press events
+ handle = mWindowGroup.CaptureKey(key, 0, 0, CXUI_KEY_PRIORITY);
+
+ if (handle >= 0) {
+ mCapturedKeyHandles.append(handle);
+ } else {
+ CX_DEBUG(("[WARNING] CxuiCaptureKeyHandlerPrivate - Problem hooking to key-press with code: %d", key));
+ }
+}
+
+// end of file
--- a/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -33,10 +33,12 @@
#include "cxeengine.h"
#include "cxuienums.h"
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuidocumentloaderTraces.h"
-#endif
+#endif // OST_TRACE_COMPILER_IN_USE
+#endif // Q_OS_SYMBIAN
CxuiDocumentLoader::CxuiDocumentLoader(CxeEngine *engine) : HbDocumentLoader(), mEngine(engine)
@@ -45,7 +47,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 +57,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") {
@@ -72,7 +74,7 @@
}
} 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 +85,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;
}
--- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -29,9 +29,9 @@
#include <hbtoolbar.h>
#include <hbaction.h>
#include <hbmessagebox.h>
-#include <hbnotificationdialog.h>
#include <hbactivitymanager.h>
+#include <xqaiwdecl.h>
#include <shareui.h>
#include <thumbnailmanager_qt.h>
@@ -50,10 +50,12 @@
#include "cxenamespace.h"
#include "cxuiserviceprovider.h"
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuipostcaptureviewTraces.h"
#endif
+#endif //Q_OS_SYMBIAN
using namespace CxUiLayout;
@@ -64,14 +66,12 @@
const QString FILENAME_KEY = "filename";
const int CXUI_STOP_VIEWFINDER_TIMEOUT = 5000; // 5 seconds
const int CXUI_RELEASE_CAMERA_TIMEOUT = 60000; // 60 seconds
-};
+}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::CxuiPostcaptureView
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Constructor.
+*/
CxuiPostcaptureView::CxuiPostcaptureView(QGraphicsItem *parent) :
CxuiView(parent),
mStillToolbar(NULL),
@@ -93,11 +93,9 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::~CxuiPostcaptureView
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Destructor.
+*/
CxuiPostcaptureView::~CxuiPostcaptureView()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -108,16 +106,15 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::construct
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Second phase construction.
+*/
void CxuiPostcaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
CxuiCaptureKeyHandler *keyHandler,
HbActivityManager *activityManager)
{
+ Q_UNUSED(keyHandler);
CX_DEBUG_ENTER_FUNCTION();
CxuiView::construct(mainwindow, engine, documentLoader, NULL, activityManager);
@@ -181,11 +178,9 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::handleCaptureKeyPressed
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Handle pressing capture key.
+*/
void CxuiPostcaptureView::handleCaptureKeyPressed()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -197,11 +192,9 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::handleAutofocusKeyPressed
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Handle pressing auto focus key.
+*/
void CxuiPostcaptureView::handleAutofocusKeyPressed()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -225,8 +218,7 @@
QString videoFile(getCurrentFilename());
- XQAiwRequest *videoRequest = mAppManager.create(
- "com.nokia.symbian.IVideoView","playMedia(QString)", true);
+ XQAiwRequest *videoRequest = mAppManager.create(XQI_VIDEO_PLAY, XQOP_VIDEO_PLAY, true);
if (videoRequest) {
QVariantList fileList;
@@ -238,7 +230,7 @@
bool res = videoRequest->send(result);
if (res) {
CX_DEBUG(("CxuiPostcaptureView: request sent, received \"%s\"",
- result.toString().toAscii().constData()));
+ qPrintable(result.toString())));
} else {
CX_DEBUG(("CxuiPostcaptureView: request sending failed, error=%d",
videoRequest->lastError()));
@@ -251,50 +243,42 @@
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::showDeleteNote
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Show delete query.
+*/
void CxuiPostcaptureView::showDeleteNote()
{
CX_DEBUG_ENTER_FUNCTION();
hideControls();
- if (mEngine->mode() == Cxe::VideoMode) {
- HbMessageBox::question(hbTrId("txt_cam_other_delete_video_clip"),
- this,
- SLOT(handleDeleteDialogClosed(HbAction*)));
- } else {
- HbMessageBox::question(hbTrId("txt_cam_other_delete_image"),
- this,
- SLOT(handleDeleteDialogClosed(HbAction*)));
- }
+ QString text(mEngine->mode() == Cxe::VideoMode
+ ? hbTrId("txt_cam_other_delete_video_clip")
+ : hbTrId("txt_cam_other_delete_image"));
+
+ HbMessageBox::question(text,
+ this,
+ SLOT(handleDeleteDialogClosed(int)),
+ HbMessageBox::Yes | HbMessageBox::No);
mDeleteNoteOpen = true;
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::handleDeleteDialogClosed
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiPostcaptureView::handleDeleteDialogClosed(HbAction *action)
+/*!
+* Handle closing delete query dialog.
+* @param action HbMessageBox::Yes if user accepted the delete query, HbMessageBox::No if not.
+*/
+void CxuiPostcaptureView::handleDeleteDialogClosed(int action)
{
CX_DEBUG_ENTER_FUNCTION();
hideControls();
mDeleteNoteOpen = false;
- HbMessageBox *dlg = qobject_cast<HbMessageBox*>(sender());
-
- // check that it was "primary action" that closed the dialog
- if (dlg && dlg->actions().at(0) == action) {
- // User confirmed delete
- QString filename = getCurrentFilename();
- QFileInfo fileInfo(filename);
+ // Check that user confirmed delete
+ if (action == HbMessageBox::Yes) {
+ QFileInfo fileInfo(getCurrentFilename());
if (fileInfo.exists()) {
//! @todo
// We can retry deletion if file deletion does'nt succeed,
@@ -303,7 +287,7 @@
// is being harvested by MdS etc.
QDir dir = fileInfo.absolutePath();
bool ok = dir.remove(fileInfo.fileName());
- CX_DEBUG(("Delete file [%s], status %d", fileInfo.fileName().toAscii().constData(), ok));
+ CX_DEBUG(("Delete file [%s], status %d", qPrintable(fileInfo.fileName()), ok));
// Go back to precapture view
goToPrecaptureView();
@@ -333,11 +317,9 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::goToPrecaptureView
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Go to pre-capture view.
+*/
void CxuiPostcaptureView::goToPrecaptureView()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -359,11 +341,9 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::stopViewfinder
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Stop viewfinder.
+*/
void CxuiPostcaptureView::stopViewfinder()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -394,11 +374,10 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::eventFilter
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Handle events.
+* Needed for restarting timers.
+*/
bool CxuiPostcaptureView::eventFilter(QObject *object, QEvent *event)
{
Q_UNUSED(object)
@@ -427,7 +406,12 @@
*/
void CxuiPostcaptureView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- OstTrace0(camerax_performance, CXUIPOSTCAPTUREVIEW_SNAPSHOT_DRAW, "msg: e_CX_SHOT_TO_SNAPSHOT 0");
+ // Performance trace for checking shot to snapshot time.
+ // Guard that we actually have the snapshot set before outputting the trace.
+ if (mImageLabel && !mImageLabel->icon().isNull()) {
+ OstTrace0(camerax_performance, CXUIPOSTCAPTUREVIEW_SNAPSHOT_DRAW, "msg: e_CX_SHOT_TO_SNAPSHOT 0");
+ }
+
QGraphicsWidget::paint(painter, option, widget);
}
@@ -438,12 +422,13 @@
*/
void CxuiPostcaptureView::restoreActivity(const QString &activityId, const QVariant &data)
{
+ Q_UNUSED(activityId);
CX_DEBUG_ENTER_FUNCTION();
// get filename. if filename is not found (toString() returns empty string)
// we will go back to pre-capture in updateSnapshotImage()
mFilename = data.toMap()[FILENAME_KEY].toString();
- CX_DEBUG(("Got filename %s from activity", mFilename.toAscii().data()));
+ CX_DEBUG(("Got filename [%s] from activity", qPrintable(mFilename)));
CX_DEBUG_EXIT_FUNCTION();
}
@@ -458,7 +443,7 @@
QVariantHash params;
QString filename = getCurrentFilename();
- CX_DEBUG(("Saving filename %s", filename.toAscii().data()));
+ CX_DEBUG(("Saving filename [%s]", qPrintable(filename)));
data.insert(FILENAME_KEY, filename);
QImage img(mMainWindow->rect().size(), QImage::Format_ARGB32_Premultiplied);
@@ -489,11 +474,10 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::showEvent
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Show event for this view.
+* Update snapshot and start timers.
+*/
void CxuiPostcaptureView::showEvent(QShowEvent *event)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -503,20 +487,27 @@
if (event->type() == QEvent::Show) {
QCoreApplication::instance()->installEventFilter(this);
+ // Update snapshot for current file.
+ // If the current file does not exist anymore, return to pre-capture view.
updateSnapshotImage();
- showControls();
- startTimers();
+
+ // If the image / video has been deleted, control returned to pre-capture view.
+ // No point to start timers or show controls then.
+ if (mMainWindow->currentView() == this) {
+ showControls();
+ startTimers();
+ }
+
event->accept();
}
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::hideEvent
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Hide event.
+* Release snapshot and stop timers.
+*/
void CxuiPostcaptureView::hideEvent(QHideEvent *event)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -594,73 +585,109 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (!mFilename.isNull()) {
- CX_DEBUG(("CxuiPostcaptureView::updateSnapshot restoring activity"));
+ if (isFileDeleted()) {
+ // File deleted, go to pre-capture view.
+ CX_DEBUG(("File has been deleted, going back to pre-capture"));
+ goToPrecaptureView();
+
+ } else if (!mFilename.isNull()) {
// filename set, we are restoring activity
- if (QFile::exists(mFilename)) {
- CX_DEBUG(("Filename ok, requesting thumbnail from TNM"));
- if (!mThumbnailManager) {
- mThumbnailManager = new ThumbnailManager();
- connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
- this, SLOT(handleThumbnailReady(QPixmap, void*, int, int)));
- mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
- }
- mThumbnailManager->getThumbnail(mFilename);
- CX_DEBUG(("Thumbnail requested"));
+ if (!mThumbnailManager) {
+ mThumbnailManager = new ThumbnailManager();
+ connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
+ this, SLOT(handleThumbnailReady(QPixmap)));
+ mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
+ }
+ mThumbnailManager->getThumbnail(mFilename);
+ CX_DEBUG(("Thumbnail requested"));
- } else {
- // file deleted
- CX_DEBUG(("File %s has been deleted, going back to pre-capture", mFilename.toAscii().data()));
- goToPrecaptureView();
- }
} else {
+ // Normal use of post-capture view
QPixmap snapshot;
if (mEngine->mode() == ImageMode) {
- if( mEngine->stillCaptureControl().imageCount() > 0 ) {
+
+ if (mEngine->stillCaptureControl().imageCount() > 0) {
snapshot = mEngine->stillCaptureControl()[0].snapshot();
}
} else {
snapshot = mEngine->videoCaptureControl().snapshot();
}
- if (mImageLabel) {
- mImageLabel->setIcon(HbIcon(QIcon(snapshot)));
- } else {
- // do nothing
- }
+
+ // Update the snapshot image
+ handleThumbnailReady(snapshot);
}
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Check if the file we show this post-capture view for is deleted.
+* This can happen e.g. if we send camera to background and delete
+* the file in other application. When used as activity, we may also
+* get the name of already deleted file as activity parameter.
+* @return True if the current file is deleted, false if not.
+*/
+bool CxuiPostcaptureView::isFileDeleted()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ bool deleted(false);
+
+ // Check how we entered this view.
+ if (mFilename.isNull()) {
+ CX_DEBUG(("Checking engine filename"));
+ // Normally entered post-capture view.
+ if (mEngine->mode() == ImageMode) {
+ // Check that the image have been saved already.
+ // If not, it cannot have been deleted in that case.
+ CxeStillImage &image(mEngine->stillCaptureControl()[0]);
+ CX_DEBUG(("Image filename [%s]", qPrintable(image.filename())));
+ CX_DEBUG(("Image file saved: %d exists: %d", image.saved(), QFile::exists(image.filename())));
+ deleted = image.saved() && !QFile::exists(image.filename());
+ } else {
+ // Check that video has been stopped fully.
+ // If it's still stopping, QFile may not work.
+ CX_DEBUG(("Video filename [%s]", qPrintable(mEngine->videoCaptureControl().filename())));
+ deleted = mEngine->videoCaptureControl().state() != CxeVideoCaptureControl::Stopping
+ && !QFile::exists(mEngine->videoCaptureControl().filename());
+ }
+ } else {
+ // Started as activity, check the filename given when restoring activity.
+ CX_DEBUG(("Checking filename saved in activity"));
+ deleted = !QFile::exists(mFilename);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return deleted;
+}
+
/* !
* gets the filename of the current file
*/
QString CxuiPostcaptureView::getCurrentFilename()
{
CX_DEBUG_ENTER_FUNCTION();
+ QString filename;
if (!mFilename.isNull()) {
// post-capture started by activity, engine doesn't contain correct
// filename anymore so use the stored one
CX_DEBUG(("Using filename saved in activity"));
- CX_DEBUG_EXIT_FUNCTION();
- return mFilename;
+ filename = mFilename;
+ } else {
+ CX_DEBUG(("Getting filename from engine"));
+ if (mEngine->mode() == Cxe::VideoMode) {
+ filename = mEngine->videoCaptureControl().filename();
+ } else {
+ //!@todo Currently only gets index 0 from the still capture control.
+ CxeStillCaptureControl& stillCaptureControl = mEngine->stillCaptureControl();
+ if (stillCaptureControl.imageCount() > 0) {
+ filename = stillCaptureControl[0].filename();
+ }
+ }
}
- CX_DEBUG(("Getting filename from engine"));
- QString filename;
-
- if (mEngine->mode() == Cxe::VideoMode) {
- filename = mEngine->videoCaptureControl().filename();
- } else {
- //!@todo Currently only gets index 0 from the still capture control.
- CxeStillCaptureControl& stillCaptureControl = mEngine->stillCaptureControl();
- if (stillCaptureControl.imageCount()) {
- filename = stillCaptureControl[0].filename();
- }
- }
- CX_DEBUG((filename.toAscii()));
-
+ CX_DEBUG(("Got filename [%s]", qPrintable(filename)));
CX_DEBUG_EXIT_FUNCTION();
return filename;
@@ -690,8 +717,12 @@
// Common functionality first.
CxuiView::exitStandby();
- //!@note We should not start timers until we receive the ShowEvent
- showControls();
+ // Update snapshot and check the current file is not deleted.
+ updateSnapshotImage();
+
+ if (mMainWindow->currentView() == this) {
+ showControls();
+ }
CX_DEBUG_EXIT_FUNCTION();
}
@@ -716,19 +747,13 @@
* Handle thumbnail received from ThumbnailManager.
*
* @param thumbnail Thumbnail as QPixmap
- * @param clientData Not used
- * @param id Thumbnail manager request id
- * @param errorCode Error code
*/
-void CxuiPostcaptureView::handleThumbnailReady(QPixmap thumbnail, void *clientData, int id, int errorCode)
+void CxuiPostcaptureView::handleThumbnailReady(QPixmap thumbnail)
{
CX_DEBUG_ENTER_FUNCTION();
- Q_UNUSED(clientData);
- Q_UNUSED(id);
-
if (thumbnail.isNull()) {
- CX_DEBUG(("Received null thumbnail from TNM, going to pre-capture. Error=%d", errorCode));
+ CX_DEBUG(("[WARNING] Received null thumbnail from TNM, going to pre-capture."));
// null thumbnail, go to precapture
goToPrecaptureView();
} else if (mImageLabel) {
@@ -778,9 +803,9 @@
}
if (!CxuiServiceProvider::isCameraEmbedded()) {
- CxeError::Id err = mEngine->settings().get(settingId, postCaptureTimeout);
+ postCaptureTimeout = mEngine->settings().get<int>(settingId, 0);
- if (postCaptureTimeout > 0 && err == CxeError::None) {
+ if (postCaptureTimeout > 0) {
mPostcaptureTimer.start(postCaptureTimeout);
} else {
// do nothing
--- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -15,7 +15,6 @@
*
*/
-#include <coemain.h>
#include <QProcess>
#include <QApplication>
#include <hbmainwindow.h>
@@ -53,15 +52,19 @@
#include "cxuisettingradiobuttonlist.h"
#include "cxuisettingslider.h"
#include "cxuisettingsinfo.h"
+
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
-#include "cxuiserviceprovider.h"
-#include "cxuizoomslider.h"
-#include "cxuifullscreenpopup.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuiprecaptureviewTraces.h"
#endif
-#include "cxegeotaggingtrail.h"
+
+#endif //Q_OS_SYMBIAN
+
+#include "cxuifullscreenpopup.h"
+#include "cxuiserviceprovider.h"
+#include "cxuizoomslider.h"
using namespace CxUiLayout;
using namespace CxUiSettings;
@@ -120,7 +123,7 @@
HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" );
+ OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_1, "msg: e_CX_PRECAPVIEW_CONSTRUCT 1");
CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager);
@@ -160,7 +163,7 @@
setNavigationAction(exitAction);
}
- OstTrace0( camerax_performance, DUP1_CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 0" );
+ OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_2, "msg: e_CX_PRECAPVIEW_CONSTRUCT 0");
QCoreApplication::instance()->installEventFilter(this);
CX_DEBUG_EXIT_FUNCTION();
@@ -511,8 +514,8 @@
}
// disable geotagging disclaimer after geotagging setting is triggered from FirstTimeUse dialog
QString settingId = action->property(PROPERTY_KEY_SETTING_ID).toString();
- int value = Cxe::GeoTaggingDisclaimerDisabled;
- mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
+ CX_DEBUG(("settingsKey=%s", settingId.toAscii().constData()));
+ Cxe::GeoTaggingDisclaimer value = mEngine->settings().get<Cxe::GeoTaggingDisclaimer>(CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled);
if (settingId == CxeSettingIds::GEOTAGGING && value == Cxe::GeoTaggingDisclaimerEnabled) {
// disable geotagging first-time-use dialog
disableGeotaggingDisclaimer();
@@ -886,25 +889,11 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QString ftuMsg = hbTrId("txt_cam_info_captured_photos_and_videos_will_be_ta");
- QString actionOkTxt = hbTrId("txt_common_button_ok");
- QString actionSettingsTxt = hbTrId("txt_cam_opt_general_settings");
-
- HbDialog *dialog = new HbDialog();
- HbLabel *label = new HbLabel();
+ HbMessageBox *ftuMessageBox = new HbMessageBox(hbTrId("txt_cam_info_captured_photos_and_videos_will_be_ta"),
+ HbMessageBox::MessageTypeInformation);
- // initializing dialog's content widget
- label->setPlainText(ftuMsg);
- label->setTextWrapping(Hb::TextWordWrap);
- label->setElideMode(Qt::ElideNone);
- label->setMaximumWidth(350);
- dialog->setContentWidget(label);
-
- // initializing dialog's actions
- HbAction *okAction = new HbAction(actionOkTxt, dialog);
- HbAction *settingsAction = new HbAction(actionSettingsTxt, dialog);
- dialog->addAction(okAction);
- dialog->addAction(settingsAction);
+ HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok"));
+ HbAction *settingsAction = new HbAction(hbTrId("txt_cam_info_geotagging_ftu_note_settings_button"));
// connecting signals for dialog's actions
connect(okAction,
@@ -917,11 +906,13 @@
this,
SLOT(launchGeoTaggingSetting()));
- // initializing dialog's properties
- dialog->setTimeout(HbDialog::NoTimeout);
- dialog->setDismissPolicy(HbPopup::NoDismiss);
- dialog->setAttribute(Qt::WA_DeleteOnClose, true);
- dialog->show();
+ // adding buttons to the information message
+ ftuMessageBox->setStandardButtons(HbMessageBox::NoButton);
+ ftuMessageBox->addAction(okAction);
+ ftuMessageBox->addAction(settingsAction);
+
+ ftuMessageBox->setAttribute(Qt::WA_DeleteOnClose, true);
+ ftuMessageBox->show();
CX_DEBUG_EXIT_FUNCTION();
}
@@ -941,7 +932,7 @@
/*!
-* Slot that accepts "Geotagging first-time use" note and launches geotagging setting dialog.
+* Slot that launches geotagging setting dialog.
*/
void CxuiPrecaptureView::launchGeoTaggingSetting()
{
--- a/camerauis/cameraxui/cxui/src/cxuiscenelabel.cpp Tue Jul 06 14:04:02 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +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:
-*
-*/
-
-#include "cxuiscenelabel.h"
-#include "cxeengine.h"
-#include "cxesettings.h"
-#include "cxutils.h"
-
-CxuiSceneLabel::CxuiSceneLabel(QGraphicsItem *parent, CxeEngine *engine)
-: HbLabel(parent), mSettingId(), mItemValues(), mItems(), mEngine(engine)
-{
- CX_ASSERT_ALWAYS(engine);
-}
-
-QStringList CxuiSceneLabel::itemValues() const
-{
- return mItemValues;
-}
-
-void CxuiSceneLabel::setItemValues(const QStringList &values)
-{
- CX_DEBUG_ENTER_FUNCTION();
- mItemValues = values;
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-QStringList CxuiSceneLabel::items() const
-{
- return mItems;
-}
-
-void CxuiSceneLabel::setItems(const QStringList &values)
-{
- CX_DEBUG_ENTER_FUNCTION();
- mItems = values;
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-QString CxuiSceneLabel::settingId() const
-{
- return mSettingId;
-}
-
-void CxuiSceneLabel::setSettingId(const QString &id)
-{
- CX_DEBUG_ENTER_FUNCTION();
- mSettingId = id;
- setSceneIcon();
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-void CxuiSceneLabel::setSceneIcon()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- QString scenevalue;
- if (!mSettingId.isEmpty() && !mItems.isEmpty() && !mItemValues.isEmpty()) {
- int err = mEngine->settings().get(mSettingId, scenevalue);
- int index = mItemValues.indexOf(scenevalue);
- CX_DEBUG((("err: %d index: %d"),err,index));
- setIcon(HbIcon(mItems.at(index)));
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-void CxuiSceneLabel::changeIcon(int index)
-{
- CX_DEBUG_ENTER_FUNCTION();
- if (!mItems.isEmpty()) {
- setIcon(HbIcon(mItems.at(index)));
- }
- CX_DEBUG_EXIT_FUNCTION();
-}
-
--- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -105,18 +105,18 @@
QGraphicsWidget *widget = NULL;
- widget = mDocumentLoader->findWidget(SCENE_VIEW_CONTAINER);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_CONTAINER);
mScenesContainer = qobject_cast<HbWidget *> (widget);
mScenesHeading = qobject_cast<HbLabel *>(
- mDocumentLoader->findWidget(SCENE_VIEW_HEADING_WIDGET));
+ mDocumentLoader->findWidget(SCENE_MODE_VIEW_HEADING_WIDGET));
CX_ASSERT_ALWAYS(mScenesHeading);
//Now let's retreive the pointer to icon widget
- widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_BG_IMAGE);
mScenesBackground = qobject_cast<HbLabel *> (widget);
- widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE2);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_BG_IMAGE2);
mScenesBackground2 = qobject_cast<HbLabel *> (widget);
//Assuming that the automatic scene mode is always the default one
@@ -125,7 +125,7 @@
background.setMirroringMode(HbIcon::LayoutDirection);
mScenesBackground->setIcon(background);
- widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS);
+ widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_RADIOBUTTONS);
mScenesList = qobject_cast<CxuiSettingRadioButtonList *> (widget);
mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity");
@@ -171,8 +171,7 @@
}
if (mScenesBackground) {
- QString sceneId;
- mEngine->settings().get(data.mSettingId, sceneId);
+ QString sceneId = mEngine->settings().get<QString>(data.mSettingId);
HbIcon background(backgroundForScene(sceneId));
background.setMirroringMode(HbIcon::LayoutDirection);
mScenesBackground->setIcon(background);
--- a/camerauis/cameraxui/cxui/src/cxuiselftimer.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiselftimer.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -29,6 +29,7 @@
#include "cxesettings.h"
#include "cxenamespace.h" // CxeSettingIds
#include "cxeerror.h"
+#include "cxeexception.h"
using namespace CxUiLayout;
@@ -272,12 +273,11 @@
CX_DEBUG_ENTER_FUNCTION();
// get the current postcapture timeout
- CxeError::Id error = mSettings.get(CxeSettingIds::STILL_SHOWCAPTURED, mOldPostCaptureTimeOut);
-
- if (error == CxeError::None) {
+ try {
+ mOldPostCaptureTimeOut = mSettings.get<int>(CxeSettingIds::STILL_SHOWCAPTURED);
// set continuous postcapture (view is visible until dismissed)
mSettings.set(CxeSettingIds::STILL_SHOWCAPTURED, CONTINUOUS_POSTCAPTURE);
- } else {
+ } catch (CxeException &e) {
// if there was an error, don't modify the postcapture setting
mOldPostCaptureTimeOut = UNKNOWN;
}
--- a/camerauis/cameraxui/cxui/src/cxuiserviceprovider.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiserviceprovider.cpp Wed Aug 18 09:37:18 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,21 +26,13 @@
#include "cxuiserviceprovider.h"
#include "cxesettings.h"
-CxuiServiceProvider* CxuiServiceProvider::mInstance = NULL;
-
-// TODO: get these constants from header <xqaiwdecl.h>
-// will be released wk16
-const QString CXUI_SERVICE_NAME = "cxui.com.nokia.symbian.ICameraCapture";
+#include <xqaiwdecl.h>
-const QString CAMERA_INDEX = "CameraIndex";
-const QString QUALITY = "Quality";
-const QString ALLOW_MODE_SWITCH = "AllowModeSwitch";
-const QString ALLOW_CAMERA_SWITCH = "AllowCameraSwitch";
-const QString ALLOW_QUALITY_CHANGE = "AllowQualityChange";
+CxuiServiceProvider* CxuiServiceProvider::mInstance = NULL;
CxuiServiceProvider::CxuiServiceProvider(CxeEngine *engine)
:
- XQServiceProvider(CXUI_SERVICE_NAME),
+ XQServiceProvider("cxui." + XQI_CAMERA_CAPTURE),
mRequestIndex(-1),
mEngine(engine),
mRequestedMode(Cxe::ImageMode),
@@ -151,6 +143,7 @@
if (mRequestIndex == -1) {
CX_DEBUG(("CxuiServiceProvider: no request in progress"));
QCoreApplication::instance()->quit();
+ CX_DEBUG_EXIT_FUNCTION();
return;
}
@@ -159,6 +152,7 @@
CX_DEBUG(("CxuiServiceProvider: completing request"));
if (!completeRequest(mRequestIndex, QVariant(filename))) {
// if request completion fails call quit immediately because signal is not coming
+ CX_DEBUG(("completeRequest() failed, quitting now"));
QCoreApplication::instance()->quit();
}
mRequestIndex = -1;
@@ -236,22 +230,23 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("Reading parameters"));
bool ok;
- mCameraIndex = parameters[CAMERA_INDEX].toInt(&ok);
+ mCameraIndex = parameters[XQCAMERA_INDEX].toInt(&ok);
if (!ok) {
- CX_DEBUG(("Error reading parameter %s", CAMERA_INDEX.toAscii().constData()));
+ CX_DEBUG(("Error reading parameter %s", XQCAMERA_INDEX.latin1()));
CX_DEBUG_EXIT_FUNCTION();
return false;
}
- mQuality = parameters[QUALITY].toInt(&ok);
+ mQuality = parameters[XQCAMERA_QUALITY].toInt(&ok);
if (!ok) {
- CX_DEBUG(("Error reading parameter %s", CAMERA_INDEX.toAscii().constData()));
+ CX_DEBUG(("Error reading parameter %s", XQCAMERA_QUALITY.latin1()));
CX_DEBUG_EXIT_FUNCTION();
return false;
}
- mAllowModeSwitching = parameters[ALLOW_MODE_SWITCH].toBool();
- mAllowQualityChange = parameters[ALLOW_QUALITY_CHANGE].toBool();
- mAllowCameraSwitching = parameters[ALLOW_CAMERA_SWITCH].toBool();
+ // ignore possible errors on these parameters. default values will be false
+ mAllowModeSwitching = parameters[XQCAMERA_MODE_SWITCH].toBool();
+ mAllowQualityChange = parameters[XQCAMERA_QUALITY_CHANGE].toBool();
+ mAllowCameraSwitching = parameters[XQCAMERA_INDEX_SWITCH].toBool();
CX_DEBUG_EXIT_FUNCTION();
return true;
--- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -71,9 +71,8 @@
setListBoxType(data->mListboxType);
// Store the original setting value and focus matching item.
- QString value;
- mEngine->settings().get(mSettingId, value);
- CX_DEBUG(("CxuiSettingRadioButtonList - original value: [%s]", value.toAscii().data()));
+ QString value = mEngine->settings().get<QString>(mSettingId, "");
+ CX_DEBUG(("CxuiSettingRadioButtonList - original value: [%s]", qPrintable(value)));
setOriginalSelectedItemByValue(QVariant(value));
}
}
@@ -87,15 +86,21 @@
{
CX_DEBUG_ENTER_FUNCTION();
+ // Find the index of given value among setting values.
+ // Default to first item, if given value is not found.
int index = mSettingValues.indexOf(QVariant(value));
- if (index >= 0) {
- mOriginalIndex = index;
- setSelected(index);
- // ensure that currently selected item is visible
- scrollTo(currentIndex());
- } else {
- CX_DEBUG(("[WARNING] Value %s not found, defaulting to first item", value.toString().toAscii().data()));
+ if (index < 0) {
+ CX_DEBUG(("[WARNING] Value [%s] not found, selecting first item", qPrintable(value.toString())));
+ index = 0;
}
+
+ // Store the original value.
+ mOriginalIndex = index;
+ // Select the index with current value item.
+ setSelected(index);
+ // Ensure that currently selected item is visible.
+ scrollTo(currentIndex());
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -190,33 +195,37 @@
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG(("id: %s", mSettingId.toAscii().data()));
+ CX_DEBUG(("CxuiSettingRadioButtonList - id: %s", qPrintable(mSettingId)));
if (!mSettingId.isEmpty() && !mSettingValues.isEmpty()) {
QVariant value = mSettingValues.at(index);
if (value.type() == QVariant::Int) {
- CX_DEBUG(("index:%d value:%d", index, value.toInt()));
+ CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:%d", index, value.toInt()));
// Don't set the value again, if it is the current value.
// For e.g. video quality it would result in re-preparation etc.
- int current(0);
- CxeError::Id status(mEngine->settings().get(mSettingId, current));
-
- if (status != CxeError::None || current != value.toInt()) {
- mEngine->settings().set(mSettingId, value.toInt());
+ try {
+ int current = mEngine->settings().get<int>(mSettingId);
+ if (current != value.toInt()) {
+ mEngine->settings().set(mSettingId, value.toInt());
+ }
+ } catch (CxeException &e) {
+ // ignore error
}
// inform interested clients about value changed event
emit valueSelected(value.toInt());
} else if (value.type() == QVariant::String) {
- CX_DEBUG(("index:%d value:[%s]", index, value.toString().toAscii().constData()));
+ CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:[%s]", index, qPrintable(value.toString())));
- QString current;
- CxeError::Id status(mEngine->settings().get(mSettingId, current));
- CX_DEBUG(("settings model value:[%s]", current.toAscii().constData()));
-
- if (status != CxeError::None || current != value.toString()) {
- mEngine->settings().set(mSettingId, value.toString());
+ try {
+ QString current = mEngine->settings().get<QString>(mSettingId);
+ CX_DEBUG(("CxuiSettingRadioButtonList - settings model value:[%s]", qPrintable(current)));
+ if (current != value.toString()) {
+ mEngine->settings().set(mSettingId, value.toString());
+ }
+ } catch (CxeException &e) {
+ // ignore error
}
}
}
--- a/camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -208,9 +208,9 @@
// get the localized possible strings for each image quality setting
QString vga = "txt_cam_dblist_vga";
- QString normal = "txt_cam_dblist_l1_mpix";
+ QString normal = "txt_cam_dblist_ln_mpix";
QString imagesLeft = "txt_cam_dblist_hd_720p_val_ln_images_left";
- QString widescreen = "txt_cam_dblist_l1_mpix_widescreen";
+ QString widescreen = "txt_cam_dblist_ln_mpix_widescreen";
foreach(CxeImageDetails quality, list) {
// mapping the right value for each quality
--- a/camerauis/cameraxui/cxui/src/cxuisettingslider.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuisettingslider.cpp Wed Aug 18 09:37:18 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"
@@ -95,10 +95,7 @@
mSettingId = id;
// once the settingid is set, we can get the current value for the slider from the engine
- qreal value = 0;
-
- int err = mSettings->get(mSettingId, value);
- CX_DEBUG((("err: %d value: %d"),err,value));
+ qreal value = mSettings->get<qreal>(mSettingId, 0);
// engine value has to be scaled when set to slider
setValue(value * mSliderScaleValue);
--- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -14,14 +14,16 @@
* Description:
*
*/
+#include <QVariant>
+#include <QMetaType>
+#include <QGraphicsLayout>
+
#include <hbpushbutton.h>
#include <hblabel.h>
#include <hbtoolbar.h>
#include <hbaction.h>
#include <hbmainwindow.h>
#include <hbtransparentwindow.h>
-#include <QVariant>
-#include <QMetaType>
#include <hbslider.h>
#include <hblistwidget.h>
#include <hbdialog.h>
@@ -46,10 +48,16 @@
#include "cxesettings.h"
#include "cxefeaturemanager.h" // mEngine->featureManager()
#include "cxuidocumentloader.h"
+
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
+
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuistillprecaptureviewTraces.h"
#endif
+
+#endif //Q_OS_SYMBIAN
+
#include "cxuistillprecaptureview.h"
#include "cxuiserviceprovider.h"
#include "cxuisettingdialog.h"
@@ -110,23 +118,14 @@
this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id)));
connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)),
this, SLOT(handleViewfinderStateChanged(CxeViewfinderControl::State, CxeError::Id)));
- connect(&(mEngine->settings()), SIGNAL(sceneChanged(CxeScene&)),
- this, SLOT(handleSceneChanged(CxeScene&)));
connect(&mEngine->stillCaptureControl(), SIGNAL(availableImagesChanged()),
this, SLOT(updateImagesLeftLabel()));
+ mEngine->settings().listenForSetting(CxeSettingIds::IMAGE_SCENE_DATA, this, SLOT(handleSceneChanged(const QVariant&)));
+
loadDefaultWidgets();
hideControls();
- mSelfTimer = new CxuiSelfTimer(mEngine->settings());
- connect(mSelfTimer, SIGNAL(timerFinished()), this, SLOT(focusAndCapture()));
-
- int value = Cxe::GeoTaggingDisclaimerDisabled;
- mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
- if(value == Cxe::GeoTaggingDisclaimerEnabled) {
- launchGeoTaggingDisclaimerDialog();
- }
-
OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 0" );
CX_DEBUG_EXIT_FUNCTION();
}
@@ -137,32 +136,97 @@
void CxuiStillPrecaptureView::loadDefaultWidgets()
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mDocumentLoader);
+ CX_ASSERT_ALWAYS(mDocumentLoader);
// get pointer to the viewfinder
QGraphicsWidget *widget = NULL;
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_VIEWFINDER);
mViewfinder = qobject_cast<HbTransparentWindow *>(widget);
- CX_DEBUG_ASSERT(mViewfinder);
+ CX_ASSERT_ALWAYS(mViewfinder);
+
+ reloadIndicatorWidgets();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+/*!
+ * Loads default indicators from docml and modifies the visibility
+ * according to current settings.
+ */
+void CxuiStillPrecaptureView::reloadIndicatorWidgets()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_ASSERT_ALWAYS(mDocumentLoader);
+
+ bool ok = false;
+ mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_INDICATORS_SECTION, &ok);
+ CX_ASSERT_ALWAYS(ok);
+
+ QGraphicsWidget *widget = NULL;
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_QUALITY_ICON);
mQualityIcon = qobject_cast<HbLabel *>(widget);
- CX_DEBUG_ASSERT(mQualityIcon);
+ CX_ASSERT_ALWAYS(mQualityIcon);
+
+ widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON);
+ HbLabel *flashBlinkingIcon = qobject_cast<HbLabel *>(widget);
+ CX_ASSERT_ALWAYS(flashBlinkingIcon);
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON);
mGeoTaggingIndicatorIcon = qobject_cast<HbLabel *>(widget);
- CX_DEBUG_ASSERT(mGeoTaggingIndicatorIcon);
+ CX_ASSERT_ALWAYS(mGeoTaggingIndicatorIcon);
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON);
mFaceTrackingIcon = qobject_cast<HbLabel *>(widget);
- CX_DEBUG_ASSERT(mFaceTrackingIcon);
+ CX_ASSERT_ALWAYS(mFaceTrackingIcon);
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER);
mIndicators = qobject_cast<HbWidget *>(widget);
- CX_DEBUG_ASSERT(mIndicators);
+ CX_ASSERT_ALWAYS(mIndicators);
+
+ QGraphicsLayout *layout = mIndicators->layout();
+ QGraphicsLayoutItem *graphicsLayoutItem = NULL;
+ QGraphicsItem *graphicsItem = NULL;
+ QString key = "";
+ int currentSettingValue = -1;
+ bool isSettingOff = false;
+ // Go through the items in the layout to check whether they should be
+ // shown or not in the indicator pane. Start from the last towards
+ // the first, so that removing items from between works correctly.
+ for (int i = layout->count() - 1; i >= 0; i--) {
+ graphicsLayoutItem = layout->itemAt(i);
+ isSettingOff = false;
+ if (graphicsLayoutItem) {
+ graphicsItem = graphicsLayoutItem->graphicsItem();
+ currentSettingValue = -1;
+ if (graphicsItem == mGeoTaggingIndicatorIcon) {
+ key = CxeSettingIds::GEOTAGGING;
+ currentSettingValue = mEngine->settings().get(key, currentSettingValue);
+ if (currentSettingValue == Cxe::GeoTaggingOff) {
+ isSettingOff = true;
+ }
+ } else if (graphicsItem == mFaceTrackingIcon) {
+ key = CxeSettingIds::FACE_TRACKING;
+ currentSettingValue = mEngine->settings().get(key, currentSettingValue);
+ // facetracking implementation does not use
+ // enum for on/off values but instead
+ // 0 for off and 1 for on.
+ if (currentSettingValue == 0) {
+ isSettingOff = true;
+ }
+ } else if (graphicsItem == flashBlinkingIcon) {
+ //remove flash indicator
+ isSettingOff = true;
+ }
+ if (isSettingOff) {
+ layout->removeAt(i);
+ }
+ }
+ }
+
// create background for indicator container
createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
+ mIndicators->setVisible(true);
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -173,9 +237,9 @@
void CxuiStillPrecaptureView::loadWidgets()
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mDocumentLoader);
+ CX_ASSERT_ALWAYS(mDocumentLoader);
- if( mWidgetsLoaded ) {
+ if (mWidgetsLoaded) {
CX_DEBUG(("Widgets already loaded"));
CX_DEBUG_EXIT_FUNCTION();
return;
@@ -187,14 +251,14 @@
OstTrace0( camerax_performance, DUP4_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 1" );
mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_WIDGETS_SECTION, &ok);
- Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+ CX_ASSERT_ALWAYS(ok);
if (CxuiServiceProvider::isCameraEmbedded()) {
mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
} else {
mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_STANDALONE_SECTION, &ok);
}
OstTrace0( camerax_performance, DUP5_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 0" );
- Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+ CX_ASSERT_ALWAYS(ok);
// get pointers to ui components from the layout data
QGraphicsWidget *widget = NULL;
@@ -202,47 +266,48 @@
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER);
mSlider = qobject_cast<CxuiZoomSlider *>(widget);
- CX_DEBUG_ASSERT(mSlider);
+ CX_ASSERT_ALWAYS(mSlider);
mSlider->addZoomButtons();
createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC);
- if (mSelfTimer) {
- // let selftimer class get needed selftimer related widgets
- // from the documentloader
- mSelfTimer->loadSelftimerWidgets(mDocumentLoader);
- }
-
// create background for selftimer containers
HbWidget *container = NULL;
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_CONTAINER);
container = qobject_cast<HbWidget *>(widget);
- CX_DEBUG_ASSERT(container);
+ CX_ASSERT_ALWAYS(container);
createWidgetBackgroundGraphic(container, TRANSPARENT_BACKGROUND_GRAPHIC);
// connect selftimer start button to hide controls
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_START_BUTTON);
HbPushButton *startButton = qobject_cast<HbPushButton *>(widget);
- CX_DEBUG_ASSERT(startButton);
+ CX_ASSERT_ALWAYS(startButton);
connect(startButton, SIGNAL(released()), this, SLOT(hideControls()));
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR);
mToolbar = qobject_cast<HbToolBar *>(widget);
- CX_DEBUG_ASSERT(mToolbar);
+ CX_ASSERT_ALWAYS(mToolbar);
object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION);
mFlashSetting = qobject_cast<HbAction *>(object);
- CX_DEBUG_ASSERT(mFlashSetting);
+ CX_ASSERT_ALWAYS(mFlashSetting);
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL);
mImagesLeft = qobject_cast<HbLabel *>(widget);
- CX_DEBUG_ASSERT(mImagesLeft);
+ CX_ASSERT_ALWAYS(mImagesLeft);
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER);
mImagesLeftContainer = qobject_cast<HbWidget *>(widget);
- CX_DEBUG_ASSERT(mImagesLeftContainer);
+ CX_ASSERT_ALWAYS(mImagesLeftContainer);
createWidgetBackgroundGraphic(mImagesLeftContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
updateImagesLeftLabel();
+ // Create self timer.
+ // Let selftimer class get needed selftimer related widgets from the documentloader
+ mSelfTimer = new CxuiSelfTimer(mEngine->settings());
+ CX_ASSERT_ALWAYS(mSelfTimer);
+ connect(mSelfTimer, SIGNAL(timerFinished()), this, SLOT(focusAndCapture()));
+ mSelfTimer->loadSelftimerWidgets(mDocumentLoader);
+
if (CxuiServiceProvider::isCameraEmbedded()) {
CX_DEBUG(("EMBEDDED: camera in embedded mode"));
@@ -274,19 +339,20 @@
mWidgetsLoaded = true;
// Update toolbar flash mode icon
- int flash;
- if (mEngine->settings().get(CxeSettingIds::FLASH_MODE, flash) == CxeError::None) {
- handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash);
- }
+ int flash = mEngine->settings().get<int>(CxeSettingIds::FLASH_MODE);
+ handleSettingValueChanged(CxeSettingIds::FLASH_MODE, flash);
// Update toolbar scene mode icon
- QString sceneId;
- if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) {
- updateSceneIcon(sceneId);
- }
+ updateSceneIcon(mEngine->settings().get<QString>(CxeSettingIds::IMAGE_SCENE));
hideControls();
+ // Check if we need to show the geotagging disclaimer for first time use.
+ Cxe::GeoTaggingDisclaimer value = mEngine->settings().get<Cxe::GeoTaggingDisclaimer>(CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled);
+ if (value == Cxe::GeoTaggingDisclaimerEnabled) {
+ launchGeoTaggingDisclaimerDialog();
+ }
+
// View is ready. Needed for startup performance automated testing.
emit viewReady();
@@ -392,7 +458,7 @@
// On error (missing settings) default to "postcapture on".
int showPostcapture(-1);
if(mEngine) {
- mEngine->settings().get(CxeSettingIds::STILL_SHOWCAPTURED, showPostcapture);
+ showPostcapture = mEngine->settings().get<int>(CxeSettingIds::STILL_SHOWCAPTURED, -1);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -421,7 +487,7 @@
if (mDocumentLoader) {
QObject *obj = mDocumentLoader->findObject(iconObjectName);
- CX_DEBUG_ASSERT(obj);
+ CX_ASSERT_ALWAYS(obj);
qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
}
} else {
@@ -440,9 +506,7 @@
if (mQualityIcon && mEngine) {
QString icon = "";
- int currentValue = -1;
-
- mEngine->settings().get(CxeSettingIds::IMAGE_QUALITY, currentValue);
+ int currentValue = mEngine->settings().get<int>(CxeSettingIds::IMAGE_QUALITY, -1);
icon = getSettingItemIcon(CxeSettingIds::IMAGE_QUALITY, currentValue);
mQualityIcon->setIcon(HbIcon(icon));
@@ -491,16 +555,17 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (!mEngine->autoFocusControl().supported()) {
+ if (!mEngine->autoFocusControl().supported() ||
+ mEngine->autoFocusControl().isFixedFocusMode(mEngine->autoFocusControl().mode())) {
// autofocus is not supported, so start capturing straight away
capture();
} else {
+ setCapturePending();
// start focusing
// Auto-focus can only work if viewfinder is running
if (mEngine->viewfinderControl().state() == CxeViewfinderControl::Running) {
mEngine->autoFocusControl().start(false);
}
- setCapturePending();
}
CX_DEBUG_EXIT_FUNCTION();
@@ -797,11 +862,12 @@
Slot for handling scene mode change
\param scene QVariantMap containing settings related to the new scene mode
*/
-void CxuiStillPrecaptureView::handleSceneChanged(CxeScene &scene)
+void CxuiStillPrecaptureView::handleSceneChanged(const QVariant &newSceneData)
{
CX_DEBUG_ENTER_FUNCTION();
if (mEngine->mode() == Cxe::ImageMode) {
+ CxeScene scene = newSceneData.toMap();
// update toolbar scene mode icon
updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString());
@@ -812,10 +878,10 @@
} else {
// No flash mode specified within the scene.
// Check from setting model what is it currently.
- int flashMode(Cxe::FlashAuto);
- mEngine->settings().get(CxeSettingIds::FLASH_MODE, flashMode);
+ Cxe::FlashMode flashMode = mEngine->settings().get<Cxe::FlashMode>(CxeSettingIds::FLASH_MODE, Cxe::FlashAuto);
handleSettingValueChanged(CxeSettingIds::FLASH_MODE, QVariant(flashMode));
}
+
}
CX_DEBUG_EXIT_FUNCTION();
@@ -860,7 +926,10 @@
// update images left when quality values are changed
updateImagesLeftLabel();
} else if (key == CxeSettingIds::FACE_TRACKING) {
+ reloadIndicatorWidgets();
updateFaceTrackingIcon();
+ } else if (key == CxeSettingIds::GEOTAGGING) {
+ reloadIndicatorWidgets();
}
// update toolbar flash icon
@@ -914,10 +983,8 @@
launchSettingsDialog(action);
// special case to get value changed event to the selftimer class
if (settingsKey == CxeSettingIds::SELF_TIMER) {
- // if selftimer is active remember the previously selected value
- if (mSelfTimer->isEnabled()) {
- mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout());
- }
+ // selftimer is not found in settings so set the value now
+ mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout());
connect(mSettingsDialogList, SIGNAL(valueSelected(int)),
mSelfTimer, SLOT(changeTimeOut(int)));
}
@@ -958,11 +1025,10 @@
if (mFaceTrackingIcon && mEngine) {
QString key = "";
QString icon = "";
- int currentValue = -1;
key = CxeSettingIds::FACE_TRACKING;
- mEngine->settings().get(key, currentValue);
+ int currentValue = mEngine->settings().get<int>(key, -1);
icon = getSettingItemIcon(key, currentValue);
mFaceTrackingIcon->setIcon(HbIcon(icon));
--- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -15,9 +15,10 @@
*
*/
-#include <e32keys.h>
+
#include <QApplication>
+#include <QGraphicsLayout>
#include <hbmainwindow.h>
#include <hbaction.h>
@@ -45,12 +46,17 @@
#include "cxuizoomslider.h"
#include "cxuicapturekeyhandler.h"
#include "cxuidocumentloader.h"
+#include "cxuiserviceprovider.h"
+
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
+
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuivideoprecaptureviewTraces.h"
#endif
-#include "cxuiserviceprovider.h"
+#include <e32keys.h>
+#endif //Q_OS_SYMBIAN
using namespace Cxe;
using namespace CxUiLayout;
@@ -64,6 +70,7 @@
//!@todo Localization?
static const char* VIDEO_TIME_FORMAT = "%02d:%02d";
+ const int POSTCAPTURE_ON = -1;
}
@@ -72,8 +79,7 @@
mElapsedTimer(this),
mTimeElapsed(0),
mTimeRemaining(0),
- mElapsedTimeText(NULL),
- mRemainingTimeText(NULL),
+ mVideoTimeText(NULL),
mRecordingIcon(NULL),
mGoToStillAction(NULL),
mToolbarIdle(NULL),
@@ -95,6 +101,13 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ * Construct-method handles initialisation tasks for this class.
+ * @param mainwindow
+ * @param engine
+ * @param documentLoader
+ * @param keyHandler
+ */
void CxuiVideoPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
CxuiCaptureKeyHandler *keyHandler,
@@ -108,15 +121,13 @@
mVideoCaptureControl = &(engine->videoCaptureControl());
connect(&mElapsedTimer, SIGNAL(timeout()), this, SLOT(updateTimeLabels()));
- connect(mVideoCaptureControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&, const QString&)),
- this, SLOT(handleSnapshot(CxeError::Id)));
connect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)),
this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id)));
- connect(&(mEngine->settings()), SIGNAL(sceneChanged(CxeScene&)),
- this, SLOT(handleSceneChanged(CxeScene&)));
connect(mVideoCaptureControl, SIGNAL(remainingTimeChanged()),
this, SLOT(updateTimeLabels()));
+ mEngine->settings().listenForSetting(CxeSettingIds::VIDEO_SCENE, this, SLOT(handleSceneChanged(const QVariant&)));
+
mPauseTimer.setSingleShot(true);
connect(&mPauseTimer, SIGNAL(timeout()), this, SLOT(stop()));
mPauseTimer.setInterval(CXUI_PAUSE_TIMEOUT);
@@ -133,34 +144,105 @@
}
+/*!
+ * Loads widgets that are needed right from the start.
+ */
void CxuiVideoPrecaptureView::loadDefaultWidgets()
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mDocumentLoader);
+ CX_ASSERT_ALWAYS(mDocumentLoader);
// get pointers to ui components from the layout data
QGraphicsWidget *widget = NULL;
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIEWFINDER);
mViewfinder = qobject_cast<HbTransparentWindow *> (widget);
- CX_DEBUG_ASSERT(mViewfinder);
-
- widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON);
- mQualityIcon = qobject_cast<HbLabel *> (widget);
- CX_DEBUG_ASSERT(mQualityIcon);
+ CX_ASSERT_ALWAYS(mViewfinder);
- widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP);
- mIndicators = qobject_cast<HbWidget *>(widget);
- CX_DEBUG_ASSERT(mIndicators);
- // Create background graphics for indicator container
- createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
+ reloadIndicatorWidgets();
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ * Loads default indicators from docml and modifies the visibility
+ * according to current settings.
+ */
+void CxuiVideoPrecaptureView::reloadIndicatorWidgets()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_ASSERT_ALWAYS(mDocumentLoader);
+
+ bool ok = false;
+ mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_INDICATORS_SECTION, &ok);
+ CX_ASSERT_ALWAYS(ok);
+
+ QGraphicsWidget *widget = NULL;
+ widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON);
+ mQualityIcon = qobject_cast<HbLabel *> (widget);
+ CX_ASSERT_ALWAYS(mQualityIcon);
+
+ widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON);
+ HbLabel *videoaudiomuteIndicatorIcon = qobject_cast<HbLabel *>(widget);
+ CX_ASSERT_ALWAYS(videoaudiomuteIndicatorIcon);
+
+ widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON);
+ HbLabel *videoStabilityIndicatorIcon = qobject_cast<HbLabel *>(widget);
+ CX_ASSERT_ALWAYS(videoStabilityIndicatorIcon);
+
+ widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP);
+ mIndicators = qobject_cast<HbWidget *>(widget);
+ CX_ASSERT_ALWAYS(mIndicators);
+
+ QGraphicsLayout *layout = mIndicators->layout();
+ QGraphicsLayoutItem *graphicsLayoutItem = NULL;
+ QGraphicsItem *graphicsItem = NULL;
+ QString key = "";
+ int currentSettingValue = -1;
+ bool isSettingOff = false;
+ // Go through the items in the layout to check whether they should be
+ // shown or not in the indicator pane. Start from the last towards
+ // the first, so that removing items from between works correctly.
+ for (int i = layout->count() - 1; i >= 0; i--) {
+ graphicsLayoutItem = layout->itemAt(i);
+ isSettingOff = false;
+ if (graphicsLayoutItem) {
+ graphicsItem = graphicsLayoutItem->graphicsItem();
+ currentSettingValue = -1;
+ if (graphicsItem == videoaudiomuteIndicatorIcon) {
+ key = CxeSettingIds::VIDEO_MUTE_SETTING;
+ currentSettingValue = mEngine->settings().get(key, currentSettingValue);
+ // video mute implementation does not use
+ // enum for on/off values but instead
+ // 0 for off and 1 for on.
+ if (currentSettingValue == 0) {
+ isSettingOff = true;
+ }
+ } else if (graphicsItem == videoStabilityIndicatorIcon) {
+ // remove video stability indicator.
+ isSettingOff = true;
+ }
+ if (isSettingOff) {
+ layout->removeAt(i);
+ }
+ }
+ }
+
+ // Create background graphics for indicator container
+ createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC);
+
+ mIndicators->setVisible(true);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Loads widgets that are not part of the default section in layouts xml.
+ * Widgets are created at the time they are first loaded.
+ */
void CxuiVideoPrecaptureView::loadWidgets()
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mDocumentLoader);
+ CX_ASSERT_ALWAYS(mDocumentLoader);
if (mWidgetsLoaded) {
CX_DEBUG(("Widgets already loaded"));
@@ -176,17 +258,17 @@
// load widgets section (creates the widgets)
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_WIDGETS_SECTION, &ok);
- Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+ CX_ASSERT_ALWAYS(ok);
if (CxuiServiceProvider::isCameraEmbedded()) {
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_EMBEDDED_SECTION, &ok);
} else {
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_STANDALONE_SECTION, &ok);
}
- Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing");
+ CX_ASSERT_ALWAYS(ok);
// get needed pointers to some of the widgets
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ZOOM_SLIDER);
mSlider = qobject_cast<CxuiZoomSlider *> (widget);
- CX_DEBUG_ASSERT(mSlider);
+ CX_ASSERT_ALWAYS(mSlider);
//Let's add a plus and minus buttons to the slider
mSlider->addZoomButtons();
@@ -201,9 +283,9 @@
mToolbar = mToolbarIdle;
- CX_DEBUG_ASSERT(mToolbarIdle);
- CX_DEBUG_ASSERT(mToolbarRec);
- CX_DEBUG_ASSERT(mToolbarPaused);
+ CX_ASSERT_ALWAYS(mToolbarIdle);
+ CX_ASSERT_ALWAYS(mToolbarRec);
+ CX_ASSERT_ALWAYS(mToolbarPaused);
hideControls();
@@ -240,20 +322,16 @@
HbWidget *indicatorContainer;
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_BOTTOM);
indicatorContainer = qobject_cast<HbWidget *>(widget);
- CX_DEBUG_ASSERT(indicatorContainer);
+ CX_ASSERT_ALWAYS(indicatorContainer);
createWidgetBackgroundGraphic(indicatorContainer, TRANSPARENT_BACKGROUND_GRAPHIC);
- widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ELAPSED_TIME_LABEL);
- mElapsedTimeText = qobject_cast<HbLabel *> (widget);
- CX_DEBUG_ASSERT(mElapsedTimeText);
-
- widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_REMAINING_TIME_LABEL);
- mRemainingTimeText = qobject_cast<HbLabel *> (widget);
- CX_DEBUG_ASSERT(mRemainingTimeText);
+ widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEO_TIME_LABEL);
+ mVideoTimeText = qobject_cast<HbLabel *> (widget);
+ CX_ASSERT_ALWAYS(mVideoTimeText);
widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_RECORDING_ICON);
mRecordingIcon = qobject_cast<HbLabel *> (widget);
- CX_DEBUG_ASSERT(mRecordingIcon);
+ CX_ASSERT_ALWAYS(mRecordingIcon);
mWidgetsLoaded = true;
@@ -268,9 +346,10 @@
// Update toolbar scene mode icon.
- QString sceneId;
- if (mEngine->settings().get(CxeSettingIds::SCENE_ID, sceneId) == CxeError::None) {
- updateSceneIcon(sceneId);
+ try {
+ updateSceneIcon(mEngine->settings().get<QString>(CxeSettingIds::VIDEO_SCENE));
+ } catch (CxeException &e) {
+ // ignore error
}
// Initialize the video time counters.
@@ -345,6 +424,7 @@
}
}
+
/**
* Get if postcapture view should be shown or not.
* Postcapture view may be shown for a predefined time or
@@ -361,9 +441,9 @@
// Read the value from settings. Ignoring reading error.
// On error (missing settings) default to "postcapture on".
- int showPostcapture(-1);
+ int showPostcapture(POSTCAPTURE_ON);
if(mEngine) {
- mEngine->settings().get(CxeSettingIds::VIDEO_SHOWCAPTURED, showPostcapture);
+ showPostcapture = mEngine->settings().get<int>(CxeSettingIds::VIDEO_SHOWCAPTURED, POSTCAPTURE_ON);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -391,7 +471,7 @@
if (mDocumentLoader) {
QObject *obj = mDocumentLoader->findObject(iconObjectName);
- CX_DEBUG_ASSERT(obj);
+ CX_ASSERT_ALWAYS(obj);
qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
}
} else {
@@ -410,9 +490,8 @@
if (mQualityIcon && mEngine) {
QString icon = "";
- int currentValue = -1;
- mEngine->settings().get(CxeSettingIds::VIDEO_QUALITY, currentValue);
+ int currentValue = mEngine->settings().get<int>(CxeSettingIds::VIDEO_QUALITY, -1);
icon = getSettingItemIcon(CxeSettingIds::VIDEO_QUALITY, currentValue);
mQualityIcon->setIcon(HbIcon(icon));
@@ -421,13 +500,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-void CxuiVideoPrecaptureView::handleSnapshot(CxeError::Id /*error*/)
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
void CxuiVideoPrecaptureView::record()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -436,7 +508,9 @@
mVideoCaptureControl->remainingTime(time);
if (time) {
- mMenu = takeMenu();
+ if (!mMenu){ // Only take out menu, if we have not already done it
+ mMenu = takeMenu();
+ }
mVideoCaptureControl->record();
} else {
emit errorEncountered(CxeError::DiskFull);
@@ -556,13 +630,12 @@
void CxuiVideoPrecaptureView::goToStill()
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, DUP1_CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" );
+ OstTrace0( camerax_performance, CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" );
hideControls();
mEngine->initMode(ImageMode);
emit changeToPrecaptureView();
- OstTrace0( camerax_performance, DUP2_CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 0" );
CX_DEBUG_EXIT_FUNCTION();
}
@@ -573,7 +646,7 @@
{
CX_DEBUG_IN_FUNCTION();
- if (!mRemainingTimeText || !mElapsedTimeText) {
+ if (!mVideoTimeText) {
// Section not loaded yet. Skip update until created.
CX_DEBUG(("CxuiVideoPrecaptureView: video time labels not loaded yet!"));
CX_DEBUG_EXIT_FUNCTION();
@@ -606,8 +679,7 @@
break;
}
- setVideoTime(mRemainingTimeText, mTimeRemaining);
- setVideoTime(mElapsedTimeText, mTimeElapsed);
+ setVideoTime(mVideoTimeText, mTimeElapsed, mTimeRemaining);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -630,23 +702,28 @@
/*!
* Helper method for formatting video time to requested label.
* @param label Text label to show the time.
-* @param time Time in seconds to be formatted to the label text.
+* @param elapsedTime Elapsed time in seconds to be formatted to the label text.
+* @param remainingTime Remaining time in seconds to be formatted to the label text.
*/
-void CxuiVideoPrecaptureView::setVideoTime(HbLabel* label, int time)
+void CxuiVideoPrecaptureView::setVideoTime(HbLabel* label,
+ int elapsedTime,
+ int remainingTime)
{
// Convert time (seconds) into mm:ss
// HbExtendedLocale wraps minutes at 60 so we can't use that.
// We need to show times over 1 hour, e.g. "90:00".
- QString timeString;
- timeString.sprintf(VIDEO_TIME_FORMAT, time/60, time%60);
- label->setPlainText(timeString);
+ QString elapsed, remaining;
+ elapsed.sprintf(VIDEO_TIME_FORMAT, elapsedTime/60, elapsedTime%60);
+ remaining.sprintf(VIDEO_TIME_FORMAT, remainingTime/60, remainingTime%60);
+
+ label->setPlainText(hbTrId("txt_cam_info_redorcding_time").arg(elapsed).arg(remaining));
}
bool CxuiVideoPrecaptureView::getElapsedTime()
{
CX_DEBUG_ENTER_FUNCTION();
- TBool status = mVideoCaptureControl->elapsedTime(mTimeElapsed);
+ bool status = mVideoCaptureControl->elapsedTime(mTimeElapsed);
CX_DEBUG(("Elapsed time: %d", mTimeElapsed));
CX_DEBUG(("status: %d", status));
@@ -705,6 +782,7 @@
if (mDocumentLoader){
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_RECORDING);
}
+
mElapsedTimer.start(CXUI_ELAPSED_TIME_TIMEOUT);
disableFeedback();
@@ -758,8 +836,7 @@
// don't change anything
break;
default:
- // in any other state, just hide the controls
- setRecordingItemsVisibility(false);
+ // don't change anything
break;
}
@@ -863,6 +940,10 @@
// update video remaining time counter when video quality is changed
updateTimeLabels();
+ } else if (key == CxeSettingIds::GEOTAGGING) {
+ reloadIndicatorWidgets();
+ } else if (key == CxeSettingIds::VIDEO_MUTE_SETTING) {
+ reloadIndicatorWidgets();
}
}
@@ -873,36 +954,18 @@
* Handle scene mode change.
* @param scene The new active scene mode.
*/
-void CxuiVideoPrecaptureView::handleSceneChanged(CxeScene &scene)
+void CxuiVideoPrecaptureView::handleSceneChanged(const QVariant &scene)
{
CX_DEBUG_ENTER_FUNCTION();
// Ignore if not in video mode.
if (mEngine->mode() == Cxe::VideoMode) {
// Update toolbar scene mode icon.
- updateSceneIcon(scene[CxeSettingIds::SCENE_ID].toString());
+ updateSceneIcon(scene.toString());
}
CX_DEBUG_EXIT_FUNCTION();
}
-
-
-/*!
- Sets the visibility of recording icon and elapsed time text.
- \param visible True if widgets are to be shown, false if not.
-*/
-void CxuiVideoPrecaptureView::setRecordingItemsVisibility(bool visible) {
-
- if (mRecordingIcon) {
- mRecordingIcon->setVisible(visible);
- mRecordingIcon->setOpacity(1.0f);
- }
-
- if (mElapsedTimeText) {
- mElapsedTimeText->setVisible(visible);
- }
-}
-
/*!
* Overridden eventFilter() to restart the pause timer.
*/
--- a/camerauis/cameraxui/cxui/src/cxuiview.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -86,6 +86,9 @@
connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls()));
mHideControlsTimeout.setSingleShot(true);
mHideControlsTimeout.setInterval(CXUI_HIDE_CONTROLS_TIMEOUT);
+
+ mControlsFeedback.setOwningWindow(mMainWindow);
+ CX_DEBUG_EXIT_FUNCTION();
}
/*!
@@ -265,19 +268,8 @@
mHideControlsTimeout.stop();
}
- // Hide title bar and status bar.
- //!@todo: View flags property is missing from HbView, so can't set these in DocML.
- HbView::HbViewFlags flags(HbView::ViewTitleBarTransparent
- | HbView::ViewTitleBarFloating
- | HbView::ViewTitleBarHidden
- | HbView::ViewStatusBarTransparent
- | HbView::ViewStatusBarFloating
- | HbView::ViewStatusBarHidden);
- setViewFlags(flags);
- //!@todo: Once the flags are defined in DocML, we can just use these convenience functions
- // to hide the title bar and status bar here.
- //setTitleBarVisible(false);
- //setStatusBarVisible(false);
+ setTitleBarVisible(false);
+ setStatusBarVisible(false);
hideZoom();
@@ -455,11 +447,9 @@
{
//! @todo temporary workaround for title bar mouse event handling bug
if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70 &&
- isFeedbackEnabled()) {
- // todo: sound disabling doesn't work in orbit yet so don't do feedback on release
- // needs to be enabled when orbit support is done
- //mControlsFeedback.setModalities(HbFeedback::Tactile);
- //mControlsFeedback.play();
+ isFeedbackEnabled()) {
+ mControlsFeedback.setModalities(HbFeedback::Tactile);
+ mControlsFeedback.play();
toggleControls();
event->accept();
}
--- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -17,11 +17,11 @@
#include <QDebug>
#include <QTimer>
#include <hbmainwindow.h>
-#include <coemain.h>
#include <QGraphicsSceneEvent>
#include <hbstyleloader.h>
#include <hbactivitymanager.h>
#include <hbaction.h>
+#include <xqserviceutil.h>
#include "cxuiapplication.h"
#include "cxuiapplicationstate.h"
@@ -43,11 +43,16 @@
#include "cxuiserviceprovider.h"
#include "cxuiscenemodeview.h"
+
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
+
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuiviewmanagerTraces.h"
#endif
+#endif //Q_OS_SYMBIAN
+
using namespace Cxe;
using namespace CxUiLayout;
@@ -68,8 +73,7 @@
mKeyHandler(NULL),
mCameraDocumentLoader(NULL),
mApplicationState(NULL),
- mErrorManager(NULL),
- mSceneModeView(NULL)
+ mErrorManager(NULL)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -77,18 +81,18 @@
mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML);
mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML);
mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML);
- mDocmlFilesByView.insert(STILL_SCENES_VIEW, SCENEMODE_SETTING_XML);
+ mDocmlFilesByView.insert(SCENE_MODE_VIEW, SCENEMODE_SETTING_XML);
// Key handler
mKeyHandler = new CxuiCaptureKeyHandler(mEngine);
// Document loader
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_1, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1");
mCameraDocumentLoader = new CxuiDocumentLoader(&engine);
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_2, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0");
// Application state
- mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), *mKeyHandler, mCameraDocumentLoader);
+ mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), mCameraDocumentLoader);
CX_ASSERT_ALWAYS(mApplicationState);
bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)),
this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State)));
@@ -160,7 +164,7 @@
Q_UNUSED(oldState);
CX_DEBUG_ENTER_FUNCTION();
- CxuiView *view = qobject_cast<CxuiView *>(mMainWindow.currentView());
+ CxuiView *view = currentView();
CX_DEBUG(("CxuiViewManager - current view %d", view));
switch (newState) {
@@ -206,7 +210,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
// Store view that is active now.
- CxuiView *view = qobject_cast<CxuiView *>(mMainWindow.currentView());
+ CxuiView *view = currentView();
CX_DEBUG(("CxuiViewManager - current view %d", view));
// Emit signal so current view can enter standby.
@@ -217,6 +221,7 @@
disconnectSignals(view);
// Make sure standby timer is not running.
stopStandbyTimer();
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -240,35 +245,12 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
- * Init engine to correct mode based on activity being restored.
- */
-void CxuiViewManager::initEngine()
-{
- Cxe::CameraMode mode = Cxe::ImageMode;
- QString activityId = mApplication.activateId();
- if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
- activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
- mode = Cxe::VideoMode;
- }
- if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY ||
- activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) {
- // init engine only if going to pre-capture
- mEngine.initMode(mode);
- } else {
- // in post-capture don't init but set the correct mode to engine
- // so init can be done later
- mEngine.setMode(mode);
- }
-}
-
/*!
* Helper function to return current view cast to CxuiView.
*/
CxuiView* CxuiViewManager::currentView() const
{
CxuiView *view = qobject_cast<CxuiView*> (mMainWindow.currentView());
- CX_ASSERT_ALWAYS(view);
return view;
}
@@ -279,7 +261,12 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (mApplication.activateReason() == Hb::ActivationReasonService) {
+ if (mApplication.activateReason() == Hb::ActivationReasonService ||
+ // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as
+ // activation reason. Use XQServiceUtil to determine if starting service as
+ // a workaround for now
+ XQServiceUtil::isService()) {
+
// For embedded mode: don't create view yet, create when engine inits to correct mode.
// Connect signals to set up the view after image/video prepare
connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)),
@@ -287,7 +274,7 @@
connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
this, SLOT(changeToPrecaptureView()));
- } else if (mApplication.activateReason() == Hb::ActivationReasonActivity ) {
+ } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) {
// restoring activity, read startup view from stored activity
// view to start in
@@ -308,16 +295,12 @@
}
CxuiView *view = createView(viewName);
- mMainWindow.setCurrentView(view, false);
-
if (preCapture) {
- connectPreCaptureSignals();
+ connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view));
} else {
connectPostCaptureSignals();
}
-
- // Check the current application state, signalled to handleApplicationStateChanged.
- mApplicationState->startMonitoring();
+ mMainWindow.setCurrentView(view, false);
// restore view from activity
bool ok = mApplication.activityManager()->waitActivity();
@@ -335,16 +318,15 @@
} else {
view = createView(STILL_PRE_CAPTURE_VIEW);
}
-
+ connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view));
mMainWindow.setCurrentView(view, false);
- connectPreCaptureSignals();
-
- // Check the current application state, signalled to handleApplicationStateChanged.
- mApplicationState->startMonitoring();
clearAllActivities();
}
+ // Check the current application state, signalled to handleApplicationStateChanged.
+ mApplicationState->startMonitoring();
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -355,7 +337,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_VIEW 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_IN, "msg: e_CX_CREATE_VIEW 1");
CX_DEBUG(("View name: %s", viewName.toAscii().data()));
@@ -366,56 +348,38 @@
// Use document loader to create widgets and layouts
// (non-sectioned parts are parsed and loaded)
QString docmlFile = mDocmlFilesByView[viewName];
- CX_DEBUG_ASSERT(mCameraDocumentLoader);
+ CX_ASSERT_ALWAYS(mCameraDocumentLoader);
CX_ASSERT_ALWAYS(!docmlFile.isNull());
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_LOAD 1" );
-
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_2, "msg: e_CX_DOCUMENTLOADER_LOAD 1");
mCameraDocumentLoader->load(docmlFile, &ok);
-
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_4, "msg: e_CX_DOCUMENTLOADER_LOAD 0");
Q_ASSERT_X(ok, "createView", "error in xml file parsing");
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_DOCLOADER_LOAD 0" );
-
- OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_6, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1");
QGraphicsWidget *widget = NULL;
// ask for the view widget pointer
widget = mCameraDocumentLoader->findWidget(viewName);
view = qobject_cast<CxuiView *> (widget);
- CX_DEBUG_ASSERT(view);
- OstTrace0( camerax_performance, DUP5_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 0" );
+ CX_ASSERT_ALWAYS(view);
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_8, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1");
// call for needed consturction methods
view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler, mApplication.activityManager());
// .. and add to main window (which also takes ownership)
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 1" );
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1");
mMainWindow.addView(view);
mViews.insert(viewName, view);
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_12, "msg: e_CX_MAINWINDOW_ADDVIEW 0");
+ }
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 0" );
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_STILLPRECAPTUREVIEW 0" );
-
- }
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_OUT, "msg: e_CX_CREATE_VIEW 0");
CX_DEBUG_EXIT_FUNCTION();
return view;
}
/*!
-* Create scene mode view.
-*/
-CxuiView* CxuiViewManager::createSceneModesView()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- mSceneModeView = qobject_cast<CxuiSceneModeView*>(createView(STILL_SCENES_VIEW));
- mSceneModeView->loadBackgroundImages();
-
- CX_DEBUG_EXIT_FUNCTION();
- return mSceneModeView;
-}
-
-/*!
* CxuiViewManager::showScenesView
* A private method for displaying Scene Modes selection view
*/
@@ -425,16 +389,13 @@
// Disconnect signals from old view.
disconnectSignals();
- if (!mSceneModeView) {
- createSceneModesView();
- }
- else {
- mSceneModeView->loadBackgroundImages();
- }
- CX_DEBUG_ASSERT(mSceneModeView);
- mMainWindow.setCurrentView(mSceneModeView, false);
+ CxuiSceneModeView *view = qobject_cast<CxuiSceneModeView*>(createView(SCENE_MODE_VIEW));
+ CX_ASSERT_ALWAYS(view);
+ view->loadBackgroundImages();
+
stopStandbyTimer();
connectSceneModeSignals();
+ mMainWindow.setCurrentView(view, false);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -464,23 +425,6 @@
}
/*!
-* Get a pointer to the document loader instance.
-*/
-CxuiDocumentLoader *CxuiViewManager::documentLoader()
-{
- return mCameraDocumentLoader;
-}
-
-/*!
-* Get reference to application state instance.
-*/
-CxuiApplicationState &CxuiViewManager::applicationState()
-{
- return *mApplicationState;
-}
-
-
-/*!
* Move to post-capture view.
*/
void CxuiViewManager::changeToPostcaptureView()
@@ -491,8 +435,6 @@
CxuiView *postCaptureView = createView(POSTCAPTURE_VIEW);
- mMainWindow.setCurrentView(postCaptureView, false);
-
// Connecting all necessary signals for postcapture view.
// Not connected yet if not in normal state. We connect the signals
// once we enter normal state again.
@@ -500,6 +442,11 @@
connectPostCaptureSignals();
}
+ // Connect signals before we set the post-capture view as current view.
+ // We need to have signals connected if post-capture view for example
+ // needs to move back to pre-capture view already in showEvent.
+ mMainWindow.setCurrentView(postCaptureView, false);
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -526,17 +473,23 @@
// Disconnect signals from old view.
disconnectSignals();
- HbView *view = getPrecaptureView(mEngine.mode(),
- mEngine.cameraDeviceControl().cameraIndex());
+ CxuiPrecaptureView *view =
+ getPrecaptureView(mEngine.mode(), mEngine.cameraDeviceControl().cameraIndex());
+
+ // Connect necessary pre-capture view signals.
+ connectPreCaptureSignals(view);
+
mMainWindow.setCurrentView(view, false);
- if (mSceneModeView){
- mViews.remove(STILL_SCENES_VIEW);
- delete mSceneModeView;
- mSceneModeView = NULL;
+ // Release resources needed by scene view.
+ HbView *sceneView = mViews.take(SCENE_MODE_VIEW);
+ if (sceneView) {
+ // This will not delete the view.
+ mMainWindow.removeView(sceneView);
+ // We can get to this slot from scene view, so don't delete the object too early.
+ sceneView->deleteLater();
+ sceneView = NULL;
}
- // connecting necessary pre-capture view signals
- connectPreCaptureSignals();
// Make sure engine prepares for new image/video if necessary
mEngine.initMode(mEngine.mode());
@@ -566,11 +519,10 @@
}
CxuiPrecaptureView* view = getPrecaptureView(mEngine.mode(), nextCamera);
+ connectPreCaptureSignals(view);
mMainWindow.setCurrentView(view, false);
view->updateOrientation(nextViewOrientation);
- connectPreCaptureSignals();
-
mEngine.cameraDeviceControl().switchCamera(nextCamera);
CX_DEBUG_EXIT_FUNCTION();
@@ -628,18 +580,22 @@
/*!
* Connect signals specific to given view.
*/
-void CxuiViewManager::connectSignals(QObject *view)
+void CxuiViewManager::connectSignals(CxuiView *view)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_1, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 1");
+
if (view) {
if (view == mViews[POSTCAPTURE_VIEW]) {
connectPostCaptureSignals();
- } else if (view == mSceneModeView) {
+ } else if (view == mViews[SCENE_MODE_VIEW]) {
connectSceneModeSignals();
} else {
- connectPreCaptureSignals();
+ connectPreCaptureSignals(static_cast<CxuiPrecaptureView *>(view));
}
}
+
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_2, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 0");
CX_DEBUG_EXIT_FUNCTION();
}
@@ -648,16 +604,17 @@
* We don't want to send or receive signals with inactive views, so this is done every time changing a view.
* @param view View object from which signals are disconnected. If NULL is given, current view is used.
*/
-void CxuiViewManager::disconnectSignals(QObject *view)
+void CxuiViewManager::disconnectSignals(CxuiView *view)
{
CX_DEBUG_ENTER_FUNCTION();
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_1, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 1");
// Disconnect all existing capture key signals
mKeyHandler->disconnect();
if (!view) {
// If view is not given, take current view.
- view = mMainWindow.currentView();
+ view = currentView();
}
CX_DEBUG(("CxuiViewManager - disconnecting from view %d", view));
@@ -668,48 +625,46 @@
disconnect(this, 0, view, 0);
}
+ OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_2, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 0");
CX_DEBUG_EXIT_FUNCTION();
}
/*!
* Connect signals to pre-capture view.
*/
-void CxuiViewManager::connectPreCaptureSignals()
+void CxuiViewManager::connectPreCaptureSignals(CxuiPrecaptureView *view)
{
CX_DEBUG_ENTER_FUNCTION();
+ // Disconnect from the current, "old" view
disconnectSignals();
- HbView *currentView = mMainWindow.currentView();
-
- if (currentView != mViews[POSTCAPTURE_VIEW]) {
- // connects all capture key signals.
- connectCaptureKeySignals();
+ // connecting pre-capture view signals to standby timer.
+ connect(view, SIGNAL(startStandbyTimer()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
+ connect(view, SIGNAL(stopStandbyTimer()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
+ connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
+ connect(view, SIGNAL(changeToPostcaptureView()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
- // connecting pre-capture view signals to standby timer.
- connect(currentView, SIGNAL(startStandbyTimer()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(stopStandbyTimer()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(startStandbyTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(stopStandbyTimer()), Qt::UniqueConnection);
+ // connecting pre-capture view signals to viewmanager slots
+ connect(view, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection);
+ connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
+
+ //connecting scene modes signal
+ connect(view, SIGNAL(showScenesView()), this, SLOT(showScenesView()), Qt::UniqueConnection);
- // connecting pre-capture view signals to viewmanager slots
- connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
+ connect(view, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection);
- //connecting scene modes signal
- connect(currentView, SIGNAL(showScenesView()), this, SLOT(showScenesView()), Qt::UniqueConnection);
-
- connect(currentView, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection);
+ // connecting error signals from precapture view to application state.
+ connect(view, SIGNAL(errorEncountered(CxeError::Id)),
+ mApplicationState, SLOT(handleApplicationError(CxeError::Id)),
+ Qt::UniqueConnection);
- // connecting error signals from precapture view to application state.
- connect(currentView, SIGNAL(errorEncountered(CxeError::Id)),
- mApplicationState, SLOT(handleApplicationError(CxeError::Id)),
- Qt::UniqueConnection);
+ // Standby signals
+ connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()), Qt::UniqueConnection);
- // Standby signals
- connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
- connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
- }
+ // connects all capture key signals.
+ connectCaptureKeySignals(view);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -721,19 +676,20 @@
{
CX_DEBUG_ENTER_FUNCTION();
+ // Disconnect from the current, "old" view
disconnectSignals();
- QObject *currentView = mMainWindow.currentView();
- if (currentView == mViews[POSTCAPTURE_VIEW]) {
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
+
+ CxuiView *view = mViews[POSTCAPTURE_VIEW];
+ if (view) {
+ connect(view, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection);
// Standby signals
- connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
- connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()), Qt::UniqueConnection);
// connect necessary capturekey signals
- connectCaptureKeySignals();
+ connectCaptureKeySignals(view);
}
-
CX_DEBUG_EXIT_FUNCTION();
}
@@ -743,39 +699,41 @@
void CxuiViewManager::connectSceneModeSignals()
{
CX_DEBUG_ENTER_FUNCTION();
+
+ // Disconnect from the current, "old" view
disconnectSignals();
- connectCaptureKeySignals();
+ CxuiView *view = mViews[SCENE_MODE_VIEW];
+ if (view) {
+ // Standby signals for releasing camera
+ connect(this, SIGNAL(normalStateEntered()), view, SLOT(exitStandby()));
+ connect(this, SIGNAL(normalStateExited()), view, SLOT(enterStandby()));
- // Standby signals for releasing camera
- connect(this, SIGNAL(normalStateEntered()), mSceneModeView, SLOT(exitStandby()));
- connect(this, SIGNAL(normalStateExited()), mSceneModeView, SLOT(enterStandby()));
+ // Moving back to pre-capture view
+ connect(view, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
- // Moving back to pre-capture view
- connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
-
+ connectCaptureKeySignals(view);
+ }
CX_DEBUG_EXIT_FUNCTION();
}
/*!
* Connect key handler capture key signals.
*/
-void CxuiViewManager::connectCaptureKeySignals()
+void CxuiViewManager::connectCaptureKeySignals(CxuiView *view)
{
CX_DEBUG_ENTER_FUNCTION();
// Disconnect all existing capture key signals
mKeyHandler->disconnect();
- QObject *currentView = mMainWindow.currentView();
-
- if (currentView) {
+ if (view) {
// If the view class does not implement the named slot, the connect will fail
// and output some warnings as debug prints. This is by design.
- connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), currentView, SLOT(handleAutofocusKeyPressed()));
- connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), currentView, SLOT(handleAutofocusKeyReleased()));
- connect(mKeyHandler, SIGNAL(captureKeyPressed()), currentView, SLOT(handleCaptureKeyPressed()));
- connect(mKeyHandler, SIGNAL(captureKeyReleased()), currentView, SLOT(handleCaptureKeyReleased()));
+ connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), view, SLOT(handleAutofocusKeyPressed()));
+ connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), view, SLOT(handleAutofocusKeyReleased()));
+ connect(mKeyHandler, SIGNAL(captureKeyPressed()), view, SLOT(handleCaptureKeyPressed()));
+ connect(mKeyHandler, SIGNAL(captureKeyReleased()), view, SLOT(handleCaptureKeyReleased()));
}
CX_DEBUG_EXIT_FUNCTION();
--- a/camerauis/cameraxui/cxui/src/main.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/main.cpp Wed Aug 18 09:37:18 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"
@@ -15,27 +15,34 @@
*
*/
-#include <coemain.h>
-#include <eikenv.h>
#include <QApplication>
#include <QGraphicsProxyWidget>
// needed for localization
+#include <QLocale>
#include <HbTranslator>
-#include <QLocale>
#include <hbmainwindow.h>
+#include <xqserviceutil.h>
+
+#ifdef Q_OS_SYMBIAN
+#include <coemain.h>
+#include <eikenv.h>
+#endif // Q_OS_SYMBIAN
#include "cxeengine.h"
#include "cxecameradevicecontrol.h"
#include "cxuiapplication.h"
#include "cxuiviewmanager.h"
#include "cxuiapplicationstate.h"
+#include "cxuienums.h"
#include "cxutils.h"
#include "cxuiserviceprovider.h"
+#ifdef Q_OS_SYMBIAN
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "mainTraces.h"
-#endif
+#endif // OST_TRACE_COMPILER_IN_USE
+#endif // Q_OS_SYMBIAN
using namespace Cxe;
@@ -63,80 +70,101 @@
// Reserve and power on can then proceed in parallel with
// ui construction.
OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" );
- CxeEngine *eng = CxeEngine::createEngine();
+ CxeEngine *engine = CxeEngine::createEngine();
OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
- if (app.activateReason() == Hb::ActivationReasonService) {
+ if (app.activateReason() == Hb::ActivationReasonService ||
+ // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as
+ // activation reason. Use XQServiceUtil to determine if starting service as
+ // a workaround for now
+ XQServiceUtil::isService()) {
+ CX_DEBUG(("CxUI: Camera started as service"));
// Embedded mode. Engine is inited to correct mode
// by service provider when request arrives
CX_DEBUG(("CxUI: creating serviceprovider"));
- CxuiServiceProvider::create(eng);
+ CxuiServiceProvider::create(engine);
CX_DEBUG(("CxUI: done"));
- } else {
- // Normal mode. Init engine now.
- OstTrace0( camerax_performance, DUP9__MAIN, "msg: e_CX_INIT_ENGINE 1" );
- //! @todo temporarily commented as part of a hack to change the startup sequence
- // to avoid GOOM issues
- //eng->initMode(Cxe::ImageMode);
- OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" );
- }
+ } else if (app.activateReason() == Hb::ActivationReasonActivity) {
+ CX_DEBUG(("CxUI: Camera started as activity"));
+ Cxe::CameraMode mode = Cxe::ImageMode;
+ QString activityId = app.activateId();
+ if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY ||
+ activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
+ mode = Cxe::VideoMode;
+ }
+
+ if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY ||
+ activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) {
+ // init engine only if going to pre-capture
+ engine->initMode(mode);
+ } else {
+ // in post-capture don't init but set the correct mode to engine
+ // so init can be done later
+ engine->setMode(mode);
+ }
+ } else {
+ CX_DEBUG(("CxUI: Camera started as normal app"));
+ // normal start
+ engine->initMode(engine->mode());
+ }
+
+#ifdef Q_OS_SYMBIAN
+ //!@todo: Yield run time to system to get enough resources released to start camera.
+ CX_DEBUG(("CxUI: yield control for resource freeing.."));
+ User::After(2*1000*1000); // 2s
+ CX_DEBUG(("CxUI: waiting done.."));
+#endif // Q_OS_SYMBIAN
// Load language specific application localization file, e.g. "camera_en.qm"
+ // Translations need to be loaded before any widgets are created.
CX_DEBUG(("CxUI: Load translations.."));
OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" );
- HbTranslator* trans = new HbTranslator(TRANSLATIONS_PATH, TRANSLATIONS_FILE);
+ HbTranslator translator(TRANSLATIONS_PATH, TRANSLATIONS_FILE);
// Load language specific common localization file
- trans->loadCommon();
+ translator.loadCommon();
OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" );
CX_DEBUG(("CxUI: ..translations loaded"));
+ // Create main window
OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" );
- HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent |
- Hb::WindowFlagNoBackground);
- mainWindow->setAttribute(Qt::WA_NoBackground);
+ HbMainWindow mainWindow(0, Hb::WindowFlagTransparent | Hb::WindowFlagNoBackground);
+ mainWindow.setAttribute(Qt::WA_NoBackground);
OstTrace0( camerax_performance, DUP6__MAIN, "msg: e_CX_MAINWINDOW_CREATION 0" );
- OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" );
- CxuiViewManager *viewManager = new CxuiViewManager(app, *mainWindow, *eng);
- OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" );
-
+ // Set main window to landscape and full screen
OstTrace0( camerax_performance, DUP13__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 1" );
- mainWindow->setOrientation(Qt::Horizontal);
+ mainWindow.setOrientation(Qt::Horizontal);
OstTrace0( camerax_performance, DUP14__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 0" );
+ OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" );
- OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" );
- mainWindow->showFullScreen();
+#ifdef Q_OS_SYMBIAN
+ mainWindow.showFullScreen();
+#else
+ /*
+ * todo : check if this is an Orbit bug or if there's a better solution
+ */
+ mainWindow.resize(640, 360);
+ mainWindow.setOrientation(Qt::Vertical, false);
+ mainWindow.show();
+ mainWindow.setOrientation(Qt::Horizontal, false);
+#endif //Q_OS_SYMBIAN
OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" );
- OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
- eng->viewfinderControl().setWindow(mainWindow->effectiveWinId());
- OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
+ // Create view manager
+ OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" );
+ CxuiViewManager *viewManager = new CxuiViewManager(app, mainWindow, *engine);
+ OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" );
- //! @todo initMode call added here as a temporary hack to change the startup sequence
- // in order to avoid GOOM issues.
- if (app.activateReason() != Hb::ActivationReasonService
- && viewManager->applicationState().currentState() == CxuiApplicationState::Normal) {
- User::After(2000000);
- if (app.activateReason() == Hb::ActivationReasonActivity) {
- // when started by activity, let viewmanager init
- // to correct mode
- viewManager->initEngine();
- } else {
- // normal start
- eng->initMode(eng->mode());
- }
- }
+ // Give main window id to engine for setting up viewfinder window behind it
+ OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
+ engine->viewfinderControl().setWindow(mainWindow.effectiveWinId());
+ OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
int returnValue = app.exec();
delete viewManager;
-
- // delete service provider instance
- CxuiServiceProvider::destroy();
-
- delete mainWindow;
- delete trans;
- delete eng;
+ CxuiServiceProvider::destroy(); // delete service provider instance
+ delete engine;
return returnValue;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/stubs_desktop/inc/XQUtils Wed Aug 18 09:37:18 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:
+*
+*/
+
+#ifndef XQUTILS
+#define XQUTILS
+
+#include <QObject>
+
+class XQUtils : public QObject
+{
+ Q_OBJECT
+public:
+ XQUtils(QObject *parent = 0) : QObject(parent) {}
+
+public slots:
+ void resetInactivityTime() {}
+};
+#endif // XQUTILS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/stubs_desktop/inc/shareui.h Wed Aug 18 09:37:18 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 SHAREUIDESKTOP_H
+#define SHAREUIDESKTOP_H
+
+class QStringList;
+
+class ShareUi
+{
+public:
+ inline void send(QStringList, bool) {}
+};
+
+#endif // SHAREUIDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/stubs_desktop/inc/thumbnailmanager_qt.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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 THUMBNAILMANAGER_QT_H
+#define THUMBNAILMANAGER_QT_H
+
+#include <QObject>
+#include <QPixmap>
+
+class ThumbnailManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum ThumbnailSize {
+ ThumbnailLarge
+ };
+
+public:
+ ThumbnailManager(){}
+ inline void setThumbnailSize(ThumbnailSize size){}
+ inline void getThumbnail(QString filename){}
+
+signals:
+ void thumbnailReady(QPixmap thumbnail, void *clientData, int id, int errorCode);
+};
+
+#endif // THUMBNAILMANAGER_QT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/stubs_desktop/inc/xqappmgr.h Wed Aug 18 09:37:18 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:
+*
+*/
+
+#ifndef XQAPPMGRDESKTOP_H
+#define XQAPPMGRDESKTOP_H
+
+#include <QVariant>
+
+class XQAiwRequest
+{
+public:
+ inline void setArguments(QVariantList &fileList) {}
+ inline bool send(QVariant &result) {return false;}
+ inline int lastError() {return 1;}
+};
+
+class XQApplicationManager
+{
+public:
+ XQApplicationManager() : videoRequest(NULL) { }
+ inline XQAiwRequest *create(const QString &service, const QString &operation, bool embedded = true)
+ {
+ videoRequest = new XQAiwRequest();
+ return videoRequest;
+ }
+
+ inline ~XQApplicationManager() {if (videoRequest) delete videoRequest;}
+
+private:
+ // Owned
+ XQAiwRequest *videoRequest;
+};
+
+#endif // XQAPPMGRDESKTOP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/stubs_desktop/inc/xqserviceprovider.h Wed Aug 18 09:37:18 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 used by CxuiServiceProvider
+*/
+
+#ifndef XQSERVICEPROVIDER_H
+#define XQSERVICEPROVIDER_H
+
+#include <QObject>
+#include <QString>
+
+class XQServiceProvider : public QObject
+{
+ Q_OBJECT
+public:
+ XQServiceProvider(const QString &service, QObject *parent = 0) : QObject(parent) {Q_UNUSED(service)}
+ virtual ~XQServiceProvider() {}
+protected:
+ virtual void publishAll(){}
+ bool completeRequest(int index, const QVariant &retValue) {return true;}
+ int setCurrentRequestAsync() {return 0;}
+
+};
+
+#endif // XQSERVICEPROVIDER_H
--- a/camerauis/cameraxui/cxui/tsrc/cxuitest.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/tsrc/cxuitest.pro Wed Aug 18 09:37:18 2010 +0300
@@ -30,8 +30,7 @@
./cxui \
../traces
QT += testlib
-HB += hbcore hbwidgets hbutils hbfeedback
-CONFIG += qtestlib hb symbian_test
+CONFIG += qtestlib hb
LIBS += -lcxengine \
-lcommonui \
-lapmime \
@@ -56,7 +55,6 @@
cxuisettingslider.cpp \
cxuisettingradiobuttonlist.cpp \
cxuisettingscenemoderadiobuttonlist.cpp \
- cxuiscenelabel.cpp \
cxuisettingbuttoncontainer.cpp \
cxuifakestillcapturecontrol.cpp \
cxuifakecameradevicecontrol.cpp \
@@ -76,7 +74,6 @@
cxuisettingslider.h \
cxuisettingradiobuttonlist.h \
cxuisettingscenemoderadiobuttonlist.h \
- cxuiscenelabel.h \
cxuisettingbuttoncontainer.h\
cxuidocumentloader.h \
cxuienums.h \
--- a/camerauis/cameraxui/cxui/tsrc/cxuitestbat.cpp Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/tsrc/cxuitestbat.cpp Wed Aug 18 09:37:18 2010 +0300
@@ -108,7 +108,7 @@
QCOMPARE( deviceStateSpy.count(), 3 );
QList<QVariant> initModeArguments = deviceStateSpy.takeAt(0);
- QVERIFY( initModeArguments.at(0).value<CxeVideoCaptureControl::State>() == CxeVideoCaptureControl::Open );
+ QVERIFY( initModeArguments.at(0).value<CxeVideoCaptureControl::State>() == CxeVideoCaptureControl::Initialized );
QVERIFY( initModeArguments.at(1).toInt() == 0 );
initModeArguments = deviceStateSpy.takeAt(0);
QVERIFY( initModeArguments.at(1).toInt() == 0 );
@@ -252,7 +252,7 @@
QCOMPARE(deviceStateSpy.count(), 3);
if (deviceStateSpy.count() > 0) {
QList<QVariant> initModeArguments = deviceStateSpy.takeAt(0);
- QVERIFY( initModeArguments.at(0).value<CxeVideoCaptureControl::State>() == CxeVideoCaptureControl::Open );
+ QVERIFY( initModeArguments.at(0).value<CxeVideoCaptureControl::State>() == CxeVideoCaptureControl::Initialized );
QVERIFY( initModeArguments.at(1).toInt() == 0 );
initModeArguments = deviceStateSpy.takeAt(0);
QVERIFY( initModeArguments.at(1).toInt() == 0 );
--- a/camerauis/cameraxui/cxui/tsrc/cxuitestbat.pro Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/cxui/tsrc/cxuitestbat.pro Wed Aug 18 09:37:18 2010 +0300
@@ -34,8 +34,8 @@
../traces
QT += testlib
-CONFIG += qtestlib hb symbian_test
-HB += hbcore hbwidgets hbfeedback hbutils
+CONFIG += qtestlib hb
+HB += hbcore hbwidgets hbtools hbfeedback
LIBS += -lcxengine \
-lcommonui \
@@ -62,7 +62,6 @@
cxuisettingslider.cpp \
cxuisettingradiobuttonlist.cpp \
cxuisettingscenemoderadiobuttonlist.cpp \
- cxuiscenelabel.cpp \
cxuiselftimer.cpp \
cxuierrormanager.cpp \
cxuistandby.cpp
@@ -78,12 +77,11 @@
cxuienums.h \
cxuidocumentloader.h \
cxuidisplaypropertyhandler.h \
- cxuisettingslider.h \
+ cxuisettingslider.h \
cxuisettingradiobuttonlist.h \
cxuisettingscenemoderadiobuttonlist.h \
- cxuiscenelabel.h \
cxuiselftimer.h \
- cxuierrormanager.h \
+ cxuierrormanager.h \
cxuistandby.h \
../traces/OstTraceDefinitions.h
--- a/camerauis/cameraxui/rom/camerax.iby Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/rom/camerax.iby Wed Aug 18 09:37:18 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,7 +23,6 @@
// Ui
S60_APP_EXE(cxui)
data = DATAZ_\private\10003a3f\import\apps\cxui_reg.rsc \private\10003a3f\import\apps\cxui_reg.rsc
-data = DATAZ_\APP_RESOURCE_DIR\cxui.mif APP_RESOURCE_DIR\cxui.mif
// Sounds
data = DATAZ_\system\sounds\digital\capture.wav system\sounds\digital\capture.wav
--- a/camerauis/cameraxui/rom/camerax_stub.pkg Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/rom/camerax_stub.pkg Wed Aug 18 09:37:18 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,5 +30,4 @@
"" - "z:\sys\bin\cxui.exe"
"" - "z:\resource\apps\cxui.r*"
"" - "z:\private\10003a3f\import\apps\cxui_reg.rsc"
-"" - "z:\resource\apps\cxui.mif"
"" - "z:\sys\bin\cxengine.dll"
Binary file camerauis/cameraxui/rom/camerax_stub.sis has changed
--- a/camerauis/cameraxui/rom/cameraxresources.iby Tue Jul 06 14:04:02 2010 +0300
+++ b/camerauis/cameraxui/rom/cameraxresources.iby Wed Aug 18 09:37:18 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,9 +20,7 @@
#include <data_caging_paths_for_iby.hrh>
-data=DATAZ_\APP_RESOURCE_DIR\camera.rsc APP_RESOURCE_DIR\camera.rsc
-
-data=DATAZ_\QT_TRANSLATIONS_DIR\camera.qm QT_TRANSLATIONS_DIR\camera.qm
+data=DATAZ_\QT_TRANSLATIONS_DIR\camera.qm QT_TRANSLATIONS_DIR\camera.qm
S60_APP_RESOURCE(cxui)