# HG changeset patch # User hgs # Date 1279148025 -10800 # Node ID feebad15db8c0f94903ee56ae7452cc846d6414d # Parent 67457b2ffb33b3ed0e5594afc5fb88c1bd759581 201027_1 diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/inc/api/cxutils.h --- a/camerauis/cameraxui/cxengine/inc/api/cxutils.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/api/cxutils.h Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -25,28 +25,39 @@ #define QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION QT_TRAP_THROWING #endif -//! @todo change back when we can use udeb again -//#ifdef _DEBUG -#if 1 + +// Traces enabled only in debug builds. +// These can heavily affect the performance. +#ifdef _DEBUG #include // Qt Debug +#ifdef Q_OS_SYMBIAN #include // Symbian Debug +#endif // Q_OS_SYMBIAN - // engine specific debug macros #define CX_DEBUG(msg) qDebug msg; - #define CX_DEBUG_SYMBIAN(msg) RDebug::Print msg; #define CX_DEBUG_ENTER_FUNCTION() qDebug("%s => ", __PRETTY_FUNCTION__); #define CX_DEBUG_IN_FUNCTION() qDebug("%s =><= ", __PRETTY_FUNCTION__); #define CX_DEBUG_EXIT_FUNCTION() qDebug("%s <= ", __PRETTY_FUNCTION__); +#ifdef Q_OS_SYMBIAN + #define CX_DEBUG_SYMBIAN(msg) RDebug::Print msg; #define CX_DEBUG_ASSERT(x) if( !(x) ) {\ qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \ ASSERT(x); \ } +#else // !Q_OS_SYMBIAN + #define CX_DEBUG_SYMBIAN(msg) qDebug()<< msg; + #define CX_DEBUG_ASSERT(x) if( !(x) ) {\ + qDebug("%s:%d, ASSERT FAIL [%s]", __FILE__, __LINE__, #x); \ + Q_ASSERT(x); \ + } + #define OstTrace0(x,y,z) + +#endif // Q_OS_SYMBIAN #define CX_ASSERT_ALWAYS(x) CX_DEBUG_ASSERT(x) #else // !_DEBUG - // engine specific debug macros #define CX_DEBUG(msg) #define CX_DEBUG_SYMBIAN(msg) #define CX_DEBUG_ENTER_FUNCTION() @@ -57,6 +68,4 @@ #endif // _DEBUG - - #endif // CXUTILS_H diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxecameradevice.cpp --- a/camerauis/cameraxui/cxengine/src/cxecameradevice.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxecameradevice.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -148,6 +148,7 @@ TRAPD(errorImgPr, mImageProcessor = CCamera::CCameraImageProcessing::NewL(*mCamera)); CX_DEBUG(("CCameraImageProcessing status: %d", errorImgPr)); + Q_UNUSED(errorImgPr); // Avoid release build unused variable warning. TRAPD(errorSnap, mCameraSnapshot = CCamera::CCameraSnapshot::NewL(*mCamera)); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -98,7 +98,7 @@ // Check we do this only once. if (!mSettingsModel) { - OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "e_CX_ENGINE_CREATE_CONTROLS 1"); + OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_IN, "msg: e_CX_ENGINE_CREATE_CONTROLS 1"); CxeCameraDeviceControlSymbian *deviceControl = new CxeCameraDeviceControlSymbian(); mCameraDeviceControl = deviceControl; @@ -122,8 +122,8 @@ mSettings = new CxeSettingsImp(*mSettingsModel); - // Loading current camera mode value from settings store and updating - // devicecontrol + // Loading current camera mode value from settings store and updating + // devicecontrol Cxe::CameraMode cameraMode = Cxe::ImageMode; int value; CxeError::Id err = mSettings->get(CxeSettingIds::CAMERA_MODE, value); @@ -132,7 +132,7 @@ } // set current camera mode to devicecontrol. mCameraDeviceControl->setMode(cameraMode); - + //! @todo a temporary hack to change the startup sequence to avoid GOOM problems static_cast(mSettings)->loadSettings(mode()); @@ -163,7 +163,7 @@ mSnapshotControl = new CxeSnapshotControl(*mCameraDevice); - mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, + mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, *mSettings); mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread(); @@ -186,7 +186,7 @@ *mVideoCaptureControl, *mSettings); - OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "e_CX_ENGINE_CREATE_CONTROLS 0"); + OstTrace0(camerax_performance, CXEENGINESYMBIAN_CREATECONTROLS_OUT, "msg: e_CX_ENGINE_CREATE_CONTROLS 0"); } CX_DEBUG_EXIT_FUNCTION(); @@ -198,7 +198,7 @@ void CxeEngineSymbian::connectSignals() { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_IN, "e_CX_ENGINE_CONNECT_SIGNALS 1"); + OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_IN, "msg: e_CX_ENGINE_CONNECT_SIGNALS 1"); // enabling scene setting change callbacks to Autofocus control connect(mSettings, @@ -280,7 +280,7 @@ SLOT(stop()), Qt::UniqueConnection); - OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "e_CX_ENGINE_CONNECT_SIGNALS 0"); + OstTrace0(camerax_performance, CXEENGINESYMBIAN_CONNECTSIGNALS_OUT, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -288,10 +288,10 @@ CxeEngineSymbian::~CxeEngineSymbian() { CX_DEBUG_ENTER_FUNCTION(); - + // Saving current camera mode to cenrep saveMode(); - + delete mGeoTaggingTrail; delete mAutoFocusControl; delete mZoomControl; @@ -356,7 +356,7 @@ return *mSettings; } -/*! +/*! Returns the sensor event handle */ CxeSensorEventHandler &CxeEngineSymbian::sensorEventHandler() @@ -415,7 +415,7 @@ void CxeEngineSymbian::doInit() { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_IN, "e_CX_ENGINE_DO_INIT 1"); + OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_IN, "msg: e_CX_ENGINE_DO_INIT 1"); mFilenameGenerator->init(mode()); // load settings whenever we change mode or start camera or switch camera @@ -438,7 +438,7 @@ mVideoCaptureControl->init(); } - OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_OUT, "e_CX_ENGINE_DO_INIT 0"); + OstTrace0(camerax_performance, CXEENGINESYMBIAN_DOINIT_OUT, "msg: e_CX_ENGINE_DO_INIT 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -526,6 +526,7 @@ void CxeEngineSymbian::initMode(Cxe::CameraMode cameraMode) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEENGINE_INITMODE_IN, "msg: e_CX_ENGINE_INIT_MODE 1"); if (mode() == cameraMode) { CX_DEBUG(("initMode() called for current mode")); @@ -577,6 +578,7 @@ } } + OstTrace0(camerax_performance, CXEENGINE_INITMODE_OUT, "msg: e_CX_ENGINE_INIT_MODE 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -611,7 +613,8 @@ void CxeEngineSymbian::startGeotaggingTrail() { CX_DEBUG_ENTER_FUNCTION(); - + OstTrace0(camerax_performance, CXEENGINE_START_GEO_IN, "msg: e_CX_ENGINE_START_GEOTAGGING 1"); + if (mGeoTaggingTrail && mSettings) { // location trail is limited to image mode only for now. int value = Cxe::GeoTaggingDisclaimerDisabled; @@ -622,7 +625,8 @@ mGeoTaggingTrail->start(); } } - + + OstTrace0(camerax_performance, CXEENGINE_START_GEO_OUT, "msg: e_CX_ENGINE_START_GEOTAGGING 0"); CX_DEBUG_EXIT_FUNCTION(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -28,6 +28,11 @@ #include "cxeerror.h" #include "cxeerrormappingsymbian.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cxefilenamegeneratorsymbianTraces.h" +#endif + using namespace Cxe; @@ -79,6 +84,7 @@ mCurrentMode(mode) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEFILENAMEGENERATOR_1, "msg: e_CX_FILENAMEGENERATOR_NEW 1"); // Set default values (used in case of error retrieving values) mCurrentMonth = ""; @@ -92,6 +98,7 @@ mSettings.get(CxeSettingIds::FNAME_IMAGE_COUNTER, mImageCounter); mSettings.get(CxeSettingIds::FNAME_VIDEO_COUNTER, mVideoCounter); + OstTrace0(camerax_performance, CXEFILENAMEGENERATOR_2, "msg: e_CX_FILENAMEGENERATOR_NEW 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -152,6 +159,7 @@ CxeError::Id CxeFilenameGeneratorSymbian::generateFilename(QString &qfName, const QString &fileExt) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_GENERATENAME_1, "msg: e_CX_GENERATE_FILENAME 1"); // Make sure that the path for images/videos exists QString path; @@ -167,6 +175,7 @@ } } + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_GENERATENAME_2, "msg: e_CX_GENERATE_FILENAME 0"); CX_DEBUG_EXIT_FUNCTION(); return CxeErrorHandlingSymbian::map(err); } @@ -353,6 +362,7 @@ int CxeFilenameGeneratorSymbian::selectFolder(QString &suggestedPath) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_SELECTFOLDER_1, "msg: e_CX_SELECT_FOLDER 1"); // Compose the path string and select counter based on mode. QString basePath = "%1%2\\"; @@ -428,6 +438,7 @@ } } + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_SELECTFOLDER_2, "msg: e_CX_SELECT_FOLDER 0"); CX_DEBUG_EXIT_FUNCTION(); // We fallback to basePath in case of unknown errors, @@ -444,6 +455,7 @@ int CxeFilenameGeneratorSymbian::initMonthFolders() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INITFOLDERS_1, "msg: e_CX_INIT_MONTH_FOLDER 1"); // Month folder: YYYYMM, with suffix: YYYYMMXX QString monthFolder = QDate::currentDate().toString("yyyyMM"); @@ -489,6 +501,7 @@ CX_DEBUG(("[FATAL] - Could not create month folder, error %d", status)); } + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INITFOLDERS_2, "msg: e_CX_INIT_MONTH_FOLDER 0"); CX_DEBUG_EXIT_FUNCTION(); return status; } @@ -596,6 +609,7 @@ CxeError::Id CxeFilenameGeneratorSymbian::init(Cxe::CameraMode mode) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INIT_1, "msg: e_CX_FILENAMEGENERATOR_INIT 1"); mCurrentMode = mode; int err = KErrNone; @@ -620,6 +634,7 @@ } } + OstTrace0(camerax_performance, CXEFILENAMEGENERATORSYMBIAN_INIT_2, "msg: e_CX_FILENAMEGENERATOR_INIT 0"); CX_DEBUG_EXIT_FUNCTION(); return CxeErrorHandlingSymbian::map(err); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp --- a/camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrailprivate.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -15,6 +15,11 @@ * */ +#include // For Q_OS_SYMBIAN define +#if defined(Q_OS_SYMBIAN) +#include +#endif + #include "cxutils.h" #include "cxestate.h" #include "cxesettings.h" @@ -23,8 +28,10 @@ #include "cxevideocapturecontrol.h" #include "cxegeotaggingtrailprivate.h" -#include - +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cxegeotaggingtrailprivateTraces.h" +#endif namespace @@ -37,7 +44,7 @@ /*! * Constructor */ -CxeGeoTaggingTrailPrivate::CxeGeoTaggingTrailPrivate(CxeStillCaptureControl &stillControl, +CxeGeoTaggingTrailPrivate::CxeGeoTaggingTrailPrivate(CxeStillCaptureControl &stillControl, CxeVideoCaptureControl &videoControl, CxeSettings &settings) : CxeStateMachine("CxeGeoTaggingTrailPrivate"), @@ -56,7 +63,7 @@ QVariant locationTrailState; // Get initial location trail state. - mSettings.get(KPSUidLocationTrail.iUid, KLocationTrailState, + mSettings.get(KPSUidLocationTrail.iUid, KLocationTrailState, Cxe::PublishAndSubscribe, locationTrailState); connect(&mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)), @@ -66,10 +73,10 @@ connect(&mSettings, SIGNAL(settingValueChanged(const QString&,QVariant)), this, SLOT(handleSettingValueChanged(const QString&,QVariant))); - + connect(&mStopLocationTrailTimer, SIGNAL(timeout()), - this, SLOT(timeout()), Qt::UniqueConnection); - + this, SLOT(timeout()), Qt::UniqueConnection); + CX_DEBUG_EXIT_FUNCTION(); } @@ -93,13 +100,14 @@ void CxeGeoTaggingTrailPrivate::start() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_START_1, "msg: e_CX_START_GEOTAGGING 1"); #if defined(Q_OS_SYMBIAN) int err = KErrNone; int settingValue = Cxe::GeoTaggingOff; mSettings.get(CxeSettingIds::GEOTAGGING, settingValue); - + if (settingValue == Cxe::GeoTaggingOn) { // geotagging setting is ON, trying to start location trail if (state() == CxeGeoTaggingTrail::NotConnected) { @@ -109,7 +117,7 @@ setState(CxeGeoTaggingTrail::Connected); } } - + if (state() == CxeGeoTaggingTrail::Connected && !err) { err = mLocationTrail.StartLocationTrail(RLocationTrail::ECaptureAll); if (!err) { @@ -122,13 +130,14 @@ if (err) { CX_DEBUG(("CxeGeoTaggingTrailPrivate::start <> FAILED: error = %d ", err)); stop(true); - } + } } else { // geotagging setting off, do nothing. CX_DEBUG(("CxeGeoTaggingTrail <> start -- Geotagging setting OFF, do nothing..")); } #endif + OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_START_2, "msg: e_CX_START_GEOTAGGING 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -143,6 +152,7 @@ void CxeGeoTaggingTrailPrivate::stop(bool closeSession) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_STOP_1, "msg: e_CX_STOP_GEOTAGGING 1"); #if defined(Q_OS_SYMBIAN) @@ -158,7 +168,7 @@ mLocationTrail.StopLocationTrail(); setState(CxeGeoTaggingTrail::Connected); } - + if (closeSession && state() == CxeGeoTaggingTrail::Connected) { CX_DEBUG(("CxeGeoTaggingTrailPrivate <> disconnect location trail utility")); mLocationTrail.Close(); @@ -171,10 +181,10 @@ } mStopLocationTrailTimer.start(STOP_TRAIL_INTERVAL); } - + #endif - - CX_DEBUG_EXIT_FUNCTION(); + + OstTrace0(camerax_performance, CXEGEOTAGGINGTRAIL_STOP_2, "msg: e_CX_STOP_GEOTAGGING 0"); } @@ -187,7 +197,7 @@ { // 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 && @@ -207,10 +217,10 @@ void CxeGeoTaggingTrailPrivate::timeout() { CX_DEBUG_ENTER_FUNCTION(); - + // stop the pending location trail utility stop(mPendingStopTrailSession); - + CX_DEBUG_EXIT_FUNCTION(); } @@ -224,7 +234,7 @@ 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 @@ -239,7 +249,7 @@ start(); } } - + CX_DEBUG_EXIT_FUNCTION(); } @@ -259,7 +269,7 @@ if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState) { CX_DEBUG(("Location trail: new state = %d ", value.toInt())); - RLocationTrail::TTrailState newState = + RLocationTrail::TTrailState newState = static_cast(value.toInt()); if (newState == RLocationTrail::ETrailStarted) { @@ -293,7 +303,7 @@ void CxeGeoTaggingTrailPrivate::handleStateChanged(int newStateId, CxeError::Id error) { emit stateChanged(static_cast (newStateId), error); - + } @@ -304,17 +314,17 @@ { // addState( id, name, allowed next states ) addState(new CxeState(CxeGeoTaggingTrail::NotConnected, "NotConnected", CxeGeoTaggingTrail::Connected)); - - addState(new CxeState(CxeGeoTaggingTrail::Connected, "Connected", CxeGeoTaggingTrail::TrailStarted | + + 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 | + + addState(new CxeState(CxeGeoTaggingTrail::DataAvailable, "DataAvailable", CxeGeoTaggingTrail::Connected | CxeGeoTaggingTrail::NotConnected)); - + setInitialState(CxeGeoTaggingTrail::NotConnected); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeimagedataitemsymbian.cpp Thu Jul 15 01:53:45 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" @@ -167,6 +167,7 @@ CxeError::Id CxeImageDataItemSymbian::save() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_IN, "msg: e_CX_IMAGEDATAITEM_SAVE 1"); mError = KErrNone; @@ -227,7 +228,7 @@ mFile.Close(); //~400us mFs.Close(); //~450us - OstTrace0(camerax_performance, CXEIMAGEDATAIMTEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0"); + OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVED, "msg: e_CX_SHOT_TO_SAVE 0"); if (mError == KErrNone) { setState(CxeImageDataItem::Saved); @@ -236,7 +237,7 @@ } emit imageSaved(CxeErrorHandlingSymbian::map(mError), mPath, mId); - CX_DEBUG(("mError: %d", mError)); + OstTrace0(camerax_performance, CXEIMAGEDATAITEMSYMBIAN_SAVE_OUT, "msg: e_CX_IMAGEDATAITEM_SAVE 0"); CX_DEBUG_EXIT_FUNCTION(); return CxeErrorHandlingSymbian::map(mError); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -64,6 +64,7 @@ : mSettings(settings) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEQUALITYPRESETSSYMBIAN_1, "msg: e_CX_QUALITYPRESETS_NEW 1"); TRAPD(err, mIcm = CImagingConfigManager::NewL()); @@ -72,8 +73,8 @@ mIcm = NULL; } + OstTrace0(camerax_performance, CXEQUALITYPRESETSSYMBIAN_2, "msg: e_CX_QUALITYPRESETS_NEW 0"); CX_DEBUG_EXIT_FUNCTION(); - } /* ! @@ -311,10 +312,10 @@ int delta16by9 = abs((width * ASPECT_RATIO_SIZE_16BY9.height()) - (height * ASPECT_RATIO_SIZE_16BY9.width())); int delta11by9 = abs((width * ASPECT_RATIO_SIZE_11BY9.height()) - (height * ASPECT_RATIO_SIZE_11BY9.width())); int delta4by3 = abs((width * ASPECT_RATIO_SIZE_4BY3.height()) - (height * ASPECT_RATIO_SIZE_4BY3.width())); - + // get the closest aspect ratio int minValue = qMin(qMin(delta16by9, delta11by9), delta4by3); - + if (minValue == delta16by9) { aspectRatio = Cxe::AspectRatio16to9; } else if (minValue == delta11by9) { diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp --- a/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -25,6 +25,9 @@ #include #include #include +#ifdef Q_OS_SYMBIAN +#include +#endif #include "xqsettingsmanager.h" // Settings Manager API #include "xqsettingskey.h" @@ -35,10 +38,11 @@ #include "cxeerror.h" #include "cxecenrepkeys.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cxesettingscenrepstoreTraces.h" +#endif -#ifdef Q_OS_SYMBIAN -#include -#endif using namespace CxeSettingIds; @@ -49,6 +53,7 @@ CxeSettingsCenRepStore::CxeSettingsCenRepStore() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_1, "msg: e_CX_SETTINGSSTORE_CREATE 1"); // map keys of type "string" to cenrep ids mapKeys(); @@ -56,13 +61,13 @@ // we create settings handle, scope user::scope mSettingsManager = new XQSettingsManager(this); - bool ok = false; - ok = connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), - this, SLOT(handleValueChanged(XQSettingsKey, QVariant))); - CX_DEBUG_ASSERT(ok); + bool ok = connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, SLOT(handleValueChanged(XQSettingsKey, QVariant))); + CX_ASSERT_ALWAYS(ok); CX_DEBUG(("CxeSettingsCenRepStore - mSettingsManager ptr = %d", mSettingsManager)); + OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_2, "msg: e_CX_SETTINGSSTORE_CREATE 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -81,7 +86,7 @@ /*! * Generates XQSettingsKey from given setting/runtime key -* \param key Name of the setting from which to generate the XQSettingsKey +* \param key Name of the setting from which to generate the XQSettingsKey * \param[out] error Error code. CxeError::None if everything went fine. */ XQSettingsKey @@ -119,6 +124,7 @@ QHash CxeSettingsCenRepStore::loadRuntimeSettings(QList& runtimeKeys) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_1, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 1"); QHash settings; CxeError::Id err = CxeError::None; @@ -152,6 +158,7 @@ CX_DEBUG_EXIT_FUNCTION(); + OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_2, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 0"); return settings; } @@ -216,14 +223,20 @@ } XQSettingsKey settingsKey(keyType, uid, key); - CX_DEBUG(("reading values from XQSettingsManager..")); + CX_DEBUG(("reading value from XQSettingsManager..")); value = mSettingsManager->readItemValue(settingsKey); // start monitoring changes for the key // both P&S and Repository keys are monitored - bool ok = false; - ok = mSettingsManager->startMonitoring(settingsKey); - CX_DEBUG_ASSERT(ok); + bool ok = mSettingsManager->startMonitoring(settingsKey); + if (!ok) { + XQSettingsManager::Error error = mSettingsManager->error(); + CX_DEBUG(("CxeSettingsCenRepStore - got error %d trying to start listening", error)); + // If we try to start listening one key more than once, + // we get this error. We can safely ignore it. + ok = (XQSettingsManager::AlreadyExistsError == error); + } + CX_ASSERT_ALWAYS(ok); CX_DEBUG_EXIT_FUNCTION(); } @@ -284,6 +297,8 @@ void CxeSettingsCenRepStore::mapKeys() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_1, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 1"); + mKeyMapping.clear(); // mapping setting keys @@ -322,7 +337,7 @@ addKeyMapping(CxeSettingIds::VIDEO_MUTE_SETTING, AudioMuteCr, XQSettingsManager::TypeInt); - + addKeyMapping(CxeSettingIds::GEOTAGGING, GeoTaggingCr, XQSettingsManager::TypeInt); @@ -346,7 +361,7 @@ addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, CaptureSoundAlwaysOnCr, XQSettingsManager::TypeInt); - + addKeyMapping(CxeSettingIds::CAMERA_MODE, CameraModeCr, XQSettingsManager::TypeInt); @@ -386,6 +401,7 @@ XQSettingsManager::TypeString, true); + OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_2, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 0"); CX_DEBUG_EXIT_FUNCTION(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -31,6 +31,12 @@ #include "cxesettingsmappersymbian.h" #include "cxesettingscontrolsymbian.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cxesettingscontrolsymbianTraces.h" +#endif + + /*! * Constructor */ @@ -103,6 +109,8 @@ void CxeSettingsControlSymbian::handleSceneChanged(CxeScene& scene) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXESETTINGSCONTROL_SCENE_1, "msg: e_CX_SCENE_SETTINGS_TO_CAMERA 1"); + CX_DEBUG(("CxeSettingsControlSymbian <> new scene [%s]", scene[CxeSettingIds::SCENE_ID].value().toAscii().constData())); @@ -110,6 +118,7 @@ handleSettingValueChanged(settingId, scene[settingId]); } + OstTrace0(camerax_performance, CXESETTINGSCONTROL_SCENE_2, "msg: e_CX_SCENE_SETTINGS_TO_CAMERA 0"); CX_DEBUG_EXIT_FUNCTION(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -209,7 +209,7 @@ return; } - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILL_CAPCONT_DEINIT 1" ); + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" ); // Stop monitoring disk space. mDiskMonitor.stop(); @@ -229,7 +229,7 @@ setState(Uninitialized); - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILL_CAPCONT_DEINIT 0" ); + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" ); CX_DEBUG_EXIT_FUNCTION(); } @@ -246,7 +246,7 @@ return; } - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1" ); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1"); int err = KErrNone; CxeError::Id cxErr = getImageQualityDetails(mCurrentImageDetails); @@ -271,9 +271,9 @@ // Prepare Image capture CCamera::TFormat imgFormat = supportedStillFormat(mCameraDeviceControl.cameraIndex()); - OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1"); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID1, "msg: e_CX_PREPARE_IMAGE_CAPTURE 1"); TRAP(err, mCameraDevice.camera()->PrepareImageCaptureL(imgFormat, ecamStillResolutionIndex)); - OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0"); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_MID2, "msg: e_CX_PREPARE_IMAGE_CAPTURE 0"); CX_DEBUG(("PrepareImageCaptureL done, err=%d, resolution index = %d", err, ecamStillResolutionIndex)); @@ -318,7 +318,8 @@ // Inform interested parties that image mode has been prepared for capture emit imagePrepareComplete(CxeErrorHandlingSymbian::map(err)); - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPARE_OUT, "msg: e_CX_STILLCAPCONT_PREPARE 0" ); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 0"); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_OUT, "msg: e_CX_STILLCAPCONT_PREPARE 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -332,7 +333,7 @@ int CxeStillCaptureControlSymbian::prepareStillSnapshot() { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0( camerax_performance, DUP4_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 1" ); + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_1, "msg: e_CX_PREPARE_SNAPSHOT 1" ); int status(KErrNone); try { @@ -343,7 +344,7 @@ } catch (...) { status = KErrGeneral; } - OstTrace0( camerax_performance, DUP5_CXESTILLCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_PREPARE_SNAPSHOT 0" ); + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_PREPARESNAP_2, "msg: e_CX_PREPARE_SNAPSHOT 0" ); CX_DEBUG_EXIT_FUNCTION(); return status; @@ -357,6 +358,7 @@ CxeError::Id CxeStillCaptureControlSymbian::getImageQualityDetails(CxeImageDetails &imageInfo) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_GETQUALITYDETAILS_1, "msg: e_CX_GET_QUALITY_DETAILS 1" ); int imageQuality = 0; CxeError::Id err = CxeError::None; @@ -378,6 +380,7 @@ imageInfo = mIcmSupportedImageResolutions.at(imageQuality); } + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROL_GETQUALITYDETAILS_2, "msg: e_CX_GET_QUALITY_DETAILS 0" ); CX_DEBUG_EXIT_FUNCTION(); return err; } @@ -452,7 +455,7 @@ CX_DEBUG_ENTER_FUNCTION(); if (mCameraDeviceControl.mode() == Cxe::ImageMode) { - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 1" ); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_1, "msg: e_CX_HANDLE_SNAPSHOT 1"); QPixmap ss = QPixmap::fromImage(snapshot); // Get image container for current snapshot index. @@ -471,7 +474,7 @@ prepareFilename(stillImage); } - OstTrace0( camerax_performance, DUP1_CXESTILLCAPTURECONTROLSYMBIAN_HANDLESNAPSHOTEVENT, "msg: e_CX_HANDLE_SNAPSHOT 0" ); + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0"); } CX_DEBUG_EXIT_FUNCTION(); @@ -744,6 +747,8 @@ CxeError::Id CxeStillCaptureControlSymbian::prepareFilename(CxeStillImageSymbian *stillImage) { + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_1, "msg: e_CX_PREPARE_FILENAME 1" ); + CxeError::Id err = CxeError::None; if (stillImage->filename().isEmpty()) { QString path; @@ -767,6 +772,8 @@ CX_DEBUG(("ERROR in filename generation. err:%d", err)); } } + + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_PREPAREFILENAME_2, "msg: e_CX_PREPARE_FILENAME 0" ); return err; } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxethumbnailmanagersymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -117,6 +117,7 @@ CX_DEBUG_ENTER_FUNCTION(); + Q_UNUSED(thumbnail); Q_UNUSED(data); CX_DEBUG(("CxeThumbnailManagerSymbian::thumbnailReady error = %d", error)); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -299,7 +299,7 @@ return; } - OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 1"); + OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_PREPARE_1, "msg: e_CX_VIDCAPCONT_PREPARE 1"); QSize frameSize(mCurrentVideoDetails.mWidth, mCurrentVideoDetails.mHeight); int muteSetting = 0; // audio enabled @@ -343,7 +343,7 @@ handlePrepareFailed(); } - OstTrace0(camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_PREPARE, "msg: e_CX_VIDCAPCONT_PREPARE 0"); + OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_PREPARE_2, "msg: e_CX_VIDCAPCONT_PREPARE 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -354,6 +354,7 @@ CxeVideoCaptureControlSymbian::getVideoQualityDetails(CxeVideoDetails &videoInfo) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROL_GETQUALITYDETAILS_1, "msg: e_CX_GET_QUALITY_DETAILS 1" ); int quality(0); @@ -369,6 +370,7 @@ // get video quality details videoInfo = mIcmSupportedVideoResolutions.at(quality); + OstTrace0( camerax_performance, CXEVIDEOCAPTURECONTROL_GETQUALITYDETAILS_2, "msg: e_CX_GET_QUALITY_DETAILS 0" ); CX_DEBUG_EXIT_FUNCTION(); } @@ -800,9 +802,13 @@ CX_DEBUG_ENTER_FUNCTION(); if (mCameraDeviceControl.mode() == Cxe::VideoMode) { + OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_HANDLESNAPSHOT_1, "msg: e_CX_HANDLE_SNAPSHOT 1"); + // Need to store snapshot for ui to be able to get it also later. mSnapshot = QPixmap::fromImage(snapshot); emit snapshotReady(status, snapshot, filename()); + + OstTrace0(camerax_performance, CXEVIDEOCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0"); } CX_DEBUG_EXIT_FUNCTION(); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeviewfindercontrolsymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -163,6 +163,8 @@ CxeError::Id CxeViewfinderControlSymbian::start() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_START_1, "msg: e_CX_VIEWFINDER_START 1"); + TInt err = KErrNone; if ( state() == Running ) { @@ -211,7 +213,7 @@ CCoeEnv::Static()->WsSession(), *CCoeEnv::Static()->ScreenDevice(), *mVideoWindow, activeViewfinderRect)); - OstTrace0(camerax_performance, CXEVIEWFINDERCONTROLSYMBIAN_START, "msg: e_CX_STARTUP 0"); + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_STARTUP, "msg: e_CX_STARTUP 0"); setState(Running); break; } @@ -248,7 +250,7 @@ // vf already running. nothing to do } - CX_DEBUG( ("CxeViewfinderControlSymbian::start symbian error code : %d", err ) ); + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_START_2, "msg: e_CX_VIEWFINDER_START 0"); CX_DEBUG_EXIT_FUNCTION(); return CxeErrorHandlingSymbian::map(err); } @@ -260,6 +262,7 @@ int CxeViewfinderControlSymbian::initViewfinder() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_INIT_1, "msg: e_CX_VIEWFINDER_INIT 1"); TInt err = KErrNone; if (state() != Uninitialized) { @@ -298,6 +301,7 @@ setState( Ready ); #endif + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_INIT_2, "msg: e_CX_VIEWFINDER_INIT 0"); CX_DEBUG_EXIT_FUNCTION(); return err; } @@ -309,6 +313,7 @@ void CxeViewfinderControlSymbian::createViewfinderWindowL() { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_CREATE_WINDOW_1, "msg: e_CX_VIEWFINDER_CREATE_WINDOW 1"); if (!mUiWindow) { CX_DEBUG( ( "mUiWindow not set - cannot create VF window!" ) ); @@ -339,6 +344,7 @@ CX_DEBUG(("mVideoWindow ordinal position is: %d", mVideoWindow->OrdinalPosition())); CX_DEBUG(("mUiWindow ordinal position is: %d", mUiWindow->OrdinalPosition())); + OstTrace0(camerax_performance, CXEVIEWFINDERCONTROL_CREATE_WINDOW_2, "msg: e_CX_VIEWFINDER_CREATE_WINDOW 0"); CX_DEBUG_EXIT_FUNCTION(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxezoomcontrolsymbian.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -209,7 +209,7 @@ if (mCameraDeviceControl.state() == CxeCameraDeviceControl::Ready) { init(); // if CxeCameraDeviceControl is ready, this pointer is valid - CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings()) + CX_ASSERT_ALWAYS(mCameraDevice.advancedSettings()); int error = KErrNone; TRAP(error, mCameraDevice.advancedSettings()->GetDigitalZoomStepsL(mDigitalZoomValues, mDigitalZoomValueInfo); @@ -256,7 +256,7 @@ mMaxZoomLevel = cameraInfo.iMaxDigitalZoom; } // change the state, since zoom is now ready - setState(Ready, KErrNone); + setState(Ready); mCameraDevice.advancedSettings()->SetDigitalZoom(mDigitalZoomValues[mCurrentZoomLevel]); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp --- a/camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/dummyengine/cxedummycamera.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -43,6 +43,8 @@ TSize(640,480) }; static const int IMAGE_CAPTURE_SIZE_COUNT = sizeof(IMAGE_CAPTURE_SIZES)/sizeof(TSize); + + _LIT( PANICDUMMYCAMERA, "DummyCamera" ); } @@ -78,7 +80,11 @@ void CxeDummyCamera::doCommand( TCxeDummyCommand aCmd ) { - iCommandBuf.Insert( aCmd, 0 ); + TInt status = iCommandBuf.Insert( aCmd, 0 ); + if ( status != KErrNone ) + { + User::Panic(PANICDUMMYCAMERA, 1); + } if ( !iCommandTimer->IsActive() ) { iCommandTimer->Start(100, 100, TCallBack(CxeDummyCamera::callBack, this)); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp --- a/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/cxeunitrunner/cxetestrunner.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -68,7 +68,9 @@ << "unittest_cxesettingscontrolsymbian" << "unittest_cxesnapshotcontrol" << "unittest_cxeenginesymbian" - << "unittest_cxegeotaggingtrail"; + << "unittest_cxegeotaggingtrail" + << "unittest_cxememorymonitor" + << "unittest_cxediskmonitor"; QDir dir; dir.mkpath(logFileFolder); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "rlocationtrail.h" + +RLocationTrail::RLocationTrail() +{ +} + +RLocationTrail::~RLocationTrail() +{ +} + +TInt RLocationTrail::Connect() +{ + return KErrNone; +} + +void RLocationTrail::Close() +{ +} + +TInt RLocationTrail::StartLocationTrail(TTrailCaptureSetting aState) +{ + return KErrNone; +} + +TInt RLocationTrail::StopLocationTrail() +{ + return KErrNone; +} + +TInt RLocationTrail::GetLocationTrailState( TTrailState& aState ) +{ + return KErrNone; +} + +void RLocationTrail::NotifyLocationTrailStateChange( TRequestStatus& aStatus ) +{ +} + +void RLocationTrail::CancelNotificationRequest() +{ +} + +TInt RLocationTrail::RetrieveLocation( const TTime& aTimeStamp, + TLocationData& aLocationData, + TTrailState& aState ) +{ + return KErrNone; +} + +void RLocationTrail::CurrentLocation( TRequestStatus& aStatus, + TLocationData& aLocationData) +{ +} + +void RLocationTrail::CancelLocationRequest() +{ +} + +TInt RLocationTrail::GetTrailCaptureSetting( TTrailCaptureSetting& aCaptureSetting ) +{ + return KErrNone; +} + +// end of file diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/system_include/rlocationtrail.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef R_RLOCATIONTRAIL_H +#define R_RLOCATIONTRAIL_H + +#include +#include +#include +#include + +typedef TPckg TLocalityPckg; + +/** + * RLocationManager dummy. + */ +class RLocationTrail + { +public: + + enum TTrailState + { + ETrailStopped, + EWaitingGPSData, + ESearchingGPS, + ETrailStarted, + ETrailStopping, + ETrailStarting + }; + enum TTrailCaptureSetting + { + EOff, + ECaptureNetworkInfo, + ECaptureAll + }; + +public: + RLocationTrail(); + ~RLocationTrail(); + + TInt Connect(); + void Close(); + + TInt StartLocationTrail(TTrailCaptureSetting aState); + TInt StopLocationTrail(); + TInt GetLocationTrailState( TTrailState& aState ); + void NotifyLocationTrailStateChange( TRequestStatus& aStatus ); + void CancelNotificationRequest(); + TInt RetrieveLocation( const TTime& aTimeStamp, + TLocationData& aLocationData, + TTrailState& aState ); + void CurrentLocation( TRequestStatus& aStatus, + TLocationData& aLocationData); + void CancelLocationRequest(); + TInt GetTrailCaptureSetting( TTrailCaptureSetting& aCaptureSetting ); + }; + +#endif // R_RLOCATIONTRAIL_H + +// end of file diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unit.pro --- a/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unit.pro Thu Jul 15 01:53:45 2010 +0300 @@ -44,6 +44,8 @@ unittest_cxeharvestercontrolsymbian \ unittest_cxesettingscontrolsymbian \ unittest_cxesnapshotcontrol \ - unittest_cxegeotaggingtrail + unittest_cxegeotaggingtrail \ + unittest_cxediskmonitor \ + unittest_cxememorymonitor CONFIG *= ordered diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxediskmonitorprivateunit.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CXEDISKMONITORPRIVATEUNIT_H +#define CXEDISKMONITORPRIVATEUNIT_H + +// Include files + +#include "cxediskmonitorprivate.h" + +class CxeDiskMonitorPrivateUnit; + + + +#endif // CXEDISKMONITORPRIVATEUNIT_H diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cxesysutil.h" +#include "cxutils.h" + +qint64 CxeSysUtil::mSpaceAvailable = 0; + + /** + * Checks if free disk drive storage space is or will fall below critical + * level. Static configuration values stored in Central Repository are + * used to determine a critical level for each drive. + * + * If aBytesToWrite is more than zero, function returns false otherwise true. + * By defining aBytesToWrite to zero it is possible to get fake fulldisk error. + * + */ +TBool CxeSysUtil::DiskSpaceBelowCriticalLevel( + RFs* /*aFs*/, + TInt aBytesToWrite, + TInt /*aDrive*/ ) +{ + CX_DEBUG_IN_FUNCTION(); + + if (aBytesToWrite > 0) { + return EFalse; + } + else { + return ETrue; + } +} + +qint64 CxeSysUtil::spaceAvailable( + RFs & /*fs*/, + int /*index*/, + CxeSettings & /*settings*/) +{ + CX_DEBUG_IN_FUNCTION(); + return CxeSysUtil::mSpaceAvailable; +} + +void CxeSysUtil::setSpaceAvailable(qint64 aSpaceAvailable) +{ + CX_DEBUG_IN_FUNCTION(); + mSpaceAvailable = aSpaceAvailable; +} + +int CxeSysUtil::getCameraDrive(RFs & /*fs*/) +{ + CX_DEBUG_IN_FUNCTION(); + return 1; +} + +// End of file diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/cxesysutil.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub class for testing purposes +* +*/ + +#ifndef CXESYSUTIL_H +#define CXESYSUTIL_H + +#include +#include + +class RFs; +class CxeSettings; + +class CxeSysUtil + { + +public: + + static TBool DiskSpaceBelowCriticalLevel( + RFs* aFs, + TInt aBytesToWrite, + TInt aDrive); + + static qint64 spaceAvailable(RFs &fs, int index, CxeSettings &settings); + static void setSpaceAvailable(qint64 aSpaceAvailable); + + static int getCameraDrive(RFs &fs); + +public: + static qint64 mSpaceAvailable; + }; + +#endif // CXESYSUTIL_H diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include +#include + +#include "cxetestutils.h" +#include "cxefakesettings.h" +#include "cxesysutil.h" +#include "cxediskmonitor.h" +#include "unittest_cxediskmonitor.h" + +UnitTestCxeDiskMonitor::UnitTestCxeDiskMonitor() + : mFakeSettings(NULL), + mDiskMonitor(NULL) +{ +} + +UnitTestCxeDiskMonitor::~UnitTestCxeDiskMonitor() +{ + cleanup(); +} + +// Run before each individual test case +void UnitTestCxeDiskMonitor::init() +{ + CX_DEBUG_ENTER_FUNCTION(); + + mFakeSettings = new CxeFakeSettings(); + mDiskMonitor = new CxeDiskMonitor(*mFakeSettings); + + CX_DEBUG_EXIT_FUNCTION(); +} + +// Run after each individual test case +void UnitTestCxeDiskMonitor::cleanup() +{ + CX_DEBUG_ENTER_FUNCTION(); + delete mDiskMonitor; + mDiskMonitor = NULL; + + delete mFakeSettings; + mFakeSettings = NULL; + + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testStart() +{ + CX_DEBUG_ENTER_FUNCTION(); + mDiskMonitor->start(); + mDiskMonitor->start(); // testing double run - should not crash + QVERIFY(mDiskMonitor->isMonitoring() == true); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testStop() +{ + CX_DEBUG_ENTER_FUNCTION(); + mDiskMonitor->stop(); + QVERIFY(mDiskMonitor->isMonitoring() == false); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testIsMonitoring() +{ + CX_DEBUG_ENTER_FUNCTION(); + mDiskMonitor->start(); + mDiskMonitor->start(); + QVERIFY(mDiskMonitor->isMonitoring() == true); + + mDiskMonitor->stop(); + QVERIFY(mDiskMonitor->isMonitoring() == false); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testFree() +{ + CX_DEBUG_ENTER_FUNCTION(); + CxeSysUtil::setSpaceAvailable(0); + QVERIFY(mDiskMonitor->free(false) == 0); + CxeSysUtil::setSpaceAvailable(100000); + QVERIFY(mDiskMonitor->free(false) == 100000); + QVERIFY(mDiskMonitor->free(true) == 100000); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testSetLowWarningLevelZero() +{ + CX_DEBUG_ENTER_FUNCTION(); + mDiskMonitor->setLowWarningLevel(0); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testSetLowWarningLevelTenMegabytes() +{ + CX_DEBUG_ENTER_FUNCTION(); + mDiskMonitor->setLowWarningLevel(10485760); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testSetLowWarningLevelFiveGigabyte() +{ + CX_DEBUG_ENTER_FUNCTION(); + mDiskMonitor->setLowWarningLevel(5368709120); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testLowLevelWarningSignal() +{ + CX_DEBUG_ENTER_FUNCTION(); + QSignalSpy spy(mDiskMonitor, SIGNAL(diskSpaceLow())); + mDiskMonitor->stop(); + mDiskMonitor->setLowWarningLevel(100); + mDiskMonitor->start(); + CxeSysUtil::setSpaceAvailable(90); + CxeTestUtils::waitForSignal(spy, 10000, 1, true); + QVERIFY(spy.count() > 0); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeDiskMonitor::testFreeSpaceChangedSignal() +{ + CX_DEBUG_ENTER_FUNCTION(); + QSignalSpy spy(mDiskMonitor, SIGNAL(diskSpaceChanged())); + mDiskMonitor->stop(); + mDiskMonitor->setLowWarningLevel(100); + mDiskMonitor->start(); + CxeSysUtil::setSpaceAvailable(110); + CxeSysUtil::setSpaceAvailable(120); + CxeTestUtils::waitForSignal(spy, 10000, 1, true); + QVERIFY(spy.count() > 0); + CX_DEBUG_EXIT_FUNCTION(); +} + +QTEST_MAIN(UnitTestCxeDiskMonitor); + diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef UNITTEST_CXEDISKMONITOR_H +#define UNITTEST_CXEDISKMONITOR_H + +#include + +#include "cxenamespace.h" + +class CxeDiskMonitor; +class CxeFakeSettings; + +class UnitTestCxeDiskMonitor : public QObject +{ + Q_OBJECT + +public: + UnitTestCxeDiskMonitor(); + ~UnitTestCxeDiskMonitor(); + +private slots: + void init(); + void cleanup(); + + void testStart(); + void testStop(); + void testIsMonitoring(); + void testFree(); + void testSetLowWarningLevelZero(); + void testSetLowWarningLevelTenMegabytes(); + void testSetLowWarningLevelFiveGigabyte(); + void testLowLevelWarningSignal(); + void testFreeSpaceChangedSignal(); + +private: + CxeFakeSettings *mFakeSettings; + CxeDiskMonitor *mDiskMonitor; +}; + +#endif // UNITTEST_CXEDISKMONITOR_H + diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxediskmonitor/unittest_cxediskmonitor.pro Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,32 @@ +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: +# Description: + +include(../unittest.pri) + +TARGET = unittest_cxediskmonitor + +DEPENDPATH = . ../../fakeclasses ../../../src/dummyengine ../utils +INCLUDEPATH = . ../../fakeclasses ../../../src/dummyengine ../utils ../../../traces + +DEFINES *= CXE_USE_DUMMY_CAMERA + +SOURCES *= unittest_cxediskmonitor.cpp \ + ./cxesysutil.cpp \ + cxefakesettings.cpp \ + ../../../src/cxediskmonitor.cpp \ + ../../../src/cxediskmonitorprivate.cpp + +HEADERS *= unittest_cxediskmonitor.h \ + ./cxesysutil.h \ + ../../../inc/api/cxesettings.h \ + cxefakesettings.h \ + ../../../inc/cxediskmonitor.h \ + ../../../inc/cxediskmonitorprivate.h diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stub implementation of the HAL class for testing purposes +* +*/ + +#include "hal.h" + +TInt HAL::Get(TAttribute /*aAttribute*/, TInt& /*aValue*/) +{ + return KErrNone; +} diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,206 @@ +// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Stub class for testing purposes +// +// WARNING: This file contains some APIs which are internal and are subject +// to change without notice. Such APIs should therefore not be used +// outside the Kernel and Hardware Services package. +// + +#ifndef __HAL_H__ +#define __HAL_H__ + +#include +#include +#include "hal_data.h" + +/** +@publishedPartner +@released + +A set of static functions to get and set hardware attributes. + +@see HALData +*/ +class HAL : public HALData + { +public: + + /** + Synonyms for the attribute properties + HALData::TAttributeProperty, and used in SEntry. + */ + enum TEntryProperty + { + /** + When set, means that an attribute is meaningful on this device. + */ + EEntryValid=0x1, + + + /** + When set, means that an attribute is modifiable. + */ + EEntryDynamic=0x2, + }; + + /** + Defines an entry in the array that is returned in a call to HAL::GetAll(). + */ + struct SEntry + { + /** + The properties of the attribute. + + @see HAL::TEntryProperty + */ + TInt iProperties; + + /** + The attribute value. + + @see HALData::TAttribute + */ + TInt iValue; + }; +public: + /** + Gets the value of the specified HAL attribute. + + @param aAttribute The HAL attribute. + @param aValue On successful return, contains the attribute value. + Some attributes may accept aValue as an input as well, to select + one of several alternate values. See the documentation for the + individual HAL attributes for details of this. + + @return KErrNone, if successful; + KErrNotSupported, if the attribute is not defined in the list + of attributes, or is not meaningful for this device. + KErrArgument, if aValue was invalid (for attributes + which take an argument). + + @see HALData::TAttribute + @see HALData::TAttributeProperty + */ + static TInt Get(TAttribute aAttribute, TInt& aValue); + + + /** + Sets the specified HAL attribute. + + @param aAttribute The HAL attribute. + @param aValue The attribute value. + + @return KErrNone, if successful; + KErrNotSupported, if the attribute is not defined in the list + of attributes, or is not meaningful for this device, or is + not settable. + + @see HALData::TAttribute + @see HALData::TAttributeProperty + + @capability WriteDeviceData or other capability specified + for individual attributes in TAttribute + */ + static TInt Set(TAttribute aAttribute, TInt aValue); + + + /** + Gets all HAL attributes, and their properties. + + For attributes that are not meaningful on this device (ie. those which have + not been defined in the config.hcf file), the attribute value and its + associated property value are set to zero in the returned array. + + Attributes for which multiple values can be retrieved + ie. EDisplayIsPalettized, EDisplayBitsPerPixel, EDisplayOffsetToFirstPixel, + EDisplayOffsetBetweenLines, and EDisplayPaletteEntry will also be zero in + the returned array. + + Attributes that allocate resources and open handles are also not returned + by this API. Their value and property values will be set to zero in the + returned array. Use HAL::Get() for these attributes. + + @param aNumEntries On successful return, contains the total number + of HAL attributes. + If the function returns KErrNoMemory, this value is set + to zero. + @param aData On successful return, contains a pointer to an array + of SEntry objects, each of which contains an attribute value + and its property value. Note that the property value is + defined by the HAL::TEntry synonym. + If the function returns KErrNoMemory, this pointer is set + to NULL. + + @return KErrNone, if succesful; + KErrNoMemory, if there is insufficient memory. + */ + static TInt GetAll(TInt& aNumEntries, SEntry*& aData); + + + /** + Gets the value of the specified HAL attribute. + + @param aDeviceNumber The device number. (eg: screen number) + @param aAttribute The HAL attribute. + @param aValue On successful return, contains the attribute value. + Some attributes may accept aValue as an input as well, to select + one of several alternate values. See the documentation for the + individual HAL attributes for details of this. + + + @return KErrNone, if successful; + KErrNotSupported, if the attribute is not defined in the list + of attributes, or is not meaningful for this device. + KErrArgument, if aValue was invalid (for attributes + which take an argument). + + @see HALData::TAttribute + @see HALData::TAttributeProperty + */ + static TInt Get(TInt aDeviceNumber, TAttribute aAttribute, TInt& aValue); + + + /** + Sets the specified HAL attribute. + + @param aDeviceNumber The device number. (eg: screen number) + @param aAttribute The HAL attribute. + @param aValue The attribute value. + + @return KErrNone, if successful; + KErrNotSupported, if the attribute is not defined in the list + of attributes, or is not meaningful for this device, or is + not settable. + + @see HALData::TAttribute + @see HALData::TAttributeProperty + + @capability WriteDeviceData or other capability specified + for individual attributes in TAttribute + */ + static TInt Set(TInt aDeviceNumber, TAttribute aAttribute, TInt aValue); + }; + + +/** +@internalComponent +*/ +static const TInt32 KUidHalPropertyKeyBase = 0x1020E306; + +__ASSERT_COMPILE(HAL::ENumHalAttributes<256); // only 256 UIDs allocated for HAL property keys + + + +#endif diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal_data.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/hal_data.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,1363 @@ +// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// hal\inc\hal_data.h +// This is a test version of the header, for testing purposes only +// + + +#ifndef __HAL_DATA_H__ +#define __HAL_DATA_H__ +#define bitmask enum + +class HALData +/** +@publishedPartner +@released + +Sets of attributes and values used by HAL functions. +*/ + { +public: + /** + A set of enumerators that identifies hardware attributes. + The enumerators are passed to HAL::Get() and HAL::Set(). + + They are also used by the HAL accessor functions. + + Note: It is not recommended to use HAL attributes to pass handles from the + kernel to user-side clients due to resource overhead's that will affect + existing clients of HAL. HAL is designed to allow simply hardware parameters + to be shared with user-side clients without resource allocation overheads. + + @see HAL::Get() + @see HAL::Set() + */ + enum TAttribute + { + /** + Identifies the manufacturer of a device. + If this is not enumerated in TManufacturer, then the manufacturer must + obtain a value from the Symbian registry. + + @see HALData::TManufacturer + */ + EManufacturer, + + + /** + The device specific hardware version number, as defined by + the device manufacturer. + */ + EManufacturerHardwareRev, + + + /** + The device specific version number, as defined by + the device manufacturer. + */ + EManufacturerSoftwareRev, + + + /** + The device specific software version number, as defined by + the device manufacturer. + */ + EManufacturerSoftwareBuild, + + + /** + The device specific model number, as defined by + the device manufacturer. + */ + EModel, + + + /** + This is the device specific UID, It is unique to the class /model + of device. A value must be obtained from Symbian's UID registry for + this attribute. + */ + EMachineUid, + + + /** + The Symbian OS specified device family identifier. + If the device family is not one of those enumerated by TDeviceFamily, + then the licensee must obtain a UID from Symbian for this attribute. + + @see HALData::TDeviceFamily + */ + EDeviceFamily, + + + /** + The Symbian OS specified device family version. + */ + EDeviceFamilyRev, + + + /** + The CPU architecture used by this device. The values are enumerated + by TCPU. + + @see HALData::TCPU + */ + ECPU, + + + /** + A revision number for the CPU architecture. + */ + ECPUArch, + + + /** + This is the default ABI used by CPU for user applications. + The values are enumerated by HALData::TCPUABI. + */ + ECPUABI, + + + /** + The processor speed in KHz. + */ + ECPUSpeed, + + + /** + The reason for most recent system boot. + This is dynamic and readonly; the values are enumerated by + TSystemStartupReason. + + @see HALData::TSystemStartupReason + */ + ESystemStartupReason, + + + /** + This is the last exception code, in the case of system reboot. + This is dynamic and readonly. + */ + ESystemException, + + + /** + The time between system ticks, in microseconds. + */ + ESystemTickPeriod, + + + /** + The total system RAM, in bytes. + */ + EMemoryRAM, + + + /** + The currently free system RAM. + + This is dynamic and readonly. + */ + EMemoryRAMFree, + + + /** + The total System ROM, in bytes. + */ + EMemoryROM, + + + /** + The MMU page size in bytes. + */ + EMemoryPageSize, + + + /** + Indicates the state of the power supply. + + It has the values: + 1 = Power is good (i.e. external power is available, + or the 'power' battery is >= low); + 0 = otherwise. + + This is dynamic and readonly. + */ + EPowerGood, + + + /** + The System (or 'Main') battery power level. + The allowable values are enumerated by TPowerBatteryStatus + + This is dynamic and readonly, + + @see HALData::TPowerBatteryStatus + */ + EPowerBatteryStatus, + + + /** + Indicates whether a backup power supply is available. + It has the values: + 0 = the device does not support (or need) a backup battery source; + 1 = a backup batter source is present. + This is dynamic and readonly + */ + EPowerBackup, + + + /** + The power level for backup power. + + It has the values enumerated by TPowerBackupStatus. + + This is dynamic and readonly. + + @see HALData::TPowerBackupStatus + */ + EPowerBackupStatus, + + + /** + Indicates the state of the external power. + + It has the values: + 0 = external power is not in use; + 1 = external power is in use. + + This is dynamic and readonly. + */ + EPowerExternal, + + + /** + A bitmask that describes the available keyboard types (it may support + more than one). + + @see HALData::TKeyboard + */ + EKeyboard, + + + /** + */ + EKeyboardDeviceKeys, + + + /** + */ + EKeyboardAppKeys, + + + /** + Indicates whether the device can produce a click sound for + each keypress. + + It has the values: + 0 = the device cannot produce a click sound for each keypress; + 1 = the device can produce a click sound. + */ + EKeyboardClick, + + + /** + The state of keyboard clicking. + + It has the values: + 0 = key click disabled; + 1 = key click enabled. + + This is dynamic and writeable. + + @capability WriteDeviceData needed to Set this attribute + */ + EKeyboardClickState, + + + /** + The keyboard click volume level. + + It can take a value in the range 0 to EKeyboardClickVolumeMax. + + This is dynamic and writeable. + + @see HALData::EKeyboardClickVolumeMax + + @capability WriteDeviceData needed to Set this attribute + */ + EKeyboardClickVolume, + + + /** + The maximum value for EKeyboardClickVolume. + + @see HALData::EKeyboardClickVolume + */ + EKeyboardClickVolumeMax, + + + /** + The screen horizontal dimension in pixels. + */ + EDisplayXPixels, + + + /** + The screen vertical dimension in pixels. + */ + EDisplayYPixels, + + + /** + The screen horizontal dimension in twips. + */ + EDisplayXTwips, + + + /** + The screen vertical dimension in twips. + */ + EDisplayYTwips, + + + /** + The number of hues (colors or shades of grey) displayable on + the screen. + */ + EDisplayColors, + + + /** + The state of the display. + + It has the values: + 0 = screen is turned off; + 1 = screen is on. + + This is dynamic and writeable. + + @capability PowerMgmt needed to Set this attribute + */ + EDisplayState, + + + /** + The screen contrast level. + It can take a value in the range 0 to EDisplayContrastMax. + + This is dynamic and writeable + + @see HALData::EDisplayContrastMax + + @capability WriteDeviceData needed to Set this attribute + */ + EDisplayContrast, + + + /** + The maximum value for EDisplayContrast + + @see HALData::EDisplayContrast + */ + EDisplayContrastMax, + + + /** + Indicates whether there is a backlight on the device. + + It has the values: + 0 = there is no screen backlight; + 1 = a screen backlight is present. + */ + EBacklight, + + + /** + The current status of the backlight. + + It has the values: + 0 = off; + 1 = on. + + This is dynamic and writeable. + + @capability WriteDeviceData needed to Set this attribute + */ + EBacklightState, + + + /** + Indicates whether a pen or digitizer is available for input. + + It has the values: + 0 = a pen/digitizer is not available for input; + 1 = a pen/digitizeris present. + */ + EPen, + + + /** + The pen/digitizer horizontal resolution, in pixels. + */ + EPenX, + + + /** + The pen/digitizer vertical resolution, in pixels. + */ + EPenY, + + + /** + Indicates whether a pen tap will turn the display on. + + It has the values: + 0 = a pen tap has no effect; + 1 = a pent tap or press enables the display. + + This is dynamic and writeable. + + @capability WriteDeviceData needed to Set this attribute + */ + EPenDisplayOn, + + + /** + Indicates whether the device can produce a click sound for + each pen tap. + + It has the values: + 0 = the device cannot produce a click sound + 1 = production of a click sound is supported by the device. + */ + EPenClick, + + + /** + The state of pen clicking. + + It has the values: + 0 = pen clicking is disabled; + 1 = pen clicking is enabled. + + This is dynamic and writable. + + @capability WriteDeviceData needed to Set this attribute + */ + EPenClickState, + + + /** + The pen click volume level. + It can take a value in the range 0 to EPenClickVolumeMax. + + This value is dynamic and writable. + + @see HALData::EPenClickVolumeMax + + @capability WriteDeviceData needed to Set this attribute + */ + EPenClickVolume, + + + /** + The maximum value for EPenClickVolume. + + @see HALData::EPenClickVolume + */ + EPenClickVolumeMax, + + + /** + Indicates whether a mouse is available for input. + + It has the values: + 0 = there is no mouse available pen/digitizer is present; + 1 = a mouse is available for input. + */ + EMouse, + + + /** + The mouse horizontal resolution, in pixels. + */ + EMouseX, + + + /** + The mouse vertical resolution, in pixels. + */ + EMouseY, + + + /** + Describes the mouse cursor visibility. + + The value is enumerated by TMouseState. + + This is dynamic and writable. + @see HALData::TMouseState + + @capability MultimediaDD needed to Set this attribute + */ + EMouseState, + + + /** + Reserved for future use. + @capability MultimediaDD needed to Set this attribute + */ + EMouseSpeed, + + + /** + Reserved for future use. + @capability MultimediaDD needed to Set this attribute + */ + EMouseAcceleration, + + + /** + The number of buttons on the mouse. + */ + EMouseButtons, + + + /** + A bitmask defining the state of each button. + + For each bit, it has values: + 0 = up; + 1 = down. + + This is dynamic and read only. + */ + EMouseButtonState, + + + /** + Defines the state of the case. + + It has the values: + 0 = case closed; + 1 = case opened. + + This is dynamic and read only. + */ + ECaseState, + + + /** + Indicates whether the device has a case switch, that actions when + the case opens and closes. + + It has values: + 0 = no; + 1 = yes. + */ + ECaseSwitch, + + + /** + Indicates whether the device is to switch on when case opens. + + It has the values: + 0 = disable device switchon when the case opens; + 1 = enable device switchon when the case opens. + + This is dynamic and writeable. + + @capability WriteDeviceData needed to Set this attribute + */ + ECaseSwitchDisplayOn, + + + /** + Indicates whether the device is to switch off when case close. + + It has the values: + 0 = disable device switchoff when the case closes; + 1 = enable device switchoff when the case closes. + + This is dynamic and writeable. + + @capability WriteDeviceData needed to Set this attribute + */ + ECaseSwitchDisplayOff, + + + /** + The number of LEDs on the device. + */ + ELEDs, + + + /** + A bitmask defining the state of each LED. + + For each bit, it has values: + 0 = off; + 1 = on. + + This is dynamic and writeable. + */ + ELEDmask, + + + /** + Indicates how the phone hardware is connected. + + It has the values: + 0 = phone hardware is not permanently connected; + 1 = phone hardware is permanently connected. + */ + EIntegratedPhone, + + + /** + @capability WriteDeviceData needed to Set this attribute + */ + EDisplayBrightness, + + + /** + */ + EDisplayBrightnessMax, + + + /** + Indicates the state of the keyboard backlight. + + It has the values: + 0 = keyboard backlight is off; + 1 = keyboard backlight is on. + + This is dynamic and writeable. + + @capability PowerMgmt needed to Set this attribute + */ + EKeyboardBacklightState, + + + /** + Power supply to an accessory port. + + It has the values: + 0 = turn off power to an accessory port on the device; + 1 = turn on power. + + This is dynamic and writeable. + + @capability PowerMgmt needed to Set this attribute + */ + EAccessoryPower, + + + /** + A 2 decimal digit language index. + + It is used as the two digit language number that is the suffix of + language resource DLLs, e.g ELOCL.01. + + The locale with this language index is loaded the next time that + the device boots. + + This is dynamic and writeable. + + @see TLanguage + + @capability WriteDeviceData needed to Set this attribute + */ + ELanguageIndex, + + + /** + A 2 decimal digit (decimal) language keyboard index. + It is used as the two digit language number that is the suffix of + language resource DLLs, e.g. EKDATA.01. + + @see TLanguage + + @capability WriteDeviceData needed to Set this attribute + */ + EKeyboardIndex, + + + /** + The maximum allowable size of RAM drive, in bytes. + */ + EMaxRAMDriveSize, + + + /** + Indicates the state of the keyboard. + + It has the values: + 0 = keyboard is disabled; + 1 = Keyboard is enabled. + + This is dynamic and writeable. + + @capability PowerMgmt needed to Set this attribute + */ + EKeyboardState, + + /** + Defines the system drive & custom resource drive. + Legacy attribute which is no longer supported. + + @deprecated Attribute is no longer the primary mechanism to define the + System Drive or the Custom Resource Drive. + @see RFs::GetSystemDrive. + @see BaflUtils::NearestLanguageFile + @see HALData::ECustomResourceDrive + */ + ESystemDrive, + + /** + Indicates the state of the pen or digitiser. + + It has the values: + 1 = pen/digitiser is enabled; + 0 = pen/digitiser is disabled. + + This is dynamic and writeable. + + @capability PowerMgmt needed to Set this attribute + */ + EPenState, + + + /** + On input: aInOut contains the mode number. + On output: aInOut contains: 0 = display is colour; + 1 = display is black & white. + + aInOut is the 3rd parameter passed to accessor functions + for derived attributes. + */ + EDisplayIsMono, + + + /** + On input: aInOut contains the mode number; + On output, aInOut contains: 0 = display is not palettised; + 1 = display is palettised. + + aInOut is the 3rd parameter passed to accessor functions + for derived attributes. + */ + EDisplayIsPalettized, + + + /** + The display bits per pixel. + + On input, aInOut contains the mode number. + On output, aInOut contains the bits per pixel for that mode. + + aInOut is the 3rd parameter passed to accessor functions + for derived attributes. + + It is read only data. + */ + EDisplayBitsPerPixel, + + + /** + The number of display modes available. + */ + EDisplayNumModes, + + + /** + The address of the display memory. + */ + EDisplayMemoryAddress, + + + /** + The offset, in bytes, to the pixel area of the screen from the start of screen memory. + + This is used to account for the fact that the palette is sometimes at + the beginning of the display memory. + + On input, aInOut contains the mode number. + On output, aInOut contains the offset to the first pixel for that mode. + + aInOut is the 3rd parameter passed to accessor functions + for derived attributes. + */ + EDisplayOffsetToFirstPixel, + + + /** + The separation, in bytes, of successive lines of display in memory. + + On input, aInOut contains the mode number. + On output, aInOut contains the display offset between lines. + + aInOut is the 3rd parameter passed to accessor functions + for derived attributes. + */ + EDisplayOffsetBetweenLines, + + + /** + @capability MultimediaDD needed to Set this attribute + */ + EDisplayPaletteEntry, + + + /** + It has the values: + 1 = order of pixels in display is RGB; + 0 = otherwise. + */ + EDisplayIsPixelOrderRGB, + + + /** + It has the values: + 1 = pixel order is landscape; + 0 = pixel order is portrait. + */ + EDisplayIsPixelOrderLandscape, + + + /** + This indicates or sets the current display mode where + EDisplayNumModes-1 is the maximum value for the display mode. + The properties of a particular display mode are entirely defined by + the base port software associated with the hardware upon which the OS + is running. + + @capability MultimediaDD needed to Set this attribute + */ + EDisplayMode, + + + /** + If the target hardware upon which Symbian OS is running has switches + which can be read by the base port software, this interface allows + the current status of those switches to be read. + */ + ESwitches, + + + /** + The port number of the debug port. + */ + EDebugPort, + + + /** + The language code of the Locale which was loaded at device boot time. + + This is dynamic and writeable. + + @see ELanguageIndex + + @capability WriteSystemData needed to Set this attribute + */ + ELocaleLoaded, + + + /** + The drive number to use for storage of Clipboard data. + 0 = Drive A, 1 = Drive B, etc... + */ + EClipboardDrive, + + /** + Custom restart + @capability PowerMgmt + */ + ECustomRestart, + + /** + Custom restart reason + */ + ECustomRestartReason, + + /** + The number of screens. + */ + EDisplayNumberOfScreens, + + /** + The time between nanokernel ticks, in microseconds. + */ + ENanoTickPeriod, + + /** + The frequency of the fast counter. + */ + EFastCounterFrequency, + + /** + Indicates the whether the fast counter counts up or down. + */ + EFastCounterCountsUp, + + /** + Indicates whether a 3 dimensional pointing device is available for input and Z coordinate + is provided in appropriate pointer-related TRawEvents generated by the driver. + + It has the values: + 0 = a 3D pointer is not available for input and Z coordinate is not provided in TRawEvents; + 1 = a 3D pointer is present and Z coordinate is provided in TRawEvents. + */ + EPointer3D, + + /** + The furthest detectable 3D pointing device's proximity above the screen. + As proximity values above the screen are negative, this will be a negative value. + + This is dynamic and writeable. + */ + EPointer3DMaxProximity, + + /** + Indicates whether a 3 dimensional pointing device supports Theta polar angle reading. + + It has the values: + 0 = a 3D pointer does not support Theta polar angle reading; + 1 = a 3D pointer supports Theta polar angle reading. + */ + EPointer3DThetaSupported, + + /** + Indicates whether a 3 dimensional pointing device supports Phi polar angle reading. + + It has the values: + 0 = a 3D pointer does not support Phi polar angle reading; + 1 = a 3D pointer supports Phi polar angle reading. + */ + EPointer3DPhiSupported, + + /** + Indicates whether a 3 dimensional pointing device supports rotation angle along its main axis reading. + + It has the values: + 0 = a 3D pointer does not support alpha (rotation) reading; + 1 = a 3D pointer supports alpha (rotation) reading. + */ + EPointer3DRotationSupported, + + /** + Indicates whether a 3 dimensional pointing device supports readings of pressure applied on screen. + + It has the values: + 0 = a 3D pointer does not support pressure reading; + 1 = a 3D pointer supports pressure reading. + */ + EPointer3DPressureSupported, + + /** + Indicates whether hardware floating point is available, and what type. + + If no hardware floating point is available, reading this attribute will return KErrNotSupported. + If hardware floating point is available, reading this attribute will return KErrNone and the type + available. These types are specified in TFloatingPointType. + */ + EHardwareFloatingPoint, + + /** + The offset between secure and nonsecure clocks. If this attribute is undefined no secure clock + will be available. + */ + ETimeNonSecureOffset, + + /** + Persist startup mode. + + If no variant specific implementation exists, the startup mode will be stored in platform + specific values.hda file. + */ + EPersistStartupModeKernel, + + /** + Maximum restart reasons. + + Returns the maximum number of values that can be used to store the restart reason required for a custom restart. + */ + EMaximumCustomRestartReasons, + + /** + Maximum startup modes. + + Returns the maximum number of values that can be used to store the startup mode requires for a system restart. + */ + EMaximumRestartStartupModes, + + /** + Defines the custom resource drive. + + This drive attribute should be set if an additional drive is required for use in the search + algorithm for language files. + + @see TDriveNumber + @see BaflUtils::NearestLanguageFile for how this attribute is used + @capability WriteDeviceData needed to Set this attribute + */ + ECustomResourceDrive, + + /** + Step size of Z distance data. + + Returns the minimum size of the step between two resolvable z positions + */ + EPointer3DProximityStep, + + /** + Maximum Number of Pointers supported by hardware/driver + + Returns the maximum number of pointers for a multi-touch configuration (or KErrNotSupported or 0 or 1 for single-touch legacy configuration) + */ + EPointerMaxPointers, + + /** + Maximum Number of Pointers + + Sets and reads back the number of pointers as requested by the UI (<=EPointerMaxPointers) + */ + EPointerNumberOfPointers, + + /** + Maximum Pressure Value + + Returns the maximum pressure value + */ + EPointer3DMaxPressure, + + /** + Step size of pressure data. + + Returns the minimum size of the step between two resolvable pressure readings + */ + EPointer3DPressureStep, + + /** + The threshold on pointer's Z coordinate above which EEnterHighPressure pointer event is sent to WSERV's clients. + This value is intended to be preconfigured in build time and modified by Window Server only + + @prototype 9.5 + */ + EPointer3DEnterHighPressureThreshold, + + /** + The threshold on pointer's Z coordinate below which EExitHighPressure pointer event is sent to WSERV's clients. + This value is intended to be preconfigured in build time and modified by Window Server only + + @prototype 9.5 + */ + EPointer3DExitHighPressureThreshold, + + /** + The threshold on pointer's Z coordinate above which EEnterCloseProximity pointer event is sent to WSERV's clients. + This value is intended to be preconfigured in build time and modified by Window Server only + + @prototype 9.5 + */ + EPointer3DEnterCloseProximityThreshold, + + + /** + The threshold on pointer's Z coordinate below which EExitCloseProximity pointer event is sent to WSERV's clients. + This value is intended to be preconfigured in build time and modified by Window Server only + + @prototype 9.5 + */ + EPointer3DExitCloseProximityThreshold, + + /** + A Handle to the display memory. + This attribute opens a chunk, the client is responsible for closing it. + Using HAL attribtues to open handles is not recommended and this + attribute may be removed in the future. + + @prototype 9.5 + */ + EDisplayMemoryHandle, + + /** + Serial number of this board + */ + ESerialNumber, + + + /** + Interrupt used by sampling profiler - applicable for SMP only. Each CPU_i is interrupted by interrupt number ECpuProfilingInterrupt + i + */ + ECpuProfilingDefaultInterruptBase, + + + /** + Number of processors present on the device. Returns 1 on unicore. This number is constant and does not take account of power management + */ + ENumCpus, + + /** + The orientation of the Digitiser. Usually mirrors device orientation. + + @see TDigitiserOrientation for allowed values + @capability WriteDeviceData needed to Set this attribute + */ + EDigitiserOrientation, + + /* + * NOTE: + * When updating this list, please also update hal/rom/hal.hby and hal/tsrc/t_newhal.cpp. + */ + + /** + + The number of HAL attributes per screen. + + It is simply defined by its position in the enumeration. + */ + ENumHalAttributes + + }; + + + + /** + Defines properties for the hardware attributes. + + @see HALData::TAttribute + */ + enum TAttributeProperty + { + /** + When set, means that an attribute is meaningful on this device. + + @see HAL::Get() + @see HAL::Set() + */ + EValid=0x1, + + + /** + When set, means that an attribute is modifiable. + A call to HAL::Set() for an attribute that does not have this property, + returns KErrNotSupported. + + @see HAL::Get() + @see HAL::Set() + */ + ESettable=0x2, + }; + + + + /** + UIDs for a defined set of device manufacturers. + + Note that any manufacturer not represented in this list must obtain + a value from the Symbian registry. + + @see HALData::TAttribute + */ + enum TManufacturer // UID for manufacturer + { + EManufacturer_Ericsson=0x00000000, + EManufacturer_Motorola=0x00000001, + EManufacturer_Nokia=0x00000002, + EManufacturer_Panasonic=0x00000003, + EManufacturer_Psion=0x00000004, + EManufacturer_Intel=0x00000005, + EManufacturer_Cogent=0x00000006, + EManufacturer_Cirrus=0x00000007, + EManufacturer_Linkup=0x00000008, + EManufacturer_TexasInstruments=0x00000009, + // New manufacturers must obtain an official UID to identify themselves + }; + + + + /** + Defines the Symbian OS device families. + + @see HALData::TAttribute + */ + enum TDeviceFamily + { + EDeviceFamily_Crystal, + EDeviceFamily_Pearl, + EDeviceFamily_Quartz, + }; + + + + /** + Defines the set of CPU architectures. + + @see HALData::TAttribute + */ + enum TCPU + { + ECPU_ARM, + ECPU_MCORE, + ECPU_X86, + }; + + + + /** + Defines the set of ABIs used by the CPU for user applications. + + @see HALData::TAttribute + */ + enum TCPUABI + { + ECPUABI_ARM4, + ECPUABI_ARMI, + ECPUABI_THUMB, + ECPUABI_MCORE, + ECPUABI_MSVC, + ECPUABI_ARM5T, + ECPUABI_X86, + }; + + + + /** + Defines the set of reasons for a system boot. + + @see HALData::TAttribute + */ + enum TSystemStartupReason + { + ESystemStartupReason_Cold, + ESystemStartupReason_Warm, + ESystemStartupReason_Fault, + }; + + + + /** + Defines the set of available keyboard types. + + @see HALData::TAttribute + */ + bitmask TKeyboard + { + EKeyboard_Keypad=0x1, + EKeyboard_Full=0x2, + }; + + + + /** + Defines the mouse cursor visibility. + + @see HALData::TAttribute + */ + enum TMouseState + { + EMouseState_Invisible=0, + EMouseState_Visible=1, + }; + + + + /** + Defines a set of UIDs for specific devices, reference boards etc + + @see HALData::TAttribute + */ + enum TMachineUid + { + EMachineUid_Series5mx=0x1000118a, + EMachineUid_Brutus=0x10005f60, + EMachineUid_Cogent=0x10005f61, + EMachineUid_Win32Emulator=0x10005f62, + EMachineUid_WinC=0x10005f63, + EMachineUid_CL7211_Eval=0x1000604f, + EMachineUid_LinkUp=0x00000000, + EMachineUid_Assabet=0x100093f3, + EMachineUid_Zylonite=0x101f7f27, + EMachineUid_IQ80310=0x1000a681, + EMachineUid_Lubbock=0x101f7f26, + EMachineUid_Integrator=0x1000AAEA, + EMachineUid_Helen=0x101F3EE3, + EMachineUid_X86PC=0x100000ad, + EMachineUid_OmapH2=0x1020601C, + EMachineUid_OmapH4=0x102734E3, + EMachineUid_NE1_TB=0x102864F7, + EMachineUid_EmuBoard=0x1200afed, + EMachineUid_OmapH6=0x10286564, + EMachineUid_OmapZoom=0x10286565, + EMachineUid_STE8500=0x101FF810, + }; + + + + /** + Defines power levels for the system (or 'Main') battery. + + @see HALData::TAttribute + */ + enum TPowerBatteryStatus + { + EPowerBatteryStatus_Zero, + EPowerBatteryStatus_Replace, + EPowerBatteryStatus_Low, + EPowerBatteryStatus_Good, + }; + + + + /** + Defines power levels for the backup power. + + @see HALData::TAttribute + */ + enum TPowerBackupStatus + { + EPowerBackupStatus_Zero, + EPowerBackupStatus_Replace, + EPowerBackupStatus_Low, + EPowerBackupStatus_Good, + }; + + + /** + Describes the orientation of the screen digitiser, usually mirrors the + device orientation not necessarily the display rotation as this might be + limited to upright and left 90 only. The values in degrees measures + the anti-clockwise angle from the left edge of the digitiser from the + normal default position of the device. + + User-side clients can use attribute to inform the digitiser driver of the + digitiser orientation. The driver may then use this information to adjust + X.Y sampling depending on input pointer type. + + @see HALData::TAttribute + */ + enum TDigitiserOrientation + { + EDigitiserOrientation_default, ///< Driver using build-in default + EDigitiserOrientation_000, ///< Device normal 'make-call' position + EDigitiserOrientation_090, ///< Device rotated left 90 degrees + EDigitiserOrientation_180, ///< Device rotated 180 degrees + EDigitiserOrientation_270 ///< Device rotated right 90 degrees + }; + + }; + +#endif diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Fake ROomMonitorSession class implementation +* +*/ + +#include "oommonitorsession.h" + +TInt ROomMonitorSession::Connect() +{ + return KErrNone; +} + +TInt ROomMonitorSession::RequestFreeMemory(TInt aBytesRequested) +{ + return KErrNone; +} + +void ROomMonitorSession::RequestFreeMemory(TInt /*aBytesRequested*/, TRequestStatus& /*aStatus*/) +{ + // do nothing +} + +TInt ROomMonitorSession::RequestOptionalRam(TInt /*aBytesRequested*/, TInt /*aMinimumBytesNeeded*/, TInt /*aPluginId*/, TInt& /*aBytesAvailable*/) +{ + return KErrNone; +} + +void ROomMonitorSession::RequestOptionalRam(TInt /*aBytesRequested*/, TInt /*aMinimumBytesNeeded*/, TInt aPluginId, TRequestStatus& /*aStatus*/) +{ + // do nothing +} + +void ROomMonitorSession::CancelRequestFreeMemory() +{ + // do nothing +} + +void ROomMonitorSession::ThisAppIsNotExiting(TInt /*aWgId*/) +{ + // do nothing +} + +void ROomMonitorSession::SetOomPriority(TOomPriority /*aPriority*/) +{ + // do nothing +} + +void ROomMonitorSession::Close() +{ + // do nothing +} + +//End of file diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/oommonitorsession.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,146 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Fake class for testing +* +*/ + +#ifndef OOMMONITORSESSION_H +#define OOMMONITORSESSION_H + +#include + +const TInt KOomMaxAllocationWithoutPermission = 1048576; +const TUid KOomMemoryMonitorStatusPropertyCategory = {0x10207218}; +const TUint32 KOomMemoryMonitorStatusPropertyKey = 0; +enum TMemoryMonitorStatusPropertyValues + { + // Above Treshhold: Free Ram is above good treshhold point and memory monitor isn't freeing any memory + EAboveTreshHold, + + // Freeing Memory: Memory monitor is in the middle of freeing memory + EFreeingMemory, + + // Below Treshhold: Memory monitor has tried to free some RAM but total memory is still below treshhold and memory monitor has given up freeing more memory. + EBelowTreshHold + }; +class ROomMonitorSession + { +public: + + /** Defines the application priorities of OOM monitor. */ + enum TOomPriority + { + /** + * Application can be closed if needed. + */ + EOomPriorityNormal = 0, + + /** + * Application should not be closed if possible. + */ + EOomPriorityHigh, + + /** + * Application is busy and should not be closed. + */ + EOomPriorityBusy + }; + +public: + /** + * Connects a new session. + * Sessions must be connected before any other APIs can be used. + * When the client has finished using a session, Close() must be called. + * @return KErrNone if successful, error code otherwise. + */ + TInt Connect(); + + /** + * Request that the OOM monitor attempts to free some paged memory. + * This function may take several seconds to execute, depending on + * the memory state. It will not return until the attempt to recover + * memory has completed. + * @param aBytesRequested The number of bytes of free memory that the client requests. + * @return KErrNone if the request memory is free. KErrNoMemory if that + * amount of memory could not be recovered. Other error codes may + * also be returned. + */ + TInt RequestFreeMemory(TInt aBytesRequested); + + /** + * Request that the OOM monitor attempts to free some paged memory. + * This is an asynchronous version of the request for free paged memory. + * @param aBytesRequested The number of bytes of free memory that the client requests. + * @param aStatus will be completed when the attempt to recover memory + * has finished. This may take several seconds, depending on + * the memory state. On completion, aStatus will be set to + * KErrNone if the request memory is free. KErrNoMemory if that + * amount of memory could not be recovered. Other error codes may + * also be set. + */ + void RequestFreeMemory(TInt aBytesRequested, TRequestStatus& aStatus); + + /** + * Request that the OOM monitor attempts to free some memory for an optional allocation. + * The passed in plugin ID is used to determine the priority for this allocation. + * Lower priority OOM actions may be executed to free enough RAM for this allocation. + * This function may take several seconds to execute, depending on + * the memory state. It will not return until the attempt to recover + * memory has completed. + * @param aBytesRequested The number of bytes of free memory that the client requests. + * @param aPluginId The ID of the plugin that may delete the allocation in event of low memory. + * @return KErrNone if the request memory is free. KErrNoMemory if that + * amount of memory could not be recovered. Other error codes may + * also be returned. + */ + TInt RequestOptionalRam(TInt aBytesRequested, TInt aMinimumBytesNeeded, TInt aPluginId, TInt& aBytesAvailable); + + /** + * Request that the OOM monitor attempts to free some memory for an optional allocation. + * The passed in plugin ID is used to determine the priority for this allocation. + * Lower priority OOM actions may be executed to free enough RAM for this allocation. + * This function may take several seconds to execute, depending on + * the memory state. It will not return until the attempt to recover + * memory has completed. + * @param aBytesRequested The number of bytes of free memory that the client requests. + * @param aPluginId The ID of the plugin that may delete the allocation in event of low memory. + * @param aStatus The TRequestStatus (completes with the number of bytes freed (aStatus >= 0) or an error (aStatus <= 0)) + * @return None + */ + void RequestOptionalRam(TInt aBytesRequested, TInt aMinimumBytesNeeded, TInt aPluginId, TRequestStatus& aStatus); + + /** + * Cancels the asynchronous request for free memory. + */ + void CancelRequestFreeMemory(); + + /** + * Notify the OOM monitor that this application is not responding + * to the EEikCmdExit request to exit the application. + * This function is used by the Avkon framework's app shutter. + * @param aWgId the window group identifier of the app that is not exiting. + */ + void ThisAppIsNotExiting(TInt aWgId); + + /** + * Notify the OOM monitor that this application has the specified priority + * @param aPriority the priority of the application + */ + void SetOomPriority(TOomPriority aPriority); + + void Close(); + + }; + +#endif // OOMMONITORSESSION_H diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include +#include +#include +#include + +#include "cxetestutils.h" +#include "cxefakefeaturemanager.h" +#include "cxememorymonitor.h" +#include "unittest_cxememorymonitor.h" + +UnitTestCxeMemoryMonitor::UnitTestCxeMemoryMonitor() + : mMemoryMonitor(NULL), + mFakeFeatureManager(NULL) +{ +} + +UnitTestCxeMemoryMonitor::~UnitTestCxeMemoryMonitor() +{ + cleanup(); +} + +// Run before each individual test case +void UnitTestCxeMemoryMonitor::init() +{ + CX_DEBUG_ENTER_FUNCTION(); + + mFakeFeatureManager = new CxeFakeFeatureManager(); + mMemoryMonitor = new CxeMemoryMonitor(*mFakeFeatureManager); + + CX_DEBUG_EXIT_FUNCTION(); +} + +// Run after each individual test case +void UnitTestCxeMemoryMonitor::cleanup() +{ + CX_DEBUG_ENTER_FUNCTION(); + delete mMemoryMonitor; + mMemoryMonitor = NULL; + + delete mFakeFeatureManager; + mFakeFeatureManager = NULL; + + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeMemoryMonitor::testFree() +{ + CX_DEBUG_ENTER_FUNCTION(); + QVERIFY(mMemoryMonitor->free() > 0); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeMemoryMonitor::testStartMonitoring() +{ + CX_DEBUG_ENTER_FUNCTION(); + mMemoryMonitor->startMonitoring(); + QVERIFY(mMemoryMonitor->free() > 0); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeMemoryMonitor::testStopMonitoring() +{ + CX_DEBUG_ENTER_FUNCTION(); + mMemoryMonitor->stopMonitoring(); + QVERIFY(mMemoryMonitor->free() > 0); + CX_DEBUG_EXIT_FUNCTION(); +} + +void UnitTestCxeMemoryMonitor::testStartStopMonitoring() +{ + CX_DEBUG_ENTER_FUNCTION(); + mMemoryMonitor->startMonitoring(); + mMemoryMonitor->stopMonitoring(); + QVERIFY(mMemoryMonitor->free() > 0); + CX_DEBUG_EXIT_FUNCTION(); +} + +// main() function - Need event loop for waiting signals, +// so can't use QTEST_APPLESS_MAIN. +QTEST_MAIN(UnitTestCxeMemoryMonitor); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.h Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef UNITTEST_CXEMEMORYMONITOR_H +#define UNITTEST_CXEMEMORYMONITOR_H + +#include + +#include "cxenamespace.h" + +class CxeMemoryMonitor; +class CxeFakeFeatureManager; + +class UnitTestCxeMemoryMonitor : public QObject +{ + Q_OBJECT + +public: + UnitTestCxeMemoryMonitor(); + ~UnitTestCxeMemoryMonitor(); + +private slots: + void init(); + void cleanup(); + + void testFree(); + void testStartMonitoring(); + void testStopMonitoring(); + void testStartStopMonitoring(); + +private: + CxeFakeFeatureManager *mFakeFeatureManager; + CxeMemoryMonitor *mMemoryMonitor; +}; + +#endif // UNITTEST_CXEMEMORYMONITOR_H diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxememorymonitor/unittest_cxememorymonitor.pro Thu Jul 15 01:53:45 2010 +0300 @@ -0,0 +1,32 @@ +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# Initial Contributors: +# Nokia Corporation - initial contribution. +# Contributors: +# Description: +include(../unittest.pri) +TARGET = unittest_cxememorymonitor + +DEPENDPATH = . ../../fakeclasses ../../../src/dummyengine ../utils +INCLUDEPATH = . ../../fakeclasses ../../../src/dummyengine ../utils ../../../traces + +DEFINES *= CXE_USE_DUMMY_CAMERA + +SOURCES *= unittest_cxememorymonitor.cpp \ + cxefakefeaturemanager.cpp \ + ../../../src/cxememorymonitor.cpp \ + ../../../src/cxememorymonitorprivate.cpp \ + ./oommonitorsession.cpp \ + ./hal.cpp + +HEADERS *= unittest_cxememorymonitor.h \ + cxefakefeaturemanager.h \ + ../../../inc/api/cxememorymonitor.h \ + ../../../inc/cxememorymonitorprivate.h \ + ./oommonitorsession.h \ + ./hal.h \ + ./hal_data.h diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -19,14 +19,18 @@ #include "unittest_cxestatemachine.h" #include "cxestate.h" #include "cxestatemachineunit.h" -#include "cxeerrormappingsymbian.h" // CxeErrorHandlingSymbian // ----------------------------------- // CxsStateMachine // ----------------------------------- UnitTestCxeStateMachine::UnitTestCxeStateMachine() -: mStateMachine(NULL), mStartState(NULL), mMiddleState(NULL), mEndState(NULL), mIsolatedState(NULL) +: mStateMachine(NULL), + mStartState(NULL), + mMiddleState(NULL), + mEndState(NULL), + mIsolatedState(NULL) { + qRegisterMetaType("CxeError::Id"); } UnitTestCxeStateMachine::~UnitTestCxeStateMachine() @@ -106,25 +110,25 @@ // set state, when initial state is not set -> NOK // check that handleStateChange is not called // current state is undefined - QVERIFY(!mStateMachine->setState(StartId, 2)); + QVERIFY(!mStateMachine->setState(StartId)); QCOMPARE(mStateMachine->mHandleStateChangedCounter, 0); - QCOMPARE(mStateMachine->stateId(), 0); + QCOMPARE(mStateMachine->stateId(), 0); // 0 - undefined state // set start state as initial state, change to another state (allowed change) -> OK // (there should be a call to state change, check the error code) mStateMachine->setInitialState(StartId); - QVERIFY(mStateMachine->setState(MiddleId, 0)); + QVERIFY(mStateMachine->setState(MiddleId, CxeError::None)); QCOMPARE(mStateMachine->mHandleStateChangedCounter, 1); QVERIFY(mStateMachine->mStateChangeStateId == MiddleId); - QVERIFY(mStateMachine->mStateChangeErrorId == CxeErrorHandlingSymbian::map(0)); + QCOMPARE(mStateMachine->mStateChangeErrorId, CxeError::None); QVERIFY(mStateMachine->stateId() == MiddleId); // set another state (allowed change) -> OK - // check the error code is correct one (return value is mapped error value) - QVERIFY(mStateMachine->setState(EndId, -1)); + // check the error code is correct one + QVERIFY(mStateMachine->setState(EndId, CxeError::NotFound)); QCOMPARE(mStateMachine->mHandleStateChangedCounter, 2); QVERIFY(mStateMachine->mStateChangeStateId == EndId); - QVERIFY(mStateMachine->mStateChangeErrorId == CxeErrorHandlingSymbian::map(-1)); + QCOMPARE(mStateMachine->mStateChangeErrorId, CxeError::NotFound); QVERIFY(mStateMachine->stateId() == EndId); // reset the counter for handleStateChanged slot @@ -132,7 +136,7 @@ // set same state again -> OK // but state change should not be called - QVERIFY(mStateMachine->setState(EndId, 0)); + QVERIFY(mStateMachine->setState(EndId, CxeError::None)); QCOMPARE(mStateMachine->mHandleStateChangedCounter, 0); // setstate to a state that does not exists -> NOK diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxestatemachine/unittest_cxestatemachine.pro Thu Jul 15 01:53:45 2010 +0300 @@ -18,13 +18,11 @@ SOURCES *= unittest_cxestatemachine.cpp \ cxestatemachineunit.cpp \ cxestatemachinebase.cpp \ - cxeerrormappingsymbian.cpp \ cxestate.cpp HEADERS *= unittest_cxestatemachine.h \ cxestatemachineunit.h \ cxestatemachinebase.h \ - cxeerrormappingsymbian.h \ cxestate.h \ cxeerror.h diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h --- a/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Thu Jul 15 01:53:45 2010 +0300 @@ -49,7 +49,6 @@ CxuiApplicationState(CxuiApplication &application, CxeSettings &settings, - CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader); ~CxuiApplicationState(); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/inc/cxuienums.h --- a/camerauis/cameraxui/cxui/inc/cxuienums.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuienums.h Thu Jul 15 01:53:45 2010 +0300 @@ -58,7 +58,9 @@ static const char *TRANSPARENT_BACKGROUND_GRAPHIC = "qtg_fr_popup_trans"; // Sections + static const char *STILL_PRE_CAPTURE_INDICATORS_SECTION = "still_capture_indicators"; static const char *STILL_PRE_CAPTURE_WIDGETS_SECTION = "still_capture_with_widgets"; + static const char *VIDEO_PRE_CAPTURE_INDICATORS_SECTION = "video_capture_indicators"; static const char *VIDEO_PRE_CAPTURE_WIDGETS_SECTION = "video_capture_with_widgets"; static const char *POST_CAPTURE_WIDGETS_SECTION = "post_capture_with_widgets"; static const char *STILL_PRE_CAPTURE_EMBEDDED_SECTION = "still_embedded_mode"; @@ -73,7 +75,6 @@ // Widgets // In order to be able to refer to a widget, we need to know its object name. static const char *STILL_PRE_CAPTURE_VIEW = "still_capture_view"; - static const char *STILL_SCENES_VIEW = "settings_scenes_view"; static const char *STILL_PRE_CAPTURE_TOOLBAR = "toolbar"; static const char *STILL_PRE_CAPTURE_FLASH_ACTION = "cxui_action_flash"; static const char *STILL_PRE_CAPTURE_SCENE_MODE_ACTION = "cxui_action_scenemodes"; @@ -89,6 +90,7 @@ static const char *STILL_PRE_CAPTURE_INDICATOR_CONTAINER = "indicatorContainer"; static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER = "images_left_container"; static const char *STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON = "still_geotagging_indicator"; + static const char *STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON = "flash_indicator"; static const char *STILL_PRE_CAPTURE_SELFTIMER_CONTAINER = "still_precapture_selftimer_container"; static const char *STILL_PRE_CAPTURE_SELFTIMER_COUNTER = "still_selftimer_counter"; @@ -119,6 +121,8 @@ static const char *VIDEO_PRE_CAPTURE_QUALITY_ICON = "video_quality_indicator"; static const char *VIDEO_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON = "video_geotagging_indicator"; + static const char *VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON = "video_audio_mute_indicator"; + static const char *VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON = "video_stability_indicator"; // standby static const char *STANDBY_POPUP = "standbymode_popup"; @@ -152,14 +156,15 @@ static const char *SETTINGS_SLIDER_DIALOG_HEADING_WIDGET = "slider_settings_dialog_heading"; static const char *SETTINGS_SLIDER_DIALOG_CONTENT_WIDGET = "settings_dialog_slider"; - // scene setting - static const char *SCENE_VIEW_CONTAINER = "scene_view_container"; - static const char *SCENE_VIEW_BG_IMAGE = "scene_view_bg_icon"; - static const char *SCENE_VIEW_BG_IMAGE2 = "scene_view_bg_icon2"; - static const char *SCENE_VIEW_RADIOBUTTONS = "scene_view_radioButtonList"; - static const char *SCENE_VIEW_OK_BUTTON = "scene_ok_button"; - static const char *SCENE_VIEW_CANCEL_BUTTON = "scene_cancel_button"; - static const char *SCENE_VIEW_HEADING_WIDGET = "scene_title"; + // scene mode view + static const char *SCENE_MODE_VIEW = "settings_scenes_view"; + static const char *SCENE_MODE_VIEW_CONTAINER = "scene_view_container"; + static const char *SCENE_MODE_VIEW_BG_IMAGE = "scene_view_bg_icon"; + static const char *SCENE_MODE_VIEW_BG_IMAGE2 = "scene_view_bg_icon2"; + static const char *SCENE_MODE_VIEW_RADIOBUTTONS = "scene_view_radioButtonList"; + static const char *SCENE_MODE_VIEW_OK_BUTTON = "scene_ok_button"; + static const char *SCENE_MODE_VIEW_CANCEL_BUTTON = "scene_cancel_button"; + static const char *SCENE_MODE_VIEW_HEADING_WIDGET = "scene_title"; } namespace CxUiInternal diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:53:45 2010 +0300 @@ -83,7 +83,7 @@ void playVideo(); void showDeleteNote(); - void handleDeleteDialogClosed(HbAction *action); + void handleDeleteDialogClosed(int action); private: QString getCurrentFilename(); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:53:45 2010 +0300 @@ -64,6 +64,7 @@ void restoreActivity(const QString &activityId, const QVariant &data); void saveActivity(); void clearActivity(); + protected: void showEvent(QShowEvent *event); @@ -111,6 +112,9 @@ void closeDialogs(); void updateFaceTrackingIcon(); +private: + void reloadIndicatorWidgets(); + protected: CxuiSelfTimer *mSelfTimer; HbAction *mFlashSetting; diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:53:45 2010 +0300 @@ -45,27 +45,13 @@ public: - /** - * Construct-method handles initialisation tasks for this class. - * @param mainwindow - * @param engine - * @param documentLoader - * @param keyHandler - */ void construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler, HbActivityManager *activityManager); - /** - * Loads widgets that are needed right from the start. - */ virtual void loadDefaultWidgets(); - /** - * Loads widgets that are not part of the default section in layouts xml. - * Widgets are created at the time they are first loaded. - */ virtual void loadWidgets(); void restoreActivity(const QString &activityId, const QVariant &data); @@ -118,6 +104,9 @@ // from QObject bool eventFilter(QObject *object, QEvent *event); +private: + void reloadIndicatorWidgets(); + protected: QTimer mElapsedTimer; int mTimeElapsed; diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/inc/cxuiviewmanager.h --- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Thu Jul 15 01:53:45 2010 +0300 @@ -31,13 +31,9 @@ class CxuiApplication; class CxuiCaptureKeyHandler; class CxuiPrecaptureView; -class CxuiStillPrecaptureView; -class CxuiVideoPrecaptureView; -class CxuiPostcaptureView; class CxeEngine; class CxuiDocumentLoader; -class CxuiErrorManager; // class that handles all errors in ui. -class CxuiSceneModeView; +class CxuiErrorManager; class CxuiView; class CxuiViewManager : public QObject @@ -48,11 +44,6 @@ CxuiViewManager(CxuiApplication &application, HbMainWindow &mainWindow, CxeEngine &engine); ~CxuiViewManager(); - CxuiDocumentLoader *documentLoader(); - - CxuiApplicationState &applicationState(); - - void initEngine(); public slots: void changeToPostcaptureView(); void changeToPrecaptureView(); @@ -80,8 +71,6 @@ CxuiView *createView(const QString &viewName); CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera); - CxuiView *createSceneModesView(); - void connectSignals(QObject *view); void disconnectSignals(QObject *view = NULL); void connectPreCaptureSignals(); @@ -105,7 +94,6 @@ CxuiDocumentLoader *mCameraDocumentLoader; CxuiApplicationState *mApplicationState; CxuiErrorManager *mErrorManager; - CxuiSceneModeView *mSceneModeView; QTimer mStandbyTimer; }; diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/layouts/setting_scenemode.docml --- a/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ - + @@ -18,10 +18,12 @@ + + @@ -39,8 +41,9 @@ + - + @@ -67,7 +70,7 @@ - + diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/layouts/view_still_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:53:45 2010 +0300 @@ -43,6 +43,18 @@ + + + + + + + + + + +
+ @@ -86,17 +98,11 @@ - + - - - - - - - +
@@ -135,7 +141,7 @@ - + @@ -144,8 +150,9 @@ - + + @@ -193,8 +200,6 @@ - - @@ -208,6 +213,8 @@ + + @@ -257,4 +264,4 @@ - + \ No newline at end of file diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/layouts/view_video_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:53:45 2010 +0300 @@ -47,6 +47,18 @@ + + + + + + + + + + +
+ @@ -84,17 +96,11 @@ - + - - - - - - - +
@@ -140,7 +146,7 @@ - + @@ -161,8 +167,6 @@ - - @@ -184,6 +188,8 @@ + + @@ -262,6 +268,9 @@ + + + diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuiapplication.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplication.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplication.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -33,7 +33,7 @@ */ CxuiApplication::CxuiApplication(int &argc, char *argv[]) - : HbApplication(argc, argv, Hb::NoSplash) + : HbApplication(argc, argv, Hb::SplashFixedHorizontal) { CX_DEBUG_IN_FUNCTION(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -32,7 +32,6 @@ */ CxuiApplicationState::CxuiApplicationState(CxuiApplication &application, CxeSettings &settings, - CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader) : mState(Background), mApplicationMonitor(NULL), mErrorManager(NULL), mEventLog(NULL) { diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp --- a/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuidocumentloader.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -45,7 +45,7 @@ QObject *CxuiDocumentLoader::createObject(const QString& type, const QString &name) { - OstTrace0( camerax_performance, CXUIDOCUMENTLOADER_CREATEOBJECT, "msg: e_CX_DOCLOADER_CREATEOBJECT 1" ); + OstTrace0(camerax_performance, CXUIDOCUMENTLOADER_1, "msg: e_CX_DOCUMENTLOADER_CREATEOBJECT 1"); QObject *object = NULL; if (type == "HbView") { @@ -55,7 +55,7 @@ object = new CxuiVideoPrecaptureView(); } else if (name == CxUiLayout::POSTCAPTURE_VIEW) { object = new CxuiPostcaptureView(); - } else if (name == CxUiLayout::STILL_SCENES_VIEW) { + } else if (name == CxUiLayout::SCENE_MODE_VIEW) { object = new CxuiSceneModeView(NULL); } } else if (type == "HbDialog") { @@ -72,7 +72,7 @@ } } else if (type == "HbRadioButtonList") { if (name == CxUiLayout::SETTINGS_DIALOG_CONTENT_WIDGET - || name == CxUiLayout::SCENE_VIEW_RADIOBUTTONS) { + || name == CxUiLayout::SCENE_MODE_VIEW_RADIOBUTTONS) { object = new CxuiSettingRadioButtonList(NULL, mEngine); } } @@ -83,7 +83,7 @@ object = HbDocumentLoader::createObject(type, name); } - OstTrace0( camerax_performance, DUP1_CXUIDOCUMENTLOADER_CREATEOBJECT, "msg: e_CX_DOCLOADER_CREATEOBJECT 0" ); + OstTrace0(camerax_performance, CXUIDOCUMENTLOADER_2, "msg: e_CX_DOCUMENTLOADER_CREATEOBJECT 0"); return object; } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -50,10 +49,12 @@ #include "cxenamespace.h" #include "cxuiserviceprovider.h" +#ifdef Q_OS_SYMBIAN #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cxuipostcaptureviewTraces.h" #endif +#endif //Q_OS_SYMBIAN using namespace CxUiLayout; @@ -64,14 +65,12 @@ const QString FILENAME_KEY = "filename"; const int CXUI_STOP_VIEWFINDER_TIMEOUT = 5000; // 5 seconds const int CXUI_RELEASE_CAMERA_TIMEOUT = 60000; // 60 seconds -}; +} -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::CxuiPostcaptureView -// -// --------------------------------------------------------------------------- -// +/*! +* Constructor. +*/ CxuiPostcaptureView::CxuiPostcaptureView(QGraphicsItem *parent) : CxuiView(parent), mStillToolbar(NULL), @@ -93,11 +92,9 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::~CxuiPostcaptureView -// -// --------------------------------------------------------------------------- -// +/*! +* Destructor. +*/ CxuiPostcaptureView::~CxuiPostcaptureView() { CX_DEBUG_ENTER_FUNCTION(); @@ -108,16 +105,15 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::construct -// -// --------------------------------------------------------------------------- -// +/*! +* Second phase construction. +*/ void CxuiPostcaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler, HbActivityManager *activityManager) { + Q_UNUSED(keyHandler); CX_DEBUG_ENTER_FUNCTION(); CxuiView::construct(mainwindow, engine, documentLoader, NULL, activityManager); @@ -181,11 +177,9 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::handleCaptureKeyPressed -// -// --------------------------------------------------------------------------- -// +/*! +* Handle pressing capture key. +*/ void CxuiPostcaptureView::handleCaptureKeyPressed() { CX_DEBUG_ENTER_FUNCTION(); @@ -197,11 +191,9 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::handleAutofocusKeyPressed -// -// --------------------------------------------------------------------------- -// +/*! +* Handle pressing auto focus key. +*/ void CxuiPostcaptureView::handleAutofocusKeyPressed() { CX_DEBUG_ENTER_FUNCTION(); @@ -251,48 +243,41 @@ } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::showDeleteNote -// -// --------------------------------------------------------------------------- -// +/*! +* Show delete query. +*/ void CxuiPostcaptureView::showDeleteNote() { CX_DEBUG_ENTER_FUNCTION(); hideControls(); - if (mEngine->mode() == Cxe::VideoMode) { - HbMessageBox::question(hbTrId("txt_cam_other_delete_video_clip"), - this, - SLOT(handleDeleteDialogClosed(HbAction*))); - } else { - HbMessageBox::question(hbTrId("txt_cam_other_delete_image"), - this, - SLOT(handleDeleteDialogClosed(HbAction*))); - } + QString text(mEngine->mode() == Cxe::VideoMode + ? hbTrId("txt_cam_other_delete_video_clip") + : hbTrId("txt_cam_other_delete_image")); + + HbMessageBox::question(text, + this, + SLOT(handleDeleteDialogClosed(int)), + HbMessageBox::Yes | HbMessageBox::No); mDeleteNoteOpen = true; CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::handleDeleteDialogClosed -// -// --------------------------------------------------------------------------- -// -void CxuiPostcaptureView::handleDeleteDialogClosed(HbAction *action) +/*! +* Handle closing delete query dialog. +* @param action HbMessageBox::Yes if user accepted the delete query, HbMessageBox::No if not. +*/ +void CxuiPostcaptureView::handleDeleteDialogClosed(int action) { CX_DEBUG_ENTER_FUNCTION(); hideControls(); mDeleteNoteOpen = false; - HbMessageBox *dlg = qobject_cast(sender()); - - // check that it was "primary action" that closed the dialog - if (dlg && dlg->actions().at(0) == action) { - // User confirmed delete + // Check that user confirmed delete + if (action == HbMessageBox::Yes) { QString filename = getCurrentFilename(); QFileInfo fileInfo(filename); if (fileInfo.exists()) { @@ -303,7 +288,7 @@ // is being harvested by MdS etc. QDir dir = fileInfo.absolutePath(); bool ok = dir.remove(fileInfo.fileName()); - CX_DEBUG(("Delete file [%s], status %d", fileInfo.fileName().toAscii().constData(), ok)); + CX_DEBUG(("Delete file [%s], status %d", qPrintable(fileInfo.fileName()), ok)); // Go back to precapture view goToPrecaptureView(); @@ -333,11 +318,9 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::goToPrecaptureView -// -// --------------------------------------------------------------------------- -// +/*! +* Go to pre-capture view. +*/ void CxuiPostcaptureView::goToPrecaptureView() { CX_DEBUG_ENTER_FUNCTION(); @@ -359,11 +342,9 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::stopViewfinder -// -// --------------------------------------------------------------------------- -// +/*! +* Stop viewfinder. +*/ void CxuiPostcaptureView::stopViewfinder() { CX_DEBUG_ENTER_FUNCTION(); @@ -394,11 +375,10 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::eventFilter -// -// --------------------------------------------------------------------------- -// +/*! +* Handle events. +* Needed for restarting timers. +*/ bool CxuiPostcaptureView::eventFilter(QObject *object, QEvent *event) { Q_UNUSED(object) @@ -438,6 +418,7 @@ */ void CxuiPostcaptureView::restoreActivity(const QString &activityId, const QVariant &data) { + Q_UNUSED(activityId); CX_DEBUG_ENTER_FUNCTION(); // get filename. if filename is not found (toString() returns empty string) @@ -489,11 +470,10 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::showEvent -// -// --------------------------------------------------------------------------- -// +/*! +* Show event for this view. +* Update snapshot and start timers. +*/ void CxuiPostcaptureView::showEvent(QShowEvent *event) { CX_DEBUG_ENTER_FUNCTION(); @@ -512,11 +492,10 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::hideEvent -// -// --------------------------------------------------------------------------- -// +/*! +* Hide event. +* Release snapshot and stop timers. +*/ void CxuiPostcaptureView::hideEvent(QHideEvent *event) { CX_DEBUG_ENTER_FUNCTION(); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -120,7 +120,7 @@ HbActivityManager *activityManager) { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" ); + OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_1, "msg: e_CX_PRECAPVIEW_CONSTRUCT 1"); CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager); @@ -160,7 +160,7 @@ setNavigationAction(exitAction); } - OstTrace0( camerax_performance, DUP1_CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 0" ); + OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_2, "msg: e_CX_PRECAPVIEW_CONSTRUCT 0"); QCoreApplication::instance()->installEventFilter(this); CX_DEBUG_EXIT_FUNCTION(); @@ -886,28 +886,14 @@ { CX_DEBUG_ENTER_FUNCTION(); - QString ftuMsg = hbTrId("txt_cam_info_captured_photos_and_videos_will_be_ta"); - QString actionOkTxt = hbTrId("txt_common_button_ok"); - QString actionSettingsTxt = hbTrId("txt_cam_opt_general_settings"); - - HbDialog *dialog = new HbDialog(); - HbLabel *label = new HbLabel(); + HbMessageBox *ftuMessageBox = new HbMessageBox(hbTrId("txt_cam_info_captured_photos_and_videos_will_be_ta"), + HbMessageBox::MessageTypeInformation); - // initializing dialog's content widget - label->setPlainText(ftuMsg); - label->setTextWrapping(Hb::TextWordWrap); - label->setElideMode(Qt::ElideNone); - label->setMaximumWidth(350); - dialog->setContentWidget(label); - - // initializing dialog's actions - HbAction *okAction = new HbAction(actionOkTxt, dialog); - HbAction *settingsAction = new HbAction(actionSettingsTxt, dialog); - dialog->addAction(okAction); - dialog->addAction(settingsAction); + HbAction *okAction = new HbAction(hbTrId("txt_common_button_ok")); + HbAction *settingsAction = new HbAction(hbTrId("txt_cam_opt_general_settings")); // connecting signals for dialog's actions - connect(okAction, + connect(okAction, SIGNAL(triggered()), this, SLOT(disableGeotaggingDisclaimer())); @@ -917,11 +903,13 @@ this, SLOT(launchGeoTaggingSetting())); - // initializing dialog's properties - dialog->setTimeout(HbDialog::NoTimeout); - dialog->setDismissPolicy(HbPopup::NoDismiss); - dialog->setAttribute(Qt::WA_DeleteOnClose, true); - dialog->show(); + // adding buttons to the information message + ftuMessageBox->setStandardButtons(HbMessageBox::NoButton); + ftuMessageBox->addAction(okAction); + ftuMessageBox->addAction(settingsAction); + + ftuMessageBox->setAttribute(Qt::WA_DeleteOnClose, true); + ftuMessageBox->show(); CX_DEBUG_EXIT_FUNCTION(); } @@ -941,7 +929,7 @@ /*! -* Slot that accepts "Geotagging first-time use" note and launches geotagging setting dialog. +* Slot that launches geotagging setting dialog. */ void CxuiPrecaptureView::launchGeoTaggingSetting() { diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -105,18 +105,18 @@ QGraphicsWidget *widget = NULL; - widget = mDocumentLoader->findWidget(SCENE_VIEW_CONTAINER); + widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_CONTAINER); mScenesContainer = qobject_cast (widget); mScenesHeading = qobject_cast( - mDocumentLoader->findWidget(SCENE_VIEW_HEADING_WIDGET)); + mDocumentLoader->findWidget(SCENE_MODE_VIEW_HEADING_WIDGET)); CX_ASSERT_ALWAYS(mScenesHeading); //Now let's retreive the pointer to icon widget - widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE); + widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_BG_IMAGE); mScenesBackground = qobject_cast (widget); - widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE2); + widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_BG_IMAGE2); mScenesBackground2 = qobject_cast (widget); //Assuming that the automatic scene mode is always the default one @@ -125,7 +125,7 @@ background.setMirroringMode(HbIcon::LayoutDirection); mScenesBackground->setIcon(background); - widget = mDocumentLoader->findWidget(SCENE_VIEW_RADIOBUTTONS); + widget = mDocumentLoader->findWidget(SCENE_MODE_VIEW_RADIOBUTTONS); mScenesList = qobject_cast (widget); mTransitionAnimation = new QPropertyAnimation(mScenesBackground2, "opacity"); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -73,7 +73,7 @@ // 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())); + CX_DEBUG(("CxuiSettingRadioButtonList - original value: [%s]", qPrintable(value))); setOriginalSelectedItemByValue(QVariant(value)); } } @@ -87,15 +87,21 @@ { CX_DEBUG_ENTER_FUNCTION(); + // Find the index of given value among setting values. + // Default to first item, if given value is not found. int index = mSettingValues.indexOf(QVariant(value)); - if (index >= 0) { - mOriginalIndex = index; - setSelected(index); - // ensure that currently selected item is visible - scrollTo(currentIndex()); - } else { - CX_DEBUG(("[WARNING] Value %s not found, defaulting to first item", value.toString().toAscii().data())); + if (index < 0) { + CX_DEBUG(("[WARNING] Value [%s] not found, selecting first item", qPrintable(value.toString()))); + index = 0; } + + // Store the original value. + mOriginalIndex = index; + // Select the index with current value item. + setSelected(index); + // Ensure that currently selected item is visible. + scrollTo(currentIndex()); + CX_DEBUG_EXIT_FUNCTION(); } @@ -190,12 +196,12 @@ { CX_DEBUG_ENTER_FUNCTION(); - CX_DEBUG(("id: %s", mSettingId.toAscii().data())); + CX_DEBUG(("CxuiSettingRadioButtonList - id: %s", qPrintable(mSettingId))); if (!mSettingId.isEmpty() && !mSettingValues.isEmpty()) { QVariant value = mSettingValues.at(index); if (value.type() == QVariant::Int) { - CX_DEBUG(("index:%d value:%d", index, value.toInt())); + CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:%d", index, value.toInt())); // Don't set the value again, if it is the current value. // For e.g. video quality it would result in re-preparation etc. @@ -209,11 +215,11 @@ emit valueSelected(value.toInt()); } else if (value.type() == QVariant::String) { - CX_DEBUG(("index:%d value:[%s]", index, value.toString().toAscii().constData())); + CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:[%s]", index, qPrintable(value.toString()))); QString current; CxeError::Id status(mEngine->settings().get(mSettingId, current)); - CX_DEBUG(("settings model value:[%s]", current.toAscii().constData())); + CX_DEBUG(("CxuiSettingRadioButtonList - settings model value:[%s]", qPrintable(current))); if (status != CxeError::None || current != value.toString()) { mEngine->settings().set(mSettingId, value.toString()); diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -208,9 +208,9 @@ // get the localized possible strings for each image quality setting QString vga = "txt_cam_dblist_vga"; - QString normal = "txt_cam_dblist_l1_mpix"; + QString normal = "txt_cam_dblist_ln_mpix"; QString imagesLeft = "txt_cam_dblist_hd_720p_val_ln_images_left"; - QString widescreen = "txt_cam_dblist_l1_mpix_widescreen"; + QString widescreen = "txt_cam_dblist_ln_mpix_widescreen"; foreach(CxeImageDetails quality, list) { // mapping the right value for each quality diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -14,14 +14,16 @@ * Description: * */ +#include +#include +#include + #include #include #include #include #include #include -#include -#include #include #include #include @@ -123,7 +125,7 @@ int value = Cxe::GeoTaggingDisclaimerDisabled; mEngine->settings().get(CxeSettingIds::GEOTAGGING_DISCLAIMER, value); - if(value == Cxe::GeoTaggingDisclaimerEnabled) { + if (value == Cxe::GeoTaggingDisclaimerEnabled) { launchGeoTaggingDisclaimerDialog(); } @@ -137,31 +139,96 @@ void CxuiStillPrecaptureView::loadDefaultWidgets() { CX_DEBUG_ENTER_FUNCTION(); - CX_DEBUG_ASSERT(mDocumentLoader); + CX_ASSERT_ALWAYS(mDocumentLoader); // get pointer to the viewfinder QGraphicsWidget *widget = NULL; widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_VIEWFINDER); mViewfinder = qobject_cast(widget); - CX_DEBUG_ASSERT(mViewfinder); + CX_ASSERT_ALWAYS(mViewfinder); + + reloadIndicatorWidgets(); + CX_DEBUG_EXIT_FUNCTION(); +} +/*! + * Loads default indicators from docml and modifies the visibility + * according to current settings. + */ +void CxuiStillPrecaptureView::reloadIndicatorWidgets() +{ + CX_DEBUG_ENTER_FUNCTION(); + CX_ASSERT_ALWAYS(mDocumentLoader); + + bool ok = false; + mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_INDICATORS_SECTION, &ok); + CX_ASSERT_ALWAYS(ok); + + QGraphicsWidget *widget = NULL; widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_QUALITY_ICON); mQualityIcon = qobject_cast(widget); - CX_DEBUG_ASSERT(mQualityIcon); + CX_ASSERT_ALWAYS(mQualityIcon); + + widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FLASHBLINK_INDICATOR_ICON); + HbLabel *flashBlinkingIcon = qobject_cast(widget); + CX_ASSERT_ALWAYS(flashBlinkingIcon); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_GEOTAGGING_INDICATOR_ICON); mGeoTaggingIndicatorIcon = qobject_cast(widget); - CX_DEBUG_ASSERT(mGeoTaggingIndicatorIcon); + CX_ASSERT_ALWAYS(mGeoTaggingIndicatorIcon); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON); mFaceTrackingIcon = qobject_cast(widget); - CX_DEBUG_ASSERT(mFaceTrackingIcon); + CX_ASSERT_ALWAYS(mFaceTrackingIcon); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER); mIndicators = qobject_cast(widget); - CX_DEBUG_ASSERT(mIndicators); + CX_ASSERT_ALWAYS(mIndicators); + + QGraphicsLayout *layout = mIndicators->layout(); + QGraphicsLayoutItem *graphicsLayoutItem = NULL; + QGraphicsItem *graphicsItem = NULL; + QString key = ""; + int currentSettingValue = -1; + bool isSettingOff = false; + // Go through the items in the layout to check whether they should be + // shown or not in the indicator pane. Start from the last towards + // the first, so that removing items from between works correctly. + for (int i = layout->count() - 1; i >= 0; i--) { + graphicsLayoutItem = layout->itemAt(i); + isSettingOff = false; + if (graphicsLayoutItem) { + graphicsItem = graphicsLayoutItem->graphicsItem(); + currentSettingValue = -1; + if (graphicsItem == mGeoTaggingIndicatorIcon) { + key = CxeSettingIds::GEOTAGGING; + mEngine->settings().get(key, currentSettingValue); + if (currentSettingValue == Cxe::GeoTaggingOff) { + isSettingOff = true; + } + } else if (graphicsItem == mFaceTrackingIcon) { + key = CxeSettingIds::FACE_TRACKING; + mEngine->settings().get(key, currentSettingValue); + // facetracking implementation does not use + // enum for on/off values but instead + // 0 for off and 1 for on. + if (currentSettingValue == 0) { + isSettingOff = true; + } + } else if (graphicsItem == flashBlinkingIcon) { + //remove flash indicator + isSettingOff = true; + } + if (isSettingOff) { + layout->removeAt(i); + } + } + } + // create background for indicator container createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC); + + mIndicators->setVisible(true); CX_DEBUG_EXIT_FUNCTION(); } @@ -173,7 +240,7 @@ void CxuiStillPrecaptureView::loadWidgets() { CX_DEBUG_ENTER_FUNCTION(); - CX_DEBUG_ASSERT(mDocumentLoader); + CX_ASSERT_ALWAYS(mDocumentLoader); if( mWidgetsLoaded ) { CX_DEBUG(("Widgets already loaded")); @@ -187,14 +254,14 @@ OstTrace0( camerax_performance, DUP4_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 1" ); mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_WIDGETS_SECTION, &ok); - Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing"); + CX_ASSERT_ALWAYS(ok); if (CxuiServiceProvider::isCameraEmbedded()) { mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_EMBEDDED_SECTION, &ok); } else { mDocumentLoader->load(STILL_1ST_XML, STILL_PRE_CAPTURE_STANDALONE_SECTION, &ok); } OstTrace0( camerax_performance, DUP5_CXUISTILLPRECAPTUREVIEW_LOADWIDGETS, "msg: e_CX_DOCUMENTLOADER_LOAD 0" ); - Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing"); + CX_ASSERT_ALWAYS(ok); // get pointers to ui components from the layout data QGraphicsWidget *widget = NULL; @@ -202,7 +269,7 @@ widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER); mSlider = qobject_cast(widget); - CX_DEBUG_ASSERT(mSlider); + CX_ASSERT_ALWAYS(mSlider); mSlider->addZoomButtons(); createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC); @@ -216,30 +283,30 @@ HbWidget *container = NULL; widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_CONTAINER); container = qobject_cast(widget); - CX_DEBUG_ASSERT(container); + CX_ASSERT_ALWAYS(container); createWidgetBackgroundGraphic(container, TRANSPARENT_BACKGROUND_GRAPHIC); // connect selftimer start button to hide controls widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_SELFTIMER_START_BUTTON); HbPushButton *startButton = qobject_cast(widget); - CX_DEBUG_ASSERT(startButton); + CX_ASSERT_ALWAYS(startButton); connect(startButton, SIGNAL(released()), this, SLOT(hideControls())); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR); mToolbar = qobject_cast(widget); - CX_DEBUG_ASSERT(mToolbar); + CX_ASSERT_ALWAYS(mToolbar); object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION); mFlashSetting = qobject_cast(object); - CX_DEBUG_ASSERT(mFlashSetting); + CX_ASSERT_ALWAYS(mFlashSetting); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL); mImagesLeft = qobject_cast(widget); - CX_DEBUG_ASSERT(mImagesLeft); + CX_ASSERT_ALWAYS(mImagesLeft); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER); mImagesLeftContainer = qobject_cast(widget); - CX_DEBUG_ASSERT(mImagesLeftContainer); + CX_ASSERT_ALWAYS(mImagesLeftContainer); createWidgetBackgroundGraphic(mImagesLeftContainer, TRANSPARENT_BACKGROUND_GRAPHIC); updateImagesLeftLabel(); @@ -421,7 +488,7 @@ if (mDocumentLoader) { QObject *obj = mDocumentLoader->findObject(iconObjectName); - CX_DEBUG_ASSERT(obj); + CX_ASSERT_ALWAYS(obj); qobject_cast(obj)->setIcon(HbIcon(icon)); } } else { @@ -860,7 +927,10 @@ // update images left when quality values are changed updateImagesLeftLabel(); } else if (key == CxeSettingIds::FACE_TRACKING) { + reloadIndicatorWidgets(); updateFaceTrackingIcon(); + } else if (key == CxeSettingIds::GEOTAGGING) { + reloadIndicatorWidgets(); } // update toolbar flash icon diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -45,11 +46,12 @@ #include "cxuizoomslider.h" #include "cxuicapturekeyhandler.h" #include "cxuidocumentloader.h" +#include "cxuiserviceprovider.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cxuivideoprecaptureviewTraces.h" #endif -#include "cxuiserviceprovider.h" using namespace Cxe; @@ -95,6 +97,13 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! + * Construct-method handles initialisation tasks for this class. + * @param mainwindow + * @param engine + * @param documentLoader + * @param keyHandler + */ void CxuiVideoPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler, @@ -133,34 +142,105 @@ } +/*! + * Loads widgets that are needed right from the start. + */ void CxuiVideoPrecaptureView::loadDefaultWidgets() { CX_DEBUG_ENTER_FUNCTION(); - CX_DEBUG_ASSERT(mDocumentLoader); + CX_ASSERT_ALWAYS(mDocumentLoader); // get pointers to ui components from the layout data QGraphicsWidget *widget = NULL; widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIEWFINDER); mViewfinder = qobject_cast (widget); - CX_DEBUG_ASSERT(mViewfinder); - - widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON); - mQualityIcon = qobject_cast (widget); - CX_DEBUG_ASSERT(mQualityIcon); + CX_ASSERT_ALWAYS(mViewfinder); - widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP); - mIndicators = qobject_cast(widget); - CX_DEBUG_ASSERT(mIndicators); - // Create background graphics for indicator container - createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC); + reloadIndicatorWidgets(); CX_DEBUG_EXIT_FUNCTION(); } +/*! + * Loads default indicators from docml and modifies the visibility + * according to current settings. + */ +void CxuiVideoPrecaptureView::reloadIndicatorWidgets() +{ + CX_DEBUG_ENTER_FUNCTION(); + CX_ASSERT_ALWAYS(mDocumentLoader); + + bool ok = false; + mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_INDICATORS_SECTION, &ok); + CX_ASSERT_ALWAYS(ok); + + QGraphicsWidget *widget = NULL; + widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_QUALITY_ICON); + mQualityIcon = qobject_cast (widget); + CX_ASSERT_ALWAYS(mQualityIcon); + + widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_VIDEOAUDIOMUTE_INDICATOR_ICON); + HbLabel *videoaudiomuteIndicatorIcon = qobject_cast(widget); + CX_ASSERT_ALWAYS(videoaudiomuteIndicatorIcon); + + widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_STABILITY_INDICATOR_ICON); + HbLabel *videoStabilityIndicatorIcon = qobject_cast(widget); + CX_ASSERT_ALWAYS(videoStabilityIndicatorIcon); + + widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_TOP); + mIndicators = qobject_cast(widget); + CX_ASSERT_ALWAYS(mIndicators); + + QGraphicsLayout *layout = mIndicators->layout(); + QGraphicsLayoutItem *graphicsLayoutItem = NULL; + QGraphicsItem *graphicsItem = NULL; + QString key = ""; + int currentSettingValue = -1; + bool isSettingOff = false; + // Go through the items in the layout to check whether they should be + // shown or not in the indicator pane. Start from the last towards + // the first, so that removing items from between works correctly. + for (int i = layout->count() - 1; i >= 0; i--) { + graphicsLayoutItem = layout->itemAt(i); + isSettingOff = false; + if (graphicsLayoutItem) { + graphicsItem = graphicsLayoutItem->graphicsItem(); + currentSettingValue = -1; + if (graphicsItem == videoaudiomuteIndicatorIcon) { + key = CxeSettingIds::VIDEO_MUTE_SETTING; + mEngine->settings().get(key, currentSettingValue); + // video mute implementation does not use + // enum for on/off values but instead + // 0 for off and 1 for on. + if (currentSettingValue == 0) { + isSettingOff = true; + } + } else if (graphicsItem == videoStabilityIndicatorIcon) { + // remove video stability indicator. + isSettingOff = true; + } + if (isSettingOff) { + layout->removeAt(i); + } + } + } + + // Create background graphics for indicator container + createWidgetBackgroundGraphic(mIndicators, TRANSPARENT_BACKGROUND_GRAPHIC); + + mIndicators->setVisible(true); + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * Loads widgets that are not part of the default section in layouts xml. + * Widgets are created at the time they are first loaded. + */ void CxuiVideoPrecaptureView::loadWidgets() { CX_DEBUG_ENTER_FUNCTION(); - CX_DEBUG_ASSERT(mDocumentLoader); + CX_ASSERT_ALWAYS(mDocumentLoader); if (mWidgetsLoaded) { CX_DEBUG(("Widgets already loaded")); @@ -176,17 +256,17 @@ // load widgets section (creates the widgets) mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_WIDGETS_SECTION, &ok); - Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing"); + CX_ASSERT_ALWAYS(ok); if (CxuiServiceProvider::isCameraEmbedded()) { mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_EMBEDDED_SECTION, &ok); } else { mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_STANDALONE_SECTION, &ok); } - Q_ASSERT_X(ok, "camerax ui", "error in xml file parsing"); + CX_ASSERT_ALWAYS(ok); // get needed pointers to some of the widgets widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ZOOM_SLIDER); mSlider = qobject_cast (widget); - CX_DEBUG_ASSERT(mSlider); + CX_ASSERT_ALWAYS(mSlider); //Let's add a plus and minus buttons to the slider mSlider->addZoomButtons(); @@ -201,9 +281,9 @@ mToolbar = mToolbarIdle; - CX_DEBUG_ASSERT(mToolbarIdle); - CX_DEBUG_ASSERT(mToolbarRec); - CX_DEBUG_ASSERT(mToolbarPaused); + CX_ASSERT_ALWAYS(mToolbarIdle); + CX_ASSERT_ALWAYS(mToolbarRec); + CX_ASSERT_ALWAYS(mToolbarPaused); hideControls(); @@ -240,20 +320,20 @@ HbWidget *indicatorContainer; widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_INDICATOR_CONTAINER_BOTTOM); indicatorContainer = qobject_cast(widget); - CX_DEBUG_ASSERT(indicatorContainer); + CX_ASSERT_ALWAYS(indicatorContainer); createWidgetBackgroundGraphic(indicatorContainer, TRANSPARENT_BACKGROUND_GRAPHIC); widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_ELAPSED_TIME_LABEL); mElapsedTimeText = qobject_cast (widget); - CX_DEBUG_ASSERT(mElapsedTimeText); + CX_ASSERT_ALWAYS(mElapsedTimeText); widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_REMAINING_TIME_LABEL); mRemainingTimeText = qobject_cast (widget); - CX_DEBUG_ASSERT(mRemainingTimeText); + CX_ASSERT_ALWAYS(mRemainingTimeText); widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_RECORDING_ICON); mRecordingIcon = qobject_cast (widget); - CX_DEBUG_ASSERT(mRecordingIcon); + CX_ASSERT_ALWAYS(mRecordingIcon); mWidgetsLoaded = true; @@ -391,7 +471,7 @@ if (mDocumentLoader) { QObject *obj = mDocumentLoader->findObject(iconObjectName); - CX_DEBUG_ASSERT(obj); + CX_ASSERT_ALWAYS(obj); qobject_cast(obj)->setIcon(HbIcon(icon)); } } else { @@ -556,13 +636,12 @@ void CxuiVideoPrecaptureView::goToStill() { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0( camerax_performance, DUP1_CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" ); + OstTrace0( camerax_performance, CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 1" ); hideControls(); mEngine->initMode(ImageMode); emit changeToPrecaptureView(); - OstTrace0( camerax_performance, DUP2_CXUIVIDEOPRECAPTUREVIEW_GOTOSTILL, "msg: e_CX_GO_TO_STILL_MODE 0" ); CX_DEBUG_EXIT_FUNCTION(); } @@ -646,7 +725,7 @@ { CX_DEBUG_ENTER_FUNCTION(); - TBool status = mVideoCaptureControl->elapsedTime(mTimeElapsed); + bool status = mVideoCaptureControl->elapsedTime(mTimeElapsed); CX_DEBUG(("Elapsed time: %d", mTimeElapsed)); CX_DEBUG(("status: %d", status)); @@ -863,6 +942,10 @@ // update video remaining time counter when video quality is changed updateTimeLabels(); + } else if (key == CxeSettingIds::GEOTAGGING) { + reloadIndicatorWidgets(); + } else if (key == CxeSettingIds::VIDEO_MUTE_SETTING) { + reloadIndicatorWidgets(); } } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuiview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiview.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -86,6 +86,9 @@ connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls())); mHideControlsTimeout.setSingleShot(true); mHideControlsTimeout.setInterval(CXUI_HIDE_CONTROLS_TIMEOUT); + + mControlsFeedback.setOwningWindow(mMainWindow); + CX_DEBUG_EXIT_FUNCTION(); } /*! @@ -455,11 +458,9 @@ { //! @todo temporary workaround for title bar mouse event handling bug if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70 && - isFeedbackEnabled()) { - // todo: sound disabling doesn't work in orbit yet so don't do feedback on release - // needs to be enabled when orbit support is done - //mControlsFeedback.setModalities(HbFeedback::Tactile); - //mControlsFeedback.play(); + isFeedbackEnabled()) { + mControlsFeedback.setModalities(HbFeedback::Tactile); + mControlsFeedback.play(); toggleControls(); event->accept(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp --- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -43,11 +42,16 @@ #include "cxuiserviceprovider.h" #include "cxuiscenemodeview.h" + +#ifdef Q_OS_SYMBIAN #include "OstTraceDefinitions.h" + #ifdef OST_TRACE_COMPILER_IN_USE #include "cxuiviewmanagerTraces.h" #endif +#endif //Q_OS_SYMBIAN + using namespace Cxe; using namespace CxUiLayout; @@ -68,8 +72,7 @@ mKeyHandler(NULL), mCameraDocumentLoader(NULL), mApplicationState(NULL), - mErrorManager(NULL), - mSceneModeView(NULL) + mErrorManager(NULL) { CX_DEBUG_ENTER_FUNCTION(); @@ -77,18 +80,18 @@ mDocmlFilesByView.insert(STILL_PRE_CAPTURE_VIEW, STILL_1ST_XML); mDocmlFilesByView.insert(VIDEO_PRE_CAPTURE_VIEW, VIDEO_1ST_XML); mDocmlFilesByView.insert(POSTCAPTURE_VIEW, POSTCAPTURE_XML); - mDocmlFilesByView.insert(STILL_SCENES_VIEW, SCENEMODE_SETTING_XML); + mDocmlFilesByView.insert(SCENE_MODE_VIEW, SCENEMODE_SETTING_XML); // Key handler mKeyHandler = new CxuiCaptureKeyHandler(mEngine); // Document loader - OstTrace0( camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1" ); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_1, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 1"); mCameraDocumentLoader = new CxuiDocumentLoader(&engine); - OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CXUIVIEWMANAGER, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0" ); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CXUIVIEWMANAGER_2, "msg: e_CX_VIEWMANAGER_CREATE_DOCLOADER 0"); // Application state - mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), *mKeyHandler, mCameraDocumentLoader); + mApplicationState = new CxuiApplicationState(mApplication, mEngine.settings(), mCameraDocumentLoader); CX_ASSERT_ALWAYS(mApplicationState); bool ok = connect(mApplicationState, SIGNAL(stateChanged(CxuiApplicationState::State, CxuiApplicationState::State)), this, SLOT(handleApplicationStateChanged(CxuiApplicationState::State, CxuiApplicationState::State))); @@ -217,6 +220,7 @@ disconnectSignals(view); // Make sure standby timer is not running. stopStandbyTimer(); + CX_DEBUG_EXIT_FUNCTION(); } @@ -240,28 +244,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -/** - * Init engine to correct mode based on activity being restored. - */ -void CxuiViewManager::initEngine() -{ - Cxe::CameraMode mode = Cxe::ImageMode; - QString activityId = mApplication.activateId(); - if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY || - activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) { - mode = Cxe::VideoMode; - } - if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY || - activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) { - // init engine only if going to pre-capture - mEngine.initMode(mode); - } else { - // in post-capture don't init but set the correct mode to engine - // so init can be done later - mEngine.setMode(mode); - } -} - /*! * Helper function to return current view cast to CxuiView. */ @@ -287,7 +269,7 @@ connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), this, SLOT(changeToPrecaptureView())); - } else if (mApplication.activateReason() == Hb::ActivationReasonActivity ) { + } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) { // restoring activity, read startup view from stored activity // view to start in @@ -355,7 +337,7 @@ { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0( camerax_performance, CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_VIEW 1" ); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_IN, "msg: e_CX_CREATE_VIEW 1"); CX_DEBUG(("View name: %s", viewName.toAscii().data())); @@ -366,56 +348,38 @@ // Use document loader to create widgets and layouts // (non-sectioned parts are parsed and loaded) QString docmlFile = mDocmlFilesByView[viewName]; - CX_DEBUG_ASSERT(mCameraDocumentLoader); + CX_ASSERT_ALWAYS(mCameraDocumentLoader); CX_ASSERT_ALWAYS(!docmlFile.isNull()); - OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_ADDPRECAPTUREVIEWS, "msg: e_CX_DOCLOADER_LOAD 1" ); - + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_2, "msg: e_CX_DOCUMENTLOADER_LOAD 1"); mCameraDocumentLoader->load(docmlFile, &ok); - + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_4, "msg: e_CX_DOCUMENTLOADER_LOAD 0"); Q_ASSERT_X(ok, "createView", "error in xml file parsing"); - OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_DOCLOADER_LOAD 0" ); - - OstTrace0( camerax_performance, DUP4_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 1" ); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_6, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1"); QGraphicsWidget *widget = NULL; // ask for the view widget pointer widget = mCameraDocumentLoader->findWidget(viewName); view = qobject_cast (widget); - CX_DEBUG_ASSERT(view); - OstTrace0( camerax_performance, DUP5_CXUIVIEWMANAGER_ADDVIEWS, "msg: e_CX_DOCLOADER_FINDWIDGET 0" ); + CX_ASSERT_ALWAYS(view); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_8, "msg: e_CX_DOCUMENTLOADER_FINDWIDGET 1"); // call for needed consturction methods view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler, mApplication.activityManager()); // .. and add to main window (which also takes ownership) - OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 1" ); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1"); mMainWindow.addView(view); mViews.insert(viewName, view); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_12, "msg: e_CX_MAINWINDOW_ADDVIEW 0"); + } - OstTrace0( camerax_performance, DUP2_CXUIVIEWMANAGER_MAINWINDOW_ADDVIEW, "msg: e_CX_MAINWINDOW_ADDVIEW 0" ); - OstTrace0( camerax_performance, DUP1_CXUIVIEWMANAGER_CREATEVIEW, "msg: e_CX_CREATE_STILLPRECAPTUREVIEW 0" ); - - } + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_OUT, "msg: e_CX_CREATE_VIEW 0"); CX_DEBUG_EXIT_FUNCTION(); return view; } /*! -* Create scene mode view. -*/ -CxuiView* CxuiViewManager::createSceneModesView() -{ - CX_DEBUG_ENTER_FUNCTION(); - - mSceneModeView = qobject_cast(createView(STILL_SCENES_VIEW)); - mSceneModeView->loadBackgroundImages(); - - CX_DEBUG_EXIT_FUNCTION(); - return mSceneModeView; -} - -/*! * CxuiViewManager::showScenesView * A private method for displaying Scene Modes selection view */ @@ -425,14 +389,11 @@ // Disconnect signals from old view. disconnectSignals(); - if (!mSceneModeView) { - createSceneModesView(); - } - else { - mSceneModeView->loadBackgroundImages(); - } - CX_DEBUG_ASSERT(mSceneModeView); - mMainWindow.setCurrentView(mSceneModeView, false); + CxuiSceneModeView *view = qobject_cast(createView(SCENE_MODE_VIEW)); + CX_ASSERT_ALWAYS(view); + view->loadBackgroundImages(); + + mMainWindow.setCurrentView(view, false); stopStandbyTimer(); connectSceneModeSignals(); @@ -464,23 +425,6 @@ } /*! -* Get a pointer to the document loader instance. -*/ -CxuiDocumentLoader *CxuiViewManager::documentLoader() -{ - return mCameraDocumentLoader; -} - -/*! -* Get reference to application state instance. -*/ -CxuiApplicationState &CxuiViewManager::applicationState() -{ - return *mApplicationState; -} - - -/*! * Move to post-capture view. */ void CxuiViewManager::changeToPostcaptureView() @@ -530,11 +474,16 @@ mEngine.cameraDeviceControl().cameraIndex()); mMainWindow.setCurrentView(view, false); - if (mSceneModeView){ - mViews.remove(STILL_SCENES_VIEW); - delete mSceneModeView; - mSceneModeView = NULL; + // Release resources needed by scene view. + HbView *sceneView = mViews.take(SCENE_MODE_VIEW); + if (sceneView) { + // This will not delete the view. + mMainWindow.removeView(sceneView); + // We can get to this slot from scene view, so don't delete the object too early. + sceneView->deleteLater(); + sceneView = NULL; } + // connecting necessary pre-capture view signals connectPreCaptureSignals(); @@ -631,15 +580,19 @@ void CxuiViewManager::connectSignals(QObject *view) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_1, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 1"); + if (view) { if (view == mViews[POSTCAPTURE_VIEW]) { connectPostCaptureSignals(); - } else if (view == mSceneModeView) { + } else if (view == mViews[SCENE_MODE_VIEW]) { connectSceneModeSignals(); } else { connectPreCaptureSignals(); } } + + OstTrace0(camerax_performance, CXUIVIEWMANAGER_CONNECTSIGNALS_2, "msg: e_CX_VIEWMANAGER_CONNECT_SIGNALS 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -651,6 +604,7 @@ void CxuiViewManager::disconnectSignals(QObject *view) { CX_DEBUG_ENTER_FUNCTION(); + OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_1, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 1"); // Disconnect all existing capture key signals mKeyHandler->disconnect(); @@ -668,6 +622,7 @@ disconnect(this, 0, view, 0); } + OstTrace0(camerax_performance, CXUIVIEWMANAGER_DISCONNECT_2, "msg: e_CX_VIEWMANAGER_DISCONNECT_SIGNALS 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -724,6 +679,7 @@ disconnectSignals(); QObject *currentView = mMainWindow.currentView(); if (currentView == mViews[POSTCAPTURE_VIEW]) { + connect(currentView, SIGNAL(changeToPrecaptureView()), this, SLOT(changeToPrecaptureView()), Qt::UniqueConnection); // Standby signals @@ -745,15 +701,19 @@ CX_DEBUG_ENTER_FUNCTION(); disconnectSignals(); - connectCaptureKeySignals(); + HbView *currentView = mMainWindow.currentView(); + + if (currentView == mViews[SCENE_MODE_VIEW]) { + + connectCaptureKeySignals(); - // Standby signals for releasing camera - connect(this, SIGNAL(normalStateEntered()), mSceneModeView, SLOT(exitStandby())); - connect(this, SIGNAL(normalStateExited()), mSceneModeView, SLOT(enterStandby())); + // Standby signals for releasing camera + connect(this, SIGNAL(normalStateEntered()), currentView, SLOT(exitStandby())); + connect(this, SIGNAL(normalStateExited()), currentView, SLOT(enterStandby())); - // Moving back to pre-capture view - connect(mSceneModeView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView())); - + // Moving back to pre-capture view + connect(currentView, SIGNAL(viewCloseEvent()), this, SLOT(changeToPrecaptureView())); + } CX_DEBUG_EXIT_FUNCTION(); } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/cxui/src/main.cpp --- a/camerauis/cameraxui/cxui/src/main.cpp Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/main.cpp Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -15,27 +15,35 @@ * */ -#include -#include #include #include // needed for localization +#include #include -#include #include +#ifdef Q_OS_SYMBIAN +#include +#include +#endif // Q_OS_SYMBIAN + #include "cxeengine.h" #include "cxecameradevicecontrol.h" #include "cxuiapplication.h" #include "cxuiviewmanager.h" #include "cxuiapplicationstate.h" +#include "cxuienums.h" #include "cxutils.h" #include "cxuiserviceprovider.h" +#ifdef Q_OS_SYMBIAN #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "mainTraces.h" -#endif +#endif // OST_TRACE_COMPILER_IN_USE +#else +#include "cxuimacrosdesktop.h" +#endif // Q_OS_SYMBIAN using namespace Cxe; @@ -63,80 +71,94 @@ // Reserve and power on can then proceed in parallel with // ui construction. OstTrace0( camerax_performance, DUP7__MAIN, "msg: e_CX_CREATE_ENGINE 1" ); - CxeEngine *eng = CxeEngine::createEngine(); + CxeEngine *engine = CxeEngine::createEngine(); OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" ); if (app.activateReason() == Hb::ActivationReasonService) { // Embedded mode. Engine is inited to correct mode // by service provider when request arrives CX_DEBUG(("CxUI: creating serviceprovider")); - CxuiServiceProvider::create(eng); + CxuiServiceProvider::create(engine); CX_DEBUG(("CxUI: done")); - } else { - // Normal mode. Init engine now. - OstTrace0( camerax_performance, DUP9__MAIN, "msg: e_CX_INIT_ENGINE 1" ); - //! @todo temporarily commented as part of a hack to change the startup sequence - // to avoid GOOM issues - //eng->initMode(Cxe::ImageMode); - OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" ); - } + } else if (app.activateReason() == Hb::ActivationReasonActivity) { + Cxe::CameraMode mode = Cxe::ImageMode; + QString activityId = app.activateId(); + if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY || + activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) { + mode = Cxe::VideoMode; + } + + if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY || + activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY) { + // init engine only if going to pre-capture + engine->initMode(mode); + } else { + // in post-capture don't init but set the correct mode to engine + // so init can be done later + engine->setMode(mode); + } + } else { + // normal start + engine->initMode(engine->mode()); + } + +#ifdef Q_OS_SYMBIAN + //!@todo: Yield run time to system to get enough resources released to start camera. + CX_DEBUG(("CxUI: yield control for resource freeing..")); + User::After(300*1000); // 300ms + CX_DEBUG(("CxUI: waiting done..")); +#endif // Q_OS_SYMBIAN // Load language specific application localization file, e.g. "camera_en.qm" + // Translations need to be loaded before any widgets are created. CX_DEBUG(("CxUI: Load translations..")); OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" ); - HbTranslator* trans = new HbTranslator(TRANSLATIONS_PATH, TRANSLATIONS_FILE); + HbTranslator translator(TRANSLATIONS_PATH, TRANSLATIONS_FILE); // Load language specific common localization file - trans->loadCommon(); + translator.loadCommon(); OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" ); CX_DEBUG(("CxUI: ..translations loaded")); + // Create main window OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" ); - HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent | - Hb::WindowFlagNoBackground); - mainWindow->setAttribute(Qt::WA_NoBackground); + HbMainWindow mainWindow(0, Hb::WindowFlagTransparent | Hb::WindowFlagNoBackground); + mainWindow.setAttribute(Qt::WA_NoBackground); OstTrace0( camerax_performance, DUP6__MAIN, "msg: e_CX_MAINWINDOW_CREATION 0" ); - OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" ); - CxuiViewManager *viewManager = new CxuiViewManager(app, *mainWindow, *eng); - OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" ); - + // Set main window to landscape and full screen OstTrace0( camerax_performance, DUP13__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 1" ); - mainWindow->setOrientation(Qt::Horizontal); + mainWindow.setOrientation(Qt::Horizontal); OstTrace0( camerax_performance, DUP14__MAIN, "msg: e_CX_MAINWINDOW_SETORIENTATION 0" ); + OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" ); - OstTrace0( camerax_performance, DUP15__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 1" ); - mainWindow->showFullScreen(); +#ifdef Q_OS_SYMBIAN + mainWindow.showFullScreen(); +#else + /* + * todo : check if this is an Orbit bug or if there's a better solution + */ + mainWindow.resize(640, 360); + mainWindow.setOrientation(Qt::Vertical, false); + mainWindow.show(); + mainWindow.setOrientation(Qt::Horizontal, false); +#endif //Q_OS_SYMBIAN OstTrace0( camerax_performance, DUP16__MAIN, "msg: e_CX_MAINWINDOW_FULLSCREEN 0" ); - OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" ); - eng->viewfinderControl().setWindow(mainWindow->effectiveWinId()); - OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" ); + // Create view manager + OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" ); + CxuiViewManager *viewManager = new CxuiViewManager(app, mainWindow, *engine); + OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" ); - //! @todo initMode call added here as a temporary hack to change the startup sequence - // in order to avoid GOOM issues. - if (app.activateReason() != Hb::ActivationReasonService - && viewManager->applicationState().currentState() == CxuiApplicationState::Normal) { - User::After(2000000); - if (app.activateReason() == Hb::ActivationReasonActivity) { - // when started by activity, let viewmanager init - // to correct mode - viewManager->initEngine(); - } else { - // normal start - eng->initMode(eng->mode()); - } - } + // Give main window id to engine for setting up viewfinder window behind it + OstTrace0( camerax_performance, DUP17__MAIN, "msg: e_CX_PREPAREWINDOW 1" ); + engine->viewfinderControl().setWindow(mainWindow.effectiveWinId()); + OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" ); int returnValue = app.exec(); delete viewManager; - - // delete service provider instance - CxuiServiceProvider::destroy(); - - delete mainWindow; - delete trans; - delete eng; + CxuiServiceProvider::destroy(); // delete service provider instance + delete engine; return returnValue; } diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/rom/camerax.iby --- a/camerauis/cameraxui/rom/camerax.iby Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/rom/camerax.iby Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -23,7 +23,6 @@ // Ui S60_APP_EXE(cxui) data = DATAZ_\private\10003a3f\import\apps\cxui_reg.rsc \private\10003a3f\import\apps\cxui_reg.rsc -data = DATAZ_\APP_RESOURCE_DIR\cxui.mif APP_RESOURCE_DIR\cxui.mif // Sounds data = DATAZ_\system\sounds\digital\capture.wav system\sounds\digital\capture.wav diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/rom/camerax_stub.pkg --- a/camerauis/cameraxui/rom/camerax_stub.pkg Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/rom/camerax_stub.pkg Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ ; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). ; All rights reserved. ; This component and the accompanying materials are made available ; under the terms of "Eclipse Public License v1.0" @@ -30,5 +30,4 @@ "" - "z:\sys\bin\cxui.exe" "" - "z:\resource\apps\cxui.r*" "" - "z:\private\10003a3f\import\apps\cxui_reg.rsc" -"" - "z:\resource\apps\cxui.mif" "" - "z:\sys\bin\cxengine.dll" diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/rom/camerax_stub.sis Binary file camerauis/cameraxui/rom/camerax_stub.sis has changed diff -r 67457b2ffb33 -r feebad15db8c camerauis/cameraxui/rom/cameraxresources.iby --- a/camerauis/cameraxui/rom/cameraxresources.iby Thu Jul 15 01:52:14 2010 +0300 +++ b/camerauis/cameraxui/rom/cameraxresources.iby Thu Jul 15 01:53:45 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -20,9 +20,7 @@ #include -data=DATAZ_\APP_RESOURCE_DIR\camera.rsc APP_RESOURCE_DIR\camera.rsc - -data=DATAZ_\QT_TRANSLATIONS_DIR\camera.qm QT_TRANSLATIONS_DIR\camera.qm +data=DATAZ_\QT_TRANSLATIONS_DIR\camera.qm QT_TRANSLATIONS_DIR\camera.qm S60_APP_RESOURCE(cxui)