# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286139908 -10800 # Node ID 415ff50d2ecaf493b2eb89a96c3db1ba65ba352e # Parent a289dde0a1d614704bcf7d1f23a15621fa5aa093 Revision: 201037 Kit: 201039 diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/conf/cameraxvariation.confml --- a/camerauis/cameraxui/cxengine/conf/cameraxvariation.confml Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/conf/cameraxvariation.confml Mon Oct 04 00:05:08 2010 +0300 @@ -44,6 +44,11 @@ + + Force the use of Qt raster graphics system instead of the default graphics system. + + + @@ -54,6 +59,7 @@ 8000000,10000000 32,32,32,32,32 40,40,40,-1,-1 + 1 diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/conf/cameraxvariation_20027018.crml --- a/camerauis/cameraxui/cxengine/conf/cameraxvariation_20027018.crml Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/conf/cameraxvariation_20027018.crml Mon Oct 04 00:05:08 2010 +0300 @@ -25,4 +25,8 @@ + + + + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/cxengine.pro --- a/camerauis/cameraxui/cxengine/cxengine.pro Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/cxengine.pro Mon Oct 04 00:05:08 2010 +0300 @@ -22,6 +22,7 @@ } else { CONFIG += dll DEFINES += CAMERAX_ENGINE_LIBRARY + VERSION = 10.0.1 } TEMPLATE = lib diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/inc/api/cxeengine.h --- a/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/api/cxeengine.h Mon Oct 04 00:05:08 2010 +0300 @@ -20,6 +20,7 @@ #include #include "cxenamespace.h" #include "cxengine_global.h" +#include "cxeerror.h" class CxeCameraDeviceControl; class CxeViewfinderControl; @@ -125,6 +126,9 @@ //! returns if the engine is ready or not virtual bool isEngineReady() = 0; +signals: + void fileSaved(CxeError::Id status, const QString &filename); + protected: CxeEngine(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h --- a/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxefilesavethreadsymbian.h Mon Oct 04 00:05:08 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009-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" @@ -58,6 +58,9 @@ virtual void init(); virtual void deinit(); +signals: + void fileSaved(CxeError::Id status, const QString &filename); + private: /** * This method includes saving in own thread. diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -166,6 +166,9 @@ mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread(); + connect(mFileSaveThread, SIGNAL(fileSaved(CxeError::Id, const QString&)), + this, SIGNAL(fileSaved(CxeError::Id, const QString&))); + mStillCaptureControl = new CxeStillCaptureControlSymbian( *mCameraDevice, *mViewfinderControl, *mSnapshotControl, *mCameraDeviceControl, *mFilenameGenerator, *mSensorEventHandler, *mAutoFocusControl, diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxefilesavethreadsymbian.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009-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" @@ -266,6 +266,8 @@ // Releasing the snapshot if it exists. mSnapshots.remove(filename); + emit fileSaved(status, filename); + CX_DEBUG_EXIT_FUNCTION(); } diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -187,21 +187,22 @@ void CxeStillCaptureControlSymbian::init() { CX_DEBUG_ENTER_FUNCTION(); - OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_IN, "msg: e_CX_STILL_CAPCONT_INIT 1"); if (state() == Uninitialized) { - + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_IN, "msg: e_CX_STILL_CAPCONT_INIT 1"); + // prepare for still capture. prepare(); // Initialize orientation sensor and other sensors mSensorEventHandler.init(); - + // inform zoom control to prepare zoom emit prepareZoomForStill(mSizeIndex); + + OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_OUT, "msg: e_CX_STILL_CAPCONT_INIT 0"); } - OstTrace0(camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_INIT_OUT, "msg: e_CX_STILL_CAPCONT_INIT 0"); CX_DEBUG_EXIT_FUNCTION(); } @@ -212,32 +213,30 @@ { CX_DEBUG_ENTER_FUNCTION(); - if (state() == Uninitialized) { - // nothing to do - return; + if (state() != Uninitialized) { + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" ); + + // Stop monitoring disk space. + mDiskMonitor.stop(); + disconnect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged())); + + //stop viewfinder + mViewfinderControl.stop(); + + if (state() == Capturing) { + mCameraDevice.camera()->CancelCaptureImage(); + } + + // disable sensor event handler. + mSensorEventHandler.deinit(); + + mSnapshotControl.stop(); + + setState(Uninitialized); + + OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" ); } - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_IN, "msg: e_CX_STILLCAPCONT_DEINIT 1" ); - - // Stop monitoring disk space. - mDiskMonitor.stop(); - disconnect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged())); - - //stop viewfinder - mViewfinderControl.stop(); - - if (state() == Capturing) { - mCameraDevice.camera()->CancelCaptureImage(); - } - - // disable sensor event handler. - mSensorEventHandler.deinit(); - - mSnapshotControl.stop(); - - setState(Uninitialized); - - OstTrace0( camerax_performance, CXESTILLCAPTURECONTROLSYMBIAN_DEINIT_OUT, "msg: e_CX_STILLCAPCONT_DEINIT 0" ); CX_DEBUG_EXIT_FUNCTION(); } @@ -248,12 +247,6 @@ void CxeStillCaptureControlSymbian::prepare() { CX_DEBUG_ENTER_FUNCTION(); - - if (state() != Uninitialized) { - // wrong state and we return - return; - } - OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_PREPARE_IN, "msg: e_CX_STILLCAPCONT_PREPARE 1"); CxeError::Id status(CxeError::None); @@ -279,7 +272,7 @@ // Start monitoring disk space. mDiskMonitor.start(); - connect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged())); + connect(&mDiskMonitor, SIGNAL(diskSpaceChanged()), this, SLOT(handleDiskSpaceChanged()), Qt::UniqueConnection); // Enable AF reticule drawing by adaptation MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking(); @@ -470,12 +463,6 @@ // Emit snapshotReady signal in all cases (error or not) emit snapshotReady(status, snapshot, stillImage->id()); - // When the snapshot ready event is handled, prepare new filename. - if (stillImage->filename().isEmpty()) { - // Error ignored at this point, try again when image data arrives. - prepareFilename(stillImage); - } - OstTrace0(camerax_performance, CXESTILLCAPTURECONTROL_HANDLESNAPSHOT_2, "msg: e_CX_HANDLE_SNAPSHOT 0"); } @@ -578,7 +565,7 @@ /*! - * Settings changed, needs updated + * Settings changed, needs updated. */ void CxeStillCaptureControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue) { @@ -587,10 +574,21 @@ Q_UNUSED(newValue); if (settingId == CxeSettingIds::IMAGE_QUALITY) { - // re-prepare for still + // Re-prepare for still, if already prepared. if (state() == Ready) { - deinit(); - init(); + // Avoid problems with AF status overlays. + mAutoFocusControl.cancel(); + + // Viewfinder and snapshot need to be re-prepared if active. + // Stop them now to get proper re-prepare done. + mSnapshotControl.stop(); + mViewfinderControl.stop(); + + // Re-prepare image capture for the new quality. + prepare(); + + // Inform zoom control to prepare zoom for new quality. + emit prepareZoomForStill(mSizeIndex); } } diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxegeotaggingtrail/unittest_cxegeotaggingtrail.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxegeotaggingtrail/unittest_cxegeotaggingtrail.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -0,0 +1,184 @@ +/* +* 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 +#include +#include +#include +#include +#include + +#include "unittest_cxegeotaggingtrail.h" +#include "cxefakestillcapturecontrol.h" +#include "cxefakevideocapturecontrol.h" +#include "cxegeotaggingtrail.h" +#include "cxefakesettings.h" +#include "cxetestutils.h" +#include "cxenamespace.h" + + + + +/** +* UnitTestCxeGeoTaggingTrail::UnitTestCxeGeoTaggingTrail() +*/ +UnitTestCxeGeoTaggingTrail::UnitTestCxeGeoTaggingTrail() +: mTrail(NULL), mSettings(NULL) +{ +} + +/** +* UnitTestCxeGeoTaggingTrail::~UnitTestCxeGeoTaggingTrail() +*/ +UnitTestCxeGeoTaggingTrail::~UnitTestCxeGeoTaggingTrail() +{ + cleanup(); +} + +/** +* UnitTestCxeGeoTaggingTrail::init() +*/ +void UnitTestCxeGeoTaggingTrail::init() +{ + CxeFakeStillCaptureControl *fakeStillControl = new CxeFakeStillCaptureControl(); + CxeFakeVideoCaptureControl *fakeVideoControl = new CxeFakeVideoCaptureControl(); + mSettings = new CxeFakeSettings(); + + CxeStillCaptureControl *stillControl = qobject_cast(fakeStillControl); + CxeVideoCaptureControl *videoControl = qobject_cast(fakeVideoControl); + + // trail is started automatically during construction + mTrail = new CxeGeoTaggingTrail(*stillControl, *videoControl, *mSettings); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::NotConnected); +} + +/** +* UnitTestCxeGeoTaggingTrail::cleanup() +*/ +void UnitTestCxeGeoTaggingTrail::cleanup() +{ + delete mTrail; + mTrail = NULL; + + delete mSettings; + mSettings = NULL; +} + + +/** +* UnitTestCxeGeoTaggingTrail::testStart() +*/ +void UnitTestCxeGeoTaggingTrail::testStart() +{ + int settingValue; + // case 1: try to start/stop geotagging trail when setting is off + settingValue = 0; + mSettings->set(CxeSettingIds::GEOTAGGING, settingValue); + mTrail->start(); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::NotConnected); + + mTrail->stop(); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::NotConnected); + + // case 2: geotagging setting is ON, starting trail and emulating real state changes in P&S key + settingValue = 1; + mSettings->set(CxeSettingIds::GEOTAGGING, settingValue); + mTrail->start(); + + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::TrailStarted); + + // trail started, emulate as if P&S key has state updates from RLocationTrail. + int newState = RLocationTrail::ETrailStarted; + mSettings->emulate(KPSUidLocationTrail.iUid, KLocationTrailState, newState); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::DataAvailable); + + // case 3: geotagging setting on, trail started, but RLocationTrail doesnt get trail ongoing + settingValue = 1; + mSettings->set(CxeSettingIds::GEOTAGGING, settingValue); + mTrail->start(); + + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::DataAvailable); + + // trail started, emulate as if P&S key has state updates from RLocationTrail. + newState = RLocationTrail::EWaitingGPSData; + mSettings->emulate(KPSUidLocationTrail.iUid, KLocationTrailState, newState); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::DataAvailable); + + // we now try to stop trail + mTrail->stop(); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::Connected); + + // Case 4: just changing the setting value + // setting value is ON, trail should start + settingValue = 1; + mSettings->set(CxeSettingIds::GEOTAGGING, settingValue); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::TrailStarted); + + // trail started, emulate as if P&S key has state updates from RLocationTrail. + newState = RLocationTrail::ETrailStarted; + mSettings->emulate(KPSUidLocationTrail.iUid, KLocationTrailState, newState); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::DataAvailable); + + // setting value is OFF, trail should stop + settingValue = 0; + mSettings->set(CxeSettingIds::GEOTAGGING, settingValue); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::Connected); + +} + +/** +* UnitTestCxeGeoTaggingTrail::testStop() +*/ +void UnitTestCxeGeoTaggingTrail::testStop() +{ + // case 1: Trying to stop the trail even before starting + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::NotConnected); + mTrail->stop(); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::NotConnected); + + // case 2: trail connected but not started + int settingValue = 1; + mSettings->set(CxeSettingIds::GEOTAGGING, settingValue); + mTrail->start(); + + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::TrailStarted); + + // now stopping trail: + mTrail->stop(); + // here we are connected to trail but trail not started. + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::Connected); + + // trying to stop the trail again + mTrail->stop(); + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::Connected); + +} + + + +/** +* UnitTestCxeGeoTaggingTrail::testState() +*/ +void UnitTestCxeGeoTaggingTrail::testState() +{ + QCOMPARE(mTrail->state(), CxeGeoTaggingTrail::NotConnected); +} + +// main() function +QTEST_MAIN(UnitTestCxeGeoTaggingTrail); + +// end of file diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxegeotaggingtrail/unittest_cxegeotaggingtrail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxegeotaggingtrail/unittest_cxegeotaggingtrail.h Mon Oct 04 00:05:08 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef UNITTEST_CXEGEOTAGGINGTRAIL_H +#define UNITTEST_CXEGEOTAGGINGTRAIL_H + +#include + +// forward declartion +class CxeFakeSettings; +class CxeGeoTaggingTrail; + +// class defining unit test cases for CxeGeoTaggingTrail engine class + +class UnitTestCxeGeoTaggingTrail : public QObject +{ + Q_OBJECT + +public: + UnitTestCxeGeoTaggingTrail(); + ~UnitTestCxeGeoTaggingTrail(); + +private slots: + void init(); + void cleanup(); + void testStart(); + void testStop(); + void testState(); + + +private: + // data + CxeGeoTaggingTrail *mTrail; + CxeFakeSettings *mSettings; +}; + +#endif // UNITTEST_CXEGEOTAGGINGTRAIL_H diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxegeotaggingtrail/unittest_cxegeotaggingtrail.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxegeotaggingtrail/unittest_cxegeotaggingtrail.pro Mon Oct 04 00:05:08 2010 +0300 @@ -0,0 +1,73 @@ +# 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: + +# This unit test doesn't want to include system include path of real header api +CONFIG *= cxeunit_no_system_paths + +include(../unittest.pri) + +INCLUDEPATH *= ../system_include +DEPENDPATH *= ../system_include + +TARGET = unittest_cxegeotaggingtrail + + +LIBS *= -lecamadvsettings +LIBS *= -lecamsnapshot +LIBS *= -lfbscli +LIBS *= -lbitgdi +LIBS *= -lsysutil +LIBS *= -lecam +LIBS *= -lecampluginsupport +LIBS *= -lplatformenv +LIBS *= -lefsrv +LIBS += -llocationmanager + +DEFINES *= CXE_USE_DUMMY_CAMERA + +SOURCES *= unittest_cxegeotaggingtrail.cpp \ + rlocationtrail.cpp \ + harvesterclient.cpp \ + cxegeotaggingtrail.cpp \ + cxegeotaggingtrail_symbian_p.cpp \ + cxefakeimagedataitem.cpp \ + cxefakevideocapturecontrol.cpp \ + cxefakestillcapturecontrol.cpp \ + cxefakesettings.cpp \ + cxesysutil.cpp \ + cxestatemachinebase.cpp \ + cxestatemachine.cpp \ + cxestate.cpp \ + cxeerrormappingsymbian.cpp \ + cxefakequalitypresets.cpp + +HEADERS *= unittest_cxegeotaggingtrail.h \ + rlocationtrail.h \ + harvesterclient.h \ + cxegeotaggingtrail.h \ + cxegeotaggingtrail_symbian_p.h \ + cxefakeimagedataitem.h \ + cxefakevideocapturecontrol.h \ + cxeimagedataitem.h \ + cxeerror.h \ + cxefakestillcapturecontrol.h \ + cxestillcapturecontrol.h \ + cxevideocapturecontrol.h \ + cxesettings.h \ + cxefakequalitypresets.h \ + cxequalitypresets.h \ + cxefakesettings.h \ + cxesysutil.h \ + cxestatemachinebase.h \ + cxestatemachine.h \ + cxestate.h \ + cxeerrormappingsymbian.h + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxescenemodestore/unittest_cxescenemodestore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxescenemodestore/unittest_cxescenemodestore.cpp Mon Oct 04 00:05:08 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: Unit tests for CxeSceneModeStore class + * + */ + +#include +#include + +#include "cxenamespace.h" +#include "cxeerror.h" +#include "cxeexception.h" +#include "unittest_cxescenemodestore.h" + +const char* FAIL_TEST_SETTING = "Fail test"; + +UnitTestCxeSceneModeStore::UnitTestCxeSceneModeStore() : + mSceneModeStore(NULL) +{ +} + +UnitTestCxeSceneModeStore::~UnitTestCxeSceneModeStore() +{ +} + +void UnitTestCxeSceneModeStore::init() +{ + mSceneModeStore = new CxeSceneModeStore(); +} + +void UnitTestCxeSceneModeStore::cleanup() +{ + delete mSceneModeStore; + mSceneModeStore = NULL; +} + +void UnitTestCxeSceneModeStore::testSceneSettingValue() +{ + QVariant value; + CxeError::Id err = mSceneModeStore->sceneSettingValue(Cxe::ImageMode, CxeSettingIds::COLOR_TONE, value); + QCOMPARE(err, CxeError::None); + + err = mSceneModeStore->sceneSettingValue(Cxe::VideoMode, CxeSettingIds::COLOR_TONE, value); + QCOMPARE(err, CxeError::None); +} + +void UnitTestCxeSceneModeStore::testSceneSettingValueNotFound() +{ + QVariant value; + CxeError::Id err = mSceneModeStore->sceneSettingValue(Cxe::ImageMode, FAIL_TEST_SETTING, value); + QCOMPARE(err, CxeError::NotFound); +} + +void UnitTestCxeSceneModeStore::testCurrentScene() +{ + CxeScene scene; + try { + scene = mSceneModeStore->currentScene(Cxe::ImageMode); + } + catch (CxeException exception){ + QString message = "Exception thrown, error id = "; + message.append(exception.error()); + QFAIL(message.toAscii()); + } + QVERIFY(true); +} + +void UnitTestCxeSceneModeStore::testCurrentScene2() +{ + CxeScene scene; + try { + scene = mSceneModeStore->currentScene(Cxe::VideoMode); + } + catch (CxeException exception){ + QString message = "Exception thrown, error id = "; + message.append(exception.error()); + QFAIL(message.toAscii()); + } + QVERIFY(true); +} + +void UnitTestCxeSceneModeStore::testCurrentSceneId() +{ + QString sceneId = mSceneModeStore->currentSceneId(Cxe::ImageMode); + QVERIFY(sceneId != ""); + sceneId = mSceneModeStore->currentSceneId(Cxe::VideoMode); + QVERIFY(sceneId != ""); +} + +void UnitTestCxeSceneModeStore::testGetScene() +{ + CxeScene scene; + try { + scene = mSceneModeStore->getScene(Cxe::ImageMode, Cxe::IMAGE_SCENE_AUTO); + } + catch (CxeException exception) { + QString message = "Exception thrown, error id = "; + message.append(exception.error()); + QFAIL(message.toAscii()); + } + QVERIFY(true); +} + +void UnitTestCxeSceneModeStore::testSetCurrentScene() +{ + try { + mSceneModeStore->setCurrentScene(Cxe::ImageMode, Cxe::IMAGE_SCENE_NIGHT); + } + catch (CxeException exception){ + QString message = "Exception thrown, error id = "; + message.append(exception.error()); + QFAIL(message.toAscii()); + } + QString scene = mSceneModeStore->currentSceneId(Cxe::ImageMode); + QVERIFY(scene == Cxe::IMAGE_SCENE_NIGHT); + + mSceneModeStore->setCurrentScene(Cxe::VideoMode, Cxe::VIDEO_SCENE_LOWLIGHT); + scene = mSceneModeStore->currentSceneId(Cxe::VideoMode); + QVERIFY(scene == Cxe::VIDEO_SCENE_LOWLIGHT); +} + +void UnitTestCxeSceneModeStore::testSetSceneSettingValue() +{ + CxeError::Id err = mSceneModeStore->setSceneSettingValue(Cxe::ImageMode, CxeSettingIds::SHARPNESS, + Cxe::SharpnessHard); + QCOMPARE(err, CxeError::None); + + err = mSceneModeStore->setSceneSettingValue(Cxe::ImageMode, FAIL_TEST_SETTING, + Cxe::SharpnessHard); + QCOMPARE(err, CxeError::NotFound); + +} + +QTEST_MAIN(UnitTestCxeSceneModeStore); + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxescenemodestore/unittest_cxescenemodestore.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxescenemodestore/unittest_cxescenemodestore.h Mon Oct 04 00:05:08 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: Unit test class + * + */ + +#ifndef UNITTEST_CXESCENEMODESTORE_H +#define UNITTEST_CXESCENEMODESTORE_H + +#include + +// Tested class +#include "cxescenemodestore.h" + +class UnitTestCxeSceneModeStore : public QObject +{ + Q_OBJECT + +public: + UnitTestCxeSceneModeStore(); + ~UnitTestCxeSceneModeStore(); + +private slots: + void init(); + void cleanup(); + + //actual tests + void testSceneSettingValue(); + void testSceneSettingValueNotFound(); + void testSetSceneSettingValue(); + void testCurrentSceneId(); + void testCurrentScene(); + void testCurrentScene2(); + void testSetCurrentScene(); + void testGetScene(); + +private: + // Tested class + CxeSceneModeStore *mSceneModeStore; + +}; + + +#endif // UNITTEST_CXESCENEMODESTORE_H diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxescenemodestore/unittest_cxescenemodestore.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxescenemodestore/unittest_cxescenemodestore.pro Mon Oct 04 00:05:08 2010 +0300 @@ -0,0 +1,21 @@ +# 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: Unit test project for CxeSceneModeStore class + +include(../unittest.pri) + +TARGET = unittest_cxescenemodestore + +SOURCES *= unittest_cxescenemodestore.cpp \ + cxescenemodestore.cpp + +HEADERS *= \ + unittest_cxescenemodestore.h \ + cxescenemodestore.h diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/cxui.pro --- a/camerauis/cameraxui/cxui/cxui.pro Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/cxui.pro Mon Oct 04 00:05:08 2010 +0300 @@ -29,6 +29,7 @@ # and TraceCompiler needing USERINCLUDE. MMP_RULES += "USERINCLUDE traces" MMP_RULES += SMPSAFE + VERSION = 10.0.1 } # export sound file @@ -68,7 +69,9 @@ -lgdi \ -lapgrfx \ -lusbman \ - -lthumbnailmanagerqt + -lxqsettingsmanager \ + -lthumbnailmanagerqt \ + -lafservice } else { win32 { debug { diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h --- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h Mon Oct 04 00:05:08 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" @@ -71,7 +71,12 @@ * Otherwise mass memory mode was deactivated, and mass memory is again accessible. */ void usbMassMemoryModeToggled(bool active); - + + /*! + * Signal when task switcher state changes. + * @param foreground If true, task switcher is in foreground. Otherwise it has moved to background. + */ + void taskSwitcherStateChanged(bool foreground); private: CxuiApplicationFrameworkMonitorPrivate *p; diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h --- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Mon Oct 04 00:05:08 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" @@ -74,6 +74,7 @@ int mKeyLockState; int mBatteryStatus; int mUsbPersonality; + bool mTaskManagerVisibility; QTimer mUsbModeCheckTimer; CxuiEventLog *mEventLog; #endif // Q_OS_SYMBIAN diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h --- a/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationstate.h Mon Oct 04 00:05:08 2010 +0300 @@ -69,6 +69,7 @@ private slots: void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state); void handleUsbMassMemoryModeChanged(bool active); + void handleTaskSwitcherStateChanged(bool active); void handleBatteryEmpty(); void handleSevereError(); void handleErrorCleared(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuidisplaypropertyhandler.h --- a/camerauis/cameraxui/cxui/inc/cxuidisplaypropertyhandler.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuidisplaypropertyhandler.h Mon Oct 04 00:05:08 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -21,6 +21,8 @@ #include #include +#include "cxeviewfindercontrol.h" + /** * CxuiDisplayPropertyHandler * @@ -42,6 +44,7 @@ protected slots: void simulateActivity(); + void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error); private: // Data diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Mon Oct 04 00:05:08 2010 +0300 @@ -44,8 +44,7 @@ CxuiPostcaptureView(QGraphicsItem *parent = 0); virtual ~CxuiPostcaptureView(); void construct(HbMainWindow *mainwindow, CxeEngine *engine, - CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager); + CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); @@ -85,6 +84,7 @@ void handleDeleteDialogClosed(int action); + void handleFileSaved(); private: bool isFileDeleted(); QString getCurrentFilename(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Mon Oct 04 00:05:08 2010 +0300 @@ -27,7 +27,6 @@ #include "cxezoomcontrol.h" #include "cxegeotaggingtrail.h" #include "cxeviewfindercontrol.h" -#include "cxuidisplaypropertyhandler.h" #include "cxuiview.h" @@ -41,7 +40,6 @@ class CxuiDocumentLoader; class HbTransparentWindow; class CxuiCaptureKeyHandler; -class CxuiCaptureKeyHandler; class CxuiSettingDialog; class CxuiSettingRadioButtonList; class CxuiSettingSlider; @@ -68,8 +66,7 @@ virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager); + CxuiCaptureKeyHandler *keyHandler); virtual bool isStandbyModeSupported() const; /** @@ -123,7 +120,7 @@ // Camera / Engine void handleEngineZoomStateChange(CxeZoomControl::State newState, CxeError::Id error); void handleZoomLevelChange(int); - void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error); + virtual void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error); // UI: Zoom slider change notification void zoomTo(int value); @@ -165,7 +162,6 @@ protected: HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene - CxuiDisplayPropertyHandler *mDisplayHandler; HbToolBarExtension *mSettingsGrid; bool mWidgetsLoaded; CxuiSettingDialog *mSettingsDialog; diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h --- a/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Mon Oct 04 00:05:08 2010 +0300 @@ -60,8 +60,7 @@ void construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager); + CxuiCaptureKeyHandler *keyHandler); void loadDefaultWidgets(); void loadBackgroundImages(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiserviceprovider.h --- a/camerauis/cameraxui/cxui/inc/cxuiserviceprovider.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiserviceprovider.h Mon Oct 04 00:05:08 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -37,11 +37,13 @@ static void destroy(); static bool isCameraEmbedded(); - Cxe::CameraMode requestedMode(); + Cxe::CameraMode requestedMode() const; - bool allowModeSwitching(); - bool allowQualityChange(); - bool allowCameraSwitching(); + bool allowModeSwitching() const; + bool allowQualityChange() const; + bool allowCameraSwitching() const; + + QString windowTitle() const; public slots: @@ -75,6 +77,7 @@ bool mAllowModeSwitching; bool mAllowQualityChange; bool mAllowCameraSwitching; + QString mWindowTitle; }; diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Mon Oct 04 00:05:08 2010 +0300 @@ -55,8 +55,7 @@ virtual void construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager); + CxuiCaptureKeyHandler *keyHandler); virtual void loadDefaultWidgets(); virtual void loadWidgets(); @@ -93,7 +92,7 @@ // Engine signals void handleAutoFocusStateChanged(CxeAutoFocusControl::State newState, CxeError::Id error); - void handleViewfinderStateChanged(CxeViewfinderControl::State newState, CxeError::Id error); + void handleVfStateChanged(CxeViewfinderControl::State newState, CxeError::Id error); void handleStillCaptureStateChanged(CxeStillCaptureControl::State newState, CxeError::Id error); void handleSnapshot(CxeError::Id error); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Mon Oct 04 00:05:08 2010 +0300 @@ -47,8 +47,7 @@ void construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager); + CxuiCaptureKeyHandler *keyHandler); virtual void loadDefaultWidgets(); @@ -62,6 +61,7 @@ // from CxuiPrecaptureView virtual void handleSettingValueChanged(const QString& key, QVariant newValue); + virtual void enterStandby(); void handleSceneChanged(const QVariant &scene); void handleQuitClicked(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/inc/cxuiview.h --- a/camerauis/cameraxui/cxui/inc/cxuiview.h Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiview.h Mon Oct 04 00:05:08 2010 +0300 @@ -31,7 +31,6 @@ class CxuiCaptureKeyHandler; class CxeEngine; class HbWidget; -class HbActivityManager; // CONSTANTS const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds @@ -50,8 +49,7 @@ virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler * keyHandler, - HbActivityManager *activityManager); + CxuiCaptureKeyHandler * keyHandler); public: virtual bool isStandbyModeSupported() const; @@ -118,7 +116,6 @@ QTimer mHideControlsTimeout; HbInstantFeedback mControlsFeedback; - HbActivityManager *mActivityManager; }; #endif // CXUIVIEW_H diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/layouts/setting.docml --- a/camerauis/cameraxui/cxui/layouts/setting.docml Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/setting.docml Mon Oct 04 00:05:08 2010 +0300 @@ -10,7 +10,7 @@ - + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/layouts/setting_slider.docml --- a/camerauis/cameraxui/cxui/layouts/setting_slider.docml Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/setting_slider.docml Mon Oct 04 00:05:08 2010 +0300 @@ -10,7 +10,7 @@ - + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/layouts/view_postcapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Mon Oct 04 00:05:08 2010 +0300 @@ -32,7 +32,7 @@ - + @@ -43,7 +43,7 @@ - + @@ -53,7 +53,7 @@ - + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/layouts/view_still_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Mon Oct 04 00:05:08 2010 +0300 @@ -50,7 +50,7 @@ - + diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -28,6 +28,7 @@ #include // usb status #include #include +#include #include #include @@ -43,13 +44,11 @@ #include "cxesettings.h" #include "cxuiapplicationframeworkmonitorprivate.h" -namespace{ +namespace +{ const int CXUI_USB_MODE_CHECK_TIMER_DELAY = 1000; // 1 second -} #ifdef Q_OS_SYMBIAN -namespace -{ inline QString convertTDesC2QString(const TDesC& aDescriptor) { #ifdef QT_NO_UNICODE @@ -73,16 +72,6 @@ return convertTDesC2QString(name); } - inline QString bitString(int number, char fill = '0', int width = 32) - { - return QString::number(number, 2).rightJustified(width, fill); - } - - //!@todo: Avkon UIDs not needed once device dialogs fully implemented in Orbit. - - // AknCapServer - static const unsigned int UID_AKNCAPSERVER = 0x10207218; - // Phone ui static const unsigned int UID_PHONEUI = 0x100058B3; // Task switcher @@ -93,8 +82,9 @@ // Log event types static const char *EVENT_USB = "usb"; static const char *EVENT_FOREGROUND = "foreground"; -} + #endif // Q_OS_SYMBIAN +} // namespace /*! @@ -114,6 +104,7 @@ mKeyLockState(EKeyguardNotActive), mBatteryStatus(EBatteryStatusUnknown), mUsbPersonality(0), + mTaskManagerVisibility(false), mUsbModeCheckTimer(this), mEventLog(NULL), #endif // Q_OS_SYMBIAN @@ -124,7 +115,9 @@ mWindowGroup.EnableFocusChangeEvents(); mWindowGroupName = windowGroupName(mWsSession, mWindowGroupId); mEventLog = new CxuiEventLog("CxuiApplicationFrameworkMonitorPrivate"); + init(); + mUsbModeCheckTimer.setSingleShot(true); mUsbModeCheckTimer.setInterval(CXUI_USB_MODE_CHECK_TIMER_DELAY); connect(&mUsbModeCheckTimer, SIGNAL(timeout()), @@ -259,6 +252,15 @@ } } + } else if (uid == TsProperty::KCategory.iUid && key == TsProperty::KVisibilityKey) { + CX_DEBUG(("CxuiApplicationFrameworkMonitor - Task Manager visibility: %d -> %d", mTaskManagerVisibility, value.toBool())); + const bool newTsVisibility(value.toBool()); + + // If the task switcher state is changed, then emit signal to inform client(s). + if (mTaskManagerVisibility != newTsVisibility) { + mTaskManagerVisibility = newTsVisibility; + emit q->taskSwitcherStateChanged(mTaskManagerVisibility); + } } CX_DEBUG_EXIT_FUNCTION(); @@ -288,6 +290,12 @@ { CX_DEBUG_ENTER_FUNCTION(); + // To be able to release resources fast enough, we need foreground + // priority also when moving to background. Once we have moved to + // background fully, we re-adjust Window Server "compute mode" + // to the normal value. + mWsSession.ComputeMode(RWsSession::EPriorityControlDisabled); + // Connect to application (window server) events. connect(&mApplication, SIGNAL(symbianEvent(const QSymbianEvent *)), this, SLOT(handleEvent(const QSymbianEvent *))); @@ -305,6 +313,10 @@ mSettings.get(KPSUidUsbWatcher.iUid, KUsbWatcherSelectedPersonality, Cxe::PublishAndSubscribe, value); mUsbPersonality = value.toInt(); + // Get current Task Switcher foreground status + mSettings.get(TsProperty::KCategory.iUid, TsProperty::KVisibilityKey, Cxe::PublishAndSubscribe, value); + mTaskManagerVisibility = value.toBool(); + bool ok = connect(&mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)), this, SLOT(handlePropertyEvent(long int, unsigned long int, QVariant))); CX_DEBUG_ASSERT(ok); @@ -342,20 +354,6 @@ setState(getCurrentState()); break; } - case EEventWindowVisibilityChanged: { - const TWsVisibilityChangedEvent *visibilityEvent = wsEvent->VisibilityChanged(); - if (visibilityEvent) { - CX_DEBUG(("CxuiApplicationFrameworkMonitor - EFullyVisible: bits[%s]", - bitString(TWsVisibilityChangedEvent::EFullyVisible).toAscii().constData() )); - CX_DEBUG(("CxuiApplicationFrameworkMonitor - EPartiallyVisible: bits[%s]", - bitString(TWsVisibilityChangedEvent::EPartiallyVisible).toAscii().constData() )); - CX_DEBUG(("CxuiApplicationFrameworkMonitor - ENotVisible: bits[%s]", - bitString(TWsVisibilityChangedEvent::ENotVisible).toAscii().constData() )); - CX_DEBUG(("CxuiApplicationFrameworkMonitor - event: bits[%s]", - bitString(visibilityEvent->iFlags).toAscii().constData() )); - } - break; - } default: break; } @@ -370,7 +368,6 @@ { if (mState != state) { const CxuiApplicationFrameworkMonitor::ForegroundState original(mState); - // Check if state transition is acceptable in current state. switch (mState) { case CxuiApplicationFrameworkMonitor::ForegroundOwned: @@ -389,6 +386,22 @@ } if (mState != original) { + if (mState == CxuiApplicationFrameworkMonitor::ForegroundOwned) { + // Keep foreground priority until fully in background. + // See init() for more comments. + mWsSession.ComputeMode(RWsSession::EPriorityControlDisabled); + } + + // If state was changed, signal it to listeners. + emit q->foregroundStateChanged(mState); + + if (mState == CxuiApplicationFrameworkMonitor::ForegroundFullyLost) { + // Background has been entered. + // Return Window Server "compute mode" to the normal value. + mWsSession.ComputeMode(RWsSession::EPriorityControlComputeOff); + } + +#ifdef CX_DEBUG // Print the event log with this foreground event included. if (mEventLog) { mEventLog->append( @@ -397,9 +410,7 @@ CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState)); mEventLog->print(); } - - // If state was changed, signal it to listeners. - emit q->foregroundStateChanged(mState); +#endif // CX_DEBUG } } } @@ -430,7 +441,6 @@ // Check the app uid. switch (uid) { - case UID_AKNCAPSERVER: case UID_TASKSWITCHER: case UID_DIALOGAPPSERVER: // Note or task switcher in foreground. diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -48,6 +48,9 @@ // USB mass memory mode signal connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)), this, SLOT(handleUsbMassMemoryModeChanged(bool))); + + // Task switcher state signal + connect(mApplicationMonitor, SIGNAL(taskSwitcherStateChanged(bool)), this, SLOT(handleTaskSwitcherStateChanged(bool))); // Severe error signals connect(mErrorManager, SIGNAL(errorPopupShown()), this, SLOT(handleSevereError())); @@ -121,10 +124,10 @@ mErrorManager->clear(); } else { CX_DEBUG(("CxuiApplicationState - application is in partial / full foreground")); - // Check that we were in background. Switching between partial and full background - // needs no actions. - if (currentState() == Background) { - CX_DEBUG(("CxuiApplicationState - application was in background before, moving to foreground")); + // Check that we were in background or standby state. + // State can be standby, if camera lost focus to task switcher. + if (currentState() == Background || currentState() == Standby) { + CX_DEBUG(("CxuiApplicationState - application was in partial/full background, moving to foreground")); // Check that there's no active errors that have been ignored in background. checkErrors(); if (currentState() != Error) { @@ -165,6 +168,26 @@ } /*! +* Handle Task Switcher state changes. +* If Task Switcher activates, we enter standby mode. +* When we receive foreground event, we can move back to Normal mode. +* @param foreground Is the Task Switcher in foreground/active. +*/ +void CxuiApplicationState::handleTaskSwitcherStateChanged(bool foreground) +{ + CX_DEBUG_ENTER_FUNCTION(); + if (foreground) { + // When task switcher is active, we enter standby mode. + if (currentState() == Normal) { + // Go to standby mode (release camera). + CX_DEBUG(("CxuiApplicationState - application losing partial-foreground to task switcher")); + setState(Standby); + } + } + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! * Handle battery emptying. We need to stop all activity and exit the application. */ void CxuiApplicationState::handleBatteryEmpty() diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuidisplaypropertyhandler.cpp --- a/camerauis/cameraxui/cxui/src/cxuidisplaypropertyhandler.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuidisplaypropertyhandler.cpp Mon Oct 04 00:05:08 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" @@ -67,3 +67,25 @@ { mUtility.resetInactivityTime(); } + +/*! + * Handles viewfinder state changes. + * @param newState new viewfinder state + * @param error error code in case of error + */ +void CxuiDisplayPropertyHandler::handleVfStateChanged( + CxeViewfinderControl::State newState, CxeError::Id error) +{ + CX_DEBUG_ENTER_FUNCTION(); + Q_UNUSED(error); + + if (newState == CxeViewfinderControl::Running) { + // switch off screen saver and turn on backlight + setDisplayAlwaysVisible(true); + } else { + // switch on screen saver and turn off backlight + setDisplayAlwaysVisible(false); + } + + CX_DEBUG_EXIT_FUNCTION(); +} diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -111,13 +111,12 @@ */ void CxuiPostcaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager) + CxuiCaptureKeyHandler *keyHandler) { Q_UNUSED(keyHandler); CX_DEBUG_ENTER_FUNCTION(); - CxuiView::construct(mainwindow, engine, documentLoader, NULL, activityManager); + CxuiView::construct(mainwindow, engine, documentLoader, NULL); // set back action to go back to pre-capture HbAction *backAction = new HbAction(Hb::BackNaviAction, this); @@ -162,10 +161,6 @@ connect(&mReleaseCameraTimer, SIGNAL(timeout()), this, SLOT(releaseCamera())); - mHideControlsTimeout.setSingleShot(true); - connect(&mHideControlsTimeout, SIGNAL(timeout()), - this, SLOT(hideControls())); - mPostcaptureTimer.setSingleShot(true); connect(&mPostcaptureTimer, SIGNAL(timeout()), this, SLOT(goToPrecaptureView())); @@ -175,6 +170,13 @@ setFocusPolicy(Qt::StrongFocus); QCoreApplication::instance()->installEventFilter(this); + + connect(mEngine, SIGNAL(fileSaved(CxeError::Id, const QString&)), this, SLOT(handleFileSaved())); + + if (CxuiServiceProvider::isCameraEmbedded()) { + setTitle(CxuiServiceProvider::instance()->windowTitle()); + } + CX_DEBUG_EXIT_FUNCTION(); } @@ -297,6 +299,15 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! + * Handle file saving complete event. Toolbar is shown when file is saved. + */ +void CxuiPostcaptureView::handleFileSaved() +{ + CX_DEBUG_ENTER_FUNCTION(); + showControls(); + CX_DEBUG_EXIT_FUNCTION(); +} /*! Slot for handling image/video sharing. @@ -441,6 +452,7 @@ CX_DEBUG_ENTER_FUNCTION(); QVariantMap data; QVariantHash params; + AfActivityStorage activityStorage; QString filename = getCurrentFilename(); CX_DEBUG(("Saving filename [%s]", qPrintable(filename))); @@ -454,23 +466,24 @@ params.insert("screenshot", screenshot); if (mEngine->mode() == Cxe::ImageMode) { - mActivityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); - mActivityManager->addActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY, data, params); + activityStorage.removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); + activityStorage.saveActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY, data, params); } else { - mActivityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); - mActivityManager->addActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY, data, params); + activityStorage.removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); + activityStorage.saveActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY, data, params); } CX_DEBUG_EXIT_FUNCTION(); } /*! - * Clear activity from activity manager. + * Clear activity from activity storage. */ void CxuiPostcaptureView::clearActivity() { CX_DEBUG_ENTER_FUNCTION(); - mActivityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); - mActivityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); + AfActivityStorage activityStorage; + activityStorage.removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); + activityStorage.removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); CX_DEBUG_EXIT_FUNCTION(); } @@ -494,7 +507,8 @@ // If the image / video has been deleted, control returned to pre-capture view. // No point to start timers or show controls then. if (mMainWindow->currentView() == this) { - showControls(); + setTitleBarVisible(true); + setStatusBarVisible(true); startTimers(); } diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -47,7 +47,6 @@ #include "cxutils.h" #include "cxuienums.h" #include "cxuidocumentloader.h" -#include "cxuidisplaypropertyhandler.h" #include "cxuicapturekeyhandler.h" #include "cxuiprecaptureview.h" #include "cxuisettingdialog.h" @@ -83,7 +82,6 @@ CxuiPrecaptureView::CxuiPrecaptureView(QGraphicsItem *parent) : CxuiView(parent), mViewfinder(0), - mDisplayHandler(0), mSettingsGrid(0), mWidgetsLoaded(false), mSettingsDialog(NULL), @@ -101,7 +99,6 @@ mSliderSettingsDialogOkAction(NULL) { CX_DEBUG_ENTER_FUNCTION(); - mDisplayHandler = new CxuiDisplayPropertyHandler(); CX_DEBUG_EXIT_FUNCTION(); } @@ -123,13 +120,12 @@ */ void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler * keyHandler, - HbActivityManager *activityManager) + CxuiCaptureKeyHandler * keyHandler) { CX_DEBUG_ENTER_FUNCTION(); OstTrace0(camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT_1, "msg: e_CX_PRECAPVIEW_CONSTRUCT 1"); - CxuiView::construct(mainWindow, engine, documentLoader, keyHandler, activityManager); + CxuiView::construct(mainWindow, engine, documentLoader, keyHandler); mSettingsInfo = new CxuiSettingsInfo(engine); CX_DEBUG_ASSERT(mSettingsInfo); @@ -152,12 +148,6 @@ connect(&(mEngine->settings()), SIGNAL(settingValueChanged(const QString&,QVariant)), this, SLOT(handleSettingValueChanged(const QString&, QVariant))); - // adjust the timer, and connect it to correct slot - connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls())); - - mHideControlsTimeout.setSingleShot(true); - mHideControlsTimeout.setInterval(CXUI_HIDE_CONTROLS_TIMEOUT); - mGeoTaggingBlinkTimer = new QTimer(this); connect(mGeoTaggingBlinkTimer, SIGNAL(timeout()), this, SLOT(blinkGeoTaggingIcon())); @@ -335,6 +325,7 @@ if (event->type() == QEvent::Show) { QCoreApplication::instance()->installEventFilter(this); + hideControls(); event->accept(); } @@ -355,6 +346,7 @@ if (event->type() == QEvent::Hide) { QCoreApplication::instance()->removeEventFilter(this); hideZoom(); + hideToolbar(); event->accept(); } @@ -419,26 +411,22 @@ } -/* - * viewfinder state call backs + +/*! + * Handles viewfinder state changes. + * @param newState new viewfinder state + * @param error error code in case of error */ void CxuiPrecaptureView::handleVfStateChanged( - CxeViewfinderControl::State newState, CxeError::Id /*error*/) + CxeViewfinderControl::State newState, CxeError::Id error) { CX_DEBUG_ENTER_FUNCTION(); + Q_UNUSED(error); if (newState == CxeViewfinderControl::Running) { - // switch off screen saver and turn on backlight - if(mDisplayHandler) { - mDisplayHandler->setDisplayAlwaysVisible(true); - } // start the standby timer emit startStandbyTimer(); } else { - // switch on screen saver and turn off backlight - if(mDisplayHandler) { - mDisplayHandler->setDisplayAlwaysVisible(false); - } // stop the standby timer when vf is not running. emit stopStandbyTimer(); } diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -15,7 +15,7 @@ * */ #include -#include +#include #include "cxenamespace.h" #include "cxesettings.h" @@ -78,11 +78,10 @@ void CxuiSceneModeView::construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager) + CxuiCaptureKeyHandler *keyHandler) { CX_DEBUG_ENTER_FUNCTION(); - CxuiView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager); + CxuiView::construct(mainwindow, engine, documentLoader, keyHandler); mSettingsInfo = new CxuiSettingsInfo(mEngine); setContentFullScreen(true); @@ -193,21 +192,22 @@ CX_DEBUG_ENTER_FUNCTION(); QVariantMap data; QVariantHash params; + AfActivityStorage activityStorage; if (mEngine->mode() == Cxe::ImageMode) { HbIcon activityScreenshot("qtg_graf_taskswitcher_camera"); QPixmap screenshot = activityScreenshot.pixmap(); params.insert("screenshot", screenshot); - mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); - mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params); + activityStorage.removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); + activityStorage.saveActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params); } else { HbIcon activityScreenshot("qtg_graf_taskswitcher_camcorder"); QPixmap screenshot = activityScreenshot.pixmap(); params.insert("screenshot", screenshot); - mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); - mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params); + activityStorage.removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); + activityStorage.saveActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params); } CX_DEBUG_EXIT_FUNCTION(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiserviceprovider.cpp --- a/camerauis/cameraxui/cxui/src/cxuiserviceprovider.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiserviceprovider.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -30,6 +30,9 @@ CxuiServiceProvider* CxuiServiceProvider::mInstance = NULL; +/*! + * Constructor. + */ CxuiServiceProvider::CxuiServiceProvider(CxeEngine *engine) : XQServiceProvider("cxui." + XQI_CAMERA_CAPTURE), @@ -40,13 +43,17 @@ mQuality(0), mAllowModeSwitching(true), mAllowQualityChange(true), - mAllowCameraSwitching(true) + mAllowCameraSwitching(true), + mWindowTitle("") { CX_DEBUG_ENTER_FUNCTION(); publishAll(); CX_DEBUG_EXIT_FUNCTION(); } +/*! + * Destructor. + */ CxuiServiceProvider::~CxuiServiceProvider() { CX_DEBUG_ENTER_FUNCTION(); @@ -102,64 +109,50 @@ } /*! - * + * Returns camera mode requested by client. */ -Cxe::CameraMode CxuiServiceProvider::requestedMode() +Cxe::CameraMode CxuiServiceProvider::requestedMode() const { return mRequestedMode; } /*! - * + * Returns boolean to indicate whether client app allows camera mode switching. */ -bool CxuiServiceProvider::allowModeSwitching() +bool CxuiServiceProvider::allowModeSwitching() const { return mAllowModeSwitching; } /*! - * + * Returns boolean to indicate whether client app allows image/video quality to be + * changed. */ -bool CxuiServiceProvider::allowQualityChange() +bool CxuiServiceProvider::allowQualityChange() const { return mAllowQualityChange; } /*! - * + * Returns boolean to indicate whether client app allows switching + * between primary and secondary camera. */ -bool CxuiServiceProvider::allowCameraSwitching() +bool CxuiServiceProvider::allowCameraSwitching() const { return mAllowCameraSwitching; } /*! - * + * Returns window title provided by client application. */ -void CxuiServiceProvider::sendFilenameToClientAndExit(QString filename) +QString CxuiServiceProvider::windowTitle() const { - CX_DEBUG_ENTER_FUNCTION(); - - if (mRequestIndex == -1) { - CX_DEBUG(("CxuiServiceProvider: no request in progress")); - QCoreApplication::instance()->quit(); - CX_DEBUG_EXIT_FUNCTION(); - return; - } - - connect(this, SIGNAL(returnValueDelivered()), QCoreApplication::instance(), SLOT(quit())); - - CX_DEBUG(("CxuiServiceProvider: completing request")); - if (!completeRequest(mRequestIndex, QVariant(filename))) { - // if request completion fails call quit immediately because signal is not coming - CX_DEBUG(("completeRequest() failed, quitting now")); - QCoreApplication::instance()->quit(); - } - mRequestIndex = -1; - - CX_DEBUG_EXIT_FUNCTION(); + return mWindowTitle; } +/*! + * Function that is called when request arrives. Sets up camera to requested state. + */ void CxuiServiceProvider::capture(int mode, const QVariantMap ¶meters) { CX_DEBUG_ENTER_FUNCTION(); @@ -183,6 +176,14 @@ return; } + CX_DEBUG(("Getting request info")); + XQRequestInfo info = requestInfo(); + + QString windowTitle = info.info(XQINFO_KEY_WINDOW_TITLE).toString(); + if (!windowTitle.isNull() && !windowTitle.isEmpty()) { + CX_DEBUG(("Got window title=%s", qPrintable(windowTitle))); + mWindowTitle = windowTitle; + } mRequestIndex = setCurrentRequestAsync(); mEngine->cameraDeviceControl().switchCamera(static_cast (mCameraIndex)); @@ -219,11 +220,39 @@ mEngine->initMode(mRequestedMode); + CX_DEBUG_EXIT_FUNCTION(); +} +/*! + * Sends filename of captured image/video to client and exits camera app. + */ +void CxuiServiceProvider::sendFilenameToClientAndExit(QString filename) +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (mRequestIndex == -1) { + CX_DEBUG(("CxuiServiceProvider: no request in progress")); + QCoreApplication::instance()->quit(); + CX_DEBUG_EXIT_FUNCTION(); + return; + } + + connect(this, SIGNAL(returnValueDelivered()), QCoreApplication::instance(), SLOT(quit())); + + CX_DEBUG(("CxuiServiceProvider: completing request")); + if (!completeRequest(mRequestIndex, QVariant(filename))) { + // if request completion fails call quit immediately because signal is not coming + CX_DEBUG(("completeRequest() failed, quitting now")); + QCoreApplication::instance()->quit(); + } + mRequestIndex = -1; CX_DEBUG_EXIT_FUNCTION(); } +/*! + * Helper function to read request parameters. + */ bool CxuiServiceProvider::readParameters(const QVariantMap& parameters) { diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -33,7 +33,8 @@ #include // HbDeviceProfile #include #include -#include +#include +#include #include "cxuiselftimer.h" #include "cxeengine.h" @@ -101,14 +102,13 @@ */ void CxuiStillPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager) + CxuiCaptureKeyHandler *keyHandler) { CX_DEBUG_ENTER_FUNCTION(); OstTrace0( camerax_performance, CXUISTILLPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_STILLPRECAPVIEW_CONSTRUCT 1" ); // constuct base class - CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager); + CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler); connect(&mEngine->autoFocusControl(), SIGNAL(stateChanged(CxeAutoFocusControl::State,CxeError::Id)), this, SLOT(handleAutoFocusStateChanged(CxeAutoFocusControl::State,CxeError::Id))); @@ -116,8 +116,6 @@ this, SLOT(handleSnapshot(CxeError::Id))); connect(&mEngine->stillCaptureControl(), SIGNAL(stateChanged(CxeStillCaptureControl::State, CxeError::Id)), this, SLOT(handleStillCaptureStateChanged(CxeStillCaptureControl::State, CxeError::Id))); - connect(&mEngine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), - this, SLOT(handleViewfinderStateChanged(CxeViewfinderControl::State, CxeError::Id))); connect(&mEngine->stillCaptureControl(), SIGNAL(availableImagesChanged()), this, SLOT(updateImagesLeftLabel())); @@ -319,6 +317,7 @@ if (CxuiServiceProvider::isCameraEmbedded()) { CX_DEBUG(("EMBEDDED: camera in embedded mode")); + setTitle(CxuiServiceProvider::instance()->windowTitle()); if (!CxuiServiceProvider::instance()->allowQualityChange()) { @@ -390,25 +389,27 @@ CX_DEBUG_ENTER_FUNCTION(); QVariantMap data; QVariantHash params; + AfActivityStorage activityStorage; HbIcon activityScreenshot("qtg_graf_taskswitcher_camera"); QPixmap screenshot = activityScreenshot.pixmap(); params.insert("screenshot", screenshot); - mActivityManager->removeActivity( + activityStorage.removeActivity( CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); - mActivityManager->addActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, + activityStorage.saveActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY, data, params); CX_DEBUG_EXIT_FUNCTION(); } /*! - * Clear activity from activity manager. + * Clear activity from activity storage. */ void CxuiStillPrecaptureView::clearActivity() { CX_DEBUG_ENTER_FUNCTION(); - mActivityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); + AfActivityStorage activityStorage; + activityStorage.removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); CX_DEBUG_EXIT_FUNCTION(); } @@ -819,7 +820,7 @@ /*! * Handle change in viewfinder state. */ -void CxuiStillPrecaptureView::handleViewfinderStateChanged( +void CxuiStillPrecaptureView::handleVfStateChanged( CxeViewfinderControl::State newState, CxeError::Id error) { CX_DEBUG_ENTER_FUNCTION(); @@ -1015,6 +1016,9 @@ { CX_DEBUG_ENTER_FUNCTION(); + QString imagesStr; + HbExtendedLocale locale = HbExtendedLocale::system(); + if (mImagesLeft && mImagesLeftContainer) { int images = mEngine->stillCaptureControl().imagesLeft(); @@ -1025,7 +1029,9 @@ } CX_DEBUG(("Images left %d", images)); - mImagesLeft->setPlainText(hbTrId("txt_cam_fullscreen_imagesleft").arg(images)); + imagesStr = locale.toString(images); + + mImagesLeft->setPlainText(imagesStr); } CX_DEBUG_EXIT_FUNCTION(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -32,8 +32,9 @@ #include #include #include -#include +#include #include +#include #include "cxuivideoprecaptureview.h" #include "cxeengine.h" @@ -109,12 +110,11 @@ */ void CxuiVideoPrecaptureView::construct(HbMainWindow *mainwindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler *keyHandler, - HbActivityManager *activityManager) + CxuiCaptureKeyHandler *keyHandler) { CX_DEBUG_ENTER_FUNCTION(); - CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler, activityManager); + CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler); mCaptureKeyHandler = keyHandler; mVideoCaptureControl = &(engine->videoCaptureControl()); @@ -290,6 +290,7 @@ if (CxuiServiceProvider::isCameraEmbedded()) { CX_DEBUG(("EMBEDDED: camera in embedded mode")); + setTitle(CxuiServiceProvider::instance()->windowTitle()); if (!CxuiServiceProvider::instance()->allowQualityChange()) { @@ -381,25 +382,27 @@ CX_DEBUG_ENTER_FUNCTION(); QVariantMap data; QVariantHash params; + AfActivityStorage activityStorage; HbIcon activityScreenshot("qtg_graf_taskswitcher_camcorder"); QPixmap screenshot = activityScreenshot.pixmap(); params.insert("screenshot", screenshot); - mActivityManager->removeActivity( + activityStorage.removeActivity( CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); - mActivityManager->addActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, + activityStorage.saveActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY, data, params); CX_DEBUG_EXIT_FUNCTION(); } /*! - * Clear activity from activity manager. + * Clear activity from activity storage. */ void CxuiVideoPrecaptureView::clearActivity() { CX_DEBUG_ENTER_FUNCTION(); - mActivityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); + AfActivityStorage activityStorage; + activityStorage.removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); CX_DEBUG_EXIT_FUNCTION(); } @@ -538,6 +541,10 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! + * Stops video recording if it is ongoing or paused. + * \sa handleVideoStateChanged() + */ void CxuiVideoPrecaptureView::stop() { CX_DEBUG_ENTER_FUNCTION(); @@ -748,7 +755,8 @@ } remaining.append(number); - label->setPlainText(hbTrId("txt_cam_info_recording_time").arg(elapsed).arg(remaining)); + label->setPlainText( + HbParameterLengthLimiter("txt_cam_info_recording_time").arg(elapsed).arg(remaining)); } bool CxuiVideoPrecaptureView::getElapsedTime() @@ -848,7 +856,6 @@ enableFeedback(); emit startStandbyTimer(); mElapsedTimer.stop(); - hideControls(); if (mMenu) { setMenu(mMenu); @@ -914,15 +921,16 @@ { CX_DEBUG_ENTER_FUNCTION(); - CxeVideoCaptureControl::State state = mVideoCaptureControl->state(); - if (state == CxeVideoCaptureControl::Recording || - state == CxeVideoCaptureControl::Paused) { - // Disable going to post-capture when video capture control goes to stopping state. - disconnect(mVideoCaptureControl, SIGNAL(stateChanged(CxeVideoCaptureControl::State, CxeError::Id)), - this, SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State,CxeError::Id))); - mVideoCaptureControl->stop(); - mElapsedTimer.stop(); - } + // Disable going to post-capture when video capture control goes to stopping state. + disconnect(mVideoCaptureControl, + SIGNAL(stateChanged(CxeVideoCaptureControl::State, + CxeError::Id)), + this, + SLOT(handleVideoStateChanged(CxeVideoCaptureControl::State, + CxeError::Id))); + + // stop video recording (if it is ongoing or paused) + stop(); QCoreApplication::exit(); @@ -983,6 +991,26 @@ } /*! + * Overridden version of CxuiPreCaptureView::enterStandby(). + * Handles video precapture specific standby preparations and calls + * base class implementation. Standby is entered either via standby timer + * or when application goes to background. + * \sa CxuiView::enterStandby() + * \sa CxuiPrecaptureView::enterStandby() + */ +void CxuiVideoPrecaptureView::enterStandby() +{ + CX_DEBUG_ENTER_FUNCTION(); + + // stop video recording (if it is ongoing or paused) + stop(); + + // call base class implemenation + CxuiPrecaptureView::enterStandby(); + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! * Handle scene mode change. * @param scene The new active scene mode. */ diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiview.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -66,8 +66,7 @@ */ void CxuiView::construct(HbMainWindow *mainWindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, - CxuiCaptureKeyHandler * keyHandler, - HbActivityManager *activityManager) + CxuiCaptureKeyHandler * keyHandler) { CX_DEBUG_ENTER_FUNCTION(); @@ -75,13 +74,11 @@ CX_ASSERT_ALWAYS(mainWindow); CX_ASSERT_ALWAYS(engine); CX_ASSERT_ALWAYS(documentLoader); - CX_ASSERT_ALWAYS(activityManager); mMainWindow = mainWindow; mDocumentLoader = documentLoader; mCaptureKeyHandler = keyHandler; mEngine = engine; - mActivityManager = activityManager; // adjust the timer, and connect it to correct slot connect(&mHideControlsTimeout, SIGNAL(timeout()), this, SLOT(hideControls())); @@ -147,7 +144,7 @@ } /*! - * Clear activity from activity manager. Default implementation does nothing. + * Clear activity from activity storage. Default implementation does nothing. */ void CxuiView::clearActivity() { @@ -194,9 +191,9 @@ */ void CxuiView::enterStandby() { - CX_DEBUG_IN_FUNCTION(); + CX_DEBUG_ENTER_FUNCTION(); releaseCamera(); - CX_DEBUG_IN_FUNCTION(); + CX_DEBUG_EXIT_FUNCTION(); } /*! @@ -268,26 +265,28 @@ { CX_DEBUG_ENTER_FUNCTION(); - if (mHideControlsTimeout.isActive()) { - mHideControlsTimeout.stop(); - } + if (mMainWindow->currentView() == this) { + if (mHideControlsTimeout.isActive()) { + mHideControlsTimeout.stop(); + } - setTitleBarVisible(false); - setStatusBarVisible(false); + setTitleBarVisible(false); + setStatusBarVisible(false); - hideZoom(); + hideZoom(); - hideToolbar(); + hideToolbar(); - // show indicators when controls are hidden - showIndicators(); + // show indicators when controls are hidden + showIndicators(); - mControlsVisible = false; + mControlsVisible = false; - // give the keyboard focus back to the view - // for the view to receive key events - setFocus(); + // give the keyboard focus back to the view + // for the view to receive key events + setFocus(); + } CX_DEBUG_EXIT_FUNCTION(); } @@ -296,7 +295,7 @@ */ void CxuiView::showControls() { - if (allowShowControls()) { + if (mMainWindow->currentView() == this && allowShowControls()) { // show toolbar showToolbar(); diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp --- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -19,7 +19,8 @@ #include #include #include -#include +#include +#include #include #include @@ -276,7 +277,9 @@ { CX_DEBUG_ENTER_FUNCTION(); - if (mApplication.activateReason() == Hb::ActivationReasonService || + AfActivation activation; + AfActivityStorage activityStorage; + if (activation.reason() == Hb::ActivationReasonService || // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as // activation reason. Use XQServiceUtil to determine if starting service as // a workaround for now @@ -289,14 +292,14 @@ connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), this, SLOT(changeToPrecaptureView())); - } else if (mApplication.activateReason() == Hb::ActivationReasonActivity) { + } else if (activation.reason() == Hb::ActivationReasonActivity) { // restoring activity, read startup view from stored activity // view to start in QString viewName = STILL_PRE_CAPTURE_VIEW; bool preCapture = true; - QString activityId = mApplication.activateId(); + QString activityId = activation.name(); if (activityId == CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY) { viewName = STILL_PRE_CAPTURE_VIEW; } else if (activityId == CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY) { @@ -318,10 +321,7 @@ mMainWindow.setCurrentView(view, false); // restore view from activity - bool ok = mApplication.activityManager()->waitActivity(); - - view->restoreActivity(activityId, - mApplication.activityManager()->activityData(mApplication.activateId())); + view->restoreActivity(activityId, activityStorage.activityData(activityId)); clearAllActivities(); } else { @@ -380,7 +380,7 @@ 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()); + view->construct(&mMainWindow, &mEngine, mCameraDocumentLoader, mKeyHandler); // .. and add to main window (which also takes ownership) OstTrace0(camerax_performance, CXUIVIEWMANAGER_CREATEVIEW_10, "msg: e_CX_MAINWINDOW_ADDVIEW 1"); mMainWindow.addView(view); @@ -759,11 +759,11 @@ */ void CxuiViewManager::clearAllActivities() { - HbActivityManager *activityManager = mApplication.activityManager(); - activityManager->removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); - activityManager->removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); - activityManager->removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); - activityManager->removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); + AfActivityStorage activityStorage; + activityStorage.removeActivity(CxuiActivityIds::STILL_PRECAPTURE_ACTIVITY); + activityStorage.removeActivity(CxuiActivityIds::STILL_POSTCAPTURE_ACTIVITY); + activityStorage.removeActivity(CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY); + activityStorage.removeActivity(CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY); } /*! diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/main.cpp --- a/camerauis/cameraxui/cxui/src/main.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/main.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -21,11 +21,12 @@ #include #include #include -#include +#include #ifdef Q_OS_SYMBIAN #include #include +#include #endif // Q_OS_SYMBIAN #include "cxeengine.h" @@ -36,6 +37,7 @@ #include "cxuienums.h" #include "cxutils.h" #include "cxuiserviceprovider.h" +#include "cxuidisplaypropertyhandler.h" #ifdef Q_OS_SYMBIAN #include "OstTraceDefinitions.h" @@ -50,6 +52,9 @@ const QString TRANSLATIONS_PATH = "/resource/qt/translations/"; const QString TRANSLATIONS_FILE = "camera"; +const long int CAMERAX_USE_RASTER_PS_UID = 0x2726beef; +const unsigned long int CAMERAX_USE_RASTER_PS_KEY = 0; + int main(int argc, char *argv[]) { CX_DEBUG(("CxUI: entering main()")); @@ -57,9 +62,22 @@ Q_INIT_RESOURCE(cxui); - // Use software rendering / raster graphics system to save graphics memory - CX_DEBUG(("CxUI: Take raster graphics system into use")); - QApplication::setGraphicsSystem("raster"); +#ifdef Q_OS_SYMBIAN + XQSettingsManager settingManager; + XQPublishAndSubscribeSettingsKey useRasterGraphicsSystemKey( + CAMERAX_USE_RASTER_PS_UID, CAMERAX_USE_RASTER_PS_KEY); + QVariant useRasterGraphicsSystemValue = + settingManager.readItemValue(useRasterGraphicsSystemKey, + XQSettingsManager::TypeInt); + + if (useRasterGraphicsSystemValue.isNull() + || !useRasterGraphicsSystemValue.toInt()) { + // Either there was an error reading the value or the value was + // zero. Raster graphics system should be forced + CX_DEBUG(("CxUI: Take raster graphics system into use")); + QApplication::setGraphicsSystem("raster"); + } +#endif OstTrace0( camerax_performance, DUP1__MAIN, "msg: e_CX_HBAPP_CREATION 1" ); CxuiApplication app(argc, argv); @@ -72,21 +90,18 @@ CxeEngine *engine = CxeEngine::createEngine(); OstTrace0( camerax_performance, DUP8__MAIN, "msg: e_CX_CREATE_ENGINE 0" ); - if (app.activateReason() == Hb::ActivationReasonService || - // @todo: There's a bug in orbit and we never get Hb::ActivationReasonService as - // activation reason. Use XQServiceUtil to determine if starting service as - // a workaround for now - XQServiceUtil::isService()) { + AfActivation activation; + if (activation.reason() == Af::ActivationReasonService) { CX_DEBUG(("CxUI: Camera started as service")); // Embedded mode. Engine is inited to correct mode // by service provider when request arrives CX_DEBUG(("CxUI: creating serviceprovider")); CxuiServiceProvider::create(engine); CX_DEBUG(("CxUI: done")); - } else if (app.activateReason() == Hb::ActivationReasonActivity) { + } else if (activation.reason() == Af::ActivationReasonActivity) { CX_DEBUG(("CxUI: Camera started as activity")); Cxe::CameraMode mode = Cxe::ImageMode; - QString activityId = app.activateId(); + QString activityId = activation.name(); if (activityId == CxuiActivityIds::VIDEO_PRECAPTURE_ACTIVITY || activityId == CxuiActivityIds::VIDEO_POSTCAPTURE_ACTIVITY) { mode = Cxe::VideoMode; @@ -119,44 +134,54 @@ // Create main window OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" ); - HbMainWindow mainWindow(0, Hb::WindowFlagTransparent | Hb::WindowFlagNoBackground); - mainWindow.setAttribute(Qt::WA_NoBackground); + HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent | Hb::WindowFlagNoBackground); + mainWindow->setAttribute(Qt::WA_NoBackground); OstTrace0( camerax_performance, DUP6__MAIN, "msg: e_CX_MAINWINDOW_CREATION 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" ); #ifdef Q_OS_SYMBIAN - mainWindow.showFullScreen(); + 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); + 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" ); // Create view manager OstTrace0( camerax_performance, DUP11__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 1" ); - CxuiViewManager *viewManager = new CxuiViewManager(app, mainWindow, *engine); + CxuiViewManager *viewManager = new CxuiViewManager(app, *mainWindow, *engine); OstTrace0( camerax_performance, DUP12__MAIN, "msg: e_CX_CREATE_VIEW_MANAGER 0" ); // 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()); + engine->viewfinderControl().setWindow(mainWindow->effectiveWinId()); OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" ); + // connect display handler to vf state changes + CxuiDisplayPropertyHandler displayHandler; + QObject::connect(&engine->viewfinderControl(), SIGNAL(stateChanged(CxeViewfinderControl::State, CxeError::Id)), + &displayHandler, SLOT(handleVfStateChanged(CxeViewfinderControl::State, CxeError::Id))); + int returnValue = app.exec(); delete viewManager; + viewManager = NULL; CxuiServiceProvider::destroy(); // delete service provider instance + engine->cameraDeviceControl().release(); + delete mainWindow; + mainWindow = NULL; delete engine; + engine = NULL; return returnValue; }