--- a/camerauis/cameraxui/camerax.pri Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/camerax.pri Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -14,28 +14,7 @@
# Description:
#
-
-# Auto-detect path for S60 Qt Mobile extensions
-exists(/qt/extensions/include) { INCLUDEPATH += /qt/extensions/include }
-exists(/qtextensions/include) { INCLUDEPATH += /qtextensions/include }
-exists(/s60/mw/qtextensions/include) { INCLUDEPATH += /s60/mw/qtextensions/include }
-exists(/sf/mw/qtextensions/include) { INCLUDEPATH += /sf/mw/qtextensions/include }
-exists(/ext/mw/qtextensions/include) { INCLUDEPATH += /ext/mw/qtextensions/include }
-exists(/epoc32/include/oem) { INCLUDEPATH += /epoc32/include/oem }
-exists(/epoc32/include/middleware) { INCLUDEPATH += /epoc32/include/middleware }
-exists(/epoc32/include/domain/middleware) { INCLUDEPATH += /epoc32/include/domain/middleware }
-exists(/epoc32/include/osextensions) { INCLUDEPATH += /epoc32/include/osextensions }
-exists(/epoc32/include/domain/osextensions) { INCLUDEPATH += /epoc32/include/domain/osextensions }
-exists(/epoc32/include/applications) { INCLUDEPATH += /epoc32/include/applications }
-exists(/epoc32/include/domain/applications) { INCLUDEPATH += /epoc32/include/domain/applications }
-exists(/epoc32/include/mw) { INCLUDEPATH += /epoc32/include/mw }
-exists(/epoc32/include/platform/mw) { INCLUDEPATH += /epoc32/include/platform/mw }
-exists(/epoc32/include/platform) { INCLUDEPATH += /epoc32/include/platform }
-exists(/epoc32/include/app) { INCLUDEPATH += /epoc32/include/app }
-exists(/epoc32/include/platform/app) { INCLUDEPATH += /epoc32/include/platform/app }
-exists(/epoc32/include/ecam) { INCLUDEPATH += /epoc32/include/ecam }
-exists(/epoc32/include/mw/QtTest) { INCLUDEPATH += /epoc32/include/mw/QtTest }
-
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
# FORCE_SECONDARY_CAMERA
# Configuration flag for forcing secondary camera hw to be used also for primary camera ui.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/bwins/cxengineu.def Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?createEngine@CxeEngine@@SAPAV1@XZ @ 1 NONAME ; class CxeEngine * CxeEngine::createEngine(void)
+
--- a/camerauis/cameraxui/cxengine/conf/camerax.confml Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/conf/camerax.confml Thu Jul 15 01:52:14 2010 +0300
@@ -43,6 +43,29 @@
0 indicates "video recording with sound."
</desc>
</setting>
+
+ <setting ref="GeoTaggingDisclaimerCr" name="Geotagging first time use notification" type="int">
+ <desc>GeoTaggingDisclaimerCr defines whether we have to show first time use note for geotagging
+ when we first start the camera.
+ </desc>
+ </setting>
+
+ <setting ref="CameraModeCr" name="Camera mode" type="int">
+ <desc> Current mode of the camera - still or video.</desc>
+ </setting>
+ <setting ref="FlashModeStillCr" name="Video quality" type="int">
+ <desc>VideoQualityCr defines the quality currently in use in video mode.
+ </desc>
+ </setting>
+ <setting ref="SceneModeStillCr" name="Scene mode still" type="string">
+ <desc>Scene mode setting in still mode.
+ </desc>
+ </setting>
+ <setting ref="SceneModeVideoCr" name="Scene mode video" type="string">
+ <desc> Scene mode setting in video mode.
+ </desc>
+ </setting>
+
</feature>
<data>
@@ -56,10 +79,15 @@
<ImageQualityCr>1</ImageQualityCr>
<VideoQualityCr>0</VideoQualityCr>
<AudioMuteCr>0</AudioMuteCr>
- <GeoTaggingCr>0</GeoTaggingCr>
+ <GeoTaggingCr>1</GeoTaggingCr>
<FacetrackingCr>1</FacetrackingCr>
<CaptureSoundAlwaysOnCr>0</CaptureSoundAlwaysOnCr>
- </CxSettingsCrUid>
+ <GeoTaggingDisclaimerCr>1</GeoTaggingDisclaimerCr>
+ <CameraModeCr>0</CameraModeCr>
+ <FlashModeStillCr>0</FlashModeStillCr>
+ <SceneModeStillCr>image_scene_auto</SceneModeStillCr>
+ <SceneModeVideoCr>video_scene_auto</SceneModeVideoCr>
+ </CxSettingsCrUid>
</data>
<rfs>
@@ -74,7 +102,12 @@
<GeoTaggingCr>true</GeoTaggingCr>
<FacetrackingCr>true</FacetrackingCr>
<CaptureSoundAlwaysOnCr>true</CaptureSoundAlwaysOnCr>
- </CxSettingsCrUid>
+ <GeoTaggingDisclaimerCr>true</GeoTaggingDisclaimerCr>
+ <CameraModeCr>true</CameraModeCr>
+ <FlashModeStillCr>true</FlashModeStillCr>
+ <SceneModeStillCr>true</SceneModeStillCr>
+ <SceneModeVideoCr>true</SceneModeVideoCr>
+ </CxSettingsCrUid>
</rfs>
</configuration>
Binary file camerauis/cameraxui/cxengine/conf/camerax_20027017.crml has changed
--- a/camerauis/cameraxui/cxengine/cxengine.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/cxengine.pro Thu Jul 15 01:52:14 2010 +0300
@@ -66,6 +66,7 @@
LIBS += -lxqserviceutil
LIBS += -loommonitor
LIBS += -lhal
+LIBS += -llocationmanager
symbian {
TARGET.EPOCALLOWDLLDATA = 1 // TODO: check this out??
@@ -159,6 +160,8 @@
cxediskmonitorprivate.h \
cxesnapshotcontrol.h \
cxesnapshotcontrolprivate.h \
+ cxegeotaggingtrail.h \
+ cxegeotaggingtrailprivate.h \
sensor/xqsensor.h \
sensor/xqaccsensor.h \
sensor/xqdeviceorientation.h \
@@ -207,6 +210,8 @@
cxediskmonitorprivate.cpp \
cxesnapshotcontrol.cpp \
cxesnapshotcontrolprivate.cpp \
+ cxegeotaggingtrail.cpp \
+ cxegeotaggingtrailprivate.cpp \
sensor/xqsensor.cpp \
sensor/xqaccsensor.cpp \
sensor/xqdeviceorientation.cpp \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/eabi/cxengineu.def Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _ZN9CxeEngine12createEngineEv @ 1 NONAME
+
--- a/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Thu Jul 15 01:52:14 2010 +0300
@@ -31,6 +31,7 @@
class CxeFeatureManager;
class CxeSettings;
class CxeMemoryMonitor;
+class CxeGeoTaggingTrail;
/**
* CxeEngine provides the the entry point into CameraX engine. This is the
@@ -98,13 +99,23 @@
* Memory monitor utility.
*/
virtual CxeMemoryMonitor &memoryMonitor() = 0;
-
+
+ /**
+ * Geotagging trail utility.
+ */
+ virtual CxeGeoTaggingTrail &geoTaggingTrail() = 0;
+
/**
* Get current camera mode.
*/
virtual Cxe::CameraMode mode() const = 0;
/**
+ * Set current camera mode.
+ */
+ virtual void setMode(Cxe::CameraMode mode) = 0;
+
+ /**
* Initialize the camera in either still or video mode. This method is also
* used to switch between modes.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/api/cxegeotaggingtrail.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXEGEOTAGGINGTRAIL_H
+#define CXEGEOTAGGINGTRAIL_H
+
+#include <QObject>
+#include <QMetaType>
+#include "cxeerror.h"
+
+class CxeSettings;
+class CxeStillCaptureControl;
+class CxeVideoCaptureControl;
+
+class CxeGeoTaggingTrailPrivate;
+
+class CxeGeoTaggingTrail : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ //! Geotagging trail states
+ enum State {
+ //! location utility not connected
+ NotConnected = 0x01,
+
+ //! connected to location utility, but location trail NOT STARTED.
+ Connected = 0x02,
+
+ //! starting Location trail, GPS data not yet available
+ TrailStarted = 0x04,
+
+ //! location trail started and GPS data available.
+ DataAvailable = 0x08
+ };
+
+public:
+
+ CxeGeoTaggingTrail(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings);
+
+ ~CxeGeoTaggingTrail();
+
+signals:
+ void stateChanged(CxeGeoTaggingTrail::State newState, CxeError::Id error);
+
+public slots:
+ void start();
+ void stop();
+
+public:
+ State state();
+
+protected:
+ CxeGeoTaggingTrailPrivate *const d_ptr;
+
+private:
+ Q_DECLARE_PRIVATE(CxeGeoTaggingTrail)
+
+};
+
+Q_DECLARE_METATYPE(CxeGeoTaggingTrail::State)
+
+#endif // CXEGEOTAGGINGTRAIL_H
--- a/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -41,7 +41,7 @@
enum CameraMode
{
//! Still image capture mode
- ImageMode,
+ ImageMode = 0,
//! Video recording mode
VideoMode
@@ -109,7 +109,8 @@
enum AspectRatio
{
AspectRatio4to3, // standard
- AspectRatio16to9 // wide screen
+ AspectRatio16to9, // wide screen
+ AspectRatio11to9
};
enum SettingKeyType
@@ -126,11 +127,45 @@
FreeMemoryTrigger = 0,
FreeMemoryTarget
};
+
+ /*!
+ * Indicates if Geotagging setting is enabled or disabled.
+ */
+ enum GeoTagging
+ {
+ GeoTaggingOff = 0,
+ GeoTaggingOn
+ };
+
+ /*!
+ * Indicates if Geotagging disclaimer note is shown to the users during camera first startup
+ */
+ enum GeoTaggingDisclaimer
+ {
+ GeoTaggingDisclaimerDisabled = 0,
+ GeoTaggingDisclaimerEnabled
+ };
+
+ // image scene mode key values
+ static const char* IMAGE_SCENE_AUTO = "image_scene_auto";
+ static const char* IMAGE_SCENE_PORTRAIT = "image_scene_portrait";
+ static const char* IMAGE_SCENE_SCENERY = "image_scene_scenery";
+ static const char* IMAGE_SCENE_MACRO = "image_scene_macro";
+ static const char* IMAGE_SCENE_SPORTS = "image_scene_sports";
+ static const char* IMAGE_SCENE_NIGHT = "image_scene_night";
+ static const char* IMAGE_SCENE_NIGHTPORTRAIT = "image_scene_night_portrait";
+
+ // video scene setting key values
+ static const char* VIDEO_SCENE_AUTO = "video_scene_auto";
+ static const char* VIDEO_SCENE_NIGHTPORTRAIT = "video_scene_night_portrait";
+ static const char* VIDEO_SCENE_LOWLIGHT = "video_scene_low_light";
+ static const char* VIDEO_SCENE_NIGHT = "video_scene_night";
}
namespace CxeSettingIds
{
// Setting Ids
+ static const char* CAMERA_MODE = "camera_mode";
static const char* FOCAL_RANGE = "focal_range";
static const char* FLASH_MODE = "flash_mode";
static const char* WHITE_BALANCE = "white_balance";
@@ -149,7 +184,8 @@
static const char* SELF_TIMER = "selfTimer";
static const char* FACE_TRACKING = "face_tracking";
static const char* GEOTAGGING = "geotagging";
- static const char* CAPTURE_SOUND_ALWAYS_ON = "capture_sound_always_on";
+ static const char* GEOTAGGING_DISCLAIMER = "geotagging_disclaimer";
+ static const char* CAPTURE_SOUND_ALWAYS_ON = "capture_sound_always_on";
// file name/path related key values
static const char* FNAME_FOLDER_SUFFIX = "folder_suffix";
@@ -161,21 +197,6 @@
static const char* IMAGE_SCENE = "still_scene_modes";
static const char* VIDEO_SCENE = "video_scene_modes";
- // image scene mode key values
- static const char* IMAGE_SCENE_AUTO = "image_scene_auto";
- static const char* IMAGE_SCENE_PORTRAIT = "image_scene_portrait";
- static const char* IMAGE_SCENE_SCENERY = "image_scene_scenery";
- static const char* IMAGE_SCENE_MACRO = "image_scene_macro";
- static const char* IMAGE_SCENE_SPORTS = "image_scene_sports";
- static const char* IMAGE_SCENE_NIGHT = "image_scene_night";
- static const char* IMAGE_SCENE_NIGHTPORTRAIT = "image_scene_night_portrait";
-
- // video scene setting key values
- static const char* VIDEO_SCENE_AUTO = "video_scene_auto";
- static const char* VIDEO_SCENE_NIGHTPORTRAIT = "video_scene_night_portrait";
- static const char* VIDEO_SCENE_LOWLIGHT = "video_scene_low_light";
- static const char* VIDEO_SCENE_NIGHT = "video_scene_night";
-
// setting keys for post capture timeout
static const char* STILL_SHOWCAPTURED = "still_showcaptured";
static const char* VIDEO_SHOWCAPTURED = "video_showcaptured";
--- a/camerauis/cameraxui/cxengine/inc/api/cxestillcapturecontrol.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxestillcapturecontrol.h Thu Jul 15 01:52:14 2010 +0300
@@ -155,7 +155,7 @@
* @param snapshot The snapshot image.
* @param id Id of the image this snapshot is for.
*/
- void snapshotReady(CxeError::Id error, const QPixmap& snapshot, int id);
+ void snapshotReady(CxeError::Id error, const QImage &snapshot, int id);
void imageCaptured(CxeError::Id error, int id);
/**
--- a/camerauis/cameraxui/cxengine/inc/api/cxevideocapturecontrol.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/api/cxevideocapturecontrol.h Thu Jul 15 01:52:14 2010 +0300
@@ -90,9 +90,9 @@
virtual void deinit() = 0;
signals:
- void videoComposed(CxeError::Id error, const QString& filename);
+ void videoComposed(CxeError::Id error, const QString &filename);
void stateChanged(CxeVideoCaptureControl::State newState, CxeError::Id error);
- void snapshotReady(CxeError::Id error, const QPixmap& snapshot, const QString& filename);
+ void snapshotReady(CxeError::Id error, const QImage &snapshot, const QString &filename);
void remainingTimeChanged();
protected:
--- a/camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h Thu Jul 15 01:52:14 2010 +0300
@@ -31,6 +31,11 @@
const unsigned long int GeoTaggingCr = 0xA;
const unsigned long int FacetrackingCr = 0xB;
const unsigned long int CaptureSoundAlwaysOnCr = 0xC;
+const unsigned long int GeoTaggingDisclaimerCr = 0xD;
+const unsigned long int CameraModeCr = 0xE;
+const unsigned long int FlashModeStillCr = 0xF;
+const unsigned long int SceneModeStillCr = 0x10;
+const unsigned long int SceneModeVideoCr = 0x11;
const unsigned long int CxRuntimeFeaturesCrUid = {0x20027018};
--- a/camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeenginesymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -40,6 +40,7 @@
class CxeFileSaveThread;
class CxeDiskMonitor;
class CxeMemoryMonitor;
+class CxeGeoTaggingTrail;
class CxeEngineSymbian : public CxeEngine
@@ -60,7 +61,9 @@
CxeSensorEventHandler &sensorEventHandler();
CxeFeatureManager &featureManager();
CxeMemoryMonitor &memoryMonitor();
+ CxeGeoTaggingTrail &geoTaggingTrail();
Cxe::CameraMode mode() const;
+ void setMode(Cxe::CameraMode mode);
void initMode(Cxe::CameraMode cameraMode);
bool isEngineReady();
@@ -81,6 +84,8 @@
bool initNeeded();
bool startViewfinderNeeded();
void reserve();
+ void saveMode();
+ void startGeotaggingTrail();
protected:
CxeCameraDeviceControl *mCameraDeviceControl;
@@ -101,6 +106,7 @@
CxeFileSaveThread *mFileSaveThread;
CxeDiskMonitor *mDiskMonitor;
CxeMemoryMonitor *mMemoryMonitor;
+ CxeGeoTaggingTrail *mGeoTaggingTrail;
};
--- a/camerauis/cameraxui/cxengine/inc/cxefilesavethread.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethread.h Thu Jul 15 01:52:14 2010 +0300
@@ -40,8 +40,8 @@
public slots:
virtual void handleVideoSaved(CxeError::Id status, const QString& filename) = 0;
- virtual void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename) = 0;
- virtual void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id) = 0;
+ virtual void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename) = 0;
+ virtual void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id) = 0;
protected:
--- a/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -48,9 +48,8 @@
public slots:
void handleVideoSaved(CxeError::Id status, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id);
-
+ void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename);
+ void handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id);
protected slots:
void handleFileHarvested(CxeError::Id status, const QString& filename);
@@ -67,7 +66,7 @@
void run();
void read();
void saveNow();
- void harvestFile(const QString& filename);
+ void harvestFile(const QString& filename, bool addLocation);
private: // data shared between the threads
@@ -78,7 +77,7 @@
QWaitCondition mDataToSave;
mutable QMutex mSnapshotsMutex;
- QHash<QString, QPixmap> mSnapshots;
+ QHash<QString, QImage> mSnapshots;
protected: // thread only used data
int mCount;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/inc/cxegeotaggingtrailprivate.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXEGEOTAGGINGTRAILPRIVATE_H
+#define CXEGEOTAGGINGTRAILPRIVATE_H
+
+#include <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
--- a/camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataitemsymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -30,12 +30,19 @@
{
Q_OBJECT
public: // from CxeImageDataItemSymbian
- CxeImageDataItemSymbian(QByteArray data, QString filename, int id, CxeImageDataItem::State state = CxeImageDataItem::SavePending);
+ CxeImageDataItemSymbian(QByteArray data,
+ QString filename,
+ int id,
+ bool addLocation,
+ CxeImageDataItem::State state = CxeImageDataItem::SavePending);
+
virtual ~CxeImageDataItemSymbian();
CxeImageDataItem::State state() const;
CxeError::Id save();
int id() const;
+ bool isLocationEnabled() const;
+
public: // new methods
QString path() const;
@@ -60,6 +67,7 @@
// used for image saving
QByteArray mData;
+ bool mAddLocationInfo;
QString mPath;
RFile mFile;
RFs mFs;
--- a/camerauis/cameraxui/cxengine/inc/cxeimagedataqueuesymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxeimagedataqueuesymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -49,7 +49,7 @@
CxeImageDataItem &operator[]( int index );
public: // public member functions, not in client API
- CxeImageDataItemSymbian *startSave( QByteArray data, QString path, int id );
+ CxeImageDataItemSymbian *startSave( QByteArray data, QString path, int id, bool addLocation);
private: // private data members
QList<CxeImageDataItemSymbian*> mList;
--- a/camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingscenrepstore.h Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -31,14 +31,15 @@
class XQSettingsKey;
-/*
-* Settings store intrerface.
+/*!
+* \class CxeSettingsStore
+* \brief Settings store intrerface.
*/
class CxeSettingsStore
{
public:
- /**
+ /*!
* This needs to be here to be able to delete an object
* of inherited class through mixin pointer.
* If this is not defined, deleting through the mixin pointer
@@ -46,35 +47,35 @@
*/
virtual ~CxeSettingsStore() {};
- /*
+ /*!
* resets the cenrep store
*/
virtual void reset() = 0;
- /*
+ /*!
* Reads a value from cenrep
* @param "key" - setting key
* @param "value" - setting value read from cenrep
*/
virtual CxeError::Id get(const QString& key, QVariant &value) = 0;
- /*
- * Reads a value from cenrep
+ /*!
+ * Reads a value from cenrep and starts monitoring changes
* @param "uid" - UID of the component that own setting key
* @param "key" - setting key id
* @param "type" - type of setting key
* @param "value" - setting value read from cenrep
*/
- virtual void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) = 0;
+ virtual void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) = 0;
- /*
+ /*!
* Sets a new value to cenrep
* @param "key" - setting key
* @param "newValue" - new value set to the key in cenrep
*/
virtual CxeError::Id set(const QString& key,const QVariant newValue) = 0;
- /*
+ /*!
* Reads/loads all run-time settings values from cenrep
* @param QList<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
@@ -87,8 +88,9 @@
-/*
-* CxeSettingsCenRepStore class implements CxeSettingsStore.
+/*!
+* \class CxeSettingsCenRepStore
+* \brief Class implements CxeSettingsStore.
* This class uses CenRep key mechanism for storing and retrieving settings information.
*/
class CxeSettingsCenRepStore : public QObject,
@@ -103,51 +105,18 @@
~CxeSettingsCenRepStore();
public: // from base class
- /*
- * resets the cenrep store
- */
+
void reset();
-
- /*
- * Reads a value from cenrep
- * @param "key" - setting key
- * @param "value" - setting value read from cenrep
- */
CxeError::Id get(const QString& key, QVariant &value);
-
- /*
- * Reads a value from cenrep
- * @param "uid" - UID of the component that own setting key
- * @param "key" - setting key id
- * @param "type" - type of setting key
- * @param "value" - setting value read from cenrep
- */
- void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
-
- /*
- * Sets a new value to cenrep
- * @param "key" - setting key
- * @param "newValue" - new value set to the key in cenrep
- */
+ void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
CxeError::Id set(const QString& key,const QVariant newValue);
-
- /*
- * Reads/loads all run-time settings values from cenrep
- * @param QList<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.
- */
QHash<QString, QVariantList> loadRuntimeSettings(QList<QString>& settingKeys);
signals:
-
void settingValueChanged(long int uid, unsigned long int key, QVariant value);
private slots:
-
void handleValueChanged(XQSettingsKey key, QVariant value);
private:
@@ -163,22 +132,13 @@
};
private:
-
- /*
- * add's key mapping to the hash container.
- */
+
void addKeyMapping(QString key,
unsigned long int keyid,
XQSettingsManager::Type type,
bool readOnly = false);
- /*
- * Generates XQSettingsKey from given setting/runtime key
- */
+
XQSettingsKey generateXQSettingsKey(const QString& key,CxeError::Id& error);
-
- /*
- * maps "string" type setting key ids to cenrep key ids that XQSettingsManager understands
- */
void mapKeys();
protected:
@@ -191,8 +151,9 @@
};
-/*
- * Settings store that reads key values from cenrep and keeps
+/*!
+ * \class CxeSettingsLocalStore
+ * \brief Settings store that reads key values from cenrep and keeps
* cached copies of them in memory. Doesn't write anything back
* to cenrep.
*/
@@ -204,19 +165,9 @@
CxeSettingsLocalStore();
~CxeSettingsLocalStore();
- /*
- * Reads a value from local store.
- * @param "key" - setting key
- * @param "value" - setting value read from cenrep
- */
CxeError::Id get(const QString& key, QVariant &value);
+ CxeError::Id set(const QString& key, const QVariant newValue);
- /*
- * Sets a new value to local store
- * @param "key" - setting key
- * @param "newValue" - new value set to the key in cenrep
- */
- CxeError::Id set(const QString& key, const QVariant newValue);
private:
bool useValueFromCenrep(const QString &key) const;
--- a/camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h Thu Jul 15 01:52:14 2010 +0300
@@ -62,7 +62,7 @@
void loadImageScenes();
void loadVideoScenes();
- void loadSceneData(CxeScene ¤tScene, CxeScene &sceneDefaultSettings);
+ CxeError::Id loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings);
CxeError::Id sceneSettingValue(const QString &key, QVariant &value);
CxeError::Id setSceneSettingValue(const QString &key, QVariant newValue);
@@ -70,6 +70,10 @@
CxeError::Id videoScene(const QString &sceneId, CxeScene &sceneSettings);
CxeError::Id imageScene(const QString &sceneId, CxeScene &sceneSettings);
+
+ void restoreImageSettings();
+ void restoreVideoSettings();
+
private:
--- a/camerauis/cameraxui/cxengine/inc/cxesnapshotcontrol.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesnapshotcontrol.h Thu Jul 15 01:52:14 2010 +0300
@@ -20,6 +20,7 @@
#include <QObject>
#include "cxeerror.h"
+#include "cxenamespace.h"
class CxeCameraDevice;
class CxeSnapshotControlPrivate;
@@ -47,13 +48,13 @@
public:
State state() const;
- QSize calculateSnapshotSize(const QSize& displaySize, const QSize& outputResolution) const;
- void start(const QSize& size);
+ QSize calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const;
+ void start(const QSize &size);
void stop();
signals:
void stateChanged(CxeSnapshotControl::State newState, CxeError::Id status);
- void snapshotReady(CxeError::Id status, const QPixmap& snapshot);
+ void snapshotReady(CxeError::Id status, const QImage &snapshot);
public slots:
void handleCameraEvent(int id, int error);
--- a/camerauis/cameraxui/cxengine/inc/cxesnapshotcontrolprivate.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesnapshotcontrolprivate.h Thu Jul 15 01:52:14 2010 +0300
@@ -23,7 +23,6 @@
#include "cxeerror.h"
#include "cxestatemachine.h"
-class QPixmap;
class CxeSnapshotControl;
class CxeCameraDevice;
@@ -43,11 +42,11 @@
private:
CxeSnapshotControl::State state() const;
void initializeStates();
- QSize calculateSnapshotSize(const QSize &displaySize, const QSize &outputResolution) const;
+ QSize calculateSnapshotSize(const QSize &displaySize, Cxe::AspectRatio aspectRatio) const;
void start(const QSize &size);
void stop();
void handleCameraEvent(int id, int error);
- QPixmap snapshot();
+ QImage snapshot();
private:
CxeSnapshotControl *q;
--- a/camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxesoundplayersymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -19,11 +19,13 @@
#include <QObject>
#include <QMetaType>
+#include <QVariant>
#include <mdaaudiosampleplayer.h>
#include "cxestatemachine.h"
class CMdaAudioPlayerUtility;
class CxeCameraDeviceControlSymbian;
+class CxeSettings;
class CxeSoundPlayerSymbian : public QObject,
public CxeStateMachine,
@@ -31,7 +33,7 @@
{
Q_OBJECT
public:
- /**
+ /*!
* CaptureSound enum defines different types of capture sounds
*/
enum CaptureSound {
@@ -47,7 +49,7 @@
AutoFocus
};
- /*
+ /*!
* Sound player states.
*/
enum State {
@@ -64,20 +66,20 @@
Playing = 0x08
};
- CxeSoundPlayerSymbian(CaptureSound soundId);
+ CxeSoundPlayerSymbian(CaptureSound soundId, CxeSettings &settings);
virtual ~CxeSoundPlayerSymbian();
- /**
- * Plays the currently open capture sound.
- */
void play();
+public slots:
+ void enableSound(long int uid, unsigned long int key, QVariant value);
+
protected: // from CxeStateMachine
void handleStateChanged(int newStateId, CxeError::Id error);
signals:
- /**
- * playComlete signal is emitted when sound has been played.
+ /*!
+ * playComplete signal is emitted when sound has been played.
* @param error Contains status information whether there was a problem with playing or not
*/
void playComplete(int error);
@@ -89,26 +91,22 @@
void MapcPlayComplete(TInt aStatus);
private:
- /**
- * Get current sound player state.
- */
State state() const;
-
- /**
- *
- */
void doOpen();
-
- /**
- * Initialize CxeStateMachine.
- */
void initializeStates();
+ void checkCaptureSoundSettings();
//! Own.
CMdaAudioPlayerUtility *mAudioPlayer;
//! Currently opened sound file
CxeSoundPlayerSymbian::CaptureSound mSoundId;
+
+ bool mUseSound;
+ bool mCaptureSoundForced;
+
+ CxeSettings &mSettings;
+
};
Q_DECLARE_METATYPE(CxeSoundPlayerSymbian::State)
--- a/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -113,7 +113,7 @@
void handleImageData(MCameraBuffer *buffer, int error);
// Snapshot event
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot);
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot);
// settings call back
void handleSettingValueChanged(const QString& settingId,QVariant newValue);
--- a/camerauis/cameraxui/cxengine/inc/cxethumbnailmanagersymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxethumbnailmanagersymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -21,6 +21,7 @@
#include <QObject>
#include <QString>
#include <QPixmap>
+#include <QImage>
// forward declaration
class ThumbnailManager;
@@ -44,20 +45,13 @@
/**
* Creates from given thumbnail.
*/
- virtual void createThumbnail(const QString& filename, QPixmap thumbnail);
+ virtual void createThumbnail(const QString &filename, const QImage &thumbnail);
/**
* Cancels thumbnail creation.
*/
virtual void cancelThumbnail(const QString& filename);
-signals:
-
- /**
- * Informs clients about thumbnail ready event
- */
- void thumbnailReady(QPixmap thumbnail, int error);
-
private slots:
/**
@@ -66,7 +60,7 @@
void thumbnailReady(QPixmap thumbnail, void * data, int id, int error);
private:
- ThumbnailManager* mThumbnailManager;
+ ThumbnailManager *mThumbnailManager;
// file name, thumbnail id hash table
QHash<QString, int> mThumbnailRequests;
};
--- a/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Thu Jul 15 01:52:14 2010 +0300
@@ -98,7 +98,7 @@
//! Notification that videocapture sound has been played
void handleSoundPlayed();
//! Snapshot has been received from adaptiation.
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot);
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot);
protected slots:
// notifications when ECam reference is changed
--- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Thu Jul 15 01:52:14 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,6 +39,7 @@
#include "cxecameradevice.h"
#include "cxememorymonitor.h"
#include "cxediskmonitor.h"
+#include "cxegeotaggingtrail.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
@@ -66,7 +67,8 @@
mQualityPresets(NULL),
mFileSaveThread(NULL),
mDiskMonitor(NULL),
- mMemoryMonitor(NULL)
+ mMemoryMonitor(NULL),
+ mGeoTaggingTrail(NULL)
{
CX_DEBUG_IN_FUNCTION();
}
@@ -120,6 +122,17 @@
mSettings = new CxeSettingsImp(*mSettingsModel);
+ // Loading current camera mode value from settings store and updating
+ // devicecontrol
+ Cxe::CameraMode cameraMode = Cxe::ImageMode;
+ int value;
+ CxeError::Id err = mSettings->get(CxeSettingIds::CAMERA_MODE, value);
+ if (!err) {
+ cameraMode = static_cast<Cxe::CameraMode>(value);
+ }
+ // set current camera mode to devicecontrol.
+ mCameraDeviceControl->setMode(cameraMode);
+
//! @todo a temporary hack to change the startup sequence to avoid GOOM problems
static_cast<CxeSettingsImp*>(mSettings)->loadSettings(mode());
@@ -169,6 +182,10 @@
mSettingsControl = new CxeSettingsControlSymbian(*mCameraDevice, *mSettings);
+ mGeoTaggingTrail = new CxeGeoTaggingTrail(*mStillCaptureControl,
+ *mVideoCaptureControl,
+ *mSettings);
+
OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0");
}
@@ -243,17 +260,25 @@
// Connect file saving thread to snapshot signals and video saved signal.
// Image saving it handles internally.
connect(mStillCaptureControl,
- SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, int)),
+ SIGNAL(snapshotReady(CxeError::Id, const QImage&, int)),
mFileSaveThread,
- SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&, int)));
+ SLOT(handleSnapshotReady(CxeError::Id, const QImage&, int)));
connect(mVideoCaptureControl,
SIGNAL(videoComposed(CxeError::Id, const QString&)),
mFileSaveThread,
SLOT(handleVideoSaved(CxeError::Id, const QString&)));
connect(mVideoCaptureControl,
- SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)),
+ SIGNAL(snapshotReady(CxeError::Id, const QImage&, const QString&)),
mFileSaveThread,
- SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&, const QString&)));
+ SLOT(handleSnapshotReady(CxeError::Id, const QImage&, const QString&)));
+
+
+ // stop location trail when releasing camera.
+ connect(mCameraDevice,
+ SIGNAL(prepareForRelease()),
+ mGeoTaggingTrail,
+ SLOT(stop()),
+ Qt::UniqueConnection);
OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "e_CX_ENGINE_CONNECT_SIGNALS 0");
@@ -263,7 +288,11 @@
CxeEngineSymbian::~CxeEngineSymbian()
{
CX_DEBUG_ENTER_FUNCTION();
-
+
+ // Saving current camera mode to cenrep
+ saveMode();
+
+ delete mGeoTaggingTrail;
delete mAutoFocusControl;
delete mZoomControl;
delete mSettingsControl;
@@ -319,13 +348,17 @@
return *mZoomControl;
}
-// Get the settings handle
+/*!
+Returns the settings handle
+*/
CxeSettings &CxeEngineSymbian::settings()
{
return *mSettings;
}
-// Get the sensor event handle
+/*!
+Returns the sensor event handle
+*/
CxeSensorEventHandler &CxeEngineSymbian::sensorEventHandler()
{
return *mSensorEventHandler;
@@ -338,14 +371,23 @@
}
/*!
-* Get memory monitor utility handle.
+* Returns memory monitor utility handle.
*/
CxeMemoryMonitor &CxeEngineSymbian::memoryMonitor()
{
return *mMemoryMonitor;
}
-/*
+
+/*!
+ Returns geotaggingtrail handle
+ */
+CxeGeoTaggingTrail &CxeEngineSymbian::geoTaggingTrail()
+{
+ return *mGeoTaggingTrail;
+}
+
+/*!
* Returns true, if the engine is ready or else false.
*/
bool CxeEngineSymbian::isEngineReady()
@@ -382,12 +424,17 @@
settingsImp->loadSettings(mode());
}
-
if (mode() == Cxe::ImageMode) {
+ // start geotagging trail in image mode.
+ startGeotaggingTrail();
mVideoCaptureControl->deinit();
mStillCaptureControl->init();
} else if (mode() == Cxe::VideoMode) {
mStillCaptureControl->deinit();
+ if (mGeoTaggingTrail) {
+ // in video mode, Geotagging is not supported for now.
+ mGeoTaggingTrail->stop();
+ }
mVideoCaptureControl->init();
}
@@ -396,12 +443,25 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ * Returns camera mode.
+ */
Cxe::CameraMode CxeEngineSymbian::mode() const
{
return mCameraDeviceControl->mode();
}
/*!
+ * Sets the camera mode.
+ * \parama mode New camera mode
+ */
+void CxeEngineSymbian::setMode(Cxe::CameraMode mode)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mCameraDeviceControl->setMode(mode);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+/*!
Check if we need to reserve camera.
*/
bool CxeEngineSymbian::reserveNeeded()
@@ -528,4 +588,42 @@
CX_DEBUG_EXIT_FUNCTION();
}
+
+/*!
+* Saves current mode to the cenrep
+*/
+void CxeEngineSymbian::saveMode()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mCameraDeviceControl && mSettings) {
+ int value = mCameraDeviceControl->mode();
+ mSettings->set(CxeSettingIds::CAMERA_MODE, value);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Start geotagging trail.
+*/
+void CxeEngineSymbian::startGeotaggingTrail()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mGeoTaggingTrail && mSettings) {
+ // location trail is limited to image mode only for now.
+ int value = Cxe::GeoTaggingDisclaimerDisabled;
+ mSettings->get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value);
+
+ // we start location trail only when Geotagging First-time-use note is accepted by user.
+ if (value == Cxe::GeoTaggingDisclaimerDisabled) {
+ mGeoTaggingTrail->start();
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
// End of file
--- a/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -180,15 +180,27 @@
// Use a dummy "image data item" with empty data and saved state for videos.
// We just need to harvest the file and provide snapshot to Thumbnail Manager.
QByteArray empty;
- CxeImageDataItem* item = new CxeImageDataItemSymbian(empty, filename, CxeStillImage::INVALID_ID, CxeImageDataItem::Saved);
- if(item) {
+ CxeImageDataItem* item = new CxeImageDataItemSymbian(empty,
+ filename,
+ CxeStillImage::INVALID_ID,
+ false,
+ CxeImageDataItem::Saved);
+ if (item) {
save(item);
}
}
+
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename)
+/*!
+ * Handles snapshot event from CxeStillCaptureControl and CxeVideoCaptureControl.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code
+ * @param snapshot Snapshot as QImage
+ * @param filename Name of the file that the snapshot is from
+ */
+void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QImage& snapshot, const QString& filename)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("[INFO] current thread 0x%x", QThread::currentThreadId()));
@@ -199,8 +211,6 @@
if (!snapshot.isNull()) {
// QMutexLocker handles locking and unlocking automaticly.
QMutexLocker lock(&mSnapshotsMutex);
-
- //!@todo: Store as QImage once TNM API is fixed.
mSnapshots.insert(filename, snapshot);
}
}
@@ -208,7 +218,14 @@
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id)
+/*!
+ * Handles snapshot event from CxeStillCaptureControl and CxeVideoCaptureControl.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code
+ * @param snapshot Snapshot as QImage
+ * @param id Id of the file that the snapshot is from
+ */
+void CxeFileSaveThreadSymbian::handleSnapshotReady(CxeError::Id status, const QImage& snapshot, int id)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("[INFO] current thread 0x%x", QThread::currentThreadId()));
@@ -316,13 +333,13 @@
// so we can find the snapshot when harvesting is ready.
QString idString(QString::number(item->id()));
if (mSnapshots.contains(idString)) {
- const QPixmap& snapshot(mSnapshots[idString]);
+ QImage snapshot(mSnapshots[idString]);
mSnapshots.remove(idString);
mSnapshots.insert(path, snapshot);
}
}
- harvestFile(path);
+ harvestFile(path, qobject_cast<CxeImageDataItemSymbian*>(item)->isLocationEnabled());
}
// Delete item, since we own it
@@ -337,7 +354,7 @@
* Harvest one file.
* @param filename Path of the file to be harvested.
*/
-void CxeFileSaveThreadSymbian::harvestFile(const QString& filename)
+void CxeFileSaveThreadSymbian::harvestFile(const QString& filename, bool addLocation)
{
CX_DEBUG_ENTER_FUNCTION();
if (mHarvesterControl) {
@@ -345,8 +362,8 @@
QMutexLocker lock(&mSnapshotsMutex);
// harvest file ( filename, add to album, album id )
- CX_DEBUG(("Requesting harvesting for file: %s", filename.toAscii().constData()));
- CxeError::Id status = mHarvesterControl->harvestFile(filename, false, MDS_CAPTURED_ALBUM_ID);
+ CX_DEBUG(("Requesting harvesting for file: %s addLocation = %d", filename.toAscii().constData(), addLocation));
+ CxeError::Id status = mHarvesterControl->harvestFile(filename, addLocation, MDS_CAPTURED_ALBUM_ID);
CX_DEBUG(("Status for starting harvesting: %d", status));
// If there were errors, release any snapshot stored for this file.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "cxutils.h"
+#include "cxegeotaggingtrail.h"
+#include "cxegeotaggingtrailprivate.h"
+
+/*!
+* Constructor
+*/
+CxeGeoTaggingTrail::CxeGeoTaggingTrail(CxeStillCaptureControl &stillControl,
+ CxeVideoCaptureControl &videoControl,
+ CxeSettings &settings)
+ : d_ptr(new CxeGeoTaggingTrailPrivate(stillControl, videoControl, settings))
+{
+ // connect signal state changed signal.
+ connect(d_ptr, SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
+ this, SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
+ Qt::UniqueConnection);
+}
+
+
+/*!
+* Destructor
+*/
+CxeGeoTaggingTrail::~CxeGeoTaggingTrail()
+{
+ delete d_ptr;
+}
+
+/*!
+* Slot to start location trail.
+*/
+void CxeGeoTaggingTrail::start()
+{
+ Q_D(CxeGeoTaggingTrail);
+ d->start();
+}
+
+/*!
+* Slot to stop location trail.
+*/
+void CxeGeoTaggingTrail::stop()
+{
+ Q_D(CxeGeoTaggingTrail);
+ d->stop();
+}
+
+
+
+/*!
+* Returns current state of Geo-tagging trail.
+*/
+CxeGeoTaggingTrail::State CxeGeoTaggingTrail::state()
+{
+ Q_D(CxeGeoTaggingTrail);
+ return d->state();
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,322 @@
+/*
+* 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
--- a/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -31,11 +31,13 @@
CxeImageDataItemSymbian::CxeImageDataItemSymbian(QByteArray data,
QString filename,
int id,
+ bool addLocation,
CxeImageDataItem::State state)
: CxeStateMachine("CxeImageDataItemSymbian"),
mError(KErrNone),
mId(id),
mData(data),
+ mAddLocationInfo(addLocation),
mPath(filename)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -327,6 +329,12 @@
emit stateChanged(static_cast<State> (newStateId), error);
}
+
+bool CxeImageDataItemSymbian::isLocationEnabled() const
+{
+ return mAddLocationInfo;
+}
+
void CxeImageDataItemSymbian::initializeStates()
{
// addState( id, name, allowed next states )
--- a/camerauis/cameraxui/cxengine/src/cxeimagedataqueuesymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxeimagedataqueuesymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -80,12 +80,12 @@
return *mList[index];
}
-CxeImageDataItemSymbian *CxeImageDataQueueSymbian::startSave( QByteArray data, QString path, int id )
+CxeImageDataItemSymbian *CxeImageDataQueueSymbian::startSave(QByteArray data, QString path, int id, bool addLocation)
{
CX_DEBUG_ENTER_FUNCTION();
- CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, id);
- mList.append( dataItem );
+ CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, id, addLocation);
+ mList.append(dataItem);
CX_DEBUG_EXIT_FUNCTION();
return dataItem;
--- a/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -40,8 +40,10 @@
const int SECONDARY_CAMERA_DISPLAY_ID = 3;
const int ONE_MILLION = 1000000;
- const qreal ASPECT_16_BY_9 = (16/9.0);
- const qreal DELTA_ERROR = 0.20;
+
+ const QSize ASPECT_RATIO_SIZE_4BY3 = QSize(4,3);
+ const QSize ASPECT_RATIO_SIZE_16BY9 = QSize(16, 9);
+ const QSize ASPECT_RATIO_SIZE_11BY9 = QSize(11, 9);
// ICM "camcorderVisible" parameter value below this means sharing aka mms quality.
const int MMS_QUALITY_CAMCORDERVISIBLE_LIMIT = 200;
@@ -305,14 +307,20 @@
{
Cxe::AspectRatio aspectRatio = Cxe::AspectRatio4to3;
- qreal ratio = 0;
- if (height != 0) {
- ratio = (1.0 * width) / height;
-
- qreal delta16by9 = ratio - ASPECT_16_BY_9;
- if (abs(delta16by9) < DELTA_ERROR) {
- aspectRatio = Cxe::AspectRatio16to9;
- }
+ // calculate delta error for the resolution against supported aspect ratio's
+ int delta16by9 = abs((width * ASPECT_RATIO_SIZE_16BY9.height()) - (height * ASPECT_RATIO_SIZE_16BY9.width()));
+ int delta11by9 = abs((width * ASPECT_RATIO_SIZE_11BY9.height()) - (height * ASPECT_RATIO_SIZE_11BY9.width()));
+ int delta4by3 = abs((width * ASPECT_RATIO_SIZE_4BY3.height()) - (height * ASPECT_RATIO_SIZE_4BY3.width()));
+
+ // get the closest aspect ratio
+ int minValue = qMin(qMin(delta16by9, delta11by9), delta4by3);
+
+ if (minValue == delta16by9) {
+ aspectRatio = Cxe::AspectRatio16to9;
+ } else if (minValue == delta11by9) {
+ aspectRatio = Cxe::AspectRatio11to9;
+ } else if (minValue == delta4by3) {
+ aspectRatio = Cxe::AspectRatio4to3;
}
return aspectRatio;
--- a/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -35,10 +35,15 @@
#include "cxeerror.h"
#include "cxecenrepkeys.h"
+
+#ifdef Q_OS_SYMBIAN
+#include <ProfileEngineSDKCRKeys.h>
+#endif
+
using namespace CxeSettingIds;
-/*
+/*!
* CxeSettingsCenRepStore::CxeSettingsCenRepStore
*/
CxeSettingsCenRepStore::CxeSettingsCenRepStore()
@@ -74,8 +79,10 @@
}
-/*
+/*!
* Generates XQSettingsKey from given setting/runtime key
+* \param key Name of the setting from which to generate the XQSettingsKey
+* \param[out] error Error code. CxeError::None if everything went fine.
*/
XQSettingsKey
CxeSettingsCenRepStore::generateXQSettingsKey(const QString& key, CxeError::Id& error)
@@ -103,7 +110,7 @@
-/*
+/*!
* 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
@@ -150,7 +157,7 @@
-/*
+/*!
* Reads a value from cenrep
* @param key - setting key
* @param value - setting value read from cenrep
@@ -183,15 +190,16 @@
-/*
-* Reads a value from cenrep
+/*!
+* Reads a value from cenrep and starts the value change monitoring.
* @param key - setting key
* @param uid - setting UID of the component that owns the setting key
-* @param type - the type of key cr key or P&S key (constantly monitoring value)
+* @param type - the type of key cr key or P&S key
* @param value - setting value read from cenrep
+*
+* @sa handleValueChanged()
*/
-
-void CxeSettingsCenRepStore::get(long int uid,
+void CxeSettingsCenRepStore::startMonitoring(long int uid,
unsigned long int key,
Cxe::SettingKeyType type,
QVariant &value)
@@ -211,18 +219,18 @@
CX_DEBUG(("reading values from XQSettingsManager.."));
value = mSettingsManager->readItemValue(settingsKey);
- if (keyType == XQSettingsKey::TargetPublishAndSubscribe) {
- bool ok = false;
- ok = mSettingsManager->startMonitoring(settingsKey);
- CX_DEBUG_ASSERT(ok);
- }
+ // start monitoring changes for the key
+ // both P&S and Repository keys are monitored
+ bool ok = false;
+ ok = mSettingsManager->startMonitoring(settingsKey);
+ CX_DEBUG_ASSERT(ok);
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Sets a new value to cenrep
* @param key - setting key
* @param newValue - new value set to the key in cenrep
@@ -258,7 +266,7 @@
-/*
+/*!
* resets the cenrep store
*/
void CxeSettingsCenRepStore::reset()
@@ -270,8 +278,8 @@
}
-/*
-* adds key mapping to all settings
+/*!
+* Maps CxeSettingIds to cenrep key ids that XQSettingsManager understands
*/
void CxeSettingsCenRepStore::mapKeys()
{
@@ -323,9 +331,29 @@
FacetrackingCr,
XQSettingsManager::TypeInt);
+ addKeyMapping(CxeSettingIds::IMAGE_SCENE,
+ SceneModeStillCr,
+ XQSettingsManager::TypeString);
+
+ addKeyMapping(CxeSettingIds::VIDEO_SCENE,
+ SceneModeVideoCr,
+ XQSettingsManager::TypeString);
+
+ addKeyMapping(CxeSettingIds::FLASH_MODE,
+ FlashModeStillCr,
+ XQSettingsManager::TypeInt);
+
addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON,
CaptureSoundAlwaysOnCr,
XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::CAMERA_MODE,
+ CameraModeCr,
+ XQSettingsManager::TypeInt);
+
+ addKeyMapping(CxeSettingIds::GEOTAGGING_DISCLAIMER,
+ GeoTaggingDisclaimerCr,
+ XQSettingsManager::TypeInt);
// mapping run-time keys
addKeyMapping(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS,
@@ -361,8 +389,8 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/*
-* helper class to construct key mappings for each setting key
+/*!
+* helper method to construct key mappings for each setting key
*/
void CxeSettingsCenRepStore::addKeyMapping(QString key,
unsigned long int keyid,
@@ -393,14 +421,14 @@
/*!
-* Slot that handles value changed signal for Publish & Subscribe key.
+* Handles value changed signal from the XQSettingsManager.
+* Emits signals corresponding the changed setting.
+* \sa warningTonesChanged(), settingValueChanged()
*/
void CxeSettingsCenRepStore::handleValueChanged(XQSettingsKey key, QVariant value)
{
CX_DEBUG_ENTER_FUNCTION();
-
emit settingValueChanged(key.uid(), key.key(), value);
-
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsimp.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -69,7 +69,7 @@
/*!
Return the current integer setting value for the given key
*/
-CxeError::Id CxeSettingsImp::get(const QString& key, int& value) const
+CxeError::Id CxeSettingsImp::get(const QString &key, int &value) const
{
CX_DEBUG_ENTER_FUNCTION();
@@ -124,7 +124,7 @@
Return the current string setting value for the given key
*/
CxeError::Id CxeSettingsImp::get(
- const QString& key, QString &stringValue) const
+ const QString &key, QString &stringValue) const
{
CX_DEBUG_ENTER_FUNCTION();
@@ -173,7 +173,7 @@
Get the current scene mode setting value for the given key
*/
CxeError::Id CxeSettingsImp::getSceneMode(
- const QString& key, QString &stringValue) const
+ const QString &key, QString &stringValue) const
{
CX_DEBUG_ENTER_FUNCTION();
@@ -204,19 +204,21 @@
/*!
Set new int value for the given key
*/
-CxeError::Id CxeSettingsImp::set(const QString& key,int newValue)
+CxeError::Id CxeSettingsImp::set(const QString &key, int newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %d",
key.toAscii().data(), newValue));
- CxeError::Id err = mSettingsModel.set(key, newValue);
- emit settingValueChanged(key, newValue);
+ CxeError::Id error = mSettingsModel.set(key, newValue);
+ if (error == CxeError::None) {
+ emit settingValueChanged(key, newValue);
+ }
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
@@ -224,35 +226,38 @@
/*!
Set new int value for the given key
*/
-CxeError::Id CxeSettingsImp::set(const QString& key,qreal newValue)
+CxeError::Id CxeSettingsImp::set(const QString &key, qreal newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %f",
key.toAscii().data(), newValue));
- CxeError::Id err = mSettingsModel.set(key, newValue);
- emit settingValueChanged(key, newValue);
+ CxeError::Id error = mSettingsModel.set(key, newValue);
+
+ if (error == CxeError::None) {
+ emit settingValueChanged(key, newValue);
+ }
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
/*!
Set new string value for the given key
*/
-CxeError::Id CxeSettingsImp::set(const QString& key,const QString& newValue)
+CxeError::Id CxeSettingsImp::set(const QString &key, const QString &newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %s",
key.toAscii().data(), newValue.toAscii().data()));
- CxeError::Id err = setSceneMode(key, newValue);
+ CxeError::Id error = setSceneMode(key, newValue);
- if (err == CxeError::NotFound) {
+ if (error == CxeError::NotFound) {
// not scene mode setting, try setting value to settings store
mSettingsModel.set(key, newValue);
emit settingValueChanged(key, newValue);
@@ -260,7 +265,7 @@
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
@@ -269,34 +274,34 @@
Set the current scene mode setting value for the given key
*/
CxeError::Id CxeSettingsImp::setSceneMode(
- const QString& key,const QString& newValue)
+ const QString &key,const QString &newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG(("CxeSettingsImp::set - key: %s value: %s",
key.toAscii().data(), newValue.toAscii().data()));
- CxeError::Id err = CxeError::None;
+ CxeError::Id error = CxeError::None;
CxeScene scene;
if(CxeSettingIds::IMAGE_SCENE == key) {
- err = mSettingsModel.setImageScene(newValue);
+ error = mSettingsModel.setImageScene(newValue);
scene = mSettingsModel.currentImageScene();
} else if(CxeSettingIds::VIDEO_SCENE == key) {
- err = mSettingsModel.setVideoScene(newValue);
+ error = mSettingsModel.setVideoScene(newValue);
scene = mSettingsModel.currentVideoScene();
} else {
- err = CxeError::NotFound;
+ error = CxeError::NotFound;
}
- if (err == CxeError::None) {
+ if (error == CxeError::None) {
// scene mode set, inform clients about scene mode change
emit sceneChanged(scene);
}
CX_DEBUG_EXIT_FUNCTION();
- return err;
+ return error;
}
/*!
@@ -316,7 +321,7 @@
/*
* CxeSettingsImp::CxeSettingsImp
*/
-CxeSettingsImp::CxeSettingsImp(CxeSettingsModel& settingsModel)
+CxeSettingsImp::CxeSettingsImp(CxeSettingsModel &settingsModel)
: mSettingsModel(settingsModel)
{
CX_DEBUG_IN_FUNCTION();
--- a/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -36,7 +36,7 @@
using namespace Cxe;
-/*
+/*!
* CxeSettingsModel::CxeSettingsModel
*/
CxeSettingsModelImp::CxeSettingsModelImp(CxeSettingsStore *settingsStore)
@@ -51,28 +51,26 @@
}
-/*
+/*!
* CxeSettingsModelImp::init
*/
void CxeSettingsModelImp::init()
{
CX_DEBUG_ENTER_FUNCTION();
+ mCurrentImgScene.clear();
+ mCurrentVidScene.clear();
+
loadRuntimeSettings();
loadImageScenes();
loadVideoScenes();
- // TODO: for now the current image scene when we start camera is SceneAuto
- mCameraMode = Cxe::ImageMode;
- setImageScene(CxeSettingIds::IMAGE_SCENE_AUTO);
- setVideoScene(CxeSettingIds::VIDEO_SCENE_AUTO);
-
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* CxeSettingsModelImp::~CxeSettingsModelImp()
*/
CxeSettingsModelImp::~CxeSettingsModelImp()
@@ -94,7 +92,7 @@
-/*
+/*!
* Loads all run-time settings
*/
void CxeSettingsModelImp::loadRuntimeSettings()
@@ -112,7 +110,7 @@
}
-/*
+/*!
* Get setting value associated with the key.
* @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h )
* @Param value - contains the value associated with the key.
@@ -123,17 +121,17 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mSettingStore);
- // Try first to find the item from scene settings.
- // These need to override the common setting values.
- CxeError::Id err = sceneSettingValue(key, value);
- CX_DEBUG(( "status reading from scene data: %d", err));
+ // Try first to find the item from cenrep store.
+
+ CxeError::Id err = mSettingStore->get(key, value);
- // If scene does not control this setting, read it from settings store.
- if (err == CxeError::NotFound) {
+ // If setting is not in cenrep store, try fetching it from scene settings.
+ if (err) {
// setting not found in setting store, try finding if its scene specific setting.
- CX_DEBUG(( "fetching value from settings store" ));
- err = mSettingStore->get(key, value);
+ CX_DEBUG(( "fetching value from scene settings" ));
+ err = sceneSettingValue(key, value);
}
+
CX_DEBUG_EXIT_FUNCTION();
return err;
@@ -142,7 +140,7 @@
-/*
+/*!
* Get setting value associated with the key.
* @param uid - UID of component that owns the setting key
* @Param key - key id of the setting
@@ -157,7 +155,7 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mSettingStore);
- mSettingStore->get(uid, key, type, value);
+ mSettingStore->startMonitoring(uid, key, type, value);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -165,7 +163,7 @@
-/*
+/*!
* Set a value to the key.
* @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h )
* @Param value - contains the value associated with the key.
@@ -176,15 +174,12 @@
CX_DEBUG_ENTER_FUNCTION();
CX_DEBUG_ASSERT(mSettingStore);
- // If this is one of scene settings,
- // store it as modification of current scene.
- CxeError::Id err = setSceneSettingValue(key, newValue);
- CX_DEBUG(( "status storing to scene data: %d", err));
+ // Try storing new value to cenrep
+ CxeError::Id err = mSettingStore->set(key, newValue);
- // If not scene specific, store the setting value.
- if (err == CxeError::NotFound) {
- CX_DEBUG(( "writing value to settings store" ));
- err = mSettingStore->set(key, newValue);
+ if (err) {
+ CX_DEBUG(( "Key not found in cenrepstore, writing value to scene settings" ));
+ err = setSceneSettingValue(key, newValue);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -193,7 +188,7 @@
}
-/*
+/*!
* Reset all settings
*/
void CxeSettingsModelImp::reset()
@@ -205,7 +200,7 @@
}
-/*
+/*!
* Get the configured run-time value associated with the key.
* @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h )
* @Param value - contains the value associated with the key.
@@ -230,7 +225,7 @@
}
-/*
+/*!
* Set new Image scene mode.
* @returns CxeError::None if successful or any CxeError specific error code.
*/
@@ -238,16 +233,20 @@
{
CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id err = CxeError::None;
+ // load scene specific settings
+ CxeError::Id err = loadSceneData(newScene, mCurrentImgScene);
+
+ if (!err) {
+ // saving current image scene to cenrep
+ err = set(CxeSettingIds::IMAGE_SCENE, newScene);
- // load the scene setting default values for the new scene id = "newScene"
- CxeScene sceneSettings;
- err = imageScene(newScene, sceneSettings);
+ // saving flash value from scene to cenrep
+ QString key(CxeSettingIds::FLASH_MODE);
+ err = set(key, mCurrentImgScene[key].toInt());
- // create of copy of the new scene as we use it for accessing the scene settings later.
- if (CxeError::None == err) {
- mCurrentImgScene.clear();
- loadSceneData(mCurrentImgScene, sceneSettings);
+ // saving face tracking value from scene to cenrep
+ key = CxeSettingIds::FACE_TRACKING;
+ err = set(key, mCurrentImgScene[key].toInt());
}
CX_DEBUG_EXIT_FUNCTION();
@@ -256,7 +255,7 @@
}
-/*
+/*!
* Set new video scene mode.
* @returns CxeError::None if successful or any CxeError specific error code.
*/
@@ -264,16 +263,11 @@
{
CX_DEBUG_ENTER_FUNCTION();
- CxeError::Id err = CxeError::None;
+ CxeError::Id err = loadSceneData(newScene, mCurrentVidScene);
- // load the scene setting default values for the new scene id = "newScene"
- CxeScene sceneSettings;
- err = videoScene(newScene, sceneSettings);
-
- // create of copy of the new scene as we use it for accessing the scene settings later.
- if (CxeError::None == err) {
- mCurrentVidScene.clear();
- loadSceneData(mCurrentVidScene, sceneSettings);
+ if (!err) {
+ // video scene loaded successfully, store the scene value to cenrep
+ err = set(CxeSettingIds::VIDEO_SCENE, newScene);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -283,7 +277,7 @@
-/*
+/*!
* Loads Image scene settings for the given Scene ID
*/
CxeError::Id CxeSettingsModelImp::imageScene(const QString &sceneId, CxeScene &sceneSettings)
@@ -304,8 +298,10 @@
}
-/*
+/*!
* Loads Video scene settings for the given Scene ID
+* \param sceneId
+* \param sceneSettings
*/
CxeError::Id CxeSettingsModelImp::videoScene(const QString &sceneId, CxeScene &sceneSettings)
{
@@ -325,27 +321,46 @@
}
-/*
+/*!
* Creates a copy of the selected scene that we use for accessing specific scene settings.
+* \param newScene
+* \param currentSceneSettings
*/
-void CxeSettingsModelImp::loadSceneData(CxeScene ¤tScene, CxeScene &sceneDefaultSettings)
+CxeError::Id CxeSettingsModelImp::loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings)
{
CX_DEBUG_ENTER_FUNCTION();
- // creating a deep copy of the scene mode selected.
+ CxeScene sceneDefaultSettings;
+ CxeError::Id err = imageScene(newScene, sceneDefaultSettings);
+
+ if (err == CxeError::NotFound) {
+ // not still scene, try in video scene.
+ err = videoScene(newScene, sceneDefaultSettings);
+ }
- CxeScene::const_iterator scene = sceneDefaultSettings.constBegin();
- while (scene != sceneDefaultSettings.constEnd()) {
- currentScene.insert(scene.key(), scene.value());
- ++scene;
- }
+ if (!err) {
+ // We have a new scene available, so we can clear the old values.
+ currentSceneSettings.clear();
+
+ // creating a deep copy of the scene mode selected.
+ CxeScene::const_iterator scene = sceneDefaultSettings.constBegin();
+ while (scene != sceneDefaultSettings.constEnd()) {
+ currentSceneSettings.insert(scene.key(), scene.value());
+ ++scene;
+ }
+ }
CX_DEBUG_EXIT_FUNCTION();
+
+ return err;
}
-/*
-* returns value associated with the key
+/*!
+* Returns scene setting value
+* \param key Settings key
+* \param[out] value Value associated with the key
+* \return Error id. CxeError::None if no errors.
*/
CxeError::Id CxeSettingsModelImp::sceneSettingValue(const QString &key, QVariant &value)
{
@@ -375,29 +390,33 @@
}
-/*
-* set scene setting value associated with the key
+/*!
+* Sets new value to settings specific to the scene.
+* @param key - setting id.
+* @param newValue - new setting value
+* @param error Error code. CxeError::None if operation has been successful.
+* @return Error id. CxeError::None if no errors.
*/
CxeError::Id CxeSettingsModelImp::setSceneSettingValue(const QString &key, QVariant newValue)
{
CX_DEBUG_ENTER_FUNCTION();
CxeError::Id err = CxeError::None;
+ CxeScene *scene(0);
- if(mCameraMode == Cxe::ImageMode) {
+ if (mCameraMode == Cxe::ImageMode) {
CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Image mode Setting"));
- if(mCurrentImgScene.contains(key)) {
- mCurrentImgScene[key] = newValue;
- } else {
- err = CxeError::NotFound;
- }
+ scene = &mCurrentImgScene;
} else {
CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Video mode Setting"));
- if(mCurrentVidScene.contains(key)) {
- mCurrentVidScene[key] = newValue;
- } else {
- err = CxeError::NotFound;
- }
+ scene = &mCurrentVidScene;
+ }
+
+ if (scene && scene->contains(key)) {
+ CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue KEY found, writing value"));
+ scene->insert(key, newValue);
+ } else {
+ err = CxeError::NotFound;
}
CX_DEBUG_EXIT_FUNCTION();
@@ -406,7 +425,10 @@
}
-// appending the run-time keys to an array
+/*!
+* Appending the run-time keys to an array
+* \param[in,out] runtimeKeys QList where the supported runtimekeys will be added to
+*/
void CxeSettingsModelImp::supportedKeys(QList<QString>& runtimeKeys)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -422,7 +444,7 @@
}
-/*
+/*!
* Loads all video scene modes
*/
void CxeSettingsModelImp::loadVideoScenes()
@@ -433,7 +455,7 @@
CxeScene vidSceneAuto;
- vidSceneAuto.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_AUTO);
+ vidSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
vidSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
vidSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
vidSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -442,12 +464,12 @@
vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0);
vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
- mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_AUTO,vidSceneAuto);
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_AUTO,vidSceneAuto);
CxeScene vidSceneNight;
- vidSceneNight.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_NIGHT);
+ vidSceneNight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT);
vidSceneNight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
vidSceneNight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
vidSceneNight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
@@ -456,12 +478,12 @@
vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0);
vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
- mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_NIGHT, vidSceneNight);
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_NIGHT, vidSceneNight);
CxeScene vidSceneLowLight;
- vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_LOWLIGHT);
+ vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT);
vidSceneLowLight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
vidSceneLowLight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
vidSceneLowLight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -470,14 +492,14 @@
vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps
vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0);
- mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight);
+ mVideoSceneModes.insert(Cxe::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight);
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Loads all Image Scene Modes
*/
void CxeSettingsModelImp::loadImageScenes()
@@ -488,7 +510,7 @@
CxeScene imgSceneAuto;
- imgSceneAuto.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_AUTO);
+ imgSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO);
imgSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto);
imgSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -501,12 +523,12 @@
imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto);
imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_AUTO, imgSceneAuto);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_AUTO, imgSceneAuto);
CxeScene imgSceneSports;
- imgSceneSports.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_SPORTS);
+ imgSceneSports.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS);
imgSceneSports.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
imgSceneSports.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgSceneSports.insert(CxeSettingIds::EXPOSURE_MODE, ExposureSport);
@@ -519,12 +541,12 @@
imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff);
imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, imgSceneSports);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_SPORTS, imgSceneSports);
CxeScene imgSceneCloseUp;
- imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_MACRO);
+ imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO);
imgSceneCloseUp.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Macro);
imgSceneCloseUp.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgSceneCloseUp.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -537,11 +559,11 @@
imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto);
imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_MACRO, imgSceneCloseUp);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_MACRO, imgSceneCloseUp);
CxeScene imgPortraitscene;
- imgPortraitscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_PORTRAIT);
+ imgPortraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT);
imgPortraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait);
imgPortraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgPortraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureBacklight);
@@ -554,11 +576,11 @@
imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye);
imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_PORTRAIT, imgPortraitscene);
CxeScene imglandscapescene;
- imglandscapescene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_SCENERY);
+ imglandscapescene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY);
imglandscapescene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Infinity);
imglandscapescene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceSunny);
imglandscapescene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -571,12 +593,12 @@
imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff);
imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, imglandscapescene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_SCENERY, imglandscapescene);
CxeScene imgNightscene;
- imgNightscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHT);
+ imgNightscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
imgNightscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto);
imgNightscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgNightscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
@@ -589,11 +611,11 @@
imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff);
imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, imgNightscene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHT, imgNightscene);
CxeScene imgNightpotraitscene;
- imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT);
+ imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT);
imgNightpotraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait);
imgNightpotraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imgNightpotraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
@@ -606,12 +628,12 @@
imgNightpotraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye);
imgNightpotraitscene.insert(CxeSettingIds::FACE_TRACKING, 1);
- mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
+ mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene);
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Returns the current image scene mode.
*/
CxeScene& CxeSettingsModelImp::currentImageScene()
@@ -623,7 +645,7 @@
}
-/*
+/*!
* Returns the current video scene mode.
*/
CxeScene& CxeSettingsModelImp::currentVideoScene()
@@ -635,13 +657,96 @@
}
-/*
-* Updating settings model whenever mode is changed from image to video and vice-versa.
+/*!
+* Restores settings whenever we switch between Image/Video modes or
+* during startup.
*/
void CxeSettingsModelImp::cameraModeChanged(Cxe::CameraMode newMode)
{
CX_DEBUG_ENTER_FUNCTION();
+
+ if (newMode == Cxe::ImageMode) {
+ restoreImageSettings();
+ } else {
+ restoreVideoSettings();
+ }
+
mCameraMode = newMode;
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Restores image settings, during mode change or during startup.
+*/
+void CxeSettingsModelImp::restoreImageSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeError::Id err = CxeError::None;
+ QVariant currentSceneInUse = mCurrentImgScene[CxeSettingIds::SCENE_ID];
+
+ // get the image scene value from cenrep and load the scene settings
+ QVariant cenrepSceneValue;
+ QString key(CxeSettingIds::IMAGE_SCENE);
+ err = getSettingValue(key, cenrepSceneValue);
+
+ bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse);
+
+ if (!err && ok2LoadSceneSettings) {
+ // loading scene settings
+ err = loadSceneData(cenrepSceneValue.toString(), mCurrentImgScene);
+ }
+
+ // Updating Flash setting from cenrep
+ QVariant value;
+ key = CxeSettingIds::FLASH_MODE;
+ err = getSettingValue(key, value);
+
+ if (!err && mCurrentImgScene.contains(key)) {
+ // update local datastructure with flash setting value from cenrep.
+ CX_DEBUG(( "flash setting value %d", value.toInt()));
+ mCurrentImgScene[key] = value;
+ }
+
+ // Updating Face Tracking setting from cenrep
+ key = CxeSettingIds::FACE_TRACKING;
+ err = getSettingValue(key, value);
+
+ if (!err && mCurrentImgScene.contains(key)) {
+ // update local datastructure with flash setting value from cenrep.
+ CX_DEBUG(( "Face Tracking setting value %d", value.toInt()));
+ mCurrentImgScene[key] = value;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+
+/*!
+* Restores video settings, during mode change or during startup.
+*/
+void CxeSettingsModelImp::restoreVideoSettings()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxeError::Id err = CxeError::None;
+ QVariant currentSceneInUse = mCurrentVidScene[CxeSettingIds::SCENE_ID];
+
+ // get the video scene value from cenrep and load the scene settings
+ QVariant cenrepSceneValue;
+ err = getSettingValue(CxeSettingIds::VIDEO_SCENE, cenrepSceneValue);
+
+ bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse);
+
+ if (!err && ok2LoadSceneSettings) {
+ // loading video scene settings
+ loadSceneData(cenrepSceneValue.toString(), mCurrentVidScene);
+ }
+
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/src/cxesnapshotcontrol.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesnapshotcontrol.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -53,9 +53,9 @@
* @param outputResolution Resolution of the output image / video in pixels.
* @return Proposed best snapshot size.
*/
-QSize CxeSnapshotControl::calculateSnapshotSize(const QSize& displaySize, const QSize& outputResolution) const
+QSize CxeSnapshotControl::calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const
{
- return d->calculateSnapshotSize(displaySize, outputResolution);
+ return d->calculateSnapshotSize(displaySize, aspectRatio);
}
/*!
--- a/camerauis/cameraxui/cxengine/src/cxesnapshotcontrolprivate.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesnapshotcontrolprivate.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -39,6 +39,10 @@
{
const int MAINTAIN_ASPECT = false;
+ const QSize ASPECT_RATIO_SIZE_4BY3 = QSize(4,3);
+ const QSize ASPECT_RATIO_SIZE_16BY9 = QSize(16, 9);
+ const QSize ASPECT_RATIO_SIZE_11BY9 = QSize(11, 9);
+
#ifdef Q_OS_SYMBIAN
/*!
* Helper class for cleaning up MCameraBuffer instances.
@@ -131,26 +135,36 @@
/*!
* Calculate snapshot size based on diplay size and image / video output resolution.
* @param displaySize Display size in pixels.
-* @param outputResolution Resolution of the output image / video in pixels.
+* @param Cxe::AspectRatio Aspect ratio of image/video resolution.
* @return Proposed best snapshot size.
*/
-QSize CxeSnapshotControlPrivate::calculateSnapshotSize(const QSize &displaySize, const QSize &outputResolution) const
+
+QSize CxeSnapshotControlPrivate::calculateSnapshotSize(const QSize& displaySize, Cxe::AspectRatio aspectRatio) const
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG(("CxeSnapshotControlPrivate - output resolution (%d,%d)", outputResolution.width(), outputResolution.height()));
CX_DEBUG(("CxeSnapshotControlPrivate - display size (%d,%d)", displaySize.width(), displaySize.height()));
// Take resolution as reference for aspect ratio.
// Scale keeping aspect ratio to just fit display.
- QSize size(outputResolution);
+ QSize size;
+
+ if (aspectRatio == Cxe::AspectRatio4to3) {
+ size = ASPECT_RATIO_SIZE_4BY3;
+ } else if (aspectRatio == Cxe::AspectRatio16to9) {
+ size = ASPECT_RATIO_SIZE_16BY9;
+ } else if (aspectRatio == Cxe::AspectRatio11to9) {
+ size = ASPECT_RATIO_SIZE_11BY9;
+ }
size.scale(displaySize, Qt::KeepAspectRatio);
- CX_DEBUG(("CxeSnapshotControlPrivate - calculated size, (%d,%d)", size.width(), size.height()));
- size.setHeight(displaySize.height());
+
CX_DEBUG(("CxeSnapshotControlPrivate - adjusted final size, (%d,%d)", size.width(), size.height()));
+
CX_DEBUG_EXIT_FUNCTION();
+
return size;
}
+
/*!
* Start getting snapshots from camera.
* Throws CxeException with CxeError::Id if error encountered.
@@ -205,54 +219,53 @@
/*!
* Helper method for getting the snapshot.
* Throws exception if fetching the snapshot fails.
-* @return QPixmap containing the snapshot.
+* @return QImage containing the snapshot.
*/
-QPixmap CxeSnapshotControlPrivate::snapshot()
+QImage CxeSnapshotControlPrivate::snapshot()
{
CX_DEBUG_ENTER_FUNCTION();
- QPixmap pixmap;
+ QImage image;
+
+ #ifdef Q_OS_SYMBIAN
-#ifdef Q_OS_SYMBIAN
- TRAPD(status, {
- RArray<TInt> frameIndex;
- CleanupClosePushL(frameIndex);
+ CFbsBitmap *snapshot = NULL;
+ TRAPD(status, {
+ RArray<TInt> frameIndex;
+ CleanupClosePushL(frameIndex);
- MCameraBuffer &buffer(mDevice.cameraSnapshot()->SnapshotDataL(frameIndex));
- // Make sure buffer is released on leave / exception.
- // Buffer is released once the cleanup item goes out of scope.
- CxeCameraBufferCleanup cleaner(&buffer);
+ MCameraBuffer &buffer(mDevice.cameraSnapshot()->SnapshotDataL(frameIndex));
+ // Make sure buffer is released on leave / exception.
+ // Buffer is released once the cleanup item goes out of scope.
+ CxeCameraBufferCleanup cleaner(&buffer);
- TInt firstImageIndex(frameIndex.Find(0));
- CFbsBitmap &snapshot(buffer.BitmapL(firstImageIndex));
+ TInt firstImageIndex(frameIndex.Find(0));
+ snapshot = &buffer.BitmapL(firstImageIndex);
- CleanupStack::PopAndDestroy(); // frameIndex
-
- TSize size = snapshot.SizeInPixels();
- TInt sizeInWords = size.iHeight * CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU) / sizeof(TUint32);
- CX_DEBUG(("size %d x %d, sizeInWords = %d", size.iWidth, size.iHeight, sizeInWords ));
+ CleanupStack::PopAndDestroy(); // frameIndex
- TUint32 *pixelData = new (ELeave) TUint32[ sizeInWords ];
- // Convert to QImage
- snapshot.LockHeap();
- TUint32 *dataPtr = snapshot.DataAddress();
- memcpy(pixelData, dataPtr, sizeof(TUint32)*sizeInWords);
- snapshot.UnlockHeap();
+ TSize size = snapshot->SizeInPixels();
+ TInt sizeInWords = size.iHeight * CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU) / sizeof(TUint32);
+ CX_DEBUG(("size %d x %d, sizeInWords = %d", size.iWidth, size.iHeight, sizeInWords ));
+
+ CX_DEBUG(("Creating QImage"));
+ image = QImage(size.iWidth, size.iHeight, QImage::Format_RGB32);
- CX_DEBUG(("Creating QImage"));
- QImage *snapImage = new QImage((uchar*)pixelData, size.iWidth, size.iHeight,
- CFbsBitmap::ScanLineLength(size.iWidth, EColor16MU),
- QImage::Format_RGB32);
+ // Convert to QImage
+ snapshot->LockHeap();
+ const uchar *dataPtr = (const uchar*) snapshot->DataAddress();
+ uchar *dst = image.bits();
+ memcpy(dst, dataPtr, image.numBytes());
+ snapshot->UnlockHeap();
- pixmap = QPixmap::fromImage(*snapImage);
- delete [] pixelData;
- delete snapImage;
- });
- // We throw error with the Symbian error code if there was problems.
- CxeException::throwIfError(status);
-#endif // Q_OS_SYMBIAN
+ });
+ // We throw error with the Symbian error code if there was problems.
+ CxeException::throwIfError(status);
+
- CX_DEBUG_EXIT_FUNCTION();
- return pixmap;
+ #endif // Q_OS_SYMBIAN
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return image;
}
/*!
@@ -268,7 +281,7 @@
if (state() == CxeSnapshotControl::Active) {
#ifdef Q_OS_SYMBIAN
if (id == KUidECamEventSnapshotUidValue) {
- QPixmap ss;
+ QImage ss;
if (!error) {
try {
--- a/camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxesoundplayersymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -16,12 +16,14 @@
*/
#include <cxesoundplayersymbian.h>
#include <AudioPreference.h>
+#include <ProfileEngineSDKCRKeys.h>
#include "cxutils.h"
#include "cxecameradevicecontrolsymbian.h"
#include "cxestate.h"
+#include "cxesettings.h"
+
const TUint KCxeAudioPriority = KAudioPriorityCameraTone;
-//const TUint KCxeAudioPriority = KAudioPriorityVideoRecording;
_LIT(KCxeCaptureSound, "z:\\system\\sounds\\digital\\capture.wav");
_LIT(KCxeVideoStartSound, "z:\\system\\sounds\\digital\\videoStart.wav");
@@ -29,13 +31,25 @@
_LIT(KCxeAutoFocusSound, "z:\\system\\sounds\\digital\\autoFocus.wav");
-CxeSoundPlayerSymbian::CxeSoundPlayerSymbian(CaptureSound soundId) :
+CxeSoundPlayerSymbian::CxeSoundPlayerSymbian(CaptureSound soundId,
+ CxeSettings &settings) :
CxeStateMachine("CxeSoundPlayerSymbian"),
mAudioPlayer(NULL),
- mSoundId(soundId)
+ mSoundId(soundId),
+ mUseSound(true),
+ mCaptureSoundForced(false),
+ mSettings(settings)
{
CX_DEBUG_ENTER_FUNCTION();
+ checkCaptureSoundSettings();
+
+ // connect to setting changed signal in order to monitor
+ // profile warning tone changes
+ connect(&mSettings,
+ SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
+ this, SLOT(enableSound(long int, unsigned long int, QVariant)));
+
qRegisterMetaType<CxeSoundPlayerSymbian::State>();
initializeStates();
@@ -52,6 +66,11 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+ * Plays the current sound file if soundplayer is in correct state. Once
+ * playing is finished or there is an error playComplete signal is emitted.
+ * \sa playComplete()
+ */
void CxeSoundPlayerSymbian::play()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -59,15 +78,25 @@
// Only play the capture sound if CMdaAudioPlayerUtility is initialised
if (state() == Ready) {
- //! @todo: Define & implement what to do, when sound is already playing.
- // Important for sequence mode.
- setState(Playing);
- mAudioPlayer->Play();
+
+ if (mUseSound) {
+ //! @todo: Define & implement what to do, when sound is already playing.
+ // Important for sequence mode.
+ setState(Playing);
+ mAudioPlayer->Play();
+ } else {
+ CX_DEBUG(("CxeSoundPlayerSymbian::play capture sounds turned off"));
+
+ // sounds are off and we don't play the sound,
+ // act as the sound has been played
+ emit playComplete(KErrNone);
+ }
+
} else if( state() == NotReady ) {
// Here sound loading has failed.
// Emit signal with error code.
emit playComplete(KErrNotReady);
- }
+ }
CX_DEBUG_EXIT_FUNCTION();
}
@@ -131,9 +160,10 @@
delete mAudioPlayer;
mAudioPlayer = 0;
}
- TRAP( error, mAudioPlayer =
- CMdaAudioPlayerUtility::NewFilePlayerL(*filename, *this, KCxeAudioPriority,
- TMdaPriorityPreference(KAudioPrefCamera)) );
+ TRAP(error, mAudioPlayer =
+ CMdaAudioPlayerUtility::NewFilePlayerL(*filename,
+ *this, KCxeAudioPriority,
+ TMdaPriorityPreference(KAudioPrefCamera)));
if (!error) {
setState(Opening);
} else {
@@ -145,16 +175,25 @@
}
-void CxeSoundPlayerSymbian::handleStateChanged(int /*newStateId*/, CxeError::Id /*error*/)
+void CxeSoundPlayerSymbian::handleStateChanged(int newStateId, CxeError::Id error)
{
+ Q_UNUSED(newStateId);
+ Q_UNUSED(error);
// No implementation needed, because state is not visible outside of this class
}
+/*!
+ * Returns the current sound player state.
+ * \return Current state
+ */
CxeSoundPlayerSymbian::State CxeSoundPlayerSymbian::state() const
{
return static_cast<State>(stateId());
}
+/*!
+ * Initialize CxeStateMachine.
+ */
void CxeSoundPlayerSymbian::initializeStates()
{
// addState(id, name, allowed next states)
@@ -165,3 +204,75 @@
setInitialState(NotReady);
}
+
+/*!
+ * Enables or disables the capture sound. If capture sound is forced to
+ * be always on, then the capture sound cannot be disabled.
+ *
+ * \param uid UID of the changed setting
+ * \param key Key of the changed setting
+ * \param value New setting value
+ */
+void CxeSoundPlayerSymbian::enableSound(long int uid, unsigned long int key, QVariant value)
+{
+
+ // selftimer is only interested in warning tones
+ if (uid == KCRUidProfileEngine.iUid && key == KProEngActiveWarningTones) {
+ CX_DEBUG_IN_FUNCTION();
+ // possible values are:
+ // 0 -> warning tones off
+ // 1 -> warning tones on
+ bool warningTonesEnabled = (value.toInt() == 1);
+
+ // update sound
+ mUseSound = mCaptureSoundForced || warningTonesEnabled;
+ }
+
+ CX_DEBUG(("CxeSoundPlayerSymbian::enableSound <> Use sound [%d]",
+ mUseSound));
+}
+
+/*!
+ * Checks the initial capture sound settings based on profile warning tones
+ * and whether the capture sound is forced to be always on. Connects settings
+ * signal for capture sounds changes to enableCaptureSound slot.
+ *
+ * \sa enableCaptureSound()
+ */
+void CxeSoundPlayerSymbian::checkCaptureSoundSettings()
+{
+
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVariant value(0);
+
+ // get current profile setting for using camerasound
+ // camera sound follows warning tone setting
+ unsigned long int key = KProEngActiveWarningTones;
+ long int uid = KCRUidProfileEngine.iUid;
+ mSettings.get(uid, key, Cxe::Repository, value);
+
+ // possible values are:
+ // 0 -> warning tones off
+ // 1 -> warning tones on
+ bool warningTonesEnabled = (value.toInt() == 1);
+ CX_DEBUG(("Warning tones enabled [%d]", value.toInt()));
+
+ // check whether capture sound is forced or not
+ int forced = 0;
+ mSettings.get(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, forced);
+ // 0 -> capture sound not forced
+ // 1 -> capture sound forced on
+ mCaptureSoundForced = (forced == 1);
+ CX_DEBUG(("Capture sound forced [%d]", forced));
+
+ // use sound if forced on or warningtones are enabled
+ mUseSound = mCaptureSoundForced || warningTonesEnabled;
+ CX_DEBUG(("Use sound [%d]", mUseSound));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+// end of file
+
--- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -56,7 +56,7 @@
const TInt64 KMinRequiredSpaceImage = 2000000;
}
-/**
+/*!
* Constructor.
*/
CxeStillCaptureControlSymbian::CxeStillCaptureControlSymbian(
@@ -118,20 +118,20 @@
connect(&mCameraDeviceControl, SIGNAL(imageBufferReady(MCameraBuffer*,int)),
this, SLOT(handleImageData(MCameraBuffer*,int)));
// connect snapshot ready signal
- connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&)),
- this, SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&)));
+ connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)),
+ this, SLOT(handleSnapshotReady(CxeError::Id, const QImage&)));
OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0");
mImageDataQueue = new CxeImageDataQueueSymbian();
- mAutoFocusSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::AutoFocus);
- mCaptureSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::StillCapture);
+ mAutoFocusSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::AutoFocus, mSettings);
+ mCaptureSoundPlayer = new CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::StillCapture, mSettings);
OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_CREATE_OUT, "msg: e_CX_STILLCAPTURECONTROL_NEW 0");
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Destructor.
*/
CxeStillCaptureControlSymbian::~CxeStillCaptureControlSymbian()
@@ -149,7 +149,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Return the current state.
*/
CxeStillCaptureControl::State CxeStillCaptureControlSymbian::state() const
@@ -157,7 +157,7 @@
return static_cast<CxeStillCaptureControl::State>( stateId() );
}
-/**
+/*!
* Handle state changed event. Normally just emits the signal
* for observers to react appropriately.
*/
@@ -166,7 +166,7 @@
emit stateChanged( static_cast<State>( newStateId ), error );
}
-/**
+/*!
* Initialize the control states.
*/
void CxeStillCaptureControlSymbian::initializeStates()
@@ -179,7 +179,7 @@
setInitialState(Uninitialized);
}
-/**
+/*!
* Initialize the still image capture control.
*/
void CxeStillCaptureControlSymbian::init()
@@ -197,7 +197,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Un-initialize the image mode.
*/
void CxeStillCaptureControlSymbian::deinit()
@@ -234,7 +234,7 @@
}
-/**!
+/*!
* Prepare still capture mode.
*/
void CxeStillCaptureControlSymbian::prepare()
@@ -325,7 +325,7 @@
-/**!
+/*!
Prepare still snapshot
Returns symbian error code.
*/
@@ -338,7 +338,7 @@
try {
QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
mViewfinderControl.deviceDisplayResolution(),
- QSize(mCurrentImageDetails.mWidth, mCurrentImageDetails.mHeight));
+ mCurrentImageDetails.mAspectRatio);
mSnapshotControl.start(snapshotSize);
} catch (...) {
status = KErrGeneral;
@@ -350,7 +350,7 @@
}
-/**!
+/*!
imageInfo contains image qualities details
Returns CxeError error code.
*/
@@ -422,7 +422,7 @@
}
-/* !
+/*!
@Param cameraIndex indicates which camera we are in use, primary/secondary
Returns the format we use for specific camera index.
*/
@@ -439,23 +439,27 @@
return imgFormat;
}
-/**
+/*!
* Snapshot ready notification. Ask the snapshot from snapshot interface.
* NB: Typically snapshot arrives before image data but can be in reverse
* order as well.
+ *
+ * @param status Status of snapshot creation. CxeError::None if no error, otherwise contains the error code.
+ * @param snapshot Snapshot as QImage
*/
-void CxeStillCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot)
+void CxeStillCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
{
CX_DEBUG_ENTER_FUNCTION();
if (mCameraDeviceControl.mode() == Cxe::ImageMode) {
OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 1" );
+ QPixmap ss = QPixmap::fromImage(snapshot);
// Get image container for current snapshot index.
// Remember to increment counter.
CxeStillImageSymbian* stillImage = getImageForIndex(mNextSnapshotIndex++);
if (status == CxeError::None) {
- stillImage->setSnapshot(snapshot);
+ stillImage->setSnapshot(ss);
}
// Emit snapshotReady signal in all cases (error or not)
@@ -490,7 +494,7 @@
}
-/**
+/*!
* handleImageData: Image data received from ECam
*/
void CxeStillCaptureControlSymbian::handleImageData(MCameraBuffer* cameraBuffer, int error)
@@ -539,8 +543,15 @@
QByteArray byteArray( reinterpret_cast<const char*>( data->Ptr() ), data->Size() );
data = NULL;
+ // get geotagging setting value and check if we have to add location trail to image data.
+ int value = Cxe::GeoTaggingOff;
+ mSettings.get(CxeSettingIds::GEOTAGGING, value);
+
// Save the image data
- CxeImageDataItemSymbian* dataItem = mImageDataQueue->startSave(byteArray, stillImage->filename(), stillImage->id());
+ CxeImageDataItemSymbian* dataItem = mImageDataQueue->startSave(byteArray,
+ stillImage->filename(),
+ stillImage->id(),
+ value == Cxe::GeoTaggingOn);
stillImage->setDataItem(dataItem);
mFileSaveThread.save(dataItem); // Saving thread takes ownership of dataItem.
}
@@ -561,7 +572,7 @@
}
-/**
+/*!
* Settings changed, needs updated
*/
void CxeStillCaptureControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue)
@@ -606,7 +617,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* ECam reference changing, release resources
*/
void CxeStillCaptureControlSymbian::prepareForCameraDelete()
@@ -616,7 +627,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Camera being released. Cancel ongoing capture, if any.
*/
void CxeStillCaptureControlSymbian::prepareForRelease()
@@ -626,7 +637,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* New camera available,
*/
void CxeStillCaptureControlSymbian::handleCameraAllocated(CxeError::Id error)
@@ -660,7 +671,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Return number of images captured (during current capture operation only).
*/
int CxeStillCaptureControlSymbian::imageCount() const
@@ -668,7 +679,7 @@
return mImages.count();
}
-/**
+/*!
* Reset the image array.
*/
void CxeStillCaptureControlSymbian::reset()
@@ -684,7 +695,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* This should cancel any ongoing image captures.
*/
void CxeStillCaptureControlSymbian::cancelAll()
@@ -693,7 +704,7 @@
reset();
}
-/**
+/*!
* Sets the current capture mode: SingleImageCapture / BurstCapture.
*/
void CxeStillCaptureControlSymbian::setMode( CaptureMode mode )
@@ -701,7 +712,7 @@
mMode = mode;
}
-/**
+/*!
* Returns the current capture mode.
*/
CxeStillCaptureControl::CaptureMode CxeStillCaptureControlSymbian::mode() const
@@ -709,7 +720,7 @@
return mMode;
}
-/**
+/*!
* Operator [] - returns the indexed image from capture array.
*/
CxeStillImage &CxeStillCaptureControlSymbian::operator[]( int index )
@@ -717,7 +728,7 @@
return *mImages[ index ];
}
-/**
+/*!
* Getter for image data queue.
*/
CxeImageDataQueue &CxeStillCaptureControlSymbian::imageDataQueue()
@@ -725,7 +736,7 @@
return *mImageDataQueue;
}
-/**
+/*!
* Generates a filename and sets it in the still image object.
* Skips the process if filename already copied exists in the object. This
* behaviour is required in rare cases where image data arrives before snapshot.
@@ -788,7 +799,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
+/*!
* Get the image container at given index or create a new one if needed.
*/
CxeStillImageSymbian* CxeStillCaptureControlSymbian::getImageForIndex(int index)
--- a/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -61,8 +61,8 @@
@param filename - name of the image/video filename
@param snapshot - snapshot data from image/video
*/
-void CxeThumbnailManagerSymbian::createThumbnail(const QString& filename,
- QPixmap /*snapshot*/)
+void CxeThumbnailManagerSymbian::createThumbnail(const QString &filename,
+ const QImage &snapshot)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -71,9 +71,7 @@
if (mThumbnailManager) {
CX_DEBUG(("creating thumbnails"));
- //!@todo Thumbnail manager interface needs to be changed to use QImage
- // instead of QPixmap for setThumbnail. Until then, using qetThumbnail.
- int thumbnailId = mThumbnailManager->getThumbnail(filename, 0);
+ int thumbnailId = mThumbnailManager->setThumbnail(snapshot, filename);
if (thumbnailId != -1) {
CX_DEBUG(("Thumbnail ID = %d", thumbnailId));
mThumbnailRequests.insert(filename, thumbnailId);
@@ -137,7 +135,6 @@
if (mThumbnailRequests.contains(key)) {
CX_DEBUG(("Thumbnail created for filename = %s", key.toAscii().constData()));
mThumbnailRequests.remove(key);
- emit thumbnailReady(thumbnail, error);
}
CX_DEBUG_EXIT_FUNCTION();
--- a/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:52:14 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"
@@ -92,9 +92,11 @@
initializeStates();
mVideoStopSoundPlayer = new
- CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStop);
+ CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStop,
+ mSettings);
mVideoStartSoundPlayer = new
- CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStart);
+ CxeSoundPlayerSymbian(CxeSoundPlayerSymbian::VideoCaptureStart,
+ mSettings);
// If camera is already allocated, call the slot ourselves.
if (mCameraDevice.camera()) {
@@ -115,8 +117,8 @@
this, SLOT(handleSoundPlayed()));
// connect snapshot ready signal
- connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&)),
- this, SLOT(handleSnapshotReady(CxeError::Id, const QPixmap&)));
+ connect(&mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)),
+ this, SLOT(handleSnapshotReady(CxeError::Id, const QImage&)));
// enabling setting change callbacks to videocapturecontrol
connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)),
@@ -164,7 +166,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* Releases all resources
*/
void CxeVideoCaptureControlSymbian::deinit()
@@ -330,7 +332,7 @@
// Prepare snapshot. Snapshot control throws error if problems.
QSize snapshotSize = mSnapshotControl.calculateSnapshotSize(
mViewfinderControl.deviceDisplayResolution(),
- QSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight));
+ mCurrentVideoDetails.mAspectRatio);
mSnapshotControl.start(snapshotSize);
// Prepare zoom only when there are no errors during prepare.
@@ -709,7 +711,7 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/*
+/*!
* calculates remaining video recording time.
*/
void CxeVideoCaptureControlSymbian::remainingTime(int &time)
@@ -793,13 +795,13 @@
* @param status Status code for getting the snapshot.
* @param snapshot Snapshot pixmap. Empty if error code reported.
*/
-void CxeVideoCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot)
+void CxeVideoCaptureControlSymbian::handleSnapshotReady(CxeError::Id status, const QImage &snapshot)
{
CX_DEBUG_ENTER_FUNCTION();
if (mCameraDeviceControl.mode() == Cxe::VideoMode) {
// Need to store snapshot for ui to be able to get it also later.
- mSnapshot = snapshot;
+ mSnapshot = QPixmap::fromImage(snapshot);
emit snapshotReady(status, snapshot, filename());
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -191,6 +191,11 @@
return mFakeCameraDeviceControl->mode();
}
+void CxeFakeEngine::setMode(Cxe::CameraMode mode)
+{
+ mFakeCameraDeviceControl->setMode(mode);
+}
+
void CxeFakeEngine::initModeFake(Cxe::CameraMode cameraMode)
{
mFakeCameraDeviceControl->setMode( cameraMode );
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeengine.h Thu Jul 15 01:52:14 2010 +0300
@@ -63,6 +63,7 @@
CxeSettings &settings();
CxeFeatureManager &featureManager();
Cxe::CameraMode mode() const;
+ void setMode(Cxe::CameraMode mode);
void initMode(Cxe::CameraMode cameraMode);
bool isEngineReady();
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -34,14 +34,14 @@
}
-void CxeFakeFileSaveThread::handleVideoSaved(CxeError::Id status, const QString& filename)
+void CxeFakeFileSaveThread::handleVideoSaved(CxeError::Id status, const QString &filename)
{
}
-void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename)
+void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename)
{
}
-void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id)
+void CxeFakeFileSaveThread::handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id)
{
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakefilesavethread.h Thu Jul 15 01:52:14 2010 +0300
@@ -30,9 +30,9 @@
void save(CxeImageDataItem *data);
public slots:
- void handleVideoSaved(CxeError::Id status, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, const QString& filename);
- void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot, int id);
+ void handleVideoSaved(CxeError::Id status, const QString &filename);
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, const QString &filename);
+ void handleSnapshotReady(CxeError::Id status, const QImage &snapshot, int id);
};
#endif // CXEFAKEFILESAVETHREAD_H
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -22,11 +22,12 @@
#include "cxeimagedataitem.h"
#include "cxutils.h"
-CxeFakeImageDataItem::CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id)
+CxeFakeImageDataItem::CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id, bool addLocation)
: mId(id),
mIndex(index),
mData(data),
mFileName(filename),
+ mAddLocationInfo(addLocation),
mState(CxeImageDataItem::SavePending)
{
CX_DEBUG_IN_FUNCTION();
@@ -64,4 +65,10 @@
return mFileName;
}
+
+bool CxeFakeImageDataItem::addLocation() const
+{
+ return mAddLocationInfo;
+}
+
// end of file
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeimagedataitem.h Thu Jul 15 01:52:14 2010 +0300
@@ -26,7 +26,7 @@
Q_OBJECT
public: // constructor and destructor
- CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id);
+ CxeFakeImageDataItem(int index, QByteArray data, QString filename, int id, bool addLocation);
virtual ~CxeFakeImageDataItem();
public: // from CxeImageDataItem
@@ -34,12 +34,14 @@
CxeImageDataItem::State state() const;
int id() const;
QString path() const;
+ bool addLocation() const;
private:
int mId;
int mIndex;
QByteArray mData;
QString mFileName;
+ bool mAddLocationInfo;
CxeImageDataItem::State mState;
};
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -58,12 +58,14 @@
CxeError::Id CxeFakeSettings::set(const QString& key, int newValue)
{
mSettingKeyHash[key] = QVariant(newValue);
+ emit settingValueChanged(key, newValue);
return CxeError::None;
}
CxeError::Id CxeFakeSettings::set(const QString &key, const QString &newValue)
{
mSettingKeyHash[key] = QVariant(newValue);
+ emit settingValueChanged(key, newValue);
return CxeError::None;
}
@@ -72,6 +74,7 @@
CxeError::Id CxeFakeSettings::set(const QString &key, qreal newValue)
{
mSettingKeyHash[key] = QVariant(newValue);
+ emit settingValueChanged(key, newValue);
return CxeError::None;
}
@@ -80,3 +83,8 @@
{
}
+
+void CxeFakeSettings::emulate(long int uid, unsigned long int key, QVariant value)
+{
+ emit settingValueChanged(uid, key, value);
+}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettings.h Thu Jul 15 01:52:14 2010 +0300
@@ -41,7 +41,8 @@
void reset();
public: // methods for unit testing
- // ??
+
+ void emulate(long int uid, unsigned long int key, QVariant value);
private: // data
QHash<QString, QVariant> mSettingKeyHash;
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -20,7 +20,12 @@
CxeFakeSettingsModel::CxeFakeSettingsModel()
{
- CX_DEBUG_IN_FUNCTION();
+ CX_DEBUG_ENTER_FUNCTION();
+
+ initDefaultCameraSettings();
+ initRuntimeSettings();
+
+ CX_DEBUG_EXIT_FUNCTION();
}
CxeFakeSettingsModel::~CxeFakeSettingsModel()
@@ -34,8 +39,8 @@
CxeError::Id err = CxeError::None;
// read run-time configuration value
- if (mStore.contains(key)) {
- value = qVariantFromValue<QList<QVariant> > (mStore[key]);
+ if (mRuntimeSettings.contains(key)) {
+ value = qVariantFromValue<QVariantList > (mRuntimeSettings.value(key));
} else {
err = CxeError::NotFound;
}
@@ -72,7 +77,7 @@
}
-/* This is a helper method for this fake class that can be used to set key-value pairs
+/*! This is a helper method for this fake class that can be used to set key-value pairs
* to local mStore database. Key-value pairs don't have to refer any real values used
* in camera application as the fake class is used only for testing purposes
*/
@@ -95,29 +100,29 @@
CxeError::Id CxeFakeSettingsModel::setImageScene(const QString &newScene)
{
- mDummyScene.clear();
+ mDummyImageScene.clear();
// image scene mode key values
- if(newScene == CxeSettingIds::IMAGE_SCENE_AUTO) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_AUTO);
+ if(newScene == Cxe::IMAGE_SCENE_AUTO) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_PORTRAIT) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_PORTRAIT);
+ else if(newScene == Cxe::IMAGE_SCENE_PORTRAIT) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_SCENERY) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_SCENERY);
+ else if(newScene == Cxe::IMAGE_SCENE_SCENERY) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_MACRO) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_MACRO);
+ else if(newScene == Cxe::IMAGE_SCENE_MACRO) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_SPORTS) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_SPORTS);
+ else if(newScene == Cxe::IMAGE_SCENE_SPORTS) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_NIGHT) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_NIGHT);
+ else if(newScene == Cxe::IMAGE_SCENE_NIGHT) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
}
- else if(newScene == CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT) {
- mDummyScene.insert(CxeSettingIds::IMAGE_SCENE, CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT);
+ else if(newScene == Cxe::IMAGE_SCENE_NIGHTPORTRAIT) {
+ mDummyImageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT);
}
else {
return CxeError::NotFound;
@@ -128,20 +133,20 @@
CxeError::Id CxeFakeSettingsModel::setVideoScene(const QString &newScene)
{
- mDummyScene.clear();
+ mDummyVideoScene.clear();
// image scene mode key values
- if(newScene == CxeSettingIds::VIDEO_SCENE_AUTO) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_AUTO);
+ if(newScene == Cxe::VIDEO_SCENE_AUTO) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
}
- else if(newScene == CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT);
+ else if(newScene == Cxe::VIDEO_SCENE_NIGHTPORTRAIT) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHTPORTRAIT);
}
- else if(newScene == CxeSettingIds::VIDEO_SCENE_LOWLIGHT) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_LOWLIGHT);
+ else if(newScene == Cxe::VIDEO_SCENE_LOWLIGHT) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT);
}
- else if(newScene == CxeSettingIds::VIDEO_SCENE_NIGHT) {
- mDummyScene.insert(CxeSettingIds::VIDEO_SCENE, CxeSettingIds::VIDEO_SCENE_NIGHT);
+ else if(newScene == Cxe::VIDEO_SCENE_NIGHT) {
+ mDummyVideoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT);
}
else {
return CxeError::NotFound;
@@ -151,6 +156,24 @@
}
+CxeScene& CxeFakeSettingsModel::currentImageScene()
+{
+ return mDummyImageScene;
+}
+
+
+CxeScene& CxeFakeSettingsModel::currentVideoScene()
+{
+ return mDummyVideoScene;
+}
+
+
+void CxeFakeSettingsModel::cameraModeChanged(Cxe::CameraMode newMode)
+{
+ mDummyCameraMode = newMode;
+}
+
+
/* This helper method initializes fake store for default camera settings
*/
void CxeFakeSettingsModel::initDefaultCameraSettings()
@@ -171,34 +194,47 @@
mSettingStore.insert(CxeSettingIds::FRAME_RATE, QVariant(1));
mSettingStore.insert(CxeSettingIds::IMAGE_QUALITY, QVariant(1));
mSettingStore.insert(CxeSettingIds::IMAGE_SCENE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_AUTO, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_MACRO, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, QVariant(1));
- mSettingStore.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, QVariant(1));
mSettingStore.insert(CxeSettingIds::LIGHT_SENSITIVITY, QVariant(1));
mSettingStore.insert(CxeSettingIds::SCENE_ID, QVariant(1));
mSettingStore.insert(CxeSettingIds::SECONDARY_CAMERA, QVariant(1));
mSettingStore.insert(CxeSettingIds::SELF_TIMER, QVariant(1));
mSettingStore.insert(CxeSettingIds::VIDEO_SCENE, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_AUTO, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_NIGHT, QVariant(1));
- mSettingStore.insert(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, QVariant(1));
mSettingStore.insert(CxeSettingIds::WHITE_BALANCE, QVariant(1));
+
+ // default scene
+ setImageScene(Cxe::IMAGE_SCENE_AUTO);
+ setVideoScene(Cxe::VIDEO_SCENE_AUTO);
+
CX_DEBUG_EXIT_FUNCTION();
}
-void CxeFakeSettingsModel::testSetCurrenImageScene()
+
+
+/* This helper method initializes fake runtime setting values for the keys
+ */
+void CxeFakeSettingsModel::initRuntimeSettings()
{
- mDummyScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE);
-}
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QVariantList supported;
+ supported.append(QVariant(1));
+
+ QVariantList notSupported;
+ notSupported.append(QVariant(0));
-void CxeFakeSettingsModel::testSetCurrenVideoScene()
-{
- mDummyScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE);
+ QVariantList values;
+ values.append(QVariant(1));
+ values.append(QVariant(2));
+ values.append(QVariant(3));
+
+ mRuntimeSettings.insert(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS, supported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS, supported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::SECONDARY_CAMERA_CAPTURE_KEYS, notSupported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::FREE_MEMORY_LEVELS, notSupported);
+ mRuntimeSettings.insert(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS, values);
+ mRuntimeSettings.insert(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, values);
+
+ CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsmodel.h Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -17,7 +17,7 @@
#ifndef CXEFAKESETTINGSMODEL_H
#define CXEFAKESETTINGSMODEL_H
-#include <QMap>
+#include <QHash>
#include "cxesettingsmodel.h"
class CxeFakeSettingsModel : public CxeSettingsModel
@@ -34,15 +34,16 @@
CxeError::Id getRuntimeValue(const QString &key, QVariant &value);
CxeError::Id set(const QString &key,const QVariant newValue);
- CxeScene& currentImageScene() {return mDummyScene;}
- CxeScene& currentVideoScene() {return mDummyScene;}
- void cameraModeChanged(Cxe::CameraMode newMode) {mDummyCameraMode = newMode;}
+ CxeScene& currentImageScene();
+ CxeScene& currentVideoScene();
+ void cameraModeChanged(Cxe::CameraMode newMode);
CxeError::Id setImageScene(const QString &newScene);
CxeError::Id setVideoScene(const QString &newScene);
public: // own helper methods
void setRuntimeValues(QString &key, QList<QVariant> value);
void initDefaultCameraSettings();
+ void initRuntimeSettings();
void testSetCurrenImageScene();
void testSetCurrenVideoScene();
@@ -50,9 +51,10 @@
private:
- QMap<QString, QList<QVariant> > mStore;
QHash<QString, QVariant> mSettingStore;
- CxeScene mDummyScene;
+ QHash<QString, QVariantList> mRuntimeSettings;
+ CxeScene mDummyImageScene;
+ CxeScene mDummyVideoScene;
Cxe::CameraMode mDummyCameraMode;
};
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -30,13 +30,28 @@
mSettingKeyHash.insert(CxeSettingIds::FNAME_MONTH_FOLDER, QVariant("08042009"));
mSettingKeyHash.insert(CxeSettingIds::FNAME_IMAGE_COUNTER, QVariant(0));
mSettingKeyHash.insert(CxeSettingIds::FNAME_VIDEO_COUNTER, QVariant(0));
+
+ mSettingKeyHash.insert(CxeSettingIds::CAMERA_MODE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::FLASH_MODE, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::IMAGE_SCENE, QVariant("image_scene_auto"));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_SCENE, QVariant("video_scene_auto"));
+ mSettingKeyHash.insert(CxeSettingIds::STILL_SHOWCAPTURED, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_SHOWCAPTURED, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_MUTE_SETTING, QVariant(0));
+
+ mSettingKeyHash.insert(CxeSettingIds::GEOTAGGING, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::GEOTAGGING_DISCLAIMER, QVariant(1));
+ mSettingKeyHash.insert(CxeSettingIds::FACE_TRACKING, QVariant(1));
+ mSettingKeyHash.insert(CxeSettingIds::IMAGE_QUALITY, QVariant(0));
+ mSettingKeyHash.insert(CxeSettingIds::VIDEO_QUALITY, QVariant(0));
+
}
CxeFakeSettingsStore::~CxeFakeSettingsStore()
{
}
-/*
+/*!
* Reads a value from cenrep
* @param "key" - setting key
* @param "value" - setting value read from cenrep
@@ -55,14 +70,14 @@
return error;
}
-/*
+/*!
* Reads a value from cenrep
* @param "uid" - UID of the component that own setting key
* @param "key" - setting key id
* @param "type" - type of setting key
* @param "value" - setting value read from cenrep
*/
-void CxeFakeSettingsStore::get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value)
+void CxeFakeSettingsStore::startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value)
{
Q_UNUSED(uid);
Q_UNUSED(key);
@@ -72,7 +87,7 @@
// no support yet
}
-/*
+/*!
* Reads/loads all run-time settings values from cenrep
* @param QList<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
@@ -106,7 +121,7 @@
}
-/*
+/*!
* Sets a new value to cenrep
* @param "key" - setting key
* @param "newValue" - new value set to the key in cenrep
@@ -121,7 +136,7 @@
return error;
}
-/*
+/*!
* resets the cenrep store
*/
void CxeFakeSettingsStore::reset()
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakesettingsstore.h Thu Jul 15 01:52:14 2010 +0300
@@ -30,7 +30,7 @@
public: // from base class
void reset();
CxeError::Id get(const QString& key, QVariant &value);
- void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
+ void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value);
CxeError::Id set(const QString& key,const QVariant newValue);
QHash<QString, QVariantList> loadRuntimeSettings(QList<QString>& keylist);
--- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideocapturecontrol.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakevideocapturecontrol.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -16,6 +16,7 @@
*/
#include <QPixmap>
+#include <QImage>
#include "cxefakequalitypresets.h"
#include "cxefakevideocapturecontrol.h"
#include "cxutils.h"
@@ -61,7 +62,7 @@
CX_DEBUG_ENTER_FUNCTION();
emit videoComposed(CxeError::None, filename());
- emit snapshotReady(CxeError::None, snapshot(), filename());
+ emit snapshotReady(CxeError::None, QImage(), filename());
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -67,7 +67,8 @@
<< "unittest_cxeharvestercontrolsymbian"
<< "unittest_cxesettingscontrolsymbian"
<< "unittest_cxesnapshotcontrol"
- << "unittest_cxeenginesymbian";
+ << "unittest_cxeenginesymbian"
+ << "unittest_cxegeotaggingtrail";
QDir dir;
dir.mkpath(logFileFolder);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/locationtrailpskeys.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Definition file for Location Trail PS keys.
+*
+*/
+
+#ifndef __LOCATIONTRAILPSKEYS_H__
+#define __LOCATIONTRAILPSKEYS_H__
+
+const TUid KPSUidLocationTrail = { 0x200071BE };
+
+/**
+ * Used by location trail, indicating location trail state changes.
+ *
+ * Possible values:
+ * 0: Location trail stopped.
+ * 1: Location trail started, waiting for valid GPS data.
+ * 2: Location trail started, searching GPS device.
+ * 3: Location trail started.
+ */
+const TUint32 KLocationTrailState = 0x00000001;
+
+
+#endif // __LOCATIONTRAILPSKEYS_H__
+
+// End of file.
+
--- a/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -27,11 +27,15 @@
* ThumbnailManager::ThumbnailManager
*/
ThumbnailManager::ThumbnailManager(QObject* parentPtr)
+ : mTimer(this)
{
Q_UNUSED(parentPtr);
mCurrentThumbnailId = 0;
mThumbnailManagerIds.clear();
+ mTimer.setSingleShot(true);
+ connect(&mTimer, SIGNAL(timeout()),
+ this, SLOT(emulateThumbnailReady()));
}
@@ -53,9 +57,33 @@
Q_UNUSED(priority);
+ int id = 0;
+
+ if (filename.isNull() || filename.isEmpty()) {
+ id = -1;
+ } else {
+ // generate thumbnail id
+ id = mCurrentThumbnailId;
+ mThumbnailManagerIds.append(mCurrentThumbnailId++);
+ }
+
+ // try emulating thumbnail ready
+ mTimer.start(1000);
+
+ CX_DEBUG_EXIT_FUNCTION();
+
+ return id;
+}
+
+int ThumbnailManager::setThumbnail( const QImage& source, const QString& fileName,
+ void *clientData, int priority)
+{
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+
int status = KErrNone;
- if (filename.isNull() || filename.isEmpty()) {
+ if (fileName.isNull() || fileName.isEmpty()) {
status = KErrNotFound;
} else {
// generate thumbnail id
@@ -65,14 +93,12 @@
emit thumbnailReady(QPixmap(), clientData, mCurrentThumbnailId, status);
mCurrentThumbnailId++;
-
+
CX_DEBUG_EXIT_FUNCTION();
- return status;
+ return mCurrentThumbnailId;
}
-
-
/*!
* start canceling creating thumbnail operation
*/
@@ -80,3 +106,21 @@
{
return mThumbnailManagerIds.contains(id);
}
+
+
+/*!
+* slot that emulates thumbnail ready
+*/
+void ThumbnailManager::emulateThumbnailReady()
+{
+ // get the current thumbnail id
+ int id = mCurrentThumbnailId - 1;
+ int status = KErrNone;
+
+ if (id == -1) {
+ // if there are no valid thumbnails
+ status = KErrNotFound;
+ }
+ emit thumbnailReady(QPixmap(), 0, id, status);
+}
+
--- a/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/thumbnailmanager_qt.h Thu Jul 15 01:52:14 2010 +0300
@@ -21,6 +21,7 @@
#include <qobject>
#include <QPixmap.h>
#include <QStringList>
+#include <QTimer>
class ThumbnailManager : public QObject
@@ -63,6 +64,24 @@
int priority = 0);
/**
+ * Set a thumbnail for an object file generated from pixmap delivered.
+ * thumbnailReady() signal will be emited when the operation is complete.
+ *
+ * @param source QImage from which the thumbnail will be created
+ * @param fileName file name
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady callback.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ *
+ */
+ int setThumbnail( const QImage& source, const QString& fileName,
+ void * clientData = NULL, int priority = 0 );
+
+ /**
* Cancel a thumbnail operation.
*
* @param id Request ID for the operation to be cancelled.
@@ -82,9 +101,13 @@
*/
void thumbnailReady( QPixmap , void * , int , int );
+private slots:
+ void emulateThumbnailReady();
+
private:
int mCurrentThumbnailId;
QList<int> mThumbnailManagerIds;
+ QTimer mTimer;
};
#endif // THUMBNAILMANAGER_QT
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Thu Jul 15 01:52:14 2010 +0300
@@ -43,6 +43,7 @@
unittest_cxethumbnailmanagersymbian \
unittest_cxeharvestercontrolsymbian \
unittest_cxesettingscontrolsymbian \
- unittest_cxesnapshotcontrol
+ unittest_cxesnapshotcontrol \
+ unittest_cxegeotaggingtrail
CONFIG *= ordered
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/unittest_cxecameradevicecontrolsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxecameradevicecontrolsymbian/unittest_cxecameradevicecontrolsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -26,6 +26,8 @@
LIBS *= -lfbscli
LIBS *= -lbitgdi
LIBS *= -lsysutil
+LIBS *= -lefsrv
+LIBS *= -lcone
DEFINES *= CXE_USE_DUMMY_CAMERA
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeenginesymbian/unittest_cxeenginesymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -41,10 +41,9 @@
LIBS *= -lsensrvclient
LIBS *= -lsensrvutil
LIBS *= -limagingconfigmanager
-LIBS *= -lalfclient
-LIBS *= -lalfdecoderserverclient
LIBS *= -lxqserviceutil
LIBS *= -loommonitor
+LIBS += -llocationmanager
SOURCES *= unittest_cxeenginesymbian.cpp \
@@ -105,7 +104,9 @@
cxememorymonitorprivate.cpp \
cxesnapshotcontrol.cpp \
cxesnapshotcontrolprivate.cpp \
- cxefakesettingsmodel.cpp
+ cxefakesettingsmodel.cpp \
+ cxegeotaggingtrail.cpp \
+ cxegeotaggingtrailprivate.cpp
@@ -180,4 +181,6 @@
cxememorymonitorprivate.h \
cxesnapshotcontrol.h \
cxesnapshotcontrolprivate.h \
- cxefakesettingsmodel.h
+ cxefakesettingsmodel.h \
+ cxegeotaggingtrail.h \
+ cxegeotaggingtrailprivate.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -20,6 +20,12 @@
#include "unittest_cxefeaturemanagerimp.h"
#include "cxefakesettingsmodel.h"
#include "cxefeaturemanagerimp.h"
+#include "cxenamespace.h"
+
+
+static const char* INVALID_KEY = "invalid key";
+static const char* EMPTY_KEY = "";
+
UnitTestCxeFeatureManager::UnitTestCxeFeatureManager()
: mFakeSettingsModel(NULL), mFeatureManager(NULL)
@@ -34,6 +40,7 @@
// Run before each individual test case
void UnitTestCxeFeatureManager::init()
{
+ // fake model contains initialized test data.
mFakeSettingsModel = new CxeFakeSettingsModel();
mFeatureManager = new CxeFeatureManagerImp(*mFakeSettingsModel);
}
@@ -49,34 +56,25 @@
}
// Testing that isFeatureSupported function returns correct values
-void UnitTestCxeFeatureManager::testSupportedKeys()
+void UnitTestCxeFeatureManager::testIsFeatureSupported()
{
- // Create a key that won't be added to test data
- QString falseKey = QString("testKeyFalse");
bool isSupported;
CxeError::Id err;
+ QString key;
- // Test that key that is not added to test data is not found
- // also boolean value isSupported should return false as key is not found
- err = mFeatureManager->isFeatureSupported(falseKey, isSupported);
+ // test that invalid key is not found.
+ err = mFeatureManager->isFeatureSupported(INVALID_KEY, isSupported);
+ QVERIFY(!isSupported);
+ QCOMPARE(err, CxeError::NotFound);
+
+ // try with empty key
+ err = mFeatureManager->isFeatureSupported(EMPTY_KEY, isSupported);
QVERIFY(!isSupported);
QCOMPARE(err, CxeError::NotFound);
- // create and set test data with "testKeyTrue" key
- QString trueKey = QString("testKeyTrue");
- QList<QVariant> value;
- value.append(1);
- value.append(2);
- value.append(3);
- mFakeSettingsModel->set(trueKey, value);
-
- // the false key should return the same values as before adding true key to test data
- err = mFeatureManager->isFeatureSupported(falseKey, isSupported);
- QVERIFY(!isSupported);
- QCOMPARE(err, CxeError::NotFound);
-
- // check that just added key can be found from test data and no error occurs
- err = mFeatureManager->isFeatureSupported(trueKey, isSupported);
+ // test with right key
+ key = CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS;
+ err = mFeatureManager->isFeatureSupported(key, isSupported);
QVERIFY(isSupported);
QCOMPARE(err, CxeError::None);
@@ -84,82 +82,30 @@
// test that configuredValues function returns a correct error code and not any values
// with any arbitrary key when there is no data set
-void UnitTestCxeFeatureManager::testConfiguredValuesEmptyData()
+void UnitTestCxeFeatureManager::testconfiguredValues()
{
- QString falseKey = QString("testKeyFalse");
QList<int> values;
CxeError::Id err;
+ QString key;
- // no data
- err = mFeatureManager->configuredValues(falseKey,values);
+ // case 1: test with invalid key
+ err = mFeatureManager->configuredValues(INVALID_KEY, values);
QCOMPARE(err, CxeError::NotFound);
QCOMPARE(values.count(), 0);
-
-}
-
-// test that configuredValues function returns a correct error code and not any values
-// with any arbitrary key when there is data set but not for false key
-void UnitTestCxeFeatureManager::testConfiguredValuesFalseKey()
-{
- QString falseKey = QString("testKeyFalse");
- QString trueKey = QString("testKeyTrue");
- QList<QVariant> value;
- value.append(1);
- value.append(2);
- value.append(3);
- mFakeSettingsModel->set(trueKey, value);
-
- CxeError::Id err;
- QList<int> values;
-
- // false key
- err = mFeatureManager->configuredValues(falseKey, values);
+
+ // case 2: test with empty key
+ err = mFeatureManager->configuredValues(EMPTY_KEY, values);
QCOMPARE(err, CxeError::NotFound);
- // as key is not found values list should be empty
QCOMPARE(values.count(), 0);
+
+ // case 3: test with right key
+ key = CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS;
+ err = mFeatureManager->configuredValues(key, values);
+ QCOMPARE(err, CxeError::None);
+ QVERIFY(values.count() > 0);
+
}
-// test data is set with the same key that is used for fetching configured values
-// Now error code should be None as the key should be found from the data
-// Also value count should match with the amount of set values
-void UnitTestCxeFeatureManager::testConfiguredValuesTrueKeyAndData()
-{
- QString trueKey = QString("testKeyTrue");
- QList<QVariant> value;
- // values added to key
- value.append(1);
- value.append(2);
- value.append(3);
- mFakeSettingsModel->set(trueKey, value);
-
- CxeError::Id err;
- QList<int> values;
-
- // true key
- err = mFeatureManager->configuredValues(trueKey, values);
- QCOMPARE(err, CxeError::None);
- QCOMPARE(values.count(), 3);
-}
-
-// Currently only integer type values can be fetched with configuredValues-function.
-// Test that proper error code is returned when data values are something else than integers
-void UnitTestCxeFeatureManager::testConfiguredValuesFalseData()
-{
- QString trueKey = QString("testKeyTrue");
- QList<QVariant> value;
- value.append(1);
- value.append(2);
- value.append(true); // add boolean value which is not supported
- mFakeSettingsModel->set(trueKey, value);
-
- CxeError::Id err;
- QList<int> values;
-
- // getting configured values should fail as boolean values are not supported
- err = mFeatureManager->configuredValues(trueKey, values);
- QCOMPARE(err, CxeError::NotSupported);
-
-}
// main() function non-GUI testing
QTEST_MAIN(UnitTestCxeFeatureManager);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.h Thu Jul 15 01:52:14 2010 +0300
@@ -34,11 +34,8 @@
void init();
void cleanup();
- void testSupportedKeys();
- void testConfiguredValuesEmptyData();
- void testConfiguredValuesFalseKey();
- void testConfiguredValuesTrueKeyAndData();
- void testConfiguredValuesFalseData();
+ void testIsFeatureSupported();
+ void testconfiguredValues();
private:
CxeFakeSettingsModel *mFakeSettingsModel;
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefeaturemanagerimp/unittest_cxefeaturemanagerimp.pro Thu Jul 15 01:52:14 2010 +0300
@@ -19,4 +19,5 @@
HEADERS *= unittest_cxefeaturemanagerimp.h \
cxefeaturemanagerimp.h \
cxefakesettingsmodel.h \
- cxeerror.h
+ cxeerror.h \
+ cxenamespace.h
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilenamegeneratorsymbian/unittest_cxefilenamegeneratorsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -20,6 +20,8 @@
LIBS *= -lplatformenv
LIBS *= -lsysutil
+LIBS *= -lefsrv
+LIBS *= -lcone
SOURCES *= unittest_cxefilenamegeneratorsymbian.cpp \
cxefakesettings.cpp \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -72,7 +72,7 @@
// Case 0: Checking if a file is saved with all valid parameters
const int index(2);
const int id(7);
- CxeImageDataItem *imageDataItem = new CxeFakeImageDataItem(index, QByteArray("unit test successful"), filename, id);
+ CxeImageDataItem *imageDataItem = new CxeFakeImageDataItem(index, QByteArray("unit test successful"), filename, id, false);
QSignalSpy imageItemStateSpy(imageDataItem, SIGNAL(imageSaved(CxeError::Id, const QString&, int)));
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxefilesavethreadsymbian/unittest_cxefilesavethreadsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -21,7 +21,8 @@
LIBS *= -lsysutil
LIBS *= -lplatformenv
-
+LIBS *= -lefsrv
+LIBS *= -lcone
SOURCES *= unittest_cxefilesavethreadsymbian.cpp \
thumbnailmanager_qt.cpp \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -22,9 +22,12 @@
#include "unittest_cxeharvestercontrolsymbian.h"
#include "cxeharvestercontrolsymbian.h"
#include "cxutils.h"
+#include "cxeerror.h"
UnitTestCxeHarvesterControlSymbian::UnitTestCxeHarvesterControlSymbian()
+ : mHarvesterControl(NULL)
{
+ qRegisterMetaType<CxeError::Id>("CxeError::Id");
}
@@ -49,35 +52,30 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QSignalSpy harvestCompleteSpy(mHarvesterControl, SIGNAL(fileHarvested(const QString&, int)));
+ QSignalSpy harvestCompleteSpy(mHarvesterControl, SIGNAL(fileHarvested(CxeError::Id, const QString&)));
QString filename;
+ QVariantList initModeArguments;
QVERIFY(harvestCompleteSpy.isValid());
// case 1: testing with wrong dummy file, we should get an error code with harvestcomplete
// since filename is invalid
mHarvesterControl->harvestFile(filename, 0, 0);
-
QCOMPARE( harvestCompleteSpy.count(), 1 );
- if (harvestCompleteSpy.count() > 0) {
- QList<QVariant> initModeArguments = harvestCompleteSpy.takeFirst();
- // we are only interested in error code in this case 1
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNotFound);
- }
-
+ initModeArguments = harvestCompleteSpy.takeFirst();
+ // we are only interested in error code in this case 1
+ QCOMPARE(initModeArguments.at(0).value<CxeError::Id>(), CxeError::NotFound);
// case 2: testing with real filename, harvesting should go fine, callback without errors
filename = QString("test.jpg");
mHarvesterControl->harvestFile(filename, 0, 0);
QCOMPARE( harvestCompleteSpy.count(), 1 );
- if (harvestCompleteSpy.count() > 0) {
- QList<QVariant> initModeArguments = harvestCompleteSpy.takeFirst();
- // we check both the filename, since in this case harvesting should go fine
- // and error returned is KErrNone.
- QCOMPARE(initModeArguments.at(1).toString(), filename);
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNone);
- }
+ initModeArguments = harvestCompleteSpy.takeFirst();
+ // we check both the filename, since in this case harvesting should go fine
+ // and error returned is KErrNone.
+ QCOMPARE(initModeArguments.at(0).value<CxeError::Id>(), CxeError::None);
+ QCOMPARE(initModeArguments.at(1).toString(), filename);
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeharvestercontrolsymbian/unittest_cxeharvestercontrolsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -22,7 +22,8 @@
cxeerrormappingsymbian.h \
cxeharvestercontrolsymbian.h \
harvesterclient.h \
- cxutils.h
+ cxutils.h \
+ cxeerror.h
SOURCES *= unittest_cxeharvestercontrolsymbian.cpp \
cxeerrormappingsymbian.cpp \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -19,8 +19,8 @@
#include "cxutils.h"
#include "cxefakesysutil.h"
-CxeImageDataItemUnit::CxeImageDataItemUnit(int index, QByteArray data, QString filename)
- : CxeImageDataItemSymbian(data, filename, index)
+CxeImageDataItemUnit::CxeImageDataItemUnit(int index, QByteArray data, QString filename, bool addLocation)
+ : CxeImageDataItemSymbian(data, filename, index, addLocation)
{
CX_DEBUG_IN_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/cxeimagedataitemunit.h Thu Jul 15 01:52:14 2010 +0300
@@ -36,7 +36,7 @@
Q_OBJECT
public:
- CxeImageDataItemUnit(int index, QByteArray data, QString filename);
+ CxeImageDataItemUnit(int index, QByteArray data, QString filename, bool addLocation);
virtual ~CxeImageDataItemUnit();
int checkDiskSpace(RFs* aFs,
TInt aBytesToWrite,
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -44,7 +44,7 @@
mPath = generateImageFileName(index);
QByteArray data = "1234";
- mImageDataItem = new CxeImageDataItemUnit(index, data, mPath);
+ mImageDataItem = new CxeImageDataItemUnit(index, data, mPath, false);
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SavePending);
CX_DEBUG_EXIT_FUNCTION();
@@ -96,7 +96,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
- mImageDataItem = new CxeImageDataItemUnit( index, data, path );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, path, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue == KErrArgument);
@@ -104,7 +104,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
QString filename = generateImageFileNameWithLetter(++index, "C");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
@@ -113,7 +113,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
filename = generateImageFileNameWithLetter(++index, "");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
@@ -122,7 +122,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
filename = generateImageFileNameWithLetter(++index, "12");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
@@ -131,7 +131,7 @@
delete mImageDataItem;
mImageDataItem = NULL;
filename = generateImageFileNameWithLetter(++index, "Edata");
- mImageDataItem = new CxeImageDataItemUnit( index, data, filename );
+ mImageDataItem = new CxeImageDataItemUnit( index, data, filename, false );
returnValue = mImageDataItem->save();
QVERIFY(mImageDataItem->state() == CxeImageDataItem::SaveFailed);
QVERIFY(returnValue != KErrNone);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataitemsymbian/unittest_cxeimagedataitemsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -22,7 +22,8 @@
LIBS *= -lsysutil
LIBS *= -lbitgdi
LIBS *= -lws32
-LIBS *= -lsysutil
+LIBS *= -lefsrv
+LIBS *= -lcone
LIBS *= -lecom
LIBS *= -lecampluginsupport
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/cxeimagedataqueueunit.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/cxeimagedataqueueunit.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -32,5 +32,5 @@
CxeImageDataItem *CxeImageDataQueueUnit::createDataItem( int index, const QByteArray& data, const QString& path ) const
{
static int id = 0;
- return new CxeFakeImageDataItem(index, data, path, id++);
+ return new CxeFakeImageDataItem(index, data, path, id++, false);
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -83,8 +83,8 @@
{
// Add some items
QByteArray data("test");
- mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0);
- mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1);
+ mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0, false);
+ mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1, false);
// Test that clearing works also with some content.
mImageDataQueue->clear();
@@ -97,8 +97,8 @@
void UnitTestCxeImageDataQueueSymbian::testOperatorAtIndex()
{
QByteArray data("test");
- CxeImageDataItemSymbian* itemIn1 = mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0);
- CxeImageDataItemSymbian* itemIn2 = mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1);
+ CxeImageDataItemSymbian* itemIn1 = mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0, false);
+ CxeImageDataItemSymbian* itemIn2 = mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1, false);
CxeImageDataItem& itemOut1 = (*mImageDataQueue)[0];
CxeImageDataItem& itemOut2 = (*mImageDataQueue)[1];
QVERIFY(itemIn1 == &itemOut1);
@@ -111,7 +111,7 @@
void UnitTestCxeImageDataQueueSymbian::testStartSave()
{
QByteArray data("test");
- CxeImageDataItemSymbian* itemIn = mImageDataQueue->startSave(data, "C:\\Images\\unittest.jpeg", 0);
+ CxeImageDataItemSymbian* itemIn = mImageDataQueue->startSave(data, "C:\\Images\\unittest.jpeg", 0, false);
QVERIFY(itemIn != NULL);
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeimagedataqueuesymbian/unittest_cxeimagedataqueuesymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,8 @@
LIBS *= -lsysutil
LIBS *= -lplatformenv
+LIBS *= -lefsrv
+LIBS *= -lcone
SOURCES *= unittest_cxeimagedataqueuesymbian.cpp \
cxeimagedataqueuesymbian.cpp \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/unittest_cxesettingscenrepstore.pro Thu Jul 15 01:52:14 2010 +0300
@@ -10,18 +10,25 @@
# Description:
+CONFIG *= cxeunit_no_system_paths
+
include(../unittest.pri)
TARGET = unittest_cxesettingscenrepstore
-LIBS *= -lxqsettingsmanager
+INCLUDEPATH *= ../system_include
+DEPENDPATH *= ../system_include
SOURCES *= unittest_cxesettingscenrepstore.cpp \
- cxesettingscenrepstore.cpp
+ cxesettingscenrepstore.cpp \
+ xqsettingsmanager.cpp \
+ xqsettingskey.cpp
HEADERS *= unittest_cxesettingscenrepstore.h \
cxutils.h \
cxeerror.h \
+ xqsettingskey.h \
+ xqsettingsmanager.h \
cxenamespace.h \
cxecenrepkeys.h \
cxesettingscenrepstore.h \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingskey.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/*!
+* XQSettingsKey class fake implementation
+*/
+
+#include <QVariant>
+#include <QList>
+#include <QMetaType>
+#include <QObject>
+
+#include "cxutils.h"
+#include "xqsettingskey.h"
+#include "cxenamespace.h"
+
+
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+long int XQSettingsKey::uid() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return mUid;
+}
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+unsigned long int XQSettingsKey::key() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return mKey;
+}
+
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+XQSettingsKey::Target XQSettingsKey::target() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CX_DEBUG_EXIT_FUNCTION();
+ return mTarget;
+}
+
+
+
+/*!
+* XQSettingsKey::XQSettingsKey
+*/
+XQSettingsKey::XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key)
+:mTarget(target),
+ mUid(uid),
+ mKey(key)
+{
+}
+
+
+
+/*!
+* XQSettingsKey::close
+*/
+XQSettingsKey::~XQSettingsKey()
+{
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingskey.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef XQSETTINGSKEY_H
+#define XQSETTINGSKEY_H
+
+// INCLUDES
+
+
+// CLASS DECLARATION
+class XQSettingsKey
+{
+public:
+ enum Target
+ {
+ TargetCentralRepository = 0,
+ TargetPublishAndSubscribe
+ };
+
+ XQSettingsKey(XQSettingsKey::Target target, long int uid, unsigned long int key);
+ ~XQSettingsKey();
+
+ XQSettingsKey::Target target() const;
+ long int uid() const;
+ unsigned long int key() const;
+
+protected:
+ XQSettingsKey::Target mTarget;
+ long int mUid;
+ unsigned long int mKey;
+};
+
+#endif //XQSETTINGSKEY_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingsmanager.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+/*!
+* XQSettingsManager class fake implementation
+*/
+
+#include <QVariant>
+#include <QList>
+#include <QMetaType>
+#include <QObject>
+
+#include "xqsettingsmanager.h"
+#include "xqsettingskey.h"
+#include "cxenamespace.h"
+#include "cxutils.h"
+
+
+
+
+/*!
+* write value to cenrep key
+*/
+bool XQSettingsManager::writeItemValue(const XQSettingsKey& key, const QVariant& value)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ mError = XQSettingsManager::NoError;
+ mStore[key.key()] = value;
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return true;
+}
+
+
+
+/*!
+* Reads the setting value for the given key from cenrep
+*/
+QVariant XQSettingsManager::readItemValue(const XQSettingsKey& settkey, XQSettingsManager::Type /*type*/)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mError = XQSettingsManager::NoError;
+ if(mStore.contains(settkey.key())) {
+ return mStore[settkey.key()];
+ }
+ return QVariant(1);
+}
+
+
+XQSettingsManager::Error XQSettingsManager::error() const
+{
+ return mError;
+}
+
+
+/*!
+* XQSettingsManager::XQSettingsManager
+*/
+XQSettingsManager::XQSettingsManager(QObject* /*parent*/)
+{
+}
+
+
+
+/*!
+* XQSettingsManager::close
+*/
+XQSettingsManager::~XQSettingsManager()
+{
+}
+
+
+/*! Instead of monitoring value changes for a P&S key
+* this fake class implementation emits valueChanged signal for the given key
+*/
+bool XQSettingsManager::startMonitoring(const XQSettingsKey& key, XQSettingsManager::Type type)
+{
+ emit valueChanged(key, type);
+ return true;
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscenrepstore/xqsettingsmanager.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+#ifndef XQSETTINGSMANAGER_H
+#define XQSETTINGSMANAGER_H
+
+// INCLUDES
+#include <QObject>
+#include <QVariant>
+#include "xqsettingskey.h"
+
+
+
+
+// CLASS DECLARATION
+class XQSettingsManager : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ enum Type
+ {
+ TypeVariant = 0,
+ TypeInt,
+ TypeDouble,
+ TypeString,
+ TypeByteArray
+ };
+
+ enum Error
+ {
+ NoError = 0,
+ OutOfMemoryError,
+ NotFoundError,
+ AlreadyExistsError,
+ PermissionDeniedError,
+ BadTypeError,
+ NotSupportedError,
+ UnknownError = -1
+ };
+
+ XQSettingsManager(QObject* parent = 0);
+ ~XQSettingsManager();
+
+ QVariant readItemValue(const XQSettingsKey& key, XQSettingsManager::Type type = XQSettingsManager::TypeVariant);
+ bool writeItemValue(const XQSettingsKey& key, const QVariant& value);
+ XQSettingsManager::Error error() const;
+ bool startMonitoring(const XQSettingsKey& key, XQSettingsManager::Type type = XQSettingsManager::TypeVariant);
+
+
+signals:
+ void valueChanged(const XQSettingsKey& key, const QVariant& value);
+
+private:
+ XQSettingsManager::Error mError;
+ QHash<unsigned long int, QVariant> mStore;
+
+};
+
+#endif // XQSETTINGSMANAGER_H
+
+// End of file
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscontrolsymbian/unittest_cxesettingscontrolsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingscontrolsymbian/unittest_cxesettingscontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -96,7 +96,7 @@
CxeScene videoScene;
- videoScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_AUTO);
+ videoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO);
videoScene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal);
videoScene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
videoScene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto);
@@ -109,7 +109,7 @@
CxeScene imageScene;
- imageScene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHT);
+ imageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT);
imageScene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto);
imageScene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic);
imageScene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsimp/unittest_cxesettingsimp.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -41,7 +41,6 @@
void UnitTestCxeSettingsImp::init()
{
mSettingsModel = new CxeFakeSettingsModel;
- mSettingsModel->initDefaultCameraSettings();
mSettingsImp = new CxeSettingsImp(*mSettingsModel);
}
@@ -164,43 +163,8 @@
err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE, stringValue);
QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_AUTO, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_AUTO, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_MACRO, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_MACRO, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_NIGHT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_PORTRAIT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_PORTRAIT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_SCENERY, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SCENERY, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_SPORTS, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SPORTS, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ CxeScene scene = mSettingsModel->currentImageScene();
+ QCOMPARE(stringValue, scene[CxeSettingIds::SCENE_ID].toString());
err = mSettingsImp->get(CxeSettingIds::LIGHT_SENSITIVITY, stringValue);
QCOMPARE(err, CxeError::None);
@@ -229,28 +193,8 @@
err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE, stringValue);
QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_AUTO, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_AUTO, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_NIGHT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
-
- err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, stringValue);
- QCOMPARE(err, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, testValue);
- QCOMPARE(stringValue, QString(testValue.toString()));
+ scene = mSettingsModel->currentVideoScene();
+ QCOMPARE(stringValue, scene[CxeSettingIds::SCENE_ID].toString());
err = mSettingsImp->get(CxeSettingIds::WHITE_BALANCE, stringValue);
QCOMPARE(err, CxeError::None);
@@ -392,7 +336,7 @@
mSettingsModel->getSettingValue(CxeSettingIds::FNAME_IMAGE_COUNTER, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::FNAME_MONTH_FOLDER, string);
+ error = mSettingsImp->set(CxeSettingIds::FNAME_MONTH_FOLDER, range);
QCOMPARE(error, CxeError::None);
mSettingsModel->getSettingValue(CxeSettingIds::FNAME_MONTH_FOLDER, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
@@ -417,41 +361,6 @@
mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_AUTO, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_AUTO, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_MACRO, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_MACRO, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_NIGHT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_PORTRAIT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_PORTRAIT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_SCENERY, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SCENERY, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_SPORTS, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SPORTS, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityAutomatic);
QCOMPARE(error, CxeError::None);
mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue);
@@ -507,26 +416,6 @@
mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, checkValue);
QCOMPARE(int(checkValue.toInt()), range);
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_AUTO, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_AUTO, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_NIGHT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
- error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, range);
- QCOMPARE(error, CxeError::None);
- mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, checkValue);
- QCOMPARE(int(checkValue.toInt()), range);
-
error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceAutomatic);
QCOMPARE(error, CxeError::None);
mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsmodelimp/unittest_cxesettingsmodelimp.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesettingsmodelimp/unittest_cxesettingsmodelimp.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -146,7 +146,7 @@
QCOMPARE(result.toInt(), 0);
// case 1: setting a value to a valid key
- error = mSettingsModel->set(CxeSettingIds::SHARPNESS, 100);
+ error = mSettingsModel->set(CxeSettingIds::SHARPNESS, QVariant(100));
QVERIFY(error == CxeError::None);
// case 2: testing if the value set is right to sharpness key
@@ -233,20 +233,23 @@
{
CxeScene result;
CxeError::Id error;
+
+ // do initialization
+ mSettingsModel->cameraModeChanged(Cxe::ImageMode);
+
// case 1: check the default image scene sharpness value
result = mSettingsModel->currentImageScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == CxeSettingIds::IMAGE_SCENE_AUTO);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == Cxe::IMAGE_SCENE_AUTO);
QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessNormal);
- QString key = CxeSettingIds::IMAGE_SCENE_PORTRAIT;
-
// case 2: trying to set a new image scene
- error = mSettingsModel->setImageScene(key);
+ QString sceneId = Cxe::IMAGE_SCENE_PORTRAIT;
+ error = mSettingsModel->setImageScene(sceneId);
QVERIFY(error == CxeError::None);
// case 3: testing if NIGHT image scene is set correctly. checking its sharpness value
result = mSettingsModel->currentImageScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == key);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == sceneId);
QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessSoft);
// case 3: trying to set a image scene with invalid value
@@ -268,20 +271,23 @@
{
CxeScene result;
CxeError::Id error;
+
+ // do initialization
+ mSettingsModel->cameraModeChanged(Cxe::VideoMode);
+
// case 1: check the default image scene
result = mSettingsModel->currentVideoScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == CxeSettingIds::VIDEO_SCENE_AUTO);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == Cxe::VIDEO_SCENE_AUTO);
QVERIFY(result[CxeSettingIds::FRAME_RATE] == 0);
- QString key = CxeSettingIds::VIDEO_SCENE_LOWLIGHT;
-
// case 2: trying to set a new image scene
- error = mSettingsModel->setVideoScene(key);
+ QString sceneId = Cxe::VIDEO_SCENE_LOWLIGHT;
+ error = mSettingsModel->setVideoScene(sceneId);
QVERIFY(error == CxeError::None);
// case 3: testing if NIGHT image scene is set correctly
result = mSettingsModel->currentVideoScene();
- QVERIFY(result[CxeSettingIds::SCENE_ID] == key);
+ QVERIFY(result[CxeSettingIds::SCENE_ID] == sceneId);
QVERIFY(result[CxeSettingIds::FRAME_RATE] == 15);
// case 3: trying to set a image scene with invalid value
@@ -296,5 +302,4 @@
// main() function non-GUI testing
-QTEST_APPLESS_MAIN(UnitTestCxeSettingsModelImp)
-;
+QTEST_APPLESS_MAIN(UnitTestCxeSettingsModelImp);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxesnapshotcontrol/unittest_cxesnapshotcontrol.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -82,31 +82,26 @@
QSize snapshotSize;
QSize displaySize;
- QSize captureResolution;
// 16:9 display, 4:3 capture format
displaySize = QSize(1600, 900);
- captureResolution = QSize(400, 300);
- snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, captureResolution);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio4to3);
QVERIFY(snapshotSize == QSize(1200, 900));
// 16:9 display, 16:9 capture format
displaySize = QSize(640, 360);
- captureResolution = QSize(4000, 2248);
- snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, captureResolution);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio16to9);
QVERIFY(snapshotSize == QSize(640, 360));
// 4:3 display, 16:9 capture format
displaySize = QSize(640, 480);
- captureResolution = QSize(4000, 2248);
- snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, captureResolution);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio16to9);
QVERIFY(snapshotSize == QSize(640, 360));
// 4:3 display, 4:3 capture format
displaySize = QSize(640, 480);
- captureResolution = QSize(2048, 1536);
- snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, captureResolution);
+ snapshotSize = mSnapshotControl->calculateSnapshotSize(displaySize, Cxe::AspectRatio4to3);
QVERIFY(snapshotSize == QSize(640, 480));
CX_DEBUG_EXIT_FUNCTION();
@@ -142,7 +137,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QSignalSpy spySnapshotReady(mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&)));
+ QSignalSpy spySnapshotReady(mSnapshotControl, SIGNAL(snapshotReady(CxeError::Id, const QImage&)));
// Snapshot not started, camera events should not effect in any way.
mSnapshotControl->handleCameraEvent(KUidECamEventSnapshotUidValue, KErrNone);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillcapturecontrolsymbian/unittest_cxestillcapturecontrolsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -30,6 +30,8 @@
LIBS *= -lsensrvclient
LIBS *= -lsensrvutil
LIBS *= -lplatformenv
+LIBS *= -lefsrv
+LIBS *= -lcone
DEFINES *= CXE_USE_DUMMY_CAMERA
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -118,7 +118,7 @@
QVERIFY(!mCxeStillImageSymbian->dataItem());
QByteArray data("124343423423456e74576");
QString path = "\\Images\\Camera\\blaah.jpg";
- CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, mCxeStillImageSymbian->id());
+ CxeImageDataItemSymbian* dataItem = new CxeImageDataItemSymbian(data, path, mCxeStillImageSymbian->id(), false);
mCxeStillImageSymbian->setDataItem(dataItem);
QVERIFY(mCxeStillImageSymbian->dataItem() == dataItem);
CX_DEBUG_EXIT_FUNCTION();
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestillimagesymbian/unittest_cxestillimagesymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,7 @@
LIBS *= -lplatformenv
LIBS *= -lsysutil
+LIBS *= -lefsrv
SOURCES *= unittest_cxestillimagesymbian.cpp \
cxeimagedataitemsymbian.cpp \
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxethumbnailmanagersymbian/unittest_cxethumbnailmanagersymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -48,33 +48,17 @@
{
CX_DEBUG_ENTER_FUNCTION();
- QSignalSpy thumbnailReadySpy(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, int)));
QString filename;
- QVERIFY(thumbnailReadySpy.isValid());
-
// case 1: testing with wrong dummy file, we should get an error code with thumbnailready
// since filename is invalid
- mThumbnailManager->createThumbnail(filename, QPixmap());
-
- QCOMPARE(thumbnailReadySpy.count(), 1 );
- if (thumbnailReadySpy.count() > 0) {
- QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst();
- // we are only interested in error code in this case 1
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNotFound);
- }
+ mThumbnailManager->createThumbnail(filename, QImage());
+
// case 1: testing with proper file name, we shouldnt get an error code with thumbnailready
// since filename is valid
filename = QString("c:\\test.jpg");
- mThumbnailManager->createThumbnail(filename, QPixmap());
-
- QCOMPARE( thumbnailReadySpy.count(), 1 );
- if (thumbnailReadySpy.count() > 0) {
- QList<QVariant> initModeArguments = thumbnailReadySpy.takeFirst();
- // we are only interested in error code in this case 1
- QCOMPARE(initModeArguments.at(1).toInt(), KErrNone);
- }
+ mThumbnailManager->createThumbnail(filename, QImage());
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -238,9 +238,9 @@
void UnitTestCxeVideoCaptureControlSymbian::testHandleSnapshotReady()
{
CX_DEBUG_ENTER_FUNCTION();
- QPixmap snapshot;
+ QImage snapshot;
- QSignalSpy spy(mCxeVideoCaptureControlSymbian, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)));
+ QSignalSpy spy(mCxeVideoCaptureControlSymbian, SIGNAL(snapshotReady(CxeError::Id, const QImage&, const QString&)));
mCxeVideoCaptureControlSymbian->deinit();
doPrepareStuff();
mCxeVideoCaptureControlSymbian->handleSnapshotReady(CxeError::OutOfMemory, snapshot);
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxevideocapturecontrolsymbian/unittest_cxevideocapturecontrolsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -25,7 +25,8 @@
LIBS *= -lmmfcontrollerframework
LIBS *= -lplatformenv
LIBS *= -lsysutil
-
+LIBS *= -lefsrv
+LIBS *= -lcone
DEFINES *= CXE_USE_DUMMY_CAMERA
--- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeviewfindercontrolsymbian/unittest_cxeviewfindercontrolsymbian.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeviewfindercontrolsymbian/unittest_cxeviewfindercontrolsymbian.pro Thu Jul 15 01:52:14 2010 +0300
@@ -1,4 +1,4 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
@@ -21,8 +21,8 @@
LIBS *= -lfbscli
LIBS *= -lbitgdi
LIBS *= -lcone
-LIBS *= -lalfclient
-LIBS *= -lalfdecoderserverclient
+LIBS *= -lws32
+LIBS *= -lgdi
DEFINES *= CXE_USE_DUMMY_CAMERA
--- a/camerauis/cameraxui/cxui/cxui.pro Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.pro Thu Jul 15 01:52:14 2010 +0300
@@ -60,7 +60,8 @@
-lws32 \
-lgdi \
-lapgrfx \
- -lusbman
+ -lusbman \
+ -lthumbnailmanagerqt
CONFIG += hb
CONFIG += service
@@ -74,6 +75,7 @@
HEADERS += cxuiapplication.h \
cxuiapplicationframeworkmonitor.h \
cxuiapplicationframeworkmonitorprivate.h \
+ cxuiapplicationstate.h \
cxuiview.h \
cxuiprecaptureview.h \
cxuistillprecaptureview.h \
@@ -90,13 +92,13 @@
cxuisettingradiobuttonlist.h \
cxuiscenelabel.h \
cxuierrormanager.h \
- cxuistandby.h \
cxuisettingradiobuttonlistmodel.h \
cxuisettingsinfo.h \
cxuisettingxmlreader.h \
cxuiserviceprovider.h \
cxuiscenemodeview.h \
cxuizoomslider.h \
+ cxuifullscreenpopup.h \
cxuieventlog.h \
traces/OstTraceDefinitions.h
@@ -104,6 +106,7 @@
cxuiapplication.cpp \
cxuiapplicationframeworkmonitor.cpp \
cxuiapplicationframeworkmonitorprivate.cpp \
+ cxuiapplicationstate.cpp \
cxuiview.cpp \
cxuiprecaptureview.cpp \
cxuivideoprecaptureview.cpp \
@@ -119,13 +122,13 @@
cxuisettingradiobuttonlist.cpp \
cxuiscenelabel.cpp \
cxuierrormanager.cpp \
- cxuistandby.cpp \
cxuisettingradiobuttonlistmodel.cpp \
cxuisettingsinfo.cpp \
cxuisettingxmlreader.cpp \
cxuiserviceprovider.cpp \
cxuiscenemodeview.cpp \
cxuizoomslider.cpp \
+ cxuifullscreenpopup.cpp \
cxuieventlog.cpp
RESOURCES += cxui.qrc
--- a/camerauis/cameraxui/cxui/cxui.qrc Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/cxui.qrc Thu Jul 15 01:52:14 2010 +0300
@@ -4,13 +4,13 @@
</qresource>
<qresource prefix="/xml" >
<file alias="setting_scenemode.docml" >layouts/setting_scenemode.docml</file>
- <file alias="standbymode_popup.docml" >layouts/standbymode_popup.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="image_setting.xml" >layouts/image_setting.xml</file>
<file alias="video_setting.xml" >layouts/video_setting.xml</file>
</qresource>
--- a/camerauis/cameraxui/cxui/inc/cxuiapplication.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplication.h Thu Jul 15 01:52:14 2010 +0300
@@ -35,6 +35,11 @@
#endif // Q_WS_S60
signals:
+ /*!
+ * Testing framework support.
+ * Application ready signal is emitted after startup when UI is fully loaded and functional.
+ */
+ void applicationReady();
#if defined(Q_WS_S60)
void symbianEvent(const QSymbianEvent *e);
#endif // Q_WS_S60
--- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Thu Jul 15 01:52:14 2010 +0300
@@ -21,6 +21,7 @@
#include <QVariant>
#include "cxuiapplicationframeworkmonitor.h"
+
class CxeSettings;
class CxuiApplication;
#ifdef Q_OS_SYMBIAN
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXUIAPPLICATIONSTATE_H
+#define CXUIAPPLICATIONSTATE_H
+
+#include <QObject>
+#include "cxeerror.h"
+#include "cxuiapplicationframeworkmonitor.h"
+
+class CxuiApplication;
+class CxuiCaptureKeyHandler;
+class CxeSettings;
+class CxuiDocumentLoader;
+class CxuiErrorManager;
+class CxuiEventLog;
+
+
+/*!
+* @brief Class maintaining application overall state.
+*/
+class CxuiApplicationState : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(State)
+
+public:
+
+ enum State {
+ Normal,
+ Standby,
+ Error,
+ Background
+ };
+
+ CxuiApplicationState(CxuiApplication &application,
+ CxeSettings &settings,
+ CxuiCaptureKeyHandler &keyHandler,
+ CxuiDocumentLoader *documentLoader);
+ ~CxuiApplicationState();
+
+
+public:
+ State currentState() const;
+
+signals:
+ void stateChanged(CxuiApplicationState::State newState,
+ CxuiApplicationState::State oldState);
+
+public slots:
+ void startMonitoring();
+ void handleApplicationError(CxeError::Id error);
+ void enterStandby();
+ void exitStandby();
+
+private slots:
+ void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
+ void handleUsbMassMemoryModeChanged(bool active);
+ void handleBatteryEmpty();
+ void handleSevereError();
+ void handleErrorCleared();
+
+private:
+ void setState(State newState);
+ void checkErrors();
+
+private:
+ State mState;
+ CxuiApplicationFrameworkMonitor *mApplicationMonitor;
+ CxuiErrorManager *mErrorManager;
+ CxuiEventLog *mEventLog;
+};
+
+#endif // CXUIAPPLICATIONSTATE_H
--- a/camerauis/cameraxui/cxui/inc/cxuienums.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuienums.h Thu Jul 15 01:52:14 2010 +0300
@@ -48,10 +48,12 @@
static const char *SCENEMODE_SETTING_XML = ":/xml/setting_scenemode.docml";
- static const char *STANDBY_POPUP_XML = ":/xml/standbymode_popup.docml";
static const char *ERROR_POPUP_XML = ":/xml/errornote_popup.docml";
static const char *SETTINGS_SLIDER_DIALOG_XML = ":/xml/setting_slider.docml";
+ static const char *FULL_SCREEN_POPUP_XML = ":/xml/full_screen_popup.docml";
+
+
// Graphics
static const char *TRANSPARENT_BACKGROUND_GRAPHIC = "qtg_fr_popup_trans";
@@ -86,6 +88,7 @@
static const char *STILL_PRE_CAPTURE_POST_CAPTURE_ACTION = "cxui_action_stillpostcapture";
static const char *STILL_PRE_CAPTURE_INDICATOR_CONTAINER = "indicatorContainer";
static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER = "images_left_container";
+ static const char *STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON = "still_geotagging_indicator";
static const char *STILL_PRE_CAPTURE_SELFTIMER_CONTAINER = "still_precapture_selftimer_container";
static const char *STILL_PRE_CAPTURE_SELFTIMER_COUNTER = "still_selftimer_counter";
@@ -101,7 +104,6 @@
static const char *VIDEO_PRE_CAPTURE_TOOLBAR = "video_toolbar";
static const char *VIDEO_PRE_CAPTURE_TOOLBAR_REC = "video_toolbar_recording";
static const char *VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED = "video_toolbar_paused";
- static const char *VIDEO_PRE_CAPTURE_FLASH_ACTION = "cxui_video_action_light";
static const char *VIDEO_PRE_CAPTURE_VIEWFINDER = "video_viewfinder_widget";
static const char *VIDEO_PRE_CAPTURE_ZOOM_SLIDER = "video_zoom";
static const char *VIDEO_PRE_CAPTURE_RECORDING_ICON = "video_recording_icon";
@@ -116,11 +118,17 @@
static const char *VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION = "cxui_video_action_scene";
static const char *VIDEO_PRE_CAPTURE_QUALITY_ICON = "video_quality_indicator";
+ static const char *VIDEO_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON = "video_geotagging_indicator";
// standby
static const char *STANDBY_POPUP = "standbymode_popup";
static const char *STANDBY_TEXT_WIDGET = "standby_text";
+ // Full screen popup
+ static const char *FULL_SCREEN_POPUP = "full_screen_popup";
+ static const char *FULL_SCREEN_POPUP_TEXT = "full_screen_popup_text";
+ static const char *FULL_SCREEN_POPUP_BUTTON = "full_screen_popup_button";
+
// error manager
static const char *ERROR_POPUP = "errornote_popup";
static const char *ERROR_TEXT_WIDGET = "errornote_text";
@@ -163,6 +171,15 @@
static const char *PROPERTY_KEY_TRUE = "1";
}
+namespace CxuiActivityIds
+{
+ static const QString STILL_PRECAPTURE_ACTIVITY = "CameraViewfinderShow";
+ static const QString STILL_POSTCAPTURE_ACTIVITY = "CameraPostCaptureShow";
+
+ static const QString VIDEO_PRECAPTURE_ACTIVITY = "CamcorderViewfinderShow";
+ static const QString VIDEO_POSTCAPTURE_ACTIVITY = "CamcorderPostCaptureShow";
+}
+
Q_DECLARE_METATYPE(CxUi::CameraView)
#endif // CXUIENUMS_H
--- a/camerauis/cameraxui/cxui/inc/cxuierrormanager.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuierrormanager.h Thu Jul 15 01:52:14 2010 +0300
@@ -23,7 +23,6 @@
class HbAction;
class HbDialog;
class CxuiDocumentLoader;
-class CxuiCaptureKeyHandler;
/*
@@ -35,18 +34,18 @@
public:
- CxuiErrorManager(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader);
+ CxuiErrorManager(CxuiDocumentLoader *documentLoader);
~CxuiErrorManager();
signals:
- void aboutToRecoverError();
- void errorRecovered();
+ void errorPopupShown();
+ void errorPopupClosed();
public slots:
- void showPopup(CxeError::Id error);
- void hidePopup(CxeError::Id error);
+ void check(CxeError::Id error);
+ void clear();
private slots:
void popupClosed(HbAction *action);
@@ -58,20 +57,18 @@
enum ErrorSeverity
{
None = 0,
- Warning, // Low severity, just warning user needed
- Severe, // when error cannot be recovered
- Critical // when error can be recovered, but needs actions e.g. camera in use
+ Warning,
+ Error
};
void launchPopup(const QString &errorText, const QString &buttonText);
- void showHighSeverityNote(const QString &errorText, const QString &buttonText);
- void showLowSeverityNote(const QString &errorText);
+ void showErrorPopup(const QString &errorText, const QString &buttonText);
+ void showWarningPopup(const QString &errorText);
void getErrorDetails(QString &errorText, QString &buttonText);
private:
//data
- CxuiCaptureKeyHandler &mKeyHandler;
CxuiDocumentLoader *mDocumentLoader; // not own
HbDialog* mErrorMsgPopup;
CxeError::Id mErrorId;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/inc/cxuifullscreenpopup.h Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef CXUFULLSCREENPOPUP_H
+#define CXUFULLSCREENPOPUP_H
+
+
+#include <HbWidget>
+#include <HbDocumentLoader>
+
+class QString;
+class QGraphicsScene;
+
+/*!
+* Class for showing simple full screen popups.
+*/
+class CxuiFullScreenPopup : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ static CxuiFullScreenPopup *create(QGraphicsScene *scene,
+ const QString &message,
+ const QString &action = QString());
+ ~CxuiFullScreenPopup();
+
+ void handleMousePress();
+ void handleMouseRelease();
+
+public slots:
+ void show();
+ void hide();
+
+private:
+ qreal topZValue() const;
+ void setScene(QGraphicsScene *scene);
+
+private:
+ CxuiFullScreenPopup();
+
+ /*!
+ * Internal custom DocML loader.
+ */
+ class CxuiFullScreenPopupLoader : public HbDocumentLoader
+ {
+ public:
+ CxuiFullScreenPopupLoader();
+ QObject *createObject(const QString& type, const QString &name);
+ };
+
+private:
+ QGraphicsScene *mScene;
+ bool mPopupShown;
+
+ Q_DISABLE_COPY(CxuiFullScreenPopup)
+};
+
+#endif // CXUFULLSCREENPOPUP_H
--- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:52:14 2010 +0300
@@ -31,7 +31,7 @@
class CxeEngine;
class CxuiDocumentLoader;
-
+class ThumbnailManager;
/**
* Post-capture view
@@ -43,14 +43,22 @@
public:
CxuiPostcaptureView(QGraphicsItem *parent = 0);
virtual ~CxuiPostcaptureView();
- void construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader);
+ void construct(HbMainWindow *mainwindow, CxeEngine *engine,
+ CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
+ void restoreActivity(const QString &activityId, const QVariant &data);
+ void saveActivity();
+ void clearActivity();
+
signals:
void changeToPrecaptureView();
public slots:
+ void enterStandby();
+ void exitStandby();
void handleCaptureKeyPressed();
void handleAutofocusKeyPressed();
@@ -85,8 +93,7 @@
void startReleaseTimers();
private slots:
- void handleFocusGained();
- void handleFocusLost();
+ void handleThumbnailReady(QPixmap thumbnail, void *clientData, int id, int errorCode);
private: // data
HbToolBar *mStillToolbar;
@@ -125,6 +132,9 @@
bool mDeleteNoteOpen;
+ QString mFilename;
+
+ ThumbnailManager *mThumbnailManager;
};
#endif // CXUIPOSTCAPTUREVIEW_H
--- a/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Thu Jul 15 01:52:14 2010 +0300
@@ -25,6 +25,7 @@
#include <hbframedrawer.h>
#include "cxezoomcontrol.h"
+#include "cxegeotaggingtrail.h"
#include "cxeviewfindercontrol.h"
#include "cxuidisplaypropertyhandler.h"
#include "cxuiview.h"
@@ -47,6 +48,8 @@
class HbToolBarExtension;
class HbWidget;
class CxuiZoomSlider;
+class CxuiFullScreenPopup;
+
/**
* Pre-capture view
@@ -62,68 +65,26 @@
public:
- virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
+ virtual void construct(HbMainWindow *mainWindow,
+ CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler);
-
- /**
- * Loads widgets that are not part of the default section in layouts xml.
- * Widgets are created at the time they are first loaded.
- */
- virtual void loadWidgets() = 0;
- void prepareWindow();
-
-public slots:
-
- void initCamera();
- void requestCameraSwitch();
-
- // whenever a setting is changed on the engine side, an icon might need updating
- // connects to the settingValueChanged signal of CxeSettings
- virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
-
-protected slots:
-
- // Key events
- virtual void handleAutofocusKeyPressed();
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
- // Camera / Engine
- void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error);
- void handleZoomLevelChange(int);
- void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error);
- virtual void handleFocusGained();
- virtual void handleFocusLost() = 0;
- // UI: Zoom slider change notification
- void zoomTo(int value);
-
- void disableControlsTimeout();
-
- void toggleZoom();
-
- // Settings related
- void launchDiskFullNotification();
- void showSettingsGrid();
- void hideSettingsGrid();
- void launchSliderSetting();
- void prepareToShowDialog(HbAction *action);
- void prepareToCloseDialog(HbAction *action);
-
-protected:
- void toggleControls();
- virtual void initializeSettingsGrid() = 0;
- void showEvent(QShowEvent *event);
- void hideEvent(QHideEvent *event);
- bool eventFilter(QObject *object, QEvent *event);
- void launchSettingsDialog(QObject *action);
- bool isPostcaptureOn() const;
- void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
- QString getSettingItemIcon(const QString &key, QVariant value);
- void updateQualityIcon();
- void updateSceneIcon(const QString& sceneId);
-
+ virtual bool isStandbyModeSupported() const;
+ /**
+ * Loads widgets that are not part of the default section in layouts xml.
+ * Widgets are created at the time they are first loaded.
+ */
+ virtual void loadWidgets() = 0;
signals:
+ /*!
+ * Signal that view is ready to be used.
+ */
+ void viewReady();
+
// signals to switch to post/pre-capture view.
void changeToPostcaptureView();
void changeToPrecaptureView();
@@ -136,7 +97,67 @@
void stopStandbyTimer();
// signal to report error to ErrorManager for further actions.
- void reportError(CxeError::Id errorId);
+ void errorEncountered(CxeError::Id id);
+
+public slots:
+
+ void initCamera();
+ void requestCameraSwitch();
+
+ // whenever a setting is changed on the engine side, an icon might need updating
+ // connects to the settingValueChanged signal of CxeSettings
+ virtual void handleSettingValueChanged(const QString& key, QVariant newValue);
+
+ // From CxuiView
+ virtual void enterStandby();
+ virtual void exitStandby();
+
+protected slots:
+
+ // Key events
+ virtual void handleAutofocusKeyPressed();
+
+ // Camera / Engine
+ void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error);
+ void handleZoomLevelChange(int);
+ void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error);
+ // UI: Zoom slider change notification
+ void zoomTo(int value);
+
+ void disableControlsTimeout();
+
+ void toggleZoom();
+
+ // Settings related
+ void showSettingsGrid();
+ void hideSettingsGrid();
+ void launchSliderSetting();
+ void prepareToShowDialog(HbAction *action);
+ void prepareToCloseDialog(HbAction *action);
+ void updateLocationIndicator(CxeGeoTaggingTrail::State newState, CxeError::Id error);
+
+private slots:
+ void disableGeotaggingDisclaimer();
+ void launchGeoTaggingSetting();
+
+protected:
+ void toggleControls();
+ virtual void initializeSettingsGrid() = 0;
+ void showEvent(QShowEvent *event);
+ void hideEvent(QHideEvent *event);
+ bool eventFilter(QObject *object, QEvent *event);
+ void launchSettingsDialog(QObject *action);
+ virtual bool isPostcaptureOn() const = 0;
+ void addIncreaseDecreaseButtons(CxuiZoomSlider *slider);
+ QString getSettingItemIcon(const QString &key, QVariant value);
+ virtual void updateQualityIcon() = 0;
+ virtual void updateSceneIcon(const QString& sceneId) = 0;
+ void launchGeoTaggingDisclaimerDialog();
+
+private:
+ CxuiSettingDialog* createSettingsDialog();
+ CxuiSettingDialog* createSliderSettingsDialog();
+ QPointF getDialogPosition();
protected:
HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene
@@ -146,13 +167,11 @@
CxuiSettingDialog *mSettingsDialog;
CxuiSettingRadioButtonList *mSettingsDialogList;
HbLabel *mQualityIcon;
+ HbLabel *mGeoTaggingIndicatorIcon;
HbLabel *mFaceTrackingIcon;
+ CxuiFullScreenPopup *mStandbyPopup;
private:
- CxuiSettingDialog* createSettingsDialog();
- CxuiSettingDialog* createSliderSettingsDialog();
- QPointF getDialogPosition();
-private:
HbLabel *mSettingsDialogHeading;
CxuiSettingDialog *mSliderSettingsDialog;
--- a/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Thu Jul 15 01:52:14 2010 +0300
@@ -60,11 +60,12 @@
void construct(HbMainWindow *mainwindow,
CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler = NULL);
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
void loadDefaultWidgets();
void loadBackgroundImages();
-
+ void saveActivity();
signals:
void viewCloseEvent();
@@ -81,6 +82,7 @@
protected:
void showEvent(QShowEvent *event);
bool allowShowControls() const;
+ bool isFeedbackEnabled() const;
private:
QString backgroundForScene(const QString& sceneId);
--- a/camerauis/cameraxui/cxui/inc/cxuiselftimer.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiselftimer.h Thu Jul 15 01:52:14 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 <QObject>
#include <QTimer>
#include <QSound>
+#include <QVariant>
class CxeSettings;
class CxuiDocumentLoader;
@@ -49,6 +50,7 @@
void startTimer();
void reset(bool update = true);
void cancel();
+ void enableSound(long int uid, unsigned long int key, QVariant value);
protected slots:
void timeout();
@@ -77,6 +79,7 @@
CxeSettings &mSettings;
QSound mSound;
+ bool mUseSound;
};
#endif // CXUISELFTIMER_H
--- a/camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h Thu Jul 15 01:52:14 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"
@@ -55,9 +55,6 @@
protected slots:
void handleItemSelected(int index);
-protected:
- virtual void initOriginalSelectedItem();
-
private:
// helper methods
void setSettingId(const QString &id);
--- a/camerauis/cameraxui/cxui/inc/cxuistandby.h Thu Jul 15 01:49:11 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#ifndef CXUISTANDBY_H
-#define CXUISTANDBY_H
-
-#include <QObject>
-
-// constants
-
-const int CXUI_STANDBY_CAMERA_TIMEOUT = 60000; // 60 seconds
-
-// forward declaration
-class HbDialog;
-class QTimer;
-class CxeEngine;
-class CxuiDocumentLoader;
-class CxuiCaptureKeyHandler;
-
-
-/*
-* class CxuiStandby continuously monitors for releasing camera when there are no user actions
-* for a specific time period. Timer is used to release the camera HW and switching to stanby mode
-* after a delay.Releasing the camera improves power efficiency, but creates additional latency
-* when returning to pre-capture view.
-*/
-class CxuiStandby : public QObject
-{
- Q_OBJECT
-
-public:
- CxuiStandby(CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader, CxeEngine *engine);
- ~CxuiStandby();
-
-public:
- void allowDismiss(bool allow);
- bool isActive() const;
-
-signals:
-
- /*
- * signal to prepare for standby
- */
- void aboutToEnterStandby();
-
- /*
- * signal to prepare UI for exiting standby
- */
- void aboutToExitStandby();
-
-public slots:
- void startTimer();
- void stopTimer();
- bool handleMouseEvent(QEvent *event);
- void enterStandby();
- void exitStandby();
-
-private slots:
-
- void dismissStandby();
-
-private: // helper methods
-
- bool proceedToStandy();
- bool eventFilter(QObject *object, QEvent *event);
-
-private:
-
- CxuiCaptureKeyHandler &mKeyHandler;
- CxuiDocumentLoader *mDocumentLoader; // not own
- CxeEngine *mEngine; // not own
- HbDialog *mStandbyPopup;
- QTimer *mStandbyTimer;
- bool mStandbyDialogVisible;
- bool mAllowDismiss;
-};
-
-#endif // CXUISTANDBY_H
--- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:52:14 2010 +0300
@@ -37,11 +37,10 @@
class CxuiSelfTimerRadioButtonList;
class HbToolBarExtension;
class HbWidget;
+
/**
* Pre-capture view for still image mode
*/
-
-
class CxuiStillPrecaptureView : public CxuiPrecaptureView
{
Q_OBJECT
@@ -53,28 +52,18 @@
public:
- /**
- * Construct-method handles initialisation tasks for this class. Needs to be called
- * before the instance of this class is used.
- * @param mainwindow
- * @param engine
- * @param documentLoader
- * @param keyHandler
- */
- virtual void construct(HbMainWindow *mainwindow, CxeEngine *engine,
- CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler = NULL);
+ virtual void construct(HbMainWindow *mainwindow,
+ CxeEngine *engine,
+ CxuiDocumentLoader *documentLoader,
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
- /**
- * Loads default widgets in layouts xml.
- */
virtual void loadDefaultWidgets();
-
- /**
- * Loads widgets that are not part of the default section in layouts xml.
- * Widgets are created at the time they are first loaded.
- */
virtual void loadWidgets();
+ void restoreActivity(const QString &activityId, const QVariant &data);
+ void saveActivity();
+ void clearActivity();
protected:
void showEvent(QShowEvent *event);
@@ -89,13 +78,15 @@
// connects to the sceneChanged signal of CxeSettings
void handleSceneChanged(CxeScene &scene);
+ // From CxuiPrecaptureView
+ virtual void enterStandby();
+
protected slots:
void focusAndCapture();
void capture();
void setCapturePending();
void goToVideo();
-
// Key events
void handleCaptureKeyPressed();
void handleAutofocusKeyPressed();
@@ -107,23 +98,16 @@
void handleStillCaptureStateChanged(CxeStillCaptureControl::State newState, CxeError::Id error);
void handleSnapshot(CxeError::Id error);
- /**
- * Signal used to reset mCapturePending after a short timeout. If the image
- * cannot be captured within a given time of the key press, it is better to cancel
- * the whole operation.
- */
void resetCapturePendingFlag();
- /**
- * Application focus slots are called if focus state is changed.
- * Camera is released or reserved according to new state.
- */
- void handleFocusLost();
void launchSetting();
void updateImagesLeftLabel();
protected:
void initializeSettingsGrid();
+ bool isPostcaptureOn() const;
+ void updateSceneIcon(const QString& sceneId);
+ void updateQualityIcon();
void closeDialogs();
void updateFaceTrackingIcon();
--- a/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:52:14 2010 +0300
@@ -54,7 +54,8 @@
*/
void construct(HbMainWindow *mainwindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler = NULL);
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager);
/**
* Loads widgets that are needed right from the start.
@@ -67,6 +68,10 @@
*/
virtual void loadWidgets();
+ void restoreActivity(const QString &activityId, const QVariant &data);
+ void saveActivity();
+ void clearActivity();
+
public slots:
// from CxuiPrecaptureView
@@ -86,22 +91,8 @@
void handleVideoStateChanged(CxeVideoCaptureControl::State newState, CxeError::Id error);
void handleCaptureKeyPressed();
void prepareNewVideo(CxeError::Id error = CxeError::None);
- void toggleLight();
void launchVideoScenePopup();
void launchSetting();
-
- /**
- * Application focus slots are called if focus state is changed.
- * Recording is stopped and camera released or reserved according to new state.
- */
- void handleFocusLost();
-
- /**
- * Battery almost empty warning signal.
- * Need to stop ongoing recording.
- */
- void handleBatteryEmpty();
-
void updateTimeLabels();
// from CxuiPrecaptureView
@@ -112,12 +103,16 @@
void setVideoTime(HbLabel* label, int time);
bool getElapsedTime();
void getRemainingTime();
- virtual bool allowShowControls() const;
- virtual void showToolbar();
+ bool allowShowControls() const;
+ bool isFeedbackEnabled() const;
+ void showToolbar();
void disableFeedback();
void enableFeedback();
void initializeSettingsGrid();
+ bool isPostcaptureOn() const;
+ void updateSceneIcon(const QString& sceneId);
+ void updateQualityIcon();
void setRecordingItemsVisibility(bool visible);
// from QObject
--- a/camerauis/cameraxui/cxui/inc/cxuiview.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiview.h Thu Jul 15 01:52:14 2010 +0300
@@ -31,6 +31,7 @@
class CxuiCaptureKeyHandler;
class CxeEngine;
class HbWidget;
+class HbActivityManager;
// CONSTANTS
const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds
@@ -47,16 +48,22 @@
CxuiView(QGraphicsItem *parent = 0);
virtual ~CxuiView();
-protected:
virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler * keyHandler);
+ CxuiCaptureKeyHandler * keyHandler,
+ HbActivityManager *activityManager);
public:
+ virtual bool isStandbyModeSupported() const;
virtual void updateOrientation(Qt::Orientation orientation);
+ virtual void restoreActivity(const QString &activityId, const QVariant &data);
+ virtual void saveActivity();
+ virtual void clearActivity();
+
protected:
virtual bool allowShowControls() const;
+ virtual bool isFeedbackEnabled() const;
virtual void toggleControls();
virtual void showToolbar();
virtual void hideZoom();
@@ -70,6 +77,11 @@
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+
+public slots:
+ virtual void enterStandby();
+ virtual void exitStandby();
+
protected slots:
virtual void launchNotSupportedNotification();
virtual void launchPhotosApp();
@@ -104,6 +116,7 @@
QTimer mHideControlsTimeout;
HbInstantFeedback mControlsFeedback;
+ HbActivityManager *mActivityManager;
};
#endif // CXUIVIEW_H
--- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Thu Jul 15 01:52:14 2010 +0300
@@ -24,8 +24,7 @@
#include "cxeviewfindercontrol.h"
#include "cxenamespace.h"
#include "cxeerror.h"
-#include "cxuiapplicationframeworkmonitor.h"
-
+#include "cxuiapplicationstate.h"
class QGraphicsSceneMouseEvent;
class HbMainWindow;
@@ -38,8 +37,8 @@
class CxeEngine;
class CxuiDocumentLoader;
class CxuiErrorManager; // class that handles all errors in ui.
-class CxuiStandby;
class CxuiSceneModeView;
+class CxuiView;
class CxuiViewManager : public QObject
{
@@ -49,89 +48,65 @@
CxuiViewManager(CxuiApplication &application, HbMainWindow &mainWindow, CxeEngine &engine);
~CxuiViewManager();
- void prepareWindow();
+ CxuiDocumentLoader *documentLoader();
- /**
- * Get a pointer to the document loader instance.
- */
- CxuiDocumentLoader* documentLoader();
+ CxuiApplicationState &applicationState();
- //@todo: Temporarily needed in main().
- bool proceedStartup();
-
+ void initEngine();
public slots:
void changeToPostcaptureView();
void changeToPrecaptureView();
void switchCamera();
- void createPostcaptureView();
void showScenesView();
private slots:
- void startupCheck();
void toForeground();
- void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state);
- void showUsbErrorPopup(bool show);
- void handleBatteryEmpty();
- void aboutToLooseFocus();
- void aboutToGainFocus();
+ void handleApplicationStateChanged(CxuiApplicationState::State newState,
+ CxuiApplicationState::State oldState);
+ void startStandbyTimer();
+ void stopStandbyTimer();
signals:
- void focusGained();
- void focusLost();
- void batteryEmpty();
- void disableStandbyTimer();
- void startStandbyTimer();
+ void normalStateEntered();
+ void normalStateExited();
+ void standbyExitRequested();
protected:
bool eventFilter(QObject *object, QEvent *event);
private:
+ CxuiView *currentView() const;
void initStartupView();
- void createStillPrecaptureView();
- void createVideoPrecaptureView();
+ CxuiView *createView(const QString &viewName);
CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera);
- void createSceneModesView();
-
- /*
- * connects all necessary signals for precapture view
- */
- void connectPreCaptureSignals();
+ CxuiView *createSceneModesView();
- /*
- * disconnects signals
- */
- void disconnectSignals();
+ void connectSignals(QObject *view);
+ void disconnectSignals(QObject *view = NULL);
+ void connectPreCaptureSignals();
+ void connectPostCaptureSignals();
+ void connectSceneModeSignals();
+ void connectCaptureKeySignals();
- /*
- * connects all necessary signals for postcapture view
- */
- void connectPostCaptureSignals();
-
-
- /*
- * connects capture key handler signals to the current view.
- */
- void connectCaptureKeySignals();
+ void handleExitingNormalState();
+ void clearAllActivities();
private:
//data
CxuiApplication &mApplication;
HbMainWindow &mMainWindow;
- CxuiStillPrecaptureView *mStillPrecaptureView;
- CxuiVideoPrecaptureView *mVideoPrecaptureView;
- CxuiPostcaptureView *mPostcaptureView;
+ QMap<QString, CxuiView*> mViews;
+ QMap<QString, QString> mDocmlFilesByView;
CxeEngine &mEngine;
CxuiCaptureKeyHandler *mKeyHandler;
- CxuiApplicationFrameworkMonitor *mApplicationMonitor;
-
-private:
CxuiDocumentLoader *mCameraDocumentLoader;
- CxuiStandby *mStandbyHandler;
+ CxuiApplicationState *mApplicationState;
CxuiErrorManager *mErrorManager;
CxuiSceneModeView *mSceneModeView;
+ QTimer mStandbyTimer;
};
#endif // CXUIVIEWMANAGER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/layouts/full_screen_popup.docml Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.1">
+ <widget name="full_screen_popup" type="HbWidget">
+ <widget name="full_screen_popup_text" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <real name="z" value="0.2"/>
+ <sizehint height="360" type="MINIMUM" width="640"/>
+ </widget>
+ <widget name="full_screen_popup_button" type="HbPushButton">
+ <real name="z" value="0.3"/>
+ </widget>
+ <real name="z" value="0.1"/>
+ <sizehint height="360" type="MINIMUM" width="640"/>
+ <layout type="anchor">
+ <anchoritem dst="full_screen_popup_button" dstEdge="BOTTOM" spacing="expr(-var(hb-param-margin-gene-bottom) )" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="full_screen_popup_button" dstEdge="CENTERH" spacing="0" src="" srcEdge="CENTERH"/>
+ </layout>
+ </widget>
+ <connect receiver="full_screen_popup" sender="full_screen_popup_button" signal="released()" slot="close()"/>
+ <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/image_setting.xml Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/image_setting.xml Thu Jul 15 01:52:14 2010 +0300
@@ -70,7 +70,6 @@
<item string="txt_cam_list_sepia" value="1" icon="" />
<item string="txt_cam_list_white" value="3" icon="" />
<item string="txt_cam_list_vivid" value="4" icon="" />
- <item string="txt_cam_list_negative" value="2" icon="" />
</setting_list>
<!-- ISO Light sensitivity (setting list) -->
@@ -85,6 +84,16 @@
<l1Item string="txt_cam_list_iso_l1" l1Value="400" value="400" icon="" />
<l1Item string="txt_cam_list_iso_l1" l1Value="800" value="800" icon="" />
</setting_list>
+
+ <!-- GeoTagging (setting list) -->
+ <setting_list id="geotagging"
+ heading="txt_cam_title_geotagging"
+ preview="0"
+ type="SingleLineListBox"
+ setting_icon="">
+ <item string="txt_cam_list_geotagging_on" value="1" icon="" />
+ <item string="txt_cam_list_geotagging_off" value="0" icon="" />
+ </setting_list>
<!-- Exposure compensation (setting slider) -->
<setting_slider id="ev_compensation_value" heading="txt_cam_title_exposure_compensation" setting_icon="">
--- a/camerauis/cameraxui/cxui/layouts/standbymode_popup.docml Thu Jul 15 01:49:11 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.1">
- <widget name="standbymode_popup" type="HbDialog">
- <sizehint height="360" type="MINIMUM" width="640"/>
- <widget name="standbymode_widget" role="HbDialog:contentWidget" type="HbWidget">
- <widget name="standby_text" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <real name="z" value="0.3"/>
- <sizehint height="360" type="MINIMUM" width="640"/>
- <string locid="txt_cam_info_camera_in_standby_mode" name="plainText" value="Camera in stand-by mode"/>
- </widget>
- <real name="z" value="0.1"/>
- </widget>
- </widget>
- <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 Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/video_setting.xml Thu Jul 15 01:52:14 2010 +0300
@@ -37,7 +37,6 @@
<item string="txt_cam_list_sepia" value="1" icon="" />
<item string="txt_cam_list_white" value="3" icon="" />
<item string="txt_cam_list_vivid" value="4" icon="" />
- <item string="txt_cam_list_negative" value="2" icon="" />
</setting_list>
<!-- Video scene modes -->
@@ -51,6 +50,16 @@
<item string="txt_cam_list_night_video" value="video_scene_night" icon="qtg_mono_night" />
</setting_list>
+ <!-- GeoTagging (setting list) -->
+ <setting_list id="geotagging"
+ heading="txt_cam_title_geotagging"
+ preview="0"
+ type="SingleLineListBox"
+ setting_icon="">
+ <item string="txt_cam_list_geotagging_on" value="1" icon="" />
+ <item string="txt_cam_list_geotagging_off" value="0" icon="" />
+ </setting_list>
+
<!-- Exposure compensation (setting slider) -->
<setting_slider id="ev_compensation_value" heading="txt_cam_title_exposure_compensation" setting_icon="">
<setup min="txt_cam_slidervalue_l1_minus" max="txt_cam_slidervalue_l1_plus" l1Value="2" minorStep="0.5" majorStep="1"/>
--- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:52:14 2010 +0300
@@ -14,9 +14,6 @@
<string name="settingskey" value="still_showcaptured"/>
<string locid="txt_cam_opt_show_captured_image" name="text" value="Show captured image"/>
</object>
- <object name="cxui_action_setdefaultscenemode" type="HbAction">
- <string locid="txt_cam_opt_set_as_default_scene_mode" name="text" value="Set as default scene mode"/>
- </object>
<object name="cxui_action_settings" type="HbAction">
<string locid="txt_cam_opt_camera_settings" name="text" value="Camera settings"/>
</object>
@@ -24,6 +21,10 @@
<string name="settingskey" value="imageQuality"/>
<string locid="txt_cam_opt_image_quality" name="text" value="Image quality"/>
</object>
+ <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 name="cxui_action_capture" type="HbAction">
<icon iconName="qtg_mono_capture" name="icon"/>
</object>
@@ -61,6 +62,12 @@
<sizehint height="var(hb-param-graphic-size-primary-small)" type="FIXED" width="var(hb-param-graphic-size-primary-small)"/>
<bool name="visible" value="TRUE"/>
</widget>
+ <widget name="still_geotagging_indicator" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <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="TRUE"/>
+ </widget>
<widget name="face_tracking_indicator" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
<sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
@@ -74,6 +81,7 @@
<linearitem itemname="mode_indicator"/>
<linearitem itemname="quality_indicator"/>
<linearitem itemname="flash_indicator"/>
+ <linearitem itemname="still_geotagging_indicator"/>
<linearitem itemname="face_tracking_indicator"/>
</layout>
</widget>
@@ -203,8 +211,8 @@
</layout>
</widget>
</widget>
- <connect receiver="still_capture_view" sender="cxui_action_setdefaultscenemode" signal="triggered(bool)" slot="launchNotSupportedNotification()"/>
<connect receiver="still_capture_view" sender="cxui_action_image_quality" signal="triggered(bool)" slot="launchSetting()"/>
+ <connect receiver="still_capture_view" sender="cxui_action_still_geotagging" signal="triggered(bool)" slot="launchSetting()"/>
<connect receiver="still_capture_view" sender="still_view_menu" signal="aboutToShow()" slot="disableControlsTimeout()"/>
<connect receiver="still_capture_view" sender="still_view_menu" signal="aboutToHide()" slot="hideControls()"/>
<connect receiver="still_capture_view" sender="cxui_action_goto_photos" signal="triggered(bool)" slot="launchPhotosApp()"/>
@@ -228,8 +236,8 @@
<string locid="txt_cam_opt_general_settings" name="title" value="General settings"/>
<ref object="cxui_action_stillpostcapture" role="HbWidget:addAction"/>
<ref object="cxui_action_image_quality" role="HbWidget:addAction"/>
+ <ref object="cxui_action_still_geotagging" role="HbWidget:addAction"/>
</widget>
- <ref object="cxui_action_setdefaultscenemode" role="HbWidget:addAction"/>
</widget>
</section>
<section name="still_embedded_mode">
@@ -239,6 +247,7 @@
<widget name="still_submenu_general" role="HbMenu:menu" type="HbMenu">
<string locid="txt_cam_opt_general_settings" name="title" value="General settings"/>
<ref object="cxui_action_image_quality" role="HbMenu:addAction"/>
+ <ref object="cxui_action_still_geotagging" role="HbMenu:addAction"/>
</widget>
</widget>
</section>
--- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:52:14 2010 +0300
@@ -3,9 +3,6 @@
<object name="cxui_video_action_record" type="HbAction">
<icon iconName="qtg_small_record" name="icon"/>
</object>
- <object name="cxui_video_action_light" type="HbAction">
- <icon iconName="qtg_mono_light" name="icon"/>
- </object>
<object name="cxui_video_action_zoom" type="HbAction">
<icon iconName="qtg_mono_zoom" name="icon"/>
</object>
@@ -38,9 +35,6 @@
<string name="settingskey" value="video_showcaptured"/>
<string locid="txt_cam_opt_show_captured_video" name="text" value="Show captured video"/>
</object>
- <object name="cxui_video_action_setdefaultscenemode" type="HbAction">
- <string locid="txt_cam_opt_set_as_default_scene_mode" name="text" value="Set as default scene mode"/>
- </object>
<object name="cxui_video_action_settings" type="HbAction">
<string locid="txt_cam_opt_camera_settings" name="text" value="Camera settings"/>
</object>
@@ -112,7 +106,6 @@
<sizehint type="PREFERRED" width="var(hb-param-widget-toolbar-height)"/>
<enums name="orientation" value="Vertical"/>
<ref object="cxui_video_action_record" role="HbWidget:addAction"/>
- <ref object="cxui_video_action_light" role="HbWidget:addAction"/>
<ref object="cxui_video_action_scene" role="HbWidget:addAction"/>
<ref object="cxui_video_action_gotostill" role="HbWidget:addAction"/>
</widget>
@@ -122,7 +115,6 @@
<enums name="orientation" value="Vertical"/>
<bool name="visible" value="FALSE"/>
<ref object="cxui_video_action_pause" role="HbWidget:addAction"/>
- <ref object="cxui_video_action_light" role="HbWidget:addAction"/>
<ref object="cxui_video_action_stop" role="HbWidget:addAction"/>
</widget>
<widget name="video_zoom" type="HbSlider">
@@ -136,7 +128,6 @@
<enums name="orientation" value="Vertical"/>
<bool name="visible" value="FALSE"/>
<ref object="cxui_video_action_resume" role="HbWidget:addAction"/>
- <ref object="cxui_video_action_light" role="HbWidget:addAction"/>
<ref object="cxui_video_action_stop" role="HbWidget:addAction"/>
</widget>
<widget name="video_indicator_container_bottom" type="HbWidget">
@@ -208,7 +199,6 @@
<connect receiver="video_capture_view" sender="cxui_video_action_pause" signal="triggered(bool)" slot="pause()"/>
<connect receiver="video_capture_view" sender="cxui_video_action_gotostill" signal="triggered(bool)" slot="goToStill()"/>
<connect receiver="video_capture_view" sender="cxui_video_action_gotostill" signal="triggered(bool)" slot="hideControls()"/>
- <connect receiver="video_capture_view" sender="cxui_video_action_light" signal="triggered(bool)" slot="launchNotSupportedNotification()"/>
<connect receiver="video_capture_view" sender="cxui_video_action_scene" signal="triggered(bool)" slot="launchVideoScenePopup()"/>
<connect receiver="video_capture_view" sender="cxui_video_action_gotovideos" signal="triggered(bool)" slot="launchVideosApp()"/>
</section>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,272 @@
+/*
+* 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 <QMetaEnum>
+
+#include "cxutils.h"
+#include "cxuieventlog.h"
+#include "cxuierrormanager.h"
+#include "cxuiapplicationstate.h"
+
+namespace
+{
+ static const char *EVENT_APPLICATION_STATE = "application state";
+}
+
+/*!
+* Constructor.
+*/
+CxuiApplicationState::CxuiApplicationState(CxuiApplication &application,
+ CxeSettings &settings,
+ CxuiCaptureKeyHandler &keyHandler,
+ CxuiDocumentLoader *documentLoader)
+ : mState(Background), mApplicationMonitor(NULL), mErrorManager(NULL), mEventLog(NULL)
+{
+ mApplicationMonitor = new CxuiApplicationFrameworkMonitor(application, settings);
+ mErrorManager = new CxuiErrorManager(documentLoader);
+
+ // Foreground state change signals
+ connect(mApplicationMonitor, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)),
+ this, SLOT(handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)));
+
+ // Battery empty signal
+ connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty()));
+
+ // USB mass memory mode signal
+ connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)),
+ this, SLOT(handleUsbMassMemoryModeChanged(bool)));
+
+ // Severe error signals
+ connect(mErrorManager, SIGNAL(errorPopupShown()), this, SLOT(handleSevereError()));
+ connect(mErrorManager, SIGNAL(errorPopupClosed()), this, SLOT(handleErrorCleared()));
+
+#ifdef CX_DEBUG
+ mEventLog = new CxuiEventLog("CxuiApplicationState");
+#endif
+}
+
+/*!
+* Destructor.
+*/
+CxuiApplicationState::~CxuiApplicationState()
+{
+ delete mErrorManager;
+ delete mApplicationMonitor;
+ delete mEventLog;
+}
+
+/*!
+* Get current application state.
+*/
+CxuiApplicationState::State CxuiApplicationState::currentState() const
+{
+ return mState;
+}
+
+/*!
+* Start monitoring the application state.
+* Initial state is checked and signal emitted about state change *unless* state is Background.
+*/
+void CxuiApplicationState::startMonitoring()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // Foreground handling checks for errors if needed.
+ handleForegroundStateChanged(mApplicationMonitor->foregroundState());
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle error from UI or engine.
+* Error will be checked and if it is severe, application state will become Error and error note will be shown.
+* If error is not severe, a warning note will be shown.
+* @param error The error id.
+*/
+void CxuiApplicationState::handleApplicationError(CxeError::Id error)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (error != CxeError::None) {
+ mErrorManager->check(error);
+ // If error manager sees this error as severe one, it will signal that back.
+ // We will handle updating state in handleSevereError().
+ // If only warning note (or nothing) is needed, application state is not changed.
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle change in application foreground status.
+* @param state New foreground status.
+*/
+void CxuiApplicationState::handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (state == CxuiApplicationFrameworkMonitor::ForegroundFullyLost) {
+ CX_DEBUG(("CxuiApplicationState - application is in background"));
+ // Background overwrites even any error. We clear any active errors.
+ // When returning to background, error situation will be re-checked.
+ setState(Background);
+ mErrorManager->clear();
+ } else {
+ CX_DEBUG(("CxuiApplicationState - application is in partial / full foreground"));
+ // Check that we were in background. Switching between partial and full background
+ // needs no actions.
+ if (currentState() == Background) {
+ CX_DEBUG(("CxuiApplicationState - application was in background before, moving to foreground"));
+ // Check that there's no active errors that have been ignored in background.
+ checkErrors();
+ if (currentState() != Error) {
+ setState(Normal);
+ }
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle USB mass memory mode (USB MMM) activating or deactivating.
+* If USB MMM activates, we enter error state and display error note.
+* When USB MMM deactivates, we hide the note and move to standby mode.
+* @param active Is the USB mass memory mode active.
+*/
+void CxuiApplicationState::handleUsbMassMemoryModeChanged(bool active)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (active) {
+ // USB error is not handled if:
+ // (a) other severe error already active
+ // (b) application is in background
+ if (currentState() == Normal || currentState() == Standby) {
+ // Emulate memory not accessible error.
+ handleApplicationError(CxeError::MemoryNotAccessible);
+ }
+ } else {
+ // If we had USB error, clear it now.
+ if (currentState() == Error) {
+ setState(Standby);
+ // Clear memory not accessible error.
+ mErrorManager->clear();
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle battery emptying. We need to stop all activity and exit the application.
+*/
+void CxuiApplicationState::handleBatteryEmpty()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ setState(Background);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle a severe error after Error Manager has analyzed it.
+*/
+void CxuiApplicationState::handleSevereError()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // In background we do not change the state from Background to anything else.
+ if (currentState() != Background) {
+ setState(Error);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Severe error has been cleared.
+* Check if we should return to normal or background state.
+*/
+void CxuiApplicationState::handleErrorCleared()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // No state change if we are not currently in Error state.
+ if (currentState() == Error) {
+ setState(Normal);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot for requesting Standby state to be entered.
+* Request is accepted only if current state is Normal. Otherwise call has no effect.
+*/
+void CxuiApplicationState::enterStandby()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (currentState() == Normal) {
+ setState(Standby);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot for requesting state change from Standby to Normal state.
+* Request is accepted only if current state is Standby. Otherwise call has no effect.
+*/
+void CxuiApplicationState::exitStandby()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (currentState() == Standby) {
+ setState(Normal);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Set new state.
+* If state is actually changing, stateChanged() signal is emitted.
+*/
+void CxuiApplicationState::setState(State newState)
+{
+ if (mState != newState) {
+#ifdef CX_DEBUG
+ if (mEventLog) {
+ mEventLog->append(EVENT_APPLICATION_STATE,
+ CxuiApplicationState::staticMetaObject.enumerator(
+ CxuiApplicationState::staticMetaObject.
+ indexOfEnumerator("State")).valueToKey(newState));
+ mEventLog->print();
+ }
+#endif // CX_DEBUG
+
+ State oldState = mState;
+ mState = newState;
+ emit stateChanged(newState, oldState);
+ }
+}
+
+/*!
+* Check if we have known errors active at the moment.
+* State is set to CxuiApplicationState::Error, if error is found.
+*/
+void CxuiApplicationState::checkErrors()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (mApplicationMonitor->isUsbMassMemoryModeActive()) {
+ // Force Error state even if Background is still the current state.
+ // We use this method to check errors also when returning from background.
+ // Normally in Background state we do not enter Error state.
+ setState(Error);
+ handleApplicationError(CxeError::MemoryNotAccessible);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+// end of file
--- a/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -66,7 +66,7 @@
} else if (type == "HbSlider") {
if (name == CxUiLayout::SETTINGS_SLIDER_DIALOG_CONTENT_WIDGET) {
object = new CxuiSettingSlider(NULL, mEngine);
- } else if (name == CxUiLayout::STILL_PRE_CAPTURE_ZOOM_SLIDER
+ } else if (name == CxUiLayout::STILL_PRE_CAPTURE_ZOOM_SLIDER
|| name == CxUiLayout::VIDEO_PRE_CAPTURE_ZOOM_SLIDER) {
object = new CxuiZoomSlider();
}
--- a/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -34,8 +34,7 @@
/*!
* Constructor
*/
-CxuiErrorManager::CxuiErrorManager(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader) :
- mKeyHandler(keyHandler),
+CxuiErrorManager::CxuiErrorManager(CxuiDocumentLoader *documentLoader) :
mDocumentLoader(documentLoader),
mErrorMsgPopup(NULL),
mErrorId(CxeError::None),
@@ -56,16 +55,18 @@
/*!
-* Show error popup based on the error id.
-* @param error Error id.
+* Check the error code and show either error popup, warning popup or do nothing,
+* if "no error" code is given.
+* @param error Error id. If CxeError::None, no action is taken. Otherwise
+* either warning or error popup is shown based on the severity of error.
+*
*/
-void CxuiErrorManager::showPopup(CxeError::Id error)
+void CxuiErrorManager::check(CxeError::Id error)
{
CX_DEBUG_ENTER_FUNCTION();
mErrorSeverity = CxuiErrorManager::None;
if (error != CxeError::None) {
- CxeError::Id oldError = mErrorId;
mErrorId = error;
// start evaluating the error.
@@ -75,7 +76,7 @@
if (mErrorSeverity != CxuiErrorManager::None) {
// Clear the old error if one for some reason exists.
- hidePopup(oldError);
+ clear();
// show the error note to the user.
launchPopup(errorText, buttonText);
@@ -88,17 +89,14 @@
}
/*!
-* Close the open error popup, if it is shown for the same error as requested here.
-* @param error Error id, for which we are closing the error dialog.
+* Close the open error popup.
*/
-void CxuiErrorManager::hidePopup(CxeError::Id error)
+void CxuiErrorManager::clear()
{
CX_DEBUG_ENTER_FUNCTION();
- if (mErrorId == error) {
- if (mErrorMsgPopup) {
- mErrorMsgPopup->close();
- mErrorMsgPopup = NULL;
- }
+ if (mErrorMsgPopup) {
+ mErrorMsgPopup->close();
+ mErrorMsgPopup = NULL;
}
CX_DEBUG_EXIT_FUNCTION();
}
@@ -108,12 +106,14 @@
*/
void CxuiErrorManager::popupClosed(HbAction *action)
{
+ Q_UNUSED(action)
+
CX_DEBUG_ENTER_FUNCTION();
// Dialog or action instance cannot be used anymore.
mErrorMsgPopup = NULL;
// handle any use-cases when the error can be recovered
- emit errorRecovered();
+ emit errorPopupClosed();
CX_DEBUG_EXIT_FUNCTION();
}
@@ -140,20 +140,12 @@
CX_DEBUG_ENTER_FUNCTION();
switch (mErrorId) {
case CxeError::MemoryNotAccessible:
- mErrorSeverity = CxuiErrorManager::Severe;
+ mErrorSeverity = CxuiErrorManager::Error;
errorText = hbTrId("txt_cam_info_error_usb_disconnected");
buttonText = hbTrId("txt_cam_info_error_usb_disconnected_button");
break;
- case CxeError::Died:
- case CxeError::InitializationFailed:
- case CxeError::HwNotAvailable:
- case CxeError::NotReady:
- mErrorSeverity = CxuiErrorManager::Severe;
- errorText = hbTrId("txt_cam_info_error");
- buttonText = hbTrId("txt_common_button_close");
- break;
case CxeError::InUse:
- mErrorSeverity = CxuiErrorManager::Severe;
+ mErrorSeverity = CxuiErrorManager::Error;
errorText = hbTrId("txt_cam_info_camera_already_in_use");
buttonText = hbTrId("txt_common_button_close");
break;
@@ -161,15 +153,28 @@
mErrorSeverity = CxuiErrorManager::Warning;
errorText = hbTrId("txt_cam_info_memory_full");
break;
+ case CxeError::OutOfMemory:
+ mErrorSeverity = CxuiErrorManager::Error;
+ errorText = hbTrId("txt_cam_info_error_ram_full");
+ buttonText = hbTrId("txt_common_ok");
+ break;
+ case CxeError::Died:
+ case CxeError::InitializationFailed:
+ case CxeError::HwNotAvailable:
+ case CxeError::NotReady:
default:
- errorText = "No Error";
+ mErrorSeverity = CxuiErrorManager::Error;
+ errorText = hbTrId("txt_cam_info_error");
+ buttonText = hbTrId("txt_common_button_close");
break;
}
CX_DEBUG_EXIT_FUNCTION();
}
/*!
-*
+* Show warning or error popup.
+* @param errorText Message to be shown in the popup.
+* @param buttonText Button text to be shown in the action button of the popup. Not used on warning popup.
*/
void CxuiErrorManager::launchPopup(const QString &errorText, const QString &buttonText)
{
@@ -179,10 +184,10 @@
case CxuiErrorManager::None:
break;
case CxuiErrorManager::Warning:
- showLowSeverityNote(errorText);
+ showWarningPopup(errorText);
break;
default:
- showHighSeverityNote(errorText, buttonText);
+ showErrorPopup(errorText, buttonText);
break;
}
@@ -192,9 +197,9 @@
}
/*!
-* Show error note for high severity error.
+* Show error note for severe error.
*/
-void CxuiErrorManager::showHighSeverityNote(const QString &errorText, const QString &buttonText)
+void CxuiErrorManager::showErrorPopup(const QString &errorText, const QString &buttonText)
{
// we always prepare the popup for the new message and hence we load the
// popup everytime from document loader
@@ -231,20 +236,18 @@
exitButton->setText(buttonText);
connect(exitButton, SIGNAL(released()), this, SLOT(closeApp()));
exitButton->show();
- } else {
- // TODO handle other severity cases here.
}
- emit aboutToRecoverError();
+ emit errorPopupShown();
mErrorMsgPopup->open(this, SLOT(popupClosed(HbAction*)));
CX_DEBUG_EXIT_FUNCTION();
}
/*!
-* Show error note for low severity error.
+* Show warning note for low severity error.
*/
-void CxuiErrorManager::showLowSeverityNote(const QString &errorText)
+void CxuiErrorManager::showWarningPopup(const QString &errorText)
{
CX_DEBUG_ENTER_FUNCTION();
HbMessageBox::warning(errorText);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/camerauis/cameraxui/cxui/src/cxuifullscreenpopup.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <QGraphicsScene>
+#include <QGraphicsRectItem>
+#include <QGraphicsAnchorLayout>
+#include <HbLabel>
+#include <HbPushButton>
+#include <HbInstantFeedback>
+#include "cxutils.h"
+#include "cxuienums.h"
+#include "cxuiview.h"
+#include "cxuidocumentloader.h"
+#include "cxuifullscreenpopup.h"
+
+/*!
+* Constructor.
+*/
+CxuiFullScreenPopup::CxuiFullScreenPopupLoader::CxuiFullScreenPopupLoader()
+ : HbDocumentLoader()
+{
+}
+
+/*!
+* Create object from DocML.
+* Custom type of object created when object name matches the full screen dialog one.
+* Other items are propagated to HbDocumentLoader for standard handling.
+* @param type Object type (class name)
+* @param name Object name, name of the item in DocML.
+*/
+QObject *CxuiFullScreenPopup::CxuiFullScreenPopupLoader::createObject(const QString& type, const QString &name)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QObject *object = NULL;
+
+ // HbWidget as type in DocML to support UI layout tool.
+ if (type == "HbWidget") {
+ if (name == CxUiLayout::FULL_SCREEN_POPUP) {
+ object = new CxuiFullScreenPopup();
+ }
+ }
+
+ if (object) {
+ object->setObjectName(name);
+ } else {
+ object = HbDocumentLoader::createObject(type, name);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return object;
+}
+
+/*!
+* Load a full screen popup from DocML and set given message and action text to it.
+* @param scene Graphics scene where to insert the popup.
+* @param message Popup message text.
+* @param action Popup action button text.
+*/
+CxuiFullScreenPopup *CxuiFullScreenPopup::create(QGraphicsScene *scene,
+ const QString &message,
+ const QString &action)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ bool ok(true);
+
+ // Load popup structure from DocML.
+ CxuiFullScreenPopupLoader *loader = new CxuiFullScreenPopupLoader();
+ loader->load(CxUiLayout::FULL_SCREEN_POPUP_XML, &ok);
+ CX_ASSERT_ALWAYS(ok);
+
+ // Popup container widget.
+ CxuiFullScreenPopup *popup = qobject_cast<CxuiFullScreenPopup *>(loader->findWidget(CxUiLayout::FULL_SCREEN_POPUP));
+ CX_ASSERT_ALWAYS(popup);
+ // Popup needs scene to move in front of all widgets.
+ popup->setScene(scene);
+ // Add background graphic for popup.
+ QGraphicsRectItem *bg = new QGraphicsRectItem(popup);
+ bg->setRect(popup->geometry());
+ bg->setBrush(Qt::black);
+ popup->setBackgroundItem(bg);
+
+ // Popup text.
+ //!@todo: Move text color definition to DocML once supported there.
+ HbLabel *text = qobject_cast<HbLabel*>(loader->findWidget(CxUiLayout::FULL_SCREEN_POPUP_TEXT));
+ CX_ASSERT_ALWAYS(text);
+ text->setPlainText(message);
+ text->setTextColor(Qt::white);
+
+ // Action button.
+ // Hidden if empty text given.
+ HbPushButton *button = qobject_cast<HbPushButton*>(loader->findWidget(CxUiLayout::FULL_SCREEN_POPUP_BUTTON));
+ CX_ASSERT_ALWAYS(button);
+ if (action.isEmpty()) {
+ CX_DEBUG(("CxuiFullScreenPopup - no button text given, hiding button.."));
+ button->setVisible(false);
+ } else {
+ button->setText(action);
+ }
+
+ delete loader;
+ loader = NULL;
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return popup;
+}
+
+/*!
+* Popup destructor.
+*/
+CxuiFullScreenPopup::~CxuiFullScreenPopup()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ hide();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle mouse press event.
+*/
+void CxuiFullScreenPopup::handleMousePress()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ // Give standard feedback.
+ HbInstantFeedback feedback(HbFeedback::BasicItem);
+ feedback.setModalities(HbFeedback::All);
+ feedback.play();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Handle mouse release event.
+*/
+void CxuiFullScreenPopup::handleMouseRelease()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ //!@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
+ // Give tactile feedback but no sound feedback on mouse release.
+ /*
+ HbInstantFeedback feedback(HbFeedback::BasicItem);
+ feedback.setModalities(HbFeedback::Tactile);
+ feedback.play();
+ CX_DEBUG_EXIT_FUNCTION();
+ */
+}
+
+/*!
+* Show the popup.
+* Checks current top most item in the scene and adds this popup in front of it.
+* Input to below widgets is blocked.
+*/
+void CxuiFullScreenPopup::show()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CX_ASSERT_ALWAYS(mScene);
+
+ if (!mPopupShown) {
+ mPopupShown = true;
+ // Store current top item z value.
+ qreal topZ(topZValue());
+ // Add popup widget to scene to actually get it visible.
+ mScene->addItem(this);
+ // Make sure popup is just above the top item.
+ setZValue(topZ + 1);
+
+ // Block input to other widgets below the popup.
+ setWindowFlags(Qt::Dialog);
+ setPanelModality(QGraphicsItem::PanelModal);
+
+ // Show popup.
+ HbWidget::show();
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Hide the popup.
+*/
+void CxuiFullScreenPopup::hide()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mPopupShown) {
+ HbWidget::hide();
+ // Double check non-nullness.
+ if (mScene) {
+ mScene->removeItem(this);
+ }
+ mPopupShown = false;
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Get the z value of top item in scene.
+* @return Top (max) z value.
+*/
+qreal CxuiFullScreenPopup::topZValue() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ qreal z(0);
+ if (mScene) {
+ const QList<QGraphicsItem *> itemList(mScene->items(Qt::DescendingOrder));
+ foreach (QGraphicsItem *item, itemList) {
+ // Max of z values.
+ z = (item && item->zValue() > z) ? item->zValue() : z;
+#ifdef CX_DEBUG
+ const QGraphicsObject *gObject(item->toGraphicsObject());
+ CX_DEBUG(("Item of class [%s] z value [%s]",
+ gObject ? gObject->metaObject()->className() : qPrintable(QString("QGraphicsItem")),
+ qPrintable(QString::number(item->zValue()))));
+#endif // CX_DEBUG
+ }
+ } else {
+ CX_DEBUG(("[WARNING] No scene found, returning zero"));
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+ return z;
+}
+
+/*!
+* Store the scene in which this popup is to be shown.
+*/
+void CxuiFullScreenPopup::setScene(QGraphicsScene *scene)
+{
+ mScene = scene;
+}
+
+/*!
+* Popup (private) constructor.
+*/
+CxuiFullScreenPopup::CxuiFullScreenPopup()
+ : mScene(NULL),
+ mPopupShown(false)
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+// end of file
--- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -30,8 +30,10 @@
#include <hbaction.h>
#include <hbmessagebox.h>
#include <hbnotificationdialog.h>
+#include <hbactivitymanager.h>
#include <shareui.h>
+#include <thumbnailmanager_qt.h>
#include "cxeviewfindercontrol.h"
#include "cxuienums.h"
@@ -39,7 +41,6 @@
#include "cxeengine.h"
#include "cxecameradevicecontrol.h"
#include "cxestillcapturecontrol.h"
-#include "cxeviewfindercontrol.h"
#include "cxevideocapturecontrol.h"
#include "cxestillimage.h"
#include "cxutils.h"
@@ -59,9 +60,12 @@
using namespace Cxe;
-//!@todo Temporarily disabled.
-//const int CXUI_STOP_VIEWFINDER_TIMEOUT = 5000; // 5 seconds
-//const int CXUI_RELEASE_CAMERA_TIMEOUT = 10000; // 10 seconds
+namespace {
+ 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
@@ -80,7 +84,9 @@
mReleaseCameraTimer(this),
mPostcaptureTimer(this),
mTimersStarted(false),
- mDeleteNoteOpen(false)
+ mDeleteNoteOpen(false),
+ mFilename(QString::null),
+ mThumbnailManager(NULL)
{
CX_DEBUG_IN_FUNCTION();
@@ -97,6 +103,7 @@
CX_DEBUG_ENTER_FUNCTION();
QCoreApplication::instance()->removeEventFilter(this);
stopTimers();
+ delete mThumbnailManager;
delete mShareUi;
CX_DEBUG_EXIT_FUNCTION();
}
@@ -107,11 +114,13 @@
// ---------------------------------------------------------------------------
//
void CxuiPostcaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
- CxuiDocumentLoader *documentLoader)
+ CxuiDocumentLoader *documentLoader,
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
- CxuiView::construct(mainwindow, engine, documentLoader, NULL);
+ CxuiView::construct(mainwindow, engine, documentLoader, NULL, activityManager);
// set back action to go back to pre-capture
HbAction *backAction = new HbAction(Hb::BackNaviAction, this);
@@ -209,10 +218,36 @@
*/
void CxuiPostcaptureView::playVideo()
{
-
- launchNotSupportedNotification();
- //! @todo needs an implementation
- CX_DEBUG_IN_FUNCTION();
+ CX_DEBUG_ENTER_FUNCTION();
+
+ stopTimers();
+ releaseCamera();
+
+ QString videoFile(getCurrentFilename());
+
+ XQAiwRequest *videoRequest = mAppManager.create(
+ "com.nokia.symbian.IVideoView","playMedia(QString)", true);
+
+ if (videoRequest) {
+ QVariantList fileList;
+ fileList.append(QVariant(videoFile));
+ videoRequest->setArguments(fileList);
+
+ CX_DEBUG(("CxuiPostcaptureView: sending request"));
+ QVariant result;
+ bool res = videoRequest->send(result);
+ if (res) {
+ CX_DEBUG(("CxuiPostcaptureView: request sent, received \"%s\"",
+ result.toString().toAscii().constData()));
+ } else {
+ CX_DEBUG(("CxuiPostcaptureView: request sending failed, error=%d",
+ videoRequest->lastError()));
+ }
+ delete videoRequest;
+ videoRequest = NULL;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
}
@@ -314,8 +349,8 @@
// Re-enabling starting timers the next time we enter post capture view.
mTimersStarted = false;
- // Make sure engine prepares for new image/video if necessary
- mEngine->initMode(mEngine->mode());
+ // reset saved filename
+ mFilename = QString::null;
// Switch to pre-capture view
emit changeToPrecaptureView();
@@ -392,8 +427,66 @@
*/
void CxuiPostcaptureView::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
- OstTrace0(camerax_performance, CXUIPOSTCAPTUREVIEW_SNAPSHOT_DRAW, "msg: e_CX_SHOT_TO_SNAPSHOT 0");
- QGraphicsWidget::paint(painter, option, widget);
+ OstTrace0(camerax_performance, CXUIPOSTCAPTUREVIEW_SNAPSHOT_DRAW, "msg: e_CX_SHOT_TO_SNAPSHOT 0");
+ QGraphicsWidget::paint(painter, option, widget);
+}
+
+/*!
+ * Restore view state from activity.
+ * @param activityId Activity id
+ * @param data Activity data
+ */
+void CxuiPostcaptureView::restoreActivity(const QString &activityId, const QVariant &data)
+{
+ 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_EXIT_FUNCTION();
+}
+
+/*!
+ * Save view state to activity.
+ */
+void CxuiPostcaptureView::saveActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVariantMap data;
+ QVariantHash params;
+
+ QString filename = getCurrentFilename();
+ CX_DEBUG(("Saving filename %s", filename.toAscii().data()));
+ data.insert(FILENAME_KEY, filename);
+
+ QImage img(mMainWindow->rect().size(), QImage::Format_ARGB32_Premultiplied);
+ QPainter p(&img);
+ mMainWindow->render(&p, mMainWindow->rect(), mMainWindow->rect());
+
+ QPixmap screenshot = QPixmap::fromImage(img);
+
+ params.insert("screenshot", screenshot);
+ if (mEngine->mode() == Cxe::ImageMode) {
+ mActivityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY, data, params);
+ } else {
+ mActivityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY, data, params);
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Clear activity from activity manager.
+ */
+void CxuiPostcaptureView::clearActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mActivityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
+ mActivityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
+ CX_DEBUG_EXIT_FUNCTION();
}
// ---------------------------------------------------------------------------
@@ -492,29 +585,48 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiPostcaptureView::setImage
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+ * Updates snapshot image. In normal case snapshot is retrieved from engine
+ * but if we are restoring camera to post-capture through activity, then
+ * we get snapshot from thumbnail manager.
+ */
void CxuiPostcaptureView::updateSnapshotImage()
{
CX_DEBUG_ENTER_FUNCTION();
- QPixmap snapshot;
+ if (!mFilename.isNull()) {
+ CX_DEBUG(("CxuiPostcaptureView::updateSnapshot restoring activity"));
+ // 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 (mEngine->mode() == ImageMode) {
- if( mEngine->stillCaptureControl().imageCount() > 0 ) {
- snapshot = mEngine->stillCaptureControl()[0].snapshot();
+ } else {
+ // file deleted
+ CX_DEBUG(("File %s has been deleted, going back to pre-capture", mFilename.toAscii().data()));
+ goToPrecaptureView();
}
} else {
- snapshot = mEngine->videoCaptureControl().snapshot();
- }
-
- if (mImageLabel) {
- mImageLabel->setIcon(HbIcon(QIcon(snapshot)));
- } else {
- // do nothing
+ QPixmap snapshot;
+ if (mEngine->mode() == ImageMode) {
+ 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
+ }
}
CX_DEBUG_EXIT_FUNCTION();
@@ -527,6 +639,15 @@
{
CX_DEBUG_ENTER_FUNCTION();
+ 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;
+ }
+
+ CX_DEBUG(("Getting filename from engine"));
QString filename;
if (mEngine->mode() == Cxe::VideoMode) {
@@ -560,27 +681,31 @@
}
/*!
- Handle cases when we gain focus
+* Handle exiting standby.
*/
-void CxuiPostcaptureView::handleFocusGained()
+void CxuiPostcaptureView::exitStandby()
{
CX_DEBUG_ENTER_FUNCTION();
- //Note: We should not start timers until we receive the ShowEvent
+ // Common functionality first.
+ CxuiView::exitStandby();
+
+ //!@note We should not start timers until we receive the ShowEvent
showControls();
CX_DEBUG_EXIT_FUNCTION();
}
/*!
- Handle cases when we loose focus
+* Handle entering standby.
*/
-void CxuiPostcaptureView::handleFocusLost()
+void CxuiPostcaptureView::enterStandby()
{
CX_DEBUG_ENTER_FUNCTION();
- // we have lost focus
- releaseCamera();
+ // Common functionality (release camera).
+ CxuiView::enterStandby();
+
stopTimers();
hideControls();
@@ -588,6 +713,32 @@
}
/*!
+ * 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)
+{
+ 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));
+ // null thumbnail, go to precapture
+ goToPrecaptureView();
+ } else if (mImageLabel) {
+ mImageLabel->setIcon(HbIcon(QIcon(thumbnail)));
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
Start the timers
*/
void CxuiPostcaptureView::startTimers()
@@ -611,6 +762,12 @@
{
CX_DEBUG_ENTER_FUNCTION();
+ if (!mFilename.isNull()) {
+ // restored from activity, don't do post-capture timeout
+ CX_DEBUG_EXIT_FUNCTION();
+ return;
+ }
+
int postCaptureTimeout = 0;
QString settingId;
@@ -640,10 +797,10 @@
{
CX_DEBUG_ENTER_FUNCTION();
- // Todo Note: Temporarily disabling release timer because of
- // graphics memory problems related to releasing and reserving again.
- // mReleaseCameraTimer.start(CXUI_RELEASE_CAMERA_TIMEOUT);
- // mStopViewfinderTimer.start(CXUI_STOP_VIEWFINDER_TIMEOUT);
+ // Release camera and stop viewfinder if user stays in postcapture long enough.
+ // Battery could otherwise drain fast.
+ mReleaseCameraTimer.start(CXUI_RELEASE_CAMERA_TIMEOUT);
+ mStopViewfinderTimer.start(CXUI_STOP_VIEWFINDER_TIMEOUT);
CX_DEBUG_EXIT_FUNCTION();
}
@@ -658,7 +815,7 @@
mPostcaptureTimer.stop();
mStopViewfinderTimer.stop();
- // Note: mTimersStarted is intentionally not reset here.
+ //!@note mTimersStarted is intentionally not reset here.
// Once the timers are stopped, they are not to be started again until
// we come from precapture view again.
// E.g. returning from background could otherwise restart the timers and
--- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -54,18 +54,20 @@
#include "cxuisettingslider.h"
#include "cxuisettingsinfo.h"
#include "OstTraceDefinitions.h"
+#include "cxuiserviceprovider.h"
+#include "cxuizoomslider.h"
+#include "cxuifullscreenpopup.h"
+
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cxuiprecaptureviewTraces.h"
#endif
-#include "cxuiserviceprovider.h"
-#include "cxuizoomslider.h"
+#include "cxegeotaggingtrail.h"
using namespace CxUiLayout;
using namespace CxUiSettings;
using namespace CxUiInternal;
-
// ---------------------------------------------------------------------------
// CxuiPrecaptureView::CxuiPrecaptureView
// Constructor
@@ -80,6 +82,9 @@
mSettingsDialog(NULL),
mSettingsDialogList(NULL),
mQualityIcon(NULL),
+ mGeoTaggingIndicatorIcon(NULL),
+ mFaceTrackingIcon(NULL),
+ mStandbyPopup(NULL),
mSettingsDialogHeading(NULL),
mSliderSettingsDialog(NULL),
mSliderSettingsDialogHeading(NULL),
@@ -111,12 +116,13 @@
*/
void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler * keyHandler)
+ CxuiCaptureKeyHandler * keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" );
- CxuiView::construct(mainWindow, engine, documentLoader, keyHandler);
+ CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager);
mSettingsInfo = new CxuiSettingsInfo(engine);
CX_DEBUG_ASSERT(mSettingsInfo);
@@ -133,6 +139,9 @@
connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)),
this, SLOT(handleVfStateChanged(CxeViewfinderControl::State, CxeError::Id)));
+ connect(&mEngine->geoTaggingTrail(), SIGNAL(stateChanged(CxeGeoTaggingTrail::State, CxeError::Id)),
+ this, SLOT(updateLocationIndicator(CxeGeoTaggingTrail::State, CxeError::Id)));
+
connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)),
this, SLOT(handleSettingValueChanged(const QString&, QVariant)));
@@ -150,27 +159,21 @@
connect(exitAction, SIGNAL(triggered()), CxuiServiceProvider::instance(), SLOT(sendFilenameToClientAndExit()));
setNavigationAction(exitAction);
}
+
OstTrace0( camerax_performance, DUP1_CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 0" );
QCoreApplication::instance()->installEventFilter(this);
CX_DEBUG_EXIT_FUNCTION();
}
-
-// ---------------------------------------------------------------------------
-// CxuiPrecaptureView::prepareWindow
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiPrecaptureView::prepareWindow()
+/*!
+* Is standby mode supported / needed by this view.
+* Pre-capture views implement / need standby mode and return true.
+* @return True if standby mode is supported, false otherwise.
+*/
+bool CxuiPrecaptureView::isStandbyModeSupported() const
{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (mMainWindow) {
- mEngine->viewfinderControl().setWindow(mMainWindow->effectiveWinId());
- }
-
- CX_DEBUG_EXIT_FUNCTION();
+ return true;
}
// ---------------------------------------------------------------------------
@@ -241,17 +244,23 @@
bool CxuiPrecaptureView::eventFilter(QObject *object, QEvent *event)
{
- Q_UNUSED(object)
-
bool eventWasConsumed = false;
switch (event->type())
{
case QEvent::GraphicsSceneMouseRelease:
- mHideControlsTimeout.start();
+ if (mStandbyPopup) {
+ mStandbyPopup->handleMouseRelease();
+ } else {
+ mHideControlsTimeout.start();
+ }
break;
case QEvent::GraphicsSceneMousePress:
- mHideControlsTimeout.stop();
+ if (object == mStandbyPopup) {
+ mStandbyPopup->handleMousePress();
+ } else {
+ mHideControlsTimeout.stop();
+ }
break;
default:
break;
@@ -423,18 +432,48 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
-/*
- * CxuiPrecaptureView::handleFocusGained
- */
-void CxuiPrecaptureView::handleFocusGained()
+/*!
+* Slot for entering standby mode.
+* Show standby canvas in addition to base class implementation.
+* @sa CxuiView::enterStandby()
+*/
+void CxuiPrecaptureView::enterStandby()
{
CX_DEBUG_ENTER_FUNCTION();
- // Set the window size and handle again.
- prepareWindow();
+ // Release camera right away to avoid any problems with GPU memory.
+ CxuiView::enterStandby();
+
+ // If this view is still the current view, show popup.
+ // If we moved to precapture view because (error) standby during capturing,
+ // don't try show the popup.
+ if (mMainWindow->currentView() == this) {
+ // Show standby canvas / popup.
+ if (!mStandbyPopup) {
+ mStandbyPopup = CxuiFullScreenPopup::create(scene(), hbTrId("txt_cam_info_camera_in_standby_mode"));
+ }
+ mStandbyPopup->show();
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot for exiting standby mode.
+* Hide the standby canvas and re-prepare camera.
+* @sa CxuiView::exitStandby()
+*/
+void CxuiPrecaptureView::exitStandby()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ CxuiView::exitStandby();
+
+ if (mStandbyPopup) {
+ mStandbyPopup->hide();
+ delete mStandbyPopup;
+ mStandbyPopup = NULL;
+ }
+
initCamera();
-
CX_DEBUG_EXIT_FUNCTION();
}
@@ -470,6 +509,14 @@
if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) {
showSettingsGrid();
}
+ // 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);
+ if (settingId == CxeSettingIds::GEOTAGGING && value == Cxe::GeoTaggingDisclaimerEnabled) {
+ // disable geotagging first-time-use dialog
+ disableGeotaggingDisclaimer();
+ }
}
// Clear the starter actions to be sure they are not reused.
@@ -720,16 +767,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/*!
-* Show "Disk full" notification.
-*/
-void CxuiPrecaptureView::launchDiskFullNotification()
-{
- CX_DEBUG_ENTER_FUNCTION();
- HbMessageBox::warning(hbTrId("txt_cam_info_memory_full"));
- CX_DEBUG_EXIT_FUNCTION();
-}
-
/**
* Show settings grid.
*/
@@ -762,36 +799,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/**
-* Get if postcapture view should be shown or not.
-* Postcapture view may be shown for a predefined time or
-* until user dismisses it, or it may be completely disabled.
-*/
-bool CxuiPrecaptureView::isPostcaptureOn() const
-{
- CX_DEBUG_ENTER_FUNCTION();
- if (CxuiServiceProvider::isCameraEmbedded()) {
- // always show post capture in embedded mode
- return true;
- }
-
- // Read the value from settings. Ignoring reading error.
- // On error (missing settings) default to "postcapture on".
- int showPostcapture(-1);
- QString key;
- if(mEngine) {
- if (mEngine->mode() == Cxe::ImageMode) {
- key = CxeSettingIds::STILL_SHOWCAPTURED;
- } else {
- key = CxeSettingIds::VIDEO_SHOWCAPTURED;
- }
- mEngine->settings().get(key, showPostcapture);
- }
-
- CX_DEBUG_EXIT_FUNCTION();
- return showPostcapture != 0; // 0 == no postcapture
-}
-
/*!
* Returns dialogs bottom right corner
*/
@@ -841,33 +848,6 @@
return icon;
}
-/*!
- Update the quality indicator
-*/
-void CxuiPrecaptureView::updateQualityIcon()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (mQualityIcon && mEngine) {
- QString key = "";
- QString icon = "";
- int currentValue = -1;
-
- if (mEngine->mode() == Cxe::VideoMode) {
- key = CxeSettingIds::VIDEO_QUALITY;
- } else {
- key = CxeSettingIds::IMAGE_QUALITY;
- }
-
- mEngine->settings().get(key, currentValue);
- icon = getSettingItemIcon(key, currentValue);
-
- mQualityIcon->setIcon(HbIcon(icon));
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
void CxuiPrecaptureView::handleSettingValueChanged(const QString& key, QVariant newValue)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -877,40 +857,102 @@
}
/*!
-* Update the scene mode icon.
-* @param sceneId The new scene id.
+ * Slot to keep track of state changes in GeotaggingLocation trail. We use these states to update
+ * the UI by enabling right icon.
+ */
+void CxuiPrecaptureView::updateLocationIndicator(CxeGeoTaggingTrail::State newState, CxeError::Id error)
+{
+ CX_DEBUG( ("CxuiPrecaptureView::updateLocationIndicator <> error: %d ", error));
+
+ if (mGeoTaggingIndicatorIcon) {
+ if (newState == CxeGeoTaggingTrail::DataAvailable && error == CxeError::None) {
+ CX_DEBUG(("CxuiPrecaptureView::updateLocationIndicator GPS data available, showing icon"));
+ mGeoTaggingIndicatorIcon->setIcon(HbIcon("qtg_mono_geotag"));
+ mGeoTaggingIndicatorIcon->show();
+ } else {
+ CX_DEBUG(("CxuiPrecaptureView::handleIconChanged GPS data not available"));
+ mGeoTaggingIndicatorIcon->hide();
+ }
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Lauches "Geotagging first-time use" notification to the user
*/
-void CxuiPrecaptureView::updateSceneIcon(const QString& sceneId)
+void CxuiPrecaptureView::launchGeoTaggingDisclaimerDialog()
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG(("CxuiPrecaptureView - scene: %s", sceneId.toAscii().constData()));
+
+ 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();
+
+ // initializing dialog's content widget
+ label->setPlainText(ftuMsg);
+ label->setTextWrapping(Hb::TextWordWrap);
+ label->setElideMode(Qt::ElideNone);
+ label->setMaximumWidth(350);
+ dialog->setContentWidget(label);
- // No need to update icon, if widgets are not even loaded yet.
- // We'll update the icon once the widgets are loaded.
- if (mWidgetsLoaded) {
+ // initializing dialog's actions
+ HbAction *okAction = new HbAction(actionOkTxt, dialog);
+ HbAction *settingsAction = new HbAction(actionSettingsTxt, dialog);
+ dialog->addAction(okAction);
+ dialog->addAction(settingsAction);
+
+ // connecting signals for dialog's actions
+ connect(okAction,
+ SIGNAL(triggered()),
+ this,
+ SLOT(disableGeotaggingDisclaimer()));
+
+ connect(settingsAction,
+ SIGNAL(triggered()),
+ this,
+ SLOT(launchGeoTaggingSetting()));
- QString key;
- QString iconObjectName;
- if (mEngine->mode() == Cxe::VideoMode) {
- key = CxeSettingIds::VIDEO_SCENE;
- iconObjectName = VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION;
- } else {
- key = CxeSettingIds::IMAGE_SCENE;
- iconObjectName = STILL_PRE_CAPTURE_SCENE_MODE_ACTION;
- }
+ // initializing dialog's properties
+ dialog->setTimeout(HbDialog::NoTimeout);
+ dialog->setDismissPolicy(HbPopup::NoDismiss);
+ dialog->setAttribute(Qt::WA_DeleteOnClose, true);
+ dialog->show();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot that disables Geotagging first-time use notification.
+*/
+void CxuiPrecaptureView::disableGeotaggingDisclaimer()
+{
+ CX_DEBUG_ENTER_FUNCTION();
- QString icon = getSettingItemIcon(key, sceneId);
- CX_DEBUG(("CxuiPrecaptureView - icon: %s", icon.toAscii().constData()));
+ // disable geotagging first-time-use dialog
+ mEngine->settings().set(CxeSettingIds::GEOTAGGING_DISCLAIMER, Cxe::GeoTaggingDisclaimerDisabled);
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
- if (mDocumentLoader) {
- QObject *obj = mDocumentLoader->findObject(iconObjectName);
- CX_DEBUG_ASSERT(obj);
- qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
- }
- } else {
- CX_DEBUG(("CxuiPrecaptureView - widgets not loaded yet, ignored!"));
- }
+/*!
+* Slot that accepts "Geotagging first-time use" note and launches geotagging setting dialog.
+*/
+void CxuiPrecaptureView::launchGeoTaggingSetting()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ QObject *action = sender();
+ action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::GEOTAGGING);
+ launchSettingsDialog(action);
+
CX_DEBUG_EXIT_FUNCTION();
}
// end of file
+
--- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -15,6 +15,7 @@
*
*/
#include <hbframeitem.h>
+#include <hbactivitymanager.h>
#include "cxenamespace.h"
#include "cxesettings.h"
@@ -77,10 +78,11 @@
void CxuiSceneModeView::construct(HbMainWindow *mainwindow,
CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler)
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
- CxuiView::construct(mainwindow, engine, documentLoader, keyHandler);
+ CxuiView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
mSettingsInfo = new CxuiSettingsInfo(mEngine);
setContentFullScreen(true);
@@ -119,7 +121,9 @@
//Assuming that the automatic scene mode is always the default one
CX_DEBUG(("CxuiSceneModeView::loadDefaultWidgets -> Now setting default image"));
- mScenesBackground->setIcon(HbIcon(CXUI_SCENES_AUTOMATIC_IMAGE));
+ HbIcon background(CXUI_SCENES_AUTOMATIC_IMAGE);
+ background.setMirroringMode(HbIcon::LayoutDirection);
+ mScenesBackground->setIcon(background);
widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS);
mScenesList = qobject_cast<CxuiSettingRadioButtonList *> (widget);
@@ -169,7 +173,9 @@
if (mScenesBackground) {
QString sceneId;
mEngine->settings().get(data.mSettingId, sceneId);
- mScenesBackground->setIcon(HbIcon(backgroundForScene(sceneId)));
+ HbIcon background(backgroundForScene(sceneId));
+ background.setMirroringMode(HbIcon::LayoutDirection);
+ mScenesBackground->setIcon(background);
} else {
//First time displaying a list
//Assuming that the automatic scene mode is always the default one and is on top of the list
@@ -179,6 +185,28 @@
}
/*!
+ * Save view state to activity. Scene mode view doesn't have it's own activity, just save
+ * correct pre-capture view.
+ */
+void CxuiSceneModeView::saveActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVariantMap data;
+ QVariantHash params;
+
+ //@todo: add pre-capture icon as screenshot
+ if (mEngine->mode() == Cxe::ImageMode) {
+ mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params);
+ } else {
+ mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
* Handle selecting value in scene list.
*/
void CxuiSceneModeView::handleSceneRadiobuttonPress(int index)
@@ -187,7 +215,9 @@
CxUiSettings::SettingItem item = mSettingPairList.at(index);
QString sceneId = item.mValue.toString();
- mScenesBackground2->setIcon(HbIcon(backgroundForScene(sceneId)));
+ HbIcon background(backgroundForScene(sceneId));
+ background.setMirroringMode(HbIcon::LayoutDirection);
+ mScenesBackground2->setIcon(background);
startBackgroundTransition();
CX_DEBUG_EXIT_FUNCTION();
}
@@ -200,25 +230,25 @@
QString CxuiSceneModeView::backgroundForScene(const QString& sceneId)
{
//!@todo: This mapping should be added to the setting xml.
- if (sceneId == CxeSettingIds::IMAGE_SCENE_AUTO) {
+ if (sceneId == Cxe::IMAGE_SCENE_AUTO) {
return CXUI_SCENES_AUTOMATIC_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_PORTRAIT) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_PORTRAIT) {
return CXUI_SCENES_PORTRAIT_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SCENERY) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_SCENERY) {
return CXUI_SCENES_LANDSCAPE_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_MACRO) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_MACRO) {
return CXUI_SCENES_CLOSEUP_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_SPORTS) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_SPORTS) {
return CXUI_SCENES_SPORT_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHT) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_NIGHT) {
return CXUI_SCENES_NIGHT_IMAGE;
- } else if (sceneId == CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT) {
+ } else if (sceneId == Cxe::IMAGE_SCENE_NIGHTPORTRAIT) {
return CXUI_SCENES_NIGHT_PORTRAIT_IMAGE;
- } else if (sceneId == CxeSettingIds::VIDEO_SCENE_AUTO) {
+ } else if (sceneId == Cxe::VIDEO_SCENE_AUTO) {
return CXUI_SCENES_AUTOMATIC_IMAGE;
- } else if (sceneId == CxeSettingIds::VIDEO_SCENE_LOWLIGHT) {
+ } else if (sceneId == Cxe::VIDEO_SCENE_LOWLIGHT) {
return CXUI_SCENES_LOW_LIGHT_IMAGE;
- } else if (sceneId == CxeSettingIds::VIDEO_SCENE_NIGHT) {
+ } else if (sceneId == Cxe::VIDEO_SCENE_NIGHT) {
return CXUI_SCENES_NIGHT_IMAGE;
} else {
return "";
@@ -293,6 +323,15 @@
}
/*!
+ * Play feedback when touching view outside of any widget?
+ * Feedback is not played in scene mode view.
+ */
+bool CxuiSceneModeView::isFeedbackEnabled() const
+{
+ return false;
+}
+
+/*!
* Slot to handle capture key full press.
*/
void CxuiSceneModeView::handleCaptureKeyPressed()
@@ -321,8 +360,6 @@
mScenesList->handleClose();
mScenesBackground->setIcon(HbIcon());
mScenesHeading = NULL;
- // Make sure engine prepares for new image/video if necessary
- mEngine->initMode(mEngine->mode());
emit viewCloseEvent();
CX_DEBUG_EXIT_FUNCTION();
}
--- a/camerauis/cameraxui/cxui/src/cxuiselftimer.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiselftimer.cpp Thu Jul 15 01:52:14 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,6 +18,10 @@
#include <hblabel.h>
#include <hbpushbutton.h>
+#ifdef Q_OS_SYMBIAN
+#include <ProfileEngineSDKCRKeys.h>
+#endif
+
#include "cxuiselftimer.h"
#include "cxutils.h"
#include "cxuienums.h"
@@ -53,13 +57,37 @@
mCancelButton(NULL),
mStartButton(NULL),
mSettings(settings),
- mSound(SELFTIMER_SOUND)
+ mSound(SELFTIMER_SOUND),
+ mUseSound(true)
{
CX_DEBUG_ENTER_FUNCTION();
connect(&mTimer, SIGNAL(timeout()), this, SLOT(timeout()));
mTimer.setSingleShot(false);
+ // connect to capture sound signal in order to monitor
+ // warning tone changes
+ connect(&mSettings,
+ SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)),
+ this, SLOT(enableSound(long int, unsigned long int, QVariant)));
+
+ // get initial warning tone value from profile
+ QVariant value(0);
+
+#ifdef Q_OS_SYMBIAN
+ // get current profile setting for using camerasound
+ // camera sound follows warning tone setting
+ unsigned long int key = KProEngActiveWarningTones;
+ long int uid = KCRUidProfileEngine.iUid;
+ mSettings.get(uid, key, Cxe::Repository, value);
+#endif
+
+ // possible values are:
+ // 0 -> warning tones off
+ // 1 -> warning tones on
+ mUseSound = (value.toInt() == 1);
+ CX_DEBUG(("Warning tones enabled [%d]", value.toInt()));
+
CX_DEBUG_EXIT_FUNCTION();
}
@@ -205,23 +233,28 @@
{
CX_DEBUG_ENTER_FUNCTION();
- int timeLeft = mDelay - mCounter;
+ // play sounds only if warning tones are enabled
+ if (mUseSound) {
+ CX_DEBUG(("play"));
+
+ int timeLeft = mDelay - mCounter;
- if (timeLeft <= 3) {
- // play as fast as we can
- if (mSound.isFinished()) {
- mSound.setLoops(-1);
- mSound.play();
- }
- } else if (timeLeft <= 10) {
- // play every second
- mSound.setLoops(1);
- mSound.play();
- } else {
- // play once every two seconds
- if (mCounter%2) {
+ if (timeLeft <= 3) {
+ // play as fast as we can
+ if (mSound.isFinished()) {
+ mSound.setLoops(-1);
+ mSound.play();
+ }
+ } else if (timeLeft <= 10) {
+ // play every second
mSound.setLoops(1);
mSound.play();
+ } else {
+ // play once every two seconds
+ if (mCounter%2) {
+ mSound.setLoops(1);
+ mSound.play();
+ }
}
}
@@ -356,6 +389,29 @@
mWidgetContainer->hide();
}
-
+}
+/*!
+ * Enables or disables the selftimer sound.
+ * \param uid UID of the changed setting
+ * \param key Key of the changed setting
+ * \param value New setting value
+ */
+void CxuiSelfTimer::enableSound(long int uid, unsigned long int key, QVariant value)
+{
+#ifdef Q_OS_SYMBIAN
+ // selftimer is only interested in warning tones
+ if (uid == KCRUidProfileEngine.iUid && key == KProEngActiveWarningTones) {
+ CX_DEBUG_IN_FUNCTION();
+ // possible values are:
+ // 0 -> warning tones off
+ // 1 -> warning tones on
+ mUseSound = (value.toInt() == 1);
+ }
+#else
+ Q_UNUSED(uid);
+ Q_UNUSED(key);
+ Q_UNUSED(value);
+#endif
}
+
--- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu Jul 15 01:52:14 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"
@@ -38,7 +38,9 @@
connect(this, SIGNAL(itemSelected(int)), this, SLOT(handleItemSelected(int)));
}
-
+/*!
+* Init contents of the listbox and select current setting value.
+*/
void CxuiSettingRadioButtonList::init(CxUiSettings::RadioButtonListParams *data)
{
// first we reset the model and clear any previous data
@@ -68,11 +70,12 @@
setSettingId(data->mSettingId);
setListBoxType(data->mListboxType);
- initOriginalSelectedItem();
- // ensure that currently selected item is visible
- scrollTo(currentIndex());
+ // 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()));
+ setOriginalSelectedItemByValue(QVariant(value));
}
-
}
/*!
@@ -91,30 +94,43 @@
// ensure that currently selected item is visible
scrollTo(currentIndex());
} else {
- CX_DEBUG(("Value %s not found", value.toString().toAscii().data()));
+ CX_DEBUG(("[WARNING] Value %s not found, defaulting to first item", value.toString().toAscii().data()));
}
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Set list texts.
+* @param values List of the texts.
+*/
void CxuiSettingRadioButtonList::setItems(const QStringList &values)
{
mListModel->setItems(values);
}
+/*!
+* Set the type of this list.
+* @param type Type identifier, SingleLine or TwoLine.
+*/
void CxuiSettingRadioButtonList::setListBoxType(int type)
{
mListModel->setListBoxType(type);
}
-
+/*!
+* Set id of the setting this list represents.
+* @param id Id of the setting.
+*/
void CxuiSettingRadioButtonList::setSettingId(const QString &id)
{
// Selected item is updated, when this list is shown.
mSettingId = id;
}
-
-
+/*!
+* Handle selecting an item.
+* @param index Index of the selected item in list.
+*/
void CxuiSettingRadioButtonList::handleItemSelected(int index)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -128,30 +144,6 @@
}
/*!
-* Get the value currently active in settings.
-*/
-void CxuiSettingRadioButtonList::initOriginalSelectedItem()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- QString value;
- int err = mEngine->settings().get(mSettingId, value);
- CX_DEBUG(("CxuiSettingRadioButtonList - original value: [%s]", value.toAscii().data()));
-
- int index = 0;
-
- if (err == CxeError::None) {
- index = mSettingValues.indexOf(QVariant(value));
- CX_DEBUG(("CxuiSettingRadioButtonList - got original index of: %d", index));
- }
-
- mOriginalIndex = index;
- setSelected(mOriginalIndex);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-/*!
This slot can be used to set the selection accepted.
*/
void CxuiSettingRadioButtonList::handleSelectionAccepted()
@@ -167,6 +159,11 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Handle closing the listbox. If the current selection was accepted,
+* we commit the new value here. If current selection has been cancelled,
+* we commit the original value.
+*/
void CxuiSettingRadioButtonList::handleClose()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -187,7 +184,7 @@
/*!
- Commits value to the cenrep store.
+ Commits value to settings.
*/
void CxuiSettingRadioButtonList::commit(int index)
{
--- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlistmodel.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlistmodel.cpp Thu Jul 15 01:52:14 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"
@@ -93,7 +93,7 @@
data = QVariant(list);
} else {
- CX_DEBUG(("[WARNING] CxuiSettingRadioButtonListModel: role is not DisplayRole!"));
+ // No action
}
CX_DEBUG_EXIT_FUNCTION();
--- a/camerauis/cameraxui/cxui/src/cxuistandby.cpp Thu Jul 15 01:49:11 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +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 <QTimer>
-#include <QApplication>
-#include <QGraphicsSceneEvent>
-#include <hblabel.h>
-#include <hbdialog.h>
-#include <hbinstantfeedback.h>
-#include <QGraphicsRectItem>
-#include <QColor>
-
-#include "cxutils.h"
-#include "cxeengine.h"
-#include "cxuienums.h"
-#include "cxuistandby.h"
-#include "cxuidocumentloader.h"
-#include "cxeviewfindercontrol.h"
-#include "cxuicapturekeyhandler.h"
-#include "cxestillcapturecontrol.h"
-#include "cxevideocapturecontrol.h"
-
-
-
-/*!
- * Constructor
- */
-CxuiStandby::CxuiStandby(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader, CxeEngine *engine)
-: mKeyHandler(keyHandler),
- mDocumentLoader(documentLoader),
- mEngine(engine),
- mStandbyPopup(NULL),
- mStandbyDialogVisible(false),
- mAllowDismiss(true)
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_ASSERT_ALWAYS(engine);
-
- // initialize standby timer
- mStandbyTimer = new QTimer(this);
-
- // install event filter for application wide events
- QCoreApplication::instance()->installEventFilter(this);
-
- CX_ASSERT_ALWAYS(mStandbyTimer);
- connect(mStandbyTimer, SIGNAL(timeout()), this, SLOT(enterStandby()));
- mStandbyTimer->setSingleShot(true);
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/*!
- * Destructor
- */
-CxuiStandby::~CxuiStandby()
-{
- CX_DEBUG_IN_FUNCTION();
- // remove the event filter
- QCoreApplication::instance()->removeEventFilter(this);
- // stop standby timer
- stopTimer();
-}
-
-
-/*!
-* Allow dismissing standby mode with AF or capture key?
-* @param allow Is dismissing allowed.
-*/
-void CxuiStandby::allowDismiss(bool allow)
-{
- CX_DEBUG_ENTER_FUNCTION();
- mAllowDismiss = allow;
- if (allow) {
- if (mStandbyDialogVisible) {
- // Reconnect the close signals if dialog is visible
- connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
- connect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
- }
- } else {
- disconnect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()));
- disconnect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close()));
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
-* Is standby mode active?
-* @return True, if standby mode is active, false if not.
-*/
-bool CxuiStandby::isActive() const
-{
- return mStandbyDialogVisible;
-}
-
-/*!
- * stops standby timer
- */
-void CxuiStandby::stopTimer()
-{
- if(mStandbyTimer) {
- mStandbyTimer->stop();
- }
-}
-
-/*!
- * starts standby timer
- */
-void CxuiStandby::startTimer()
-{
- if(mStandbyTimer) {
- mStandbyTimer->start(CXUI_STANDBY_CAMERA_TIMEOUT);
- }
-}
-
-/*!
- * Handles mouse press events
- * returns if mouse key press is consumed.
- * \param event event to be handled
- * \return boolean to indicate whether the event was handled or not
- */
-bool CxuiStandby::handleMouseEvent(QEvent *event)
-{
- bool keyHandled = false;
-
- // close the dialog if it's visible
- if (mStandbyDialogVisible && mStandbyPopup) {
- HbInstantFeedback feedback(HbFeedback::BasicItem);
- switch (event->type()) {
- case QEvent::GraphicsSceneMousePress:
- feedback.play();
- break;
- case QEvent::GraphicsSceneMouseRelease:
- if (mAllowDismiss) {
- CX_DEBUG(( "closing the popup mStandbyDialogVisible = : %d", mStandbyDialogVisible ));
- // 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
- //feedback.setModalities(HbFeedback::Tactile);
- //feedback.play();
- exitStandby();
- }
- break;
- default:
- break;
- }
- // eat all mouse events when standby is active
- keyHandled = true;
- } else if (mStandbyTimer && mStandbyTimer->isActive()) {
- // restart the timer only if it's running
- startTimer();
- }
-
- return keyHandled;
-}
-
-
-/*!
- * switching to standby.
- */
-void CxuiStandby::enterStandby()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (proceedToStandy()) {
-
- // signal for ui classes to prepare for standby
- emit aboutToEnterStandby();
-
- mStandbyDialogVisible = true;
-
- if (mStandbyPopup == NULL) {
- CX_DEBUG(("Loading standby DocML"));
- bool ok = false;
- // Use document loader to create popup
- mDocumentLoader->load(CxUiLayout::STANDBY_POPUP_XML, &ok);
- CX_DEBUG(("standby load ok=%d", ok));
- mStandbyPopup = qobject_cast<HbDialog*>(mDocumentLoader->findWidget(CxUiLayout::STANDBY_POPUP));
- CX_ASSERT_ALWAYS(mStandbyPopup);
- mStandbyPopup->setTimeout(HbDialog::NoTimeout);
- mStandbyPopup->setBackgroundFaded(false);
- mStandbyPopup->setPreferredPos(QPointF(0,0));
- // color of standby text is set in the code. It cannot be done in docml
- HbLabel* label = qobject_cast<HbLabel*>(mDocumentLoader->findWidget(CxUiLayout::STANDBY_TEXT_WIDGET));
- label->setTextColor(Qt::white);
-
- // connecting "abouttoclose" signal to dismissStandby
- connect(mStandbyPopup, SIGNAL(aboutToClose()), this, SLOT(dismissStandby()));
-
- // HbDialog's default background item is replaced with black rectangle
- QGraphicsRectItem *backgroundItem = new QGraphicsRectItem();
- QBrush blackBrush = QBrush(Qt::black);
- backgroundItem->setBrush(blackBrush);
- QGraphicsItem *origBgItem = mStandbyPopup->backgroundItem();
- backgroundItem->setRect(origBgItem->boundingRect());
- mStandbyPopup->setBackgroundItem(backgroundItem);
-
- }
-
- CX_ASSERT_ALWAYS(mStandbyPopup);
-
- mStandbyPopup->show();
- // connecting half press or full press key signal to dismiss standby
- connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
- connect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection);
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-/*!
-* Close the standby dialog.
-*/
-void CxuiStandby::exitStandby()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (mAllowDismiss && mStandbyDialogVisible && mStandbyPopup) {
- mStandbyPopup->close();
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-/*!
- * dismisses standby
- */
-void CxuiStandby::dismissStandby()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if(mStandbyDialogVisible) {
- // stop the standby timer and close the pop-up
- mStandbyDialogVisible = false;
- //restart timer
- startTimer();
- // signal for ui classes to prepare for standby exit
- emit aboutToExitStandby();
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/*!
- * checks if we can switch to standby
- */
-bool CxuiStandby::proceedToStandy()
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_ASSERT_ALWAYS(mEngine);
-
- bool ok = false;
- if (!mStandbyDialogVisible) {
- CX_DEBUG(("show standby dialog"));
- ok = true;
- }
-
- CX_DEBUG(( "CxuiStandby::proceedToStandy proceedToStandy: %d", ok ));
-
- return ok;
-}
-
-
-
-/*!
- * Event filter which filters application wide mouse events.
- */
-bool CxuiStandby::eventFilter(QObject *object, QEvent *event)
-{
- Q_UNUSED(object);
-
- bool eventWasConsumed = false;
- switch (event->type()) {
- case QEvent::GraphicsSceneMouseMove:
- case QEvent::GraphicsSceneMousePress:
- case QEvent::GraphicsSceneMouseRelease:
- eventWasConsumed = handleMouseEvent(event);
- break;
- default:
- break;
- }
- return eventWasConsumed;
-}
-
-// end of file
--- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -31,6 +31,7 @@
#include <hbdeviceprofile.h> // HbDeviceProfile
#include <hbmenu.h>
#include <hbicon.h>
+#include <hbactivitymanager.h>
#include "cxuiselftimer.h"
#include "cxeengine.h"
@@ -82,19 +83,28 @@
delete mSelfTimer;
}
+/*!
+ * Construct-method handles initialisation tasks for this class. Needs to be called
+ * before the instance of this class is used.
+ * @param mainwindow
+ * @param engine
+ * @param documentLoader
+ * @param keyHandler
+ */
void CxuiStillPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler)
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
OstTrace0( camerax_performance, CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 1" );
// constuct base class
- CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
+ CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
connect(&mEngine->autoFocusControl(), SIGNAL(stateChanged(CxeAutoFocusControl::State,CxeError::Id)),
this, SLOT(handleAutoFocusStateChanged(CxeAutoFocusControl::State,CxeError::Id)));
- connect(&mEngine->stillCaptureControl(), SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, int)),
+ connect(&mEngine->stillCaptureControl(), SIGNAL(snapshotReady(CxeError::Id, const QImage&, int)),
this, SLOT(handleSnapshot(CxeError::Id)));
connect(&mEngine->stillCaptureControl(), SIGNAL(stateChanged(CxeStillCaptureControl::State, CxeError::Id)),
this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id)));
@@ -111,10 +121,19 @@
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();
}
+/*!
+ * Loads default widgets in layouts xml.
+ */
void CxuiStillPrecaptureView::loadDefaultWidgets()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -130,6 +149,10 @@
mQualityIcon = qobject_cast<HbLabel *>(widget);
CX_DEBUG_ASSERT(mQualityIcon);
+ widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON);
+ mGeoTaggingIndicatorIcon = qobject_cast<HbLabel *>(widget);
+ CX_DEBUG_ASSERT(mGeoTaggingIndicatorIcon);
+
widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON);
mFaceTrackingIcon = qobject_cast<HbLabel *>(widget);
CX_DEBUG_ASSERT(mFaceTrackingIcon);
@@ -143,7 +166,10 @@
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 CxuiStillPrecaptureView::loadWidgets()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -261,11 +287,51 @@
hideControls();
+ // View is ready. Needed for startup performance automated testing.
+ emit viewReady();
+
OstTrace0( camerax_performance, DUP1_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_STILLPRECAPTUREVIEW_LOADWIDGETS 0" );
CX_DEBUG_EXIT_FUNCTION();
}
/*!
+ * Restore view state from activity.
+ */
+void CxuiStillPrecaptureView::restoreActivity(const QString &activityId, const QVariant &data)
+{
+ Q_UNUSED(activityId);
+ Q_UNUSED(data);
+
+ CX_DEBUG_ENTER_FUNCTION();
+ // no need to restore any state
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Save view state to activity.
+ */
+void CxuiStillPrecaptureView::saveActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVariantMap data;
+ QVariantHash params;
+ //@todo: add pre-capture icon as screenshot
+ mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Clear activity from activity manager.
+ */
+void CxuiStillPrecaptureView::clearActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
* Initializing settings grid
*/
void CxuiStillPrecaptureView::initializeSettingsGrid()
@@ -308,6 +374,82 @@
}
}
+/**
+* Get if postcapture view should be shown or not.
+* Postcapture view may be shown for a predefined time or
+* until user dismisses it, or it may be completely disabled.
+*/
+bool CxuiStillPrecaptureView::isPostcaptureOn() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (CxuiServiceProvider::isCameraEmbedded()) {
+ // always show post capture in embedded mode
+ CX_DEBUG_EXIT_FUNCTION();
+ return true;
+ }
+
+ // Read the value from settings. Ignoring reading error.
+ // On error (missing settings) default to "postcapture on".
+ int showPostcapture(-1);
+ if(mEngine) {
+ mEngine->settings().get(CxeSettingIds::STILL_SHOWCAPTURED, showPostcapture);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return showPostcapture != 0; // 0 == no postcapture
+}
+
+/*!
+* Update the scene mode icon.
+* @param sceneId The new scene id.
+*/
+void CxuiStillPrecaptureView::updateSceneIcon(const QString& sceneId)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mEngine->mode() == Cxe::ImageMode) {
+ CX_DEBUG(("CxuiStillPrecaptureView - scene: %s", sceneId.toAscii().constData()));
+
+ // No need to update icon, if widgets are not even loaded yet.
+ // We'll update the icon once the widgets are loaded.
+ if (mWidgetsLoaded) {
+
+ QString iconObjectName = STILL_PRE_CAPTURE_SCENE_MODE_ACTION;
+ QString icon = getSettingItemIcon(CxeSettingIds::IMAGE_SCENE, sceneId);
+
+ CX_DEBUG(("CxuiStillPrecaptureView - icon: %s", icon.toAscii().constData()));
+
+ if (mDocumentLoader) {
+ QObject *obj = mDocumentLoader->findObject(iconObjectName);
+ CX_DEBUG_ASSERT(obj);
+ qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
+ }
+ } else {
+ CX_DEBUG(("CxuiStillPrecaptureView - widgets not loaded yet, ignored!"));
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ Update the quality indicator
+*/
+void CxuiStillPrecaptureView::updateQualityIcon()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mQualityIcon && mEngine) {
+ QString icon = "";
+ int currentValue = -1;
+
+ mEngine->settings().get(CxeSettingIds::IMAGE_QUALITY, currentValue);
+ icon = getSettingItemIcon(CxeSettingIds::IMAGE_QUALITY, currentValue);
+
+ mQualityIcon->setIcon(HbIcon(icon));
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error)
{
@@ -328,7 +470,7 @@
}
}
} else {
- emit reportError(error);
+ emit errorEncountered(error);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -385,7 +527,9 @@
mEngine->stillCaptureControl().reset(); //! @todo: Do not delete snapshots before images are really saved
mEngine->stillCaptureControl().capture();
} else {
- launchDiskFullNotification();
+ // Inform that error was encountered.
+ // Error manager will show necessary message to user.
+ emit errorEncountered(CxeError::DiskFull);
}
}
} else {
@@ -453,7 +597,6 @@
default:
break;
}
- //}
CX_DEBUG_EXIT_FUNCTION();
}
@@ -598,9 +741,11 @@
* Handle change in viewfinder state.
*/
void CxuiStillPrecaptureView::handleViewfinderStateChanged(
- CxeViewfinderControl::State newState, CxeError::Id /*error*/)
+ CxeViewfinderControl::State newState, CxeError::Id error)
{
CX_DEBUG_ENTER_FUNCTION();
+ // Call base class to get standby timer and display always visible when needed.
+ CxuiPrecaptureView::handleVfStateChanged(newState, error);
if (newState == CxeViewfinderControl::Running) {
@@ -636,6 +781,11 @@
}
}
+/*!
+ * Signal used to reset mCapturePending after a short timeout. If the image
+ * cannot be captured within a given time of the key press, it is better to cancel
+ * the whole operation.
+ */
void CxuiStillPrecaptureView::resetCapturePendingFlag()
{
CX_DEBUG_IN_FUNCTION();
@@ -643,25 +793,6 @@
mCapturePending = false;
}
-/*!
-* Slot to handle application being sent to background.
-*/
-void CxuiStillPrecaptureView::handleFocusLost()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (mSelfTimer && mSelfTimer->isOngoing()) {
- // If self-timer is running, stop and reset the delay now.
- mSelfTimer->reset();
- }
-
- // Release camera as we are going to background.
- // If taking image is just ongoing, it will be cancelled by engine.
- releaseCamera();
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
/*
Slot for handling scene mode change
\param scene QVariantMap containing settings related to the new scene mode
@@ -690,6 +821,24 @@
CX_DEBUG_EXIT_FUNCTION();
}
+/*!
+* Enter standby mode.
+*/
+void CxuiStillPrecaptureView::enterStandby()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mSelfTimer && mSelfTimer->isOngoing()) {
+ // If self-timer is running, stop and reset the delay now.
+ mSelfTimer->reset();
+ }
+
+ // Base class handles releasing camera.
+ CxuiPrecaptureView::enterStandby();
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
/*
Slot for handling setting value changes. Notice that changing the scene mode
does not emit settingValueChanged signal.
--- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -31,6 +31,7 @@
#include <hbnotificationdialog.h>
#include <hbfeedbacksettings.h>
#include <hbfeedbacknamespace.h>
+#include <hbactivitymanager.h>
#include "cxuivideoprecaptureview.h"
#include "cxeengine.h"
@@ -96,17 +97,18 @@
void CxuiVideoPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler *keyHandler)
+ CxuiCaptureKeyHandler *keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
- CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler);
+ CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager);
mCaptureKeyHandler = keyHandler;
mVideoCaptureControl = &(engine->videoCaptureControl());
connect(&mElapsedTimer, SIGNAL(timeout()), this, SLOT(updateTimeLabels()));
- connect(mVideoCaptureControl, SIGNAL(snapshotReady(CxeError::Id, const QPixmap&, const QString&)),
+ 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)));
@@ -274,11 +276,50 @@
// Initialize the video time counters.
updateTimeLabels();
+ // View is ready. Needed for startup performance automated testing.
+ emit viewReady();
CX_DEBUG_EXIT_FUNCTION();
}
/*!
+ * Restore view state from activity.
+ */
+void CxuiVideoPrecaptureView::restoreActivity(const QString &activityId, const QVariant &data)
+{
+ Q_UNUSED(activityId);
+ Q_UNUSED(data);
+
+ CX_DEBUG_ENTER_FUNCTION();
+ // no need to restore any state
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Save view state to activity.
+ */
+void CxuiVideoPrecaptureView::saveActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QVariantMap data;
+ QVariantHash params;
+ //@todo: add pre-capture icon as screenshot
+ mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
+ mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ * Clear activity from activity manager.
+ */
+void CxuiVideoPrecaptureView::clearActivity()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
* Initialize settings grid.
*/
void CxuiVideoPrecaptureView::initializeSettingsGrid()
@@ -304,6 +345,82 @@
}
}
+/**
+* Get if postcapture view should be shown or not.
+* Postcapture view may be shown for a predefined time or
+* until user dismisses it, or it may be completely disabled.
+*/
+bool CxuiVideoPrecaptureView::isPostcaptureOn() const
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (CxuiServiceProvider::isCameraEmbedded()) {
+ // always show post capture in embedded mode
+ CX_DEBUG_EXIT_FUNCTION();
+ return true;
+ }
+
+ // Read the value from settings. Ignoring reading error.
+ // On error (missing settings) default to "postcapture on".
+ int showPostcapture(-1);
+ if(mEngine) {
+ mEngine->settings().get(CxeSettingIds::VIDEO_SHOWCAPTURED, showPostcapture);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+ return showPostcapture != 0; // 0 == no postcapture
+}
+
+/*!
+* Update the scene mode icon.
+* @param sceneId The new scene id.
+*/
+void CxuiVideoPrecaptureView::updateSceneIcon(const QString& sceneId)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mEngine->mode() == Cxe::VideoMode) {
+ CX_DEBUG(("CxuiPrecaptureView - scene: %s", sceneId.toAscii().constData()));
+
+ // No need to update icon, if widgets are not even loaded yet.
+ // We'll update the icon once the widgets are loaded.
+ if (mWidgetsLoaded) {
+ QString iconObjectName = VIDEO_PRE_CAPTURE_SCENE_MODE_ACTION;
+ QString icon = getSettingItemIcon(CxeSettingIds::VIDEO_SCENE, sceneId);
+
+ CX_DEBUG(("CxuiVideoPrecaptureView - icon: %s", icon.toAscii().constData()));
+
+ if (mDocumentLoader) {
+ QObject *obj = mDocumentLoader->findObject(iconObjectName);
+ CX_DEBUG_ASSERT(obj);
+ qobject_cast<HbAction *>(obj)->setIcon(HbIcon(icon));
+ }
+ } else {
+ CX_DEBUG(("CxuiVideoPrecaptureView - widgets not loaded yet, ignored!"));
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+ Update the quality indicator
+*/
+void CxuiVideoPrecaptureView::updateQualityIcon()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ if (mQualityIcon && mEngine) {
+ QString icon = "";
+ int currentValue = -1;
+
+ mEngine->settings().get(CxeSettingIds::VIDEO_QUALITY, currentValue);
+ icon = getSettingItemIcon(CxeSettingIds::VIDEO_QUALITY, currentValue);
+
+ mQualityIcon->setIcon(HbIcon(icon));
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
void CxuiVideoPrecaptureView::handleSnapshot(CxeError::Id /*error*/)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -322,7 +439,7 @@
mMenu = takeMenu();
mVideoCaptureControl->record();
} else {
- launchDiskFullNotification();
+ emit errorEncountered(CxeError::DiskFull);
}
CX_DEBUG_EXIT_FUNCTION();
@@ -373,6 +490,20 @@
return show;
}
+/*!
+ * Play feedback when touching view outside of any widget?
+ * If video is paused feedback is off. Otherwise on.
+ */
+bool CxuiVideoPrecaptureView::isFeedbackEnabled() const
+{
+ CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state());
+ if (state == CxeVideoCaptureControl::Paused) {
+ return false;
+ } else {
+ return true;
+ }
+}
+
// CxuiPrecaptureView::showToolbar()
// Shows toolbar. Calls the base class implementation if not recording
// since toolbar is not shown during recording
@@ -570,6 +701,7 @@
break;
case CxeVideoCaptureControl::Recording:
hideControls();
+ emit stopStandbyTimer();
if (mDocumentLoader){
mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_RECORDING);
}
@@ -604,7 +736,7 @@
//}
enableFeedback();
-
+ emit startStandbyTimer();
mElapsedTimer.stop();
hideControls();
@@ -664,19 +796,11 @@
disconnect(mVideoCaptureControl, SIGNAL(videoComposed(CxeError::Id, const QString&)),
this, SLOT(prepareNewVideo(CxeError::Id)));
} else {
- emit reportError(error);
+ emit errorEncountered(error);
}
}
-/**
-* Toggle video light on / off.
-*/
-void CxuiVideoPrecaptureView::toggleLight()
-{
- launchNotSupportedNotification();
-}
-
void CxuiVideoPrecaptureView::handleQuitClicked()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -696,25 +820,6 @@
CX_DEBUG_EXIT_FUNCTION();
}
-void CxuiVideoPrecaptureView::handleFocusLost()
-{
- CX_DEBUG_IN_FUNCTION();
- // Release camera. Stopping possibly ongoing recording is handled by engine.
- releaseCamera();
-}
-
-void CxuiVideoPrecaptureView::handleBatteryEmpty()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- CxeVideoCaptureControl::State state = mVideoCaptureControl->state();
- if (state == CxeVideoCaptureControl::Recording){
- stop(); // delete recording icon
- }
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
void CxuiVideoPrecaptureView::launchVideoScenePopup()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -822,3 +927,4 @@
}
//end of file
+
--- a/camerauis/cameraxui/cxui/src/cxuiview.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -65,7 +65,8 @@
*/
void CxuiView::construct(HbMainWindow *mainWindow, CxeEngine *engine,
CxuiDocumentLoader *documentLoader,
- CxuiCaptureKeyHandler * keyHandler)
+ CxuiCaptureKeyHandler * keyHandler,
+ HbActivityManager *activityManager)
{
CX_DEBUG_ENTER_FUNCTION();
@@ -73,11 +74,13 @@
CX_ASSERT_ALWAYS(mainWindow);
CX_ASSERT_ALWAYS(engine);
CX_ASSERT_ALWAYS(documentLoader);
+ CX_ASSERT_ALWAYS(activityManager);
mMainWindow = mainWindow;
mDocumentLoader = documentLoader;
mCaptureKeyHandler = keyHandler;
mEngine = engine;
+ mActivityManager = activityManager;
// adjust the timer, and connect it to correct slot
connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls()));
@@ -86,6 +89,18 @@
}
/*!
+* Is standby mode supported / needed by this view.
+* Default implementation returns false.
+* Inherited classes need to re-implement this if standby mode is needed.
+* @return True if standby mode is supported, false otherwise.
+*/
+bool CxuiView::isStandbyModeSupported() const
+{
+ return false;
+}
+
+
+/*!
* CxuiView::updateOrientation
*/
void CxuiView::updateOrientation(Qt::Orientation orientation)
@@ -106,6 +121,32 @@
CX_DEBUG_EXIT_FUNCTION();
}
+
+/*!
+ * Restore view state from activity. Default implementation does nothing.
+ */
+void CxuiView::restoreActivity(const QString &activityId, const QVariant &data)
+{
+ Q_UNUSED(activityId);
+ Q_UNUSED(data);
+}
+
+/*!
+ * Save view state to activity. Default implementation does nothing.
+ */
+void CxuiView::saveActivity()
+{
+
+}
+
+/*!
+ * Clear activity from activity manager. Default implementation does nothing.
+ */
+void CxuiView::clearActivity()
+{
+
+}
+
/*!
* Allow showing UI controls?
* Default behaviour is that controls can be shown at any time.
@@ -116,6 +157,15 @@
}
/*!
+ * Play feedback when touching view outside of any widget?
+ * Default behaviour is that feedback is always played.
+ */
+bool CxuiView::isFeedbackEnabled() const
+{
+ return true;
+}
+
+/*!
* Toggle visibility of UI controls.
*/
void CxuiView::toggleControls()
@@ -132,6 +182,26 @@
}
/*!
+* Slot for entering standby mode.
+* By default, release camera.
+*/
+void CxuiView::enterStandby()
+{
+ CX_DEBUG_IN_FUNCTION();
+ releaseCamera();
+ CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
+* Slot for exiting standby mode.
+* By default, no action needed.
+*/
+void CxuiView::exitStandby()
+{
+ CX_DEBUG_IN_FUNCTION();
+}
+
+/*!
* CxuiView::launchNotSupportedNotification
* Show "not supported" notification.
*/
@@ -158,6 +228,8 @@
*/
void CxuiView::launchPhotosApp()
{
+ // Release camera device in order to free resources for Photos application
+ releaseCamera();
QProcess::startDetached(PhotosAppExe);
}
@@ -167,8 +239,7 @@
*/
void CxuiView::launchVideosApp()
{
- //Releasing cameda device in order to free
- //graphical memory
+ // Release camera device in order to free resources for Videos application
releaseCamera();
QProcess::startDetached(VideosAppExe);
}
@@ -367,7 +438,8 @@
void CxuiView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
//! @todo temporary workaround for title bar mouse event handling bug
- if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) {
+ if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70 &&
+ isFeedbackEnabled()) {
mControlsFeedback.setModalities(HbFeedback::All);
mControlsFeedback.play();
event->accept();
@@ -382,7 +454,8 @@
void CxuiView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
//! @todo temporary workaround for title bar mouse event handling bug
- if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70) {
+ 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);
@@ -391,4 +464,5 @@
event->accept();
}
}
+
// End of file
--- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -20,9 +20,11 @@
#include <coemain.h>
#include <QGraphicsSceneEvent>
#include <hbstyleloader.h>
+#include <hbactivitymanager.h>
+#include <hbaction.h>
#include "cxuiapplication.h"
-#include "cxuiapplicationframeworkmonitor.h"
+#include "cxuiapplicationstate.h"
#include "cxuiviewmanager.h"
#include "cxuivideoprecaptureview.h"
#include "cxuistillprecaptureview.h"
@@ -36,8 +38,6 @@
#include "cxuienums.h"
#include "cxutils.h"
#include "cxuidocumentloader.h"
-#include "cxuistandby.h"
-#include "cxuierrormanager.h"
#include "cxesettings.h"
#include "cxememorymonitor.h"
#include "cxuiserviceprovider.h"
@@ -52,68 +52,67 @@
using namespace Cxe;
using namespace CxUiLayout;
+namespace
+{
+ static const int CXUI_STANDBY_CAMERA_TIMEOUT = 60000; // 60 seconds
+}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::CxuiViewManager
-//
-// ---------------------------------------------------------------------------
-//
+
+/*!
+* Constructor.
+*/
CxuiViewManager::CxuiViewManager(CxuiApplication &application, HbMainWindow &mainWindow, CxeEngine &engine) :
mApplication(application),
mMainWindow(mainWindow),
- mStillPrecaptureView(NULL),
- mVideoPrecaptureView(NULL),
- mPostcaptureView(NULL),
mEngine(engine),
mKeyHandler(NULL),
- mApplicationMonitor(NULL),
mCameraDocumentLoader(NULL),
+ mApplicationState(NULL),
+ mErrorManager(NULL),
mSceneModeView(NULL)
{
CX_DEBUG_ENTER_FUNCTION();
- // Application monitor
- mApplicationMonitor = new CxuiApplicationFrameworkMonitor(mApplication, mEngine.settings());
- connect(mApplicationMonitor, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)),
- this, SLOT(handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)));
- connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty()));
- connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)), this, SLOT(showUsbErrorPopup(bool)));
-
- // Connect memory monitor start / stop to focused status
- connect(this, SIGNAL(focusGained()), &mEngine.memoryMonitor(), SLOT(startMonitoring()));
- connect(this, SIGNAL(focusLost()), &mEngine.memoryMonitor(), SLOT(stopMonitoring()));
+ // create mappings to map view name to correct docml file
+ 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);
// Key handler
mKeyHandler = new CxuiCaptureKeyHandler(mEngine);
- mMainWindow.installEventFilter(this); // in order to filter capture and AF keys
-
+ // Document loader
OstTrace0( camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1" );
mCameraDocumentLoader = new CxuiDocumentLoader(&engine);
OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0" );
- // standby functionality and necessary signal connections
- mStandbyHandler = new CxuiStandby(*mKeyHandler, mCameraDocumentLoader, &mEngine);
-
- connect(mStandbyHandler, SIGNAL(aboutToEnterStandby()),this, SLOT(aboutToLooseFocus()));
- connect(mStandbyHandler, SIGNAL(aboutToExitStandby()),this, SLOT(aboutToGainFocus()));
+ // Application state
+ mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), *mKeyHandler, mCameraDocumentLoader);
+ CX_ASSERT_ALWAYS(mApplicationState);
+ bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)),
+ this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State)));
+ Q_ASSERT_X(ok, "CxuiViewManager", "Application state change signal connect failed.");
+ connect(this, SIGNAL(standbyExitRequested()), mApplicationState, SLOT(exitStandby()), Qt::QueuedConnection);
- // error manager, handling errors and notifying users based on their severity
- mErrorManager = new CxuiErrorManager(*mKeyHandler, mCameraDocumentLoader);
+ // Standby timer
+ mStandbyTimer.setInterval(CXUI_STANDBY_CAMERA_TIMEOUT);
+ mStandbyTimer.setSingleShot(true);
+ connect(&mStandbyTimer, SIGNAL(timeout()), mApplicationState, SLOT(enterStandby()));
- // connecting necessary signals from error manager to release and init camera.
- connect(mErrorManager, SIGNAL(aboutToRecoverError()), this, SLOT(aboutToLooseFocus()));
- connect(mErrorManager, SIGNAL(errorRecovered()), this, SLOT(aboutToGainFocus()));
+ // Filter capture and AF keys and follow user activity from mouse events.
+ QCoreApplication::instance()->installEventFilter(this);
+
+ // Monitor memory on normal state, not on standby, error or background.
+ connect(this, SIGNAL(normalStateEntered()), &mEngine.memoryMonitor(), SLOT(startMonitoring()));
+ connect(this, SIGNAL(normalStateExited()), &mEngine.memoryMonitor(), SLOT(stopMonitoring()));
//connecting initmode signals
connect(&mEngine.cameraDeviceControl(), SIGNAL(initModeComplete(CxeError::Id)),
- this, SLOT(createPostcaptureView()));
-
- connect(&mEngine.cameraDeviceControl(), SIGNAL(initModeComplete(CxeError::Id)),
- mErrorManager, SLOT(showPopup(CxeError::Id)));
+ mApplicationState, SLOT(handleApplicationError(CxeError::Id)));
connect(&mEngine.stillCaptureControl(), SIGNAL(imageCaptured(CxeError::Id, int)),
- mErrorManager, SLOT(showPopup(CxeError::Id)));
+ mApplicationState, SLOT(handleApplicationError(CxeError::Id)));
// Register stylesheet. It will be automatically destroyed on application
// exit.
@@ -123,58 +122,154 @@
// will be created once we know the mode we are starting to.
initStartupView();
+ // For UI startup testing, we need to emit applicationReady signal once UI is ready to be used.
+ connect(mMainWindow.currentView(), SIGNAL(viewReady()), &mApplication, SIGNAL(applicationReady()));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+
+/*!
+* Destructor.
+*/
+CxuiViewManager::~CxuiViewManager()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ QCoreApplication::instance()->removeEventFilter(this);
+
+ if (!CxuiServiceProvider::isCameraEmbedded()) {
+ currentView()->saveActivity();
+ }
+
+ delete mApplicationState;
+ delete mCameraDocumentLoader;
+ delete mKeyHandler;
+
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::~CxuiViewManager
-//
-// ---------------------------------------------------------------------------
-//
-CxuiViewManager::~CxuiViewManager()
+
+
+/*!
+* Handle change in overall state of application.
+* @param newState The new application state.
+*/
+void CxuiViewManager::handleApplicationStateChanged(CxuiApplicationState::State newState,
+ CxuiApplicationState::State oldState)
+{
+ Q_UNUSED(oldState);
+ CX_DEBUG_ENTER_FUNCTION();
+
+ CxuiView *view = qobject_cast<CxuiView *>(mMainWindow.currentView());
+ CX_DEBUG(("CxuiViewManager - current view %d", view));
+
+ switch (newState) {
+ case CxuiApplicationState::Normal:
+ // Disable raising to foreground with capture key.
+ disconnect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground()));
+
+ connectSignals(view);
+
+ CX_DEBUG(("CxuiViewManager - emitting normalStateEntered"));
+ emit normalStateEntered();
+ break;
+ case CxuiApplicationState::Standby:
+ if (view && !view->isStandbyModeSupported()) {
+ // If we move to Stanby, and current view does not
+ // support standby mode, move to Normal mode right away.
+ CX_DEBUG(("CxuiViewManager - view does not support stanbdy, exiting standby right away.."));
+ mApplicationState->exitStandby();
+ } else {
+ handleExitingNormalState();
+ }
+ break;
+ case CxuiApplicationState::Error:
+ case CxuiApplicationState::Background:
+ handleExitingNormalState();
+
+ if (newState == CxuiApplicationState::Background) {
+ // Moved to background.
+ // Bring application back to foreground by capture key press
+ connect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground()));
+ }
+ break;
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Helper method to handle (possible) exiting from normal state.
+* @param oldState The previous state.
+*/
+void CxuiViewManager::handleExitingNormalState()
{
CX_DEBUG_ENTER_FUNCTION();
+ // Store view that is active now.
+ CxuiView *view = qobject_cast<CxuiView *>(mMainWindow.currentView());
+ CX_DEBUG(("CxuiViewManager - current view %d", view));
- delete mCameraDocumentLoader;
- delete mKeyHandler;
- delete mApplicationMonitor;
+ // Emit signal so current view can enter standby.
+ emit normalStateExited();
+ // Disconnect signals so we don't send key event's etc.
+ // Using the view before normalStateExited() signal was emitted,
+ // just in case it caused view switch.
+ disconnectSignals(view);
+ // Make sure standby timer is not running.
+ stopStandbyTimer();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+/*!
+* Slot for starting standby timer.
+*/
+void CxuiViewManager::startStandbyTimer()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mStandbyTimer.start();
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Slot for stopping standby timer.
+*/
+void CxuiViewManager::stopStandbyTimer()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ mStandbyTimer.stop();
CX_DEBUG_EXIT_FUNCTION();
}
/**
-* Temporary method to check if camera startup should be proceeded after creating view mananger.
-*/
-bool CxuiViewManager::proceedStartup()
+ * Init engine to correct mode based on activity being restored.
+ */
+void CxuiViewManager::initEngine()
{
- return !mStandbyHandler->isActive();
-}
-
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::prepareWindow
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::prepareWindow()
-{
- getPrecaptureView(mEngine.mode(), mEngine.cameraDeviceControl().cameraIndex())->prepareWindow();
+ 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);
+ }
}
/*!
-* Check if we need to take special actions in startup.
-* USB mass memory mode atleast requires us to enter error standby mode,
-* where user can only exit or fix the issue (remove cable).
-*/
-void CxuiViewManager::startupCheck()
+ * Helper function to return current view cast to CxuiView.
+ */
+CxuiView* CxuiViewManager::currentView() const
{
- CX_DEBUG_ENTER_FUNCTION();
-
- if (mApplicationMonitor && mApplicationMonitor->isUsbMassMemoryModeActive()) {
- showUsbErrorPopup(true);
- }
-
- CX_DEBUG_EXIT_FUNCTION();
+ CxuiView *view = qobject_cast<CxuiView*> (mMainWindow.currentView());
+ CX_ASSERT_ALWAYS(view);
+ return view;
}
/*!
@@ -184,25 +279,7 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (!CxuiServiceProvider::isCameraEmbedded()) {
- // For embedded mode: don't create view yet, create
- // when engine inits to correct mode
- CX_DEBUG_ASSERT(mEngine.cameraDeviceControl().cameraIndex() == Cxe::PrimaryCameraIndex);
- if (mEngine.mode() == Cxe::VideoMode) {
- createVideoPrecaptureView();
- mMainWindow.blockSignals(true);
- mMainWindow.setCurrentView(mVideoPrecaptureView, false);
- mMainWindow.blockSignals(false);
- } else {
- createStillPrecaptureView();
- mMainWindow.blockSignals(true);
- mMainWindow.setCurrentView(mStillPrecaptureView, false);
- mMainWindow.blockSignals(false);
- }
- connectPreCaptureSignals();
-
- startupCheck();
- } else {
+ if (mApplication.activateReason() == Hb::ActivationReasonService) {
// 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)),
@@ -210,86 +287,132 @@
connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)),
this, SLOT(changeToPrecaptureView()));
- // start standby timer now because view will not be ready when viewfinder is started
- mStandbyHandler->startTimer();
+ } else if (mApplication.activateReason() == Hb::ActivationReasonActivity ) {
+ // restoring activity, read startup view from stored activity
+
+ // view to start in
+ QString viewName = STILL_PRE_CAPTURE_VIEW;
+
+ bool preCapture = true;
+ QString activityId = mApplication.activateId();
+ if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY) {
+ viewName = STILL_PRE_CAPTURE_VIEW;
+ } else if (activityId == CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY) {
+ viewName = POSTCAPTURE_VIEW;
+ preCapture = false;
+ } else if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) {
+ viewName = VIDEO_PRE_CAPTURE_VIEW;
+ } else if (activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) {
+ viewName = POSTCAPTURE_VIEW;
+ preCapture = false;
+ }
+
+ CxuiView *view = createView(viewName);
+ mMainWindow.setCurrentView(view, false);
+
+ if (preCapture) {
+ connectPreCaptureSignals();
+ } else {
+ connectPostCaptureSignals();
+ }
+
+ // Check the current application state, signalled to handleApplicationStateChanged.
+ mApplicationState->startMonitoring();
+
+ // restore view from activity
+ bool ok = mApplication.activityManager()->waitActivity();
+
+ view->restoreActivity(activityId,
+ mApplication.activityManager()->activityData(mApplication.activateId()));
+
+ clearAllActivities();
+ } else {
+ // normal start
+ // no activity id, get default view from engine state
+ CxuiView *view = NULL;
+ if (mEngine.mode() == Cxe::VideoMode) {
+ view = createView(VIDEO_PRE_CAPTURE_VIEW);
+ } else {
+ view = createView(STILL_PRE_CAPTURE_VIEW);
+ }
+
+ mMainWindow.setCurrentView(view, false);
+ connectPreCaptureSignals();
+
+ // Check the current application state, signalled to handleApplicationStateChanged.
+ mApplicationState->startMonitoring();
+
+ clearAllActivities();
}
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::createStillPrecaptureView
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::createStillPrecaptureView()
-{
- CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATESTILLPRECAPTUREVIEW, "msg: e_CX_CREATE_STILLPRECAPTUREVIEW 1" );
-
- // Use document loader to create widgets and layouts
- // (non-sectioned parts are parsed and loaded)
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_LOAD 1" );
-
- bool ok = false;
- CX_DEBUG_ASSERT(mCameraDocumentLoader);
- mCameraDocumentLoader->load(STILL_1ST_XML, &ok);
- Q_ASSERT_X(ok, "createStillPrecaptureView", "error in xml file parsing");
-
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_CREATESTILLPRECAPTUREVIEW, "msg: e_CX_DOCLOADER_LOAD 0" );
-
- OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 1" );
- QGraphicsWidget *widget = NULL;
- // ask for the still precapture view widget pointer
- widget = mCameraDocumentLoader->findWidget(STILL_PRE_CAPTURE_VIEW);
- mStillPrecaptureView = qobject_cast<CxuiStillPrecaptureView *> (widget);
- CX_DEBUG_ASSERT(mStillPrecaptureView);
- OstTrace0( camerax_performance, DUP5_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 0" );
-
- // call for needed consturction methods
- mStillPrecaptureView->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler);
- // .. and add to main window (which also takes ownership)
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 1" );
- mMainWindow.addView(widget);
- OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 0" );
-
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATESTILLPRECAPTUREVIEW, "msg: e_CX_CREATE_STILLPRECAPTUREVIEW 0" );
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::createStillScenesView
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::createSceneModesView()
+/*!
+* Create view and add it to main window.
+*/
+CxuiView* CxuiViewManager::createView(const QString &viewName)
{
CX_DEBUG_ENTER_FUNCTION();
- bool ok = false;
- CX_DEBUG_ASSERT(mCameraDocumentLoader);
- CxuiDocumentLoader *documentLoader = new CxuiDocumentLoader(&mEngine);
- // Use document loader to create widgets and layouts
- // (non-sectioned parts are parsed and loaded)
- documentLoader->load(SCENEMODE_SETTING_XML, &ok);
+ OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_VIEW 1" );
+
+ CX_DEBUG(("View name: %s", viewName.toAscii().data()));
- QGraphicsWidget *widget = NULL;
+ CxuiView* view = mViews[viewName];
+ if (view == NULL) {
+ CX_DEBUG(("View not loaded yet, loading now"));
+ bool ok = false;
+ // 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(!docmlFile.isNull());
+
+ OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_LOAD 1" );
+
+ mCameraDocumentLoader->load(docmlFile, &ok);
+
+ Q_ASSERT_X(ok, "createView", "error in xml file parsing");
+
+ OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_DOCLOADER_LOAD 0" );
- // ask for the scenes mode view widget pointer
- widget = documentLoader->findWidget(STILL_SCENES_VIEW);
- Q_ASSERT_X(ok && (widget != 0), "camerax ui", "invalid xml file");
- mSceneModeView = qobject_cast<CxuiSceneModeView *> (widget);
+ OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_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" );
+
+ // 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" );
+ mMainWindow.addView(view);
+ mViews.insert(viewName, view);
- // call for needed construction methods
- mSceneModeView->construct(&mMainWindow, &mEngine, documentLoader, mKeyHandler);
- // .. and add to main window (which also takes ownership)
- mMainWindow.addView(widget);
+ 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" );
+
+ }
+
+ 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();
- connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
- delete documentLoader;
CX_DEBUG_EXIT_FUNCTION();
+ return mSceneModeView;
}
/*!
@@ -299,6 +422,9 @@
void CxuiViewManager::showScenesView()
{
CX_DEBUG_ENTER_FUNCTION();
+ // Disconnect signals from old view.
+ disconnectSignals();
+
if (!mSceneModeView) {
createSceneModesView();
}
@@ -306,141 +432,80 @@
mSceneModeView->loadBackgroundImages();
}
CX_DEBUG_ASSERT(mSceneModeView);
- mMainWindow.blockSignals(true);
mMainWindow.setCurrentView(mSceneModeView, false);
- emit disableStandbyTimer();
- connectCaptureKeySignals();
- mMainWindow.blockSignals(false);
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::createVideoPrecaptureView
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::createVideoPrecaptureView()
-{
- CX_DEBUG_ENTER_FUNCTION();
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATEVIDEOPRECAPTUREVIEW, "msg: e_CX_CREATE_VIDEOPRECAPTUREVIEW 1" );
-
- CX_DEBUG_ASSERT(mCameraDocumentLoader);
-
- bool ok = false;
- // load and create the default widgets in video xml
- mCameraDocumentLoader->load(VIDEO_1ST_XML, &ok);
- CX_DEBUG_ASSERT(ok);
-
- // get pointer to videoprecaptureview and do some initialisation
- QGraphicsWidget *widget = NULL;
- widget = mCameraDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIEW);
- mVideoPrecaptureView = qobject_cast<CxuiVideoPrecaptureView *> (widget);
- CX_DEBUG_ASSERT(mVideoPrecaptureView);
- mVideoPrecaptureView->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler);
-
- // add view to main window
- OstTrace0( camerax_performance, DUP3_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 1" );
- mMainWindow.addView(mVideoPrecaptureView);
- OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 0" );
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATEVIDEOPRECAPTUREVIEW, "msg: e_CX_CREATE_VIDEOPRECAPTUREVIEW 0" );
+ stopStandbyTimer();
+ connectSceneModeSignals();
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::createStillPostcaptureView
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::createPostcaptureView()
-{
- CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG_ASSERT(mCameraDocumentLoader);
- OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATESTILLPOSTCAPTUREVIEW, "msg: e_CX_CREATE_STILLPOSTCAPTUREVIEW 1" );
-
- if (!mPostcaptureView) {
- bool ok = false;
- mCameraDocumentLoader->load(POSTCAPTURE_XML, &ok);
- CX_DEBUG_ASSERT(ok);
-
- // get pointer to videoprecaptureview and do some initialisation
- QGraphicsWidget *widget = NULL;
- widget = mCameraDocumentLoader->findWidget(POSTCAPTURE_VIEW);
- mPostcaptureView = qobject_cast<CxuiPostcaptureView *> (widget);
- CX_DEBUG_ASSERT(mPostcaptureView);
- mPostcaptureView->construct(&mMainWindow, &mEngine, mCameraDocumentLoader);
-
- mMainWindow.addView(mPostcaptureView);
- connect(mPostcaptureView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()));
-
- }
-
- OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATESTILLPOSTCAPTUREVIEW, "msg: e_CX_CREATE_STILLPOSTCAPTUREVIEW 0" );
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::getPrecaptureView
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Get the precapture view appropriate for given camera mode and index.
+* If the view does not exist, it is created.
+* @param mode Which camera mode the view should match.
+* @param index Which camera index the view should match.
+*/
CxuiPrecaptureView*
CxuiViewManager::getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera)
{
CX_DEBUG_ENTER_FUNCTION();
- CX_DEBUG(("CxuiViewManager::getPrecaptureView() mode=%d, camera index=%d", mode, camera));
+ CX_DEBUG(("CxuiViewManager::getPrecaptureView - mode=%d, camera index=%d", mode, camera));
CX_DEBUG_ASSERT(camera == Cxe::PrimaryCameraIndex);
if (mode == ImageMode) {
- CX_DEBUG(("CxuiViewManager::getPrecaptureView() image mode"));
- if(!mStillPrecaptureView) {
- createStillPrecaptureView();
- }
- return mStillPrecaptureView;
+ CX_DEBUG(("CxuiViewManager::getPrecaptureView - image mode"));
+ return qobject_cast<CxuiPrecaptureView*>(createView(STILL_PRE_CAPTURE_VIEW));
+
} else {
- CX_DEBUG(("CxuiViewManager::getPrecaptureView() video mode"));
- if(!mVideoPrecaptureView) {
- createVideoPrecaptureView();
- }
- return mVideoPrecaptureView;
+ CX_DEBUG(("CxuiViewManager::getPrecaptureView - video mode"));
+ return qobject_cast<CxuiPrecaptureView*>(createView(VIDEO_PRE_CAPTURE_VIEW));
}
}
-CxuiDocumentLoader* CxuiViewManager::documentLoader()
+/*!
+* Get a pointer to the document loader instance.
+*/
+CxuiDocumentLoader *CxuiViewManager::documentLoader()
{
return mCameraDocumentLoader;
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::changeToPostcaptureView
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Get reference to application state instance.
+*/
+CxuiApplicationState &CxuiViewManager::applicationState()
+{
+ return *mApplicationState;
+}
+
+
+/*!
+* Move to post-capture view.
+*/
void CxuiViewManager::changeToPostcaptureView()
{
CX_DEBUG_ENTER_FUNCTION();
+ // Disconnect signals from old view.
+ disconnectSignals();
- if (!mPostcaptureView) {
- createPostcaptureView();
- }
+ CxuiView *postCaptureView = createView(POSTCAPTURE_VIEW);
+
+ mMainWindow.setCurrentView(postCaptureView, false);
- mMainWindow.blockSignals(true);
- mMainWindow.setCurrentView(mPostcaptureView, false);
- mMainWindow.blockSignals(false);
-
- // connecting all necessary signals for postcapture view
- connectPostCaptureSignals();
+ // 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.
+ if (mApplicationState->currentState() == CxuiApplicationState::Normal) {
+ connectPostCaptureSignals();
+ }
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::changeToPrecaptureView
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Move to pre-capture view.
+*/
void CxuiViewManager::changeToPrecaptureView()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -453,33 +518,38 @@
this, SLOT(changeToPrecaptureView()));
}
- // If standby mode is active, don't switch to precapture view and reserve camera now.
- if (mStandbyHandler->isActive()) {
- CX_DEBUG(("CxuiViewManager - Change to precapture blocked as standby mode still active."));
+ // If normal mode is not active, don't switch to precapture view and reserve camera now.
+ if (mApplicationState->currentState() != CxuiApplicationState::Normal) {
+ CX_DEBUG(("CxuiViewManager - Change to precapture blocked as not normal mode (error, standby, background)."));
} else {
+
+ // Disconnect signals from old view.
+ disconnectSignals();
+
HbView *view = getPrecaptureView(mEngine.mode(),
mEngine.cameraDeviceControl().cameraIndex());
-
- mMainWindow.blockSignals(true);
mMainWindow.setCurrentView(view, false);
- mMainWindow.blockSignals(false);
if (mSceneModeView){
+ mViews.remove(STILL_SCENES_VIEW);
delete mSceneModeView;
mSceneModeView = NULL;
}
// connecting necessary pre-capture view signals
connectPreCaptureSignals();
- emit startStandbyTimer();
+
+ // Make sure engine prepares for new image/video if necessary
+ mEngine.initMode(mEngine.mode());
+
+ startStandbyTimer();
+
}
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::switchCamera
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Switch between cameras.
+*/
void CxuiViewManager::switchCamera()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -496,12 +566,8 @@
}
CxuiPrecaptureView* view = getPrecaptureView(mEngine.mode(), nextCamera);
-
- mMainWindow.blockSignals(true);
mMainWindow.setCurrentView(view, false);
- mMainWindow.blockSignals(false);
view->updateOrientation(nextViewOrientation);
- view->prepareWindow();
connectPreCaptureSignals();
@@ -510,34 +576,190 @@
CX_DEBUG_EXIT_FUNCTION();
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::eventFilter
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Event filter function.
+* Used to get mouse and key events for standby and capture key handling.
+* @param object Target object.
+* @param event Event to be checked.
+*/
bool CxuiViewManager::eventFilter(QObject *object, QEvent *event)
{
Q_UNUSED(object)
bool eventWasConsumed = false;
+ bool userActivity = false;
- switch (event->type())
- {
+ switch (event->type()) {
case QEvent::KeyPress:
case QEvent::KeyRelease:
+ userActivity = true;
eventWasConsumed = mKeyHandler->handleKeyEvent(event);
+ if (eventWasConsumed && mApplicationState->currentState() == CxuiApplicationState::Standby) {
+ // Queued exit from standby.
+ emit standbyExitRequested();
+ }
+ break;
+
+ case QEvent::GraphicsSceneMouseMove:
+ case QEvent::GraphicsSceneMousePress:
+ userActivity = true;
+ break;
+ case QEvent::GraphicsSceneMouseRelease:
+ userActivity = true;
+ if (mApplicationState->currentState() == CxuiApplicationState::Standby) {
+ // Queued exit from standby.
+ // Standby popup in view can receive mouse event before it is dismissed.
+ emit standbyExitRequested();
+ }
break;
}
+
+ // Restart standby timer if there is user activity.
+ // Only restart the timer if it is running, do not set it running here.
+ if (userActivity && mStandbyTimer.isActive()) {
+ startStandbyTimer();
+ }
+
// No need to call base class implementation, because we derive from QObject directly.
// QObject::eventFilter() implementation always returns false.
return eventWasConsumed;
}
-// ---------------------------------------------------------------------------
-// CxuiViewManager::connectCaptureKeySignals
-//
-// ---------------------------------------------------------------------------
-//
+/*!
+* Connect signals specific to given view.
+*/
+void CxuiViewManager::connectSignals(QObject *view)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ if (view) {
+ if (view == mViews[POSTCAPTURE_VIEW]) {
+ connectPostCaptureSignals();
+ } else if (view == mSceneModeView) {
+ connectSceneModeSignals();
+ } else {
+ connectPreCaptureSignals();
+ }
+ }
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Disconnect signals.
+* 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)
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ // Disconnect all existing capture key signals
+ mKeyHandler->disconnect();
+
+ if (!view) {
+ // If view is not given, take current view.
+ view = mMainWindow.currentView();
+ }
+
+ CX_DEBUG(("CxuiViewManager - disconnecting from view %d", view));
+ if (view) {
+ // Disconnect all signals from current view to us.
+ disconnect(view, 0, this, 0);
+ // Disconnect all signals from us to current view.
+ disconnect(this, 0, view, 0);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Connect signals to pre-capture view.
+*/
+void CxuiViewManager::connectPreCaptureSignals()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ 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(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(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection);
+ connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), 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(currentView, SIGNAL(errorEncountered(CxeError::Id)),
+ mApplicationState, SLOT(handleApplicationError(CxeError::Id)),
+ Qt::UniqueConnection);
+
+ // Standby signals
+ connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby()), Qt::UniqueConnection);
+ connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby()), Qt::UniqueConnection);
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Connect signals to post-capture view.
+*/
+void CxuiViewManager::connectPostCaptureSignals()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+
+ disconnectSignals();
+ QObject *currentView = mMainWindow.currentView();
+ if (currentView == mViews[POSTCAPTURE_VIEW]) {
+ connect(currentView, 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 necessary capturekey signals
+ connectCaptureKeySignals();
+ }
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Connect signals to scene mode view.
+*/
+void CxuiViewManager::connectSceneModeSignals()
+{
+ CX_DEBUG_ENTER_FUNCTION();
+ disconnectSignals();
+
+ connectCaptureKeySignals();
+
+ // 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(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView()));
+
+ CX_DEBUG_EXIT_FUNCTION();
+}
+
+/*!
+* Connect key handler capture key signals.
+*/
void CxuiViewManager::connectCaptureKeySignals()
{
CX_DEBUG_ENTER_FUNCTION();
@@ -559,104 +781,16 @@
CX_DEBUG_EXIT_FUNCTION();
}
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::connectPreCaptureSignals
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::connectPreCaptureSignals()
+/*!
+ * Clears all camera activities from activity manager.
+ */
+void CxuiViewManager::clearAllActivities()
{
- CX_DEBUG_ENTER_FUNCTION();
-
- disconnectSignals();
-
- QObject *currentView = mMainWindow.currentView();
-
- if (currentView != mPostcaptureView) {
- // connects all capture key signals.
- connectCaptureKeySignals();
-
- // connecting view manager focus events to pre-capture views
- connect(this, SIGNAL(focusGained()), currentView, SLOT(handleFocusGained()), Qt::UniqueConnection);
- connect(this, SIGNAL(focusLost()), currentView, SLOT(handleFocusLost()), Qt::UniqueConnection);
- connect(this, SIGNAL(batteryEmpty()), currentView, SLOT(handleBatteryEmpty()), Qt::UniqueConnection);
-
- // in standby mode, we are interested in focus gain events for dismissing standby
- connect(this, SIGNAL(focusGained()), mStandbyHandler, SLOT(handleMouseEvent()), Qt::UniqueConnection);
-
- // connecting key events to standby.
- connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyHandler, SLOT(stopTimer()), Qt::UniqueConnection);
- connect(mKeyHandler, SIGNAL(autofocusKeyReleased()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
- connect(mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
- connect(mKeyHandler, SIGNAL(captureKeyReleased()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
- connect(this, SIGNAL(disableStandbyTimer()), mStandbyHandler, SLOT(stopTimer()), Qt::UniqueConnection);
- connect(this, SIGNAL(startStandbyTimer()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
-
- // connecting pre-capture view signals to standby.
- connect(currentView, SIGNAL(startStandbyTimer()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(stopStandbyTimer()), mStandbyHandler, SLOT(stopTimer()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPostcaptureView()), mStandbyHandler, SLOT(stopTimer()), Qt::UniqueConnection);
-
- // connecting precapture view signals to viewmanager slots
- connect(currentView, SIGNAL(changeToPostcaptureView()), this, SLOT(changeToPostcaptureView()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), 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 errormanager.
- connect(currentView, SIGNAL(reportError(CxeError::Id)), mErrorManager, SLOT(showPopup(CxeError::Id)), Qt::UniqueConnection);
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::connectPostCaptureSignals
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::connectPostCaptureSignals()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- disconnectSignals();
- QObject *currentView = mMainWindow.currentView();
- if (currentView == mPostcaptureView) {
- // connecting view manager focus events to pre-capture views
- connect(this, SIGNAL(focusGained()), currentView, SLOT(handleFocusGained()), Qt::UniqueConnection);
- connect(this, SIGNAL(focusLost()), currentView, SLOT(handleFocusLost()), Qt::UniqueConnection);
- connect(currentView, SIGNAL(changeToPrecaptureView()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection);
-
- // connect necessary capturekey signals
- connectCaptureKeySignals();
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-
-/*
-* CxuiViewManager::disconnectPreCaptureSignals
-*/
-void CxuiViewManager::disconnectSignals()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- // Disconnect all existing capture key signals
- mKeyHandler->disconnect();
-
- disconnect(SIGNAL(focusGained()));
- disconnect(SIGNAL(focusLost()));
- disconnect(SIGNAL(batteryEmpty()));
-
- CX_DEBUG_EXIT_FUNCTION();
+ HbActivityManager *activityManager = mApplication.activityManager();
+ activityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY);
+ activityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY);
+ activityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY);
+ activityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY);
}
/*!
@@ -666,10 +800,9 @@
{
CX_DEBUG_ENTER_FUNCTION();
- if (mApplicationMonitor
- && mApplicationMonitor->foregroundState() == CxuiApplicationFrameworkMonitor::ForegroundFullyLost) {
+ if (mApplicationState->currentState() == CxuiApplicationState::Background) {
// Bring to foreground and gain focus.
- CX_DEBUG(("CxuiViewManager - fully in background, bringing to foreground now."));
+ CX_DEBUG(("CxuiViewManager - in background, bringing to foreground now."));
mMainWindow.raise();
mMainWindow.activateWindow();
}
@@ -677,112 +810,4 @@
CX_DEBUG_EXIT_FUNCTION();
}
-/*!
-* Handle change in foreground state.
-*/
-void CxuiViewManager::handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state)
-{
- switch (state) {
- case CxuiApplicationFrameworkMonitor::ForegroundPartiallyLost:
- break;
- case CxuiApplicationFrameworkMonitor::ForegroundFullyLost:
- aboutToLooseFocus();
- break;
- case CxuiApplicationFrameworkMonitor::ForegroundOwned:
- aboutToGainFocus();
- break;
- }
-}
-
-/*!
-* Show or hide error popup based on change in USB mass memory mode activity.
-* @param show Show the popup?
-*/
-void CxuiViewManager::showUsbErrorPopup(bool show)
-{
- CX_DEBUG_ENTER_FUNCTION();
- if (show) {
- mStandbyHandler->enterStandby();
- mStandbyHandler->allowDismiss(false);
- // Emulate "mass memory not accessible" error to Error Manager
- // to get the same functionality as if the error came from CxEngine.
- mErrorManager->showPopup(CxeError::MemoryNotAccessible);
- } else {
- mStandbyHandler->allowDismiss(true);
- // If we are in postcapture view or scene view, we can return right away to normal mode.
- // For precapture views we expect user action before reserving camera
- // and starting viewfinder again.
- QObject *currentView = mMainWindow.currentView();
- if (currentView == mPostcaptureView || currentView == mSceneModeView) {
- mStandbyHandler->exitStandby();
- }
- mErrorManager->hidePopup(CxeError::MemoryNotAccessible);
- }
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::aboutToLooseFocus()
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::aboutToLooseFocus()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- emit focusLost();
- disconnectSignals();
-
- // We do not stop listening to capture key events even if we go to background,
- // as capture key brings us back to foreground.
- connect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground()));
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-
-// ---------------------------------------------------------------------------
-// CxuiViewManager::aboutToGainFocus
-//
-// ---------------------------------------------------------------------------
-//
-void CxuiViewManager::aboutToGainFocus()
-{
- CX_DEBUG_ENTER_FUNCTION();
-
- // If standby mode is still active, no action is needed yet.
- // This is the case when USB mass memory mode error is cleared.
- if (mStandbyHandler->isActive()) {
- CX_DEBUG(("CxuiViewManager - Focus gain event ignored as standby mode still active."));
- } else {
-
- // Disconnect capture key event and bringing us to foreground connection (if there is one).
- disconnect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground()));
-
- // we are getting the focus.
- if (mMainWindow.currentView() != mPostcaptureView) {
- connectPreCaptureSignals();
- } else {
- connectPostCaptureSignals();
- }
-
- if (mKeyHandler) {
- mKeyHandler->listenKeys(true);
- }
- emit focusGained();
- }
-
- CX_DEBUG_EXIT_FUNCTION();
-}
-
-/*!
-* Handle battery emptying
-*/
-void CxuiViewManager::handleBatteryEmpty()
-{
- CX_DEBUG_ENTER_FUNCTION();
- emit batteryEmpty();
- CX_DEBUG_EXIT_FUNCTION();
-}
-
// end of file
--- a/camerauis/cameraxui/cxui/src/main.cpp Thu Jul 15 01:49:11 2010 +0300
+++ b/camerauis/cameraxui/cxui/src/main.cpp Thu Jul 15 01:52:14 2010 +0300
@@ -23,12 +23,12 @@
#include <HbTranslator>
#include <QLocale>
#include <hbmainwindow.h>
-#include <xqserviceutil.h>
#include "cxeengine.h"
#include "cxecameradevicecontrol.h"
#include "cxuiapplication.h"
#include "cxuiviewmanager.h"
+#include "cxuiapplicationstate.h"
#include "cxutils.h"
#include "cxuiserviceprovider.h"
@@ -66,7 +66,7 @@
CxeEngine *eng = CxeEngine::createEngine();
OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" );
- if (XQServiceUtil::isService()) {
+ if (app.activateReason() == Hb::ActivationReasonService) {
// Embedded mode. Engine is inited to correct mode
// by service provider when request arrives
CX_DEBUG(("CxUI: creating serviceprovider"));
@@ -109,21 +109,31 @@
OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" );
OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" );
- viewManager->prepareWindow();
+ eng->viewfinderControl().setWindow(mainWindow->effectiveWinId());
OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" );
+
//! @todo initMode call added here as a temporary hack to change the startup sequence
- // in order to avoid GOOM issues
- if (viewManager->proceedStartup()) {
+ // in order to avoid GOOM issues.
+ if (app.activateReason() != Hb::ActivationReasonService
+ && viewManager->applicationState().currentState() == CxuiApplicationState::Normal) {
User::After(2000000);
- eng->initMode(Cxe::ImageMode);
+ if (app.activateReason() == Hb::ActivationReasonActivity) {
+ // when started by activity, let viewmanager init
+ // to correct mode
+ viewManager->initEngine();
+ } else {
+ // normal start
+ eng->initMode(eng->mode());
+ }
}
int returnValue = app.exec();
+ delete viewManager;
+
// delete service provider instance
CxuiServiceProvider::destroy();
- delete viewManager;
delete mainWindow;
delete trans;
delete eng;