# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277305194 -10800 # Node ID b12f3922a74fa5f3a155997b5d513a8091595812 # Parent 5c1e3c6aa4ef9b80b07ab236c13e5ce8c2eea572 Revision: 201023 Kit: 2010125 diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h --- a/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Wed Jun 23 17:59:54 2010 +0300 @@ -27,6 +27,7 @@ //forward declarations class CxeCameraDevice; +class CxeSettings; @@ -41,7 +42,7 @@ Q_OBJECT public: - CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice ); + CxeAutoFocusControlSymbian( CxeCameraDevice &cameraDevice, CxeSettings &settings ); virtual ~CxeAutoFocusControlSymbian(); CxeError::Id start(bool soundEnabled = true); @@ -81,7 +82,8 @@ // Handle ECam events void handleCameraEvent( int eventUid, int error ); - void handleSceneChanged(CxeScene& scene); + void handleSceneChanged(CxeScene &scene); + void handleSettingValueChanged(const QString &settingId, QVariant newValue); private: @@ -93,8 +95,11 @@ CCamera::CCameraAdvancedSettings *mAdvancedSettings; // not owned CxeAutoFocusControl::Mode mAfMode; CCamera::CCameraAdvancedSettings::TFocusRange mAFRange; + CxeSettings &mSettings; bool mCancelled; bool mSoundEnabled; + bool mFaceTrackingOverride; //need for temporary override of the AF mode if FT is enabled by user + CxeAutoFocusControl::Mode mPreviousAFMode; //for restoring previous AF mode in case of FT override }; #endif // CXEAUTOFOCUSCONTROLSYMBIAN_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h --- a/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxesettingscontrolsymbian.h Wed Jun 23 17:59:54 2010 +0300 @@ -51,8 +51,8 @@ void updateBrightnessSetting(QVariant newValue); void updateExposureModeSetting(QVariant newValue); void updateExposureCompensationSetting(QVariant newValue); - void updateFlashSetting(QVariant newValue); + void updateFaceTrackingSetting(QVariant newValue); private: CxeCameraDevice &mCameraDevice; diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h --- a/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxestillcapturecontrolsymbian.h Wed Jun 23 17:59:54 2010 +0300 @@ -95,7 +95,7 @@ void prepareZoomForStill(int ecamStillResolutionIndex); protected: // from CxeStateMachine - void handleStateChanged( int newStateId, CxeError::Id error ); + void handleStateChanged(int newStateId, CxeError::Id error); protected slots: @@ -106,8 +106,11 @@ // notification for when camera is released void prepareForRelease(); - // ECam events - void handleImageData( MCameraBuffer *buffer, int error ); + // ECAM events + void handleCameraEvent(int eventUid, int error); + + // Image data event + void handleImageData(MCameraBuffer *buffer, int error); // Snapshot event void handleSnapshotReady(CxeError::Id status, const QPixmap& snapshot); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -40,11 +40,14 @@ /* * CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian */ -CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice) +CxeAutoFocusControlSymbian::CxeAutoFocusControlSymbian(CxeCameraDevice &cameraDevice, + CxeSettings &settings) : CxeStateMachine("CxeAutoFocusControlSymbian"), mCameraDevice(cameraDevice), mAdvancedSettings(NULL), - mCancelled(false) + mSettings(settings), + mCancelled(false), + mFaceTrackingOverride(false) { CX_DEBUG_ENTER_FUNCTION(); @@ -65,6 +68,13 @@ QObject::connect( &cameraDevice, SIGNAL(prepareForRelease()), this,SLOT(prepareForRelease()) ); + + // connect scene / setting change callbacks to settings control + QObject::connect(&mSettings, + SIGNAL(settingValueChanged(const QString&,QVariant)), + this, + SLOT(handleSettingValueChanged(const QString&,QVariant))); + OstTrace0(camerax_performance, CXEAUTOFOCUSCONTROLSYMBIAN_CREATE_MID2, "msg: e_CX_ENGINE_CONNECT_SIGNALS 0"); initializeResources(); @@ -476,4 +486,40 @@ return mSoundEnabled; } +/*! +* Handle new setting value. +* New value is set to camera. +* \param settingId The id of the updated setting +* \param newValue A new value for the updated setting +*/ +void CxeAutoFocusControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue) +{ + CX_DEBUG_ENTER_FUNCTION(); + if (settingId == CxeSettingIds::FACE_TRACKING) { + // Updating AF mode when face tracking is activated + // in scene mode which doesn't support face tracking + if (newValue.toInt()) { + //Face tracking enabled + if(mAfMode == CxeAutoFocusControl::Infinity || + mAfMode == CxeAutoFocusControl::Hyperfocal) { + mPreviousAFMode = mAfMode; + setMode(CxeAutoFocusControl::Auto); + mFaceTrackingOverride = true; + } + } else { + //Face tracking disabled + if (mFaceTrackingOverride) { + mAfMode = mPreviousAFMode; + setMode(mAfMode); + mFaceTrackingOverride = false; + } + } + + } else { + // do nothing + } + + CX_DEBUG_EXIT_FUNCTION(); +} + // end of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeenginesymbian.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -119,11 +119,11 @@ CX_DEBUG_ASSERT(mSettingsModel); mSettings = new CxeSettingsImp(*mSettingsModel); - + //! @todo a temporary hack to change the startup sequence to avoid GOOM problems static_cast(mSettings)->loadSettings(mode()); - - + + // Connect P&S key updates to settings signal. connect(settingsStore, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)), mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant))); @@ -150,7 +150,8 @@ mSnapshotControl = new CxeSnapshotControl(*mCameraDevice); - mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice); + mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, + *mSettings); mFileSaveThread = CxeFileSaveThreadFactory::createFileSaveThread(); @@ -205,6 +206,11 @@ mAutoFocusControl, SLOT(handleCameraEvent(int,int))); + connect(mCameraDeviceControl, + SIGNAL(cameraEvent(int,int)), + mStillCaptureControl, + SLOT(handleCameraEvent(int,int))); + // Connect signal for device ready events connect(mCameraDeviceControl, SIGNAL(deviceReady()), diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxefilenamegeneratorsymbian.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -48,7 +48,10 @@ const char MAX_CHAR = 'Z'; const TInt64 KMinRequiredSpaceImage = 2000000; -const TInt64 KMinRequiredSpaceVideo = 4000000; + +// Whether there's enough space for video or not is handled lower in the SW stack +// so this is set to 0 to fix an error +const TInt64 KMinRequiredSpaceVideo = 0; diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxesettingscontrolsymbian.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,8 @@ /*! * Handle new setting value. * New value is set to camera. +* \param settingId The id of the updated setting +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::handleSettingValueChanged(const QString& settingId, QVariant newValue) { @@ -79,6 +82,8 @@ updateExposureModeSetting(newValue); } else if (settingId == CxeSettingIds::EV_COMPENSATION_VALUE) { updateExposureCompensationSetting(newValue); + } else if (settingId == CxeSettingIds::FACE_TRACKING) { + updateFaceTrackingSetting(newValue); } else { // do nothing } @@ -93,7 +98,7 @@ /*! * Handle new scene being set. * Scene settings are checked and new values are set to camera. -* @param scene New scene containing scene specific settings. +* \param scene New scene containing scene specific settings. */ void CxeSettingsControlSymbian::handleSceneChanged(CxeScene& scene) { @@ -104,12 +109,13 @@ foreach (const QString& settingId, scene.keys()) { handleSettingValueChanged(settingId, scene[settingId]); } + CX_DEBUG_EXIT_FUNCTION(); } - /*! -* +* Update color tone setting value to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateColorToneSetting(QVariant newValue) { @@ -136,7 +142,8 @@ } /*! -* +* Update white balance setting value to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateWhiteBalanceSetting(QVariant newValue) { @@ -155,7 +162,8 @@ } /*! -* +* Update light sensitivity (ISO) setting value to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateLightSensitivitySetting(QVariant newValue) { @@ -180,7 +188,8 @@ } /*! -* +* Update sharpness setting value to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateSharpnessSetting(QVariant newValue) { @@ -210,7 +219,8 @@ } /*! -* +* Update contrast setting value to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateContrastSetting(QVariant newValue) { @@ -233,7 +243,8 @@ } /*! -* +* Update brightness setting value to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateBrightnessSetting(QVariant newValue) { @@ -256,7 +267,8 @@ } /*! -* +* Update Exposure mode to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateExposureModeSetting(QVariant newValue) { @@ -275,7 +287,8 @@ } /*! -* +* Update Exposure Compensation mode to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateExposureCompensationSetting(QVariant newValue) { @@ -297,7 +310,8 @@ } /*! -* +* Update flash mode to the camera device +* \param newValue A new value for the updated setting */ void CxeSettingsControlSymbian::updateFlashSetting(QVariant newValue) { @@ -315,4 +329,18 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! +* Update face tracking mode to the camera device +* \param newValue A new value for the updated setting +*/ +void CxeSettingsControlSymbian::updateFaceTrackingSetting(QVariant newValue) +{ + CX_DEBUG_ENTER_FUNCTION(); + MCameraFaceTracking *faceTracking = mCameraDevice.faceTracking(); + if(faceTracking) { + TRAP_IGNORE(faceTracking->SetFaceTrackingL(newValue.toInt())); + } + CX_DEBUG_EXIT_FUNCTION(); +} + // end of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp --- a/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxesettingsmodelimp.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -499,6 +499,7 @@ imgSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imgSceneAuto.insert(CxeSettingIds::BRIGHTNESS, 0); imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto); + imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_AUTO, imgSceneAuto); @@ -516,6 +517,7 @@ imgSceneSports.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imgSceneSports.insert(CxeSettingIds::BRIGHTNESS, 0); imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff); + imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, imgSceneSports); @@ -533,6 +535,7 @@ imgSceneCloseUp.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imgSceneCloseUp.insert(CxeSettingIds::BRIGHTNESS, 0); imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto); + imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_MACRO, imgSceneCloseUp); @@ -549,6 +552,7 @@ imgPortraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imgPortraitscene.insert(CxeSettingIds::BRIGHTNESS, 0); imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye); + imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, imgPortraitscene); @@ -565,6 +569,7 @@ imglandscapescene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imglandscapescene.insert(CxeSettingIds::BRIGHTNESS, 0); imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff); + imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, imglandscapescene); @@ -582,6 +587,7 @@ imgNightscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imgNightscene.insert(CxeSettingIds::BRIGHTNESS, 0); imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff); + imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, imgNightscene); @@ -598,6 +604,7 @@ imgNightpotraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); imgNightpotraitscene.insert(CxeSettingIds::BRIGHTNESS, 0); imgNightpotraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye); + imgNightpotraitscene.insert(CxeSettingIds::FACE_TRACKING, 1); mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -382,8 +382,9 @@ return err; } -/** +/*! * Command to start image capture now. + * @sa handleCameraEvent */ void CxeStillCaptureControlSymbian::capture() { @@ -392,10 +393,10 @@ // Start the image capture as fast as possible to minimize lag. // Check e.g. space available *after* this. + // Capture sound will be played when we receive "image capture event" from ECAM. mCameraDevice.camera()->CaptureImage(); if (imagesLeft() > 0) { - mCaptureSoundPlayer->play(); setState(Capturing); //! @todo: NOTE: This call may not stay here. It can move depending on the implementation for burst capture. @@ -472,6 +473,23 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! +* Handle ECAM events. +* Needed only for capture sound synchronization. +* @param eventUid ECAM event id. +* @param error Error code. KErrNone if operation has been successful. +*/ +void CxeStillCaptureControlSymbian::handleCameraEvent(int eventUid, int error) +{ + if (eventUid == KUidECamEventImageCaptureEventUidValue && error == KErrNone) { + CX_DEBUG(("CxeStillCaptureControlSymbian::handleCameraEvent - image capture event")); + if (state() == CxeStillCaptureControl::Capturing) { + mCaptureSoundPlayer->play(); + } + } +} + + /** * handleImageData: Image data received from ECam */ diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -23,13 +23,15 @@ #include "cxetestutils.h" #include "cxefakecameradevicecontrol.h" #include "cxefakecameradevice.h" +#include "cxefakesettings.h" #include "cxeautofocuscontrolsymbian.h" #include "unittest_cxeautofocuscontrolsymbian.h" UnitTestCxeAutoFocusControlSymbian::UnitTestCxeAutoFocusControlSymbian() - : mAutoFocusControl(0), - mCameraDeviceControl(0), - mCameraDevice(0) + : mAutoFocusControl(NULL), + mCameraDeviceControl(NULL), + mCameraDevice(NULL), + mFakeSettings(NULL) { } @@ -43,11 +45,13 @@ { qDebug() << "UnitTestCxeAutoFocusControlSymbian::init =>"; + mFakeSettings = new CxeFakeSettings(); + mCameraDeviceControl = new CxeFakeCameraDeviceControl(); mCameraDevice = new CxeFakeCameraDevice(); mCameraDevice->newCamera(mCameraDeviceControl->cameraIndex(), mCameraDeviceControl); - mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice); + mAutoFocusControl = new CxeAutoFocusControlSymbian(*mCameraDevice, *mFakeSettings); //mAutoFocusControl->initializeResources(); connect(mCameraDeviceControl, SIGNAL(cameraEvent(int,int)), @@ -61,15 +65,18 @@ { qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup =>"; delete mAutoFocusControl; - mAutoFocusControl = 0; + mAutoFocusControl = NULL; delete mCameraDeviceControl; - mCameraDeviceControl = 0; + mCameraDeviceControl = NULL; delete mCameraDevice; - mCameraDevice = 0; + mCameraDevice = NULL; + + delete mFakeSettings; + mFakeSettings = NULL; + qDebug() << "UnitTestCxeAutoFocusControlSymbian::cleanup <="; - } diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Wed Jun 23 17:59:54 2010 +0300 @@ -24,6 +24,7 @@ class CxeAutoFocusControlSymbian; class CxeFakeCameraDeviceControl; class CxeFakeCameraDevice; +class CxeFakeSettings; class UnitTestCxeAutoFocusControlSymbian : public QObject { @@ -53,6 +54,7 @@ CxeAutoFocusControlSymbian *mAutoFocusControl; CxeFakeCameraDeviceControl *mCameraDeviceControl; CxeFakeCameraDevice *mCameraDevice; + CxeFakeSettings *mFakeSettings; }; #endif // UNITTEST_CXEAUTOFOCUSCONTROLSYMBIAN_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.pro Wed Jun 23 17:59:54 2010 +0300 @@ -1,4 +1,4 @@ -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of "Eclipse Public License v1.0" @@ -33,7 +33,9 @@ cxecameradevice.cpp \ cxefakecameradevice.cpp \ cxecameradevicecontrolsymbian.cpp \ - cxefakecameradevicecontrol.cpp + cxefakecameradevicecontrol.cpp \ + cxefakesettings.cpp + HEADERS *= unittest_cxeautofocuscontrolsymbian.h \ cxeautofocuscontrol.h \ cxeautofocuscontrolsymbian.h \ @@ -48,4 +50,6 @@ cxecameradevicecontrol.h \ cxecameradevicecontrolsymbian.h \ cxefakecameradevicecontrol.h \ - cxutils.h + cxutils.h \ + cxefakesettings.h \ + cxesettings.h diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/cxui.pro --- a/camerauis/cameraxui/cxui/cxui.pro Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/cxui.pro Wed Jun 23 17:59:54 2010 +0300 @@ -24,7 +24,7 @@ TARGET.UID3 = 0x101f857a TARGET.VID = VID_DEFAULT TARGET.EPOCHEAPSIZE = 0x020000 0x1000000 - ICON = ./icons/cxui.svg + SKINICON = qtg_large_camera RSS_RULES = "group_name=\"Qt Camera\";" # Fix for QMake translating INCLUDEPATH to SYSTEMINCLUDE # and TraceCompiler needing USERINCLUDE. @@ -59,7 +59,8 @@ -lefsrv \ -lws32 \ -lgdi \ - -lapgrfx + -lapgrfx \ + -lusbman CONFIG += hb CONFIG += service @@ -96,6 +97,7 @@ cxuiserviceprovider.h \ cxuiscenemodeview.h \ cxuizoomslider.h \ + cxuieventlog.h \ traces/OstTraceDefinitions.h SOURCES += main.cpp \ @@ -123,7 +125,8 @@ cxuisettingxmlreader.cpp \ cxuiserviceprovider.cpp \ cxuiscenemodeview.cpp \ - cxuizoomslider.cpp + cxuizoomslider.cpp \ + cxuieventlog.cpp RESOURCES += cxui.qrc diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/icons/cxui.svg --- a/camerauis/cameraxui/cxui/icons/cxui.svg Fri Jun 11 13:26:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h --- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitor.h Wed Jun 23 17:59:54 2010 +0300 @@ -46,11 +46,12 @@ }; public: - CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings& settings); + CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings &settings); virtual ~CxuiApplicationFrameworkMonitor(); public: ForegroundState foregroundState() const; + bool isUsbMassMemoryModeActive() const; signals: /*! @@ -64,8 +65,18 @@ */ void batteryEmpty(); + /*! + * USB mass memory mode was just activated or deactivated. + * @param active If true, mass memory mode was activated, and mass memory cannot be accessed. + * Otherwise mass memory mode was deactivated, and mass memory is again accessible. + */ + void usbMassMemoryModeToggled(bool active); + + private: - CxuiApplicationFrameworkMonitorPrivate* p; + CxuiApplicationFrameworkMonitorPrivate *p; + + friend class CxuiApplicationFrameworkMonitorPrivate; }; #endif // CXUIAPPLICATIONFRAMEWORKMONITOR_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h --- a/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiapplicationframeworkmonitorprivate.h Wed Jun 23 17:59:54 2010 +0300 @@ -28,6 +28,7 @@ class RWindowGroup; class QString; class QSymbianEvent; +class CxuiEventLog; #endif // Q_OS_SYMBIAN @@ -35,16 +36,14 @@ { Q_OBJECT -public: - CxuiApplicationFrameworkMonitorPrivate(CxuiApplication &application, CxeSettings& settings); +private: + CxuiApplicationFrameworkMonitorPrivate(CxuiApplicationFrameworkMonitor *parent, + CxuiApplication &application, + CxeSettings &settings); virtual ~CxuiApplicationFrameworkMonitorPrivate(); -public: CxuiApplicationFrameworkMonitor::ForegroundState foregroundState() const; - -signals: - void foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState t); - void batteryEmpty(); + bool isUsbMassMemoryModeActive() const; #ifdef Q_OS_SYMBIAN private slots: @@ -53,25 +52,33 @@ private: void init(); - bool handleWindowServerEvent(const QSymbianEvent *event); + void handleWindowServerEvent(const QSymbianEvent *event); + void handleUsbPropertyEvent(unsigned long int key, QVariant value); void setState(CxuiApplicationFrameworkMonitor::ForegroundState state); CxuiApplicationFrameworkMonitor::ForegroundState getCurrentState(); unsigned int focusedApplicationUid(); #endif // Q_OS_SYMBIAN - private: + CxuiApplicationFrameworkMonitor *q; CxuiApplication &mApplication; - CxeSettings& mSettings; + CxeSettings &mSettings; #ifdef Q_OS_SYMBIAN RWsSession &mWsSession; RWindowGroup &mWindowGroup; int mWindowGroupId; QString mWindowGroupName; + int mKeyLockState; int mBatteryStatus; + int mUsbPersonality; + + CxuiEventLog *mEventLog; #endif // Q_OS_SYMBIAN + CxuiApplicationFrameworkMonitor::ForegroundState mState; + + friend class CxuiApplicationFrameworkMonitor; }; #endif // CXUIAPPLICATIONFRAMEWORKMONITORPRIVATE_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuienums.h --- a/camerauis/cameraxui/cxui/inc/cxuienums.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuienums.h Wed Jun 23 17:59:54 2010 +0300 @@ -82,6 +82,7 @@ static const char *STILL_PRE_CAPTURE_GOTO_VIDEO_ACTION = "cxui_action_goto_video"; static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_LABEL = "images_remaining"; static const char *STILL_PRE_CAPTURE_QUALITY_ICON = "quality_indicator"; + static const char *STILL_PRE_CAPTURE_FACE_TRACKING_ICON = "face_tracking_indicator"; static const char *STILL_PRE_CAPTURE_POST_CAPTURE_ACTION = "cxui_action_stillpostcapture"; static const char *STILL_PRE_CAPTURE_INDICATOR_CONTAINER = "indicatorContainer"; static const char *STILL_PRE_CAPTURE_IMAGES_LEFT_CONTAINER = "images_left_container"; @@ -150,6 +151,7 @@ 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"; } namespace CxUiInternal diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuierrormanager.h --- a/camerauis/cameraxui/cxui/inc/cxuierrormanager.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuierrormanager.h Wed Jun 23 17:59:54 2010 +0300 @@ -20,6 +20,7 @@ #include #include "cxeerror.h" +class HbAction; class HbDialog; class CxuiDocumentLoader; class CxuiCaptureKeyHandler; @@ -42,10 +43,13 @@ void aboutToRecoverError(); void errorRecovered(); -private slots: +public slots: - void analyze(CxeError::Id error); - void aboutToClosePopup(); + void showPopup(CxeError::Id error); + void hidePopup(CxeError::Id error); + +private slots: + void popupClosed(HbAction *action); void closeApp(); private: @@ -59,10 +63,10 @@ Critical // when error can be recovered, but needs actions e.g. camera in use }; - void launchPopup(QString& errorMsgTxt); - void showHighSeverityNote(QString& errorMsgTxt); - void showLowSeverityNote(QString& errorMsgTxt); - QString getErrorDetails(CxeError::Id error); + void launchPopup(const QString &errorText, const QString &buttonText); + void showHighSeverityNote(const QString &errorText, const QString &buttonText); + void showLowSeverityNote(const QString &errorText); + void getErrorDetails(QString &errorText, QString &buttonText); private: @@ -70,6 +74,7 @@ CxuiCaptureKeyHandler &mKeyHandler; CxuiDocumentLoader *mDocumentLoader; // not own HbDialog* mErrorMsgPopup; + CxeError::Id mErrorId; CxuiErrorManager::ErrorSeverity mErrorSeverity; }; diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuieventlog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxui/inc/cxuieventlog.h Wed Jun 23 17:59:54 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CXUIEVENTLOG_H +#define CXUIEVENTLOG_H + +#include +#include +#include + +/*! +* Class for saving events in run-time to be printed / traced out later. +* Useful when tracing is not possible when the events occur, but can be done later. +*/ +class CxuiEventLog +{ +public: + CxuiEventLog(const QString &name, int size = 10); + ~CxuiEventLog(); + + void append(const QString &type, const QString &value); + void print() const; + +private: + struct CxuiEvent + { + public: + CxuiEvent(const QString &type, const QString &value); + + QTime mTime; + QString mType; + QString mValue; + }; + + QLinkedList mEvents; + int mSize; + QString mName; +}; + +#endif // CXUIEVENTLOG_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Wed Jun 23 17:59:54 2010 +0300 @@ -27,6 +27,7 @@ class HbMainWindow; class HbAction; class HbLabel; +class ShareUi; class CxeEngine; class CxuiDocumentLoader; @@ -55,7 +56,6 @@ protected: bool eventFilter(QObject *object, QEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); void showToolbar(); @@ -95,6 +95,8 @@ QGraphicsRectItem *mBackgroundItem; HbLabel *mImageLabel; + ShareUi *mShareUi; + /** * Timer used to stop viewfinder after a delay if the user remains in * post-capture view. Viewfinder is not stopped immediately when diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Wed Jun 23 17:59:54 2010 +0300 @@ -113,7 +113,6 @@ virtual void initializeSettingsGrid() = 0; void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *event); bool eventFilter(QObject *object, QEvent *event); void launchSettingsDialog(QObject *action); bool isPostcaptureOn() const; @@ -147,6 +146,7 @@ CxuiSettingDialog *mSettingsDialog; CxuiSettingRadioButtonList *mSettingsDialogList; HbLabel *mQualityIcon; + HbLabel *mFaceTrackingIcon; private: CxuiSettingDialog* createSettingsDialog(); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h --- a/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Wed Jun 23 17:59:54 2010 +0300 @@ -99,6 +99,7 @@ HbPushButton* mScenesOkButton; HbPushButton* mScenesCancelButton; HbWidget* mScenesContainer; + HbLabel *mScenesHeading; QTimer mCameraReleaseTimer; diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuistandby.h --- a/camerauis/cameraxui/cxui/inc/cxuistandby.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuistandby.h Wed Jun 23 17:59:54 2010 +0300 @@ -45,6 +45,10 @@ CxuiStandby(CxuiCaptureKeyHandler &keyHandler, CxuiDocumentLoader *documentLoader, CxeEngine *engine); ~CxuiStandby(); +public: + void allowDismiss(bool allow); + bool isActive() const; + signals: /* @@ -58,26 +62,15 @@ void aboutToExitStandby(); public slots: - - /* - * starts standby timer - */ void startTimer(); - - /* - * stops standby timer - */ void stopTimer(); - - /* - * handles focus gain event - */ - bool handleMouseEvent(); + bool handleMouseEvent(QEvent *event); + void enterStandby(); + void exitStandby(); private slots: void dismissStandby(); - void toStandby(); private: // helper methods @@ -92,6 +85,7 @@ HbDialog *mStandbyPopup; QTimer *mStandbyTimer; bool mStandbyDialogVisible; + bool mAllowDismiss; }; #endif // CXUISTANDBY_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Wed Jun 23 17:59:54 2010 +0300 @@ -125,6 +125,7 @@ protected: void initializeSettingsGrid(); void closeDialogs(); + void updateFaceTrackingIcon(); protected: CxuiSelfTimer *mSelfTimer; diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuiview.h --- a/camerauis/cameraxui/cxui/inc/cxuiview.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiview.h Wed Jun 23 17:59:54 2010 +0300 @@ -23,6 +23,7 @@ #include #include #include +#include class CxuiDocumentLoader; class CxuiCaptureKeyHandler; @@ -67,6 +68,8 @@ HbFrameDrawer::FrameType frameType = HbFrameDrawer::NinePieces); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); protected slots: virtual void launchNotSupportedNotification(); virtual void launchPhotosApp(); @@ -100,6 +103,7 @@ bool mZoomVisible; QTimer mHideControlsTimeout; + HbInstantFeedback mControlsFeedback; }; #endif // CXUIVIEW_H diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/inc/cxuiviewmanager.h --- a/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiviewmanager.h Wed Jun 23 17:59:54 2010 +0300 @@ -56,6 +56,9 @@ */ CxuiDocumentLoader* documentLoader(); + //@todo: Temporarily needed in main(). + bool proceedStartup(); + public slots: void changeToPostcaptureView(); void changeToPrecaptureView(); @@ -64,8 +67,10 @@ void showScenesView(); private slots: + void startupCheck(); void toForeground(); void handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState state); + void showUsbErrorPopup(bool show); void handleBatteryEmpty(); void aboutToLooseFocus(); void aboutToGainFocus(); @@ -81,6 +86,7 @@ bool eventFilter(QObject *object, QEvent *event); private: + void initStartupView(); void createStillPrecaptureView(); void createVideoPrecaptureView(); CxuiPrecaptureView* getPrecaptureView(Cxe::CameraMode mode, Cxe::CameraIndex camera); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/layouts/errornote_popup.docml --- a/camerauis/cameraxui/cxui/layouts/errornote_popup.docml Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/errornote_popup.docml Wed Jun 23 17:59:54 2010 +0300 @@ -1,11 +1,15 @@ - + + + + + - + @@ -24,14 +28,12 @@ - + - - - + diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/layouts/image_setting.xml --- a/camerauis/cameraxui/cxui/layouts/image_setting.xml Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/image_setting.xml Wed Jun 23 17:59:54 2010 +0300 @@ -115,6 +115,16 @@ + + + + + + \ No newline at end of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/layouts/setting_scenemode.docml --- a/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Wed Jun 23 17:59:54 2010 +0300 @@ -18,11 +18,11 @@ - + - + @@ -35,7 +35,7 @@ - + diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/layouts/standbymode_popup.docml --- a/camerauis/cameraxui/cxui/layouts/standbymode_popup.docml Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/standbymode_popup.docml Wed Jun 23 17:59:54 2010 +0300 @@ -1,6 +1,7 @@ - + + @@ -10,9 +11,8 @@ - - + diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/layouts/view_still_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Wed Jun 23 17:59:54 2010 +0300 @@ -47,18 +47,24 @@ - + - + - + + + + + + + @@ -68,6 +74,7 @@ + diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/layouts/view_video_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Wed Jun 23 17:59:54 2010 +0300 @@ -58,25 +58,25 @@ - + - + - + - + diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitor.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -28,13 +28,7 @@ CxuiApplicationFrameworkMonitor::CxuiApplicationFrameworkMonitor(CxuiApplication &application, CxeSettings &settings) { CX_DEBUG_ENTER_FUNCTION(); - p = new CxuiApplicationFrameworkMonitorPrivate(application, settings); - - connect(p, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)), - this, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState))); - connect(p, SIGNAL(batteryEmpty()), this, SIGNAL(batteryEmpty())); - - + p = new CxuiApplicationFrameworkMonitorPrivate(this, application, settings); CX_DEBUG_EXIT_FUNCTION(); } @@ -57,4 +51,13 @@ return p->foregroundState(); } +/*! +* Is USB connected in mass memory mode? +* @return True if USB mass memory mode is active and connected, false otherwise. +*/ +bool CxuiApplicationFrameworkMonitor::isUsbMassMemoryModeActive() const +{ + return p->isUsbMassMemoryModeActive(); +} + // end of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplicationframeworkmonitorprivate.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -25,14 +25,19 @@ #include #include // keyguard state #include // battery status +#include // usb status +#include +#include #include #include #include #include + #endif // Q_OS_SYMBIAN #include "cxutils.h" +#include "cxuieventlog.h" #include "cxuiapplication.h" #include "cxesettings.h" #include "cxuiapplicationframeworkmonitorprivate.h" @@ -64,6 +69,11 @@ return convertTDesC2QString(name); } + inline QString bitString(int number, char fill = '0', int width = 32) + { + return QString::number(number, 2).rightJustified(width, fill); + } + //!@todo: Avkon UIDs not needed once device dialogs fully implemented in Orbit. // AknCapServer @@ -75,6 +85,10 @@ static const unsigned int UID_TASKSWITCHER = 0x2002677D; // Dialog server static const unsigned int UID_DIALOGAPPSERVER = 0x20022FC5; + + // Log event types + static const char *EVENT_USB = "usb"; + static const char *EVENT_FOREGROUND = "foreground"; } #endif // Q_OS_SYMBIAN @@ -82,8 +96,11 @@ /*! * Constructor */ -CxuiApplicationFrameworkMonitorPrivate::CxuiApplicationFrameworkMonitorPrivate(CxuiApplication &application, CxeSettings& settings) - : mApplication(application), +CxuiApplicationFrameworkMonitorPrivate::CxuiApplicationFrameworkMonitorPrivate(CxuiApplicationFrameworkMonitor *parent, + CxuiApplication &application, + CxeSettings& settings) + : q(parent), + mApplication(application), mSettings(settings), #ifdef Q_OS_SYMBIAN mWsSession(CCoeEnv::Static()->WsSession()), @@ -92,17 +109,18 @@ mWindowGroupName(), mKeyLockState(EKeyguardNotActive), mBatteryStatus(EBatteryStatusUnknown), + mUsbPersonality(0), + mEventLog(NULL), #endif // Q_OS_SYMBIAN mState(CxuiApplicationFrameworkMonitor::ForegroundOwned) { CX_DEBUG_ENTER_FUNCTION(); - #ifdef Q_OS_SYMBIAN mWindowGroup.EnableFocusChangeEvents(); mWindowGroupName = windowGroupName(mWsSession, mWindowGroupId); + mEventLog = new CxuiEventLog("CxuiApplicationFrameworkMonitorPrivate"); init(); #endif // Q_OS_SYMBIAN - CX_DEBUG_EXIT_FUNCTION(); } @@ -111,7 +129,11 @@ */ CxuiApplicationFrameworkMonitorPrivate::~CxuiApplicationFrameworkMonitorPrivate() { - CX_DEBUG_IN_FUNCTION(); + CX_DEBUG_ENTER_FUNCTION(); +#ifdef Q_OS_SYMBIAN + delete mEventLog; +#endif // Q_OS_SYMBIAN + CX_DEBUG_EXIT_FUNCTION(); } /*! @@ -123,6 +145,24 @@ return mState; } +/*! +* Is USB connected in mass memory mode? +* @return True if USB mass memory mode is active and connected, false otherwise. +*/ +bool CxuiApplicationFrameworkMonitorPrivate::isUsbMassMemoryModeActive() const +{ + bool active(false); +#ifdef Q_OS_SYMBIAN + // Mass memory mode activity can be seen from the KUsbWatcherSelectedPersonality property. + // When USB is connected in Mass Memory Mode, we get KUsbPersonalityIdMS as personality id. + // If USB is not connected, personality id is KUsbWatcherSelectedPersonalityNone. + active = (mUsbPersonality == KUsbPersonalityIdMS); +#endif // Q_OS_SYMBIAN + return active; +} + + + #ifdef Q_OS_SYMBIAN /*! * Slot to handle Symbian event. @@ -153,7 +193,7 @@ CX_DEBUG_ENTER_FUNCTION(); if (uid == KPSUidAvkonDomain.iUid && key == KAknKeyguardStatus) { - CX_DEBUG(("CxuiApplicationFrameworkMonitor - keylock status changed: %d -> %d", value.toInt(), mKeyLockState)); + CX_DEBUG(("CxuiApplicationFrameworkMonitor - keylock status changed: %d -> %d", mKeyLockState, value.toInt())); // Check if the keylock value has actually changed const int newKeyLockState = value.toInt(); @@ -163,7 +203,7 @@ setState(getCurrentState()); } } else if (uid == KPSUidHWRMPowerState.iUid && key == KHWRMBatteryStatus ) { - CX_DEBUG(("CxuiApplicationFrameworkMonitor - battery status changed: %d -> %d", value.toInt(), mBatteryStatus)); + CX_DEBUG(("CxuiApplicationFrameworkMonitor - battery status changed: %d -> %d", mBatteryStatus, value.toInt() )); // If status changed, check if battery is going empty. const int newBatteryStatus = value.toInt(); @@ -172,8 +212,29 @@ // Notify that battery is almost empty, // need to stop any recordings etc. - if( mBatteryStatus == EBatteryStatusEmpty ) { - emit batteryEmpty(); + if(mBatteryStatus == EBatteryStatusEmpty) { + emit q->batteryEmpty(); + } + } + } else if (uid == KPSUidUsbWatcher.iUid && key == KUsbWatcherSelectedPersonality) { + CX_DEBUG(("CxuiApplicationFrameworkMonitor - usb personality changed: %d -> %d", mUsbPersonality, value.toInt())); + + const int newUsbPersonality(value.toInt()); + if (newUsbPersonality != mUsbPersonality) { + // Check before saving the new state if mass memory mode was active, + // so we know when to emit the unactivated signal. + const bool wasUsbMassMemoryModeActive(isUsbMassMemoryModeActive()); + // Store new state. + mUsbPersonality = newUsbPersonality; + + // Save state to log. + if (mEventLog) { + mEventLog->append(EVENT_USB, QString::number(mUsbPersonality)); + } + + // Check if mass memory mode activity changed. + if (wasUsbMassMemoryModeActive != isUsbMassMemoryModeActive()) { + emit q->usbMassMemoryModeToggled(isUsbMassMemoryModeActive()); } } } @@ -201,6 +262,10 @@ mSettings.get(KPSUidAvkonDomain.iUid, KAknKeyguardStatus, Cxe::PublishAndSubscribe, value); mKeyLockState = value.toInt(); + // Get current USB personality + mSettings.get(KPSUidUsbWatcher.iUid, KUsbWatcherSelectedPersonality, Cxe::PublishAndSubscribe, value); + mUsbPersonality = value.toInt(); + bool ok = connect(&mSettings, SIGNAL(settingValueChanged(long int, unsigned long int, QVariant)), this, SLOT(handlePropertyEvent(long int, unsigned long int, QVariant))); CX_DEBUG_ASSERT(ok); @@ -215,7 +280,7 @@ * Helper method to handle Symbian event that specificly is of type QSymbianEvent::WindowServerEvent. * @param event Symbian event to be handled. (Ownership not taken.) */ -bool CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event) +void CxuiApplicationFrameworkMonitorPrivate::handleWindowServerEvent(const QSymbianEvent *event) { // We receive tons of these events, so function start and end traces // are intentionally left out. @@ -242,13 +307,13 @@ const TWsVisibilityChangedEvent *visibilityEvent = wsEvent->VisibilityChanged(); if (visibilityEvent) { CX_DEBUG(("CxuiApplicationFrameworkMonitor - EFullyVisible: bits[%s]", - QString::number(TWsVisibilityChangedEvent::EFullyVisible, 2).toAscii().constData() )); + bitString(TWsVisibilityChangedEvent::EFullyVisible).toAscii().constData() )); CX_DEBUG(("CxuiApplicationFrameworkMonitor - EPartiallyVisible: bits[%s]", - QString::number(TWsVisibilityChangedEvent::EPartiallyVisible, 2).toAscii().constData() )); + bitString(TWsVisibilityChangedEvent::EPartiallyVisible).toAscii().constData() )); CX_DEBUG(("CxuiApplicationFrameworkMonitor - ENotVisible: bits[%s]", - QString::number(TWsVisibilityChangedEvent::ENotVisible, 2).toAscii().constData() )); + bitString(TWsVisibilityChangedEvent::ENotVisible).toAscii().constData() )); CX_DEBUG(("CxuiApplicationFrameworkMonitor - event: bits[%s]", - QString::number(visibilityEvent->iFlags, 2).toAscii().constData() )); + bitString(visibilityEvent->iFlags).toAscii().constData() )); } break; } @@ -256,8 +321,6 @@ break; } } - - return false; } /*! @@ -287,14 +350,17 @@ } if (mState != original) { - CX_DEBUG(("CxuiApplicationFrameworkMonitor - state change [%s] -> [%s]", - CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator( - CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(original), - CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator( - CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState) )); + // Print the event log with this foreground event included. + if (mEventLog) { + mEventLog->append( + EVENT_FOREGROUND, + CxuiApplicationFrameworkMonitor::staticMetaObject.enumerator( + CxuiApplicationFrameworkMonitor::staticMetaObject.indexOfEnumerator("ForegroundState")).valueToKey(mState)); + mEventLog->print(); + } // If state was changed, signal it to listeners. - emit foregroundStateChanged(mState); + emit q->foregroundStateChanged(mState); } } } @@ -312,6 +378,7 @@ if (mKeyLockState != EKeyguardNotActive) { // Keylock enabled is the same as if other application is in foreground. + CX_DEBUG(("CxuiApplicationFrameworkMonitor - key lock on")); state = CxuiApplicationFrameworkMonitor::ForegroundFullyLost; } else if (focusWindowGroupId == mWindowGroupId) { // If our window group has focus, we clearly are the foreground owning application. @@ -374,7 +441,6 @@ #ifdef CX_DEBUG QString name(windowGroupName(mWsSession, focusWgId)); - CX_DEBUG(("CxuiApplicationFrameworkMonitor - Own window group id: 0x%08x", mWindowGroupId)); CX_DEBUG(("CxuiApplicationFrameworkMonitor - Focused window group id: 0x%08x", focusWgId)); CX_DEBUG(("CxuiApplicationFrameworkMonitor - Own window group name: [%s]", mWindowGroupName.toAscii().constData())); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuierrormanager.cpp --- a/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuierrormanager.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -37,6 +38,7 @@ mKeyHandler(keyHandler), mDocumentLoader(documentLoader), mErrorMsgPopup(NULL), + mErrorId(CxeError::None), mErrorSeverity(CxuiErrorManager::None) { CX_DEBUG_ENTER_FUNCTION(); @@ -54,23 +56,29 @@ /*! -* Analyze the error code and act accordingly. -* @param error Error code. +* Show error popup based on the error id. +* @param error Error id. */ -void CxuiErrorManager::analyze(CxeError::Id error) +void CxuiErrorManager::showPopup(CxeError::Id error) { CX_DEBUG_ENTER_FUNCTION(); - - mErrorMsgPopup = NULL; mErrorSeverity = CxuiErrorManager::None; if (error != CxeError::None) { - // start evaluating the error. - QString errorMsgTxt = getErrorDetails(error); + CxeError::Id oldError = mErrorId; + mErrorId = error; - if(mErrorSeverity != CxuiErrorManager::None) { + // start evaluating the error. + QString errorText; + QString buttonText; + getErrorDetails(errorText, buttonText); + + if (mErrorSeverity != CxuiErrorManager::None) { + // Clear the old error if one for some reason exists. + hidePopup(oldError); + // show the error note to the user. - launchPopup(errorMsgTxt); + launchPopup(errorText, buttonText); } else { // ignore } @@ -79,13 +87,31 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! +* Close the open error popup, if it is shown for the same error as requested here. +* @param error Error id, for which we are closing the error dialog. +*/ +void CxuiErrorManager::hidePopup(CxeError::Id error) +{ + CX_DEBUG_ENTER_FUNCTION(); + if (mErrorId == error) { + if (mErrorMsgPopup) { + mErrorMsgPopup->close(); + mErrorMsgPopup = NULL; + } + } + CX_DEBUG_EXIT_FUNCTION(); +} /*! * Slot that gets called when error note is closed. */ -void CxuiErrorManager::aboutToClosePopup() +void CxuiErrorManager::popupClosed(HbAction *action) { CX_DEBUG_ENTER_FUNCTION(); + // Dialog or action instance cannot be used anymore. + mErrorMsgPopup = NULL; + // handle any use-cases when the error can be recovered emit errorRecovered(); CX_DEBUG_EXIT_FUNCTION(); @@ -109,59 +135,66 @@ * and set the severity level, based on given error code. * @param error Error code to be analyzed. */ -QString CxuiErrorManager::getErrorDetails(CxeError::Id error) +void CxuiErrorManager::getErrorDetails(QString &errorText, QString &buttonText) { CX_DEBUG_ENTER_FUNCTION(); - QString msg("No Error"); - switch(error) { + switch (mErrorId) { + case CxeError::MemoryNotAccessible: + mErrorSeverity = CxuiErrorManager::Severe; + errorText = hbTrId("txt_cam_info_error_usb_disconnected"); + buttonText = hbTrId("txt_cam_info_error_usb_disconnected_button"); + break; case CxeError::Died: case CxeError::InitializationFailed: case CxeError::HwNotAvailable: case CxeError::NotReady: mErrorSeverity = CxuiErrorManager::Severe; - msg = hbTrId("txt_cam_info_error"); + errorText = hbTrId("txt_cam_info_error"); + buttonText = hbTrId("txt_common_button_close"); break; case CxeError::InUse: mErrorSeverity = CxuiErrorManager::Severe; - msg = hbTrId("txt_cam_info_camera_already_in_use"); + errorText = hbTrId("txt_cam_info_camera_already_in_use"); + buttonText = hbTrId("txt_common_button_close"); break; case CxeError::DiskFull: mErrorSeverity = CxuiErrorManager::Warning; - msg = hbTrId("txt_cam_info_memory_full"); + errorText = hbTrId("txt_cam_info_memory_full"); + break; default: + errorText = "No Error"; break; } CX_DEBUG_EXIT_FUNCTION(); - - return msg; } /*! * */ -void CxuiErrorManager::launchPopup(QString& errorMsgTxt) +void CxuiErrorManager::launchPopup(const QString &errorText, const QString &buttonText) { CX_DEBUG_ENTER_FUNCTION(); switch (mErrorSeverity) { - case CxuiErrorManager::Warning: - showLowSeverityNote(errorMsgTxt); + case CxuiErrorManager::None: break; - case CxuiErrorManager::Severe: - case CxuiErrorManager::Critical: - showHighSeverityNote(errorMsgTxt); + case CxuiErrorManager::Warning: + showLowSeverityNote(errorText); break; default: + showHighSeverityNote(errorText, buttonText); break; } + mErrorSeverity = CxuiErrorManager::None; + CX_DEBUG_EXIT_FUNCTION(); } /*! * Show error note for high severity error. */ -void CxuiErrorManager::showHighSeverityNote(QString& errorMsgTxt) +void CxuiErrorManager::showHighSeverityNote(const QString &errorText, const QString &buttonText) { // we always prepare the popup for the new message and hence we load the // popup everytime from document loader @@ -175,6 +208,8 @@ mErrorMsgPopup = qobject_cast(mDocumentLoader->findWidget(CxUiLayout::ERROR_POPUP)); CX_ASSERT_ALWAYS(mErrorMsgPopup); + mErrorMsgPopup->setAttribute(Qt::WA_DeleteOnClose, true); + mErrorMsgPopup->setTimeout(HbDialog::NoTimeout); // HbDialog's default background item is replaced with black rectangle QGraphicsRectItem *backgroundItem = new QGraphicsRectItem(); @@ -184,26 +219,24 @@ backgroundItem->setRect(origBgItem->boundingRect()); mErrorMsgPopup->setBackgroundItem(backgroundItem); - mErrorMsgPopup->setTimeout(HbDialog::NoTimeout); - mErrorMsgPopup->setBackgroundFaded(false); // color of standby text is set in the code. It cannot be done in docml HbLabel* label = qobject_cast(mDocumentLoader->findWidget(CxUiLayout::ERROR_TEXT_WIDGET)); label->setTextColor(Qt::white); - label->setPlainText(errorMsgTxt); + label->setPlainText(errorText); HbPushButton *exitButton = qobject_cast(mDocumentLoader->findWidget(CxUiLayout::ERROR_BUTTON_WIDGET)); - - if(mErrorSeverity == CxuiErrorManager::Severe) { + if (!buttonText.isEmpty()) { // inform ui about error recovery - emit aboutToRecoverError(); - QObject::connect(mErrorMsgPopup, SIGNAL(aboutToClose()), this, SLOT(closeApp())); + exitButton->setText(buttonText); + connect(exitButton, SIGNAL(released()), this, SLOT(closeApp())); exitButton->show(); } else { // TODO handle other severity cases here. } - mErrorMsgPopup->show(); + emit aboutToRecoverError(); + mErrorMsgPopup->open(this, SLOT(popupClosed(HbAction*))); CX_DEBUG_EXIT_FUNCTION(); } @@ -211,9 +244,9 @@ /*! * Show error note for low severity error. */ -void CxuiErrorManager::showLowSeverityNote(QString& errorMsgTxt) +void CxuiErrorManager::showLowSeverityNote(const QString &errorText) { CX_DEBUG_ENTER_FUNCTION(); - HbMessageBox::warning(errorMsgTxt); + HbMessageBox::warning(errorText); CX_DEBUG_EXIT_FUNCTION(); } diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuieventlog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxui/src/cxuieventlog.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cxutils.h" +#include "cxuieventlog.h" + +/*! +* Event log item constructor. +* @param type Event type description +* @param id Event id description +*/ +CxuiEventLog::CxuiEvent::CxuiEvent(const QString &type, const QString &value) + : mTime(QTime::currentTime()), mType(type), mValue(value) +{ +} + + +/*! +* Event log constructor. +* @param name Event log name. +* @param size Maximum number of events stored to log. After maximum size is encountered, +* old events are discarded as new ones are added. +*/ +CxuiEventLog::CxuiEventLog(const QString& name, int size) + : mSize(size), + mName(name) +{ +} + +/*! +* Event log destructor. +*/ +CxuiEventLog::~CxuiEventLog() +{ +} + +/*! +* Append new event to the log. +* @param type Event type description +* @param id Event id description +*/ +void CxuiEventLog::append(const QString &type, const QString &value) +{ + if (mSize) { + if (mEvents.size() >= mSize) { + mEvents.removeFirst(); + } + mEvents.append(CxuiEvent(type, value)); + } +} + +/*! +* Print out the event log. +*/ +void CxuiEventLog::print() const +{ + if (mEvents.size()) { + + CX_DEBUG(("[INFO] >>> CameraX event log[%s]", mName.toAscii().constData())); + foreach(CxuiEvent e, mEvents) { + CX_DEBUG(("[INFO] <-> event: time[%s] type[%s] value[%s]", + e.mTime.toString("HH:mm:ss.zzz").toAscii().constData(), + e.mType.toAscii().constData(), + e.mValue.toAscii().constData())); + } + CX_DEBUG(("[INFO] <<< CameraX event log[%s]", mName.toAscii().constData())); + } +} + +// end of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -76,6 +75,7 @@ mEmbeddedToolbar(NULL), mBackgroundItem(NULL), mImageLabel(NULL), + mShareUi(NULL), mStopViewfinderTimer(this), mReleaseCameraTimer(this), mPostcaptureTimer(this), @@ -97,6 +97,7 @@ CX_DEBUG_ENTER_FUNCTION(); QCoreApplication::instance()->removeEventFilter(this); stopTimers(); + delete mShareUi; CX_DEBUG_EXIT_FUNCTION(); } @@ -126,6 +127,8 @@ mImageLabel = qobject_cast(widget); CX_DEBUG_ASSERT(mImageLabel); + mShareUi = new ShareUi(); + // get toolbar pointers from the documentloader widget = mDocumentLoader->findWidget(STILL_POST_CAPTURE_TOOLBAR); // This resize is a workaround to get toolbar shown correctly. @@ -206,7 +209,7 @@ */ void CxuiPostcaptureView::playVideo() { - + launchNotSupportedNotification(); //! @todo needs an implementation CX_DEBUG_IN_FUNCTION(); @@ -285,16 +288,12 @@ stopTimers(); releaseCamera(); - + hideControls(); QString filename = getCurrentFilename(); - QStringList filelist; filelist.append(filename); - ShareUi dialog; - dialog.send(filelist, true); - - showControls(); + mShareUi->send(filelist, true); CX_DEBUG_EXIT_FUNCTION(); } @@ -398,22 +397,6 @@ } // --------------------------------------------------------------------------- -// CxuiPostcaptureView::mousePressEvent -// -// --------------------------------------------------------------------------- -// -void CxuiPostcaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - - if (event->type() == QEvent::GraphicsSceneMousePress) { - mPostcaptureTimer.stop(); - toggleControls(); - event->accept(); - } - -} - -// --------------------------------------------------------------------------- // CxuiPostcaptureView::showEvent // // --------------------------------------------------------------------------- diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -16,7 +16,6 @@ */ #include -#include #include #include #include @@ -169,9 +168,6 @@ if (mMainWindow) { mEngine->viewfinderControl().setWindow(mMainWindow->effectiveWinId()); - setFlag(QGraphicsItem::ItemIsFocusable); - setFocusPolicy(Qt::StrongFocus); - setFocus(); } CX_DEBUG_EXIT_FUNCTION(); @@ -278,25 +274,9 @@ // call load widgets to load app DocML and get the pointers to needed widgets loadWidgets(); } - CxuiView::toggleControls(); } - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::mousePressEvent -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - //! @todo temporary workaround for title bar mouse event handling bug - if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) { - toggleControls(); - event->accept(); - } -} - // --------------------------------------------------------------------------- // CxuiPrecaptureView::handleZoomLevelChange // Slot to handle zoom level change signal from zoom control. @@ -483,15 +463,13 @@ */ void CxuiPrecaptureView::prepareToCloseDialog(HbAction *action) { - if (!action) { - return; - } - // Check if the dialog was started from grid, and show the grid now if needed. // Autofocus key-press will clear the action to disable showing the grid. - QString fromGrid = action->property(PROPERTY_KEY_SETTING_GRID).toString(); - if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) { - showSettingsGrid(); + if (action) { + QString fromGrid = action->property(PROPERTY_KEY_SETTING_GRID).toString(); + if (fromGrid.compare(QString(PROPERTY_KEY_TRUE)) == 0 ) { + showSettingsGrid(); + } } // Clear the starter actions to be sure they are not reused. diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -51,7 +51,8 @@ CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) : CxuiView(parent), mSettingsInfo(NULL), - mScenesBackground(NULL) + mScenesBackground(NULL), + mScenesHeading(NULL) { CX_DEBUG_IN_FUNCTION(); } @@ -105,6 +106,10 @@ widget = mDocumentLoader->findWidget(SCENE_VIEW_CONTAINER); mScenesContainer = qobject_cast (widget); + mScenesHeading = qobject_cast( + mDocumentLoader->findWidget(SCENE_VIEW_HEADING_WIDGET)); + CX_ASSERT_ALWAYS(mScenesHeading); + //Now let's retreive the pointer to icon widget widget = mDocumentLoader->findWidget(SCENE_VIEW_BG_IMAGE); mScenesBackground = qobject_cast (widget); @@ -157,6 +162,10 @@ mSettingPairList = data.mSettingPairList; mScenesList->init(&data); + if (mScenesHeading) { + mScenesHeading->setPlainText(data.mHeading); + } + if (mScenesBackground) { QString sceneId; mEngine->settings().get(data.mSettingId, sceneId); @@ -311,6 +320,7 @@ CX_DEBUG_ENTER_FUNCTION(); mScenesList->handleClose(); mScenesBackground->setIcon(HbIcon()); + mScenesHeading = NULL; // Make sure engine prepares for new image/video if necessary mEngine->initMode(mEngine->mode()); emit viewCloseEvent(); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuistandby.cpp --- a/camerauis/cameraxui/cxui/src/cxuistandby.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuistandby.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -35,15 +36,16 @@ -/* -* CxuiStandby::CxuiStandby -*/ +/*! + * Constructor + */ CxuiStandby::CxuiStandby(CxuiCaptureKeyHandler &keyHandler,CxuiDocumentLoader *documentLoader, CxeEngine *engine) : mKeyHandler(keyHandler), mDocumentLoader(documentLoader), mEngine(engine), mStandbyPopup(NULL), - mStandbyDialogVisible(false) + mStandbyDialogVisible(false), + mAllowDismiss(true) { CX_DEBUG_ENTER_FUNCTION(); CX_ASSERT_ALWAYS(engine); @@ -55,7 +57,7 @@ QCoreApplication::instance()->installEventFilter(this); CX_ASSERT_ALWAYS(mStandbyTimer); - connect(mStandbyTimer, SIGNAL(timeout()), this, SLOT(toStandby())); + connect(mStandbyTimer, SIGNAL(timeout()), this, SLOT(enterStandby())); mStandbyTimer->setSingleShot(true); CX_DEBUG_EXIT_FUNCTION(); @@ -63,9 +65,9 @@ -/* -* CxuiStandby::~CxuiStandby() -*/ +/*! + * Destructor + */ CxuiStandby::~CxuiStandby() { CX_DEBUG_IN_FUNCTION(); @@ -76,9 +78,41 @@ } -/* -* stops standby timer +/*! +* Allow dismissing standby mode with AF or capture key? +* @param allow Is dismissing allowed. */ +void CxuiStandby::allowDismiss(bool allow) +{ + CX_DEBUG_ENTER_FUNCTION(); + mAllowDismiss = allow; + if (allow) { + if (mStandbyDialogVisible) { + // Reconnect the close signals if dialog is visible + connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection); + connect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection); + } + } else { + disconnect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close())); + disconnect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close())); + } + + CX_DEBUG_EXIT_FUNCTION(); +} + + +/*! +* Is standby mode active? +* @return True, if standby mode is active, false if not. +*/ +bool CxuiStandby::isActive() const +{ + return mStandbyDialogVisible; +} + +/*! + * stops standby timer + */ void CxuiStandby::stopTimer() { if(mStandbyTimer) { @@ -86,9 +120,9 @@ } } -/* -* starts standby timer -*/ +/*! + * starts standby timer + */ void CxuiStandby::startTimer() { if(mStandbyTimer) { @@ -96,19 +130,37 @@ } } - -/* -* handles mouse press events -* returns if mouse key press is consumed. -*/ -bool CxuiStandby::handleMouseEvent() +/*! + * Handles mouse press events + * returns if mouse key press is consumed. + * \param event event to be handled + * \return boolean to indicate whether the event was handled or not + */ +bool CxuiStandby::handleMouseEvent(QEvent *event) { bool keyHandled = false; // close the dialog if it's visible if (mStandbyDialogVisible && mStandbyPopup) { - CX_DEBUG(( "closing the popup mStandbyDialogVisible = : %d", mStandbyDialogVisible )); - mStandbyPopup->close(); + HbInstantFeedback feedback(HbFeedback::BasicItem); + switch (event->type()) { + case QEvent::GraphicsSceneMousePress: + feedback.play(); + break; + case QEvent::GraphicsSceneMouseRelease: + if (mAllowDismiss) { + CX_DEBUG(( "closing the popup mStandbyDialogVisible = : %d", mStandbyDialogVisible )); + // todo: sound disabling doesn't work in orbit yet so don't do feedback on release + // needs to be enabled when orbit support is done + //feedback.setModalities(HbFeedback::Tactile); + //feedback.play(); + exitStandby(); + } + break; + default: + break; + } + // eat all mouse events when standby is active keyHandled = true; } else if (mStandbyTimer && mStandbyTimer->isActive()) { // restart the timer only if it's running @@ -119,10 +171,10 @@ } -/* -* switching to standby. -*/ -void CxuiStandby::toStandby() +/*! + * switching to standby. + */ +void CxuiStandby::enterStandby() { CX_DEBUG_ENTER_FUNCTION(); @@ -165,17 +217,31 @@ mStandbyPopup->show(); // connecting half press or full press key signal to dismiss standby - connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close())); - connect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close())); + connect(&mKeyHandler, SIGNAL(autofocusKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection); + connect(&mKeyHandler, SIGNAL(captureKeyPressed()), mStandbyPopup, SLOT(close()), Qt::UniqueConnection); + } + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! +* Close the standby dialog. +*/ +void CxuiStandby::exitStandby() +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (mAllowDismiss && mStandbyDialogVisible && mStandbyPopup) { + mStandbyPopup->close(); } CX_DEBUG_EXIT_FUNCTION(); } -/* -* dismisses standby -*/ +/*! + * dismisses standby + */ void CxuiStandby::dismissStandby() { CX_DEBUG_ENTER_FUNCTION(); @@ -194,17 +260,16 @@ -/* -* checks if we can swtich to standby -*/ +/*! + * checks if we can switch to standby + */ bool CxuiStandby::proceedToStandy() { CX_DEBUG_ENTER_FUNCTION(); CX_ASSERT_ALWAYS(mEngine); bool ok = false; - if(!mStandbyDialogVisible && - mEngine->isEngineReady()) { + if (!mStandbyDialogVisible) { CX_DEBUG(("show standby dialog")); ok = true; } @@ -216,10 +281,9 @@ -/* -* Event filter which filters application wide mouse events. -*/ - +/*! + * Event filter which filters application wide mouse events. + */ bool CxuiStandby::eventFilter(QObject *object, QEvent *event) { Q_UNUSED(object); @@ -229,7 +293,7 @@ case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseRelease: - eventWasConsumed = handleMouseEvent(); + eventWasConsumed = handleMouseEvent(event); break; default: break; diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -130,6 +130,10 @@ mQualityIcon = qobject_cast(widget); CX_DEBUG_ASSERT(mQualityIcon); + widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_FACE_TRACKING_ICON); + mFaceTrackingIcon = qobject_cast(widget); + CX_DEBUG_ASSERT(mFaceTrackingIcon); + widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_INDICATOR_CONTAINER); mIndicators = qobject_cast(widget); CX_DEBUG_ASSERT(mIndicators); @@ -296,7 +300,8 @@ action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::CONTRAST); action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); - mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification())); + action = mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchSetting())); + action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::FACE_TRACKING); action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); @@ -555,6 +560,7 @@ updateImagesLeftLabel(); updateQualityIcon(); + updateFaceTrackingIcon(); // cancel selftimer when returning to precapture // since selftimer needs to be turned off after capturing an image @@ -704,6 +710,8 @@ updateQualityIcon(); // update images left when quality values are changed updateImagesLeftLabel(); + } else if (key == CxeSettingIds::FACE_TRACKING) { + updateFaceTrackingIcon(); } // update toolbar flash icon @@ -792,4 +800,26 @@ CX_DEBUG_EXIT_FUNCTION(); } +/*! + Update the face tracking icon +*/ +void CxuiStillPrecaptureView::updateFaceTrackingIcon() +{ + CX_DEBUG_ENTER_FUNCTION(); + if (mFaceTrackingIcon && mEngine) { + QString key = ""; + QString icon = ""; + int currentValue = -1; + + key = CxeSettingIds::FACE_TRACKING; + + mEngine->settings().get(key, currentValue); + icon = getSettingItemIcon(key, currentValue); + + mFaceTrackingIcon->setIcon(HbIcon(icon)); + } + + CX_DEBUG_EXIT_FUNCTION(); +} + // end of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -575,9 +575,13 @@ } mElapsedTimer.start(CXUI_ELAPSED_TIME_TIMEOUT); disableFeedback(); - if (mRecordingAnimation && mRecordingIcon) { - mRecordingAnimation->start(); - } + + // commented out the activation of the recording animation because + // it is causing issues when using SW rendering + //if (mRecordingAnimation && mRecordingIcon) { + // mRecordingAnimation->start(); + //} + break; case CxeVideoCaptureControl::Paused: mElapsedTimer.stop(); @@ -593,9 +597,12 @@ mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED); } - if (mRecordingAnimation && mRecordingIcon) { - mRecordingAnimation->stop(); - } + // commented out the stopping of the recording animation since the activation + // is commented out also couple lines earlier + //if (mRecordingAnimation && mRecordingIcon) { + // mRecordingAnimation->stop(); + //} + enableFeedback(); mElapsedTimer.stop(); diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuiview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiview.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -45,7 +46,8 @@ mSlider(NULL), mToolbar(NULL), mIndicators(NULL), - mHideControlsTimeout(this) + mHideControlsTimeout(this), + mControlsFeedback(HbFeedback::BasicItem) { CX_DEBUG_IN_FUNCTION(); } @@ -357,4 +359,36 @@ } } +/*! + * Handle mouse press events on this view. Needed to implement toggling of + * controls and playing feedback. + * \param event event to be handled + */ +void CxuiView::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + //! @todo temporary workaround for title bar mouse event handling bug + if (event->type() == QEvent::GraphicsSceneMousePress && event->scenePos().y() > 70) { + mControlsFeedback.setModalities(HbFeedback::All); + mControlsFeedback.play(); + event->accept(); + } +} + +/*! + * Handle mouse release events on this view. Needed to implement toggling of + * controls and playing feedback. + * \param event to be handled + */ +void CxuiView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + //! @todo temporary workaround for title bar mouse event handling bug + if (event->type() == QEvent::GraphicsSceneMouseRelease && event->scenePos().y() > 70) { + // 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(); + toggleControls(); + event->accept(); + } +} // End of file diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp --- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -76,8 +76,8 @@ mApplicationMonitor = new CxuiApplicationFrameworkMonitor(mApplication, mEngine.settings()); connect(mApplicationMonitor, SIGNAL(foregroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState)), this, SLOT(handleForegroundStateChanged(CxuiApplicationFrameworkMonitor::ForegroundState))); - connect(mApplicationMonitor, SIGNAL(batteryEmpty()), - this, SLOT(handleBatteryEmpty())); + connect(mApplicationMonitor, SIGNAL(batteryEmpty()), this, SLOT(handleBatteryEmpty())); + connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)), this, SLOT(showUsbErrorPopup(bool))); // Connect memory monitor start / stop to focused status connect(this, SIGNAL(focusGained()), &mEngine.memoryMonitor(), SLOT(startMonitoring())); @@ -105,49 +105,24 @@ connect(mErrorManager, SIGNAL(aboutToRecoverError()), this, SLOT(aboutToLooseFocus())); connect(mErrorManager, SIGNAL(errorRecovered()), this, SLOT(aboutToGainFocus())); - if (!CxuiServiceProvider::isCameraEmbedded()) { - // For embedded mode: don't create view yet, create - // when engine inits to correct mode - CX_DEBUG_ASSERT(mEngine.cameraDeviceControl().cameraIndex() == Cxe::PrimaryCameraIndex); - if (mEngine.mode() == Cxe::VideoMode) { - createVideoPrecaptureView(); - mMainWindow.blockSignals(true); - mMainWindow.setCurrentView(mVideoPrecaptureView, false); - mMainWindow.blockSignals(false); - } else { - createStillPrecaptureView(); - mMainWindow.blockSignals(true); - mMainWindow.setCurrentView(mStillPrecaptureView, false); - mMainWindow.blockSignals(false); - } - connectPreCaptureSignals(); - } - //connecting initmode signals connect(&mEngine.cameraDeviceControl(), SIGNAL(initModeComplete(CxeError::Id)), this, SLOT(createPostcaptureView())); connect(&mEngine.cameraDeviceControl(), SIGNAL(initModeComplete(CxeError::Id)), - mErrorManager, SLOT(analyze(CxeError::Id))); + mErrorManager, SLOT(showPopup(CxeError::Id))); connect(&mEngine.stillCaptureControl(), SIGNAL(imageCaptured(CxeError::Id, int)), - mErrorManager, SLOT(analyze(CxeError::Id))); - - if (CxuiServiceProvider::isCameraEmbedded()) { - // connect signals to set up the view after image/video prepare - connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)), - this, SLOT(changeToPrecaptureView())); - connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), - this, SLOT(changeToPrecaptureView())); - - // start standby timer now because view will not be ready when viewfinder is started - mStandbyHandler->startTimer(); - } + mErrorManager, SLOT(showPopup(CxeError::Id))); // Register stylesheet. It will be automatically destroyed on application // exit. HbStyleLoader::registerFilePath(":/camerax/cxui.css"); + // Create the view we are starting in, or connect signals so it + // will be created once we know the mode we are starting to. + initStartupView(); + CX_DEBUG_EXIT_FUNCTION(); } @@ -167,6 +142,14 @@ CX_DEBUG_EXIT_FUNCTION(); } +/** +* Temporary method to check if camera startup should be proceeded after creating view mananger. +*/ +bool CxuiViewManager::proceedStartup() +{ + return !mStandbyHandler->isActive(); +} + // --------------------------------------------------------------------------- // CxuiViewManager::prepareWindow @@ -178,6 +161,61 @@ getPrecaptureView(mEngine.mode(), mEngine.cameraDeviceControl().cameraIndex())->prepareWindow(); } +/*! +* Check if we need to take special actions in startup. +* USB mass memory mode atleast requires us to enter error standby mode, +* where user can only exit or fix the issue (remove cable). +*/ +void CxuiViewManager::startupCheck() +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (mApplicationMonitor && mApplicationMonitor->isUsbMassMemoryModeActive()) { + showUsbErrorPopup(true); + } + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! +* Select and initialize the view we need to start into. +*/ +void CxuiViewManager::initStartupView() +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (!CxuiServiceProvider::isCameraEmbedded()) { + // For embedded mode: don't create view yet, create + // when engine inits to correct mode + CX_DEBUG_ASSERT(mEngine.cameraDeviceControl().cameraIndex() == Cxe::PrimaryCameraIndex); + if (mEngine.mode() == Cxe::VideoMode) { + createVideoPrecaptureView(); + mMainWindow.blockSignals(true); + mMainWindow.setCurrentView(mVideoPrecaptureView, false); + mMainWindow.blockSignals(false); + } else { + createStillPrecaptureView(); + mMainWindow.blockSignals(true); + mMainWindow.setCurrentView(mStillPrecaptureView, false); + mMainWindow.blockSignals(false); + } + connectPreCaptureSignals(); + + startupCheck(); + } else { + // For embedded mode: don't create view yet, create when engine inits to correct mode. + // Connect signals to set up the view after image/video prepare + connect(&mEngine.stillCaptureControl(), SIGNAL(imagePrepareComplete(CxeError::Id)), + this, SLOT(changeToPrecaptureView())); + connect(&mEngine.videoCaptureControl(), SIGNAL(videoPrepareComplete(CxeError::Id)), + this, SLOT(changeToPrecaptureView())); + + // start standby timer now because view will not be ready when viewfinder is started + mStandbyHandler->startTimer(); + } + + CX_DEBUG_EXIT_FUNCTION(); +} // --------------------------------------------------------------------------- // CxuiViewManager::createStillPrecaptureView @@ -415,21 +453,25 @@ this, SLOT(changeToPrecaptureView())); } - HbView *view = getPrecaptureView(mEngine.mode(), - mEngine.cameraDeviceControl().cameraIndex()); - - mMainWindow.blockSignals(true); - mMainWindow.setCurrentView(view, false); - mMainWindow.blockSignals(false); + // If standby mode is active, don't switch to precapture view and reserve camera now. + if (mStandbyHandler->isActive()) { + CX_DEBUG(("CxuiViewManager - Change to precapture blocked as standby mode still active.")); + } else { + HbView *view = getPrecaptureView(mEngine.mode(), + mEngine.cameraDeviceControl().cameraIndex()); - if (mSceneModeView){ - delete mSceneModeView; - mSceneModeView = NULL; + mMainWindow.blockSignals(true); + mMainWindow.setCurrentView(view, false); + mMainWindow.blockSignals(false); + + if (mSceneModeView){ + delete mSceneModeView; + mSceneModeView = NULL; + } + // connecting necessary pre-capture view signals + connectPreCaptureSignals(); + emit startStandbyTimer(); } - // connecting necessary pre-capture view signals - connectPreCaptureSignals(); - emit startStandbyTimer(); - CX_DEBUG_EXIT_FUNCTION(); } @@ -567,7 +609,7 @@ connect(currentView, SIGNAL(switchCamera()), this, SLOT(switchCamera()), Qt::UniqueConnection); // connecting error signals from precapture view to errormanager. - connect(currentView, SIGNAL(reportError(CxeError::Id)), mErrorManager, SLOT(analyze(CxeError::Id)), Qt::UniqueConnection); + connect(currentView, SIGNAL(reportError(CxeError::Id)), mErrorManager, SLOT(showPopup(CxeError::Id)), Qt::UniqueConnection); } CX_DEBUG_EXIT_FUNCTION(); @@ -652,6 +694,33 @@ } } +/*! +* Show or hide error popup based on change in USB mass memory mode activity. +* @param show Show the popup? +*/ +void CxuiViewManager::showUsbErrorPopup(bool show) +{ + CX_DEBUG_ENTER_FUNCTION(); + if (show) { + mStandbyHandler->enterStandby(); + mStandbyHandler->allowDismiss(false); + // Emulate "mass memory not accessible" error to Error Manager + // to get the same functionality as if the error came from CxEngine. + mErrorManager->showPopup(CxeError::MemoryNotAccessible); + } else { + mStandbyHandler->allowDismiss(true); + // If we are in postcapture view or scene view, we can return right away to normal mode. + // For precapture views we expect user action before reserving camera + // and starting viewfinder again. + QObject *currentView = mMainWindow.currentView(); + if (currentView == mPostcaptureView || currentView == mSceneModeView) { + mStandbyHandler->exitStandby(); + } + mErrorManager->hidePopup(CxeError::MemoryNotAccessible); + } + CX_DEBUG_EXIT_FUNCTION(); +} + // --------------------------------------------------------------------------- // CxuiViewManager::aboutToLooseFocus() // @@ -681,20 +750,27 @@ { CX_DEBUG_ENTER_FUNCTION(); - // Disconnect capture key event and bringing us to foreground connection (if there is one). - disconnect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground())); - - // we are getting the focus. - if (mMainWindow.currentView() != mPostcaptureView) { - connectPreCaptureSignals(); + // If standby mode is still active, no action is needed yet. + // This is the case when USB mass memory mode error is cleared. + if (mStandbyHandler->isActive()) { + CX_DEBUG(("CxuiViewManager - Focus gain event ignored as standby mode still active.")); } else { - connectPostCaptureSignals(); - } + + // Disconnect capture key event and bringing us to foreground connection (if there is one). + disconnect(mKeyHandler, SIGNAL(captureKeyPressed()), this, SLOT(toForeground())); - if (mKeyHandler) { - mKeyHandler->listenKeys(true); + // we are getting the focus. + if (mMainWindow.currentView() != mPostcaptureView) { + connectPreCaptureSignals(); + } else { + connectPostCaptureSignals(); + } + + if (mKeyHandler) { + mKeyHandler->listenKeys(true); + } + emit focusGained(); } - emit focusGained(); CX_DEBUG_EXIT_FUNCTION(); } diff -r 5c1e3c6aa4ef -r b12f3922a74f camerauis/cameraxui/cxui/src/main.cpp --- a/camerauis/cameraxui/cxui/src/main.cpp Fri Jun 11 13:26:48 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/main.cpp Wed Jun 23 17:59:54 2010 +0300 @@ -20,7 +20,7 @@ #include #include // needed for localization -#include +#include #include #include #include @@ -40,9 +40,8 @@ using namespace Cxe; // CONSTANTS -const QString TRANSLATIONS_PATH = "z:/resource/qt/translations/"; -const QString TRANSLATIONS_FILE_NAME = "camera_"; -const QString COMMON_TRANSLATIONS_FILE_NAME = "common_"; +const QString TRANSLATIONS_PATH = "/resource/qt/translations/"; +const QString TRANSLATIONS_FILE = "camera"; int main(int argc, char *argv[]) { @@ -82,24 +81,14 @@ OstTrace0( camerax_performance, DUP10__MAIN, "msg: e_CX_INIT_ENGINE 0" ); } - // Load the language specific localization files: application + common + // Load language specific application localization file, e.g. "camera_en.qm" + CX_DEBUG(("CxUI: Load translations..")); OstTrace0( camerax_performance, DUP3__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 1" ); - QTranslator translator; - QString lang = QLocale::system().name(); - - CX_DEBUG(("CxUI: loading translation")); - bool ret = false; - ret = translator.load(TRANSLATIONS_PATH + TRANSLATIONS_FILE_NAME + lang); - CX_DEBUG(("load ok=%d", ret)); - app.installTranslator( &translator ); - - QTranslator commonTranslator; - CX_DEBUG(("CxUI: loading common translation")); - ret = false; - ret = commonTranslator.load(TRANSLATIONS_PATH + COMMON_TRANSLATIONS_FILE_NAME + lang); - CX_DEBUG(("load ok=%d", ret)); - app.installTranslator(&commonTranslator); + HbTranslator* trans = new HbTranslator(TRANSLATIONS_PATH, TRANSLATIONS_FILE); + // Load language specific common localization file + trans->loadCommon(); OstTrace0( camerax_performance, DUP4__MAIN, "msg: e_CX_LOAD_TRANSLATIONS 0" ); + CX_DEBUG(("CxUI: ..translations loaded")); OstTrace0( camerax_performance, DUP5__MAIN, "msg: e_CX_MAINWINDOW_CREATION 1" ); HbMainWindow *mainWindow = new HbMainWindow(0, Hb::WindowFlagTransparent | @@ -124,8 +113,11 @@ OstTrace0( camerax_performance, DUP18__MAIN, "msg: e_CX_PREPAREWINDOW 0" ); //! @todo initMode call added here as a temporary hack to change the startup sequence // in order to avoid GOOM issues - User::After(2000000); - eng->initMode(Cxe::ImageMode); + if (viewManager->proceedStartup()) { + User::After(2000000); + eng->initMode(Cxe::ImageMode); + } + int returnValue = app.exec(); // delete service provider instance @@ -133,6 +125,7 @@ delete viewManager; delete mainWindow; + delete trans; delete eng; return returnValue;