# HG changeset patch # User hgs # Date 1279147565 -10800 # Node ID c5025ea871a1923728b1a9dee7dacdfbfb0e1475 # Parent 0f0b4c1d77445f6bcc2af234dffe0085099cb5b3 201021_1 diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/conf/CI_camerax.confml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxengine/conf/CI_camerax.confml Thu Jul 15 01:46:05 2010 +0300 @@ -0,0 +1,44 @@ + + + CameraX settings + + + StillShowCapturedCr defines setting in Image settings. + If disabled, post-capture view is not shown after capturing an image. + + + + + VideoShowCapturedCr defines setting in Image settings. + If disabled, post-capture view is not shown after capturing an video. + + + + + Store location information in metadata for captured images. + + + + The key defines if facetracking should be on or off. + + + + The key defines if the capture sound should always be played, regardless of profile sounds. + + + + diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/conf/camerax.confml --- a/camerauis/cameraxui/cxengine/conf/camerax.confml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/conf/camerax.confml Thu Jul 15 01:46:05 2010 +0300 @@ -27,26 +27,6 @@ - - StillShowCapturedCr defines setting in Image settings. - If disabled, post-capture view is not shown after capturing an image. - - - - - VideoShowCapturedCr defines setting in Image settings. - If disabled, post-capture view is not shown after capturing an video. - - - ImageQualityCr defines the quality currently in use in still mode. @@ -76,6 +56,9 @@ 1 0 0 + 0 + 1 + 0 @@ -88,6 +71,9 @@ true true true + true + true + true diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/conf/camerax_20027017.crml Binary file camerauis/cameraxui/cxengine/conf/camerax_20027017.crml has changed diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/cxengine.pro --- a/camerauis/cameraxui/cxengine/cxengine.pro Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/cxengine.pro Thu Jul 15 01:46:05 2010 +0300 @@ -91,6 +91,7 @@ symbian { CXENGINE_DIR = $$section(PWD,":",1) BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include " + BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/CI_camerax.confml APP_LAYER_CONFML(CI_camerax.confml) BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/camerax.confml APP_LAYER_CONFML(camerax.confml) BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/camerax_20027017.crml APP_LAYER_CRML(camerax_20027017.crml) BLD_INF_RULES.prj_exports += "$$CXENGINE_DIR/conf/cameraxvariation.confml APP_LAYER_CONFML(cameraxvariation.confml) diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/inc/api/cxeautofocuscontrol.h --- a/camerauis/cameraxui/cxengine/inc/api/cxeautofocuscontrol.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/api/cxeautofocuscontrol.h Thu Jul 15 01:46:05 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" @@ -34,7 +34,7 @@ { Q_OBJECT public: - + /* * Autofocus control states. */ @@ -42,71 +42,76 @@ { //! focusing InProgress = 0x01, - + //! Autofocus Failed Failed = 0x02, - + //! Focused Ready = 0x04, - + //! State after successfully canceling AF or during startup Unknown = 0x08, - + //! Starting to cancel any pending AF requests Canceling = 0x10 // Starting to Cancel any pending AF requests }; - + // TODO: Check if we have to get all the supported modes from adaptation. enum Mode { //! AF mode: Auto Auto, - + //! AF mode: Hyperfocal Hyperfocal, - + //! AF mode: Macro Macro, - + //! AF mode: Infinity Infinity, - + //! AF mode: Portrait Portrait }; - + /** * Starts Autofocus. * \param soundEnabled indicates if the auto focus sound should be played */ virtual CxeError::Id start(bool soundEnabled = true) = 0; - + /** * Cancels Autofocus. */ virtual void cancel() = 0; // cancels active start operation - + /** * Setting Autofocus Mode. */ virtual void setMode( Mode newMode ) = 0; // sets default value for current view/mode - + /** * Get current Autofocus mode. */ virtual Mode mode() const = 0; - + + /** + * Is the mode a fixed focus mode. + */ + virtual bool isFixedFocusMode(Mode mode) const = 0; + /** * Get current Autofocus state. */ virtual State state() const = 0; // returns current AF state, one of AutoFocusState - + /** * Check if Autofocus is Supported or Not. */ virtual bool supported() const = 0; // true when AF is supported - + /** * Check if auto focus sound is enabled */ diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/inc/api/cxenamespace.h --- a/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/api/cxenamespace.h Thu Jul 15 01:46:05 2010 +0300 @@ -147,7 +147,9 @@ static const char* VIDEO_QUALITY = "videoQuality"; static const char* SECONDARY_CAMERA = "2ndCamera"; static const char* SELF_TIMER = "selfTimer"; - + static const char* FACE_TRACKING = "face_tracking"; + static const char* GEOTAGGING = "geotagging"; + static const char* CAPTURE_SOUND_ALWAYS_ON = "capture_sound_always_on"; // file name/path related key values static const char* FNAME_FOLDER_SUFFIX = "folder_suffix"; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h --- a/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxeautofocuscontrolsymbian.h Thu Jul 15 01:46:05 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" @@ -48,6 +48,7 @@ void cancel(); void setMode( CxeAutoFocusControl::Mode newMode ); CxeAutoFocusControl::Mode mode() const; + bool isFixedFocusMode(CxeAutoFocusControl::Mode mode) const; CxeAutoFocusControl::State state() const; bool supported() const; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h --- a/camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxecenrepkeys.h Thu Jul 15 01:46:05 2010 +0300 @@ -28,6 +28,9 @@ const unsigned long int ImageQualityCr = 0x7; const unsigned long int VideoQualityCr = 0x8; const unsigned long int AudioMuteCr = 0x9; +const unsigned long int GeoTaggingCr = 0xA; +const unsigned long int FacetrackingCr = 0xB; +const unsigned long int CaptureSoundAlwaysOnCr = 0xC; const unsigned long int CxRuntimeFeaturesCrUid = {0x20027018}; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h --- a/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h Thu Jul 15 01:46:05 2010 +0300 @@ -125,6 +125,7 @@ void generateFilename(); void handlePrepareFailed(); void handleComposeFailed(int error); + void emulateNormalStopping(); protected: // protected data //! Video Recorder diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxeautofocuscontrolsymbian.cpp Thu Jul 15 01:46:05 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" @@ -91,25 +91,28 @@ */ CxeError::Id CxeAutoFocusControlSymbian::start(bool soundEnabled) { - CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <> state: %d, sound enabled: %d", - state(), soundEnabled ) ); - mSoundEnabled = soundEnabled; - int err = KErrNone; - CX_ASSERT_ALWAYS(mAdvancedSettings); - if ( state() != CxeAutoFocusControl::InProgress && state() != CxeAutoFocusControl::Canceling ) { - CX_DEBUG(("CxeAutoFocusControlSymbian::start() calling SetAutoFocusType")); - mCancelled = false; - setState(InProgress); - setFocusRange(mAFRange); - setFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle); - } else { // AF was started earlier, can't start until it completes - err = KErrInUse; + CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <> state: %d, sound enabled: %d", + state(), soundEnabled ) ); + + mSoundEnabled = soundEnabled; + CxeError::Id error = CxeError::None; + + if (!isFixedFocusMode(mode())) { + if ( state() != CxeAutoFocusControl::InProgress && state() != CxeAutoFocusControl::Canceling ) { + CX_DEBUG(("CxeAutoFocusControlSymbian::start() calling SetAutoFocusType")); + mCancelled = false; + setState(InProgress); + setFocusRange(mAFRange); + setFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle); + } else { // AF was started earlier, can't start until it completes + error = CxeError::InUse; + } } - CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <= err : %d", err ) ); - return CxeErrorHandlingSymbian::map(err); + CX_DEBUG( ("CxeAutoFocusControlSymbian::start() <= error: %d", error ) ); + return error; } @@ -123,7 +126,7 @@ CX_DEBUG_ASSERT(mAdvancedSettings); - if (!mCancelled) { + if (!mCancelled && !isFixedFocusMode(mode())) { if (state() == CxeAutoFocusControl::InProgress) { // Need to stop current AF first. Wait for AF event to proceed. setState(CxeAutoFocusControl::Canceling); @@ -171,6 +174,14 @@ return mAfMode; } +/** +* Is the given mode a fixed focus mode? +*/ +bool CxeAutoFocusControlSymbian::isFixedFocusMode(CxeAutoFocusControl::Mode mode) const +{ + return (mode == CxeAutoFocusControl::Hyperfocal + || mode == CxeAutoFocusControl::Infinity); +} /* * To check if Autofocus is supported @@ -389,7 +400,15 @@ // we are interested only in the AF range. if(scene.contains(CxeSettingIds::FOCAL_RANGE) && supported() ) { + setMode(static_cast(scene[CxeSettingIds::FOCAL_RANGE].toInt())); + + if (isFixedFocusMode(mode())) { + // Focus now if a fixed focus mode is used. + setFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle); + // Set state to InProgress, so we know to set it ready in ECAM callback. + setState(CxeAutoFocusControl::InProgress); + } } CX_DEBUG_EXIT_FUNCTION(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp --- a/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxesettingscenrepstore.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -314,6 +314,18 @@ addKeyMapping(CxeSettingIds::VIDEO_MUTE_SETTING, AudioMuteCr, XQSettingsManager::TypeInt); + + addKeyMapping(CxeSettingIds::GEOTAGGING, + GeoTaggingCr, + XQSettingsManager::TypeInt); + + addKeyMapping(CxeSettingIds::FACE_TRACKING, + FacetrackingCr, + XQSettingsManager::TypeInt); + + addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, + CaptureSoundAlwaysOnCr, + XQSettingsManager::TypeInt); // mapping run-time keys addKeyMapping(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS, diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxestillcapturecontrolsymbian.cpp Thu Jul 15 01:46:05 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" @@ -804,8 +804,7 @@ // if focused and in correct mode, play sound if (newState == CxeAutoFocusControl::Ready && - mode != CxeAutoFocusControl::Hyperfocal && - mode != CxeAutoFocusControl::Infinity && + !mAutoFocusControl.isFixedFocusMode(mode) && mAutoFocusControl.isSoundEnabled()) { mAutoFocusSoundPlayer->play(); } diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/src/cxevideocapturecontrolsymbian.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -181,14 +181,20 @@ // stop video-recording in-case if its ongoing. stop(); + // Check if state is stopping, in which case we have to inform the + // file harvester that a file is to be completed. We would not + // call harvestFile otherwise in this case. + // Otherwise the video will not be found from videos app. + if (state() == Stopping) { + emit videoComposed(CxeError::None, mCurrentFilename); + } + mSnapshotControl.stop(); if (mVideoRecorder) { mVideoRecorder->close(); } - mCurrentFilename = QString(""); - setState(Idle); OstTrace0( camerax_performance, DUP1_CXEVIDEOCAPTURECONTROLSYMBIAN_DEINIT, "msg: e_CX_VIDEO_CAPCONT_DEINIT 0" ); @@ -453,10 +459,8 @@ CX_DEBUG(("CxeVideoCaptureControlSymbian - async stop failed, try sync..")); try { mVideoRecorder->stop(false); - // stop operation went fine, set back the state to Initialized. - setState(Initialized); - // must increment counter now since no callback is coming in sync stop - mFilenameGenerator.raiseCounterValue(); + // stopping went ok + emulateNormalStopping(); } catch (const std::exception &e) { // Even synchronous stopping failed -> release resources. CX_DEBUG(("CxeVideoCaptureControlSymbian - sync stop failed, too!")); @@ -523,9 +527,7 @@ // KErrCompletion is received when video recording stops // because of maximum clip size is reached. Emulate // normal stopping. - setState(Stopping); - MvruoEvent(TMMFEvent(KCamCControllerCCVideoRecordStopped, KErrNone)); - MvruoEvent(TMMFEvent(KCamCControllerCCVideoFileComposed, KErrNone)); + emulateNormalStopping(); } else { // error during recording, report to client @@ -630,22 +632,10 @@ { CX_DEBUG_ENTER_FUNCTION(); - // Save the state and filename before releasing. - QString filenameCopy(filename()); - CxeVideoCaptureControl::State stateCopy(state()); - // first de-init videocapture control deinit(); reset(); - // Check if state is stopping, in which case we have to inform the - // file harvester that a file is to be completed. We would not - // call harvestFile otherwise in this case. - // Otherwise the video will not be found from videos app. - if (stateCopy == CxeVideoCaptureControl::Stopping) { - emit videoComposed(CxeError::None, filenameCopy); - } - delete mVideoRecorder; mVideoRecorder = NULL; @@ -935,4 +925,18 @@ deinit(); CX_DEBUG_EXIT_FUNCTION(); } + +/*! + * Helper method to emulate video stopping events. + */ +void CxeVideoCaptureControlSymbian::emulateNormalStopping() +{ + CX_DEBUG_ENTER_FUNCTION(); + + setState(Stopping); + MvruoEvent(TMMFEvent(KCamCControllerCCVideoRecordStopped, KErrNone)); + MvruoEvent(TMMFEvent(KCamCControllerCCVideoFileComposed, KErrNone)); + + CX_DEBUG_EXIT_FUNCTION(); +} // End of file diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp --- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.cpp Thu Jul 15 01:46:05 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" @@ -59,6 +59,12 @@ return mAfMode; } +bool CxeFakeAutoFocusControl::isFixedFocusMode(Mode mode) const +{ + return (mode == CxeAutoFocusControl::Hyperfocal + || mode == CxeAutoFocusControl::Infinity); +} + bool CxeFakeAutoFocusControl::supported() const { return true; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.h --- a/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/fakeclasses/cxefakeautofocuscontrol.h Thu Jul 15 01:46:05 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -36,6 +36,7 @@ void cancel(); void setMode(CxeAutoFocusControl::Mode newMode); CxeAutoFocusControl::Mode mode() const; + bool isFixedFocusMode(Mode mode) const; CxeAutoFocusControl::State state() const; bool supported() const; bool isSoundEnabled() const; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.cpp Thu Jul 15 01:46:05 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" @@ -108,6 +108,15 @@ QVERIFY(mAutoFocusControl->mode() == CxeAutoFocusControl::Portrait); } +void UnitTestCxeAutoFocusControlSymbian::testIsFixedFocusMode() +{ + QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Auto) == false); + QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Hyperfocal) == true); + QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Macro) == false); + QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Infinity) == true); + QVERIFY(mAutoFocusControl->isFixedFocusMode(CxeAutoFocusControl::Portrait) == false); +} + void UnitTestCxeAutoFocusControlSymbian::testSupported() { bool supported = mAutoFocusControl->supported(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h --- a/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxeautofocuscontrolsymbian/unittest_cxeautofocuscontrolsymbian.h Thu Jul 15 01:46:05 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" @@ -40,6 +40,7 @@ void testStart(); void testCancel(); void testMode(); + void testIsFixedFocusMode(); void testSupported(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/cxui.pro --- a/camerauis/cameraxui/cxui/cxui.pro Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/cxui.pro Thu Jul 15 01:46:05 2010 +0300 @@ -73,6 +73,7 @@ HEADERS += cxuiapplication.h \ cxuiapplicationframeworkmonitor.h \ cxuiapplicationframeworkmonitorprivate.h \ + cxuiview.h \ cxuiprecaptureview.h \ cxuistillprecaptureview.h \ cxuivideoprecaptureview.h \ @@ -101,6 +102,7 @@ cxuiapplication.cpp \ cxuiapplicationframeworkmonitor.cpp \ cxuiapplicationframeworkmonitorprivate.cpp \ + cxuiview.cpp \ cxuiprecaptureview.cpp \ cxuivideoprecaptureview.cpp \ cxuistillprecaptureview.cpp \ diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuipostcaptureview.h Thu Jul 15 01:46:05 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include "cxuiview.h" class QGraphicsRectItem; class HbMainWindow; @@ -35,7 +35,7 @@ /** * Post-capture view */ -class CxuiPostcaptureView : public HbView +class CxuiPostcaptureView : public CxuiView { Q_OBJECT @@ -66,43 +66,35 @@ protected slots: void goToPrecaptureView(); void stopViewfinder(); - void releaseCamera(); - // Control visibility - void hideControls(); - void showControls(); - void toggleControls(); + void hideToolbar(); // toolbar actions - void launchPhotosApp(); void select(); void launchShare(); void playVideo(); void showDeleteNote(); - void launchVideosApp(); void handleDeleteDialogClosed(HbAction *action); private: - void launchNotSupportedNotification(); QString getCurrentFilename(); + void startTimers(); + void startPostcaptureTimer(); + void startReleaseTimers(); + private slots: - void startTimers(); + void handleFocusGained(); void handleFocusLost(); private: // data - HbMainWindow *mMainWindow; // not own - CxeEngine *mEngine; // not own - CxuiDocumentLoader *mDocumentLoader; // not own HbToolBar *mStillToolbar; HbToolBar *mVideoToolbar; HbToolBar *mEmbeddedToolbar; QGraphicsRectItem *mBackgroundItem; HbLabel *mImageLabel; - QTimer mHideControlsTimeout; - /** * Timer used to stop viewfinder after a delay if the user remains in * post-capture view. Viewfinder is not stopped immediately when @@ -125,12 +117,12 @@ */ QTimer mPostcaptureTimer; - bool mControlsVisible; + bool mTimersStarted; - bool mTimersStarted; - XQApplicationManager mAppManager; + bool mDeleteNoteOpen; + }; #endif // CXUIPOSTCAPTUREVIEW_H diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiprecaptureview.h Thu Jul 15 01:46:05 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -27,6 +27,7 @@ #include "cxezoomcontrol.h" #include "cxeviewfindercontrol.h" #include "cxuidisplaypropertyhandler.h" +#include "cxuiview.h" class HbAction; @@ -50,7 +51,7 @@ /** * Pre-capture view */ -class CxuiPrecaptureView : public HbView +class CxuiPrecaptureView : public CxuiView { Q_OBJECT @@ -61,13 +62,6 @@ public: - /** - * Construct-method handles initialisation tasks for this class. - * @param mainwindow - * @param engine - * @param documentLoader - * @param keyHandler - */ virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler *keyHandler); @@ -78,11 +72,9 @@ */ virtual void loadWidgets() = 0; void prepareWindow(); - virtual void updateOrientation(Qt::Orientation orient) = 0; public slots: - void releaseCamera(); void initCamera(); void requestCameraSwitch(); @@ -104,21 +96,11 @@ // UI: Zoom slider change notification void zoomTo(int value); - // Control visibility of all UI items at the same time: toolbar, zoom and titlepane items - virtual void hideControls(); - virtual void showControls(); - void toggleControls(); - void disableControlsTimeout(); void toggleZoom(); - void hideToolbar(); - - void launchPhotosApp(); - void launchVideosApp(); // Settings related - void launchNotSupportedNotification(); void launchDiskFullNotification(); void showSettingsGrid(); void hideSettingsGrid(); @@ -127,17 +109,11 @@ void prepareToCloseDialog(HbAction *action); protected: - - virtual void initializeSettingsGrid() = 0; - - void hideZoom(); - void showZoom(); - void hideIndicators(); - void showIndicators(); + void toggleControls(); + virtual void initializeSettingsGrid() = 0; void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event); - virtual void showToolbar(); bool eventFilter(QObject *object, QEvent *event); void launchSettingsDialog(QObject *action); bool isPostcaptureOn() const; @@ -145,10 +121,7 @@ QString getSettingItemIcon(const QString &key, QVariant value); void updateQualityIcon(); void updateSceneIcon(const QString& sceneId); - void createWidgetBackgroundGraphic(HbWidget *widget, - const QString &graphicName, - HbFrameDrawer::FrameType frameType = - HbFrameDrawer::NinePieces); + signals: @@ -165,26 +138,15 @@ // signal to report error to ErrorManager for further actions. void reportError(CxeError::Id errorId); - void showScenesView(); protected: - CxeEngine *mEngine; // not own HbTransparentWindow *mViewfinder; // not own, owned by the graphics scene - HbMainWindow *mMainWindow; // not own - CxuiDocumentLoader *mDocumentLoader; // not own CxuiDisplayPropertyHandler *mDisplayHandler; - bool mControlsVisible; - QTimer mHideControlsTimeout; - CxuiZoomSlider *mSlider; // zoom slider, not own, owned by the graphics scene - HbToolBar *mToolBar; // not own, owned by the graphics scene HbToolBarExtension *mSettingsGrid; - bool mZoomVisible; bool mWidgetsLoaded; CxuiSettingDialog *mSettingsDialog; CxuiSettingRadioButtonList *mSettingsDialogList; - CxuiCaptureKeyHandler *mKeyHandler; HbLabel *mQualityIcon; - HbWidget *mIndicators; private: CxuiSettingDialog* createSettingsDialog(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h --- a/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiscenemodeview.h Thu Jul 15 01:46:05 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -31,6 +31,7 @@ #include "cxuisettingsinfo.h" #include "cxuienums.h" #include "cxeengine.h" +#include "cxuiview.h" class CxuiCaptureKeyHandler; class CxuiDocumentLoader; @@ -45,7 +46,7 @@ */ -class CxuiSceneModeView : public HbView +class CxuiSceneModeView : public CxuiView { Q_OBJECT @@ -76,28 +77,20 @@ void finishScenesTransition(); void handleOkButtonPress(); void handleCancelButtonPress(); - void releaseCameraHw(); protected: void showEvent(QShowEvent *event); + bool allowShowControls() const; private: QString backgroundForScene(const QString& sceneId); void startBackgroundTransition(); - void createWidgetBackgroundGraphic(HbWidget *widget, - const QString &graphicName, - HbFrameDrawer::FrameType frameType = - HbFrameDrawer::NinePieces); void connectSignals(); void closeView(); private: - HbMainWindow *mMainWindow; //not own CxuiSettingsInfo *mSettingsInfo; - CxeEngine *mEngine; //not own - CxuiDocumentLoader *mDocumentLoader; //not own - CxuiCaptureKeyHandler *mCaptureKeyHandler; HbLabel* mScenesBackground; HbLabel* mScenesBackground2; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuiselftimer.h --- a/camerauis/cameraxui/cxui/inc/cxuiselftimer.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuiselftimer.h Thu Jul 15 01:46:05 2010 +0300 @@ -39,6 +39,7 @@ bool isEnabled(); bool isOngoing(); + int getTimeout() const; signals: void timerFinished(); void cancelled(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h --- a/camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuisettingradiobuttonlist.h Thu Jul 15 01:46:05 2010 +0300 @@ -43,7 +43,7 @@ explicit CxuiSettingRadioButtonList(QGraphicsItem *parent, CxeEngine *engine); void init(CxUiSettings::RadioButtonListParams *data); - + void setOriginalSelectedItemByValue(const QVariant &value); signals: void valueSelected(int value); void selectionCommitted(); @@ -56,7 +56,6 @@ void handleItemSelected(int index); protected: - void showEvent(QShowEvent *event); // From QGraphicsWidget virtual void initOriginalSelectedItem(); private: diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuisettingsinfo.h --- a/camerauis/cameraxui/cxui/inc/cxuisettingsinfo.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuisettingsinfo.h Thu Jul 15 01:46:05 2010 +0300 @@ -18,6 +18,11 @@ #ifndef CXUISETTINGSINFO_H #define CXUISETTINGSINFO_H +/*! +* @file +* @brief CxUi settings related classes and constants. +*/ + #include #include #include @@ -31,12 +36,23 @@ class CxeEngine; class CxuiSettingXmlReader; +/*! +* @namespace CxUiSettings +* @brief Namespace for UI settings related constants and classes. +*/ namespace CxUiSettings { - // Setting mappings + /*! Image setting definitions. */ static const char *IMAGE_SETTING_MAPPING_FILE = ":/xml/image_setting.xml"; + /*! Video setting definitions. */ static const char *VIDEO_SETTING_MAPPING_FILE = ":/xml/video_setting.xml"; + /*! + * Character used to separate lines within a single string. + * E.g. SettingItem::mItem can be split with this character to get multi-line item. + */ + static const char NEW_LINE_CHAR = '\n'; + struct SettingItem { QString mItem; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuistillprecaptureview.h Thu Jul 15 01:46:05 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" @@ -75,12 +75,10 @@ */ virtual void loadWidgets(); - void updateOrientation(Qt::Orientation orientation); - protected: void showEvent(QShowEvent *event); - virtual void showToolbar(); + virtual bool allowShowControls() const; public slots: @@ -97,7 +95,6 @@ void setCapturePending(); void goToVideo(); - void launchSceneModesPopup(); // Key events void handleCaptureKeyPressed(); @@ -117,14 +114,11 @@ */ void resetCapturePendingFlag(); - void showControls(); - /** * Application focus slots are called if focus state is changed. * Camera is released or reserved according to new state. */ void handleFocusLost(); - void handleFocusGained(); void launchSetting(); void updateImagesLeftLabel(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h --- a/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuivideoprecaptureview.h Thu Jul 15 01:46:05 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,8 +67,6 @@ */ virtual void loadWidgets(); - void updateOrientation(Qt::Orientation orientation); - public slots: // from CxuiPrecaptureView @@ -114,6 +112,7 @@ void setVideoTime(HbLabel* label, int time); bool getElapsedTime(); void getRemainingTime(); + virtual bool allowShowControls() const; virtual void showToolbar(); void disableFeedback(); void enableFeedback(); @@ -133,9 +132,9 @@ HbLabel *mRemainingTimeText; // not own HbLabel *mRecordingIcon; // not own HbAction *mGoToStillAction; // not own - HbToolBar *mToolBarIdle; // not own - HbToolBar *mToolBarRec; // not own - HbToolBar *mToolBarPaused; // not own + HbToolBar *mToolbarIdle; // not own + HbToolBar *mToolbarRec; // not own + HbToolBar *mToolbarPaused; // not own HbDialog *mVideoScenePopup; CxeVideoCaptureControl *mVideoCaptureControl; HbMenu *mMenu; // own diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuiview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxui/inc/cxuiview.h Thu Jul 15 01:46:05 2010 +0300 @@ -0,0 +1,105 @@ +/* +* 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: This is a header file for a CxuiView class +* +*/ + +#ifndef CXUIVIEW_H +#define CXUIVIEW_H + +#include +#include +#include +#include +#include + +class CxuiDocumentLoader; +class CxuiCaptureKeyHandler; +class CxuiZoomSlider; +class CxuiCaptureKeyHandler; +class CxeEngine; +class HbWidget; + +// CONSTANTS +const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds + +/** + * A base class for all views in the Camera UI + * The class is for deriving only + */ +class CxuiView : public HbView +{ + Q_OBJECT + +public: + CxuiView(QGraphicsItem *parent = 0); + virtual ~CxuiView(); + +protected: + virtual void construct(HbMainWindow *mainWindow, CxeEngine *engine, + CxuiDocumentLoader *documentLoader, + CxuiCaptureKeyHandler * keyHandler); + +public: + virtual void updateOrientation(Qt::Orientation orientation); + +protected: + virtual bool allowShowControls() const; + virtual void toggleControls(); + virtual void showToolbar(); + virtual void hideZoom(); + virtual void showZoom(); + virtual void hideIndicators(); + virtual void showIndicators(); + virtual void createWidgetBackgroundGraphic(HbWidget *widget, + const QString &graphicName, + HbFrameDrawer::FrameType frameType = + HbFrameDrawer::NinePieces); + +protected slots: + virtual void launchNotSupportedNotification(); + virtual void launchPhotosApp(); + virtual void launchVideosApp(); + virtual void releaseCamera(); + + virtual void launchScenesView(); + + // Control visibility of all UI items at the same time: toolbar, zoom and titlepane items + virtual void hideControls(); + virtual void showControls(); + + virtual void hideToolbar(); + + +signals: + void viewCloseEvent(); + void showScenesView(); + +protected: //common data + HbMainWindow *mMainWindow; // not own + CxeEngine *mEngine; // not own + CxuiDocumentLoader *mDocumentLoader; // not own + CxuiCaptureKeyHandler* mCaptureKeyHandler; + + CxuiZoomSlider *mSlider; // zoom slider, not own, owned by the graphics scene + HbToolBar *mToolbar; // not own, owned by the graphics scene + HbWidget *mIndicators; + + bool mControlsVisible; + bool mZoomVisible; + QTimer mHideControlsTimeout; + +}; + +#endif // CXUIVIEW_H diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/inc/cxuizoomslider.h --- a/camerauis/cameraxui/cxui/inc/cxuizoomslider.h Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/inc/cxuizoomslider.h Thu Jul 15 01:46:05 2010 +0300 @@ -30,6 +30,9 @@ explicit CxuiZoomSlider(QGraphicsItem *parentItem = NULL); ~CxuiZoomSlider(); +public: + void addZoomButtons(); + protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/cxui.css --- a/camerauis/cameraxui/cxui/layouts/cxui.css Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/cxui.css Thu Jul 15 01:46:05 2010 +0300 @@ -55,6 +55,10 @@ { color: var(qtc_popup_trans_normal); } +HbWidget#video_indicator_container_bottom > HbLabel::icon +{ +color: var(qtc_popup_trans_normal); +} /* Zoom sliders Decrement and increase icons both diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/image_setting.xml --- a/camerauis/cameraxui/cxui/layouts/image_setting.xml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/image_setting.xml Thu Jul 15 01:46:05 2010 +0300 @@ -19,8 +19,8 @@ setting_icon=""> - - + + @@ -32,7 +32,7 @@ - + @@ -41,7 +41,7 @@ preview="0" type="SingleLineListBox" setting_icon=""> - + @@ -80,25 +80,25 @@ type="SingleLineListBox" setting_icon=""> - - - - + + + + - + - + - + diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/setting_scenemode.docml --- a/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/setting_scenemode.docml Thu Jul 15 01:46:05 2010 +0300 @@ -64,7 +64,6 @@ - diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/setting_slider.docml --- a/camerauis/cameraxui/cxui/layouts/setting_slider.docml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/setting_slider.docml Thu Jul 15 01:46:05 2010 +0300 @@ -6,7 +6,7 @@ - + diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/video_setting.xml --- a/camerauis/cameraxui/cxui/layouts/video_setting.xml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/video_setting.xml Thu Jul 15 01:46:05 2010 +0300 @@ -8,10 +8,10 @@ - - - - + + + + @@ -42,18 +42,18 @@ - + - + - + diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/view_postcapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_postcapture.docml Thu Jul 15 01:46:05 2010 +0300 @@ -77,7 +77,6 @@ - diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/view_still_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_still_precapture.docml Thu Jul 15 01:46:05 2010 +0300 @@ -1,5 +1,5 @@ - + @@ -81,7 +81,6 @@ -
@@ -93,14 +92,14 @@ - - - - + + + + - + @@ -121,6 +120,8 @@ + + @@ -128,6 +129,8 @@ + + @@ -192,7 +195,6 @@ - @@ -208,32 +210,32 @@ - +
- - - + + + - - + + - +
- - + +
- + diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/layouts/view_video_precapture.docml --- a/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/layouts/view_video_precapture.docml Thu Jul 15 01:46:05 2010 +0300 @@ -1,5 +1,5 @@ - + @@ -48,7 +48,7 @@ - + @@ -100,7 +100,6 @@ -
@@ -112,23 +111,23 @@ - - - - + + + + - - - + + + - + @@ -136,9 +135,9 @@ - - - + + + @@ -196,7 +195,6 @@ - @@ -216,25 +214,28 @@
- - + + - - + +
- + - +
+ + + @@ -245,12 +246,34 @@ +
+
- + + + + + + + + + + + + + + + + +
-
+
+ + + + @@ -262,31 +285,8 @@ - - - - - -
-
- - - - - - - - - - - - - - - -
- + diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuipostcaptureview.cpp Thu Jul 15 01:46:05 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" @@ -59,10 +59,6 @@ using namespace CxUiLayout; using namespace Cxe; -// CONSTANTS -const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds -const QString PhotosAppExe = "photos.exe"; -const QString VideosAppExe = "videoplayer.exe"; //!@todo Temporarily disabled. //const int CXUI_STOP_VIEWFINDER_TIMEOUT = 5000; // 5 seconds @@ -74,19 +70,17 @@ // --------------------------------------------------------------------------- // CxuiPostcaptureView::CxuiPostcaptureView(QGraphicsItem *parent) : - HbView(parent), - mMainWindow(NULL), - mEngine(NULL), + CxuiView(parent), mStillToolbar(NULL), mVideoToolbar(NULL), mEmbeddedToolbar(NULL), mBackgroundItem(NULL), mImageLabel(NULL), - mHideControlsTimeout(this), mStopViewfinderTimer(this), mReleaseCameraTimer(this), mPostcaptureTimer(this), - mTimersStarted(false) + mTimersStarted(false), + mDeleteNoteOpen(false) { CX_DEBUG_IN_FUNCTION(); @@ -116,9 +110,7 @@ { CX_DEBUG_ENTER_FUNCTION(); - mMainWindow = mainwindow; - mEngine = engine; - mDocumentLoader = documentLoader; + CxuiView::construct(mainwindow, engine, documentLoader, NULL); // set back action to go back to pre-capture HbAction *backAction = new HbAction(Hb::BackNaviAction, this); @@ -186,7 +178,9 @@ { CX_DEBUG_ENTER_FUNCTION(); - goToPrecaptureView(); + if (!mDeleteNoteOpen) { + goToPrecaptureView(); + } CX_DEBUG_EXIT_FUNCTION(); } @@ -200,7 +194,9 @@ { CX_DEBUG_ENTER_FUNCTION(); - goToPrecaptureView(); + if (!mDeleteNoteOpen) { + goToPrecaptureView(); + } CX_DEBUG_EXIT_FUNCTION(); } @@ -238,6 +234,7 @@ SLOT(handleDeleteDialogClosed(HbAction*))); } + mDeleteNoteOpen = true; CX_DEBUG_EXIT_FUNCTION(); } @@ -251,6 +248,7 @@ CX_DEBUG_ENTER_FUNCTION(); hideControls(); + mDeleteNoteOpen = false; HbMessageBox *dlg = qobject_cast(sender()); @@ -344,32 +342,12 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::releaseCamera -// -// --------------------------------------------------------------------------- -// -void CxuiPostcaptureView::releaseCamera() +/*! +* Hides toolbar. +*/ +void CxuiPostcaptureView::hideToolbar() { CX_DEBUG_ENTER_FUNCTION(); - - if (mMainWindow->currentView() == this) { - mEngine->cameraDeviceControl().release(); - } - mReleaseCameraTimer.stop(); - - CX_DEBUG_EXIT_FUNCTION(); -} - -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::hideControls -// -// --------------------------------------------------------------------------- -// -void CxuiPostcaptureView::hideControls() -{ - CX_DEBUG_ENTER_FUNCTION(); - if (mStillToolbar) { mStillToolbar->hide(); } @@ -379,56 +357,6 @@ if (mEmbeddedToolbar) { mEmbeddedToolbar->hide(); } - - hideItems(Hb::AllItems); - - mControlsVisible = false; - - // stop hiding control timer - mHideControlsTimeout.stop(); - - - // give the keyboard focus back to the view - // for the view to receive key events - setFocus(); - - CX_DEBUG_EXIT_FUNCTION(); -} - -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::showControls -// -// --------------------------------------------------------------------------- -// -void CxuiPostcaptureView::showControls() -{ - CX_DEBUG_ENTER_FUNCTION(); - - showToolbar(); - - showItems(Hb::AllItems); - - mHideControlsTimeout.start(CXUI_HIDE_CONTROLS_TIMEOUT); - mControlsVisible = true; - - CX_DEBUG_EXIT_FUNCTION(); -} - -// --------------------------------------------------------------------------- -// CxuiPostcaptureView::toggleControls -// -// --------------------------------------------------------------------------- -// -void CxuiPostcaptureView::toggleControls() -{ - CX_DEBUG_ENTER_FUNCTION(); - - if (mControlsVisible) { - hideControls(); - } else { - showControls(); - } - CX_DEBUG_EXIT_FUNCTION(); } @@ -609,16 +537,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -/*! - Launches "Not supported yet" notification. - */ -void CxuiPostcaptureView::launchNotSupportedNotification() -{ - CX_DEBUG_ENTER_FUNCTION(); - HbNotificationDialog::launchDialog("Notification", "Not supported yet"); - CX_DEBUG_EXIT_FUNCTION(); -} - /* ! * gets the filename of the current file */ @@ -645,14 +563,6 @@ } /*! - Launches the Photos applications as a separate process -*/ -void CxuiPostcaptureView::launchPhotosApp() -{ - QProcess::startDetached(PhotosAppExe); -} - -/*! Sends current capture to client app and closes camera */ void CxuiPostcaptureView::select() @@ -667,14 +577,16 @@ } /*! - Launches the Videos applications as a separate process + Handle cases when we gain focus */ -void CxuiPostcaptureView::launchVideosApp() +void CxuiPostcaptureView::handleFocusGained() { - //Releasing cameda device in order to free - //graphical memory - releaseCamera(); - QProcess::startDetached(VideosAppExe); + CX_DEBUG_ENTER_FUNCTION(); + + //Note: We should not start timers until we receive the ShowEvent + showControls(); + + CX_DEBUG_EXIT_FUNCTION(); } /*! @@ -692,46 +604,63 @@ CX_DEBUG_EXIT_FUNCTION(); } - +/*! + Start the timers +*/ void CxuiPostcaptureView::startTimers() { CX_DEBUG_ENTER_FUNCTION(); // we start timers only once in a given postcapture view session - if (!mTimersStarted) { - int postCaptureTimeout = 0; - QString settingId; - - if (mEngine->mode() == ImageMode) { - settingId = CxeSettingIds::STILL_SHOWCAPTURED; - } else { - settingId = CxeSettingIds::VIDEO_SHOWCAPTURED; - } - - if (!CxuiServiceProvider::isCameraEmbedded()) { - CxeError::Id err = mEngine->settings().get(settingId, postCaptureTimeout); - - if (postCaptureTimeout > 0 && err == CxeError::None) { - mPostcaptureTimer.start(postCaptureTimeout); - } else { - // do nothing - } - } - - // start the hide control timer. - mHideControlsTimeout.start(CXUI_HIDE_CONTROLS_TIMEOUT); - - //! @todo Temporarily disabling release timer because of - // graphics memory problems related to releasing and reserving again. - // mReleaseCameraTimer.start(CXUI_RELEASE_CAMERA_TIMEOUT); - // mStopViewfinderTimer.start(CXUI_STOP_VIEWFINDER_TIMEOUT); - - // we make sure that timers are started only once in a given postcaptureview session + if(!mTimersStarted) { + startPostcaptureTimer(); + startReleaseTimers(); mTimersStarted = true; } - // show controls when we get back focus - showControls(); + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + Start the timer to return to pre-capture view +*/ +void CxuiPostcaptureView::startPostcaptureTimer() +{ + CX_DEBUG_ENTER_FUNCTION(); + + int postCaptureTimeout = 0; + QString settingId; + + if (mEngine->mode() == ImageMode) { + settingId = CxeSettingIds::STILL_SHOWCAPTURED; + } else { + settingId = CxeSettingIds::VIDEO_SHOWCAPTURED; + } + + if (!CxuiServiceProvider::isCameraEmbedded()) { + CxeError::Id err = mEngine->settings().get(settingId, postCaptureTimeout); + + if (postCaptureTimeout > 0 && err == CxeError::None) { + mPostcaptureTimer.start(postCaptureTimeout); + } else { + // do nothing + } + } + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + Start the timers to stop viewfinder and release the camera +*/ +void CxuiPostcaptureView::startReleaseTimers() +{ + CX_DEBUG_ENTER_FUNCTION(); + + // Todo Note: Temporarily disabling release timer because of + // graphics memory problems related to releasing and reserving again. + // mReleaseCameraTimer.start(CXUI_RELEASE_CAMERA_TIMEOUT); + // mStopViewfinderTimer.start(CXUI_STOP_VIEWFINDER_TIMEOUT); CX_DEBUG_EXIT_FUNCTION(); } diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiprecaptureview.cpp Thu Jul 15 01:46:05 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" @@ -61,12 +61,6 @@ #include "cxuiserviceprovider.h" #include "cxuizoomslider.h" - -// CONSTANTS -const int CXUI_HIDE_CONTROLS_TIMEOUT = 6000; // 6 seconds -const QString PhotosAppExe = "photos.exe"; -const QString VideosAppExe = "videoplayer.exe"; - using namespace CxUiLayout; using namespace CxUiSettings; using namespace CxUiInternal; @@ -79,24 +73,14 @@ // --------------------------------------------------------------------------- // CxuiPrecaptureView::CxuiPrecaptureView(QGraphicsItem *parent) : - HbView(parent), - mEngine(0), + CxuiView(parent), mViewfinder(0), - mMainWindow(0), - mDocumentLoader(0), mDisplayHandler(0), - mControlsVisible(false), - mHideControlsTimeout(this), - mSlider(0), - mToolBar(0), mSettingsGrid(0), - mZoomVisible(false), mWidgetsLoaded(false), mSettingsDialog(NULL), mSettingsDialogList(NULL), - mKeyHandler(NULL), mQualityIcon(NULL), - mIndicators(NULL), mSettingsDialogHeading(NULL), mSliderSettingsDialog(NULL), mSliderSettingsDialogHeading(NULL), @@ -118,7 +102,14 @@ CX_DEBUG_EXIT_FUNCTION(); } - +/** + * CxuiPrecaptureView::construct + * Construct-method handles initialisation tasks for this class. + * @param mainwindow + * @param engine + * @param documentLoader + * @param keyHandler + */ void CxuiPrecaptureView::construct(HbMainWindow *mainWindow, CxeEngine *engine, CxuiDocumentLoader *documentLoader, CxuiCaptureKeyHandler * keyHandler) @@ -126,14 +117,7 @@ CX_DEBUG_ENTER_FUNCTION(); OstTrace0( camerax_performance, CXUIPRECAPTUREVIEW_CONSTRUCT, "msg: e_CX_PRECAPVIEW_CONST 1" ); - CX_ASSERT_ALWAYS(mainWindow); - CX_ASSERT_ALWAYS(engine); - CX_ASSERT_ALWAYS(documentLoader); - - mMainWindow = mainWindow; - mEngine = engine; - mDocumentLoader = documentLoader; - mKeyHandler = keyHandler; + CxuiView::construct(mainWindow, engine, documentLoader, keyHandler); mSettingsInfo = new CxuiSettingsInfo(engine); CX_DEBUG_ASSERT(mSettingsInfo); @@ -240,93 +224,6 @@ } // --------------------------------------------------------------------------- -// CxuiPrecaptureView::hideControls -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::hideControls() -{ - CX_DEBUG_ENTER_FUNCTION(); - - hideItems(Hb::AllItems); - hideZoom(); - mControlsVisible = false; - if (mHideControlsTimeout.isActive()) { - mHideControlsTimeout.stop(); - } - hideToolbar(); - - // show indicators when controls are hidden - showIndicators(); - - // give the keyboard focus back to the view - // for the view to receive key events - setFocus(); - - CX_DEBUG_EXIT_FUNCTION(); -} - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::hideToolbar -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::hideToolbar() -{ - CX_DEBUG_ENTER_FUNCTION(); - if (mToolBar) { - mToolBar->hide(); - } - CX_DEBUG_EXIT_FUNCTION(); -} - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::hideZoom -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::hideZoom() -{ - if (mSlider) { - mSlider->hide(); - } - mZoomVisible = false; -} - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::showZoom -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::showZoom() -{ - CX_DEBUG_ENTER_FUNCTION(); - if (mSlider) { - - // if maxVal has not been set yet, ask for new parameters from engine - if (mSlider->maximum() <= 0) { - - // get the zoom range - int min = mEngine->zoomControl().min(); - int max = mEngine->zoomControl().max(); - - // only change values if they are acceptable and have changed - if ((max - min > 0) && ((mSlider->maximum() != max) || (mSlider->minimum() != min))) { - mSlider->setRange(min, max); - } - } - - // show zoom only if the slider has acceptable value - if (mSlider->maximum() > 0) { - mSlider->show(); - } - } - - mZoomVisible = true; - CX_DEBUG_EXIT_FUNCTION(); -} - -// --------------------------------------------------------------------------- // CxuiPrecaptureView::toggleZoom // // --------------------------------------------------------------------------- @@ -340,77 +237,6 @@ } } -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::hideIndicators -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::hideIndicators() -{ - if (mIndicators) { - mIndicators->hide(); - } -} - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::showIndicators -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::showIndicators() -{ - if (mIndicators) { - mIndicators->show(); - } -} - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::showControls -// -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::showControls() -{ - if (mEngine) { - bool videoCases = (mEngine->videoCaptureControl().state() == CxeVideoCaptureControl::Recording || - mEngine->videoCaptureControl().state() == CxeVideoCaptureControl::Paused); - - if (mEngine->isEngineReady() || videoCases) { - // show toolbar - showToolbar(); - // show zoom - showZoom(); - // show titlepane - showItems(Hb::AllItems); - - // hide indicators when controls are shown - hideIndicators(); - - mHideControlsTimeout.start(); - mControlsVisible = true; - } - } -} - -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::showToolbar -// shows toolbar -// --------------------------------------------------------------------------- -// -void CxuiPrecaptureView::showToolbar() -{ - - CX_DEBUG_ENTER_FUNCTION(); - - // toolbar pointer is missing if widgets for the view have not been loaded - // from the DocML - if (mToolBar) { - mToolBar->show(); - } - - CX_DEBUG_EXIT_FUNCTION(); -} - /* * Event filter which filters tool bar mouse events and @@ -453,11 +279,7 @@ loadWidgets(); } - if (mControlsVisible) { - hideControls(); - } else { - showControls(); - } + CxuiView::toggleControls(); } @@ -582,16 +404,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -// --------------------------------------------------------------------------- -// CxuiPrecaptureView::releaseCamera -// --------------------------------------------------------------------------- -void CxuiPrecaptureView::releaseCamera() -{ - CX_DEBUG_ENTER_FUNCTION(); - mEngine->cameraDeviceControl().release(); - CX_DEBUG_EXIT_FUNCTION(); -} - // --------------------------------------------------------------------------- // CxuiPrecaptureView::initCamera @@ -689,6 +501,16 @@ if (mSliderSettingsDialog) { mSliderSettingsDialog->setStarterAction(NULL); } + + // Dialog will be deleted automatically when closed + // The pointers may become invalid at any time + mSettingsDialog = NULL; + mSettingsDialogList = NULL; + mSettingsDialogHeading = NULL; + + mSliderSettingsDialog = NULL; + mSliderSettingsDialogHeading = NULL; + mSettingsSlider = NULL; } @@ -796,7 +618,9 @@ // Adjust position and show the dialog. mSettingsDialog->setPreferredPos(getDialogPosition(), HbPopup::BottomRightCorner); + mSettingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); mSettingsDialog->show(); + } } else { launchNotSupportedNotification(); @@ -907,7 +731,9 @@ // Adjust position and show the dialog. mSliderSettingsDialog->setFrameType(HbPopup::Weak); mSliderSettingsDialog->setPreferredPos(getDialogPosition(), HbPopup::BottomRightCorner); + mSliderSettingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); mSliderSettingsDialog->show(); + } } else { launchNotSupportedNotification(); @@ -916,32 +742,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -void CxuiPrecaptureView::launchPhotosApp() -{ - QProcess::startDetached(PhotosAppExe); -} - -/*! - * Launching Videos application as a separate process - */ -void CxuiPrecaptureView::launchVideosApp() -{ - //Releasing cameda device in order to free - //graphical memory - releaseCamera(); - QProcess::startDetached(VideosAppExe); -} - -/*! -* Show "not supported" notification. -*/ -void CxuiPrecaptureView::launchNotSupportedNotification() -{ - CX_DEBUG_ENTER_FUNCTION(); - HbNotificationDialog::launchDialog("Notification", "Not supported yet"); - CX_DEBUG_EXIT_FUNCTION(); -} - /*! * Show "Disk full" notification. */ @@ -1015,50 +815,6 @@ } /*! -* Adding zoom buttons to the slider -* \param slider Pointer to the slider object, where the buttons will be added -*/ -void CxuiPrecaptureView::addIncreaseDecreaseButtons(CxuiZoomSlider *slider) -{ - // get current slider elements - QList elements = slider->sliderElements(); - - // add increase and decrease elements to the slider - elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement; - slider->setSliderElements(elements); - - // set icons for the increase and decrease element - slider->setElementIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus")); - slider->setElementIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus")); -} - - -/*! -* Function can be used to create a graphics item and setting it as a background -* item for HbWidget. graphicName refers to system wide graphic name. Given graphic -* can consist of one, three or nine pieces. Nine piece graphics are used by default. -* See HbFrameDrawer documentation for graphic naming. -*/ -void CxuiPrecaptureView::createWidgetBackgroundGraphic(HbWidget *widget, - const QString &graphicName, - HbFrameDrawer::FrameType frameType) -{ - if (widget) { - HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType); - - if (drawer) { - HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget); - if (backgroundItem) { - // set item to fill the whole widget - backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size())); - backgroundItem->setZValue(0); - widget->setBackgroundItem(backgroundItem); - } - } - } -} - -/*! * Returns dialogs bottom right corner */ QPointF CxuiPrecaptureView::getDialogPosition() diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp --- a/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiscenemodeview.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -49,13 +49,9 @@ * Constructor */ CxuiSceneModeView::CxuiSceneModeView(QGraphicsItem *parent) : - HbView(parent), - mMainWindow(NULL), + CxuiView(parent), mSettingsInfo(NULL), - mEngine(NULL), - mDocumentLoader(NULL), - mCaptureKeyHandler(NULL), - mScenesBackground(NULL) + mScenesBackground(NULL) { CX_DEBUG_IN_FUNCTION(); } @@ -83,17 +79,15 @@ CxuiCaptureKeyHandler *keyHandler) { CX_DEBUG_ENTER_FUNCTION(); + CxuiView::construct(mainwindow, engine, documentLoader, keyHandler); - mMainWindow = mainwindow; - mDocumentLoader = documentLoader; - mCaptureKeyHandler = keyHandler; - mEngine = engine; mSettingsInfo = new CxuiSettingsInfo(mEngine); setContentFullScreen(true); loadDefaultWidgets(); - mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT); - connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCameraHw()), Qt::UniqueConnection); + mCameraReleaseTimer.setInterval(CXUI_SCENES_CAMERA_TIMEOUT); + mCameraReleaseTimer.setSingleShot(true); + connect(&mCameraReleaseTimer, SIGNAL(timeout()), this, SLOT(releaseCamera()), Qt::UniqueConnection); CX_DEBUG_EXIT_FUNCTION(); } @@ -130,6 +124,10 @@ createWidgetBackgroundGraphic(mScenesContainer, TRANSPARENT_BACKGROUND_GRAPHIC); + //!@todo: View flags property is missing from HbView, + // so can't properly hide title bar / status bar there. + hideControls(); + connectSignals(); CX_DEBUG_EXIT_FUNCTION(); @@ -145,31 +143,6 @@ } /*! -* Function can be used to create a graphics item and setting it as a background -* item for HbWidget. graphicName refers to system wide graphic name. Given graphic -* can consist of one, three or nine pieces. Nine piece graphics are used by default. -* See HbFrameDrawer documentation for graphic naming. -*/ -void CxuiSceneModeView::createWidgetBackgroundGraphic(HbWidget *widget, - const QString &graphicName, - HbFrameDrawer::FrameType frameType) -{ - if (widget) { - HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType); - - if (drawer) { - HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget); - if (backgroundItem) { - // set item to fill the whole widget - backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size())); - backgroundItem->setZValue(0); - widget->setBackgroundItem(backgroundItem); - } - } - } -} - -/*! * This public method assumes that the view is already properly constructed */ void CxuiSceneModeView::loadBackgroundImages() @@ -302,6 +275,15 @@ } /*! +* Allow showing UI controls? +* Title bar and other UI chrome is never shown in scene mode view. +*/ +bool CxuiSceneModeView::allowShowControls() const +{ + return false; +} + +/*! * Slot to handle capture key full press. */ void CxuiSceneModeView::handleCaptureKeyPressed() @@ -335,16 +317,5 @@ CX_DEBUG_EXIT_FUNCTION(); } -/*! -* Slot to handle camera hw release timeout -*/ -void CxuiSceneModeView::releaseCameraHw() -{ - CX_DEBUG_ENTER_FUNCTION(); - mCameraReleaseTimer.stop(); - mEngine->cameraDeviceControl().release(); - CX_DEBUG_EXIT_FUNCTION(); -} - // end of file diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuiselftimer.cpp --- a/camerauis/cameraxui/cxui/src/cxuiselftimer.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiselftimer.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -128,6 +128,14 @@ return mTimer.isActive(); } +/*! + Returns current timeout value of selftimer. + */ +int CxuiSelfTimer::getTimeout() const +{ + return mDelay; +} + /*! Slot for canceling the selftimer. Disables selftimer, sets back the postcapturetimeout if it has been changed by selftimer and emits signal to notify interested diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -67,10 +67,35 @@ setSettingId(data->mSettingId); setListBoxType(data->mListboxType); + + initOriginalSelectedItem(); + // ensure that currently selected item is visible + scrollTo(currentIndex()); } } +/*! + * Sets the original selection of list by value. Can be used to override value read from + * CxeSettings or used to remember previously selected value in case of setting that is + * not read from CxeSettings (e.g. selftimer) + */ +void CxuiSettingRadioButtonList::setOriginalSelectedItemByValue(const QVariant &value) +{ + CX_DEBUG_ENTER_FUNCTION(); + + int index = mSettingValues.indexOf(QVariant(value)); + if (index >= 0) { + mOriginalIndex = index; + setSelected(index); + // ensure that currently selected item is visible + scrollTo(currentIndex()); + } else { + CX_DEBUG(("Value %s not found", value.toString().toAscii().data())); + } + CX_DEBUG_EXIT_FUNCTION(); +} + void CxuiSettingRadioButtonList::setItems(const QStringList &values) { mListModel->setItems(values); @@ -102,19 +127,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -void CxuiSettingRadioButtonList::showEvent(QShowEvent *event) -{ - CX_DEBUG_ENTER_FUNCTION(); - - initOriginalSelectedItem(); - // ensure that currently selected item is visible - scrollTo(currentIndex()); - QGraphicsWidget::showEvent(event); - - CX_DEBUG_EXIT_FUNCTION(); -} - - /*! * Get the value currently active in settings. */ diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlistmodel.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlistmodel.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlistmodel.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -19,6 +19,7 @@ #include "cxutils.h" // debug #include "cxuienums.h" +#include "cxuisettingsinfo.h" #include "cxuisettingradiobuttonlist.h" #include "cxuisettingradiobuttonlistmodel.h" @@ -79,10 +80,12 @@ CX_DEBUG(("CxuiSettingRadioButtonListModel: Listbox type is TwoLineListBox")); // two line list box // get the two strings - QStringList lines = setting.split(","); - QString first = lines[0]; - QString second = lines[1]; - list << first << second ; + QStringList lines = setting.split(CxUiSettings::NEW_LINE_CHAR); + // Split returns always atleast a single element list. + list << lines[0]; + if (lines.size() > 1) { + list << lines[1]; + } } else { CX_DEBUG(("CxuiSettingRadioButtonListModel: Listbox type is SingleLine")); list << setting; diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingsinfo.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include +#include #include "cxutils.h" #include "cxuienums.h" @@ -206,30 +207,31 @@ int index = 0; // get the localized possible strings for each image quality setting - QString vga = hbTrId("txt_cam_dblist_vga"); - QString normal = hbTrId("txt_cam_dblist_ln_mpix"); - QString imagesLeft = hbTrId("txt_cam_dblist_hd_720p_val_ln_images_left"); - QString widescreen = hbTrId("txt_cam_dblist_ln_mpix_widescreen"); + QString vga = "txt_cam_dblist_vga"; + QString normal = "txt_cam_dblist_l1_mpix"; + QString imagesLeft = "txt_cam_dblist_hd_720p_val_ln_images_left"; + QString widescreen = "txt_cam_dblist_l1_mpix_widescreen"; foreach(CxeImageDetails quality, list) { // mapping the right value for each quality QString settingString; QString qualityIcon = ""; + qreal pxCount = quality.mMpxCount.toDouble(); if (quality.mWidth == KResVGA.width() && quality.mHeight == KResVGA.height()) { - settingString.append(vga); + settingString.append(hbTrId(vga.toAscii().constData())); settingString.append(" "); } if (quality.mAspectRatio == Cxe::AspectRatio16to9) { - settingString.append(widescreen.arg(quality.mMpxCount)); + settingString.append(hbTrId(widescreen.toAscii().constData()).arg(pxCount,0,'g',3)); } else { - settingString.append(normal.arg(quality.mMpxCount)); + settingString.append(hbTrId(normal.toAscii().constData()).arg(pxCount,0,'g',3)); } - settingString.append(","); - settingString.append(imagesLeft.arg(quality.mPossibleImages)); + settingString.append(NEW_LINE_CHAR); + settingString.append(HbParameterLengthLimiter(imagesLeft.toAscii().constData(), quality.mPossibleImages)); CX_DEBUG(( "Image quality setting string: %s", settingString.toAscii().constData())); if (quality.mMpxCount == "12") { @@ -304,7 +306,7 @@ qualityIcon = "qtg_mono_vga_wide"; } - settingString.append(","); + settingString.append(NEW_LINE_CHAR); time.sprintf("%02d:%02d", quality.mRemainingTime / 60, quality.mRemainingTime % 60); settingString.append(timeleft.arg(time)); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuisettingxmlreader.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingxmlreader.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingxmlreader.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -18,6 +18,7 @@ #include #include #include +#include #include "cxutils.h" @@ -34,7 +35,8 @@ static const char *TAG_SETTING_LIST = "setting_list"; static const char *TAG_SETTING_SLIDER = "setting_slider"; static const char *TAG_ITEM = "item"; - static const char *TAG_ITEM_VARIANT = "lnItem"; + static const char *TAG_ITEM_VARIANT_LN = "lnItem"; + static const char *TAG_ITEM_VARIANT_L1 = "l1Item"; static const char *TAG_SETUP = "setup"; static const char *ATTRIBUTE_ID = "id"; @@ -47,6 +49,7 @@ static const char *ATTRIBUTE_VALUE = "value"; static const char *ATTRIBUTE_LOCALIZATION_ID = "string"; static const char *ATTRIBUTE_LOCALIZATION_ID_LN_VALUE = "lnValue"; + static const char *ATTRIBUTE_LOCALIZATION_ID_L1_VALUE = "l1Value"; static const char *ATTRIBUTE_SLIDER_MIN = "min"; static const char *ATTRIBUTE_SLIDER_MAX = "max"; @@ -310,18 +313,26 @@ value.setValue(string); } - // get the string text id from the xml, and format based on type. string = e.attribute(ATTRIBUTE_LOCALIZATION_ID); if (e.tagName() == TAG_ITEM) { - // get the localizable string from the hbtrid + // string without parameters: get localised string string = hbTrId(string.toAscii().constData()); - } else if (e.tagName() == TAG_ITEM_VARIANT) { + CX_DEBUG(("tag name <%s>", e.tagName().toAscii().constData())); + } else if (e.tagName() == TAG_ITEM_VARIANT_L1) { + // string with numeric parameter: get localised string and add numeric parameter + QString l1Value = e.attribute(ATTRIBUTE_LOCALIZATION_ID_L1_VALUE); + string = hbTrId(string.toAscii().constData()).arg(l1Value.toInt()); + CX_DEBUG(("tag name <%s>", e.tagName().toAscii().constData())); + CX_DEBUG(("attribute [%s] value[%s]", ATTRIBUTE_LOCALIZATION_ID_L1_VALUE, + string.toAscii().constData())); + } else if (e.tagName() == TAG_ITEM_VARIANT_LN) { QString lnValue = e.attribute(ATTRIBUTE_LOCALIZATION_ID_LN_VALUE); - // format the setting string - string = hbTrId(string.toAscii().constData(), lnValue.toInt()); + // string with count parameter: get localised string and add plural form numeric parameter + string = HbParameterLengthLimiter(string.toAscii().constData(), lnValue.toInt()); + CX_DEBUG(("tag name <%s>", e.tagName().toAscii().constData())); + CX_DEBUG(("attribute [%s] value[%s]", ATTRIBUTE_LOCALIZATION_ID_LN_VALUE, string.toAscii().constData())); } - CX_DEBUG(("attribute [%s] value[%s]", ATTRIBUTE_LOCALIZATION_ID, string.toAscii().constData())); if (!string.isNull()) { CxUiSettings::SettingItem setting; @@ -382,14 +393,14 @@ stepString = e.attribute(ATTRIBUTE_SLIDER_MAJOR_STEP); p->mMajorStep = stepString.toReal(); - // get the ln value from xml to generate strings for slider - QString lnValue = e.attribute(ATTRIBUTE_LOCALIZATION_ID_LN_VALUE); + // get the l1 value from xml to generate strings for slider + QString l1Value = e.attribute(ATTRIBUTE_LOCALIZATION_ID_L1_VALUE); // Don't create labels for slider if no strings are defined in settinsg xml // Create labels only for major ticks if (!minString.isEmpty() && !maxString.isEmpty()) { qreal step = p->mMajorStep; - qreal value = lnValue.toDouble(); + qreal value = l1Value.toDouble(); // generating all negative valued strings for slider setting while (value > 0) { // format the setting string @@ -401,7 +412,7 @@ // generating all non-negative valued strings for slider setting step = p->mMajorStep; value = 0; - while(value <= lnValue.toInt()) { + while(value <= l1Value.toInt()) { // format the setting string QString str = hbTrId(maxString.toAscii().constData()).arg(value,0,'f',1); p->mSettingStrings.append(str); @@ -409,8 +420,8 @@ } } - int min = -lnValue.toInt(); - int max = lnValue.toInt(); + int min = -l1Value.toInt(); + int max = l1Value.toInt(); p->mRange = qMakePair(min, max); } diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuistillprecaptureview.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -173,7 +173,7 @@ widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_ZOOM_SLIDER); mSlider = qobject_cast(widget); CX_DEBUG_ASSERT(mSlider); - addIncreaseDecreaseButtons(mSlider); + mSlider->addZoomButtons(); createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC); if (mSelfTimer) { @@ -196,8 +196,8 @@ connect(startButton, SIGNAL(released()), this, SLOT(hideControls())); widget = mDocumentLoader->findWidget(STILL_PRE_CAPTURE_TOOLBAR); - mToolBar = qobject_cast(widget); - CX_DEBUG_ASSERT(mToolBar); + mToolbar = qobject_cast(widget); + CX_DEBUG_ASSERT(mToolbar); object = mDocumentLoader->findObject(STILL_PRE_CAPTURE_FLASH_ACTION); mFlashSetting = qobject_cast(object); @@ -299,18 +299,10 @@ mSettingsGrid->addAction(HbIcon("qtg_mono_face_tracking"), hbTrId("txt_cam_button_face_tracking"), this, SLOT(launchNotSupportedNotification())); action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); - connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); + connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); } } -void CxuiStillPrecaptureView::launchSceneModesPopup() -{ - CX_DEBUG_ENTER_FUNCTION(); - hideControls(); - emit showScenesView(); - CX_DEBUG_EXIT_FUNCTION(); -} - void CxuiStillPrecaptureView::handleSnapshot(CxeError::Id error) { @@ -462,24 +454,6 @@ } -void CxuiStillPrecaptureView::updateOrientation(Qt::Orientation orientation) -{ - CX_DEBUG_ENTER_FUNCTION(); - - hideControls(); - mMainWindow->setOrientation(orientation); - - if (orientation == Qt::Horizontal) { - CX_DEBUG(("New screen orientation is horizontal")); - mToolBar->setOrientation(Qt::Vertical); - } else { - CX_DEBUG(("New screen orientation is vertical")); - mToolBar->setOrientation(Qt::Horizontal); - } - - CX_DEBUG_EXIT_FUNCTION(); -} - /*! * Handle capture key full press. */ @@ -593,21 +567,30 @@ // in post-capture view, we need to start auto-focusing when entering // the still precapture view. if (event->type() == QEvent::Show && - mKeyHandler && mKeyHandler->isAutofocusKeyPressed()) { + mCaptureKeyHandler && mCaptureKeyHandler->isAutofocusKeyPressed()) { CX_DEBUG(("Still pre-capture coming visible and auto-focus key pressed -> starting AF")); handleAutofocusKeyPressed(); } } -void CxuiStillPrecaptureView::showToolbar() +/*! +* Allow showing UI controls? +*/ +bool CxuiStillPrecaptureView::allowShowControls() const { - if (mEngine && mEngine->isEngineReady()) { - CxuiPrecaptureView::showToolbar(); - } + // show controls when selftimer counter is not active + // and when autofocus key is not being pressed + bool engineOk(mEngine && mEngine->isEngineReady()); + bool selfTimerOk(!mSelfTimer || !mSelfTimer->isOngoing()); + bool keysOk(!mCaptureKeyHandler || !mCaptureKeyHandler->isAutofocusKeyPressed()); + + return engineOk && selfTimerOk && keysOk; } - +/*! +* Handle change in viewfinder state. +*/ void CxuiStillPrecaptureView::handleViewfinderStateChanged( CxeViewfinderControl::State newState, CxeError::Id /*error*/) { @@ -622,7 +605,7 @@ } if(mMainWindow->currentView() == this && - mKeyHandler->isAutofocusKeyPressed()) { + mCaptureKeyHandler->isAutofocusKeyPressed()) { // Viewfinder just started and the user is pressing the auto-focus key. // Start focusing. @@ -654,17 +637,6 @@ mCapturePending = false; } -void CxuiStillPrecaptureView::showControls() -{ - // show controls when selftimer counter is not active - // and when autofocus key is not being pressed - if ( !(mSelfTimer && mSelfTimer->isOngoing()) && - (!mKeyHandler || !mKeyHandler->isAutofocusKeyPressed()) ) { - CxuiPrecaptureView::showControls(); - } - -} - /*! * Slot to handle application being sent to background. */ @@ -684,13 +656,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -void CxuiStillPrecaptureView::handleFocusGained() -{ - CX_DEBUG_ENTER_FUNCTION(); - CxuiPrecaptureView::handleFocusGained(); - CX_DEBUG_EXIT_FUNCTION(); -} - /* Slot for handling scene mode change \param scene QVariantMap containing settings related to the new scene mode @@ -792,6 +757,10 @@ launchSettingsDialog(action); // special case to get value changed event to the selftimer class if (settingsKey == CxeSettingIds::SELF_TIMER) { + // if selftimer is active remember the previously selected value + if (mSelfTimer->isEnabled()) { + mSettingsDialogList->setOriginalSelectedItemByValue(mSelfTimer->getTimeout()); + } connect(mSettingsDialogList, SIGNAL(valueSelected(int)), mSelfTimer, SLOT(changeTimeOut(int))); } diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp --- a/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -75,9 +75,9 @@ mRemainingTimeText(NULL), mRecordingIcon(NULL), mGoToStillAction(NULL), - mToolBarIdle(NULL), - mToolBarRec(NULL), - mToolBarPaused(NULL), + mToolbarIdle(NULL), + mToolbarRec(NULL), + mToolbarPaused(NULL), mVideoScenePopup(NULL), mVideoCaptureControl(NULL), mMenu(NULL), @@ -101,7 +101,7 @@ CX_DEBUG_ENTER_FUNCTION(); CxuiPrecaptureView::construct(mainwindow, engine, documentLoader, keyHandler); - mKeyHandler = keyHandler; + mCaptureKeyHandler = keyHandler; mVideoCaptureControl = &(engine->videoCaptureControl()); @@ -187,21 +187,21 @@ CX_DEBUG_ASSERT(mSlider); //Let's add a plus and minus buttons to the slider - addIncreaseDecreaseButtons(mSlider); + mSlider->addZoomButtons(); createWidgetBackgroundGraphic(mSlider, TRANSPARENT_BACKGROUND_GRAPHIC); widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR); - mToolBarIdle = qobject_cast (widget); + mToolbarIdle = qobject_cast (widget); widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_REC); - mToolBarRec = qobject_cast (widget); + mToolbarRec = qobject_cast (widget); widget = mDocumentLoader->findWidget(VIDEO_PRE_CAPTURE_TOOLBAR_PAUSED); - mToolBarPaused = qobject_cast (widget); + mToolbarPaused = qobject_cast (widget); - mToolBar = mToolBarIdle; + mToolbar = mToolbarIdle; - CX_DEBUG_ASSERT(mToolBarIdle); - CX_DEBUG_ASSERT(mToolBarRec); - CX_DEBUG_ASSERT(mToolBarPaused); + CX_DEBUG_ASSERT(mToolbarIdle); + CX_DEBUG_ASSERT(mToolbarRec); + CX_DEBUG_ASSERT(mToolbarPaused); hideControls(); @@ -300,7 +300,7 @@ action->setProperty(PROPERTY_KEY_SETTING_ID, CxeSettingIds::WHITE_BALANCE); action->setProperty(PROPERTY_KEY_SETTING_GRID, PROPERTY_KEY_TRUE); - connect(mKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); + connect(mCaptureKeyHandler, SIGNAL(autofocusKeyPressed()), mSettingsGrid, SLOT(close())); } } @@ -356,6 +356,23 @@ CX_DEBUG_EXIT_FUNCTION(); } + +/*! +* Allow showing UI controls? +*/ +bool CxuiVideoPrecaptureView::allowShowControls() const +{ + bool show(false); + if (mEngine) { + CxeVideoCaptureControl::State state(mEngine->videoCaptureControl().state()); + + show = (mEngine->isEngineReady() + || state == CxeVideoCaptureControl::Recording + || state == CxeVideoCaptureControl::Paused); + } + return show; +} + // CxuiPrecaptureView::showToolbar() // Shows toolbar. Calls the base class implementation if not recording // since toolbar is not shown during recording @@ -363,19 +380,19 @@ { CxeVideoCaptureControl::State state = mVideoCaptureControl->state(); if (state == CxeVideoCaptureControl::Recording) { - if (mToolBar != mToolBarRec) { - mToolBar->hide(); - mToolBar = mToolBarRec; + if (mToolbar != mToolbarRec) { + mToolbar->hide(); + mToolbar = mToolbarRec; } } else if (state ==CxeVideoCaptureControl::Ready) { - if (mToolBar != mToolBarIdle) { - mToolBar->hide(); - mToolBar = mToolBarIdle; + if (mToolbar != mToolbarIdle) { + mToolbar->hide(); + mToolbar = mToolbarIdle; } } else if (state == CxeVideoCaptureControl::Paused) { - if (mToolBar != mToolBarPaused) { - mToolBar->hide(); - mToolBar = mToolBarPaused; + if (mToolbar != mToolbarPaused) { + mToolbar->hide(); + mToolbar = mToolbarPaused; } } @@ -564,14 +581,9 @@ break; case CxeVideoCaptureControl::Paused: mElapsedTimer.stop(); - if (mDocumentLoader){ mDocumentLoader->load(VIDEO_1ST_XML, VIDEO_PRE_CAPTURE_PAUSED); } - - if (mRecordingAnimation && mRecordingIcon) { - mRecordingAnimation->stop(); - } showControls(); enableFeedback(); mPauseTimer.start(); @@ -603,6 +615,9 @@ this, SLOT(prepareNewVideo(CxeError::Id))); } break; + case CxeVideoCaptureControl::PlayingStartSound: + // don't change anything + break; default: // in any other state, just hide the controls setRecordingItemsVisibility(false); @@ -612,24 +627,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -void CxuiVideoPrecaptureView::updateOrientation(Qt::Orientation orientation) -{ - CX_DEBUG_ENTER_FUNCTION(); - - hideControls(); - mMainWindow->setOrientation(orientation); - - if (mToolBar) { - if (orientation == Qt::Horizontal) { - mToolBar->setOrientation(Qt::Vertical); - } else { - mToolBar->setOrientation(Qt::Horizontal); - } - } - - CX_DEBUG_EXIT_FUNCTION(); -} - void CxuiVideoPrecaptureView::handleCaptureKeyPressed() { CX_DEBUG_ENTER_FUNCTION(); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuiview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/camerauis/cameraxui/cxui/src/cxuiview.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -0,0 +1,360 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include "cxuiview.h" +#include "cxutils.h" +#include "cxeengine.h" +#include "cxuidocumentloader.h" +#include "cxuicapturekeyhandler.h" +#include "cxecameradevicecontrol.h" +#include "cxevideocapturecontrol.h" +#include "cxuizoomslider.h" +#include "cxezoomcontrol.h" + +// CONSTANTS +const QString PhotosAppExe = "photos.exe"; +const QString VideosAppExe = "videoplayer.exe"; + +/*! +* Constructor +*/ +CxuiView::CxuiView(QGraphicsItem *parent) : + HbView(parent), + mMainWindow(NULL), + mEngine(NULL), + mDocumentLoader(NULL), + mSlider(NULL), + mToolbar(NULL), + mIndicators(NULL), + mHideControlsTimeout(this) +{ + CX_DEBUG_IN_FUNCTION(); +} + +/*! +* Destructor +*/ +CxuiView::~CxuiView() +{ + CX_DEBUG_IN_FUNCTION(); +} + +/*! +* CxuiView::construct +*/ +void CxuiView::construct(HbMainWindow *mainWindow, CxeEngine *engine, + CxuiDocumentLoader *documentLoader, + CxuiCaptureKeyHandler * keyHandler) +{ + CX_DEBUG_ENTER_FUNCTION(); + + //Minimum requirements to construct the view + CX_ASSERT_ALWAYS(mainWindow); + CX_ASSERT_ALWAYS(engine); + CX_ASSERT_ALWAYS(documentLoader); + + mMainWindow = mainWindow; + mDocumentLoader = documentLoader; + mCaptureKeyHandler = keyHandler; + mEngine = engine; + + // 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); +} + +/*! +* CxuiView::updateOrientation +*/ +void CxuiView::updateOrientation(Qt::Orientation orientation) +{ + CX_DEBUG_ENTER_FUNCTION(); + + hideControls(); + mMainWindow->setOrientation(orientation); + + if (mToolbar) { + if (orientation == Qt::Horizontal) { + mToolbar->setOrientation(Qt::Vertical); + } else { + mToolbar->setOrientation(Qt::Horizontal); + } + } + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! +* Allow showing UI controls? +* Default behaviour is that controls can be shown at any time. +*/ +bool CxuiView::allowShowControls() const +{ + return true; +} + +/*! +* Toggle visibility of UI controls. +*/ +void CxuiView::toggleControls() +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (mControlsVisible) { + hideControls(); + } else { + showControls(); + } + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! +* CxuiView::launchNotSupportedNotification +* Show "not supported" notification. +*/ +void CxuiView::launchNotSupportedNotification() +{ + CX_DEBUG_ENTER_FUNCTION(); + HbNotificationDialog::launchDialog("Notification", "Not supported yet"); + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * CxuiView::launchScenesView + */ +void CxuiView::launchScenesView() +{ + CX_DEBUG_ENTER_FUNCTION(); + hideControls(); + emit showScenesView(); + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * CxuiView::launchPhotosApp + */ +void CxuiView::launchPhotosApp() +{ + QProcess::startDetached(PhotosAppExe); +} + +/*! + * CxuiView::launchVideosApp + * Launching Videos application as a separate process + */ +void CxuiView::launchVideosApp() +{ + //Releasing cameda device in order to free + //graphical memory + releaseCamera(); + QProcess::startDetached(VideosAppExe); +} + +/*! + * Releasing camera hw + */ +void CxuiView::releaseCamera() +{ + CX_DEBUG_ENTER_FUNCTION(); + mEngine->cameraDeviceControl().release(); + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * CxuiView::hideControls + */ +void CxuiView::hideControls() +{ + CX_DEBUG_ENTER_FUNCTION(); + + if (mHideControlsTimeout.isActive()) { + mHideControlsTimeout.stop(); + } + + // Hide title bar and status bar. + //!@todo: View flags property is missing from HbView, so can't set these in DocML. + HbView::HbViewFlags flags(HbView::ViewTitleBarTransparent + | HbView::ViewTitleBarFloating + | HbView::ViewTitleBarHidden + | HbView::ViewStatusBarTransparent + | HbView::ViewStatusBarFloating + | HbView::ViewStatusBarHidden); + setViewFlags(flags); + //!@todo: Once the flags are defined in DocML, we can just use these convenience functions + // to hide the title bar and status bar here. + //setTitleBarVisible(false); + //setStatusBarVisible(false); + + hideZoom(); + + hideToolbar(); + + // show indicators when controls are hidden + showIndicators(); + + mControlsVisible = false; + + // give the keyboard focus back to the view + // for the view to receive key events + setFocus(); + + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * CxuiView::showControls + */ +void CxuiView::showControls() +{ + if (allowShowControls()) { + // show toolbar + showToolbar(); + + // show zoom + showZoom(); + + // show title bar and status bar + setTitleBarVisible(true); + setStatusBarVisible(true); + + // hide indicators when controls are shown + hideIndicators(); + + mHideControlsTimeout.start(); + mControlsVisible = true; + } +} + +/*! + * CxuiView::hideToolbar + */ +void CxuiView::hideToolbar() +{ + CX_DEBUG_ENTER_FUNCTION(); + if (mToolbar) { + mToolbar->hide(); + } + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * CxuiView::showToolbar + */ +void CxuiView::showToolbar() +{ + CX_DEBUG_ENTER_FUNCTION(); + if (mToolbar) { + mToolbar->show(); + } + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! + * CxuiView::hideIndicators + */ +void CxuiView::hideIndicators() +{ + if (mIndicators) { + mIndicators->hide(); + } +} + +/*! + * CxuiView::showIndicators + */ +void CxuiView::showIndicators() +{ + if (mIndicators) { + mIndicators->show(); + } +} + +/*! + * CxuiView::hideZoom + */ +void CxuiView::hideZoom() +{ + if (mSlider) { + mSlider->hide(); + } + mZoomVisible = false; +} + +/*! + * CxuiView::showZoom + */ +void CxuiView::showZoom() +{ + CX_DEBUG_ENTER_FUNCTION(); + if (mSlider) { + + // if maxVal has not been set yet, ask for new parameters from engine + if (mSlider->maximum() <= 0) { + + // get the zoom range + int min = mEngine->zoomControl().min(); + int max = mEngine->zoomControl().max(); + + // only change values if they are acceptable and have changed + if ((max - min > 0) && ((mSlider->maximum() != max) || (mSlider->minimum() != min))) { + mSlider->setRange(min, max); + } + } + + // show zoom only if the slider has acceptable value + if (mSlider->maximum() > 0) { + mSlider->show(); + } + } + + mZoomVisible = true; + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! +* Function can be used to create a graphics item and setting it as a background +* item for HbWidget. graphicName refers to system wide graphic name. Given graphic +* can consist of one, three or nine pieces. Nine piece graphics are used by default. +* See HbFrameDrawer documentation for graphic naming. +*/ +void CxuiView::createWidgetBackgroundGraphic(HbWidget *widget, + const QString &graphicName, + HbFrameDrawer::FrameType frameType) +{ + if (widget) { + HbFrameDrawer *drawer = new HbFrameDrawer(graphicName, frameType); + + if (drawer) { + HbFrameItem *backgroundItem = new HbFrameItem(drawer, widget); + if (backgroundItem) { + // set item to fill the whole widget + backgroundItem->setGeometry(QRectF(QPointF(0, 0), widget->size())); + backgroundItem->setZValue(0); + widget->setBackgroundItem(backgroundItem); + } + } + } +} + +// End of file diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp --- a/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiviewmanager.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -587,7 +587,7 @@ QObject *currentView = mMainWindow.currentView(); if (currentView == mPostcaptureView) { // connecting view manager focus events to pre-capture views - connect(this, SIGNAL(focusGained()), currentView, SLOT(startTimers()), Qt::UniqueConnection); + connect(this, SIGNAL(focusGained()), currentView, SLOT(handleFocusGained()), Qt::UniqueConnection); connect(this, SIGNAL(focusLost()), currentView, SLOT(handleFocusLost()), Qt::UniqueConnection); connect(currentView, SIGNAL(changeToPrecaptureView()), mStandbyHandler, SLOT(startTimer()), Qt::UniqueConnection); diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/cxuizoomslider.cpp --- a/camerauis/cameraxui/cxui/src/cxuizoomslider.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuizoomslider.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -55,3 +55,22 @@ // underneath this slider event->accept(); } + +/*! +* Adding zoom buttons to the slider +*/ +void CxuiZoomSlider::addZoomButtons() +{ + // get current slider elements + QList elements = sliderElements(); + + // add increase and decrease elements to the slider + elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement; + setSliderElements(elements); + + // set icons for the increase and decrease element + setElementIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus")); + setElementIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus")); +} + +//End of file diff -r 0f0b4c1d7744 -r c5025ea871a1 camerauis/cameraxui/cxui/src/main.cpp --- a/camerauis/cameraxui/cxui/src/main.cpp Thu Jul 15 01:44:30 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/main.cpp Thu Jul 15 01:46:05 2010 +0300 @@ -51,6 +51,11 @@ Q_INIT_RESOURCE(cxui); + // Use software rendering / raster graphics system to save GPU memory. + CX_DEBUG(("CxUI: Take raster graphics system into use..")); + QApplication::setGraphicsSystem("raster"); + CX_DEBUG(("CxUI: ..raster graphics system in use")); + OstTrace0( camerax_performance, DUP1__MAIN, "msg: e_CX_HBAPP_CREATION 1" ); CxuiApplication app(argc, argv); OstTrace0( camerax_performance, DUP2__MAIN, "msg: e_CX_HBAPP_CREATION 0" );