# HG changeset patch # User Pat Downey # Date 1283340554 -3600 # Node ID c6bafb5162d8b697f60f254499e33d051d225959 # Parent 072a5fa0c63b5ebea1beb88ea0909c87661d1e24 Revert incorrect RCL_3 drop: Revision: 201030 Kit: 201035 diff -r 072a5fa0c63b -r c6bafb5162d8 group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 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: Project build file for voicerec. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + + +PRJ_MMPFILES +#include "../voicerec_plat/group/bld.inf" +#include "../voicerecorder/group/bld.inf" + + +// End of File + diff -r 072a5fa0c63b -r c6bafb5162d8 layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,34 @@ + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 072a5fa0c63b -r c6bafb5162d8 tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsrc/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2006 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: Project specification for mmenhs projects. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_TESTEXPORTS + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +#include "../../voicerec_plat/new_file_service_api/tsrc/group/bld.inf" + +PRJ_MMPFILES + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2006 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: Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../new_file_service_api/group/bld.inf" +#include "../voicerecorder_public_constants_api/group/bld.inf" diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: New File Service API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/NewFileServiceClient.h APP_LAYER_PLATFORM_EXPORT_PATH(NewFileServiceClient.h) +../inc/CNewFileServiceBase.h APP_LAYER_PLATFORM_EXPORT_PATH(CNewFileServiceBase.h) +../inc/NewFileServiceDefs.h APP_LAYER_PLATFORM_EXPORT_PATH(NewFileServiceDefs.h) +../inc/NewFileService.hrh APP_LAYER_PLATFORM_EXPORT_PATH(NewFileService.hrh) diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/inc/CNewFileServiceBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/inc/CNewFileServiceBase.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002-2004 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: Interface for recording new media files using platform + applications +* +*/ + + + +#ifndef CNEWFILESERVICEBASE_H +#define CNEWFILESERVICEBASE_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CAiwGenericParamList; + + +// CLASS DECLARATION + +/** +* Observer interface to get notification from server application +* +* @lib NewService.lib +* @since Series 60 3.0 +*/ +class MNewFileServiceObserver + { + public: + virtual void HandleCompletedNewServiceL( TBool aReturnValue ) = 0; + }; + +/** +* Base class for server applications +* +* @lib NewService.lib +* @since Series 60 3.0 +*/ +class CNewFileServiceBase : public CAknAppServiceBase, public MNewFileServiceObserver + { + public: // Constructors and destructor + + /** + * Destructor. + */ + IMPORT_C virtual ~CNewFileServiceBase(); + + /** + * return iErrorCode. + */ + IMPORT_C TInt GetErrorCode(); + + /** + * set iErrorCode. + */ + IMPORT_C void SetErrorCode(TInt); + + + protected: // New functions + + /** + * From CAknAppServiceBase + * @since Series 60 3.0 + * @param aMessage The client message + */ + IMPORT_C void ServiceL( const RMessage2& aMessage ); + + /** + * From MNewFileServiceObserver + * @since Series 60 3.0 + * @param aReturnValue ETrue if the media file was succesfully created + */ + IMPORT_C void HandleCompletedNewServiceL( TBool aReturnValue ); + + /** + * Getter for member variable + * @since Series 60 3.0 + * @return Pointer to iGenericParams + */ + IMPORT_C CAiwGenericParamList* GenericParams(); + + /** + * Create a new media file + * @since Series 60 3.0 + * @param aObserver Object that is notified when recording is ready + * @param aFilenameArray Array for the filename(s) of the recorded files + * @param aType Required media type + * @param aMultiplefiles ETrue if multiples files can be recorded + */ + virtual void HandleNewFileL( MNewFileServiceObserver* aObserver, + CDesCArray& aFilenameArray, + TNewServiceFileType aType, + TBool aMultipleFiles ) = 0; + /** + * Create a new media file + * @since Series 60 3.0 + * @param aObserver Object that is notified when recording is ready + * @param aFile File handle that the media file is to be recorded + * @param aType Required media type + */ + virtual void HandleNewFileL( MNewFileServiceObserver* aObserver, + RFile& aFile, + TNewServiceFileType aType ) = 0; + + /** + * Notifies the server application that service is complete + * and it may safely close + * @since Series 60 3.0 + */ + virtual void ServiceCompleteL() = 0; + + private: + + void DeserializeGenericParamsL( const RMessage2& aMessage ); + + + protected: + + /** + * C++ default constructor. + */ + IMPORT_C CNewFileServiceBase(); + + private: // Data + // Array for the filenames + CDesCArrayFlat* iFilenameArray; + + // Last received message + RMessage2 iPendingMessage; + + // Generic parameter array + CAiwGenericParamList* iGenericParams; + + // Error code that send back to client + TInt iError; + + }; + +#endif // CNewFileServiceBase_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/inc/NewFileService.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/inc/NewFileService.hrh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2002-2004 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: Definitions for the API +* +*/ + + +#ifndef NEWFILESERVICE_HRH +#define NEWFILESERVICE_HRH + +// DATA TYPES +enum TNewServiceFileType + { + ENewFileServiceImage, + ENewFileServiceVideo, + ENewFileServiceAudio + }; + +#endif + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/inc/NewFileServiceClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/inc/NewFileServiceClient.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2002-2004 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: Client side API +* +*/ + + + +#ifndef NEWFILESERVICECLIENT_H +#define NEWFILESERVICECLIENT_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class RFile; +class CApaServerAppExitMonitor; +class CNewFileServiceClient; +class CAiwGenericParamList; + +// CLASS DECLARATION + + +class NewFileServiceFactory + { + public: + IMPORT_C static CNewFileServiceClient* NewClientL(); + }; + +/** +* Client side API for New File Service +* +* @lib NewService.lib +* @since Series 60 3.0 +*/ +class CNewFileServiceClient : public CBase + { + + public: // New functions + + /** + * Create new media file + * @since Series 60 3.0 + * @param aApplicationUid Uid for the server application + * @param aFileNames Array for the created media files + * @param aParams Parameters for the operation + * @param aFileType Type of media file requested + * @param aMultipleFiles Multiple files can be created + * @return ETrue if new file was succesfully created + */ + virtual TBool NewFileL( CDesCArray& aFileNames, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType, + TBool aMultipleFiles ) = 0; + virtual TBool NewFileL( TUid aApplicationUid, + CDesCArray& aFileNames, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType, + TBool aMultipleFiles ) = 0; + + + /** + * NOTE: When you pass file handles to new file service, + * the handle should be opened using ShareProtected() + * file session, otherwise handles can't be transfered through + * client-server interface. + */ + + /** + * Create new media file + * @since Series 60 3.0 + * @param aApplicationUid Uid for the server application + * @param aFile File handle for the media file + * @param aParams Parameters for the operation + * @param aFileType Type of media file requested + * @return ETrue if new file was succesfully created + */ + virtual TBool NewFileL( RFile& aFileHandle, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType ) = 0; + + virtual TBool NewFileL( TUid aApplicationUid, + RFile& aFileHandle, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType ) = 0; + + + + }; + +#endif // NEWFILESERVICECLIENT_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/inc/NewFileServiceDefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/inc/NewFileServiceDefs.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2002-2006 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: Definitions for the API +* +*/ + + + +#ifndef NEWSERVICEDEFS_H +#define NEWSERVICEDEFS_H + +// INCLUDES +#include + +#define NEWSERVICEUID 0x101F8861 + +// DATA TYPES +enum TIpcMessageIds + { + ECreateNewFile = RApaAppServiceBase::KServiceCmdBase, + ENewFileToHandle, + EGetFilenameArrayLength, + EGetFilenameArray + }; + +enum TIpcNewFileArgumentIndices + { + ENewServiceIndexParams = 0, + ENewServiceIndexFsHandle, + ENewServiceIndexFileHandle, + ENewServiceIndexFileName + }; + +/** +* Parameter class transferred through client-server interface. +* +* @since Series 60 3.0 +*/ +class TNewServiceParamPack + { + public: + TNewServiceFileType iType; + TBool iMultipleFiles; + TBool iReturnValue; + }; + + +#endif // NEWSERVICEDEFS_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/new_file_service_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/new_file_service_api.metaxml Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,18 @@ + + + New File Service API + New File Service API + c++ + voicerecorder + + + + + + + + + no + no + + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/Bmarm/UI_NewFileServiceTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/Bmarm/UI_NewFileServiceTestU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/Bwins/UI_NewFileServiceTestU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/Bwins/UI_NewFileServiceTestU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/EABI/UI_NewFileServiceTestU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/EABI/UI_NewFileServiceTestU.def Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI24CDummyNewFileServiceBase @ 2 NONAME ; ## + _ZTV24CDummyNewFileServiceBase @ 3 NONAME ; ## + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/group/UI_NewFileServiceTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/group/UI_NewFileServiceTest.mmp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002 - 2007 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: API test automation file for project UI_NewFileServiceTest +* +*/ + + +#if defined(__S60_) + // To get the OS_LAYER_SYSTEMINCLUDE-definition + #include +#endif + +TARGET UI_NewFileServiceTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE UI_NewFileServiceTest.def + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE UI_NewFileServiceTest.cpp +SOURCE UI_NewFileServiceTestBlocks.cpp +SOURCE CDummyNewFileServiceBase.cpp + +USERINCLUDE ../inc + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY NewService.lib bafl.lib ServiceHandler.lib +LIBRARY cone.lib ws32.lib avkon.lib eikcoctl.lib eikctl.lib apgrfx.lib aknskins.lib aknskinsrv.lib aknswallpaperutils.lib eikcore.lib mpxviewutility.lib efsrv.lib + +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/group/UI_NewFileServiceTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/group/UI_NewFileServiceTest.pkg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,64 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: pakage file for make installation file for STIF +; +; +; Installation file for STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF UI_NewFileServiceTest Application"},(0x10005942),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\urel\UI_NewFileServiceTest.dll" - "c:\Sys\Bin\UI_NewFileServiceTest.dll" +"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" +"..\..\conf\UI_NewFileServiceTest.cfg" - "c:\testframework\UI_NewFileServiceTest.cfg" +"..\..\conf\tcNewFileServiceTest.cfg" - "c:\testframework\tcNewFileServiceTest.cfg" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 - 2007 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: build information file for project UI_NewFileServiceTest. +* +*/ + + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +UI_NewFileServiceTest.mmp +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/inc/CDummyNewFileServiceBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/inc/CDummyNewFileServiceBase.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002 - 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Sample file of newfile server +* +*/ + + + + + + +#ifndef CDUMMYNEWFILESERVICEBASE_H_ +#define CDUMMYNEWFILESERVICEBASE_H_ +#include + +class CDummyNewFileServiceBase : public CNewFileServiceBase + { +public: // Constructors and destructor + CDummyNewFileServiceBase(); + ~CDummyNewFileServiceBase(); + void HandleNewFileL( MNewFileServiceObserver* aObserver, + CDesCArray& aFilenameArray, + TNewServiceFileType aType, + TBool aMultipleFiles ); + CPolicyServer::TCustomResult SecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing); + TInt CountResources(); + void Disconnect(const RMessage2& aMessage); + void ExtensionInterface(TUid aInterfaceId, TAny*& aImplementaion); + void CApaAppServiceBase_Reserved1(); + void CApaAppServiceBase_Reserved2(); + void HandleNewFileL( MNewFileServiceObserver* aObserver, + RFile& aFile, + TNewServiceFileType aType ); + void ServiceCompleteL(); + void ServiceLtest(const RMessage2& aMessage); + void HandleCompletedNewServiceLtest(TBool aBool); + CAiwGenericParamList* GenericParamstest(); + + }; +#endif /*CDUMMYNEWFILESERVICEBASE_H_*/ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/inc/UI_NewFileServiceTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/inc/UI_NewFileServiceTest.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2002 - 2007 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: UI_NewFileServiceTest test class for STIF Test Framework TestScripter. +* +*/ + + + + + + +#ifndef UI_NewFileServiceTest_H +#define UI_NewFileServiceTest_H + +// INCLUDES +#include +#include +#include + +#include +#include +#include +#include +#include "CDummyNewFileServiceBase.h" +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +// Logging path +_LIT( KUI_NewFileServiceTestLogPath, "\\logs\\testframework\\UI_NewFileServiceTest\\" ); +//Data path +_LIT( KNewFileServiceTestDataPath, "c:\\testing\\data\\" ); +// Log file +_LIT( KUI_NewFileServiceTestLogFile, "UI_NewFileServiceTest.txt" ); +_LIT( KUI_NewFileServiceTestLogFileWithTitle, "UI_NewFileServiceTest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CUI_NewFileServiceTest; +class CCoeControl; +class CNewFileServiceClient; +class NewFileServiceFactory; +class CNewFileServiceBase; +class CEdwinTestControl; +class CListBoxTestControl; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* CUI_NewFileServiceTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CUI_NewFileServiceTest) : public CScriptBase + { + public: // Constructors and destructor + + enum TIpcNewFileArgumentIndices + { + ENewServiceIndexParams = 0, + ENewServiceIndexFsHandle, + ENewServiceIndexFileHandle, + ENewServiceIndexFileName + }; + /** + * Two-phased constructor. + */ + static CUI_NewFileServiceTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CUI_NewFileServiceTest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + + + private: + + /** + * C++ default constructor. + */ + CUI_NewFileServiceTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + + TInt CNewFileServiceClientCreate( CStifItemParser& aItem ); + TInt NewFileL( CStifItemParser& aItem ); + TInt NewFileByUid( CStifItemParser& aItem ); + TInt NewFileByRFile( CStifItemParser& aItem ); + TInt NewFileByRFileAndUid( CStifItemParser& aItem ); + + TInt CreateCDummyNewFileServiceBase( CStifItemParser& /*aItem*/ ); + TInt DestroyCDummyNewFileServiceBase( CStifItemParser& /*aItem*/ ); + TInt CDummyNewFileServiceBaseGetErrorCode( CStifItemParser& /*aItem*/ ); + TInt CDummyNewFileServiceBaseSetErrorCode( CStifItemParser& aItem ); + TInt CDummyNewFileServiceBaseServiceL( CStifItemParser& /*aItem*/ ); + TInt CDummyNewFileServiceBaseHandleCompletedNewServiceL( CStifItemParser& /*aItem*/ ); + TInt CDummyNewFileServiceBaseGenericParams( CStifItemParser& /*aItem*/ ); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + + private: // Friend classes + //?friend_class_declaration; + + CNewFileServiceClient* iNewFileServiceClient; + CNewFileServiceBase* iNewFileServiceBase; + CDummyNewFileServiceBase* iDummyNewFileServiceBase; + }; + +#endif // UI_NewFileServiceTest_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/src/CDummyNewFileServiceBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/src/CDummyNewFileServiceBase.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2002 - 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: sample file of Newfile server +* +*/ + + + + + + +#include "CDummyNewFileServiceBase.h" + +CDummyNewFileServiceBase::CDummyNewFileServiceBase():CNewFileServiceBase() + { + } +CDummyNewFileServiceBase::~CDummyNewFileServiceBase() + { + } +void CDummyNewFileServiceBase::HandleNewFileL( MNewFileServiceObserver* /*aObserver*/, + CDesCArray& /*aFilenameArray*/, + TNewServiceFileType /*aType*/, + TBool /*aMultipleFiles*/ ) + {} + +void CDummyNewFileServiceBase::HandleNewFileL( MNewFileServiceObserver* /*aObserver*/, + RFile& /*aFile*/, + TNewServiceFileType /*aType*/ ) + {} + +void CDummyNewFileServiceBase::ServiceCompleteL() + { + GenericParams(); + } +CPolicyServer::TCustomResult CDummyNewFileServiceBase::SecurityCheckL(const RMessage2& /*aMsg*/, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/) + {return CPolicyServer::EPass;} +TInt CDummyNewFileServiceBase::CountResources() + {return 0;} +void CDummyNewFileServiceBase::Disconnect(const RMessage2& /*aMessage*/) + {} +void CDummyNewFileServiceBase::ExtensionInterface(TUid /*aInterfaceId*/, TAny*& /*aImplementaion*/) + {} +void CDummyNewFileServiceBase::CApaAppServiceBase_Reserved1() + {} +void CDummyNewFileServiceBase::CApaAppServiceBase_Reserved2() + {} + +void CDummyNewFileServiceBase::ServiceLtest(const RMessage2& aMessage) + { + ServiceL( aMessage ); + } + +void CDummyNewFileServiceBase::HandleCompletedNewServiceLtest(TBool aBool) + { + HandleCompletedNewServiceL( aBool); + } + +CAiwGenericParamList* CDummyNewFileServiceBase::GenericParamstest() + { + return GenericParams(); + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/src/UI_NewFileServiceTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/src/UI_NewFileServiceTest.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2002 - 2007 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: UI_NewFileServiceTest test class for STIF Test Framework TestScripter. +* +*/ + + + + + + +// INCLUDE FILES +#include +#include "UI_NewFileServiceTest.h" +#include + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CUI_NewFileServiceTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CUI_NewFileServiceTest::CUI_NewFileServiceTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CUI_NewFileServiceTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KUI_NewFileServiceTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KUI_NewFileServiceTestLogFile); + } + + iLog = CStifLogger::NewL( KUI_NewFileServiceTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CUI_NewFileServiceTest* CUI_NewFileServiceTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CUI_NewFileServiceTest* self = new (ELeave) CUI_NewFileServiceTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CUI_NewFileServiceTest::~CUI_NewFileServiceTest() + { + + // Delete resources allocated from test methods + Delete(); + + if ( iNewFileServiceClient != NULL ) + { + delete iNewFileServiceClient; + iNewFileServiceClient=NULL; + } + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CUI_NewFileServiceTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/src/UI_NewFileServiceTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/UI_NewFileServiceTest/src/UI_NewFileServiceTestBlocks.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,414 @@ +/* +* Copyright (c) 2002 - 2007 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: UI_NewFileServiceTest test class for STIF Test Framework TestScripter. +* +*/ + + + + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "UI_NewFileServiceTest.h" + +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CUI_NewFileServiceTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CUI_NewFileServiceTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + // test cases for the header "NewFileServiceClient.h" + ENTRY( "CNewFileServiceClientCreate", CUI_NewFileServiceTest::CNewFileServiceClientCreate ), + ENTRY( "NewFileL", CUI_NewFileServiceTest::NewFileL ), + ENTRY( "NewFileByUid", CUI_NewFileServiceTest::NewFileByUid ), + ENTRY( "NewFileByRFile", CUI_NewFileServiceTest::NewFileByRFile ), + ENTRY( "NewFileByRFileAndUid", CUI_NewFileServiceTest::NewFileByRFileAndUid ), + // test cases for the header "CNewFileServiceBase.h" + + ENTRY( "CreateCDummyNewFileServiceBase", CUI_NewFileServiceTest::CreateCDummyNewFileServiceBase ), + ENTRY( "DestroyCDummyNewFileServiceBase", CUI_NewFileServiceTest::DestroyCDummyNewFileServiceBase ), + ENTRY( "CDummyNewFileServiceBaseGetErrorCode", CUI_NewFileServiceTest::CDummyNewFileServiceBaseGetErrorCode ), + ENTRY( "CDummyNewFileServiceBaseSetErrorCode", CUI_NewFileServiceTest::CDummyNewFileServiceBaseSetErrorCode ), + ENTRY( "CDummyNewFileServiceBaseServiceL", CUI_NewFileServiceTest::CDummyNewFileServiceBaseServiceL ), + ENTRY( "CDummyNewFileServiceBaseHandleCompletedNewServiceL", CUI_NewFileServiceTest::CDummyNewFileServiceBaseHandleCompletedNewServiceL ), + ENTRY( "CDummyNewFileServiceBaseGenericParams", CUI_NewFileServiceTest::CDummyNewFileServiceBaseGenericParams ) + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CNewFileServiceClientCreate +// NewClientL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CUI_NewFileServiceTest::CNewFileServiceClientCreate( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + iLog->Log(_L("CUI_NewFileServiceTest::CNewFileServiceClientCreate begin:")); + + TRAP(err,iNewFileServiceClient=NewFileServiceFactory::NewClientL()); + + iLog->Log(_L("CUI_NewFileServiceTest::CNewFileServiceClientCreate returned: %d"), err); + return err; + + } + + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::NewFileL +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::NewFileL( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TPtrC string; + iLog->Log(_L("CUI_NewFileServiceTest::NewFileL begin:")); + + CDesCArray* files = new (ELeave)CDesCArrayFlat(1); + + CleanupStack::PushL(files); + CAiwGenericParamList* iCAiwGenericParamList=CAiwGenericParamList::NewL(); + + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KNewFileServiceTestDataPath); + KFrom.Append(string); + files->AppendL(KFrom); + iNewFileServiceClient=NewFileServiceFactory::NewClientL(); + + TRAP(err,iNewFileServiceClient->NewFileL(*files,iCAiwGenericParamList,ENewFileServiceAudio,ETrue)); + + + } + CleanupStack::PopAndDestroy(files); + + iLog->Log(_L("CUI_NewFileServiceTest::NewFileL returned: %d"), err); + return err; + + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::NewFileByUid +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::NewFileByUid( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TPtrC string; + iLog->Log(_L("CUI_NewFileServiceTest::NewFileByUid begin:")); + TUid uid = TUid::Uid(0x100058CA);//0x101F87A3 0x101F87A4 0x100058CA + CDesCArray* files = new (ELeave)CDesCArrayFlat(1); + CleanupStack::PushL(files); + CAiwGenericParamList* iCAiwGenericParamList=CAiwGenericParamList::NewL(); + + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KNewFileServiceTestDataPath); + KFrom.Append(string); + files->AppendL(KFrom); + iNewFileServiceClient=NewFileServiceFactory::NewClientL(); + + TRAP(err,iNewFileServiceClient->NewFileL(uid,*files,iCAiwGenericParamList,ENewFileServiceAudio,ETrue)); + + + } + CleanupStack::PopAndDestroy(files); + + iLog->Log(_L("CUI_NewFileServiceTest::NewFileByUid returned: %d"), err); + return err; + + } + + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::NewFileByRFile +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::NewFileByRFile( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TPtrC string; + iLog->Log(_L("CUI_NewFileServiceTest::NewFileByRFile begin:")); + + CAiwGenericParamList* iCAiwGenericParamList=CAiwGenericParamList::NewL(); + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KNewFileServiceTestDataPath); + KFrom.Append(string); + + RFile file; + RFs fs; + fs.Connect(); + file.Open(fs,KFrom,EFileShareAny|EFileWrite); + iNewFileServiceClient=NewFileServiceFactory::NewClientL(); + + TRAP(err,iNewFileServiceClient->NewFileL(file,iCAiwGenericParamList,ENewFileServiceAudio)); + file.Close(); + fs.Close(); + + } + + iLog->Log(_L("CUI_NewFileServiceTest::NewFileByRFile returned: %d"), err); + return err; + + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::NewFileByRFileAndUid +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::NewFileByRFileAndUid( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TPtrC string; + iLog->Log(_L("CUI_NewFileServiceTest::NewFileByRFileAndUid begin:")); + TUid uid = TUid::Uid(0x100058CA); + + CAiwGenericParamList* iCAiwGenericParamList=CAiwGenericParamList::NewL(); + + + while ( aItem.GetNextString( string ) == KErrNone ) + { + TBuf<120> KFrom; + KFrom.Append(KNewFileServiceTestDataPath); + KFrom.Append(string); + + RFile file; + RFs fs; + fs.Connect(); + file.Open(fs,KFrom,EFileShareAny|EFileWrite); + iNewFileServiceClient=NewFileServiceFactory::NewClientL(); + + TRAP(err,iNewFileServiceClient->NewFileL(uid,file,iCAiwGenericParamList,ENewFileServiceAudio)); + file.Close(); + fs.Close(); + + } + + + iLog->Log(_L("CUI_NewFileServiceTest::NewFileByRFileAndUid returned: %d"), err); + return err; + + } +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CreateCDummyNewFileServiceBase +// Create CDummyNewFileServiceBase +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::CreateCDummyNewFileServiceBase( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + iLog->Log(_L("CUI_NewFileServiceTest::CreateCDummyNewFileServiceBase begin:")); + + iDummyNewFileServiceBase = new (ELeave)CDummyNewFileServiceBase(); + + if ( iDummyNewFileServiceBase == NULL ) + + { + err = KErrNotFound; + iLog->Log(_L("CUI_NewFileServiceTest::CreateCDummyNewFileServiceBase returned: %d"), err); + } + + return err; + + } +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::DestroyCDummyNewFileServiceBase +// Destroy CDummyNewFileServiceBase +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::DestroyCDummyNewFileServiceBase( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + iLog->Log(_L("CUI_NewFileServiceTest::DestroyCDummyNewFileServiceBase begin:")); + if ( iDummyNewFileServiceBase != NULL ) + { + delete iDummyNewFileServiceBase; + iDummyNewFileServiceBase = NULL; + } + iLog->Log(_L("CUI_NewFileServiceTest::DestroyCDummyNewFileServiceBase returned: %d"), err); + return err; + } +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CDummyNewFileServiceBaseGetErrorCode +// CDummyNewFileServiceBase GetErrorCode +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::CDummyNewFileServiceBaseGetErrorCode( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + TInt errcode = 0; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseGetErrorCode begin:")); + + errcode = iDummyNewFileServiceBase->GetErrorCode(); + if ( errcode > 0 ) + { + err = KErrNotFound; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseGetErrorCode returned: %d"), err); + } + + return err; + } +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CDummyNewFileServiceBaseSetErrorCode +// CDummyNewFileServiceBase SetErrorCode +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +TInt CUI_NewFileServiceTest::CDummyNewFileServiceBaseSetErrorCode( CStifItemParser& aItem ) + { + TInt err = KErrNone; + TInt errcode; + TInt compare; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseSetErrorCode begin:")); + while ( aItem.GetNextInt(errcode) == KErrNone ) + { + iDummyNewFileServiceBase->SetErrorCode(errcode); + } + + compare = iDummyNewFileServiceBase->GetErrorCode(); + + if ( compare != errcode ) + { + err = KErrNotFound; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseSetErrorCode returned: %d"), err); + } + + return err; + } + + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CDummyNewFileServiceBaseServiceL +// CDummyNewFileServiceBase ServiceL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::CDummyNewFileServiceBaseServiceL( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseServiceL begin:")); +// RMessage2* msg = new(ELeave)RMessage2(); +// HBufC* buf = HBufC::NewLC(100); +// buf->Des().Append(_L("aa")); +// TPtr ptr = buf->Des(); +// ptr.Copy(_L("aa")); +// message->ReadL(0,ptr); + RMessage2* msg = new(ELeave)RMessage2(); + HBufC* msg1 = HBufC::New( 20 ); + TUint16 msgContent = ENewServiceIndexFileName; //(TUint8)3; + msg1->Des().Copy( &msgContent ); + TPtr msgPtr1 = msg1->Des(); + msg->ReadL( msgContent,msgPtr1 ); + + iDummyNewFileServiceBase->ServiceLtest(*msg); + CleanupStack::PopAndDestroy(); // msg1 + //delete message; + //delete buf; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseServiceL returned: %d"), err); + + + return err; + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CDummyNewFileServiceBaseHandleCompletedNewServiceL +// CDummyNewFileServiceBase HandleCompletedNewServiceL +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::CDummyNewFileServiceBaseHandleCompletedNewServiceL( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + TBool tbool = ETrue; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseHandleCompletedNewServiceL begin:")); + + iDummyNewFileServiceBase->HandleCompletedNewServiceLtest(tbool); + + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseHandleCompletedNewServiceL returned: %d"), err); + + return err; + } + +// ----------------------------------------------------------------------------- +// CUI_NewFileServiceTest::CDummyNewFileServiceBaseGenericParams +// CDummyNewFileServiceBase GenericParams +// (other items were commented in a header). +// ----------------------------------------------------------------------------- + +TInt CUI_NewFileServiceTest::CDummyNewFileServiceBaseGenericParams( CStifItemParser& /*aItem*/ ) + { + TInt err = KErrNone; + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseGenericParams begin:")); + + iDummyNewFileServiceBase->GenericParamstest(); + + iLog->Log(_L("CUI_NewFileServiceTest::CDummyNewFileServiceBaseGenericParams returned: %d"), err); + + return err; + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/conf/UI_NewFileServiceTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/conf/UI_NewFileServiceTest.cfg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,70 @@ +[Test] +title 1: CNewFileServiceClientCreate +create UI_NewFileServiceTest client +client CNewFileServiceClientCreate +delete client +[Endtest] + +[Test] +title 2: CreateCDummyNewFileServiceBase +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] + +[Test] +title 3: DestroyCDummyNewFileServiceBase +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] + +[Test] +title 4: CDummyNewFileServiceBaseGetErrorCode +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client CDummyNewFileServiceBaseSetErrorCode -12 +client CDummyNewFileServiceBaseGetErrorCode +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] + +[Test] +title 5: CDummyNewFileServiceBaseSetErrorCode +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client CDummyNewFileServiceBaseSetErrorCode -12 +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] + + +[Test] +title 6: CDummyNewFileServiceBaseHandleCompletedNewServiceL +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client CDummyNewFileServiceBaseHandleCompletedNewServiceL +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] + +[Test] +title 7: CDummyNewFileServiceBaseGenericParams +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client CDummyNewFileServiceBaseGenericParams +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] + +[Test] +title 8: CDummyNewFileServiceBaseServiceL +create UI_NewFileServiceTest client +client CreateCDummyNewFileServiceBase +client CDummyNewFileServiceBaseServiceL +pause 1000 +client DestroyCDummyNewFileServiceBase +delete client +[Endtest] diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/conf/tcNewFileServiceTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/conf/tcNewFileServiceTest.cfg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,40 @@ +[Test] +title 1: CNewFileServiceClientCreate +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 1 +[Endtest] + +[Test] +title 2: CreateCDummyNewFileServiceBase +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 2 +[Endtest] + +[Test] +title 3: DestroyCDummyNewFileServiceBase +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 3 +[Endtest] + +[Test] +title 4: CDummyNewFileServiceBaseGetErrorCode +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 4 +[Endtest] + +[Test] +title 5: CDummyNewFileServiceBaseSetErrorCode +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 5 +[Endtest] + + +[Test] +title 6: CDummyNewFileServiceBaseHandleCompletedNewServiceL +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 6 +[Endtest] + +[Test] +title 7: CDummyNewFileServiceBaseGenericParams +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 7 +[Endtest] + +[Test] +title 8: CDummyNewFileServiceBaseServiceL +run testscripter c:\testframework\UI_NewFileServiceTest.cfg 8 +[Endtest] diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2007 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: Build information file for project UI_NewFileServiceTest +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTEXPORTS +// Test sound file + + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +#include "../UI_NewFileServiceTest/group/bld.inf" + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/new_file_service_api/tsrc/init/TestFramework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/new_file_service_api/tsrc/init/TestFramework.ini Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,197 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport_UI_NewFileServiceTest + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +UITestingSupport= YES +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testcombiner +TestCaseFile= c:\testframework\tcNewFileServiceTest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/voicerecorder_public_constants_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/voicerecorder_public_constants_api/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: VoiceRecorder Public Constants API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/VoiceRecorderUID.h APP_LAYER_PLATFORM_EXPORT_PATH(VoiceRecorderUID.h) +../inc/VoiceRecorderContexts.h APP_LAYER_PLATFORM_EXPORT_PATH(VoiceRecorderContexts.h) diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/voicerecorder_public_constants_api/inc/VoiceRecorderContexts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/voicerecorder_public_constants_api/inc/VoiceRecorderContexts.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 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: +* Defines commands and control identifiers. +* The file can be included in C++ or resource file. +* +*/ + + +#ifndef __VOICERECORDERCONTEXTS_H_ +#define __VOICERECORDERCONTEXTS_H_ + +// Recorder View context IDs +enum TVRRecViewContexts + { + EContextNormal = 0, + EContextEmptyNormal, + EContextRecordNewNormal, + EContextRecordNewForRemote, + EContextViewer, + EContextNokiaRingTone, + ENumContexts // this must be the last line + }; + +#endif // __VOICERECORDERCONTEXTS_H_ + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/voicerecorder_public_constants_api/inc/VoiceRecorderUID.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/voicerecorder_public_constants_api/inc/VoiceRecorderUID.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2002 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: +* Contains the UIDs for Voice Recorder application modules and views +* +*/ + + +#ifndef __VOICERECORDERUID_H__ +#define __VOICERECORDERUID_H__ + +// CONSTANTS +#define KVoiceRecorderAppUID3 0x100058CA +#define KEPOCAppUID2 0x100039ce // Symbian defined +#define KEPOCDLLUID2 0x1000008d // Symbian defined + +// View UIDs +#define KVRRecorderViewUID 1 + +#endif // __VOICERECORDERUID_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerec_plat/voicerecorder_public_constants_api/voicerecorder_public_constants_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerec_plat/voicerecorder_public_constants_api/voicerecorder_public_constants_api.metaxml Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,17 @@ + + + VoiceRecorder Public Constants API + VoiceRecorder Public Constants API + c++ + voicerecorder + + + + + + + + no + no + + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/Aif/VoiceRecorderAif.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/Aif/VoiceRecorderAif.rss Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2002 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: +* Application Information resource file for Voice Recorder +* +* +*/ + + +#include +#include + +RESOURCE AIF_DATA + { + app_uid = 0x100058CA; + num_icons = 2; + hidden = KAppNotHidden; + embeddability = KAppEmbeddable; + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRAppServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRAppServer.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2002 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 class is part of new file service framework. +* +*/ + + +#include +#include +#include "CVRNewFileService.h" +#include "CVRAppServer.h" + +CApaAppServiceBase* CVRAppServer::CreateServiceL( TUid aServiceType ) const + { + if ( aServiceType == TUid::Uid( NEWSERVICEUID ) ) + { + CVRNewFileService* service = CVRNewFileService::NewL(); + iNewFileServiceObserver = service; + return service; + } + else + { + return CAknAppServer::CreateServiceL(aServiceType); + } + } + +MNewFileServiceObserver* CVRAppServer::NewFileServiceObserver() const + { + return iNewFileServiceObserver; + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRAppServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRAppServer.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002 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 class is part of application framework. +* +*/ + + +#ifndef __CVRAPPSERVER_H__ +#define __CVRAPPSERVER_H__ + +// INCLUDES +#include +#include + +// CONSTANTS + +// CLASS DECLARATION +/** +* This class is part of new file service framework. +*/ +class CVRAppServer + : public CAknAppServer + { + + public: // from CAknAppServer + CApaAppServiceBase* CreateServiceL( TUid aServiceType ) const; + + public: + MNewFileServiceObserver* NewFileServiceObserver() const; + + private: + mutable MNewFileServiceObserver* iNewFileServiceObserver; + }; + +#endif // __CVNEWFILESERVICE_H__ + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRAppUI.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRAppUI.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,436 @@ +/* +* Copyright (c) 2002-2006 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 class is a part of the standard application framework. + * It instantiates the application views. + * It also acts as the default command handler for the application. + * +*/ + + + +#include +#include + +#include // For layout change event definitions + +#include "CVRRecView.h" +#include "MVRSelectionProvider.h" +#include "CVRAppUi.h" +#include +#include +#include "CVRDocument.h" +#include +#include "VRConsts.h" + +#include +#include +#include "voicerecorder.hrh" +#include "VRUtils.h" +#include "CVRSettingsDialog.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef RD_MULTIPLE_DRIVE +#include +#endif +#include +_LIT( KVRCommandRecord, "record" ); + +// --------------------------------------------------------------------------- +// CVRAppUi::CVRAppUi +// +// --------------------------------------------------------------------------- +// +CVRAppUi::CVRAppUi() + { + } + + +// --------------------------------------------------------------------------- +// CVRAppUi::~CVRAppUi +// +// --------------------------------------------------------------------------- +// +CVRAppUi::~CVRAppUi() + { + if (iActiveWait.IsStarted()) + { + iActiveWait.AsyncStop(); + } + + if (iDoorObserver) + { + iDoorObserver->NotifyExit(MApaEmbeddedDocObserver::EEmpty); + } + + delete iErrorUI; + FeatureManager::UnInitializeLib(); + } + +// --------------------------------------------------------------------------- +//CVRAppUi::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRAppUi::ConstructL() + { + BaseConstructL( EAknEnableSkin | EAknEnableMSK +#ifdef SINGLE_CLICK_INCLUDED + | EAknSingleClickCompatible +#endif + ); + + iErrorUI = CErrorUI::NewL(); + + // Exit if video or voip call is ongoing + if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) ) + { + Exit(); + } + + FeatureManager::InitializeLibL(); + + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + +#ifndef RD_MULTIPLE_DRIVE + TVRDriveInfo mmcInfo; + VRUtils::GetMMCInfo( mmcInfo ); + TVRMemoStore memoStore = VRUtils::MemoStoreL(); + + if ( memoStore == EMemoStoreMMC ) + { + // check if USB is connected, if so, then need to switch to phone memory + if (CVRUSBStateHanlder::IsUsbActive()) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC( + R_QTN_MEMC_VOREC_NOTE1 ); + CAknInformationNote* infoNote = + new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + + // MMC not available or locked + else if ( memoStore && ( mmcInfo.iDriveLocked || !mmcInfo.iDrivePresent ) ) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC( + R_QTN_MEMC_VOREC_NOTE1 ); + CAknInformationNote* infoNote = + new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + else if ( mmcInfo.iDriveReadOnly ) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC( + R_QTN_MEMC_VOREC_NOTE2 ); + CAknInformationNote* infoNote = + new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy( noteText ); + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + else if ( mmcInfo.iDriveCorrupted ) + { + // MMC corrupted -> use phone memory + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + + } +// for multiple drives +#else + + +#endif + } + + CVRRecView* view = CVRRecView::NewLC(R_VR_RECORDER_VIEW, + R_VR_RECVIEW_STATES); + + AddViewL( view ); + iLayoutChangeObserver = view; + CleanupStack::Pop( view ); + + SetDefaultViewL( *view ); + + // Activate view straight away, if started through new file service + if (iEikonEnv->StartedAsServerApp()) + { + ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid( + EContextRecordNewForRemote), KNullDesC8); + } + + } + +// --------------------------------------------------------------------------- +// CVRAppUi::HandleCommandL +// +// --------------------------------------------------------------------------- +// +void CVRAppUi::HandleCommandL( TInt aCommand ) + { + switch ( aCommand ) + { + case EAknSoftkeyExit: // Fall through + { + if ( iView ) + { + iView->HandleCommandL( ECmdCancelNote ); + } + Exit(); + break; + } + case EEikCmdExit: + { + if ( iView ) + { + iView->HandleCommandL( ECmdCancelNote ); + } + + // The file service needs to abort if it's still going on + if (iEmbeddedObserver) + { + CNewFileServiceBase * iNewFileService = NULL; + iNewFileService + = dynamic_cast (iEmbeddedObserver); + if (iNewFileService != NULL) + { + iNewFileService->SetErrorCode(KErrAbort); + } + iEmbeddedObserver->AbortL(); + } + + Exit(); + break; + } + case EAknCmdExit: + { + if ( iView ) + { + iView->HandleCommandL( ECmdCancelNote ); + } + + // The file service needs to abort if it's still going on + if (iEmbeddedObserver) + { + CNewFileServiceBase * iNewFileService = NULL; + iNewFileService + = dynamic_cast (iEmbeddedObserver); + if (iNewFileService != NULL) + { + iNewFileService->SetErrorCode(KErrAbort); + } + iEmbeddedObserver->AbortL(); + } + + Exit(); + break; + } + case ECmdHelp: + { + if (FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + if (iIsSettingsOpen) + { + CArrayFix* contexts = AppHelpContextL(); + contexts->At(0).iContext = KVOREC_HLP_SETTINGS; + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), contexts); + } + else + { + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), AppHelpContextL()); + } + } + break; + } + case ECmdSettings: + { + if (FeatureManager::FeatureSupported(KFeatureIdMmc) + || VRUtils::FeatureEnabled(EVRFeatureShowQualitySetting)) + { + iIsSettingsOpen = ETrue; + CVRSettingsDialog* settingsDlg = CVRSettingsDialog::NewL(); + settingsDlg->ExecuteLD(R_VR_SETTINGS_DIALOG); + iIsSettingsOpen = EFalse; + } + break; + } + case ECmdNewFileServiceNotify: + { + if (iActiveWait.IsStarted()) + { + iActiveWait.AsyncStop(); + } + break; + } + case ECmdEmbeddedRecordingReady: + { + if (iEmbeddedObserver) + { + TBool canExit(ETrue); + + TVRSelectionStyle selStyle; + TPtrC memoFile(SelectionProviderL()-> GetSelectedFilesLC( + selStyle)-> MdcaPoint(0)); + if (memoFile.Length() > 0) + { + TFileName myFilename(memoFile); + canExit = iEmbeddedObserver->FileCompleteL(myFilename); + } + + // destroy array from GetSelectedFilesLC() + CleanupStack::PopAndDestroy(); + + if ( canExit ) + { + HandleCommandL( EEikCmdExit ); + } + else + { + // Wait until file service has completed + // transfering filename array back to client + if( !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); // CSI: 10 # + } + } + } + break; + } + + default: + { + break; + } + } + } + +// --------------------------------------------------------------------------- +// CVRAppUi::SelectionProviderL +// +// --------------------------------------------------------------------------- +// +MVRSelectionProvider* CVRAppUi::SelectionProviderL() + { + return reinterpret_cast< CVRRecView* >( iView ); + } + +// --------------------------------------------------------------------------- +// CVRAppUi::HandleResourceChangeL +// +// --------------------------------------------------------------------------- +// +void CVRAppUi::HandleResourceChangeL( TInt aType ) + { + CAknViewAppUi::HandleResourceChangeL( aType ); + + if (iLayoutChangeObserver != NULL && (aType == KEikDynamicLayoutVariantSwitch || aType + == KAknsMessageSkinChange)) + { + iLayoutChangeObserver->LayoutChangedL(aType); + } + } + +// --------------------------------------------------------------------------- +// CVRAppUi::RecordNewFileL +// +// --------------------------------------------------------------------------- +// +void CVRAppUi::RecordNewFileL( RFile& aFile, MVREmbeddedObserver* aObserver ) + { + if ( aObserver ) + { + iEmbeddedObserver = aObserver; + + if ( aFile.SubSessionHandle() != 0) + { + // Pass file handle to recview + SelectionProviderL()->SetFileHandle( aFile ); + } + } + } + +// --------------------------------------------------------------------------- +// CVRAppUi::ProcessCommandParametersL +// +// --------------------------------------------------------------------------- +// +TBool CVRAppUi::ProcessCommandParametersL( TApaCommand /*aCommand*/, + TFileName& aDocumentName, const TDesC8& aTail ) + { + + // Check if we got "-record" as command line parameter + // convert 8-bit descriptor to a 16-bit one without altering data. + const TUint16* ptr16 = reinterpret_cast (aTail.Ptr()); + TPtrC16 tail(ptr16, aTail.Size() >> 1); + + if (aDocumentName.Compare(KVRCommandRecord) == 0 || tail.Compare( + KVRCommandRecord) == 0) + { + // Enter recording context + ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid( + EContextRecordNewNormal), KNullDesC8); + return EFalse; + } + else // No record parameter, start normally + { + ActivateLocalViewL(TUid::Uid(KVRRecorderViewUID), TUid::Uid( + EContextEmptyNormal), KNullDesC8); + } + + if ( !ConeUtils::FileExists( aDocumentName ) ) + { + aDocumentName.Copy( aTail ); + } + return ConeUtils::FileExists( aDocumentName ); + } + +// --------------------------------------------------------------------------- +// CVRAppUi::HandleApplicationSpecificEventL +// +// --------------------------------------------------------------------------- +// +void CVRAppUi::HandleApplicationSpecificEventL(TInt aType, + const TWsEvent& aEvent) + { + if( aType == EAknSoftkeyExit || aType == KAknShutOrHideApp) + { + Exit(); + } + CEikAppUi::HandleApplicationSpecificEventL(aType, aEvent); + } + +// --------------------------------------------------------------------------- +// CVRAppUi::SetEmbeddedObserver +// +// --------------------------------------------------------------------------- +// +void CVRAppUi::SetEmbeddedObserver( MVREmbeddedObserver* aObserver ) + { + iEmbeddedObserver = aObserver; + } + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRAppUi.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2002 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 class is a part of the standard application framework. +* It instantiates the application views. +* It also acts as the default command handler for the application. +* +*/ + + +#ifndef __CVRAPPUI_H__ +#define __CVRAPPUI_H__ + +// INCLUDES +#include +#include // MApaEmbeddedDocObserver + +#include "MVREmbeddedObserver.h" +#include "VRUSBStateHanlder.h" +// FORWARD DECLARATIONS +class MVRSelectionProvider; +class CErrorUI; +class MVRLayoutChangeObserver; +class CAknWaitDialog; + +// CLASS DECLARATION +/** +* This class is a part of the standard application framework. +* It instantiates the application views. +* It also acts as the default command handler for the application. +*/ +class CVRAppUi + : public CAknViewAppUi + { + public: // Constructors and destructor + + /** + * Default constructor. + */ + CVRAppUi(); + + /** + * Destructor. + */ + ~CVRAppUi(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + /** + * Receive file handle and observer for recording + * for file new service + * @param aFile File handle + * @param aObserver Observer for handing events back to file service + */ + void RecordNewFileL( RFile& aFile, MVREmbeddedObserver* aObserver ); + + /** + * Method for setting observer for file new service + * @param aObserver Observer for handing events back to file service + */ + void SetEmbeddedObserver( MVREmbeddedObserver* aObserver ); + + private: // from CEikAppUi + + /** + * Takes care of command handling. + * @param aCommand Command to be handled + */ + void HandleCommandL( TInt aCommand ); + + /** + * Handles a change to the application's resources + * @param aType The type of changed resource + */ + void HandleResourceChangeL( TInt aType ); + + /** + * CEikAppUi::ProcessCommandParametersL() is overwritten here, because + * otherwise it messes with the document name. + * @param aCommand The shell command sent to the application + * @param aDocumentName The document name that will be given to OpenFileL() + * @param aTail The rest of the command line + * @return Whether the final document name represents an existing file + */ + TBool ProcessCommandParametersL( TApaCommand aCommand, + TFileName& aDocumentName, const TDesC8& aTail ); + + /** + * Handles events from window group + * @param aType The type of event + */ + + void HandleApplicationSpecificEventL(TInt aType, const TWsEvent& aEvent); + + private: // from MVRUSBEventObserver + void HandleUSBEventL(); + + private: // new methods + + /** + * Provides access to the current view's MVRSelectionProvider + * interface. + * @return pointer to the active view as MVRSelectionProvider. + */ + MVRSelectionProvider* SelectionProviderL(); + + private: // data + /** + * CActiveScheduler wrapper object. Owned. + */ + CActiveSchedulerWait iActiveWait; + + /** + * Owned: CErrorUI object used to display notes when errors occur + * in embedded activation + */ + CErrorUI* iErrorUI; + + /** + * Pointer to object that observers layout changes and forwards + * notification to all UI controls + */ + MVRLayoutChangeObserver* iLayoutChangeObserver; + + /** + * Pointer to embedded observer which is notified (if not null) when + * embedded recording is ready + */ + MVREmbeddedObserver* iEmbeddedObserver; + + /* + * For help context, whether settings page is active. + */ + TBool iIsSettingsOpen; + + + }; + +#endif // __CVRAPPUI_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRApplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRApplication.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002 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 class is a part of the standard application framework. +* The application gets instantiated starting from this class. +* Provides a factory method for instantiating the document object. +* +*/ + + +#include +#include "CVRApplication.h" +#include "CVRAppServer.h" +#include "CVRDocument.h" + +TUid CVRApplication::AppDllUid() const + { + return KVRAppUID; + } + +CApaDocument* CVRApplication::CreateDocumentL() + { + return CVRDocument::NewL( *this ); + } + +LOCAL_C CApaApplication* NewApplication() + { + return new CVRApplication; + } + +void CVRApplication::NewAppServerL( CApaAppServer*& aAppServer ) + { + aAppServer = new( ELeave ) CVRAppServer; + } + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication( NewApplication ); + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRApplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRApplication.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002-2006 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 class is a part of the standard application framework. +* The application gets instantiated starting from this class. +* Provides a factory method for instantiating the document object. +* +*/ + + +#ifndef CVRAPPLICATION_H +#define CVRAPPLICATION_H + +// INCLUDES +#include +#include + +// CONSTANTS +const TUid KVRAppUID = { KVoiceRecorderAppUID3 }; + +// CLASS DECLARATION +/** +* This class is a part of the standard application framework. +* The application gets instantiated starting from this class. +* Provides a factory method for instantiating the document object. +*/ +class CVRApplication + : public CAknApplication + { + + private: // from CApaApplication + + /** + * Creates a CVRDocument instance. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * Returns application's UID value. + * @return KVRAppUID. + */ + TUid AppDllUid() const; + + /** + * Returns a pointer to first-stage constructed server + * @ return A pointer to AppServer object + */ + void NewAppServerL( CApaAppServer*& aAppServer ); + }; + +#endif // CVRAPPLICATION_H + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRDocument.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 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 class is a part of the standard application framework. +* Declares the document class for this application. +* +*/ + + +#include "CVRDocument.h" +#include "CVRAppUi.h" + +CVRDocument::~CVRDocument() + { + } + +CVRDocument* CVRDocument::NewL( CEikApplication& aApp ) + { + CVRDocument* self = new( ELeave ) CVRDocument( aApp ); + return self; + } + +CEikAppUi* CVRDocument::CreateAppUiL() + { + return new( ELeave ) CVRAppUi; + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRDocument.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002 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 class is a part of the standard application framework. +* Declares the document class for this application. +* +*/ + + +#ifndef __CVRDOCUMENT_H__ +#define __CVRDOCUMENT_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CEikAppUi; + +// CLASS DECLARATION +/** +* This class is a part of the standard application framework. +* Declares the document class for this application. +*/ +class CVRDocument + : public CMediaSharedDocument + { + public: // Constructors and destructor + + /** + * Destructor. + */ + ~CVRDocument(); + + /** + * Static two-phased constructor. + * @param aApp Reference to the application object. + */ + static CVRDocument* NewL( CEikApplication& aApp ); + + private: + + /** + * Default constructor. Private, not implemented. + */ + CVRDocument(); + + /** + * Constructor. Inlined to save a few bytes. + * @param aApp Reference to the application object. + */ + inline CVRDocument( CEikApplication& aApp ) + : CMediaSharedDocument( aApp ) {} + + private: // from CEikDocument + + /** + * Instantiates the application UI class. + * @return CCnvAppUi object instance. + */ + CEikAppUi* CreateAppUiL(); + + }; + +#endif // __CVRDOCUMENT_H__ + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRNewFileService.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRNewFileService.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,150 @@ +/* +* Copyright (c) 2002 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 class is part of new file service framework. +* +*/ + + +#include "CVRNewFileService.h" +#include "CVRAppUi.h" +#include +#include +#include +#include + +#include "voicerecorder.hrh" + +CVRNewFileService* CVRNewFileService::NewL() + { + return new( ELeave ) CVRNewFileService; + } + +CVRNewFileService::CVRNewFileService() +: iCompleted( EFalse ), iFileHandleUsed( EFalse ) + { + + } + +CVRNewFileService::~CVRNewFileService() + { + // Make sure that appui wont use this deleted class + CVRAppUi* appUi( static_cast (CEikonEnv::Static() + ->EikAppUi() ) ); + if ( appUi ) + { + appUi->SetEmbeddedObserver( NULL ); + } + + if ( !iCompleted) + { + if ( iObserver ) + { + // Can't leave in destructor + TRAP_IGNORE( iObserver->HandleCompletedNewServiceL( EFalse ) ); + iCompleted = ETrue; + } + } + } + +void CVRNewFileService::HandleNewFileL( MNewFileServiceObserver* aObserver, + CDesCArray& aFilenameArray, + TNewServiceFileType aType, + TBool /*aMultipleFiles*/ ) + { + RFile dummyFile; + + iFilenameArray = &aFilenameArray; + iObserver = aObserver; + + if ( aType != ENewFileServiceAudio ) + { + iCompleted = ETrue; + aObserver->HandleCompletedNewServiceL( EFalse ); + + // Send NULL to AppUi as observer, AppUi exits + + ( static_cast (CEikonEnv::Static()->EikAppUi() ) ) + ->RecordNewFileL( dummyFile, NULL ); + return; + } + + // Send message to AppUi to fully construct application + ( static_cast (CEikonEnv::Static()->EikAppUi() ) ) + ->RecordNewFileL( dummyFile, this ); + + } + +void CVRNewFileService::HandleNewFileL( MNewFileServiceObserver* aObserver, + RFile& aFile, + TNewServiceFileType aType ) + { + iObserver = aObserver; + + if ( aType != ENewFileServiceAudio ) + { + iCompleted = ETrue; + aObserver->HandleCompletedNewServiceL( EFalse ); + + // Send NULL to AppUi as observer, AppUi exits + RFile dummyFile; + ( static_cast (CEikonEnv::Static()->EikAppUi() ) ) + ->RecordNewFileL( dummyFile, NULL ); + return; + } + + iFileHandleUsed = ETrue; + + // Send the file handle to application and finish ui construction + ( static_cast (CEikonEnv::Static()->EikAppUi() ) ) + ->RecordNewFileL( aFile, this ); + } + +TBool CVRNewFileService::FileCompleteL( const TDesC& aName ) + { + if ( iFilenameArray ) + { + iFilenameArray->AppendL( aName ); + } + + iCompleted = ETrue; + iObserver->HandleCompletedNewServiceL( ETrue ); + + // Notify the appui + if ( iFileHandleUsed ) + { + // Application can be closed immediately + return ETrue; + } + + // Application waits for ECmdNewFileServiceNotify before it quits + // File service needs to transfer filenames back to client first + return EFalse; + } + +void CVRNewFileService::ServiceCompleteL() + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( ECmdNewFileServiceNotify ); + } + +void CVRNewFileService::AbortL() + { + if ( !iCompleted ) + { + iCompleted = ETrue; + iObserver->HandleCompletedNewServiceL( EFalse ); + } + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRNewFileService.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRNewFileService.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002 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 class is part of new file service framework. +* +*/ + + +#ifndef __CVRNEWFILESERVICE_H__ +#define __CVRNEWFILESERVICE_H__ + +// INCLUDES +#include +#include "MVREmbeddedObserver.h" + +// CONSTANTS + +// CLASS DECLARATION +/** +* This class is part of new file service framework. +*/ +class CVRNewFileService + : public CNewFileServiceBase, public MVREmbeddedObserver + { + + public: + static CVRNewFileService* NewL(); + ~CVRNewFileService(); + + /* + * Receive message from service to record new files + */ + void HandleNewFileL( MNewFileServiceObserver* aObserver, + CDesCArray& aFilenameArray, + TNewServiceFileType aType, + TBool aMultipleFiles ); + /* + * Receive message from service to record new file into file handle + */ + void HandleNewFileL( MNewFileServiceObserver* aObserver, + RFile& aFile, + TNewServiceFileType aType ); + + /* + * Receive message from service that file service has completed + * and can be closed + */ + void ServiceCompleteL(); + + public: // MVREmbeddedObserver + /* + * Receive comand from application that file named aName has been recorded + * @param aName The name of the recorded file + * @return Can the application be closed or should we wait + */ + virtual TBool FileCompleteL( const TDesC& aName ); + + /* + * Receive command from application that file service must be aborted + */ + void AbortL(); + + private: + CVRNewFileService(); + + private: // data + /* + * Pointer to file service observer + */ + MNewFileServiceObserver* iObserver; + + /* + * If file service has already completed + */ + TBool iCompleted; + + /* + * Are we recording to file handle or filenamearray + */ + TBool iFileHandleUsed; + + /* + * Contains name of the target file. Not owned. + */ + CDesCArray* iFilenameArray; + + /* + * Used for asynchronic operations + */ + CActiveSchedulerWait iActiveWait; + + }; + +#endif // __CVNEWFILESERVICE_H__ + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRSettingItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRSettingItem.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2003, 2004 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: Setting item for default image/video name +* +*/ + + +// INCLUDE FILES +#include "CVRSettingItem.h" +#include + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CCVRSettingItem::CCVRSettingItem +// C++ constructor +// --------------------------------------------------------------------------- +// +CCVRSettingItem::CCVRSettingItem( TInt aIdentifier,TDes& aText ) +: CAknTextSettingItem( aIdentifier, aText ) + { + } + + +// Destructor +CCVRSettingItem::~CCVRSettingItem() + { + } + + +// --------------------------------------------------------------------------- +// CCVRSettingItem::EditItemL +// This launches the setting page for text editing. Overridden here +// to use CCVRSettingPage instead of CAknTextSettingPage. +// --------------------------------------------------------------------------- +// +void CCVRSettingItem::EditItemL( TBool /* aCalledFromMenu */ ) + { + } + + + /** + * Access for re-implementors to the internal text + * + * @return reference to a TPtr holding the internal text + */ + TPtr& CCVRSettingItem::InternalTextPtr() + { + return CAknTextSettingItem::InternalTextPtr(); + } + + /** + * Access for re-implementors to the external text + * + * @return TPtrC pointing to the external text + */ + TPtrC CCVRSettingItem::ExternalText() + { + return CAknTextSettingItem::ExternalText(); + } + + /** + * Allows re-implementors to set the external text + * No change of ownership is implied. + * + * @param a reference to the external text + * + */ + void CCVRSettingItem:: SetExternalText( TDesC& aNewExternalText ) + { + CAknTextSettingItem::SetExternalText(aNewExternalText); + } + + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRSettingItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRSettingItem.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2003, 2004 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: Setting item for memory settings +* +*/ + + +#ifndef CCVRSETTINGITEM_H +#define CCVRSETTINGITEM_H + +// INCLUDES +#include +#include + +// CLASS DECLARATION + +/** +* Setting item for name base setting +*/ +class CCVRSettingItem : public CAknTextSettingItem + { + public: // Constructors and destructor + /** + * C++ constructor + * @param aIdentifier identifier ID + * @param aText text related to identifier + * @since 3.1 + */ + CCVRSettingItem( TInt aIdentifier, TDes& aText ); + + /** + * Access for re-implementors to the internal text + * + * @return reference to a TPtr holding the internal text + */ + TPtr& InternalTextPtr(); + + /** + * Access for re-implementors to the external text + * + * @return TPtrC pointing to the external text + */ + TPtrC ExternalText(); + + /** + * Allows re-implementors to set the external text + * No change of ownership is implied. + * + * @param a reference to the external text + * + */ + void SetExternalText( TDesC& aNewExternalText ); + /** + * Destructor + */ + virtual ~CCVRSettingItem(); + + private: // Functions from base classes + /** + * From CAknTextSettingItem. + * This launches the setting page for text editing. Overridden here + * to use CCVRSettingPage instead of CAknTextSettingPage. + * + * @param aCalledFromMenu - ignored in this class + */ + void EditItemL( TBool aCalledFromMenu ); + + }; + + +#endif diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRSettingsDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRSettingsDialog.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2002 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 class defines a settings dialog for the Voice Recorder application. +* +*/ + + +#include + +#include +#include +#include +#include "CVRSettingsDialog.h" +#include "VoiceRecorder.hrh" +#include +#include "VRConsts.h" +#include "VRUtils.h" + +CVRSettingsDialog::~CVRSettingsDialog() + { + iSettingItemArray.ResetAndDestroy(); + } + +CVRSettingsDialog* CVRSettingsDialog::NewL() + { + CVRSettingsDialog* self = new( ELeave ) CVRSettingsDialog; + CleanupStack::PushL( self ); + self->ConstructL( R_VR_SETTINGS_MENUBAR ); + CleanupStack::Pop(); + return self; + } + +TBool CVRSettingsDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOptions ) + { + DisplayMenuL(); + return EFalse; + } + + TInt settingItemCount( iSettingItemArray.Count() ); + + for ( TInt i( 0 ); i < settingItemCount; i++ ) + { + iSettingItemArray.At( i )->StoreL(); + } + + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + // Save the quality setting + VRUtils::SetQualityL( iQuality ); + } + + return ETrue; + } + +void CVRSettingsDialog::PreLayoutDynInitL() + { + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + iQuality = VRUtils::QualityL(); + } + + CAknSettingStyleListBox* listBox = static_cast< CAknSettingStyleListBox* > + ( Control( EVRSettingsListboxId ) ); + User::LeaveIfNull( listBox ); + + CAknSettingItem* settingItem; + HBufC* itemTitle = NULL; + TInt id( 0 ); + + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + // Add quality setting + settingItem = new( ELeave ) CAknBinaryPopupSettingItem( 0, ( TInt& ) iQuality ); + CleanupStack::PushL( settingItem ); + + itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_QUALITY ); + settingItem->ConstructL( EFalse, id, *itemTitle, NULL, + R_VR_SETTINGS_DEFAULT_SPEAKER_PAGE, EAknCtPopupField, NULL, + R_VR_SETTINGS_QUALITY_TEXTS ); + CleanupStack::PopAndDestroy(); // itemTitle + + // Add quality item to the settings array + iSettingItemArray.AppendL( settingItem ); + CleanupStack::Pop(); // settingItem + id++; + } + + CTextListBoxModel* model = listBox->Model(); + model->SetItemTextArray( &iSettingItemArray ); + // Ownership retained by us + model->SetOwnershipType( ELbmDoesNotOwnItemArray ); + + iSettingItemArray.RecalculateVisibleIndicesL(); + listBox->CreateScrollBarFrameL( ETrue ); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + listBox->HandleItemAdditionL(); + listBox->SetListBoxObserver( this ); + listBox->UpdateScrollBarsL(); + + } + +void CVRSettingsDialog::HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ) + { + TInt index( aListBox->CurrentItemIndex() ); + if ( index >=0 ) // index is -1 if there are no items in the list + { + iSettingItemArray.At( index )->EditItemL( + aEventType == EEventEditingStarted ); + aListBox->DrawItem( index ); + } + } + +void CVRSettingsDialog::ProcessCommandL( TInt aCommandId ) + { + HideMenu(); + switch ( aCommandId ) + { + case ECmdChange: + { + CEikListBox* listBox = static_cast< CEikListBox* >( Control( EVRSettingsListboxId ) ); + HandleListBoxEventL( listBox, EEventEditingStarted ); + break; + } + case EEikCmdExit: + { + TryExitL( EAknSoftkeyBack ); + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + default: + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::DynInitMenuPaneL +// +// --------------------------------------------------------------------------- +// +void CVRSettingsDialog::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + + switch ( aResourceId ) + { + case R_VR_SETTINGS_MENUPANE: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + break; + } + default: + { + break; + } + } + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRSettingsDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRSettingsDialog.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2002 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 class defines a settings dialog for the Voice Recorder application. +* +*/ + + +#ifndef __CVRSETTINGSDIALOG_H__ +#define __CVRSETTINGSDIALOG_H__ + +// INCLUDES +#include +#include +#include "VRUtils.h" + +#include + +// CLASS DECLARATION + +/** +* This class defines a settings dialog for the Voice Recorder application. +*/ +class CVRSettingsDialog + : public CAknDialog, + public MEikListBoxObserver + { + + public: // Constructors and destructor + + /** + * Destructor. + */ + ~CVRSettingsDialog(); + + /** + * Two-phased constructor. + */ + static CVRSettingsDialog* NewL(); + + private: // Constructors + + /** + * Default constructor. Inlined to save a few bytes. + * Parameters to array: granularity, isnumered, 1st ordinal + */ + inline CVRSettingsDialog() : iSettingItemArray( 1, EFalse, 1 ) {} + + protected: // from CEikDialog + + /** + * Tests if it is OK to exit the dialog. + * @param aButtonId The ID of the button that was activated. + * @return ETrue to validate and exit the dialog, + * EFalse to keep the dialog active. + */ + TBool OkToExitL( TInt aButtonId ); + + /** + * Pre-layout dialog initialisation. + */ + void PreLayoutDynInitL(); + + void ProcessCommandL( TInt aCommandId ); + + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + public: // From MEikListBoxObserver + + /** + * Handles list box events. + * This is invoked by CEikListBox to notify the observer of + * list box events. + * @param aListBox The originating list box. + * @param aEventType A code for the event. + */ + void HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ); + + private: // data + + /** + * Array of setting items contained in the listbox. Owned. + */ + CAknSettingItemArray iSettingItemArray; + + TVRQuality iQuality; + }; + +#endif // __CVRSETTINGSDIALOG_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRSettingsDialogMMCSupported.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRSettingsDialogMMCSupported.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,387 @@ +/* +* Copyright (c) 2002-2006 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 class defines a settings dialog for the Voice Recorder application. +* +*/ + +#include + +#include +#include +#include "CVRSettingsDialogMMCSupported.h" +#include "voicerecorder.hrh" +#include +#include "VRConsts.h" +#include "VRUtils.h" +#include + +#include +#include +#include +#include + +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#include +#include +#endif + +// ListBox item index +enum TListItemIndex + { + EListItemQualityIndex = 0, + ElistItemMemoStoreIndex, + }; +// --------------------------------------------------------------------------- +// CVRSettingsDialog::~CVRSettingsDialog +// +// --------------------------------------------------------------------------- +// +CVRSettingsDialog::~CVRSettingsDialog() + { + iSettingItemArray.ResetAndDestroy(); + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::CVRSettingsDialog +// +// --------------------------------------------------------------------------- +// +CVRSettingsDialog* CVRSettingsDialog::NewL() + { + CVRSettingsDialog* self = new( ELeave ) CVRSettingsDialog; + CleanupStack::PushL( self ); + self->ConstructL( R_VR_SETTINGS_MENUBAR ); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::OkToExitL +// +// --------------------------------------------------------------------------- +// +TBool CVRSettingsDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOptions ) + { + DisplayMenuL(); + return EFalse; + } + + // If want to exit settings afterwards + TBool exitAfter( ETrue ); + + // MSK button pressed in settings view + if ( aButtonId == ECmdMSK ) + { + // A new key event is simulated + TKeyEvent key; + key.iRepeats = 0; + key.iCode = EKeyEnter; + key.iModifiers = 0; + CEikonEnv::Static()->SimulateKeyEventL( key, EEventKey ); + + + exitAfter = EFalse; // No Exit + } + // Do not store settings anymore when exit + return exitAfter; + } + + + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::PreLayoutDynInitL +// Intialize layout +// --------------------------------------------------------------------------- +// +void CVRSettingsDialog::PreLayoutDynInitL() + { + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + iQuality = VRUtils::QualityL(); + } + // Convert the internal memory enumeration to CFD enumeration +#ifndef RD_MULTIPLE_DRIVE + if ( VRUtils::MemoStoreL() == EMemoStorePhoneMemory ) + { + iMemoStore = CAknMemorySelectionSettingPage::EPhoneMemory; + } + else + { + iMemoStore = CAknMemorySelectionSettingPage::EMemoryCard; + } + + // for multiple drives +#else + iDrive = (TDriveNumber)VRUtils::MemoDriveL(); + +#endif + + CAknSettingStyleListBox* listBox = static_cast< CAknSettingStyleListBox* > + ( Control( EVRSettingsListboxId ) ); + User::LeaveIfNull( listBox ); + CAknSettingItem* settingItem; + + HBufC* itemTitle; + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + // Add quality setting +#ifdef __AAC_ENCODER_PLUGIN + settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem ( 0, ( TInt& ) iQuality ); + +#else + settingItem = new( ELeave ) CAknBinaryPopupSettingItem ( 0, ( TInt& ) iQuality ); +#endif + + CleanupStack::PushL( settingItem ); + + itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_QUALITY ); + settingItem->ConstructL( EFalse, EListItemQualityIndex, *itemTitle, NULL, + R_VR_SETTINGS_DEFAULT_SPEAKER_PAGE, EAknCtPopupField, NULL, + R_VR_SETTINGS_QUALITY_TEXTS ); + CleanupStack::PopAndDestroy(); // itemTitle + + // Add quality item to the settings array + iSettingItemArray.AppendL( settingItem ); + CleanupStack::Pop(); // settingItem + } + + if ( VRUtils::MultipleMassStorageAvailable() ) + { + // Create the memo store item + // Set memo store item's title + + itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_STORE ); +#ifndef RD_MULTIPLE_DRIVE + settingItem = new( ELeave ) CAknMemorySelectionSettingItem( 0, iMemoStore ); + CleanupStack::PushL( settingItem ); + settingItem->ConstructL( EFalse, id, *itemTitle, NULL, + R_VOREC_MEMORY_SELECTION_DIALOG, EAknCtPopupSettingList ); + // Add memo store item to the settings array + iSettingItemArray.AppendL( settingItem ); + id++; + CleanupStack::Pop(); // settingItem + +#else //multiple drives + settingItem = new( ELeave ) CAknMemorySelectionSettingItemMultiDrive(0, iDrive ); + CleanupStack::PushL( settingItem ); + TInt includedMedias = AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage | + AknCommonDialogsDynMem::EMemoryTypeMMCExternal; + static_cast< CAknMemorySelectionSettingItemMultiDrive *> ( settingItem )->SetIncludedMediasL( includedMedias ); + // Set memo store item's title + settingItem->ConstructL( EFalse, ElistItemMemoStoreIndex, *itemTitle, NULL, 0, EAknSetListBox ); + // Add memo store item to the settings array + iSettingItemArray.AppendL( settingItem ); + CleanupStack::Pop(); // settingItem + +#endif + + CleanupStack::PopAndDestroy(); // itemTitle + } + CTextListBoxModel* model = listBox->Model(); + model->SetItemTextArray( &iSettingItemArray ); + // Ownership retained by us + model->SetOwnershipType( ELbmDoesNotOwnItemArray ); + + iSettingItemArray.RecalculateVisibleIndicesL(); + listBox->CreateScrollBarFrameL( ETrue ); + listBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + listBox->HandleItemAdditionL(); + listBox->SetListBoxObserver( this ); + listBox->UpdateScrollBarsL(); + + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::HandleListBoxEventL +// +// --------------------------------------------------------------------------- +// +void CVRSettingsDialog::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType) + { + + switch ( aEventType ) + { +#ifdef SINGLE_CLICK_INCLUDED + case EEventItemSingleClicked: +#endif + case EEventItemDoubleClicked: // Pointer events (highlighted item before pressing) + case EEventEnterKeyPressed: // Normal button presses + case EEventEditingStarted: // From ProcessCommand->ECmdChange + { + TInt index( aListBox->CurrentItemIndex() ); + TInt driveDefaultMassStorage = VRUtils::DefaultMemoDriveL(); + TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); + + if ( index >=0 ) // index is -1 if there are no items in the list + { + if(index == ElistItemMemoStoreIndex && + !VRUtils::DriveValid(driveDefaultMassStorage) && + !VRUtils::DriveValid(driveRemovableMassStorage) ) + { + break; + } + iSettingItemArray.At( index )->EditItemL( + aEventType == EEventEditingStarted ); + aListBox->DrawItem( index ); + } + StoreAllSettingsL(); + break; + } + default: + { + break; + } + } + + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::ProcessCommandL +// +// --------------------------------------------------------------------------- +// +void CVRSettingsDialog::ProcessCommandL( TInt aCommandId ) + { + HideMenu(); + switch ( aCommandId ) + { + case ECmdChange: + { + CEikListBox* listBox = static_cast< CEikListBox* >( Control( EVRSettingsListboxId ) ); + HandleListBoxEventL( listBox, EEventEditingStarted ); + StoreAllSettingsL(); + break; + } + case EEikCmdExit: + { + TryExitL( EEikCmdExit ); + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + default: + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + } + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::StoreAllSettingsL +// Stores values in settings list to permanent storage +// --------------------------------------------------------------------------- +// +void CVRSettingsDialog::StoreAllSettingsL() + { + + TInt settingItemCount( iSettingItemArray.Count() ); + + for ( TInt i( 0 ); i < settingItemCount; i++ ) + { + iSettingItemArray.At( i )->StoreL(); + } + +#ifndef RD_MULTIPLE_DRIVE + if ( iMemoStore == CAknMemorySelectionSettingPage::EPhoneMemory ) + { + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + else + { + // check if MMC is read-only + TVRDriveInfo mmcInfo; + VRUtils::GetMMCInfo( mmcInfo ); + + if ( mmcInfo.iDriveReadOnly ) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC( + R_QTN_MEMC_READONLY ); + CAknInformationNote* infoNote = + new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy(); // noteText + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + else + { + VRUtils::SetMemoStoreL( EMemoStoreMMC ); + } + } + + // for multiple drives +#else + TUint status( 0 ); + TInt defaultDrive = VRUtils::DefaultMemoDriveL(); + if (VRUtils::MemoDriveL() != defaultDrive) + { + VRUtils::GetDriveInfo(iDrive, status); + // check if drive status is ok + if ( status & DriveInfo::EDriveReadOnly ) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC(R_QTN_MEMC_READONLY ); + CAknInformationNote* infoNote = new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy(); // noteText + + // use default device drive to save files + iDrive = (TDriveNumber)defaultDrive; + } + } + if(iDrive == defaultDrive || iDrive == VRUtils::GetRemovableMassStorageL()) + { + VRUtils::SetMemoDriveL( iDrive ); + } +#endif + + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + // Save the quality setting + VRUtils::SetQualityL( iQuality ); + } + } + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::DynInitMenuPaneL +// +// --------------------------------------------------------------------------- +// +void CVRSettingsDialog::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + + switch ( aResourceId ) + { + case R_VR_SETTINGS_MENUPANE: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + break; + } + default: + { + break; + } + } + } + + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/CVRSettingsDialogMMCSupported.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/CVRSettingsDialogMMCSupported.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2002 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 class defines a settings dialog for the Voice Recorder application. +* +*/ + + +#ifndef __CVRSETTINGSDIALOG_H__ +#define __CVRSETTINGSDIALOG_H__ + +// INCLUDES + +#include +#include +#include "VRUtils.h" +#include "CVRSettingItem.h" + + +#include +#include + +// CLASS DECLARATION + +/** +* This class defines a settings dialog for the Voice Recorder application. +*/ +class CVRSettingsDialog + : public CAknDialog, + public MEikListBoxObserver + { + + public: // Constructors and destructor + + /** + * Destructor. + */ + ~CVRSettingsDialog(); + + /** + * Two-phased constructor. + */ + static CVRSettingsDialog* NewL(); + + private: // Constructors + + /** + * Default constructor. Inlined to save a few bytes. + * Parameters to array: granularity, isnumered, 1st ordinal + */ + + inline CVRSettingsDialog() : iSettingItemArray( 1, EFalse, 1 ){} + + protected: // from CEikDialog + + /** + * Tests if it is OK to exit the dialog. + * @param aButtonId The ID of the button that was activated. + * @return ETrue to validate and exit the dialog, + * EFalse to keep the dialog active. + */ + TBool OkToExitL( TInt aButtonId ); + + /** + * Pre-layout dialog initialisation. + */ + void PreLayoutDynInitL(); + + void ProcessCommandL( TInt aCommandId ); + + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + public: // From MEikListBoxObserver + + + /** + * Handles list box events. + * This is invoked by CEikListBox to notify the observer of + * list box events. + * @param aListBox The originating list box. + * @param aEventType A code for the event. + */ + void HandleListBoxEventL( CEikListBox* aListBox, + TListBoxEvent aEventType ); + + private: //new methods + + /** + * Stores all settings to Central Repository when called + */ + void StoreAllSettingsL(); + + private: // data + + /** + * Array of setting items contained in the listbox. Owned. + */ + + CAknSettingItemArray iSettingItemArray; + + /** + * Selected memo store + */ + CAknMemorySelectionDialog::TMemory iMemoStore; + + /** + * Selected memo quality + */ + TVRQuality iQuality; + + /** + * Multiple drives + */ + TDriveNumber iDrive; + + + }; + +#endif // __CVRSETTINGSDIALOG_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/MVREmbeddedObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/MVREmbeddedObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2002 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: +* An observer class used to notify objects that embedded recording +* was completed +* +*/ + + +#ifndef MVREMBEDDEDOBSERVER_H +#define MVREMBEDDEDOBSERVER_H + +// INCLUDES +#include + +// CLASS DECLARATION +/** +* An observer class used to notify objects that embedded recording +* was completed +*/ +class MVREmbeddedObserver + { + + public: // new methods + + /** + * This function is called when application wants to notify + * the observer that embedded clip was recorded + * @param aName The name of the file that was recorded + * or EEventKeyDown + * @return Can we close the application + */ + virtual TBool FileCompleteL( const TDesC& aName ) = 0; + + /** + * This function may be used to inform server to abort transfer. + * If operation already has completed, nothing is done. + */ + virtual void AbortL() = 0; + }; + +#endif // MVREMBEDDEDOBSERVER_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/AppSrc/MVRUSBEventObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/AppSrc/MVRUSBEventObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2002-2006 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 class can be used to observe changes that has been happened in +* CVRUSBEventHandler class +* +*/ + + +#ifndef __MVRUSBEVENTOBSERVER_H +#define __MVRUSBEVENTOBSERVER_H + +// INCLUDES +#include +#include + +// CLASS DECLARATION +/** +* MVRUSBEventObserver +*/ +class MVRUSBEventObserver + { + public: // Constructors and destructor + + virtual void HandleUSBEventL() = 0; + + }; + +#endif // __MVRUSBEVENTOBSERVER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/BMARM/VOICERECORDERRECVIEWU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/BMARM/VOICERECORDERRECVIEWU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + NewLC__10CVRRecViewii @ 1 NONAME R3UNUSED ; CVRRecView::NewLC(int, int) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/BMARM/VOICERECORDERUTILSU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/BMARM/VOICERECORDERUTILSU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,15 @@ +EXPORTS + __9TVRRenameR3RFs @ 1 NONAME R3UNUSED ; TVRRename::TVRRename(RFs &) + GetMMCInfo__7VRUtilsR12TVRDriveInfo @ 2 NONAME R3UNUSED ; VRUtils::GetMMCInfo(TVRDriveInfo &) + GetNewNameL__9TVRRenameRC7TDesC16R6TDes16i @ 3 NONAME ; TVRRename::GetNewNameL(TDesC16 const &, TDes16 &, int) + MemoStoreDirectoryL__7VRUtils @ 4 NONAME R3UNUSED ; VRUtils::MemoStoreDirectoryL(void) + MemoStoreL__7VRUtils @ 5 NONAME R3UNUSED ; VRUtils::MemoStoreL(void) + NewL__17CVRFileRecognizer @ 6 NONAME R3UNUSED ; CVRFileRecognizer::NewL(void) + RecognizeL__17CVRFileRecognizerRC7TDesC16 @ 7 NONAME R3UNUSED ; CVRFileRecognizer::RecognizeL(TDesC16 const &) + RenameL__9TVRRenameR6TDes16i @ 8 NONAME R3UNUSED ; TVRRename::RenameL(TDes16 &, int) + SetDefaultSpeakerL__7VRUtils10TVRSpeaker @ 9 NONAME R3UNUSED ; VRUtils::SetDefaultSpeakerL(TVRSpeaker) + SetMemoStoreL__7VRUtils12TVRMemoStore @ 10 NONAME R3UNUSED ; VRUtils::SetMemoStoreL(TVRMemoStore) + "_._17CVRFileRecognizer" @ 11 NONAME R3UNUSED ; CVRFileRecognizer::~CVRFileRecognizer(void) + "_._9TVRRename" @ 12 NONAME R3UNUSED ; TVRRename::~TVRRename(void) + DefaultSpeakerL__7VRUtils @ 13 NONAME R3UNUSED ; VRUtils::DefaultSpeakerL(void) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/BWINS/NewServiceU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/BWINS/NewServiceU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,10 @@ +EXPORTS + ??0CNewFileServiceBase@@IAE@XZ @ 1 NONAME ; CNewFileServiceBase::CNewFileServiceBase(void) + ??1CNewFileServiceBase@@UAE@XZ @ 2 NONAME ; CNewFileServiceBase::~CNewFileServiceBase(void) + ?GenericParams@CNewFileServiceBase@@IAEPAVCAiwGenericParamList@@XZ @ 3 NONAME ; class CAiwGenericParamList * CNewFileServiceBase::GenericParams(void) + ?HandleCompletedNewServiceL@CNewFileServiceBase@@MAEXH@Z @ 4 NONAME ; void CNewFileServiceBase::HandleCompletedNewServiceL(int) + ?NewClientL@NewFileServiceFactory@@SAPAVCNewFileServiceClient@@XZ @ 5 NONAME ; class CNewFileServiceClient * NewFileServiceFactory::NewClientL(void) + ?ServiceL@CNewFileServiceBase@@MAEXABVRMessage2@@@Z @ 6 NONAME ; void CNewFileServiceBase::ServiceL(class RMessage2 const &) + ?GetErrorCode@CNewFileServiceBase@@QAEHXZ @ 7 NONAME ; int CNewFileServiceBase::GetErrorCode(void) + ?SetErrorCode@CNewFileServiceBase@@QAEXH@Z @ 8 NONAME ; void CNewFileServiceBase::SetErrorCode(int) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/BWINS/VOICERECORDERRECVIEWU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/BWINS/VOICERECORDERRECVIEWU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?MrccatoCommand@CVRRemConObserver@@MAEXW4TRemConCoreApiOperationId@@W4TRemConCoreApiButtonAction@@@Z @ 1 NONAME ; void CVRRemConObserver::MrccatoCommand(enum TRemConCoreApiOperationId, enum TRemConCoreApiButtonAction) + ?NewLC@CVRRecView@@SAPAV1@HH@Z @ 2 NONAME ; class CVRRecView * CVRRecView::NewLC(int, int) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/BWINS/VoiceRecorderUtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/BWINS/VoiceRecorderUtilsU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,27 @@ +EXPORTS + ??0TVRRename@@QAE@AAVRFs@@@Z @ 1 NONAME ; TVRRename::TVRRename(class RFs &) + ?AACAudioModeL@VRUtils@@SAHXZ @ 2 NONAME ; int VRUtils::AACAudioModeL(void) + ?AACBitrateL@VRUtils@@SAIXZ @ 3 NONAME ; unsigned int VRUtils::AACBitrateL(void) + ?AACSamplerateL@VRUtils@@SAHXZ @ 4 NONAME ; int VRUtils::AACSamplerateL(void) + ?AMRBitrateL@VRUtils@@SAIXZ @ 5 NONAME ; unsigned int VRUtils::AMRBitrateL(void) + ?DefaultSpeakerL@VRUtils@@SA?AW4TVRSpeaker@@XZ @ 6 NONAME ; enum TVRSpeaker VRUtils::DefaultSpeakerL(void) + ?DefaultVolumeL@VRUtils@@SAHW4TVRSpeaker@@@Z @ 7 NONAME ; int VRUtils::DefaultVolumeL(enum TVRSpeaker) + ?FeatureEnabled@VRUtils@@SAHW4TVRFeature@@@Z @ 8 NONAME ; int VRUtils::FeatureEnabled(enum TVRFeature) + ?GenerateUniqueFilenameL@VRUtils@@SAXAAVRFs@@AAV?$TBuf@$0BAA@@@W4TVRFiletype@@@Z @ 9 NONAME ; void VRUtils::GenerateUniqueFilenameL(class RFs &, class TBuf<256> &, enum TVRFiletype) + ?GetMMCInfo@VRUtils@@SAXAAVTVRDriveInfo@@@Z @ 10 NONAME ; void VRUtils::GetMMCInfo(class TVRDriveInfo &) + ?GetNewNameL@TVRRename@@QAEHABVTDesC16@@AAVTDes16@@H@Z @ 11 NONAME ; int TVRRename::GetNewNameL(class TDesC16 const &, class TDes16 &, int) + ?MaxLengthL@VRUtils@@SAHXZ @ 12 NONAME ; int VRUtils::MaxLengthL(void) + ?MemoCount@VRUtils@@SAHXZ @ 13 NONAME ; int VRUtils::MemoCount(void) + ?MemoStoreDirectoryL@VRUtils@@SAXAAVTDes16@@@Z @ 14 NONAME ; void VRUtils::MemoStoreDirectoryL(class TDes16 &) + ?MemoStoreL@VRUtils@@SA?AW4TVRMemoStore@@XZ @ 15 NONAME ; enum TVRMemoStore VRUtils::MemoStoreL(void) + ?QualityL@VRUtils@@SA?AW4TVRQuality@@XZ @ 16 NONAME ; enum TVRQuality VRUtils::QualityL(void) + ?RenameL@TVRRename@@QAEHAAVRFile@@H@Z @ 17 NONAME ; int TVRRename::RenameL(class RFile &, int) + ?RenameL@TVRRename@@QAEHAAVTDes16@@H@Z @ 18 NONAME ; int TVRRename::RenameL(class TDes16 &, int) + ?SetDefaultSpeakerL@VRUtils@@SAXW4TVRSpeaker@@@Z @ 19 NONAME ; void VRUtils::SetDefaultSpeakerL(enum TVRSpeaker) + ?SetDefaultVolumeL@VRUtils@@SAXW4TVRSpeaker@@H@Z @ 20 NONAME ; void VRUtils::SetDefaultVolumeL(enum TVRSpeaker, int) + ?SetMemoCount@VRUtils@@SAXH@Z @ 21 NONAME ; void VRUtils::SetMemoCount(int) + ?SetMemoStoreL@VRUtils@@SAXW4TVRMemoStore@@@Z @ 22 NONAME ; void VRUtils::SetMemoStoreL(enum TVRMemoStore) + ?SetQualityL@VRUtils@@SAXW4TVRQuality@@@Z @ 23 NONAME ; void VRUtils::SetQualityL(enum TVRQuality) + ?ShowMemoryFullConfirmationQuery@VRUtils@@SAXH@Z @ 24 NONAME ; void VRUtils::ShowMemoryFullConfirmationQuery(int) + ?UnsupportedCallTypeOngoing@VRUtils@@SAHH@Z @ 25 NONAME ; int VRUtils::UnsupportedCallTypeOngoing(int) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/BWINS/VoiceRecorderUtilsUU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/BWINS/VoiceRecorderUtilsUU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,36 @@ +EXPORTS + ??0TVRRename@@QAE@AAVRFs@@@Z @ 1 NONAME ; TVRRename::TVRRename(class RFs &) + ?AACAudioModeL@VRUtils@@SAHXZ @ 2 NONAME ; int VRUtils::AACAudioModeL(void) + ?AACBitrateL@VRUtils@@SAIXZ @ 3 NONAME ; unsigned int VRUtils::AACBitrateL(void) + ?AACSamplerateL@VRUtils@@SAHXZ @ 4 NONAME ; int VRUtils::AACSamplerateL(void) + ?AMRBitrateL@VRUtils@@SAIXZ @ 5 NONAME ; unsigned int VRUtils::AMRBitrateL(void) + ?DefaultMemoDriveL@VRUtils@@SAHXZ @ 6 NONAME ; int VRUtils::DefaultMemoDriveL(void) + ?DefaultSpeakerL@VRUtils@@SA?AW4TVRSpeaker@@XZ @ 7 NONAME ; enum TVRSpeaker VRUtils::DefaultSpeakerL(void) + ?DefaultVolumeL@VRUtils@@SAHW4TVRSpeaker@@@Z @ 8 NONAME ; int VRUtils::DefaultVolumeL(enum TVRSpeaker) + ?FeatureEnabled@VRUtils@@SAHW4TVRFeature@@@Z @ 9 NONAME ; int VRUtils::FeatureEnabled(enum TVRFeature) + ?GenerateUniqueFilenameL@VRUtils@@SAXAAVRFs@@AAV?$TBuf@$0BAA@@@W4TVRFiletype@@@Z @ 10 NONAME ; void VRUtils::GenerateUniqueFilenameL(class RFs &, class TBuf<256> &, enum TVRFiletype) + ?GetMMCInfo@VRUtils@@SAXAAVTVRDriveInfo@@@Z @ 11 NONAME ; void VRUtils::GetMMCInfo(class TVRDriveInfo &) + ?GetNewNameL@TVRRename@@QAEHABVTDesC16@@AAVTDes16@@H@Z @ 12 NONAME ; int TVRRename::GetNewNameL(class TDesC16 const &, class TDes16 &, int) + ?MaxLengthL@VRUtils@@SAHXZ @ 13 NONAME ; int VRUtils::MaxLengthL(void) + ?MemoCount@VRUtils@@SAHXZ @ 14 NONAME ; int VRUtils::MemoCount(void) + ?MemoDriveL@VRUtils@@SAHXZ @ 15 NONAME ; int VRUtils::MemoDriveL(void) + ?MemoStoreDirectoryL@VRUtils@@SAXAAVTDes16@@@Z @ 16 NONAME ; void VRUtils::MemoStoreDirectoryL(class TDes16 &) + ?MemoStoreL@VRUtils@@SA?AW4TVRMemoStore@@XZ @ 17 NONAME ; enum TVRMemoStore VRUtils::MemoStoreL(void) + ?QualityL@VRUtils@@SA?AW4TVRQuality@@XZ @ 18 NONAME ; enum TVRQuality VRUtils::QualityL(void) + ?RenameL@TVRRename@@QAEHAAVRFile@@H@Z @ 19 NONAME ; int TVRRename::RenameL(class RFile &, int) + ?RenameL@TVRRename@@QAEHAAVTDes16@@H@Z @ 20 NONAME ; int TVRRename::RenameL(class TDes16 &, int) + ?SetDefaultSpeakerL@VRUtils@@SAXW4TVRSpeaker@@@Z @ 21 NONAME ; void VRUtils::SetDefaultSpeakerL(enum TVRSpeaker) + ?SetDefaultVolumeL@VRUtils@@SAXW4TVRSpeaker@@H@Z @ 22 NONAME ; void VRUtils::SetDefaultVolumeL(enum TVRSpeaker, int) + ?SetMemoCount@VRUtils@@SAXH@Z @ 23 NONAME ; void VRUtils::SetMemoCount(int) + ?SetMemoDriveL@VRUtils@@SAXW4TDriveNumber@@@Z @ 24 NONAME ; void VRUtils::SetMemoDriveL(enum TDriveNumber) + ?SetMemoStoreL@VRUtils@@SAXW4TVRMemoStore@@@Z @ 25 NONAME ; void VRUtils::SetMemoStoreL(enum TVRMemoStore) + ?SetQualityL@VRUtils@@SAXW4TVRQuality@@@Z @ 26 NONAME ; void VRUtils::SetQualityL(enum TVRQuality) + ?ShowMemoryFullConfirmationQuery@VRUtils@@SAXH@Z @ 27 NONAME ; void VRUtils::ShowMemoryFullConfirmationQuery(int) + ?UnsupportedCallTypeOngoing@VRUtils@@SAHH@Z @ 28 NONAME ; int VRUtils::UnsupportedCallTypeOngoing(int) + ?GetDriveInfo@VRUtils@@SAHHAAI@Z @ 29 NONAME ; int VRUtils::GetDriveInfo(int, unsigned int &) + ?IsUsbActive@CVRUSBStateHanlder@@SAHXZ @ 30 NONAME ; int CVRUSBStateHanlder::IsUsbActive(void) + ?NewL@CVRUSBStateHanlder@@SAPAV1@PAVMVRUSBStateObserver@@@Z @ 31 NONAME ; class CVRUSBStateHanlder * CVRUSBStateHanlder::NewL(class MVRUSBStateObserver *) + ?DriveValid@VRUtils@@SAHH@Z @ 32 NONAME ; int VRUtils::DriveValid(int) + ?MultipleMassStorageAvailable@VRUtils@@SAHXZ @ 33 NONAME ; int VRUtils::MultipleMassStorageAvailable(void) + ?GetRemovableMassStorageL@VRUtils@@SAHXZ @ 34 NONAME ; int VRUtils::GetRemovableMassStorageL(void) + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/Conf/voicerecorder.confml Binary file voicerecorder/Conf/voicerecorder.confml has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/Conf/voicerecorder_101F87A3.crml Binary file voicerecorder/Conf/voicerecorder_101F87A3.crml has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/EABI/NewServiceU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/EABI/NewServiceU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,21 @@ +EXPORTS + _ZN19CNewFileServiceBase13GenericParamsEv @ 1 NONAME + _ZN19CNewFileServiceBase26HandleCompletedNewServiceLEi @ 2 NONAME + _ZN19CNewFileServiceBase8ServiceLERK9RMessage2 @ 3 NONAME + _ZN19CNewFileServiceBaseC2Ev @ 4 NONAME + _ZN19CNewFileServiceBaseD0Ev @ 5 NONAME + _ZN19CNewFileServiceBaseD1Ev @ 6 NONAME + _ZN19CNewFileServiceBaseD2Ev @ 7 NONAME + _ZN21NewFileServiceFactory10NewClientLEv @ 8 NONAME + _ZTI19CNewFileServiceBase @ 9 NONAME ; ## + _ZTI21RNewFileServiceClient @ 10 NONAME ; ## + _ZTI24CNewFileServiceDiscovery @ 11 NONAME ; ## + _ZTI25CNewFileServiceClientImpl @ 12 NONAME ; ## + _ZTV19CNewFileServiceBase @ 13 NONAME ; ## + _ZTV21RNewFileServiceClient @ 14 NONAME ; ## + _ZTV24CNewFileServiceDiscovery @ 15 NONAME ; ## + _ZTV25CNewFileServiceClientImpl @ 16 NONAME ; ## + _ZThn36_N19CNewFileServiceBase26HandleCompletedNewServiceLEi @ 17 NONAME ; ## + _ZN19CNewFileServiceBase12GetErrorCodeEv @ 18 NONAME + _ZN19CNewFileServiceBase12SetErrorCodeEi @ 19 NONAME + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/EABI/VoiceRecorderRecViewU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/EABI/VoiceRecorderRecViewU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,7 @@ +EXPORTS + _ZN10CVRRecView5NewLCEii @ 1 NONAME + _ZTI10CVRRecView @ 2 NONAME ; ## + _ZTV10CVRRecView @ 3 NONAME ; ## + _ZN17CVRRemConObserver14MrccatoCommandE25TRemConCoreApiOperationId26TRemConCoreApiButtonAction @ 4 NONAME + _ZThn4_N17CVRRemConObserver14MrccatoCommandE25TRemConCoreApiOperationId26TRemConCoreApiButtonAction @ 5 NONAME ; ## + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/EABI/VoiceRecorderUtilsU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/EABI/VoiceRecorderUtilsU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,28 @@ +EXPORTS + _ZN7VRUtils10GetMMCInfoER12TVRDriveInfo @ 1 NONAME + _ZN7VRUtils10MaxLengthLEv @ 2 NONAME + _ZN7VRUtils10MemoStoreLEv @ 3 NONAME + _ZN7VRUtils11AACBitrateLEv @ 4 NONAME + _ZN7VRUtils11AMRBitrateLEv @ 5 NONAME + _ZN7VRUtils11SetQualityLE10TVRQuality @ 6 NONAME + _ZN7VRUtils12SetMemoCountEi @ 7 NONAME + _ZN7VRUtils13AACAudioModeLEv @ 8 NONAME + _ZN7VRUtils13SetMemoStoreLE12TVRMemoStore @ 9 NONAME + _ZN7VRUtils14AACSamplerateLEv @ 10 NONAME + _ZN7VRUtils14DefaultVolumeLE10TVRSpeaker @ 11 NONAME + _ZN7VRUtils14FeatureEnabledE10TVRFeature @ 12 NONAME + _ZN7VRUtils15DefaultSpeakerLEv @ 13 NONAME + _ZN7VRUtils17SetDefaultVolumeLE10TVRSpeakeri @ 14 NONAME + _ZN7VRUtils18SetDefaultSpeakerLE10TVRSpeaker @ 15 NONAME + _ZN7VRUtils19MemoStoreDirectoryLER6TDes16 @ 16 NONAME + _ZN7VRUtils23GenerateUniqueFilenameLER3RFsR4TBufILi256EE11TVRFiletype @ 17 NONAME + _ZN7VRUtils26UnsupportedCallTypeOngoingEi @ 18 NONAME + _ZN7VRUtils31ShowMemoryFullConfirmationQueryEi @ 19 NONAME + _ZN7VRUtils8QualityLEv @ 20 NONAME + _ZN7VRUtils9MemoCountEv @ 21 NONAME + _ZN9TVRRename11GetNewNameLERK7TDesC16R6TDes16i @ 22 NONAME + _ZN9TVRRename7RenameLER5RFilei @ 23 NONAME + _ZN9TVRRename7RenameLER6TDes16i @ 24 NONAME + _ZN9TVRRenameC1ER3RFs @ 25 NONAME + _ZN9TVRRenameC2ER3RFs @ 26 NONAME + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/EABI/VoiceRecorderUtilsUU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/EABI/VoiceRecorderUtilsUU.DEF Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,39 @@ +EXPORTS + _ZN7VRUtils10GetMMCInfoER12TVRDriveInfo @ 1 NONAME + _ZN7VRUtils10MaxLengthLEv @ 2 NONAME + _ZN7VRUtils10MemoStoreLEv @ 3 NONAME + _ZN7VRUtils11AACBitrateLEv @ 4 NONAME + _ZN7VRUtils11AMRBitrateLEv @ 5 NONAME + _ZN7VRUtils11SetQualityLE10TVRQuality @ 6 NONAME + _ZN7VRUtils12SetMemoCountEi @ 7 NONAME + _ZN7VRUtils13AACAudioModeLEv @ 8 NONAME + _ZN7VRUtils13SetMemoStoreLE12TVRMemoStore @ 9 NONAME + _ZN7VRUtils14AACSamplerateLEv @ 10 NONAME + _ZN7VRUtils14DefaultVolumeLE10TVRSpeaker @ 11 NONAME + _ZN7VRUtils14FeatureEnabledE10TVRFeature @ 12 NONAME + _ZN7VRUtils15DefaultSpeakerLEv @ 13 NONAME + _ZN7VRUtils17SetDefaultVolumeLE10TVRSpeakeri @ 14 NONAME + _ZN7VRUtils18SetDefaultSpeakerLE10TVRSpeaker @ 15 NONAME + _ZN7VRUtils19MemoStoreDirectoryLER6TDes16 @ 16 NONAME + _ZN7VRUtils23GenerateUniqueFilenameLER3RFsR4TBufILi256EE11TVRFiletype @ 17 NONAME + _ZN7VRUtils26UnsupportedCallTypeOngoingEi @ 18 NONAME + _ZN7VRUtils31ShowMemoryFullConfirmationQueryEi @ 19 NONAME + _ZN7VRUtils8QualityLEv @ 20 NONAME + _ZN7VRUtils9MemoCountEv @ 21 NONAME + _ZN9TVRRename11GetNewNameLERK7TDesC16R6TDes16i @ 22 NONAME + _ZN9TVRRename7RenameLER5RFilei @ 23 NONAME + _ZN9TVRRename7RenameLER6TDes16i @ 24 NONAME + _ZN9TVRRenameC1ER3RFs @ 25 NONAME + _ZN9TVRRenameC2ER3RFs @ 26 NONAME + _ZN7VRUtils10MemoDriveLEv @ 27 NONAME + _ZN7VRUtils12GetDriveInfoEiRj @ 28 NONAME + _ZN7VRUtils13SetMemoDriveLE12TDriveNumber @ 29 NONAME + _ZN7VRUtils17DefaultMemoDriveLEv @ 30 NONAME + _ZN18CVRUSBStateHanlder11IsUsbActiveEv @ 31 NONAME + _ZN18CVRUSBStateHanlder4NewLEP19MVRUSBStateObserver @ 32 NONAME + _ZN7VRUtils10DriveValidEi @ 33 NONAME + _ZTI18CVRUSBStateHanlder @ 34 NONAME + _ZTV18CVRUSBStateHanlder @ 35 NONAME + _ZN7VRUtils28MultipleMassStorageAvailableEv @ 36 NONAME + _ZN7VRUtils24GetRemovableMassStorageLEv @ 37 NONAME + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceInc/CNewFileServiceDiscovery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceInc/CNewFileServiceDiscovery.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2002-2006 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: Class implementing the discovery of New file Service servers +* +*/ + + + +#ifndef CNEWFILESERVICEDISCOVERY_H +#define CNEWFILESERVICEDISCOVERY_H + +// INCLUDES +#include + +/** +* Discovery is not supported +* +* @lib NewService.dll +* @since Series 60 3.0 +*/ +class CNewFileServiceDiscovery : public CBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CNewFileServiceDiscovery* NewL(); + + /** + * Destructor. + */ + virtual ~CNewFileServiceDiscovery(); + + public: // New functions + + private: + + /** + * C++ default constructor. + */ + CNewFileServiceDiscovery(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + }; + +#endif // CNEWFILESERVICEDISCOVERY_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceInc/NewFileService.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceInc/NewFileService.rh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2002-2004 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: Definitions for the API +* +*/ + + +#ifndef NEWFILESERVICE_RH +#define NEWFILESERVICE_RH + + +#endif // NEWFILESERVICE_RH + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceInc/NewFileServiceUID.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceInc/NewFileServiceUID.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2005 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: +* Contains the UID for New file service +* +*/ + + +#ifndef __NEWSERVICEUID_H__ +#define __NEWSERVICEUID_H__ + +// CONSTANTS +#define NEWSERVICEUID 0x101F8861 + +#endif // __NEWSERVICEUID_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/CNewFileServiceBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/CNewFileServiceBase.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,284 @@ +/* +* Copyright (c) 2002-2006 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: Base class for app servers +* +*/ + + + +// INCLUDE FILES +#include +#include +#include + +#include "CNewFileServiceBase.h" +#include "NewFileServiceDefs.h" + +// CONSTANTS +const TInt KFilenameArrayGranularity( 2 ); + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::CNewFileServiceBase +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +EXPORT_C CNewFileServiceBase::CNewFileServiceBase():iError(0) + { + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::~CNewFileServiceBase +// +// --------------------------------------------------------------------------- +// +// Destructor +EXPORT_C CNewFileServiceBase::~CNewFileServiceBase() + { + delete iFilenameArray; + delete iGenericParams; + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::DeserializeGenericParamsL +// +// --------------------------------------------------------------------------- +// +void CNewFileServiceBase::DeserializeGenericParamsL( const RMessage2& aMessage ) + { + if ( !iGenericParams ) + { + iGenericParams = CAiwGenericParamList::NewL(); + } + else + { + iGenericParams->Reset(); + } + + TInt dataLength( aMessage.GetDesLengthL( ENewServiceIndexFileName ) ); + if ( dataLength == 0 ) + { + return; + } + + HBufC8* buffer = HBufC8::NewLC( dataLength ); + TPtr8 ptr( buffer->Des() ); + aMessage.ReadL( ENewServiceIndexFileName, ptr ); + + RDesReadStream stream( ptr ); + iGenericParams->InternalizeL( stream ); + CleanupStack::PopAndDestroy(); // buffer + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::ServiceL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void CNewFileServiceBase::ServiceL( const RMessage2& aMessage ) + { +#ifdef _DEBUG + RDebug::Print( _L("CNewFileServiceBase::ServiceL %d"), + aMessage.Function() ); +#endif + switch ( aMessage.Function() ) + { + case ECreateNewFile: + { + TPckgBuf< TNewServiceParamPack > paramPack; + aMessage.ReadL( ENewServiceIndexParams, paramPack ); + + if ( !iFilenameArray ) + { + iFilenameArray = new ( ELeave ) + CDesCArrayFlat( KFilenameArrayGranularity ); + } + iFilenameArray->Reset(); + + DeserializeGenericParamsL( aMessage ); + + // Copy the message handle so we can reply to the message when + // the service observer gets called + iPendingMessage = aMessage; + + HandleNewFileL( this, *iFilenameArray, paramPack().iType, + paramPack().iMultipleFiles ); + + break; + } + + case ENewFileToHandle: + { + TPckgBuf< TNewServiceParamPack > paramPack; + aMessage.ReadL( ENewServiceIndexParams, paramPack ); + + DeserializeGenericParamsL( aMessage ); + + // Adopt file handle from client + RFile file; + TInt err = file.AdoptFromClient( aMessage, + ENewServiceIndexFsHandle, + ENewServiceIndexFileHandle ); +#ifdef _DEBUG + RDebug::Print( _L("adopt error: %d" ), err ); +#endif + // Copy the message handle so we can reply to the message when + // the service observer gets called + iPendingMessage = aMessage; + + HandleNewFileL( this, file, paramPack().iType ); + + break; + } + + case EGetFilenameArrayLength: + { + // Calculate the size of the buffer needed to transfer the + //filenames to the client side + TPckgBuf< TInt > lengthBuf; + TInt count( iFilenameArray->MdcaCount() ); +#ifdef _DEBUG + RDebug::Print( _L("Filename array count: %d"), count ); +#endif + TInt length = sizeof( TInt ) + count * sizeof( TUint16 ); + for ( TInt i( 0 ); i < count; i++ ) + { + length += iFilenameArray->MdcaPoint( i ).Size(); + } + + lengthBuf = length; + aMessage.WriteL( ENewServiceIndexParams, lengthBuf ); + aMessage.Complete( KErrNone ); + break; + } + + case EGetFilenameArray: + { + // Allocate a buffer with the same size as in the client side + TInt length( aMessage.GetDesMaxLengthL( ENewServiceIndexParams ) ); + HBufC8* buffer = HBufC8::NewLC( length ); + + TPtr8 ptr = buffer->Des(); + RDesWriteStream stream( ptr ); + + // Stream the filename array to the buffer + TInt count( iFilenameArray->MdcaCount() ); + stream.WriteInt32L( count ); + for ( TInt i( 0 ); i < count; i++ ) + { + TPtrC filename = iFilenameArray->MdcaPoint( i ); + stream.WriteUint16L( filename.Length() ); + stream.WriteL( filename ); + } + + stream.CommitL(); + + // Return the buffer to the client side + aMessage.WriteL( ENewServiceIndexParams, ptr ); + aMessage.Complete( KErrNone ); + CleanupStack::PopAndDestroy(); // buffer + + // notify the application that the transfer is complete and + // it's ok to quit / whatever + ServiceCompleteL(); + + break; + } + default: + { + // Complete old message if still open + if ( !iPendingMessage.IsNull() ) + { + iPendingMessage.Complete( KErrCancel ); + } + + CApaAppServiceBase::ServiceL(aMessage); + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::HandleCompletedNewServiceL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void CNewFileServiceBase::HandleCompletedNewServiceL( + TBool aReturnValue ) + { + // Message was already completed in ServiceL + if ( iPendingMessage.IsNull() ) + { + return; + } + + TNewServiceParamPack pack; + TPckgBuf< TNewServiceParamPack > paramPack; + pack.iReturnValue = aReturnValue; + paramPack = pack; + + iPendingMessage.WriteL( ENewServiceIndexParams, paramPack ); + if(iError != KErrAbort) + { + iPendingMessage.Complete( KErrNone ); + } + else + { + iPendingMessage.Complete( KErrAbort ); + iError = 0; + } + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::GenericParams +// +// --------------------------------------------------------------------------- +// +EXPORT_C CAiwGenericParamList* CNewFileServiceBase::GenericParams() + { + return iGenericParams; + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::GenericParams +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CNewFileServiceBase::GetErrorCode() + { + return iError; + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceBase::GenericParams +// +// --------------------------------------------------------------------------- +// +EXPORT_C void CNewFileServiceBase::SetErrorCode(TInt aError) + { + iError = aError; + } + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/CNewFileServiceClientImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/CNewFileServiceClientImpl.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,255 @@ +/* +* Copyright (c) 2002-2006 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: Implementation for Client side API +* +*/ + + +// INCLUDE FILES + +#include +#include +#include + +#include "NewFileServiceClient.h" +#include "RNewFileServiceClient.h" +#include "CNewFileServiceClientImpl.h" + +#include +#include +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// NewFileServiceFactory::NewClientL +// +// ---------------------------------------------------------------------------- +// +EXPORT_C CNewFileServiceClient* NewFileServiceFactory::NewClientL() + { + return CNewFileServiceClientImpl::NewL(); + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::NewL +// +// ---------------------------------------------------------------------------- +// +CNewFileServiceClientImpl* CNewFileServiceClientImpl::NewL() + { + CNewFileServiceClientImpl* self = + new( ELeave )CNewFileServiceClientImpl; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::~CNewFileServiceClientImpl +// +// ---------------------------------------------------------------------------- +// +CNewFileServiceClientImpl::~CNewFileServiceClientImpl() + { + delete iServerAppMonitor; + iClient.Close(); + if(iClient.iError == KErrAbort) + { + iClient.iError = 0; + MAknServerAppExitObserver::HandleServerAppExit(EAknCmdExit); + } + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::ConstructL +// +// ---------------------------------------------------------------------------- +// +void CNewFileServiceClientImpl::ConstructL() + { + iClient.SetFileServiceClient(this); + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::NewFileL +// +// ---------------------------------------------------------------------------- +// +TBool CNewFileServiceClientImpl::NewFileL( CDesCArray& aFileNames, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType, + TBool aMultipleFiles ) + { + TUid uid( KNullUid ); + + switch ( aFileType ) + { + case ENewFileServiceAudio: + { + uid = TUid::Uid( KVoiceRecorderAppUID3 ); + break; + } + + case ENewFileServiceVideo: + case ENewFileServiceImage: + { + uid = KUidCamcorder; + break; + } + default: + { + User::Leave( KErrNotSupported ); + } + }; + + return NewFileL( uid, aFileNames, aParams, aFileType, aMultipleFiles ); + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::HandleServerAppExit +// +// ---------------------------------------------------------------------------- +// +void CNewFileServiceClientImpl::HandleServerAppExit(TInt aReason) + { +#ifdef _DEBUG + RDebug::Print( _L("CNewFileServiceClientImpl::HandleServerAppExit") ); +#endif + iClient.Close(); + MAknServerAppExitObserver::HandleServerAppExit(aReason); + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::NewFileL +// +// ---------------------------------------------------------------------------- +// +TBool CNewFileServiceClientImpl::NewFileL( TUid aApplicationUid, + CDesCArray& aFileNames, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType, + TBool aMultipleFiles ) + { + iClient.ConnectChainedAppL( aApplicationUid ); + + if ( !iServerAppMonitor ) + { + iServerAppMonitor = CApaServerAppExitMonitor::NewL( iClient, *this, + CActive::EPriorityStandard ); + } + + HBufC8* serializedParams = SerializeGenericParamListLC( aParams ); + TBool ret = iClient.NewFileL( aFileNames, serializedParams, + aFileType, aMultipleFiles ); + CleanupStack::PopAndDestroy(); // serializedParams + return ret; + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::NewFileL +// +// ---------------------------------------------------------------------------- +// +TBool CNewFileServiceClientImpl::NewFileL( RFile& aFileHandle, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType ) + { + TUid uid( KNullUid ); + + switch ( aFileType ) + { + case ENewFileServiceAudio: + { + uid = TUid::Uid( KVoiceRecorderAppUID3 ); + break; + } + + case ENewFileServiceVideo: + case ENewFileServiceImage: + { + uid = KUidCamcorder; + break; + } + default: + { + User::Leave( KErrNotSupported ); + } + }; + + return NewFileL( uid, aFileHandle, aParams, aFileType ); + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::NewFileL +// +// ---------------------------------------------------------------------------- +// +TBool CNewFileServiceClientImpl::NewFileL( TUid aApplicationUid, + RFile& aFileHandle, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType ) + { + + iClient.ConnectChainedAppL( aApplicationUid ); + + if ( !iServerAppMonitor ) + { + iServerAppMonitor = CApaServerAppExitMonitor::NewL( iClient, *this, + CActive::EPriorityStandard ); + } + + HBufC8* serializedParams = SerializeGenericParamListLC( aParams ); + TBool ret = iClient.NewFileL( aFileHandle, serializedParams, aFileType ); + + CleanupStack::PopAndDestroy(); // serializedParams + + return ret; + } + + +// ---------------------------------------------------------------------------- +// CNewFileServiceClientImpl::SerializeGenericParamListLC +// +// ---------------------------------------------------------------------------- +// +HBufC8* CNewFileServiceClientImpl::SerializeGenericParamListLC( + CAiwGenericParamList* aParams ) + { + if ( !aParams ) + { + HBufC8* dummy = HBufC8::NewLC( 0 ); // return dummy + return dummy; + } + + TInt size( aParams->Size() ); + HBufC8* serialized = HBufC8::NewLC( size ); + TPtr8 ptr = serialized->Des(); + RDesWriteStream stream( ptr ); + aParams->ExternalizeL( stream ); + stream.Close(); + return serialized; + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/CNewFileServiceClientImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/CNewFileServiceClientImpl.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2002-2006 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: Implementation for client side API +* +*/ + + + +#ifndef NEWFILESERVICECLIENTIMPL_H +#define NEWFILESERVICECLIENTIMPL_H + +// INCLUDES +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class RFile; +class CApaServerAppExitMonitor; +class CAiwGenericParamList; + +// CLASS DECLARATION + +/** +* Actual implementation class for client side API +* +* @lib NewService.lib +* @since Series 60 3.0 +*/ +class CNewFileServiceClientImpl : public CNewFileServiceClient, + public MAknServerAppExitObserver + { + + public: // New functions + + static CNewFileServiceClientImpl* NewL(); + + ~CNewFileServiceClientImpl(); + + public: // From CNewFileServiceClient + TBool NewFileL( CDesCArray& aFileNames, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType, + TBool aMultipleFiles ); + + TBool NewFileL( TUid aApplicationUid, + CDesCArray& aFileNames, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType, + TBool aMultipleFiles ); + + TBool NewFileL( RFile& aFileHandle, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType ); + + TBool NewFileL( TUid aApplicationUid, + RFile& aFileHandle, + CAiwGenericParamList* aParams, + TNewServiceFileType aFileType ); + + public: // from MApaServerAppExitObserver + void HandleServerAppExit( TInt aReason ); + + private: + + void ConstructL(); + + HBufC8* SerializeGenericParamListLC( CAiwGenericParamList* aParams ); + + private: + + CApaServerAppExitMonitor* iServerAppMonitor; + + RNewFileServiceClient iClient; + + }; + +#endif // NEWFILESERVICECLIENTIMPL_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/CNewFileServiceDiscovery.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/CNewFileServiceDiscovery.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2002-2006 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: Empty implementation for discovery class +* +*/ + + + +// INCLUDE FILES +#include "CNewFileServiceDiscovery.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CNewFileServiceDiscovery::CNewFileServiceDiscovery +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CNewFileServiceDiscovery::CNewFileServiceDiscovery() + { + } + +// ----------------------------------------------------------------------------- +// CNewFileServiceDiscovery::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CNewFileServiceDiscovery::ConstructL() + { + } + +// ----------------------------------------------------------------------------- +// CNewFileServiceDiscovery::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CNewFileServiceDiscovery* CNewFileServiceDiscovery::NewL() + { + CNewFileServiceDiscovery* self = new( ELeave ) CNewFileServiceDiscovery; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// Destructor +CNewFileServiceDiscovery::~CNewFileServiceDiscovery() + { + + } + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/DllMain.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2002-2006 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: +* Dll entry point +* +* +*/ + + +#include + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/NewFileServiceDefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/NewFileServiceDefs.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2002-2006 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: Definitions for the API +* +*/ + + + +#ifndef NEWSERVICEDEFS_H +#define NEWSERVICEDEFS_H + +// INCLUDES +#include + +#define NEWSERVICEUID 0x101F8861 + +// DATA TYPES +enum TIpcMessageIds + { + ECreateNewFile = RApaAppServiceBase::KServiceCmdBase, + ENewFileToHandle, + EGetFilenameArrayLength, + EGetFilenameArray + }; + +enum TIpcNewFileArgumentIndices + { + ENewServiceIndexParams = 0, + ENewServiceIndexFsHandle, + ENewServiceIndexFileHandle, + ENewServiceIndexFileName + }; + +/** +* Parameter class transferred through client-server interface. +* +* @since Series 60 3.0 +*/ +class TNewServiceParamPack + { + public: + TNewServiceFileType iType; + TBool iMultipleFiles; + TBool iReturnValue; + }; + + +#endif // NEWSERVICEDEFS_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/RNewFileServiceClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/RNewFileServiceClient.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,236 @@ +/* +* Copyright (c) 2002-2006 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: Service implementation class +* +*/ + + + +// INCLUDE FILES +#include "RNewFileServiceClient.h" +#include "NewFileServiceDefs.h" +#include "cnewfileserviceserverobserver.h" +#include + +#include + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// RNewFileServiceClient::RNewFileServiceClient +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +RNewFileServiceClient::RNewFileServiceClient() + { + } + + +// --------------------------------------------------------------------------- +// RNewFileServiceClient::~RNewFileServiceClient +// Destructor +// --------------------------------------------------------------------------- +// +RNewFileServiceClient::~RNewFileServiceClient() + { + delete iObserver; + + if ( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + + } + + +// --------------------------------------------------------------------------- +// RNewFileServiceClient::ServiceUid +// +// --------------------------------------------------------------------------- +// +TUid RNewFileServiceClient::ServiceUid() const + { + return TUid::Uid( NEWSERVICEUID ); + + } + + +// --------------------------------------------------------------------------- +// RNewFileServiceClient::NewFileL +// +// --------------------------------------------------------------------------- +// +TBool RNewFileServiceClient::NewFileL( RFile& aFile, TDesC8* aGenericParams, + TNewServiceFileType aType ) + { + TIpcArgs args; + + TNewServiceParamPack pack; + pack.iType = aType; + pack.iMultipleFiles = EFalse; + + TPckgBuf< TNewServiceParamPack > paramPack; + paramPack = pack; + args.Set( 0, ¶mPack ); + + + if ( aGenericParams ) + { + args.Set( ENewServiceIndexFileName, aGenericParams ); + } + + TInt err = aFile.TransferToServer( args, ENewServiceIndexFsHandle, + ENewServiceIndexFileHandle ); +#ifdef _DEBUG + RDebug::Print( _L("transfer to server error: %d"), err ); +#endif + + iObserver = CNewFileServiceServerObserver::NewL(); + + // Send through IPC, pass iObservers TRequestStatus to server + SendReceive( ENewFileToHandle, args, iObserver->IssueWait( this ) ); + + // Wait until server notifies iObserver + if ( !iWait.IsStarted() ) + { + iWait.Start(); // CSI: 10 # + } + + return paramPack().iReturnValue; + } + + +// --------------------------------------------------------------------------- +// RNewFileServiceClient::NewFileL +// +// --------------------------------------------------------------------------- +// +TBool RNewFileServiceClient::NewFileL( CDesCArray& aFilenames, + TDesC8* aGenericParams, + TNewServiceFileType aType, + TBool aMultipleFiles ) + { +#ifdef _DEBUG + RDebug::Print( _L("RNewFileServiceClient::NewFileL") ); +#endif + + TIpcArgs args; + + TNewServiceParamPack pack; + pack.iType = aType; + pack.iMultipleFiles = aMultipleFiles; + + TPckgBuf< TNewServiceParamPack > paramPack = pack; + args.Set( ENewServiceIndexParams, ¶mPack ); + + if ( aGenericParams ) + { + args.Set( ENewServiceIndexFileName, aGenericParams ); + } + else + { + args.Set( ENewServiceIndexFileName, &KNullDesC() ); + } + + iObserver = CNewFileServiceServerObserver::NewL(); + + // Send through IPC, pass iObservers TRequestStatus to server + SendReceive( ECreateNewFile, args, iObserver->IssueWait( this ) ); + + // Wait until server notifies iObserver + if ( !iWait.IsStarted() ) + { + iWait.Start(); // CSI: 10 # + } + + pack = paramPack(); + + if ( !pack.iReturnValue ) + { +#ifdef _DEBUG + RDebug::Print( _L("RNewFileServiceClient::NewFileL - return value received: False") ); +#endif + // don't bother with filename array if the user canceled + return EFalse; + } + +#ifdef _DEBUG + RDebug::Print( _L("RNewFileServiceClient::NewFileL - return value received: True") ); +#endif + + TPckgBuf< TInt > lengthBuf; + args.Set( ENewServiceIndexParams, &lengthBuf ); + User::LeaveIfError( SendReceive( EGetFilenameArrayLength, args ) ); + + TInt length( lengthBuf() ); + + HBufC8* buffer = HBufC8::NewLC( length ); + TPtr8 ptr = buffer->Des(); + args.Set( ENewServiceIndexParams, &ptr ); + User::LeaveIfError( SendReceive( EGetFilenameArray, args ) ); + + // Unpack filename array + RDesReadStream stream; + stream.Open( ptr ); + + TInt count( stream.ReadInt32L() ); + + for ( TInt i( 0 ); i < count; i++ ) + { + TInt length( stream.ReadInt16L() ); + TFileName filename; + stream.ReadL( filename, length ); +#ifdef _DEBUG + RDebug::Print( filename ); +#endif + aFilenames.AppendL( filename ); + } + + CleanupStack::PopAndDestroy(); // buffer + + + return ETrue; + } + + +// ---------------------------------------------------------------------------- +// RNewFileServiceClient::ServerRequestReady +// +// ---------------------------------------------------------------------------- +// +void RNewFileServiceClient::ServerRequestReady( TInt aError ) + { + + if (aError == KErrAbort) + { + iError = KErrAbort; + } + // Server processed command and active object was notified and + // client can continue now + if ( iWait.IsStarted() ) + { + iWait.AsyncStop(); + } + } + + +void RNewFileServiceClient::SetFileServiceClient(CNewFileServiceClient* aClient) + { + iNewFileServiceClient = aClient; + } + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/RNewFileServiceClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/RNewFileServiceClient.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2002-2006 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: Service implementation class +* +*/ + + + +#ifndef RNEWFILESERVICECLIENT_H +#define RNEWFILESERVICECLIENT_H + +// INCLUDES +#include +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CNewFileServiceServerObserver; +class CNewFileServiceClient; + + +class MNewFileServiceServerObserver + { + public: // New functions + + /** + * This is a callback function which is called when a IHF mode changes. + * User must derive his class from MVRIHFObserver + * and implement this method if he is to use notify services. + */ + virtual void ServerRequestReady( TInt aError ) = 0; + }; + +/** +* Class that implements the actual client-server communication +* +* @lib NewService.lib +* @since Series 60 3.0 +*/ +class RNewFileServiceClient : public RAknAppServiceBase, + public MNewFileServiceServerObserver + { + + public: // Constructors and destructor + + /** + * C++ default constructor. + */ + RNewFileServiceClient(); + + /** + * Destructor. + */ + virtual ~RNewFileServiceClient(); + + public: // New functions + + /** + * Handles the communication between server application. + * After this synchronic operation the new file service has completed + * and the new file is available for the client + * @since Series 60 3.0 + * @param aFile File handle to media file + * @param aGenericParams Parameters passed to server + * @param aType Type of the media file + * @param aMultipleFiles ETrue if multiple files can be created + * @return Was the creation succesful + */ + TBool NewFileL( RFile& aFile, TDesC8* aGenericParams, TNewServiceFileType aType ); + TBool NewFileL( CDesCArray& aFilenames, TDesC8* aGenericParams, TNewServiceFileType aType, TBool aMultipleFiles ); + + void SetFileServiceClient(CNewFileServiceClient*); + + CNewFileServiceClient* iNewFileServiceClient; + + TInt iError; + + public: // Functions from base classes + + /** + * Returns the Uid of the service + * @since Series 60 3.0 + */ + TUid ServiceUid() const; + + /** + * From MNewFileServiceServerObserver + */ + void ServerRequestReady( TInt aError ); + + private: + // Wait object used to synchronise asynchronic server request + CActiveSchedulerWait iWait; + + // Active object observing server request completion. Owned. + CNewFileServiceServerObserver* iObserver; + }; + +#endif // RNEWFILESERVICECLIENT_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/cnewfileserviceserverobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/cnewfileserviceserverobserver.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2006 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: CActive-derived class for synchronizing server commands. +* +*/ + + +// INCLUDE FILES +#include "cnewfileserviceserverobserver.h" +#include "RNewFileServiceClient.h" + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::CNewFileServiceServerObserver +// +// --------------------------------------------------------------------------- +// +CNewFileServiceServerObserver::CNewFileServiceServerObserver() + : CActive( EPriorityNormal ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::ConstructL +// +// --------------------------------------------------------------------------- +// +void CNewFileServiceServerObserver::ConstructL() + { + + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::NewL +// +// --------------------------------------------------------------------------- +// +CNewFileServiceServerObserver* CNewFileServiceServerObserver::NewL() + { + CNewFileServiceServerObserver* self = new( ELeave ) CNewFileServiceServerObserver; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::~CNewFileServiceServerObserver +// +// --------------------------------------------------------------------------- +// +CNewFileServiceServerObserver::~CNewFileServiceServerObserver() + { + iObserver = NULL; +RDebug::Print( _L("VoiceRecorder::delete cnewfileserviceobserver") ); + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::RunL +// +// --------------------------------------------------------------------------- +// +void CNewFileServiceServerObserver::RunL() + { + RDebug::Print( _L("VoiceRecorder CNewFileServiceServerObserver::RunL") ); + if ( iObserver ) + { + iObserver->ServerRequestReady( iStatus.Int() ); + } + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::DoCancel +// +// --------------------------------------------------------------------------- +// +void CNewFileServiceServerObserver::DoCancel() + { + RDebug::Print( _L("VoiceRecorder CNewFileServiceServerObserver::DoCancel") ); + if ( iObserver ) + { + iObserver->ServerRequestReady( KErrCancel ); + } + + } + + +// --------------------------------------------------------------------------- +// CNewFileServiceServerObserver::IssueWait +// +// --------------------------------------------------------------------------- +// +TRequestStatus& CNewFileServiceServerObserver::IssueWait( + MNewFileServiceServerObserver* aObserver ) + { + iObserver = aObserver; + + SetActive(); + RDebug::Print( _L("VoiceRecorder CNewFileServiceServerObserver::IssueWait") ); + return iStatus; + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/NewServiceSrc/cnewfileserviceserverobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/NewServiceSrc/cnewfileserviceserverobserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2006-2006 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: CActive-derived class for synchronizing server commands +* +*/ + +#ifndef CNEWFILESERVICESERVEROBSERVER_H +#define CNEWFILESERVICESERVEROBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MNewFileServiceServerObserver; + +/** + * CActive-derived class for synchronizing server commands + * + * @lib newservice.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CNewFileServiceServerObserver ) + : public CActive + { +public: + static CNewFileServiceServerObserver* NewL(); + + ~CNewFileServiceServerObserver(); + + /** + * Wait until RunL is called from server + * + * @since S60 3.1 + * @param aObserver The object that is notified when request completes + * @return Reference to this objects TRequestStatus so that it can be + * supplied to server + */ + TRequestStatus& IssueWait( MNewFileServiceServerObserver* aObserver ); + +private: // from base class CActive + /** + * From CActive + */ + void RunL(); + void DoCancel(); + +protected: + + +private: + CNewFileServiceServerObserver(); + + void ConstructL(); + +private: // data + MNewFileServiceServerObserver* iObserver; + }; + +#endif // CNEWFILESERVICESERVEROBSERVER_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewInc/CVRRecView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewInc/CVRRecView.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,416 @@ +/* +* Copyright (c) 2002-2006 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: +* CVRRecView is an CAknView inherited view class that implements +* the recorder view functionality of Voicer Recorder. +* It owns the view container (which, in turn, owns all the ui controls) +* and the view model. +* +*/ + + +#ifndef __CVRRECVIEW_H__ +#define __CVRRECVIEW_H__ + +// INCLUDES +#include +#include +#include +#include + +#include "MVRSelectionProvider.h" +#include "MVRLayoutChangeObserver.h" +#include "voicerecorder.hrh" +#include "VRUSBStateHanlder.h" + +// FORWARD DECLARATIONS +class CAknLaunchAppService; +class CSendUi; +class CVRRecViewContainer; +class CVRRecViewActivationContainer; +class CVRRecViewModel; + +enum TDialogTypeID { + EDialogForWaitStorageCard = 0, + EDialogForWaitUSBPluggingOut + }; + +// CLASS DEFINITION +/** + * CVRRecView is an CAknView inherited view class that implements + * the recorder view functionality of Voicer Recorder. + * It owns the view container (which, in turn, owns all the ui controls) + * and the view model. + */ +class CVRRecView : public CAknView, + public MVRSelectionProvider, + public MVRLayoutChangeObserver, + public MVRUSBStateObserver, + public MProgressDialogCallback + { +private: + // nested classes + + /* + * One shot class for model activation. Receives a pointer to + * constructed CVRRecViewModel object and activates it asynchronically + * when Activate() is called. + */ + NONSHARABLE_CLASS( CVRRecViewModelActivator ) + : public CAsyncOneShot + { + public: // constructor and destructor + CVRRecViewModelActivator( CVRRecViewModel* aModel ); + ~CVRRecViewModelActivator(); + + public: // New functions: + + /** + * Activate model in given context + */ + void Activate( TVRRecViewContexts aContext, TCallBack aCallback ); + + private: // Functions from base classes + + /** + * From CActive. + */ + void RunL(); + void DoCancel(); + + private: // Data: + + /* + * State machine model, not owned + */ + CVRRecViewModel* iModel; + + /* + * Context that is used to activate model in RunL + */ + TVRRecViewContexts iContext; + + /* + * Callback that is called after model is activated + */ + TCallBack iCallback; + }; + + /* + * One shot class for note pop-up + */ + NONSHARABLE_CLASS( CVRRecViewDialogActivator ) + : public CAsyncOneShot + { + public: // constructor and destructor + CVRRecViewDialogActivator( CVRRecViewModel* aModel); + ~CVRRecViewDialogActivator(); + + public: // new method + void SetDialogType(TDialogTypeID aType); + + void SetViewContexts(TVRRecViewContexts aContext); + + private: // Functions from base classes + + /** + * From CActive. + */ + void RunL(); + void DoCancel(); + + private: // Data: + + /* + * State machine model, not owned + */ + CVRRecViewModel* iModel; + + /* + * The type of dialog + */ + TDialogTypeID iType; + + /* + * Context that is used to activate model + */ + TVRRecViewContexts iContext; + }; + + + public: // Constructors and destructor + + /** + * Static constructor. + * @param aViewResourceId The resource used in view construction. + * @param aModelResourceId The resource used in model construction. + */ + IMPORT_C static CVRRecView* NewLC( TInt aViewResourceId, + TInt aModelResourceId ); + + /** + * Destructor + */ + ~CVRRecView(); + + private: // Constructors + + /** + * Default constructor. + * The inline saves a few bytes. + */ + inline CVRRecView() {}; + + /** + * 2nd phase constructor. + * @param aViewResourceId The resource used in view construction. + * @param aModelResourceId The resource used in model construction. + */ + void ConstructL( TInt aViewResourceId, TInt aModelResourceId ); + + public: // from MVRSelectionProvider + + /** + * Returns an array of currently selected files. + * Ownership is transferred. Caller must destroy the returned array. + * @param aStyle Used to return the style of selection + * (empty/focused/marked) + * @return An array of selected files (0 or more). + */ + MDesCArray* GetSelectedFilesLC( TVRSelectionStyle& aStyle ) const; + + /** + * Pass the file handle to recview. + * Recorded memo is placed there. + * @param aFile File handle + */ + void SetFileHandle( RFile& aFile ); + + /** + * Return the recorded open file handle + * @param aFile File handle + */ + RFile& GetFile(); + + public: // from MVRLayoutChangeObserver + + /** + * This method gets called by the AppUI when a dynamic layout change + * event occurs. + */ + void LayoutChangedL( TInt aType ); + + public: // from CAknView + + /** + * Returns the id of the view. + * @return KVRRecViewUID + */ + TUid Id() const; + + /** + * Handles menu commands. + * @param aCommand Command identifier. + */ + void HandleCommandL( TInt aCommandId ); + + protected: // from CAknView + + /** + * Dynamically initialises a menu pane. The Uikon framework calls this + * function, immediately before the menu pane is activated. + * @param aResourceId Resource ID identifying a menu pane to initialise + * @param aMenuPane The in-memory representation of the menu pane. + */ + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /** + * Foreground event handling function. + * + * Called by UI Framework when view switches to and from foreground + * + * @param aForeground True if view is switched to foreground else false. + */ +// void HandleForegroundEventL( TBool aForeground ); + + private: // from CAknView + + /** + * Is called by the framework when the view is activated. + * @param aPrevViewId Id of the previous view that was active + * @param aCustomMessageId Id of the custom message passed + * @param aCustomMessage Descriptor containing the custom message data + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * Is called by the framework when the view is deactivated. + */ + void DoDeactivate(); + + protected: // from MCoeView + + /** + * Is called by the view server when the application goes to background. + */ + void ViewDeactivated(); + + /** + * Is called by the view server when the application goes to the foreground. + */ + void ViewActivatedL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); + + public: // from CAknView + + /** + * Returns a pointer to the CBA container + * Calls base class Cba() (which is protected) + */ + CEikButtonGroupContainer* Cba() const; + + /** + * Returns a the StateId + * + */ + TUint GetStateId() const; + + /** + * Returns embedding status. + * @param ETrue if the current context is an embedded one. + */ + TBool IsEmbedded() const; + + /** + * Returns the active quality setting. + * @return Quality setting of the active memo + */ + TVRQuality Quality() const; + + private: // new methods + + /** + * Dynamically adds a Send Via menu item plus associated cascade + * to the given menu pane. + * @param aResourceId Resource ID identifying a menu pane + * @param aMenuPane The in-memory representation of the menu pane. + */ + void AddSendToMenuL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + /* + * Trappable version of DoActivateL. Activates an empty UI container + * and starts asynchronic model activation. + * See CAknView::DoActivateL for parameters + */ + void ReallyDoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /* + * Called by iModelActivator object after model has been + * fully activated. + * @param aRecView Always a valid pointer to CVRRecView object + * @return Return value required by TCallBack, not used. + */ + static TInt ActivationCallBack(TAny* aRecView); + + /* + * Non-static method called by ActivationCallBack. Activates + * the actual UI container and deletes the empty one. + */ + void ActivateContainerL(); + + /* + * Check the current state of drives + */ + void CheckDriveState(); + + /** + * This method show a dialog to warn user to insert the SD card. + * @return if user insert the SD card or not + */ + static TBool ShowDialogForWaitStorageCardL(); + + /** + * Make user insert the SD card, and choose SD card as the memo storage + */ + void SetDriveL(); + +public: + virtual TInt HandleUsbPlugInL(); + virtual TInt HandleUsbPlugOutL(); + + virtual void DialogDismissedL( TInt aButtonId ); + +private: + // data + + /** + * Pointer to the UI control container. Owned. + */ + CVRRecViewContainer* iContainer; + + /** + * Pointer to the container that is displayed during + * model construction. Owned + */ + CVRRecViewActivationContainer* iActivationContainer; + + /** + * Pointer to the view model (statemachine). Owned. + */ + CVRRecViewModel* iModel; + + /** + * SendUi used to implement the Send Via feature. Owned. + */ + CSendUi* iSendUi; + + /** + * One shot object that is used to activate model in correct context + * asynchronically. Owned. + */ + CVRRecViewModelActivator* iModelActivator; + + /** + * One shot object that is used to pop up the note + */ + CVRRecViewDialogActivator* iDialogActivator; + + /** + * The type of dialog + */ + TDialogTypeID iDialogType; + + /** + * The command that passed to Handlecommand + * + */ + TInt iCommand; + + CAknLaunchAppService* iLaunchService; + + CAknWaitDialog* iUsbWaitDialog; + + CVRUSBStateHanlder* iUSBStateHandler; + + /* + * Context that is used to activate model + */ + TVRRecViewContexts iContext; + }; + +#endif // __CVRRECVIEW_H__ + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewInc/RecView.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewInc/RecView.rh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2002 - 2006 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: +* Defines resource structures for defining recording view states (visual). +* The file can be included in a resource file only. +* +*/ + + +#ifndef __RECVIEW_RH__ +#define __RECVIEW_RH__ + +#include +#include + +#include "voicerecorder.hrh" + +STRUCT VR_TRANSITION + { + BYTE cmd = 0; + BYTE next = 0; + BYTE function = 0; + } + +STRUCT VR_CONTEXT + { + BYTE id; + STRUCT transition; + STRUCT states[]; + } + +STRUCT VR_STATE + { + BYTE id; + STRUCT transitions[]; + } + + +STRUCT VR_STATEMACHINE + { + STRUCT labelsets[]; // a VR_LABELSET array + STRUCT labelLayouts[]; // a VR_LABEL array + STRUCT states[]; // a VR_VISUAL_STATE array + STRUCT contexts[]; // a VR_CONTEXT array + } + +STRUCT VR_VISUAL_STATE + { + LLINK menubar; + LLINK cba; + LTEXT< VRLABELMAXLENGTH > status; + BYTE labelSetId = 0; + BYTE hasVolumeControl = 0; + BYTE hasProgressBar = 1; + BYTE focusButton = 0; + BYTE stateID = 0; + STRUCT buttons[]; + } + +STRUCT VR_LABELSET + { + STRUCT labels[]; // an LTEXT array + } + +STRUCT VR_BUTTON_INFO + { + WORD commandId = 0; + BYTE state = 0; + } + +STRUCT VR_LABEL_LINK + { + LLINK euroLabelId; + LLINK apacLabelId; + LLINK arabicHebrewLabelId; + } + +STRUCT VR_BUTTONS_NEW + { + STRUCT buttons[]; + } + +#endif // __RECVIEW_RH__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRButtonPanel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRButtonPanel.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,857 @@ +/* +* Copyright (c) 2002 - 2006 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: +* A compound control class. It is responsible for drawing and updating +* a set of buttons. Button selections are also handled and forwarded +* as commands to the AppUi. +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include // TResourceReader +#include +#include // New button highlight +#include // Timer +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "CVRButtonPanel.h" +#include "MVRButtonPanelModel.h" +#include "voicerecorder.hrh" +#include "VRConsts.h" + +// CONSTANTS + +// Timer delays +const TInt KVRFastForwStartDelay( 500000 ); +const TInt KVRFastForwUpdateDelay( 170000 ); + +const TInt KVRButtonCount( 5 ); // Total number of buttons +const TInt KVRAmountOfFocusShrink( 5 ); + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRButtonPanel::CVRButtonPanel +// +// --------------------------------------------------------------------------- +// +CVRButtonPanel::CVRButtonPanel( MVRButtonPanelModel* aModel ) + : iModel( aModel ), + iVRButtons( KVRButtonCount ) + { + __ASSERT_DEBUG( iModel, User::Panic( KVRPanic, KErrNotFound ) ); + iModel->SetButtonPanelObserver( this ); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::CVRButtonPanel +// +// --------------------------------------------------------------------------- +// +CVRButtonPanel::CVRButtonPanel( MVRButtonPanelModel* aModel, + TUid aParentViewUid ) + : iModel( aModel ), + iParentViewUid( aParentViewUid ), + iVRButtons( KVRButtonCount ) + { + __ASSERT_DEBUG( iModel, User::Panic( KVRPanic, KErrNotFound ) ); + iModel->SetButtonPanelObserver( this ); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::~CVRButtonPanel +// Destructor +// --------------------------------------------------------------------------- +// +CVRButtonPanel::~CVRButtonPanel() + { + if ( iModel ) + { + iModel->SetButtonPanelObserver( NULL ); + } + + iVRButtons.ResetAndDestroy(); + delete iTimer; + iModel = NULL; + iSkin = NULL; + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::ConstructL() + { + iSkin = AknsUtils::SkinInstance(); + + // Create buttons from resources + CreateButtonsFromResourcesL( R_VR_BUTTON_PANEL_BUTTONS ); + UpdateButtons(); + + // Has to be done to get the buttons' background shown correctly + for ( TInt i = 0; i < iVRButtons.Count(); i++ ) + { + iVRButtons.At( i )->SetBackground( this ); + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::CreateButtonsFromResourcesL +// Creates buttons from resources +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::CreateButtonsFromResourcesL( TInt aButtonsResourceId ) + { + TResourceReader reader; + iEikonEnv->CreateResourceReaderLC( reader, aButtonsResourceId ); + + TInt numButtons( reader.ReadInt16() ); + + // Create buttons + for (TInt i = 0; i < numButtons; i++ ) + { + CAknButton* aknButton = CAknButton::NewL(); + CleanupStack::PushL( aknButton ); + + aknButton->SetContainerWindowL( *this ); + aknButton->SetMopParent( this ); + aknButton->ConstructFromResourceL( reader ); + aknButton->SetObserver( this ); + + // Set ready to be drawn and add it to array + aknButton->ActivateL(); + iVRButtons.AppendL( aknButton ); + + CleanupStack::Pop( aknButton ); // aknButton + } + + CleanupStack::PopAndDestroy(); // reader; + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::Update +// This method can be called via MVRObserver class when Button Panel needs +// to be updated. +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::Update( TVRUpdateCommand aCommand ) + { + + TBool drawNow( ETrue ); + + // Recorder calls this after each tick, we have to check if button reset + // is needed. Redraw is needed also after 1 secs playback to enable + // rewind button. + switch( aCommand ) + { + case EVRUpdate1Second: + case EVRUpdate: + case EVRUpdateStateChange: + { + // Redraw + drawNow = ETrue; + break; + } + case EVRUpdatePositionChange: + { + // Skip redraw + drawNow = EFalse; + break; + } + default: + { + // Skip redraw + drawNow = EFalse; + return; + } + } + + if ( iModel->ResetNeeded() ) + { + iFocusedButton = iModel->InitialFocusButtonId(); + } + + UpdateButtons(); + + // Change focus if focused button is dimmed + TuneButtonFocus(); + + if ( drawNow ) + { + DrawNow(); + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::SizeChanged +// Called when Button Panel layout needs to be updated +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::SizeChanged() + { + TInt count( iModel->ButtonCount() ); + + TSize size; // Size of the bitmap + + for ( TInt i( 0 ); i < count; i++ ) + { + // Layout button. + TAknWindowLineLayout cell = AppLayout::cell_vorec_pane( i ); + + TAknLayoutRect buttonLayout; + buttonLayout.LayoutRect( Rect(), cell ); + TRect buttonRect = buttonLayout.Rect(); + TInt newSize = (TInt)(buttonRect.Width() * 0.1); // used to reduce the size of button + buttonRect.Shrink( TSize(newSize,newSize) ); + iVRButtons.At( i )->SetRect( buttonRect ); + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::OfferKeyEventL +// Key event handling +// --------------------------------------------------------------------------- +// +TKeyResponse CVRButtonPanel::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + if ( aType != EEventKey ) + { + if( aType == EEventKeyDown ) + { + // Rocker key pressed + if ( aKeyEvent.iScanCode == EStdKeyDevice3 ) + { + // Start timer to get continuous timercallbacks for + // FastForwarding and FastRewinding + StartTimerL(); + } + } + else if( aType == EEventKeyUp ) + { + // Rocker key pressed + if ( aKeyEvent.iScanCode == EStdKeyDevice3 ) + { + StopTimer(); + } + } + return EKeyWasNotConsumed; + } + // EEventKey + switch ( aKeyEvent.iCode ) + { + case EKeyDownArrow: + { + MoveFocus( EFocusDown, ETrue ); + break; + } + case EKeyUpArrow: + { + MoveFocus( EFocusUp, ETrue ); + break; + } + case EKeyEnter: + case EKeyOK: + { + // This is in use as long as there are only 2 CBA buttons. When MSK + // enabled, execution goes straight to CVRRecView::HandleCommandL + FetchAndSendCommandL(); + break; + } + default: + { + return EKeyWasNotConsumed; + } + } + + return EKeyWasConsumed; + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::Draw +// Needed to get correct focus drawing with AknButtons +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::Draw( CWindowGc& /*aGc*/, const CCoeControl& /*aControl*/, + const TRect& /*aRect*/ ) const + { + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::Draw +// +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::Draw( const TRect& /*aRect*/ ) const + { + CWindowGc& gc = SystemGc(); + // Acquire the control context through the MOP-chain + MAknsControlContext* context = AknsDrawUtils::ControlContext( this ); + + // Draw the background using the control context + // Note: if there is no skin, the background is just cleared + // (which is OK for us) + AknsDrawUtils::Background( iSkin, context, this, gc, Rect() ); + + // Draw button highlight + DrawFocus( gc ); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::CountComponentControls +// +// --------------------------------------------------------------------------- +// +TInt CVRButtonPanel::CountComponentControls() const + { + return iVRButtons.Count(); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::ComponentControl +// +// --------------------------------------------------------------------------- +// +CCoeControl* CVRButtonPanel::ComponentControl( TInt aIndex ) const + { + return iVRButtons.At( aIndex ); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::MoveFocus +// Moves the focus to next button up or down. aDirection tells the which. +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::MoveFocus( const TFocusChange aDirection, TBool aDrawNow ) + { + TInt buttonCount( iModel->ButtonCount() ); + TInt newButton( iFocusedButton ); + + for ( TInt i( 0 ); i < buttonCount; i++ ) + { + // calculate new button id. the modulo operator (%) handles looping + newButton = ( newButton + aDirection + buttonCount ) % buttonCount; + // dimmed buttons are skipped + if ( iModel->ButtonState( newButton ) != EDimmed ) + { + iFocusedButton = newButton; + + // Timer is used for FastForward/-Rewind. Stop that when focus is + // changed. + StopTimer(); + break; + } + } + + if ( aDrawNow ) + { + DrawNow(); + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::UpdateLayoutL +// +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::UpdateLayoutL( ) + { + SizeChanged(); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::HandleResourceChangeL +// +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::HandleResourceChangeL( TInt aType ) + { + CCoeControl::HandleResourceChange( aType ); + + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + UpdateLayoutL(); + } + else if ( aType == KAknsMessageSkinChange ) + { + // New skin instance is loaded + iSkin = AknsUtils::SkinInstance(); + } + + // Inform Avkon Buttons + for( TInt buttonIndex = 0; buttonIndex < iVRButtons.Count() ; + buttonIndex++ ) + { + iVRButtons.At( buttonIndex )->HandleResourceChange( aType ); + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::UpdateButtons +// Updates all Button Panel buttons to correct visual state. Also few +// exceptional cases are handled here (1. clip position is at the beginning +// 2. clip position is at the end) +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::UpdateButtons() + { + TUint stateId; + // Update all the buttons + for( TInt buttonIndex = 0; buttonIndex < iVRButtons.Count() ; + buttonIndex++ ) + { + stateId = iModel->VisualStateId(); + + // dim rewind button if there is nothing to rewind + if ( buttonIndex == EButtonRewind && + iModel->ButtonState( buttonIndex ) == EDimmed ) + { + iVRButtons.At( buttonIndex )->SetDimmed(ETrue); + stateId = EStateDisableButtons; + } + if ( buttonIndex == EButtonRewind && + iModel->ButtonState( buttonIndex ) != EDimmed ) + { + iVRButtons.At( buttonIndex )->SetDimmed(EFalse); + } + // dim forward button if there is nothing to forward + if( buttonIndex == EButtonForward && + iModel->ButtonState( buttonIndex ) == EDimmed ) + { + iVRButtons.At( buttonIndex )->SetDimmed(ETrue); + stateId = EStateDisableButtons; + } + if( buttonIndex == EButtonForward && + iModel->ButtonState( buttonIndex ) != EDimmed ) + { + iVRButtons.At( buttonIndex )->SetDimmed(EFalse); + } + + // ************ADDED CODE STARTS**************************** + if( buttonIndex == EButtonRecord && + iModel->ButtonState( buttonIndex ) == EDimmed ) + { + stateId = EStateDisableButtons; + } + // ************ADDED CODE ENDS****************************** + + if( iModel->ButtonState( buttonIndex ) == EDimmed ) + { + iVRButtons.At( buttonIndex )->SetDimmed(ETrue); + } + else + { + iVRButtons.At( buttonIndex )->SetDimmed(EFalse); + } + + // Change the button state, don't redraw + iVRButtons.At( buttonIndex )->SetCurrentState( stateId , EFalse ); + } + } + + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::DrawFocus() +// Draws the focus rectangle around the currently focused button +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::DrawFocus( CWindowGc& aGc ) const + { + + aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); + + if ( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) + { + // From LAF-table +// TAknWindowLineLayout area = +// AknLayoutScalable_Apps::grid_highlight_pane_cp05().LayoutLine(); + +// TRect buttonRect = iVRButtons.At( iFocusedButton )->Rect(); + TAknWindowLineLayout area = AppLayout::cell_vorec_pane( iFocusedButton ); + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( Rect(), area ); +// layoutRect.LayoutRect( buttonRect, area ); + + // The outer rectangle is calculated from the layoutRect + TRect outerRect = TRect( layoutRect.Rect().iTl, layoutRect.Rect().iBr ); + + // Inner rectangle is generated by shrinking the outer rect. + TRect innerRect = outerRect; + innerRect.Shrink( TSize( KVRAmountOfFocusShrink, + KVRAmountOfFocusShrink ) ); + + if (iModel->ButtonState( iFocusedButton ) != EDimmed ) + { + //Focus frame is drawn + aGc.SetPenStyle( CGraphicsContext::ENullPen ); + TBool highlightDrawn = AknsDrawUtils::DrawFrame( iSkin, aGc, + outerRect, innerRect, KAknsIIDQsnFrGrid, KAknsIIDNone ); + } + } + else + { + if ( iModel->ButtonState( iFocusedButton ) != EDimmed ) + { + // Old basic rectangle is drawn + aGc.SetPenStyle( CGraphicsContext::ESolidPen ); + aGc.DrawRect( iVRButtons.At( iFocusedButton )->Rect() ); + } + } + + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::FocusedButton() +// Returns the index for the currently focused button +// --------------------------------------------------------------------------- +// +TInt CVRButtonPanel::FocusedButton() const + { + return iFocusedButton; + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::StartTimerL +// Create and start a timer with initial delay of KVRFastForwStartDelay +// and with callback frequency of KVRFastForwUpdateDelay +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::StartTimerL() + { + if ( iTimer ) + { + // stop if iTimer is already running + StopTimer(); + } + + TCallBack cb( TimerCallBack, this ); + iTimer = CPeriodic::NewL( 0 ); + iTimer->Start( KVRFastForwStartDelay, KVRFastForwUpdateDelay, cb ); + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::StopTimer +// Stop the timer by deleting the CPeriodic object +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::StopTimer() + { + delete iTimer; + iTimer = NULL; + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::TimerCallBack +// Timer callback for iTimer. Time between callbacks is KVRFastForwUpdateDelay +// --------------------------------------------------------------------------- +// +TInt CVRButtonPanel::TimerCallBack( TAny* aButtonPanel ) + { + CVRButtonPanel* buttonPanel = reinterpret_cast< CVRButtonPanel* > + ( aButtonPanel ); + + buttonPanel->HandleTimerCallBack(); + + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::HandleTimerCallBack +// Non-static variant of TimerCallBack (more convinient to implement) +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::HandleTimerCallBack() + { + // Callbacks are handled only if focus is on rewind or forward button + if (iFocusedButton == EButtonRewind || iFocusedButton == EButtonForward) + { + TRAPD( err, FetchAndSendCommandL() ); + + if ( err ) + { + RDebug::Print(_L("VoiceRecorder: FetchAndSendCommandL, error ID: %d"), + err); + StopTimer(); + } + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::FetchAndSendCommand +// Fetches the command relating to focused button from the model. Command is +// sent on to active view. +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::FetchAndSendCommandL() + { + // Don't forward the command if dimmed button was clicked or + // if model can't handle commands + if ( iModel->ButtonState( iFocusedButton ) == EDimmed || + !iModel->CanHandleCommands() ) + { + return; + } + + // Send a command id to the active view specified in the button + CAknViewAppUi* appUi = reinterpret_cast< CAknViewAppUi* >( + CEikonEnv::Static()->EikAppUi() ); + CAknView* view = appUi->View( iParentViewUid ); + view->HandleCommandL( iModel->CommandId( iFocusedButton ) ); + + Update( EVRUpdateStateChange ); + + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::TuneButtonFocus +// The special cases when button focus has to be moved are handled here +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::TuneButtonFocus() + { + + // CVRRecViewModel::ButtonState() returns EDimmed for EButtonRewind if + // the position of the clip is at the beginning + if ( iFocusedButton == EButtonRewind && + iModel->ButtonState( iFocusedButton ) == EDimmed ) + { + iVRButtons.At( iFocusedButton )->SetDimmed(ETrue); + MoveFocus( EFocusDown, EFalse ); + } + + // CVRRecViewModel::ButtonState() returns EDimmed for EButtonForward if + // the position of the clip is at the end + else if( iFocusedButton == EButtonForward && + iModel->ButtonState( iFocusedButton ) == EDimmed ) + { + iVRButtons.At( iFocusedButton )->SetDimmed(ETrue); + MoveFocus( EFocusUp, EFalse ); + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::HandleControlEventL +// A callback function of Avkon buttons. Handles EEventStateChanged type events +// which happen every time when some of the buttons is pressed and button state +// changes. Event comes before CAknButton::Draw method is executed. +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::HandleControlEventL( CCoeControl *aControl, + TCoeEvent aEventType ) + { + if( AknLayoutUtils::PenEnabled() ) + { + + switch( aEventType ) + { + case EEventStateChanged: + { + + TInt newFocusedButton( 0 ); + for( TInt i = 0; i < iVRButtons.Count() ; i++ ) + { + // Which of buttons was pressed + if ( aControl == iVRButtons.At( i ) ) + { + // When new state is the first state, we have to set + // new state to ENumStates to be able to se a correct + // state in SetCurrentState( stateId - 1 , EFalse ); + TInt stateId( iVRButtons.At( i )->StateIndex() ); + if( stateId == 0 ) + { + stateId = ENumStates; + } + + // CAknButton automatically changes the state to next + // one always when it's ,pressed whether we want it or + // not. To prevent this we set the previous state + // before button draws itself + iVRButtons.At( i )->SetCurrentState( stateId - 1, + EFalse ); + newFocusedButton = i; + break; + } + } + + // Focus already was on pressed button so button's command is + // executed + if ( iFocusedButton == newFocusedButton ) + { + // Don't forward the command if dimmed button was clicked + if ( iModel->ButtonState( iFocusedButton ) == EDimmed ) + { + break; + } + + // Send a command id specified in the button to an + // active view + CAknViewAppUi* appUi = reinterpret_cast< CAknViewAppUi* >( + CEikonEnv::Static()->EikAppUi() ); + CAknView* view = appUi->View( iParentViewUid ); + view->HandleCommandL( iModel->CommandId( iFocusedButton ) ); + + // To make FastForwarding/FastRewinding possible + if ( iFocusedButton == EButtonRewind || + iFocusedButton == EButtonForward ) + { + if ( iLastPointerEvent == EVRButtonDownEvent ) + { + StartTimerL(); + } + } + + Update( EVRUpdateStateChange ); + } + // Focus was not on the focused button -> + // Focus should be changed + else if ( newFocusedButton >= 0 && + newFocusedButton < iVRButtons.Count() ) + { + //draw focus + if ( iModel->ButtonState( newFocusedButton ) != EDimmed ) + { + iFocusedButton = newFocusedButton; + DrawNow(); + + // Send a command id specified in the button to an + // active view + CAknViewAppUi* appUi = reinterpret_cast< CAknViewAppUi* >( + CEikonEnv::Static()->EikAppUi() ); + CAknView* view = appUi->View( iParentViewUid ); + view->HandleCommandL( iModel->CommandId( iFocusedButton ) ); + // To make FastForwarding/FastRewinding possible + if ( iFocusedButton == EButtonRewind || + iFocusedButton == EButtonForward ) + { + if ( iLastPointerEvent == EVRButtonDownEvent ) + { + StartTimerL(); + } + } + } + // for one error about touch UI, when click a dimmed button, the dimmed + // button should not go back to umdimmed. + else + { + DrawNow(); + } + } + break; + } + default: + { + // No default behaviour + break; + } + } + + } + } + + +// --------------------------------------------------------------------------- +// CVRButtonPanel::HandlePointerEventL +// Handles Button panel pointer events. True functionality is to stop +// FastForward timer when FF should be stopped. +// --------------------------------------------------------------------------- +// +void CVRButtonPanel::HandlePointerEventL( const TPointerEvent& aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + + + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + // Don't start timer here. It's started in HandleControlEventL() + iLastPointerEvent = EVRButtonDownEvent; + break; + } + case TPointerEvent::EDrag: + { + // Don't stop timer if just dragging inside the currently + // focused button + TRect focusedButtonRect( + iVRButtons.At( iFocusedButton )->Rect() ); + if( !focusedButtonRect.Contains( aPointerEvent.iPosition ) ) + { + // Dragged outside + iLastPointerEvent = EVRButtonDragOutsideEvent; + StopTimer(); + } + break; + } + case TPointerEvent::EButton1Up: + { + // Pen up + iLastPointerEvent = EVRButtonUpEvent; + StopTimer(); + break; + } + default: + { + break; + } + } + + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + } + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRButtonPanel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRButtonPanel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,294 @@ +/* +* Copyright (c) 2002 - 2006 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: +* A compound control class. It is responsible for drawing and updating +* a set of buttons. Button selections are also handled and forwarded +* as commands to the AppUi. +* +*/ + + +#ifndef __CVRBUTTONPANEL_H__ +#define __CVRBUTTONPANEL_H__ + +// INCLUDES +#include +#include +#include // MCoeControlObserver + +#include "MVRObserver.h" + +// FORWARD DECLARATIONS +class MVRButtonPanelModel; +class MAknsSkinInstance; +class CApaMaskedBitmap; +class TAknsItemID; +class CAknButton; + +// CLASS DEFINITION +/** +* A compound control class. It is responsible for drawing and updating +* a set of buttons. Button selections are also handled and forwarded +* as commands to the AppUi. +*/ +NONSHARABLE_CLASS( CVRButtonPanel ) + : public CCoeControl, + public MVRObserver, + public MCoeControlObserver, + public MCoeControlBackground + { + public: // data types + enum TFocusChange + { + EFocusUp = -1, + EFocusDown = 1, + EFocusInvalid = 2 + }; + + // pointer event types used in VR + enum TLastPointerEventType + { + EVRButtonDownEvent, + EVRButtonDragOutsideEvent, + EVRButtonUpEvent + }; + + public: // constructors and destructor + + /** + * Constructor. + * @param aModel Pointer to the button panel model. + * Ownership is not transferred. + */ + CVRButtonPanel( MVRButtonPanelModel* aModel ); + + /** + * Constructor. + * @param aModel Pointer to the button panel model. + * @param aParentViewUid Uid of CVRRecView for fast swap + * Ownership is not transferred. + */ + CVRButtonPanel( MVRButtonPanelModel* aModel, TUid aParentViewUid ); + + /** + * Destructor + */ + virtual ~CVRButtonPanel(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + private: // constructors + + /** + * Default constructor. Not implemented. + */ + CVRButtonPanel(); + + /** + * Creates control buttons from given resources + * @param aButtonsResourceId The resource used in buttons' construction. + */ + void CreateButtonsFromResourcesL( TInt aButtonsResourceId ); + + public: + + /** + * Updates the layout of all child controls to current active + * layout (Euro, Apac, Arabic/Hebrew) + */ + void UpdateLayoutL( ); + + /** + * Handles a change to the application's resources + * @param aType The type of changed resource + */ + void HandleResourceChangeL( TInt aType ); + + public: // from CCoeControl + + /* + * From CCoeControl + * @see CCoeControl + */ + void SizeChanged(); + + /** + * When a key event occurs, the control framework calls this function + * for each control on the control stack, until one of them can process + * the key event (and returns EKeyWasConsumed). + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown + * @return Indicates whether or not the key event was used by this + * control + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** + * Gets called whenever a pointer event occurs. + * @param aPointerEvent The pointer event to handle. + */ + void HandlePointerEventL( const TPointerEvent& aPointerEvent ); + + public: // from MVRObserver + + /** + * Called to notify a change in the observed subject's state. + */ + void Update( TVRUpdateCommand aCommand ); + + public: // from MCoeControlObserver + + /** + * This function is called when a control for which this control is the observer + * calls CCoeControl::ReportEventL(). In VoiceRecorder button pointer events are + * handled here. + * @param aControl The control that sent the event. + * @param aEventType The event type. + */ + void HandleControlEventL(CCoeControl *aControl, TCoeEvent aEventType); + + private: // from MCoeControlBackground + + /* + * From MCoeControlBackground + * @see MCoeControlBackground + */ + void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const; + + public: // new methods + + /* + * Checks which button is currently focused and returns the index + * value of that + * @return The index for the currently focused button + */ + TInt FocusedButton() const; + + private: // from CCoeControl + + /** + * Draws this control. + * @param aRect The area that needs updating. Ignored. + */ + void Draw( const TRect& aRect ) const; + + /** + * Called by the framework to get the number of sub-components + * contained in this component. + * @return The number of component controls contained by this control + */ + TInt CountComponentControls() const; + + /** + * Called by the framework to get a specified sub-component + * of this component. + * @param aIndex The index of the component to get. + * @return The component control with an index of aIndex. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + private: // new methods + + /** + * Moves focus to the next non-dimmed button. + * @param aDirection EFocusDown to move downwards, EFocusUp upwards + */ + void MoveFocus( const TFocusChange aDirection, TBool aDrawNow ); + + /** + * Updates buttons by changing their state + */ + void UpdateButtons(); + + /** + * Draws highlight rectangle for the focused button. + * @param aGc Current Graphic Context in use. + */ + void DrawFocus( CWindowGc& aGc ) const; + + /** + * Creates and starts a CPeriodic timer object + * with a resolution of KVRFastForwUpdateDelay + */ + void StartTimerL(); + + /** + * Stops and deletes the timer object. + */ + void StopTimer(); + + /** + * Called by the CPeriodic timer to handle a tick. + * Uses HandleTimerCallBack() to do the actual work. + * @param aButtonPanel Always a valid pointer to CVRButtonPanel object + * @return ETrue to indicate that the timer should continue. + */ + static TInt TimerCallBack( TAny* aButtonPanel ); + + /** + * Non-static variant of TimerCallBack (more convinient to implement). + */ + void HandleTimerCallBack(); + + /** + * Search corresponding command of the focused/pressed button and + * sends it to active view + */ + void FetchAndSendCommandL(); + + /** + * Handles special cases concerning button focus + */ + void TuneButtonFocus(); + + + private: // data + + /** + * Pointer to the button panel model. Not owned. + */ + MVRButtonPanelModel* iModel; + + /** + * The index of the currently focused button. + */ + TInt iFocusedButton; + + // Skin instance. Not owned. + MAknsSkinInstance* iSkin; + + // Uid of the parent view + TUid iParentViewUid; + + /** + * Pointer to the timer object. Owned. + */ + CPeriodic* iTimer; + + // Button panel's button controls. Owned. + CArrayPtrFlat< CAknButton > iVRButtons; + + /** + * Tells what pointer event is the last that has happened + */ + TLastPointerEventType iLastPointerEvent; + + }; + +#endif // __CVRBUTTONPANEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRDiskSpaceWatcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRDiskSpaceWatcher.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2002 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: +* Observe the Disk Space +* +*/ + + +// INCLUDE FILES +#include "CVRMdaRecorder.h" +#include "CVRDiskSpaceWatcher.h" +#include "CVRMemo.h" + + + +// ================= MEMBER FUNCTIONS ======================= +// --------------------------------------------------------------------------- +// CVRDiskSpaceWatcher::CVRDiskSpaceWatcher +// +// --------------------------------------------------------------------------- +// +inline CVRDiskSpaceWatcher::CVRDiskSpaceWatcher + (CVRMdaRecorder& aRecorder, RFs& aFs) : + CActive(CActive::EPriorityIdle), + iRecorder(aRecorder), iFs(aFs) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +//CVRDiskSpaceWatcher::NewL +// +// --------------------------------------------------------------------------- +// +CVRDiskSpaceWatcher* CVRDiskSpaceWatcher::NewL + (CVRMdaRecorder& aRecorder, RFs& aFs) + { + CVRDiskSpaceWatcher* self = new(ELeave) CVRDiskSpaceWatcher(aRecorder, aFs); + return self; + } + +// --------------------------------------------------------------------------- +// CVRDiskSpaceWatcher::~CVRDiskSpaceWatcher +// +// --------------------------------------------------------------------------- +// +CVRDiskSpaceWatcher::~CVRDiskSpaceWatcher() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CVRDiskSpaceWatcher::DoCancel +// +// --------------------------------------------------------------------------- +// +void CVRDiskSpaceWatcher::DoCancel() + { + iFs.NotifyDiskSpaceCancel(); + } + +// --------------------------------------------------------------------------- +// CVRDiskSpaceWatcher::RunL() +// +// --------------------------------------------------------------------------- +// +void CVRDiskSpaceWatcher::RunL() + { + // if error returns, restart AO + if (iStatus.Int()) + { + if (iRecorder.iMemo->Quality() == EQualityHigh) + { + RequestNotification( iThreshold, iDrive); + } + return; + } + + // Disk space is below CL -> initiate a compress + if(iRecorder.iAudioRecorder->State() == CMdaAudioClipUtility::ERecording) + { + iRecorder.StopAndNotify(); + } + + // Renew notification request + if (iRecorder.iMemo) + { + if (iRecorder.iMemo->Quality() == EQualityHigh) + { + RequestNotification( iThreshold, iDrive); + } + } + + } + +// --------------------------------------------------------------------------- +// CVRDiskSpaceWatcher::RunError +// +// --------------------------------------------------------------------------- +// +TInt CVRDiskSpaceWatcher::RunError(TInt /*aError*/) + { + return KErrNone; + } + +// --------------------------------------------------------------------------- +// CVRDiskSpaceWatcher::RequestNotification +// +// --------------------------------------------------------------------------- +// +void CVRDiskSpaceWatcher::RequestNotification( TInt64 aThreshold, TInt aDrive) + { + iThreshold = aThreshold; + iDrive = aDrive; + Cancel(); + iFs.NotifyDiskSpace(iThreshold,iDrive,iStatus); + SetActive(); + } + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRDiskSpaceWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRDiskSpaceWatcher.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2002 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: +* Disk space level watcher +* +*/ + + +#ifndef __CVRDISKSPACEWATCHER_H__ +#define __CVRDISKSPACEWATCHER_H__ + + +// CLASS DECLARATION +class CVRMdaRecorder; + +/** + * Database compression timeout timer. + */ + NONSHARABLE_CLASS(CVRDiskSpaceWatcher) : public CActive + { + public: // Interface + /** + * Creates a new instance of this class. + * @param aCompressionStrategy compressions strategy + * @param aFs file server session + * @param aThreshold threshold + * @param aDrive disk drive + */ + static CVRDiskSpaceWatcher* NewL + (CVRMdaRecorder&, RFs& aFs); + + void RequestNotification(TInt64 aThreshold, TInt aDrive); + + /** + * Destructor. + */ + ~CVRDiskSpaceWatcher(); + + private: // from CActive + void DoCancel(); + void RunL(); + TInt RunError(TInt aError); + + private: // Implementation + CVRDiskSpaceWatcher(CVRMdaRecorder&, RFs& aFs); + + private: // Data + /// Ref. compression strategy + CVRMdaRecorder& iRecorder; + /// Ref: file server session + RFs iFs; + /// Own: threshold + TInt64 iThreshold; + /// Own: disk drive + TInt iDrive; + }; + +#endif // __CVRDISKSPACEWATCHER_H__ + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRLabel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRLabel.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2002 - 2006 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 class is an extension to the standard Eikon label. +* It provides leave-safe SetText() and is able to +* clear its background before drawing. +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include + +#include "CVRLabel.h" +#include "voicerecorder.hrh" + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRLabel::NewLC +// +// --------------------------------------------------------------------------- +// +CVRLabel* CVRLabel::NewLC( const CCoeControl& aContainer ) + { + CVRLabel* self = new( ELeave ) CVRLabel; + CleanupStack::PushL( self ); + self->ConstructL( aContainer ); + + return self; + } + + +// --------------------------------------------------------------------------- +// CVRLabel::~CVRLabel +// +// --------------------------------------------------------------------------- +// +CVRLabel::~CVRLabel() + { + } + + +// --------------------------------------------------------------------------- +// CVRLabel::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRLabel::ConstructL( const CCoeControl& aContainer ) + { + SetContainerWindowL( aContainer ); + SetBufferReserveLengthL( VRLABELMAXLENGTH ); + iSkin = AknsUtils::SkinInstance(); + } + + +// --------------------------------------------------------------------------- +// CVRLabel::Draw +// Clears the label area and then draws the text +// --------------------------------------------------------------------------- +// +void CVRLabel::Draw( const TRect& aRect ) const + { + // Acquire the control context through the MOP-chain + MAknsControlContext* context = AknsDrawUtils::ControlContext( this ); + + // Draw the background using the control context + // Note: if there is no skin, the background is just cleared + // (which is OK for us) + AknsDrawUtils::Background( iSkin, context, this, SystemGc(), Rect() ); + + // Draw the actual text + CEikLabel::Draw( aRect ); + } + + +// --------------------------------------------------------------------------- +// CVRLabel::SetText +// Non-leaving SetText variant. +// --------------------------------------------------------------------------- +// +void CVRLabel::SetText( const TDesC& aText ) + { + TBuf< VRLABELMAXLENGTH > clipped( aText ); + // will Panic if clipped is longer than VRLABELMAXLENGTH + // AknTextUtils::ClipToFit( clipped, *iFont, iSize.iWidth ); + // AknBidiTextUtils::ConvertToVisualAndClipL(clipped,*iFont,iSize.iWidth, iSize.iWidth ); + *iText = clipped; + } + + +// --------------------------------------------------------------------------- +// CVRLabel::SetTextAndDraw +// Updates the label if the given text is differentfrom the label's +// current text. +// --------------------------------------------------------------------------- +// +void CVRLabel::SetTextAndDraw( const TDesC& aText ) + { + if ( iText->Compare( aText ) ) + { + SetText( aText ); + DrawNow(); + } + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRLabel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRLabel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,100 @@ +/* +* Copyright (c) 2002 - 2006 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 class is an extension to the standard Eikon label. +* It provides leave-safe SetText() and is able to +* clear its background before drawing. +* +*/ + + +#ifndef __CVRLABEL_H__ +#define __CVRLABEL_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MAknsSkinInstance; + +// CLASS DEFINITION +/** +* This class is an extension to the standard Eikon label. +* It provides leave-safe SetText() and is able to +* clear its background before drawing. +*/ +NONSHARABLE_CLASS( CVRLabel ) + : public CEikLabel + { + public: // Constructors and destructor + + /** + * Two-phased constructor + * @param aContainer Reference to the owning CCoeControl + */ + static CVRLabel* NewLC( const CCoeControl& aContainer ); + + /** + * Destructor. + */ + ~CVRLabel(); + + private: // Constructors + + /** + * Default constructor. + */ + inline CVRLabel() {}; + + /** + * 2nd phase constructor. + * @param aContainer Reference to the owning CCoeControl + */ + void ConstructL( const CCoeControl& aContainer ); + + private: // from CCoeControl + + /** + * Draws this label. + * @param aRect The area that needs updating. + */ + void Draw( const TRect& aRect ) const; + + public: // New methods + + /** + * Sets the text in this label. + * Leave-safe. Panics if aText is too long. + * @param aText The new contents. + */ + void SetText( const TDesC& aText ); + + /** + * Sets the text in this label. + * Will draw the label if the given text + * is different from the current one. + * Leave-safe. Panics if aText is too long. + * @param aText The new contents. + */ + void SetTextAndDraw( const TDesC& aText ); + + private: + // Skin instance. Not owned. + MAknsSkinInstance* iSkin; + + TAknLayoutText iTextLayout; + }; + +#endif // __CVRLABEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMdaRecorder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMdaRecorder.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,1639 @@ +/* +* Copyright (c) 2002 - 2006 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 class acts as a high level wrapper around the media server +* playback and recording functionalities. +* +*/ + + +// INCLUDE FILES +#include "CVRSystemEventHandler.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // Feature manager + +#include +#include +#include "VoiceRecorderPrivatePSKeys.h" +#include "CVRMemo.h" +#include "MVRObserver.h" +#include "VRConsts.h" +#include "VRUtils.h" +#include "CVRTonePlayer.h" +#include "CVRMdaRecorder.h" +#include "CVRDiskSpaceWatcher.h" +#include "CVRRecViewModel.h" +#include + + +// MACROS +#ifdef _DEBUG +#define DEB_PRN_0(str) RDebug::Print(str) +#else +#define DEB_PRN_0(str) +#endif + +// CONSTANTS +const TInt KVRMdaRecorderDefaultStep( 5 ); +const TInt KVRObserverArrayGranularity( 2 ); +const TInt KVRMaxNoteLabelLength( 256 ); + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::CVRMdaRecorder +// +// --------------------------------------------------------------------------- +// +CVRMdaRecorder::CVRMdaRecorder() : + iObservers( KVRObserverArrayGranularity ), + iIsAttachedToMemo( EFalse ), + iMediaServerError( KErrNone ), + iDimLight (EFalse), + iAttachingToMemo(EFalse), + ifInRecording(EFalse), + ifStopCalled(EFalse) + { + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::~CVRMdaRecorder +// +// --------------------------------------------------------------------------- +// +CVRMdaRecorder::~CVRMdaRecorder() + { + + delete iGlobalNote; + delete iAudioInput; + delete iAudioRecorder; + delete iErrorUI; + delete iTimer; + delete iTonePlayer; + delete iLight; + delete iDiskSpaceWatcher; + iObservers.Close(); + + if (iCurrentCallHandler) + { + delete iCurrentCallHandler; + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::ConstructL() + { + _LIT_SECURITY_POLICY_S0( KVRWritePolicy, KVoiceRecorderAppUID3 ); + _LIT_SECURITY_POLICY_PASS( KVRReadPolicy ); + // Connect to Pub&Sub: + // Error ignored, key may be already defined which is ok for us + iPropVRState.Define( KPSUidVoiceRecorder, KVoiceRecorderMode, 0, + KVRReadPolicy, KVRWritePolicy ); + + User::LeaveIfError( + iPropVRState.Attach( + KPSUidVoiceRecorder, KVoiceRecorderMode ) ); + + // To allow/don't allow screensaver + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Attach( KPSUidScreenSaver, + KScreenSaverAllowScreenSaver ); + iAudioRecorder = CMdaAudioRecorderUtility::NewL( *this, NULL, + KAudioPriorityRecording, TMdaPriorityPreference( + KAudioPrefRealOneLocalPlayback ) ); + + iGlobalNote = CAknGlobalNote::NewL(); + + iErrorUI = CErrorUI::NewL(); + + iTonePlayer = CVRTonePlayer::NewL(); + iTonePlayer->PrepareToneL( EAvkonSIDVoiceRecordingStartTone ); + + iLight = CHWRMLight::NewL(this); + + // start observe diskdrive + RFs& fs( CEikonEnv::Static()->FsSession() ); + + iDiskSpaceWatcher = CVRDiskSpaceWatcher::NewL(*this, fs); + + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::MoscoStateChangeEvent +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::MoscoStateChangeEvent( CBase* /*aObject*/, + TInt aPreviousState, + TInt aCurrentState, + TInt aErrorCode ) + { +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: MoscoStateChangeEvent() prev: %d, current: %d, error: %d" ), + aPreviousState, aCurrentState, aErrorCode ); +#endif + iMediaServerError = aErrorCode; + + TRAP_IGNORE(CreateAudioInputL()); + + + // Stop the active scheduler wait (if present) + if ( iActiveWait.IsStarted() ) + { + iActiveWait.AsyncStop(); + } + + if (iMediaServerError != KErrNone ) + { + + // when mmc card is used and unpluged, this error returned + if (iMediaServerError == KErrCorrupt || iMediaServerError == KErrNotReady) + { + CVRRecViewModel* iViewModel = NULL; + //iAudioRecorder->Close(); + iViewModel = dynamic_cast (iAutoStopObserver); + if(iViewModel != NULL) + { + TRAP_IGNORE( iViewModel->HandleCommandL(EEikCmdExit) ); + } + else + { + TRAP_IGNORE( CEikonEnv::Static()->EikAppUi()->HandleCommandL( EAknSoftkeyExit) ); + } + } + + // Media server reports KErrDied if the playing was interrupted + // by some other system sound triggered by for example incoming SMS + + if (aPreviousState == CMdaAudioClipUtility::ERecording || aPreviousState == CMdaAudioClipUtility::EPlaying ) + { + + //if ( iMediaServerError != KErrDied && iMediaServerError != KErrAccessDenied ) + if ( iMediaServerError != KErrDied && + iMediaServerError != KErrAccessDenied && + iMediaServerError != KErrInUse ) + { + TBuf< KVRMaxNoteLabelLength > label; + + // If showing of error note fails, then.. well it fails + if ( iMediaServerError == KErrNotSupported ) + { + CCoeEnv::Static()-> + ReadResourceAsDes16( label, R_VR_UNSUPPORTED_INFONOTE_LABEL ); + + TRAP_IGNORE( iGlobalNote-> + ShowNoteL( EAknGlobalErrorNote, label ) ); + + } + else if ( iMediaServerError == KErrCorrupt ) + { + CCoeEnv::Static()-> + ReadResourceAsDes16( label, R_VR_CORRUPT_INFONOTE_LABEL ); + + TRAP_IGNORE( iGlobalNote->ShowNoteL( EAknGlobalErrorNote, + label ) ); + } + + else + { + TRAP_IGNORE( iErrorUI->ShowGlobalErrorNoteL( iMediaServerError ) ); + } + + } + if(iMediaServerError == KErrInUse && aPreviousState == CMdaAudioClipUtility::EPlaying) + { + CVRRecViewModel* iViewModel = NULL; + iViewModel = dynamic_cast (iAutoStopObserver); + if(iViewModel != NULL) + { + iViewModel->HandleCommandL(ECmdPause); + } + return; + } + else + { + StopAndNotify(); + } + } + + //it will happen when the openfile fails + if (aPreviousState == CMdaAudioClipUtility::ENotReady && aCurrentState == CMdaAudioClipUtility::ENotReady ) + { +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: callback stop called" ) ); +#endif + iAudioRecorder->Close(); + } + +#ifdef _DEBUG + if ( aCurrentState == CMdaAudioClipUtility::ERecording) + { + RDebug::Print( _L( "VoiceRecorder: ERecording" ) ); + } +#endif + + } // if ( iMediaServerError != KErrNone ) + + if ( aCurrentState == CMdaAudioClipUtility::ERecording || + aCurrentState == CMdaAudioClipUtility::EPlaying ) + { + // Do not allow screen saver while playing + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Set( KPSUidScreenSaver, + KScreenSaverAllowScreenSaver, EVRScreenSaverNotAllowed ); + } + + if ( aCurrentState == CMdaAudioClipUtility::EOpen ) + { + switch ( aPreviousState ) + { + case CMdaAudioClipUtility::ENotReady: + { + iMemo->UpdateModifiedDate(); + if ( iAttachingToMemo ) + { + iAttachingToMemo = EFalse; + TRAP_IGNORE( ConfigureMemoL()); + } + break; + } + default: + { + StopAndNotify(); + break; + } + } + } + DEB_PRN_0( _L( "CVRMdaRecorder::MoscoStateChangeEvent::Exit")); + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::RegisterObserver +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::RegisterObserver( MVRObserver* aObserver ) + { + if ( aObserver && iObservers.Find( aObserver ) == KErrNotFound ) + { + iObservers.Append( aObserver ); + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::UnregisterObserver +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::UnregisterObserver( MVRObserver* aObserver ) + { + if ( !aObserver ) + { + return; + } + + TInt index( iObservers.Find( aObserver ) ); + if ( index != KErrNotFound ) + { + iObservers.Remove( index ); + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::SetAutoStopObserver +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::SetAutoStopObserver( MVRObserver* aObserver ) + { + iAutoStopObserver = aObserver; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::AttachToMemoL +// Opens a memo file. +// If the specified file does not exist (yet), it is created. +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::AttachToMemoL( CVRMemo* aMemo ) + { +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL -enter" )); +#endif + + // if error happen, attach will fail + + if( iIsAttachedToMemo ) + { + User::Panic( KVRPanic,EPanicAlreadyAttached ); + } + + if( !aMemo ) + { + User::Panic( KVRPanic, KErrNotFound ); + } + + iMemo = aMemo; + + // if the mmc card is full, should not attach to it + + RFs& fs( CEikonEnv::Static()->FsSession() ); + + +// old storage system +#ifndef RD_MULTIPLE_DRIVE + if ( iMemo->MemoStore() == EMemoStorePhoneMemory ) + { +#ifdef __AAC_ENCODER_PLUGIN + if (((iMemo->Quality() != EQualityHigh) && SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) || + ((iMemo->Quality() == EQualityHigh) && SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRAACCriticalMemoryLevel ))) +#else + // now AAC format is not enabled + if (SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) +#endif + { + VRUtils::ShowMemoryFullConfirmationQuery(); + if(GetInRecordingFlag()) + { + SetInRecordingFlag(EFalse); + } + } + + } + + // MMC card + else + { +#ifdef __AAC_ENCODER_PLUGIN + if (((iMemo->Quality() != EQualityHigh) && SysUtil::MMCSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) || + ((iMemo->Quality() == EQualityHigh) && SysUtil::MMCSpaceBelowCriticalLevelL( &fs, KVRAACCriticalMemoryLevel ))) +#else + // now AAC format is not enabled + if (SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) +#endif + { + VRUtils::ShowMemoryFullConfirmationQuery(ETrue); + + if(GetInRecordingFlag()) + { + SetInRecordingFlag(EFalse); + } + } + } + +// now multiple drives +#else + +#ifdef __AAC_ENCODER_PLUGIN + if (((iMemo->Quality() != EQualityHigh) && SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf, iMemo->StorageDrive())) || + ((iMemo->Quality() == EQualityHigh) && SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KVRAACCriticalMemoryLevel, iMemo->StorageDrive()))) +#else + // now AAC format is not enabled + if (SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf, iMemo->StorageDrive())) +#endif + + { + //mmc card + if ( iMemo->StorageDrive() == VRUtils::GetRemovableMassStorageL()) + { + VRUtils::ShowMemoryFullConfirmationQuery(ETrue); + } + else + { + VRUtils::ShowMemoryFullConfirmationQuery(); + } + if(GetInRecordingFlag()) + { + SetInRecordingFlag(EFalse); + } + } + + +#endif + + // opens an existing file or creates new + iAudioRecorder->OpenFileL( iMemo->File() ); + + iAttachingToMemo = ETrue; + + if( !iActiveWait.IsStarted() ) + { +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL::AWaitStarting...")); +#endif + iActiveWait.Start(); // CSI: 10 # + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL::AWResuming...[%d]"), iMediaServerError); +#endif + } + + User::LeaveIfError( iMediaServerError ); + + + +/* + if( !iActiveWait.IsStarted() ) + { + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL::AWaitStarting...")); + iActiveWait.Start(); // CSI: 10 # + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL::AWResuming...[%d]"), iMediaServerError); + } + + User::LeaveIfError( iMediaServerError ); + + // Configure bitrate if recording an AMR clip. + // Default bitrate is 12200 and it's used if codec doesn't support + // the bitrate that is retrieved from Central Repository. + if (iMemo->Quality() == EQualityMMSOptimized ) + { + TUint configuredAmrBitrate( VRUtils::AMRBitrateL() ); + TUint amrBitrate( KVRDefaultAmrBitrate ); + + // Fetch supported bitrates and find out if configured bitrate + // is supported + RArray rates; + iAudioRecorder->GetSupportedBitRatesL( rates ); + TInt num = rates.Count(); + if(num > 0) + { + rates.Sort(); + TInt found = rates.Find(configuredAmrBitrate); + if (found == KErrNotFound) + { + amrBitrate = rates[num-1]; + } + } + rates.Reset(); // Clear array + iAudioRecorder->SetDestinationBitRateL( amrBitrate ); + } + + +// added for supporting mp4 format +#ifdef __AAC_ENCODER_PLUGIN + else if (iMemo->Quality() == EQualityHigh) + { + + TInt configuredAacSamplerate( VRUtils::AACSamplerateL() ); + TInt aacSampleRate( KVRDefaultSamplerateAac ); + + TInt configuredAacBitrate( VRUtils::AACBitrateL() ); + TInt aacBitrate( KVRDefaultBitrateAac ); + + TInt configuredAudioMode( VRUtils::AACAudioModeL() ); + + // Sample rate + RArray supportedSampleRates; +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-GetSupportedSampleRatesL -before" )); +#endif + iAudioRecorder->GetSupportedSampleRatesL(supportedSampleRates); + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-GetSupportedSampleRatesL -after" )); +#endif + + TInt num1 = supportedSampleRates.Count(); + if(num1 > 0) + { + supportedSampleRates.Sort(); + TInt found1 = supportedSampleRates.Find(configuredAacSamplerate); + if (found1 == KErrNotFound) + { + aacSampleRate = supportedSampleRates[num1-1]; + } + } + + supportedSampleRates.Reset(); +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-SetDestinationSampleRateL -before, sampleRate is %d"), aacSampleRate); +#endif + iAudioRecorder->SetDestinationSampleRateL(aacSampleRate); + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-SetDestinationSampleRateL -after" )); +#endif + + + // Bit reate + RArray supportedBitRates; + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-GetSupportedBitRatesL -before" )); +#endif + iAudioRecorder->GetSupportedBitRatesL(supportedBitRates); + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-GetSupportedBitRatesL -after" )); +#endif + + TInt num2 = supportedBitRates.Count(); + if(num2 > 0) + { + supportedBitRates.Sort(); + TInt found2 = supportedBitRates.Find(configuredAacBitrate); + if (found2 == KErrNotFound) + { + aacBitrate = supportedBitRates[num2-1]; + } + } + + supportedBitRates.Reset(); + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-SetDestinationBitRateL -before, bitrate is %d"), aacBitrate); +#endif + iAudioRecorder->SetDestinationBitRateL(aacBitrate); + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-SetDestinationBitRateL -after" )); +#endif + + // the audio mode flag + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL-GetSupportedNumberOfChannelsL -before" )); +#endif + RArray supportedNumberOfChannels; + iAudioRecorder->GetSupportedNumberOfChannelsL(supportedNumberOfChannels); + TInt num3 = supportedNumberOfChannels.Count(); + if (num3 > 0) + { + supportedNumberOfChannels.Sort(); + TInt ifFound = supportedNumberOfChannels.Find(configuredAudioMode); + if (ifFound == KErrNotFound) + { + configuredAudioMode = supportedNumberOfChannels [0]; + } + } + supportedNumberOfChannels.Reset(); + iAudioRecorder->SetDestinationNumberOfChannelsL(configuredAudioMode); + + } +#endif + iIsAttachedToMemo = ETrue; + ResetPosition(); +*/ + +#ifdef _DEBUG + RDebug::Print( _L( "CVRMdaRecorder::AttachToMemoL -exit" )); +#endif + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::CreateNewMemoL +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::CreateNewMemoL( CVRMemo* aMemo ) + { + iMemo = aMemo; + iAudioRecorder->OpenFileL( aMemo->File() ); + if ( !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); // CSI: 10 # + } + User::LeaveIfError( iMediaServerError ); + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::DetachMemo +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::DetachMemo() + { + if ( iIsAttachedToMemo ) + { + Stop(); + //Need to delete iAudioInput before close!!! + DeleteAudioInput(); + + iAudioRecorder->Close(); + + iMemo = NULL; + iIsAttachedToMemo = EFalse; + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::SetVolume +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::SetVolume( TInt aStep, TInt aMaxSteps ) + { + if ( iIsAttachedToMemo ) + { + // On device, MaxVolume() typically returns 9. + TInt maxVolume( iAudioRecorder->MaxVolume() ); + TInt volume = maxVolume * aStep / aMaxSteps; + + // Just to make sure that volume is between 0 .. MaxVolume + if ( volume < 0) + { + volume = 0; + } + else if ( volume > maxVolume ) + { + volume = maxVolume; + } + +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: Set volume: %d, max volume: %d" ), + volume, maxVolume ); +#endif + iAudioRecorder->SetVolume( volume ); + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::PlayL +// +// --------------------------------------------------------------------------- +// +TInt CVRMdaRecorder::PlayL() + { + __ASSERT_DEBUG( iIsAttachedToMemo, User::Panic( KVRPanic, + EPanicNotAttached ) ); + + if( iPause ) + { + iAudioRecorder->SetPosition( iPosition ); + iPosition = 0; + iPause = EFalse; + } + + // This line was added to prevent MMF crash, remove it when play works + // without this + iAudioRecorder->SetPlaybackBalance( KMMFBalanceCenter ); + + SetIfStopCalled(EFalse); + iAudioRecorder->PlayL(); + + User::LeaveIfError( iPropVRState.Set( KPSUidVoiceRecorder, + KVoiceRecorderMode, EVRPlaying ) ); + + // Do not allow screen saver while playing + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Set( KPSUidScreenSaver, + KScreenSaverAllowScreenSaver, EVRScreenSaverNotAllowed ); + + if( !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); // CSI: 10 # + } + StartTimerL(); + return iMediaServerError; + } + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::RecordL +// Starts the recording of a sound clip. Checks the memory space situation +// and plays start tone before starting recording. +// --------------------------------------------------------------------------- +// +TInt CVRMdaRecorder::RecordL() + { + // If we receive record command and file is not opened yet. wait for file + // to be opened and then resume. + if ( !iIsAttachedToMemo && iAttachingToMemo && !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); + User::LeaveIfError( iMediaServerError ); + } + + __ASSERT_DEBUG( iIsAttachedToMemo, User::Panic( KVRPanic, + EPanicNotAttached ) ); + TBool wasPaused( iPause ); + iPause = EFalse; + + // Check if available memory is/goes below critical level + // in that case record is not performed + // KVRRecStartMemBuf should be size of 60 sec AMR and 5 sec WAV + // New max time estimation for WAV is calculated after 5 secs + RFs& fs( CEikonEnv::Static()->FsSession() ); + + TBool critical( EFalse ); + +// the current storage system (phone memory and mmc card) +#ifndef RD_MULTIPLE_DRIVE + if ( iMemo->MemoStore() == EMemoStorePhoneMemory ) + { +#ifdef __AAC_ENCODER_PLUGIN + if (((iMemo->Quality() != EQualityHigh) && SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) || + ((iMemo->Quality() == EQualityHigh) && SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRAACCriticalMemoryLevel ))) +#else + // now AAC format is not enabled + if (SysUtil::FFSSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) +#endif + { + VRUtils::ShowMemoryFullConfirmationQuery(); + critical = ETrue; + } + } + + // MMC card + else + { +#ifdef __AAC_ENCODER_PLUGIN + if (((iMemo->Quality() != EQualityHigh) && SysUtil::MMCSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) || + ((iMemo->Quality() == EQualityHigh) && SysUtil::MMCSpaceBelowCriticalLevelL( &fs, KVRAACCriticalMemoryLevel ))) +#else + // now AAC format is not enabled + if (SysUtil::MMCSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf )) +#endif + { + VRUtils::ShowMemoryFullConfirmationQuery( ETrue ); + critical = ETrue; + } + + } + +// now for multiple drives +#else +#ifdef __AAC_ENCODER_PLUGIN + if (((iMemo->Quality() != EQualityHigh) && SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf, iMemo->StorageDrive())) || + ((iMemo->Quality() == EQualityHigh) && SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KVRAACCriticalMemoryLevel, iMemo->StorageDrive()))) +#else + // now AAC format is not enabled + if (SysUtil::DiskSpaceBelowCriticalLevelL( &fs, KVRRecStartMemBuf, iMemo->StorageDrive())) +#endif + { + if ( iMemo->StorageDrive() == VRUtils::GetRemovableMassStorageL()) + { + VRUtils::ShowMemoryFullConfirmationQuery(ETrue); + } + else + { + VRUtils::ShowMemoryFullConfirmationQuery(); + } + critical = ETrue; + } + + +#endif + + if( critical ) + { + User::Leave( KErrDiskFull ); + } + + + if ( !wasPaused ) + { + iTonePlayer->PlayTone( EAvkonSIDVoiceRecordingStartTone ); + iTonePlayer->PrepareToneL( EAvkonSIDVoiceRecordingStopTone ); + } + +// start monitor disk space +#ifdef __AAC_ENCODER_PLUGIN + if (iMemo->Quality() == EQualityHigh) + { + TInt drive (0); +#ifndef RD_MULTIPLE_DRIVE + if ( iMemo->MemoStore() == EMemoStorePhoneMemory ) + { + drive = EDriveC; + } + else + { + drive = EDriveE; + } +// multiple drives +#else + drive = iMemo->StorageDrive(); +#endif + + iDiskSpaceWatcher->RequestNotification(KVRAACCriticalMemoryLevel,drive); + } +#endif + + // Set recording preference + iAudioRecorder->SetPriority( KAudioPriorityRecording, + TMdaPriorityPreference( KAudioPrefVoiceRec ) ); + iAudioRecorder->SetGain( iAudioRecorder->MaxGain() ); + + SetIfStopCalled(EFalse); + + iAudioRecorder->RecordL(); + + // Sets the indication that recording has started -> + // Current file's handle can't be reused for next file + iMemo->SetRecorded( ETrue ); + + + User::LeaveIfError( iPropVRState.Set( KPSUidVoiceRecorder, + KVoiceRecorderMode, EVRRecording ) ); + + // Do not allow screen saver while recording + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Set( KPSUidScreenSaver, KScreenSaverAllowScreenSaver, + EVRScreenSaverNotAllowed ); + + if( !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); // CSI: 10 # + } + StartTimerL(); + + return iMediaServerError; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::Stop +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::Stop() + { + if ( iIsAttachedToMemo ) + { + TBool reallyStopping( iPause ); +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: Stop error: %d" ), + iMediaServerError ); +#endif + iPause = EFalse; + + if( iAudioRecorder->State() == CMdaAudioRecorderUtility::ERecording ) + { + reallyStopping = ETrue; + + // if the dim light is on, turn off it. + if(iDimLight) + { + + iLight->ReleaseLight (CHWRMLight::EPrimaryDisplay); + User::ResetInactivityTime(); + iDimLight = EFalse; + } + + } + // it will tell VRecorder not pause because it has been stopped. + SetIfStopCalled(ETrue); + iAudioRecorder->Stop(); + + // if error does not happen in recording, change the file to visible + iMemo->File().SetAtt( KEntryAttNormal, KEntryAttHidden); + + iTonePlayer->PlayTone( EAvkonSIDVoiceRecordingStopTone ); + iTonePlayer->PrepareTone( EAvkonSIDVoiceRecordingStartTone ); + + if( ( iAudioRecorder->State() == CMdaAudioRecorderUtility::EOpen ) || + reallyStopping ) + { + // Set lower preference to ensure other sounds will + // be played correctly + iAudioRecorder->SetPriority( KAudioPriorityRecording, + TMdaPriorityPreference( KAudioPrefRealOneLocalPlayback ) ); + } + + // Error value ignored if PS key is not available + iPropVRState.Set( KPSUidVoiceRecorder, KVoiceRecorderMode, EVRIdle ); + // Used to check the state of a phone call if any + + if ( iCurrentCallHandler ) + { + delete iCurrentCallHandler; + iCurrentCallHandler = NULL; + } + + TRAP_IGNORE( iCurrentCallHandler = CVRSystemEventHandler::NewL() ); + TInt currentState( 0 ); + TRAP_IGNORE( currentState = iCurrentCallHandler->StateL( KPSUidCtsyCallInformation, KCTsyCallState ) ); + + // Do not allow screen saver if there is an active phone call + if(currentState == EPSCTsyCallStateRinging) + { + // Do not allow screen saver + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Set( KPSUidScreenSaver, + KScreenSaverAllowScreenSaver, EVRScreenSaverNotAllowed ); + } + else + { + // Allow screen saver + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Set( KPSUidScreenSaver, + KScreenSaverAllowScreenSaver, EVRScreenSaverAllowed ); + } + + StopTimer(); + ResetPosition(); + iMemo->UpdateModifiedDate(); + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::StopAndNotify +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::StopAndNotify() + { + Stop(); + if ( iAutoStopObserver ) + { +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: StopAndNotify AutoStopObserver: %d" ), + iMediaServerError ); +#endif + iAutoStopObserver->Update(); +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: StopAndNotify AutoStopObserver: %d" ), + iMediaServerError ); +#endif + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::Pause +// +// --------------------------------------------------------------------------- +void CVRMdaRecorder::Pause() + { + __ASSERT_DEBUG( iIsAttachedToMemo, User::Panic( KVRPanic, + EPanicNotAttached ) ); + + iPause = ETrue; + +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: Pause called. Position: %d:%d"), + I64HIGH( iPosition.Int64() ), I64LOW( iPosition.Int64() ) ); +#endif + + iAudioRecorder->Stop(); + + // Error value ignored if PS key is not available + iPropVRState.Set( KPSUidVoiceRecorder, KVoiceRecorderMode, EVRIdle ); + + // Don't allow screen saver + // Errors ignored, no actions needed if API is not available + iPropScreenSaver.Set( KPSUidScreenSaver, + KScreenSaverAllowScreenSaver, EVRScreenSaverAllowed ); + + StopTimer(); + SyncAndNotify(); + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::ForwardL +// +// --------------------------------------------------------------------------- +// +TInt CVRMdaRecorder::ForwardL() + { + if ( !MovePositionL( KVRMdaRecorderDefaultStep ) ) + { + return KErrOverflow; + } + return iMediaServerError; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::RewindL +// +// --------------------------------------------------------------------------- +// +TInt CVRMdaRecorder::RewindL() + { + MovePositionL( -KVRMdaRecorderDefaultStep ); + return iMediaServerError; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::CanAcceptCommands +// +// --------------------------------------------------------------------------- +// +TBool CVRMdaRecorder::CanAcceptCommands() const + { + return !iActiveWait.IsStarted(); + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::MovePositionL +// +// --------------------------------------------------------------------------- +// +TBool CVRMdaRecorder::MovePositionL( TInt aSeconds ) + { + __ASSERT_DEBUG( iIsAttachedToMemo, User::Panic( KVRPanic, + EPanicNotAttached ) ); + +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: MovePosition called. Base position: %d:%d"), + I64HIGH( iAudioRecorder->Position().Int64() ), + I64LOW( iAudioRecorder->Position().Int64() ) ); +#endif + + TInt64 interval; + if (iPause) + { + interval = iPosition.Int64() + aSeconds * KVRSecondAsMicroSeconds; + } + // Not sure if iPosition value is valid other than when paused, so do as + // previous for all other states: + else + { + interval = iAudioRecorder->Position().Int64() + + aSeconds * + KVRSecondAsMicroSeconds; + } + + // Truncated to integer values + TInt integerInterval( interval / KVRSecondAsMicroSeconds ); + TInt integerDuration( iAudioRecorder->Duration().Int64() / + KVRSecondAsMicroSeconds ); + if ( interval < 0 ) + { + interval = 0; + } + // if gone past the end or integer values are the same + // in duration and position + else if ( interval > iAudioRecorder->Duration().Int64() || + integerInterval == integerDuration ) + { + interval = iAudioRecorder->Duration().Int64(); + } + +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: MovePosition called. Interval: %d:%d"), + I64HIGH( interval ), I64LOW( interval ) ); +#endif + + TTimeIntervalMicroSeconds newPosition( interval ); + + if (iPause) + { + iPosition = newPosition; + } + else if ( iAudioRecorder->State() == CMdaAudioClipUtility::EOpen ) + { + // not playing, recording or paused. +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder. Idle.: MovePosition called. New Position: %d:%d"), + I64HIGH( newPosition.Int64() ), I64LOW( newPosition.Int64() ) ); +#endif + iAudioRecorder->SetPosition( newPosition ); + } + else + { + +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder. Playing.: MovePosition called. New Position: %d:%d"), + I64HIGH( newPosition.Int64() ), I64LOW( newPosition.Int64() ) ); +#endif + + iAudioRecorder->Stop(); + iAudioRecorder->SetPosition( newPosition ); + iAudioRecorder->PlayL(); + if( !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); // CSI: 10 # + } + } + SyncAndNotify(); + return ETrue; + } + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::ConfigureMemoL() +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::ConfigureMemoL() + { + DEB_PRN_0( _L( "CVRMdaRecorder::ConfigureMemoL-Enter" )); + + // Configure bitrate if recording an AMR clip. + // Default bitrate is 12200 and it's used if codec doesn't support + // the bitrate that is retrieved from Central Repository. + if (iMemo->Quality() == EQualityMMSOptimized ) + { + TUint configuredAmrBitrate( VRUtils::AMRBitrateL() ); + TUint amrBitrate( KVRDefaultAmrBitrate ); + + // Fetch supported bitrates and find out if configured bitrate + // is supported + RArray rates; + iAudioRecorder->GetSupportedBitRatesL( rates ); + TInt num = rates.Count(); + if(num > 0) + { + rates.Sort(); + TInt found = rates.Find(configuredAmrBitrate); + if (found == KErrNotFound) + { + amrBitrate = rates[num-1]; + } + } + rates.Reset(); // Clear array + iAudioRecorder->SetDestinationBitRateL( amrBitrate ); + + DEB_PRN_0( _L( "CVRMdaRecorder::ConfigureMemoL-Configured MMSOpt bitrate" )); + } + + + // added for supporting mp4 format +#ifdef __AAC_ENCODER_PLUGIN + else if (iMemo->Quality() == EQualityHigh) + { + TInt configuredAacSamplerate( VRUtils::AACSamplerateL() ); + TInt aacSampleRate( KVRDefaultSamplerateAac ); + + TInt configuredAacBitrate( VRUtils::AACBitrateL() ); + TInt aacBitrate( KVRDefaultBitrateAac ); + + TInt configuredAudioMode( VRUtils::AACAudioModeL() ); + + // Sample rate + RArray supportedSampleRates; + iAudioRecorder->GetSupportedSampleRatesL(supportedSampleRates); + + TInt num1 = supportedSampleRates.Count(); + if(num1 > 0) + { + supportedSampleRates.Sort(); + TInt found1 = supportedSampleRates.Find(configuredAacSamplerate); + if (found1 == KErrNotFound) + { + aacSampleRate = supportedSampleRates[num1-1]; + } + } + supportedSampleRates.Reset(); + iAudioRecorder->SetDestinationSampleRateL(aacSampleRate); + + DEB_PRN_0( _L( "CVRMdaRecorder::ConfigureMemoL-Configured HiQ sampling rate" )); + + // Bit reate + RArray supportedBitRates; + iAudioRecorder->GetSupportedBitRatesL(supportedBitRates); + TInt num2 = supportedBitRates.Count(); + if(num2 > 0) + { + supportedBitRates.Sort(); + TInt found2 = supportedBitRates.Find(configuredAacBitrate); + if (found2 == KErrNotFound) + { + aacBitrate = supportedBitRates[num2-1]; + } + } + supportedBitRates.Reset(); + iAudioRecorder->SetDestinationBitRateL(aacBitrate); + DEB_PRN_0( _L( "CVRMdaRecorder::ConfigureMemoL-Configured HiQ bit rate" )); + + // the audio mode flag + RArray supportedNumberOfChannels; + iAudioRecorder->GetSupportedNumberOfChannelsL(supportedNumberOfChannels); + TInt num3 = supportedNumberOfChannels.Count(); + if (num3 > 0) + { + supportedNumberOfChannels.Sort(); + TInt ifFound = supportedNumberOfChannels.Find(configuredAudioMode); + if (ifFound == KErrNotFound) + { + configuredAudioMode = supportedNumberOfChannels [0]; + } + } + supportedNumberOfChannels.Reset(); + iAudioRecorder->SetDestinationNumberOfChannelsL(configuredAudioMode); + + DEB_PRN_0( _L( "CVRMdaRecorder::ConfigureMemoL-Configured HiQ channel" )); + } +#endif // __AAC_ENCODER_PLUGIN + iIsAttachedToMemo = ETrue; + ResetPosition(); + DEB_PRN_0( _L( "CVRMdaRecorder::ConfigureMemoL-Exit" )); + } + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::ResetPosition +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::ResetPosition() + { + if ( iIsAttachedToMemo ) + { + iAudioRecorder->SetPosition( TTimeIntervalMicroSeconds( 0 ) ); + SyncAndNotify(); + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::StartTimerL +// Create and start a timer with initial delay of 0 +// and a frequency of one second +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::StartTimerL() + { + StopTimer(); // stop if already running + + TCallBack cb( TimerCallBack, this ); + iTimer = CPeriodic::NewL( 1 ); // priority = EPriorityNormal + 1 = 1 + iTimer->Start( 0, KVRDisplayUpdateDelay, cb ); + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::StopTimer +// Stop the timer by deleting the CPeriodic object +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::StopTimer() + { + delete iTimer; + iTimer = NULL; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::SyncAndNotify +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::SyncAndNotify() + { + if(!iPause) + { + iPosition = iAudioRecorder->Position(); + } + iMemo->SetPosition( iPosition ); + + iMemo->SetDuration( iAudioRecorder->Duration() ); + + for ( int i = 0; i < iObservers.Count(); i++ ) + { + TVRUpdateCommand command( EVRUpdate ); + if ( ( iMemo->Position().Int64() / KVRSecondAsMicroSeconds ) == 1 ) + { + command = EVRUpdate1Second; + } + iObservers[ i ]->Update( command ); + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::TimerCallBack +// +// --------------------------------------------------------------------------- +// +TInt CVRMdaRecorder::TimerCallBack( TAny* aMdaRecorder ) + { + CVRMdaRecorder* recorder = reinterpret_cast< CVRMdaRecorder* >( + aMdaRecorder ); + recorder->HandleTick(); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::HandleTick +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::HandleTick() + { + SyncAndNotify(); + + if ( iAudioRecorder->State() == CMdaAudioClipUtility::ERecording ) + { + + TTimeIntervalMicroSeconds position( 0 ); + TTimeIntervalMicroSeconds duration( 0 ); + TTimeIntervalMicroSeconds maxDuration( 0 ); + + position = iMemo->Position(); + duration = iMemo->Duration(); + maxDuration = iMemo->MaxDuration(); + + // Position value is used for comparison because it gives more accurate + // value than Duration value + if ( position >= maxDuration ) + { +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: Max duration passed. Position: %d:%d"), + I64HIGH( position.Int64() ), I64LOW( position.Int64() ) ); +#endif + +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: Max duration passed. Duration: %d:%d"), + I64HIGH( duration.Int64() ), I64LOW( duration.Int64() ) ); +#endif + +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: Max duration passed. MaxDuration: %d:%d"), + I64HIGH( maxDuration.Int64() ), I64LOW( maxDuration.Int64() ) ); +#endif + // Note that some data cropping is possible after stopping + // ->Duration decreases + StopAndNotify(); + } + } + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::SetIhf +// +// --------------------------------------------------------------------------- +// +TInt CVRMdaRecorder::SetIhf( TBool /*aEnabled*/ ) + { + return KErrNotSupported; + } + + +// --------------------------------------------------------------------------- +// CVRMdaRecorder::SetPositionL +// +// --------------------------------------------------------------------------- +// +void CVRMdaRecorder::SetPositionL( TInt aSeconds ) + { + __ASSERT_DEBUG( iIsAttachedToMemo, User::Panic( KVRPanic, + EPanicNotAttached ) ); + + if( iAudioRecorder->State() == CMdaAudioClipUtility::ERecording || + iAudioRecorder->State() == CMdaAudioClipUtility::ENotReady ) + { + return; + } + + TInt64 interval ( TInt64( aSeconds ) * KVRSecondAsMicroSeconds ); + + // Truncated to integer values + TInt integerInterval( interval / KVRSecondAsMicroSeconds ); + TInt integerDuration( iAudioRecorder->Duration().Int64() / + KVRSecondAsMicroSeconds ); + + if ( interval < 0 || integerDuration == 0 ) + { + interval = 0; + } + // if gone past the end or integer values are the same in + // duration and position + else if ( interval > iAudioRecorder->Duration().Int64() || + integerInterval == integerDuration ) + { + interval = iAudioRecorder->Duration().Int64(); + } + + TTimeIntervalMicroSeconds newPosition( interval ); + + if ( iPause ) + { + iPosition = newPosition; + } + else if ( iAudioRecorder->State() == CMdaAudioClipUtility::EOpen ) + { + iAudioRecorder->SetPosition( newPosition ); + } + else + { + iAudioRecorder->Stop(); + iAudioRecorder->SetPosition( newPosition ); + iAudioRecorder->PlayL(); + if( !iActiveWait.IsStarted() ) + { + iActiveWait.Start(); // CSI: 10 # + } + } + SyncAndNotify(); + } + +// --------------------------------------------------------- +// From class MBacklightControlObserver. +// CNTExternalEventObserver::LightStatusChanged +// --------------------------------------------------------- +// +void CVRMdaRecorder::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus) + { + + if(aTarget == CHWRMLight::EPrimaryDisplayAndKeyboard || aTarget == CHWRMLight::EPrimaryDisplay) + { + if(aStatus == CHWRMLight::ELightOff) + { + if (iAudioRecorder) + { + if (iAudioRecorder->State() == CMdaAudioClipUtility::ERecording ) // set light to dimmed + { + + TRAPD(err, iLight->LightOnL(CHWRMLight::EPrimaryDisplay, KHWRMInfiniteDuration, 10, ETrue)); + if ( err == KErrNone ) + { + iDimLight = ETrue; + } + + } + } + + return; + } + + if((aStatus == CHWRMLight::ELightOn) && (aTarget == CHWRMLight::EPrimaryKeyboard)) + { + + if (iLight) + { + + CHWRMLight::TLightStatus status = iLight->LightStatus(CHWRMLight::EPrimaryDisplay); + + if( (status == CHWRMLight::ELightOn) && iDimLight ) + { + User::ResetInactivityTime(); + iDimLight = EFalse; + } + } + return; + } + + } + } + + +// --------------------------------------------------------- +// GetInRecordingFlag +// +// --------------------------------------------------------- +// +TBool CVRMdaRecorder::GetInRecordingFlag() + { + return ifInRecording; + } + + +// --------------------------------------------------------- +// SetInRecordingFlag +// --------------------------------------------------------- +// +void CVRMdaRecorder::SetInRecordingFlag(TBool aFlag) + { + ifInRecording = aFlag; + } + + +// --------------------------------------------------------- +// GetInRecordingFlag +// +// --------------------------------------------------------- +// +TBool CVRMdaRecorder::GetIfStopCalled() + { + return ifStopCalled; + } + + +// --------------------------------------------------------- +// SetInRecordingFlag +// --------------------------------------------------------- +// +void CVRMdaRecorder::SetIfStopCalled(TBool aFlag) + { + ifStopCalled = aFlag; + } + +// --------------------------------------------------------- +// IsAttachedToMemo +// --------------------------------------------------------- +// +TBool CVRMdaRecorder::IsAttachedToMemo() + { + return iIsAttachedToMemo; + } + + +// --------------------------------------------------------- +// CreateAudioInput +// --------------------------------------------------------- +// +void CVRMdaRecorder::CreateAudioInputL() + { + CAudioInput::TAudioInputPreference audioInput = CAudioInput::EDefaultMic; + + if ((iAudioRecorder->State() == CMdaAudioClipUtility::EOpen)&& + (!iAudioInput)) + { + iAudioInput = CAudioInput::NewL(*iAudioRecorder); + SetAudioInputL(audioInput); + iCurrentAudioInput = audioInput; + } + + } +// --------------------------------------------------------- +// SetAudioInputL +// --------------------------------------------------------- +// +void CVRMdaRecorder::SetAudioInputL(CAudioInput::TAudioInputPreference aAudioInput) + { + if((iAudioInput)&&(iCurrentAudioInput!=aAudioInput)) + { + RArray inputArray(4); + CleanupClosePushL( inputArray ); + inputArray.Append( aAudioInput ); + iAudioInput->SetAudioInputL( inputArray.Array() ); + CleanupStack::PopAndDestroy( &inputArray ); + iCurrentAudioInput = aAudioInput; + } + + } + +// --------------------------------------------------------- +// DeleteAudioInput +// --------------------------------------------------------- +// +void CVRMdaRecorder::DeleteAudioInput() + { + delete iAudioInput; + iAudioInput = NULL; + } + +// --------------------------------------------------------- +// ConfigSampleRateOfVoiceCallL +// --------------------------------------------------------- +// +void CVRMdaRecorder::ConfigSampleRateOfVoiceCallL() + { + // Sample rate + TUint sampleRates = iAudioRecorder->DestinationSampleRateL(); + TInt configuredAacSamplerate( VRUtils::AACSamplerateL() ); + if(sampleRates == configuredAacSamplerate) + { + return; + } + + if (iMemo->Quality() == EQualityHigh) + { + TInt aacSampleRate( KVRDefaultSamplerateAac ); + // Sample rate + RArray supportedSampleRates; + iAudioRecorder->GetSupportedSampleRatesL(supportedSampleRates); + TInt num1 = supportedSampleRates.Count(); + if(num1 > 0) + { + supportedSampleRates.Sort(); + TInt found1 = supportedSampleRates.Find(configuredAacSamplerate); + if (found1 == KErrNotFound) + { + aacSampleRate = supportedSampleRates[num1-1]; + } + } + supportedSampleRates.Reset(); + iAudioRecorder->SetDestinationSampleRateL(aacSampleRate); + } + } + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMdaRecorder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMdaRecorder.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,441 @@ +/* +* Copyright (c) 2002 - 2006 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 class acts as a high level wrapper around the media server +* playback and recording functionalities. +* +*/ + + +#ifndef __CVRMDARECORDER_H__ +#define __CVRMDARECORDER_H__ + +// INCLUDES +#include +#include +#include + +#include "MVRMdaRecorder.h" +#include "MVRUpdateEventProvider.h" + +#include +// FORWARD DECLARATIONS +class CVRSystemEventHandler; +class CAknGlobalNote; +class CMdaAudioRecorderUtility; +class CVRMemo; +class MVRObserver; +class CErrorUI; +class CAudioOutput; +class CVRTonePlayer; +class CVRDiskSpaceWatcher; +class CAudioInput; + +// CLASS DEFINITION +/** +* This class acts as a high level wrapper around the media server +* playback and recording functionalities. +*/ +NONSHARABLE_CLASS( CVRMdaRecorder ) + : public CBase, public MVRMdaRecorder, + public MMdaObjectStateChangeObserver, + public MVRUpdateEventProvider, + public MHWRMLightObserver // for light control + { + public: // Constructors and destructor + + /** + * Default constructor + */ + CVRMdaRecorder(); + + /** + * Destructor + */ + ~CVRMdaRecorder(); + + /** + * 2nd phase constructor + */ + void ConstructL(); + + public: // from MMdaObjectStateChangeObserver + + /** + * Encapsulates the interface for handling the change of state of + * an audio data sample object. + * @param aObject A pointer to the audio sample object that has + * changed state. + * @param aPreviousState The state before the change + * @param aCurrentState The state after the change + * @param aErrorCode If not KErrNone, then the error that + * caused the state change + */ + void MoscoStateChangeEvent( CBase* aObject, TInt aPreviousState, + TInt aCurrentState, TInt aErrorCode ); + + /** + * Registers an observer for receiving update notifications. + * @param aObserver The observer object. + */ + void RegisterObserver( MVRObserver* aObserver ); + + /** + * Unregisters a previously registered observer + * @param aObserver The observer object. + */ + void UnregisterObserver( MVRObserver* aObserver ); + + /** + * Registers an observer for receiving auto stop notifications. + * @param aObserver The observer object. + */ + void SetAutoStopObserver( MVRObserver* aObserver ); + + /** + * Attachs this recorder to a memo file, i.e. opens it + * and initialises media server. + * @param aMemo Specifies the file to be attached to. + */ + void AttachToMemoL( CVRMemo* aMemo ); + + /** + * Creates a new memo file and attachs to it. + * @param aMemo Specifies the file to be created. + */ + void CreateNewMemoL( CVRMemo* aMemo ); + + /** + * Detachs from the current memo, i.e. closes the file. + */ + void DetachMemo(); + + /** + * Sets playback volume. + * @param aStep Volume level in steps + * @param aMaxSteps How many steps there are (10 usually). + */ + void SetVolume( TInt aStep, TInt aMaxSteps ); + + /** + * Starts playback. + * @return System wide error code + */ + TInt PlayL(); + + /** + * Starts recording. + * @return System wide error code + */ + TInt RecordL(); + + /** + * Stops playback or recording. + */ + void Stop(); + + /** + * Pauses playback or recording. + */ + void Pause(); + + /** + * Moves the playing position forward 5 seconds. + * @return System wide error code. KErrOverflow if the + * position was forwarded past the end. + */ + TInt ForwardL(); + + /** + * Moves the playing position backward 5 seconds. + * @return System wide error code + */ + TInt RewindL(); + + /** + * Indicates if we are in a state that can accept + * more commands (i.e. all async calls have completed). + * @return ETrue if it's ok to proceed calling methods. + */ + TBool CanAcceptCommands() const; + + /** + * Set active speaker if feature is supported + * @param aEnabled ETrue if playback should be routed to IHF + * @return Error code returned by routing operation + */ + TInt SetIhf( TBool aEnabled ); + + /** + * Set the audio recorder position to a new value + * @param aSeconds The position to set + */ + void SetPositionL( TInt aSeconds ); + + /** + * From MBacklightControlObserver. + * Callback for change in backlight status + * + * @since S60 ?S60_version + * @param aTarget The target of light change event; keypad, screen or both + * @param aTarget New status of the target + */ + void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus); + + /** + * Returns iInRecording flag + * @return True or False + */ + TBool GetInRecordingFlag(); + + /** + * set iInRecording flag + * + */ + void SetInRecordingFlag(TBool); + + /** + * Returns ifStopCalled flag + * @return True or False + */ + TBool GetIfStopCalled(); + + /** + * set ifStopCalled flag + * + */ + void SetIfStopCalled(TBool); + + /** + * return the iIsAttachToMemo flag + * + */ + TBool IsAttachedToMemo(); + /** + * Sets the AudioInput. + * + * Leaves on error. + */ + void SetAudioInputL(CAudioInput::TAudioInputPreference aAudioInput); + + /** + * set sample rate during voice call + * + */ + void ConfigSampleRateOfVoiceCallL(); + +public: + friend class CVRDiskSpaceWatcher; + + private: // new methods + + /** + * Moves the playing position to beginning. + */ + void ResetPosition(); + + /** + * Stops playing or recording and notifies the observer + * registered with SetAutoStopObserver(). + */ + void StopAndNotify(); + + /** + * Updates duration and position fields in CVRMemo + * and notifies the observer registered with SetObserver(); + */ + void SyncAndNotify(); + + /** + * Creates and starts a CPeriodic timer object + * with a resolution of one second. + */ + void StartTimerL(); + + /** + * Stops and deletes the timer object. + */ + void StopTimer(); + + /** + * Called by the CPeriodic timer to handle a tick. + * Uses HandleTick() to do the actual work. + * @param aMdaRecorder Always a valid pointer to CVRMdaRecorder object + * @return ETrue to indicate that the timer should continue. + */ + static TInt TimerCallBack( TAny* aMdaRecorder ); + + /** + * Non-static variant of TimerCallBack (more convinient to implement). + */ + void HandleTick(); + + /** + * Moves the playing position forward or backward. + * @param aSeconds Negative for bacward, positive for forward + * @return EFalse if the position moved past the end + */ + TBool MovePositionL( TInt aSeconds ); + + /** + * Configures the memo to be recorded. + * + * This function reads configuration data (bitrate, sampling rate, + * mono/stereo information from utility and configures the clip opened + * recording. + * + * Leaves on error. + * + */ + void ConfigureMemoL(); + + + /** + * Creates the AudioInput. + * + * Leaves on error. + */ + void CreateAudioInputL(); + + + /** + * Deletes the AudioInput. + * + */ + void DeleteAudioInput(); + + + + private: // data + + /** + * For listening call events. Owned. + */ + CVRSystemEventHandler* iCurrentCallHandler; + + /** + * Pointer to the media server audio recorder object. Owned. + */ + CMdaAudioRecorderUtility* iAudioRecorder; + + /** + * Pointer to the voice memo object. Not owned. + */ + CVRMemo* iMemo; + + /** + * Pointer to the timer object. Owned. + */ + CPeriodic* iTimer; + + /** + * Pointers to the memo status observers. Not owned. + */ + RPointerArray iObservers; + + /** + * Pointer to the auto stop (non-user initiated) observer. Not owned. + */ + MVRObserver* iAutoStopObserver; + + + /** + * ETrue if a memo is currently attached. + */ + TBool iIsAttachedToMemo; + + /** + * Identifies the last media server error, or KErrNone. + */ + TInt iMediaServerError; + + /** + * CActiveScheduler wrapper object. Owned. + */ + CActiveSchedulerWait iActiveWait; + + /** + * Pointer to the generic error note object. Owned. + */ + CAknGlobalNote* iGlobalNote; + + /** + * Pointer to a Error UI object. Owned. + * Used for showing system error notes + */ + CErrorUI* iErrorUI; + + /** + * Pub&Sub property. + * For notifying voice dialing about the state of voice recorder + */ + RProperty iPropVRState; + + /** + * Pub&Sub property. + * For checking and setting the state of the screen saver. + */ + RProperty iPropScreenSaver; + + /** + * Fix for pause problem + */ + TBool iPause; + + /** + * For storing current position + */ + TTimeIntervalMicroSeconds iPosition; + + /** + * For playing the recording start and stop tones. Owned. + */ + CVRTonePlayer* iTonePlayer; + + /** + * Pointer to the CHWRMLight. owned. + */ + CHWRMLight* iLight; + + /** + * State of the Light. If EFalse the dimmed light is set as off + * causes no action. + */ + TBool iDimLight; + + // Boolean to maintain attaching to memo state. + TBool iAttachingToMemo; + + /** + * Returns if Voice Recorder start to record new file (real recording not necessary started) . + * @return True or False + */ + TBool ifInRecording; + + + /** + * Returns if Voice Recorder has called stoped, if so should not handle Pause . + * @return True or False + */ + TBool ifStopCalled; + + + CVRDiskSpaceWatcher* iDiskSpaceWatcher; + CAudioInput* iAudioInput; + CAudioInput::TAudioInputPreference iCurrentAudioInput; + + + }; + +#endif // __CVRMDARECORDER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMediaRemovalMonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMediaRemovalMonitor.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2006 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: Monitors for Media removal +* +*/ + + +#include +#include +#include "CVRMediaRemovalMonitor.h" + +// --------------------------------------------------------------------------- +// C++ Constructor +// --------------------------------------------------------------------------- +// +CVRMediaRemovalMonitor::CVRMediaRemovalMonitor + ( TInt aDrive, RFs& aFs, MVRMediaRemovalObserver* aObserver ) + : CActive(EPriorityHigh), + iDrive( aDrive ), + iFs( aFs ), + iDiskRemoved( EFalse ), + iObserver( aObserver ) + + { + CActiveScheduler::Add(this); + } + + +// --------------------------------------------------------------------------- +// 2nd Phase Constructor +// --------------------------------------------------------------------------- +// +void CVRMediaRemovalMonitor::ConstructL() + { + + // Initial state + TDriveInfo drive; + User::LeaveIfError(iFs.Drive(drive, TInt(iDrive))); + iDiskRemoved = (drive.iType == EMediaNotPresent); + + // Start listening + TNotifyType notType(ENotifyDisk); + iFs.NotifyChange( notType, iStatus ); + SetActive(); + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CVRMediaRemovalMonitor* CVRMediaRemovalMonitor::NewL + ( TInt aDrive, RFs& aFs, MVRMediaRemovalObserver* aObserver ) + { + CVRMediaRemovalMonitor* self + = CVRMediaRemovalMonitor::NewLC( aDrive, + aFs, + aObserver ); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// Two-Phased Constructor +// --------------------------------------------------------------------------- +// +CVRMediaRemovalMonitor* CVRMediaRemovalMonitor::NewLC + ( TInt aDrive, RFs& aFs, MVRMediaRemovalObserver* aObserver ) + { + CVRMediaRemovalMonitor* self = + new( ELeave ) CVRMediaRemovalMonitor( aDrive, + aFs, + aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CVRMediaRemovalMonitor::~CVRMediaRemovalMonitor() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// Service the request +// --------------------------------------------------------------------------- +// +void CVRMediaRemovalMonitor::RunL() + { + // Re-subscribe to event. + TNotifyType notType(ENotifyDisk); + iFs.NotifyChange( notType, iStatus ); + SetActive(); + + // Check state + TDriveInfo drive; + User::LeaveIfError(iFs.Drive(drive, TInt(iDrive))); + + // Notify Observer + switch(drive.iType) + { + case EMediaNotPresent: + { + if (!iDiskRemoved) + { + iObserver->HandleMMCEjectEventL( ); + } + iDiskRemoved = ETrue; + break; + } + default: + { + if ( iDiskRemoved && + ( drive.iMediaAtt & ( KMediaAttLockable|KMediaAttLocked|KMediaAttHasPassword ) ) != + ( KMediaAttLockable|KMediaAttLocked|KMediaAttHasPassword ) ) + { + //do nothing + iDiskRemoved = EFalse; + } + break; + } + } + + } + +// --------------------------------------------------------------------------- +// Cancel NotifyChange request from file system +// --------------------------------------------------------------------------- +// +void CVRMediaRemovalMonitor::DoCancel() + { + iFs.NotifyChangeCancel(); + } + +// ---------------------------------------------------------------------------- +// Handles a leave occurring in the request completion event handler RunL() +// Don't care if client has a User::Leave() in RunL(), keep monitoring for events +// ---------------------------------------------------------------------------- +// +TInt CVRMediaRemovalMonitor::RunError(TInt aError) + { + return KErrNone; + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMediaRemovalMonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMediaRemovalMonitor.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2007 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: Monitors for media removal events +* +*/ + + +#ifndef CVRMEDIAREMOVALMONITER_H +#define CVRMEDIAREMOVALMONITER_H + +#include +#include "MVRMediaRemovalObserver.h" + +/** + * Class to monitors for File System dismount events + * @lib Harvester + * @since S60 3.0 + */ +NONSHARABLE_CLASS( CVRMediaRemovalMonitor ) : public CActive + { + +public: + + /** + * Two-phase constructor + * @param aDrive drive to monitor + * @param aFs file server session + * @param aObserver observer to the event + */ + static CVRMediaRemovalMonitor* NewL( TInt aDrive, + RFs& aFs, + MVRMediaRemovalObserver* aObserver ); + /** + * Two-phase constructor + * @param aDrive drive to monitor + * @param aFs file server session + * @param aObserver observer to the event + */ + static CVRMediaRemovalMonitor* NewLC( TInt aDrive, + RFs& aFs, + MVRMediaRemovalObserver* aObserver ); + + /** + * Virtual destructor + */ + virtual ~CVRMediaRemovalMonitor(); + +protected: // From base class + + /* + * From CActive + */ + void RunL(); + + /* + * From CActive + */ + void DoCancel(); + + /** + * From CActive + */ + TInt RunError(TInt aError); + +private: + + /** + * C++ constructor + * @param aDrive drive to monitor + * @param aFs file server session + * @param aObserver observer to the event + */ + CVRMediaRemovalMonitor( TInt aDrive, + RFs& aFs, + MVRMediaRemovalObserver* aObserver ); + + void ConstructL(); + +private: // data + + TInt iDrive; // Drive that is being monitored + RFs& iFs; // File Session, not owned + TBool iDiskRemoved; // Is the disk inserted + + /* + * Observer interface to callback to an observer + */ + MVRMediaRemovalObserver* iObserver; + }; + +#endif // CVRMEDIAREMOVALMONITER_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMemo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMemo.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,690 @@ +/* +* Copyright (c) 2002 - 2006 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 class represents a voice memo. It is able to create new files, +* rename and delete existing files, and to save them to permanent storage. +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "CVRMemo.h" +#include "VRConsts.h" +#include "TVRRename.h" +#include "VRUtils.h" + +// CONSTANTS +// Max length is 300 millisecs over one minute so possible cropping +// of the file after stop doesn't drop the length under one minute +const TInt KVRMMSMemoMaxRecordLength( 60300000 ); +const TInt KVREstimateDelayDuration( 10000000 ); + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRMemo::CVRMemo +// +// --------------------------------------------------------------------------- +// +CVRMemo::CVRMemo() + : iDuration( 0 ), iPosition( 0 ), iMaxDuration( KVRDefaultMaxLength ), + iQuality( EQualityMMSOptimized ),iIsRecorded( EFalse ) + { +#ifndef RD_MULTIPLE_DRIVE + iStoragePlace = EMemoStorePhoneMemory; +#else + TRAP_IGNORE(iStorageDrive = VRUtils::DefaultMemoDriveL()); +#endif + } + + +// --------------------------------------------------------------------------- +// CVRMemo::~CVRMemo +// +// --------------------------------------------------------------------------- +// +CVRMemo::~CVRMemo() + { + DeleteEmptyFile(); + + // Close the file handle and file server session + iFile.Close(); + iFs.Close(); + + delete iFileMan; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRMemo::ConstructL(TInt aDefaultAudioFormat) + { + User::LeaveIfError( iFs.Connect() ); + iFs.ShareProtected(); + + iFileMan = CFileMan::NewL( iFs ); + + iVRAudioFormat = aDefaultAudioFormat; + + iQuality = VRUtils::QualityL(); + if ( !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) + || iEmbedded ) + { + iMaxDuration = KVRMMSMemoMaxRecordLength; + iQuality = EQualityMMSOptimized; + } + else + { + TInt64 max( VRUtils::MaxLengthL() ); + max = max * KVRMinuteAsMicroSeconds; + iMaxDuration = max; + } + + // Current storage place +#ifndef RD_MULTIPLE_DRIVE + iStoragePlace = VRUtils::MemoStoreL(); +#else + iStorageDrive = VRUtils::MemoDriveL(); +#endif + + } + + +// --------------------------------------------------------------------------- +// CVRMemo::SetName +// +// --------------------------------------------------------------------------- +// +void CVRMemo::SetName( const TDesC& aFilename ) + { + iFilename.Copy( aFilename ); + TParsePtrC parse( iFilename ); + iNamePtr.Set( parse.Name().Left( VRMEMONAMEMAXLENGTH ) ); + } + + +// --------------------------------------------------------------------------- +// CVRMemo::SetTemporaryNameL +// +// --------------------------------------------------------------------------- +// +void CVRMemo::SetTemporaryNameL( TBool aEmbedded ) + { + iEmbedded = aEmbedded; + + // We can use the same handle, no need to create new name + // Empty the file so it can be overwritten with new memo + if ( iEmbedded && !iExternalFileHandle ) + { + if ( iFile.SubSessionHandle() ) + { + iFile.SetSize( 0 ); + return; + } + } + + // Checks if the file handle can be found i.e if file is created + if ( iFile.SubSessionHandle() ) + { + // Retrieving new settings + TVRQuality newQuality( VRUtils::QualityL() ); + +#ifndef RD_MULTIPLE_DRIVE + TVRMemoStore newStoragePlace ( VRUtils::MemoStoreL() ); + + // If the current file is empty, we can reuse it if quality or + // the storage place hasn't changed + if ( iQuality == newQuality && iStoragePlace == newStoragePlace ) + { + TInt size( 0 ); + iFile.Size( size ); + + // If current file has already been recorded to, a new file has + // to be generated + if ( !IsRecorded() ) + { + iFile.SetSize( 0 ); + return; + } + } + // The file has been created but the settings have been changed + // before using the file -> delete file and create a new one + else + { + DeleteEmptyFile(); + } + +#else + // for Multiple drives + TInt newStorageDrive ( VRUtils::MemoDriveL() ); + + // If the current file is empty, we can reuse it if quality or + // the storage place hasn't changed + if ( iQuality == newQuality && iStorageDrive == newStorageDrive ) + { + TInt size( 0 ); + iFile.Size( size ); + + // If current file has already been recorded to, a new file has + // to be generated + if ( !IsRecorded() ) + { + iFile.SetSize( 0 ); + return; + } + } + // The file has been created but the settings have been changed + // before using the file -> delete file and create a new one + else + { + DeleteEmptyFile(); + } + + +#endif + } + + TFileName memoName; + // Retrieve storage path + if ( iSavingLocation.Length() > 0 ) + { + memoName = iSavingLocation; + } + else + { + VRUtils::MemoStoreDirectoryL( memoName ); + } + + // Recheck the quality before naming memo + if ( !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) + || iEmbedded ) + { + iQuality = EQualityMMSOptimized; + } + else + { + iQuality = VRUtils::QualityL(); + } + + // Current storage place +#ifndef RD_MULTIPLE_DRIVE + iStoragePlace = VRUtils::MemoStoreL(); +#else + iStorageDrive = VRUtils::MemoDriveL(); +#endif + + // Choose the file type + // Use amr if quality is MMS Optimized or we are recording + // in embedded mode, wav otherwise + TVRFiletype type( EVRFileAmr ); + if( iEmbedded || iQuality == EQualityMMSOptimized ) + { + type = EVRFileAmr; + } + +// **** updated for new CR, if it QualitySetting is Normal, save as WAV + +#ifdef __AAC_ENCODER_PLUGIN + else if (iQuality == EQualityNormal) + { + type = EVRFileWav; + } + +// **** the following are updated for new CR, if it QualitySetting is High, save as mp4 + else if (iQuality == EQualityHigh) + { + type = EVRFileAAC_LC; + } +#else + + else + { + type = EVRFileWav; + } + +#endif + + TFileName memoNameTemp; + memoNameTemp = memoName; + memoNameTemp.Delete(memoName.Length()-1, 1); + + TBool boolTemp = EFalse; + + TInt intTemp = BaflUtils::IsFolder( iFs, memoNameTemp, boolTemp ); + + if( ! boolTemp ) + { + if( BaflUtils::FileExists( iFs, memoNameTemp ) ) + { + if( intTemp != KErrNone ) + { + User::LeaveIfError(intTemp); + } + else + { + User::LeaveIfError(iFs.Delete( memoNameTemp )); + } + } + } + + // Generate unique final file name + VRUtils::GenerateUniqueFilenameL( iFs, memoName, type ); + + // Make sure that file handles are not leaked + if ( iFile.SubSessionHandle() ) + { + iFile.Close(); + } + + // Ensure that path exists + BaflUtils::EnsurePathExistsL( iFs, memoName ); + +// Open the memo file + +#ifdef __AAC_ENCODER_PLUGIN + if((iQuality == EQualityHigh)) //for mp4 format , 3gplib does not support EFileShareExclusive so EFileShareAny is used here + { + User::LeaveIfError( iFile.Create( iFs, memoName, EFileWrite|EFileShareAny) ); + } + else // for other formats + { + User::LeaveIfError( iFile.Create( iFs, memoName, EFileShareExclusive|EFileWrite ) ); + + } +#else // it is not mp4, so still use the old flag + User::LeaveIfError( iFile.Create( iFs, memoName, EFileShareExclusive|EFileWrite ) ); + +#endif + + TInt error = iFile.SetAtt(KEntryAttHidden, KEntryAttNormal ); + SetName( memoName ); + } + + +// --------------------------------------------------------------------------- +// CVRMemo::QueryAndDeleteL +// +// --------------------------------------------------------------------------- +// +TBool CVRMemo::QueryAndDeleteL() + { + //Delete?\n%U" �qtn.query.common.conf.delete� + TParsePtrC parse( iFilename ); + HBufC* text = StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE, + parse.Name() ); + + // Show confirm note + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + TInt result( dlg->ExecuteLD( R_VR_CONFIRMATION_QUERY, *text ) ); + CleanupStack::PopAndDestroy( text ); + + if ( result ) + { + DeleteL(); + return ETrue; + } + + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::DeleteL +// +// --------------------------------------------------------------------------- +// +void CVRMemo::DeleteL() + { + if ( iFile.SubSessionHandle() ) + { + if ( iExternalFileHandle ) + { + // We shouldn't delete the file handle, so let's + // just empty the file + iFile.SetSize( 0 ); + } + else + { + TFileName fileName( KNullDesC ); + iFile.FullName( fileName ); + iFile.Close(); + + TInt err( iFileMan->Delete( fileName ) ); + if ( err != KErrNone && err != KErrNotFound ) + { + // Try to open the file again so we wont end up + // in goofy state without open file + User::LeaveIfError( iFile.Open( iFs, fileName, + EFileShareReadersOnly ) ); + User::LeaveIfError( err ); + } + } + } + SetName( KNullDesC ); + } + + +// --------------------------------------------------------------------------- +// CVRMemo::QueryAndRenameL +// +// --------------------------------------------------------------------------- +// +TBool CVRMemo::QueryAndRenameL() + { + TVRRename renamer( iFs ); + if ( renamer.RenameL( iFile, R_QTN_FLDR_ITEM_NAME_PRMPT ) ) + { + TFileName name( KNullDesC ); + iFile.FullName( name ); + SetName( name ); + + return ETrue; + } + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::SavePermanentlyL +// +// --------------------------------------------------------------------------- +// +void CVRMemo::SavePermanentlyL( CAknGlobalNote* /*aWaitNote*/, + TInt& /*aNoteId*/, + const TDesC& /*aLabel*/, + TBool /*aProduceCopy*/ ) + + { + // Don't do anything if recording to external file handle + if ( iExternalFileHandle ) + { + return; + } + + // Change file open mode to read + TFileName name( KNullDesC ); + iFile.FullName( name ); + iFile.Close(); + User::LeaveIfError( iFile.Open( iFs, + name, + EFileRead|EFileShareReadersOnly) ); + } + + +// --------------------------------------------------------------------------- +// CVRMemo::IsValid +// +// --------------------------------------------------------------------------- +// +TBool CVRMemo::IsValid() const + { + return iFile.SubSessionHandle() == 0 ? EFalse : ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::UpdateModifiedDate +// +// --------------------------------------------------------------------------- +// +void CVRMemo::UpdateModifiedDate() + { + if ( IsValid() ) + { + TLocale locale; + iFile.Modified( iDateCreated ); + iDateCreated += locale.UniversalTimeOffset(); + } + } + + +// --------------------------------------------------------------------------- +// CVRMemo::SetSavingLocationL +// +// --------------------------------------------------------------------------- +// +void CVRMemo::SetSavingLocationL( const TDesC& aPath ) + { + iSavingLocation = aPath; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::DeleteEmptyFile +// Deletes an empty file that hasn't been recorded into. After deleting +// also decreases central repository's memo count value +// --------------------------------------------------------------------------- +// +TBool CVRMemo::DeleteEmptyFile() + { + if ( iFile.SubSessionHandle() != 0 ) + { + TInt size( 0 ); + + // Error code ignored + iFile.Size( size ); + + if ( !iIsRecorded ) + { + TFileName name( KNullDesC ); + iFile.FullName( name ); + + iFile.Close(); + iFileMan->Delete( name ); + + // Central repository value has to be decreased by one because it + // was increased earlier, when current filename was generated + VRUtils::SetMemoCount( VRUtils::MemoCount() - 1 ); + + return ETrue; + } + } + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::SetFileHandle +// +// --------------------------------------------------------------------------- +// +void CVRMemo::SetFileHandle( RFile& aFile, const TBool aEmbedded ) + { + iEmbedded = aEmbedded; + iExternalFileHandle = ETrue; + + iFile = aFile; + + // Set the correct name for UI + TFileName name( KNullDesC ); + iFile.FullName( name ); + SetName( name ); + } + + +// --------------------------------------------------------------------------- +// CVRMemo::MaxDuration +// Returns in microseconds the maximum time that can be still recorded with +// current settings (codecs and mem storage place) +// --------------------------------------------------------------------------- +// +const TTimeIntervalMicroSeconds& CVRMemo::MaxDuration() + { + if ( iEmbedded || + !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) || + iQuality == EQualityMMSOptimized ) + { + //Voice Recorder change to remove 1 Min. limit for AMR for Stand alone recording + //if embedded allow 1 min recording for EQualityMMSOptimized(AMR) + //else allow 1 hour recording + if(iEmbedded) + { + iMaxDuration = KVRMMSMemoMaxRecordLength; + return iMaxDuration; + } + } + + // Make the first estimate after KVRFirstEstimateTime seconds recording + if ( Duration() < KVRFirstEstimateTime ) + { + // Fetch the setting for high quality max length + TInt64 max( 0 ); + TRAPD( err, max = VRUtils::MaxLengthL() ); + if ( err != KErrNone ) + { + max = KVRMMSMemoMaxRecordLength; + } + + max = max * KVRMinuteAsMicroSeconds; + iMaxDuration = max; + + // Reset the time of last estimate + TDateTime date; + date.SetYear( -1 ); + iLastEstimate = date; // invalid + + return iMaxDuration; + } + + // Make new estimate if there's no last estimate or if 10 secs have passed + // from the previous estimate + TTime currentTime; + currentTime.HomeTime(); + if ( iLastEstimate.DateTime().Year() == -1 || + currentTime.MicroSecondsFrom( iLastEstimate ) >= + TTimeIntervalMicroSeconds( KVREstimateDelayDuration ) ) + { + iLastEstimate = currentTime; + + TEntry fileEntry; + TFileName name( KNullDesC ); + iFile.FullName( name ); + + TInt err = iFs.Entry( name, fileEntry ); + if( err != KErrNone ) + { + return iMaxDuration; + } + + // Retrieve free space + TVolumeInfo volInfo; + +// old storage +#ifndef RD_MULTIPLE_DRIVE + TVRMemoStore memoStore( EMemoStorePhoneMemory ); + TRAP( err, memoStore = VRUtils::MemoStoreL() ); + if ( err != KErrNone ) + { + memoStore = EMemoStorePhoneMemory; + } + + if ( memoStore == EMemoStorePhoneMemory ) + { + err = iFs.Volume( volInfo, EDriveC ); + } + else // memostore is MMC + { + err = iFs.Volume( volInfo, EDriveE ); + } + +// multiple drive +#else + + TInt drive = 0; + TRAP_IGNORE(drive = VRUtils::DefaultMemoDriveL()); + TRAP( err, drive = VRUtils::MemoDriveL() ); + if ( err != KErrNone ) + { + TRAP_IGNORE(drive = VRUtils::DefaultMemoDriveL()); + } + err = iFs.Volume( volInfo, drive ); + +#endif + + if( err != KErrNone ) + { + + return iMaxDuration; + } + + // Calculate the current disk consumption "speed" of the memo + TReal speed( fileEntry.iSize / ( Duration().Int64() / + KVRSecondAsMicroSeconds ) ); + + // The total free memory + TInt64 freeSpace(volInfo.iFree); + // Free memory if Critical Memory isn't taken into account + TInt64 freeSpaceMinusCrlevel( freeSpace - KDRIVECCRITICALTHRESHOLD); + + // Estimate the time left + TInt64 value( freeSpaceMinusCrlevel / speed ); + TTimeIntervalMicroSeconds estimate( value * KVRSecondAsMicroSeconds ); + + // Estimate should include also the length of clip + estimate = TTimeIntervalMicroSeconds( estimate.Int64() + + Duration().Int64() ); + if ( estimate < iMaxDuration) + { + iMaxDuration = estimate; + } + } + + return iMaxDuration; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::IsRecorded +// Returns the attribute iIsRecorded value that indicates if the recording of +// the clip currently open is started or not +// --------------------------------------------------------------------------- +// +TBool CVRMemo::IsRecorded() const + { + return iIsRecorded; + } + + +// --------------------------------------------------------------------------- +// CVRMemo::SetRecorded +// Sets the value of iIsRecorded attribute +// --------------------------------------------------------------------------- +// +void CVRMemo::SetRecorded( TBool aRecorded ) + { + iIsRecorded = aRecorded; + } + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMemo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMemo.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,344 @@ +/* +* Copyright (c) 2002 - 2006 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 class represents a voice memo. It is able to create new files, +* rename and delete existing files, and to save them to permanent storage. +* +*/ + + +#ifndef __CVRMEMO_H__ +#define __CVRMEMO_H__ + +// INCLUDES +#include +#include "voicerecorder.hrh" +#include "VRConsts.h" + +// FORWARD DECLARATIONS +class CAknWaitDialog; +class CAknGlobalNote; + +// CLASS DEFINITION +/** +* This class represents a voice memo. It is able to create new files, +* rename and delete existing files, and to save them to permanent storage. +*/ +NONSHARABLE_CLASS( CVRMemo ) + : public CBase + { + + public: // enumerations + + /* + * File format of voice recorder + * Possible values = 0 (AMR). + */ + enum TVRFileFormat + { + EVRFormatAMR = 0 + }; + + public: // constructors and destructor + + /** + * Default constructor. + */ + CVRMemo(); + + /** + * Destructor. + */ + ~CVRMemo(); + + /** + * 2nd phase constructor. + * @param aDefaultAudioFormat Default audio file format of VR + * Is really defined as TVRFileFormat, but for legacy reasons + * not used that way yet. + */ + void ConstructL(TInt aDefaultAudioFormat); + + public: // new methods + + /** + * Changes the file name of this memo object. + * @param aFilename New file name. + */ + void SetName( const TDesC& aFilename ); + + /** + * Sets the file name to a non-existent, new, name. + * @param aEmbedded is true if creating temporary name for embedded + * recording (different path) + */ + void SetTemporaryNameL( TBool aEmbedded = EFalse ); + + /** + * Shows a confirmation query and deletes the memo file + * if user accepts. + * @return ETrue if deletion was confirmed. + */ + TBool QueryAndDeleteL(); + + /** + * Deletes the current memo file. + * The memo file name is set to KNullDesC + */ + void DeleteL(); + + /** + * Queries the user for a new name for the current memo file. + * @return ETrue if rename was confirmed. + */ + TBool QueryAndRenameL(); + + /** + * Saves this memo to permanent storage. Removes the original + * copy from RAM unless otherwise requested. + * @param aProduceCopy Specify ETrue if you want to leave the + * original memo file intact. + */ + void SavePermanentlyL( CAknGlobalNote* aWaitNote, TInt& aNoteId, + const TDesC& aLabel, TBool aProduceCopy = EFalse ); + + /** + * Checks wether the memo file represented by this object exists or not + * @return ETrue if the file exists + */ + TBool IsValid() const; + + /** + * Re-reads the file modification timestamp. + */ + void UpdateModifiedDate(); + + /** + * Returns the duration of the memo in microseconds. + * @return Duration + */ + inline const TTimeIntervalMicroSeconds& Duration() const; + + /** + * Sets the duration of the memo in microseconds. + * This is for data storage only (does not affect playback). + * @param aDuration The new duration. + */ + inline void SetDuration( const TTimeIntervalMicroSeconds& aDuration ); + + /** + * Returns the current playing position of the memo in microseconds. + * @return Playing position + */ + inline const TTimeIntervalMicroSeconds& Position() const; + + /** + * Sets the current playing position of the memo in microseconds. + * This is for data storage only (does not affect playback). + * @param aPosition The new position + */ + inline void SetPosition( const TTimeIntervalMicroSeconds& aPosition ); + + /** + * Returns the maximum duration of the memo in microseconds. + * @return Maximum duration (for recording) + */ + const TTimeIntervalMicroSeconds& MaxDuration(); + + /** + * Returns the complete file name (path and everything). + * @return Reference to the memo name. + */ + inline const TDesC& Filename() const; + + /** + * Returns the name portion of the complete file name. + * @return Reference to the memo name. + */ + inline const TPtrC& Name() const; + + /** + * Returns the creation date of this file. + * @return Reference to the date. + */ + inline const TTime& DateCreated() const; + + void SetSavingLocationL( const TDesC& aPath ); + + /** + * Returns the handle of the memo file. + * You may have to check the SubSessionHandle() to + * now if the file has been opened + * @return Reference to the file handle + */ + inline RFile& File(); + + /** + * Returns the active quality setting. + * @return Quality setting of the active memo + */ + inline TVRQuality Quality() const; + + /** + * Used to set the target file handle. + * @param aFile File handle + * @param aEmbedded True if recording for external application and + * handle must be kept open all the time + */ + void SetFileHandle( RFile& aFile, const TBool aEmbedded = EFalse ); + + /** + * Check if quality setting has changed and memo needs to be renamed. + * Should be called at least before starting to record first memo + * after application launch. + */ + void CheckQualityL(); + + /** + * Sets the attribute iIsRecorded ETrue if recording is started. EFalse + * if memo is attached but recording isn't started. + * @param aRecorded ETrue when recording is started + */ + void SetRecorded( TBool aRecorded ); + + /** + * Returns the current memo store. + * . + */ + inline TVRMemoStore MemoStore() const; + + /** + * Returns the creation date of this file. + * @return Reference to the date. + */ + inline TInt StorageDrive() const; + + + + private: + /** + * Checks if iFile has an empty file open + * and deletes it, leaving iFile closed + * @return returns ETrue if file was deleted + */ + TBool DeleteEmptyFile(); + + /** + * Checks if recording to the currently open memo is started + * Returns ETrue if recording is started, EFalse if not + */ + TBool IsRecorded() const; + + private: // data + + /** + * Length of this memo in microseconds. + */ + TTimeIntervalMicroSeconds iDuration; + + /** + * Length of this memo in microseconds. + */ + TTimeIntervalMicroSeconds iPosition; + + /** + * Maximum length for all memos. + */ + TTimeIntervalMicroSeconds iMaxDuration; + + /** + * The final path and file name of the memo. + * Memo is moved to this path from temp drive when + * when it's saved + */ + TFileName iFilename; + + /** + * Handle to actual file system file + */ + RFile iFile; + + /** + * The name of this memo (the file name minus extension). + * This is a ptr descriptor to the iFileName; + */ + TPtrC iNamePtr; + + /** + * The creation time of this memo. + */ + TTime iDateCreated; + + /** + * A reference to a connected file server session. + * Used as a short cut. Not owned. + */ + RFs iFs; + + /** + * Pointer to a file manager object. Owned. + */ + CFileMan* iFileMan; + + /** + * The directory where memos will be saved. + */ + TFileName iSavingLocation; + + /** + * Default audio format for recording audio clip + */ + TInt iVRAudioFormat; + + /** + * Are we in embedded mode + */ + TBool iEmbedded; + + /** + * Is the RFile received from outside or should we close it + */ + TBool iExternalFileHandle; + + /** + * Cached quality setting + */ + TVRQuality iQuality; + + /** + * Cached storage place setting + */ + TVRMemoStore iStoragePlace; + + /** + * Cached storage drive setting + */ + TInt iStorageDrive; + + /** + * Last time that the estimate was updated + */ + TTime iLastEstimate; + + /** + * Tells if recording of current open memo is started. + * EFalse: not recording started + * ETrue: recording is started + */ + TBool iIsRecorded; + }; + +#include "CVRMemo.inl" + +#endif // __CVRMEMO_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRMemo.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRMemo.inl Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2005-2006 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: Inline versions of some member functions +* +*/ + + +inline const TTimeIntervalMicroSeconds& CVRMemo::Duration() const + { + return iDuration; + } + +inline void CVRMemo::SetDuration( const TTimeIntervalMicroSeconds& aDuration ) + { + iDuration = aDuration; + } + +inline const TTimeIntervalMicroSeconds& CVRMemo::Position() const + { + return iPosition; + } + +inline void CVRMemo::SetPosition( const TTimeIntervalMicroSeconds& aPosition ) + { + iPosition = aPosition; + } + + +inline const TDesC& CVRMemo::Filename() const + { + return iFilename; + } + +inline const TTime& CVRMemo::DateCreated() const + { + return iDateCreated; + } + +inline const TPtrC& CVRMemo::Name() const + { + return iNamePtr; + } + +inline RFile& CVRMemo::File() + { + return iFile; + } + +inline TVRQuality CVRMemo::Quality() const + { + return iQuality; + } + + +inline TVRMemoStore CVRMemo::MemoStore() const + { + return iStoragePlace; + } + +inline TInt CVRMemo::StorageDrive() const + { + return iStorageDrive; + } + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecView.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,1136 @@ +/* +* Copyright (c) 2002-2006 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: +* Voice Recorder Record View +* +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "voicerecorder.hrh" +#include "CVRRecView.h" +#include "CVRRecViewContainer.h" +#include "CVRRecViewActivationContainer.h" +#include "CVRRecViewModel.h" +#include "VRUtils.h" +#include "VRUSBStateHanlder.h" + +// CONSTANTS +const TUid KUidMmsEditor = + { + 0x100058DE + }; +const TUid KUidMailEditor = + { + 0x101F4CD6 + }; + +inline TBool ShowDialogForWaitUSBPluggingOutL() + { + HBufC* text = StringLoader::LoadLC(R_QTN_USB_MODE_NOTE_MODE); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + TInt result(dlg->ExecuteLD(R_INSERT_F_USB_PLUG_IN_DIALOG, *text)); + CleanupStack::PopAndDestroy(text); + if (result) + { + return ETrue; + } + return EFalse; + } + +inline TInt WaitDialogForUSBPluggingOut(CAknWaitDialog*& aDialog) + { + aDialog = new (ELeave) CAknWaitDialog( + (REINTERPRET_CAST(CEikDialog**,&aDialog))); + aDialog->SetTone(CAknNoteDialog::EConfirmationTone); + return aDialog->ExecuteLD(R_VOREC_USB_CONNECTED_DIALOG); + } + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator +// +// --------------------------------------------------------------------------- +// +CVRRecView::CVRRecViewModelActivator::CVRRecViewModelActivator( + CVRRecViewModel* aModel) : + CAsyncOneShot(EPriorityNormal), iModel(aModel), iContext( + EContextEmptyNormal) + { + } + + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator +// +// --------------------------------------------------------------------------- +// +CVRRecView::CVRRecViewModelActivator::~CVRRecViewModelActivator() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewModelActivator::RunL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewModelActivator::RunL() + { + if(iModel->GetIsDriveReady()) + { + // Activate model in correct context + iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); + iModel->EnterContextL( iContext ); + iModel->ActivateL(); + } + + // Notify recview + iCallback.CallBack(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewModelActivator::Activate +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewModelActivator::Activate( + TVRRecViewContexts aContext, TCallBack aCallback ) + { + iContext = aContext; + iCallback = aCallback; + Call(); + + } + + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewModelActivator::DoCancel +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewModelActivator::DoCancel() + { + } + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator +// +// --------------------------------------------------------------------------- +// +CVRRecView::CVRRecViewDialogActivator::CVRRecViewDialogActivator( CVRRecViewModel* aModel) +:CAsyncOneShot(EPriorityNormal), iModel(aModel) + { + + } + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator +// +// --------------------------------------------------------------------------- +// +CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator() + { + Cancel(); + } + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewDialogActivator::~CVRRecViewDialogActivator +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewDialogActivator::SetDialogType(TDialogTypeID aType) + { + iType = aType; + } + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewDialogActivator::SetViewContexts +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewDialogActivator::SetViewContexts(TVRRecViewContexts aContext) + { + iContext = aContext; + } + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewDialogActivator::DoCancel +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewDialogActivator::DoCancel() + { + } + +// --------------------------------------------------------------------------- +// CVRRecView::CVRRecViewNoteActivator::RunL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CVRRecViewDialogActivator::RunL() + { + if(iType == EDialogForWaitStorageCard) + { + TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); + while ( !VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) + { + if (!ShowDialogForWaitStorageCardL()) + { + iModel->SendExitEvent(); + } + } + // Come to here when driveRemovableMassStorage is valid + VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); + + /***** check if memory is below min value, if yes, close app*****/ + RFs& fs(CEikonEnv::Static()->FsSession()); + if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) + { + HBufC* errorText = StringLoader::LoadLC( + R_VR_MEMORY_LOW_STOP_WARNING); + CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); + dlg->ExecuteLD(*errorText); + CleanupStack::PopAndDestroy(errorText); + iModel->SendExitEvent(); + } + // check memory size end + + // To activate view model + iModel->SetMemoNameNewL( iContext == EContextRecordNewForRemote); + iModel->SetIsDriveReady(ETrue); + iModel->EnterContextL( iContext ); + iModel->ActivateL(); + } + else if(iType == EDialogForWaitUSBPluggingOut) + { + ShowDialogForWaitUSBPluggingOutL(); + iModel->SendExitEvent(); + } + } + +// --------------------------------------------------------------------------- +// CVRRecView::NewLC +// +// --------------------------------------------------------------------------- +// +EXPORT_C CVRRecView* CVRRecView::NewLC( TInt aViewResourceId, + TInt aModelResourceId ) + { + CVRRecView* recview = new( ELeave ) CVRRecView; + CleanupStack::PushL( recview ); + recview->ConstructL( aViewResourceId, aModelResourceId ); + + return recview; + } + + +// --------------------------------------------------------------------------- +// CVRRecView::~CVRRecView +// +// --------------------------------------------------------------------------- +// +CVRRecView::~CVRRecView() + { + if ( iContainer ) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + } + + if ( iActivationContainer ) + { + AppUi()->RemoveFromViewStack( *this, iActivationContainer ); + } + + delete iContainer; + delete iActivationContainer; + delete iDialogActivator; + delete iModel; + delete iSendUi; + delete iModelActivator; + delete iLaunchService; + delete iUSBStateHandler; + + if (iUsbWaitDialog) + { + TRAP_IGNORE(iUsbWaitDialog->ProcessFinishedL()); + } + } + +// --------------------------------------------------------------------------- +// CVRRecView::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::ConstructL( TInt aViewResourceId, TInt aModelResourceId ) + { + BaseConstructL( aViewResourceId ); + + iModel = new( ELeave ) CVRRecViewModel; + TResourceReader reader; + iEikonEnv->CreateResourceReaderLC( reader, aModelResourceId ); + iModel->ConstructFromResourceL( reader ); + CleanupStack::PopAndDestroy(); // reader; + + // Create SendUi (Send as MMS, E-Mail, etc...) + iSendUi = CSendUi::NewL(); + + iModelActivator = new (ELeave) CVRRecViewModelActivator(iModel); + + iUSBStateHandler = CVRUSBStateHanlder::NewL(this); + } + +// --------------------------------------------------------------------------- +// CVRRecView::Id +// +// --------------------------------------------------------------------------- +// +TUid CVRRecView::Id() const + { + const TUid KVRRecViewUID = + { + KVRRecorderViewUID + }; + + return KVRRecViewUID; + } + + +// --------------------------------------------------------------------------- +// CVRRecView::HandleCommandL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::HandleCommandL( TInt aCommandId ) + { + // This command must be acceptable all times. + if ( aCommandId == ECmdCancelNote ) + { + iCommand = aCommandId; + if( iModel ) + { + iModel->HandleCommandL( aCommandId ); + } + return; + } + + if ( !iModel->CanAcceptCommands() ) + { + return; + } + + switch ( aCommandId ) + { + // Don't do anything in case of a Task Swapper command + case EAknCmdTaskSwapper: + { + break; + } + // No operation + case ECmdNOP: + { + break; + } + // Go back to voice memo list view + case EAknSoftkeyBack: + { + AppUi()->HandleCommandL( EEikCmdExit ); + break; + } + case ECmdSettings: + { + // Saving the volume control state before entering settings + TBool hasVolumeControl( iModel->HasVolumeControl() ); + // Disabling volume control + iModel->EnableVolumeControl( EFalse ); + iContainer->Update(); + + AppUi()->HandleCommandL( aCommandId ); + + // Set volume control as it was before settings dialog + iModel->EnableVolumeControl( hasVolumeControl ); + iContainer->Update(); + break; + } + case ECmdGoToMyClips: + { + delete iLaunchService; + iLaunchService = NULL; + + TFileName path; + VRUtils::MemoStoreDirectoryL( path ); + TInt sortMode = 0; + + CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC(); + inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( + path))); + inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( + sortMode))); + iLaunchService = CAknLaunchAppService::NewL( + TUid::Uid(0x101F84EB), NULL, inParams); + CleanupStack::PopAndDestroy(inParams); + break; + } + case ECmdSendVia: + { + iModel->SendViaL(iSendUi); + break; + } + + // Handles Middle SoftKey presses in this view + case ECmdMSK: + { + // Don't forward the command if dimmed button was clicked or + // if model can't handle commands + if (iModel->ButtonState(iContainer->FocusedButton()) == EDimmed + || !iModel->CanHandleCommands()) + { + break; + } + + // Fetch the command to execute + TInt commandId(iModel->CommandId(iContainer->FocusedButton())); + + iModel->HandleCommandL(commandId); + AppUi()->HandleCommandL(commandId); + + iContainer->UpdateButtonPanel(EVRUpdateStateChange); + break; + } + case ECmdUSBChange: + if (iUsbWaitDialog) + { + iUsbWaitDialog->ProcessFinishedL(); + } + iContainer->UpdateButtonPanel(EVRUpdateStateChange); + break; + default: + { + iModel->HandleCommandL(aCommandId); + AppUi()->HandleCommandL(aCommandId); + break; + } + } + } + +// --------------------------------------------------------------------------- +// CVRRecView::DynInitMenuPaneL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + + switch ( aResourceId ) + { + case R_VR_REC_MENUPANE_DEFAULT: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + if (CVRUSBStateHanlder::IsUsbActive()) + { + aMenuPane->SetItemDimmed(ECmdRecord, ETrue); + aMenuPane->SetItemDimmed(ECmdDelete, ETrue); + aMenuPane->SetItemDimmed(ECmdRename, ETrue); + aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); + } + + TRAP_IGNORE(AddSendToMenuL( aResourceId, aMenuPane )); + + break; + } + + case R_VR_REC_MENUPANE_VIEWER: + { + TUid appuid( KNullUid ); + CEikAppUi* container = iEikonEnv->EikAppUi()->ContainerAppUi(); + if ( container ) + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + + if (CVRUSBStateHanlder::IsUsbActive()) + { + aMenuPane->SetItemDimmed(ECmdSaveAttachment, ETrue); + } + + appuid = container->Application()->AppDllUid(); + if ((appuid == KUidMmsEditor) || (appuid == KUidMailEditor)) + { + aMenuPane->SetItemDimmed(ECmdSaveAttachment, ETrue); + } + else + { + TRAP_IGNORE(AddSendToMenuL(aResourceId, aMenuPane)); + } + } + + break; + } + case R_VR_SETTINGS_MENUPANE: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + break; + } + + case R_VR_REC_MENUPANE_DELETED: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + + if (CVRUSBStateHanlder::IsUsbActive()) + { + aMenuPane->SetItemDimmed(ECmdRecord, ETrue); + aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); + + } + + // if recording already started, not allow to start recording again. + if (iModel->GetInRecordingFlag()) + { + aMenuPane->SetItemDimmed(ECmdRecord, ETrue); + aMenuPane->SetItemDimmed(ECmdSettings, ETrue); + iModel->SetInRecordingFlag(EFalse); + } + + if (CVRUSBStateHanlder::IsUsbActive()) + { + aMenuPane->SetItemDimmed(ECmdRecord, ETrue); + aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); + } + + break; + } + + case R_VR_REC_MENUPANE_INCALL_RECORDING_DISABLED: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + + if (CVRUSBStateHanlder::IsUsbActive()) + { + aMenuPane->SetItemDimmed(ECmdGoToMyClips, ETrue); + } + break; + } + + case R_VOREC_GS_SETTINGS_MENUPANE: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); + } + break; + } + + default: + { + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CVRRecView::GetSelectedFilesLC +// +// --------------------------------------------------------------------------- +// +MDesCArray* CVRRecView::GetSelectedFilesLC( TVRSelectionStyle& aStyle ) const + { + aStyle = EFocusedItem; + return iModel->GetSelectedFilesLC(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::DoActivateL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::DoActivateL(const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, const TDesC8& aCustomMessage) + { + TRAP_IGNORE( ReallyDoActivateL( aPrevViewId, + aCustomMessageId, + aCustomMessage ) ); + + } + +// --------------------------------------------------------------------------- +// CVRRecView::DoDeactivate +// +// --------------------------------------------------------------------------- +// +void CVRRecView::DoDeactivate() + { + iModel->Deactivate(); + + iModel->LeaveContext(); + + CAknViewAppUi* appUi = AppUi(); + if ( iContainer ) + { + appUi->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + + if ( iActivationContainer ) + { + appUi->RemoveFromViewStack( *this, iActivationContainer ); + delete iActivationContainer; + iActivationContainer = NULL; + } + + } + + +// --------------------------------------------------------------------------- +// CVRRecView::ViewDeactivated +// +// --------------------------------------------------------------------------- +// +void CVRRecView::ViewDeactivated() + { +#ifdef _DEBUG + RDebug::Print( _L( "CVRRecView::ViewDeactivated" )); +#endif + + TInt err = 0; + + if (!iModel->IncomingCall() && (iModel->VisualStateId() == EStatePlaying + || iModel->VisualStateId() == EStateRecording)) + { + + if (iModel->VisualStateId() == EStateRecording && iCommand + == ECmdCancelNote) + { + TRAP_IGNORE (iModel->HandleCommandL( ECmdSaveAttachment )); + } + + // Is autolock activating? + RProperty prop; + TInt val; + prop.Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, val ); + + if ( val == EAutolockOff && //Do not pause when focus is lost because of autolock + !iModel->GetIfStopCalled()) + { + + //messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change +#ifdef __AAC_ENCODER_PLUGIN + if ((iModel->Quality() == EQualityHigh) && (GetStateId() + == EStateRecording)) + { + TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted )); + } + else + { + TRAP( err, iModel->HandleCommandL( ECmdPause ) ); + } + +#else + TRAP( err, iModel->HandleCommandL( ECmdPause ) ); +#endif + + + if( err ) + { +#ifdef _DEBUG + RDebug::Print( + _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), + err); +#endif + } + } + + } + else + { + TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) ); + } + + CAknView::ViewDeactivated(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::ViewActivatedL +// The model's ActivateL() function is called to invoke any functionality +// required when the UI is activated (e.g., for In-call recording diabling +// feature) +// --------------------------------------------------------------------------- +// +void CVRRecView::ViewActivatedL(const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, const TDesC8& aCustomMessage) + { + // dismiss sound player / file manager if it was active so that recording + // view becomes visible + delete iLaunchService; + iLaunchService = NULL; + + iModel->ActivateL(); + + CAknView::ViewActivatedL(aPrevViewId, aCustomMessageId, aCustomMessage); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::Cba +// +// --------------------------------------------------------------------------- +// +CEikButtonGroupContainer* CVRRecView::Cba() const + { + return CAknView::Cba(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::AddSendToMenuL +// Use CSendAppUi to display the Send cascade +// --------------------------------------------------------------------------- +// +void CVRRecView::AddSendToMenuL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + // If the focused file is closed content (e.g. a DRM file or a protected + // MIDI file), the whole Send option mustn't be shown. + CCommonContentPolicy* ccp = CCommonContentPolicy::NewLC(); + MDesCArray* filenames = iModel->GetSelectedFilesLC(); + if (filenames->MdcaCount() > 0 && !ccp->IsClosedFileL( + filenames->MdcaPoint(0))) + { + // Set proper capabilities + TSendingCapabilities capabilities(0, KVRSendUiMsgSize, + TSendingCapabilities::ESupportsAttachments); + + // We want the send menuitem after a specific item + TInt itemPosForSend(0); + if (aResourceId == R_VR_REC_MENUPANE_DEFAULT) + { + aMenuPane->ItemAndPos(ECmdRename, itemPosForSend); + } + else if (aResourceId == R_VR_REC_MENUPANE_VIEWER) + { + aMenuPane->ItemAndPos(ECmdSaveAttachment, itemPosForSend); + } + itemPosForSend++; + if (!CVRUSBStateHanlder::IsUsbActive()) + { + iSendUi->AddSendMenuItemL(*aMenuPane, itemPosForSend, + ECmdSendVia, capabilities); + } + } + CleanupStack::PopAndDestroy(2); // ccp, filenames + } + +// --------------------------------------------------------------------------- +// CVRRecView::LayoutChangedL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::LayoutChangedL( TInt aType ) + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + iContainer->HandleResourceChangeL( aType ); + } + } + + +// --------------------------------------------------------------------------- +// CVRRecView::ReallyDoActivateL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::ReallyDoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid aCustomMessageId, const TDesC8& /*aCustomMessage*/) + { + // Don't do anything if activation is ongoing + if (iActivationContainer) + { + return; + } + + // If container exists, we have already been activated + // Deactivate needed before new activation. + if (iContainer) + { + DoDeactivate(); + } + + // Display an empty UI container until model has been fully activated + iActivationContainer = new( ELeave ) CVRRecViewActivationContainer; + iActivationContainer->ConstructL( ClientRect() ); + CAknViewAppUi* appUi = AppUi(); + appUi->AddToViewStackL( *this, iActivationContainer ); + iActivationContainer->ActivateL(); + + iDialogActivator = new( ELeave ) CVRRecViewDialogActivator(iModel); + CheckDriveState(); + + // Activate model in correct context asynchronically. + // iContainer will be activated trough callback after model activation + TCallBack cb(ActivationCallBack, this); + iContext = static_cast (aCustomMessageId.iUid); + iDialogActivator->SetViewContexts(iContext); + iModelActivator->Activate(iContext , cb); + + // Construct the real container + iContainer = new (ELeave) CVRRecViewContainer; + iContainer->ConstructL(ClientRect(), iModel, iModel, iModel, this); + iContainer->SetKeyObserver(iModel); + iContainer->SetVolumeChangeObserver(iModel); + } + +// --------------------------------------------------------------------------- +// CVRRecView::CheckDriveState +// +// --------------------------------------------------------------------------- +// +void CVRRecView::CheckDriveState() + { + TInt memoDrive = VRUtils::MemoDriveL(); + if (VRUtils::DriveValid(memoDrive)) + { + VRUtils::SetMemoDriveL((TDriveNumber) memoDrive); + } + else + { + TInt defaultDrive = VRUtils::DefaultMemoDriveL(); //eMMC + if (defaultDrive == memoDrive) + { + SetDriveL(); + } + else + { + if (VRUtils::DriveValid(defaultDrive)) + { + VRUtils::SetMemoDriveL((TDriveNumber) defaultDrive); + } + else + { + SetDriveL(); + } + } + } + + + if (iModel->GetIsDriveReady() && CVRUSBStateHanlder::IsUsbActive()) + { + iModel->SetIsDriveReady(EFalse); + iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); + iDialogActivator->Call(); + } + + + if(iModel->GetIsDriveReady()) + { + /***** check if memory is below min value, if yes, close app*****/ + RFs& fs(CEikonEnv::Static()->FsSession()); + if (SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, VRUtils::MemoDriveL())) + { + HBufC* errorText = StringLoader::LoadLC( + R_VR_MEMORY_LOW_STOP_WARNING); + CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue); + dlg->ExecuteLD(*errorText); + CleanupStack::PopAndDestroy(errorText); + iModel->SendExitEvent(); + } + // check memory size end + } + } + +// --------------------------------------------------------------------------- +// Make user insert the SD card, and choose SD card as the memo storage +// --------------------------------------------------------------------------- +// +void CVRRecView::SetDriveL() + { + TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); + if ( VRUtils::DriveValid( (TDriveNumber) driveRemovableMassStorage ) ) + { + VRUtils::SetMemoDriveL( (TDriveNumber) driveRemovableMassStorage ); + } + else + { + iModel->SetIsDriveReady(EFalse); + if (CVRUSBStateHanlder::IsUsbActive()) + { + iDialogActivator->SetDialogType(EDialogForWaitUSBPluggingOut); + iDialogActivator->Call(); + } + else + { + iDialogActivator->SetDialogType(EDialogForWaitStorageCard); + iDialogActivator->Call(); + } + } + } + +// --------------------------------------------------------------------------- +// This method show a dialog to warn user to insert the SD card. +// --------------------------------------------------------------------------- +// +TBool CVRRecView::ShowDialogForWaitStorageCardL() + { + HBufC* text = StringLoader::LoadLC( R_QTN_CCOR_INSERT_MMC ); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + TInt result( dlg->ExecuteLD( R_INSERT_F_CARD_DIALOG, *text ) ); + CleanupStack::PopAndDestroy( text ); + + if ( result ) + { + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------------------------- +// CVRRecView::SetFileHandle +// +// --------------------------------------------------------------------------- +// +void CVRRecView::SetFileHandle( RFile& aFile ) + { + iModel->SetFileHandle( aFile ); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::GetFile +// +// --------------------------------------------------------------------------- +// +RFile& CVRRecView::GetFile() + { + return iModel->MemoFileHandle(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::ActivationCallBack +// +// --------------------------------------------------------------------------- +// +TInt CVRRecView::ActivationCallBack( TAny* aRecView ) + { + CVRRecView* view = reinterpret_cast< CVRRecView* >( aRecView ); + TRAP_IGNORE( view->ActivateContainerL() ); + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRRecView::ActivateContainerL +// +// --------------------------------------------------------------------------- +// +void CVRRecView::ActivateContainerL() + { + // Activate the actual container and remove + // the one used during model construction + CAknViewAppUi* appUi = AppUi(); + appUi->AddToViewStackL( *this, iContainer ); + iContainer->ActivateL(); + + // Delete the empty container, it's not needed anymore + if ( iActivationContainer ) + { + appUi->RemoveFromViewStack( *this, iActivationContainer ); + delete iActivationContainer; + iActivationContainer = NULL; + } + + } + +TUint CVRRecView::GetStateId() const + { +// if (iModel) + return iModel->VisualStateId(); + } + + +// --------------------------------------------------------------------------- +// CVRRecView::IsEmbedded +// +// --------------------------------------------------------------------------- +// +TBool CVRRecView::IsEmbedded() const + { + + return iModel->IsEmbedded(); + + } + + +// --------------------------------------------------------------------------- +//Returns the active quality setting. +//return Quality setting of the active memo +// --------------------------------------------------------------------------- +TVRQuality CVRRecView::Quality() const + { + return iModel->Quality(); + } + +TInt CVRRecView::HandleUsbPlugInL() + { + if(MenuBar()->IsDisplayed()) + { + MenuBar()->StopDisplayingMenuBar(); + MenuBar()->TryDisplayMenuBarL(); + } + + if (EStateRecording == iModel->VisualStateId() || EStateRecordingPaused + == iModel->VisualStateId() || EStatePlaying + == iModel->VisualStateId() || EStatePlayingPaused + == iModel->VisualStateId()) + { + HandleCommandL(ECmdStop); + } + + if (EStateIdleEmbedded == iModel->VisualStateId() || EStateRecordEmbedded + == iModel->VisualStateId() || EStateIdleRecordEmbedded + == iModel->VisualStateId()) + { + ShowDialogForWaitUSBPluggingOutL(); + AppUi()->Exit(); + } + + HandleCommandL(ECmdUSBChange); + if(iUsbWaitDialog == NULL) + WaitDialogForUSBPluggingOut(iUsbWaitDialog); + return KErrNone; + } + +TInt CVRRecView::HandleUsbPlugOutL() + { + if(MenuBar()->IsDisplayed()) + { + MenuBar()->StopDisplayingMenuBar(); + MenuBar()->TryDisplayMenuBarL(); + } + + + HandleCommandL(ECmdUSBChange); + + if(!VRUtils::DriveValid(VRUtils::MemoDriveL())) + { + iModel->SendExitEvent(); + } + return KErrNone; + } + +void CVRRecView::DialogDismissedL(TInt /*aButtonId*/) + { + HandleCommandL(ECmdUSBChange); + } + +// --------------------------------------------------------------------------- +// Called by UI Framework when view switches to and from foreground +// --------------------------------------------------------------------------- +/* +void CVRRecView::HandleForegroundEventL( TBool aForeground ) + { + // If the view is going to background, pause recording for stand alone + // application mode + if ( !aForeground && !iModel->IsEmbedded() && iCommand != ECmdCancelNote ) + { + TInt err(0); + if ( !iModel->IncomingCall() && ( iModel->VisualStateId() == EStatePlaying ||iModel->VisualStateId() == EStateRecording ) ) + { + //messy, if it is ACC format, stop it. in the future when Pause is supported, it needs change +#ifdef __AAC_ENCODER_PLUGIN + if ((iModel->Quality() == EQualityHigh) && (GetStateId() == EStateRecording)) + { + TRAP_IGNORE (iModel->HandleCommandL( ECmdAutoStopInterrupted )); + } + else + { + TRAP( err, iModel->HandleCommandL( ECmdPause ) ); + } + +#else + TRAP( err, iModel->HandleCommandL( ECmdPause ) ); +#endif + + if( err ) + { +#ifdef _DEBUG + RDebug::Print( _L("CVRRecView::ViewDeactivated, PauseError Id: %d"), err ); +#endif + } + } + else + { + TRAP_IGNORE( iModel->HandleCommandL( ECmdAutoStopInterrupted ) ); + } + } + + // iCommand = 0; + + // Forward to handle default event handling. + CAknView::HandleForegroundEventL(aForeground); + } +*/ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecViewActivationContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecViewActivationContainer.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,168 @@ +/* +* Copyright (c) 2002 - 2006 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: +* An empty control that is displayed until application is fully +* constructed +* +*/ + + +// INCLUDE FILES + +#include // For layout change event definitions +#include +#include +#include + +#include "CVRRecViewActivationContainer.h" + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::CVRRecViewActivationContainer +// +// --------------------------------------------------------------------------- +// +CVRRecViewActivationContainer::CVRRecViewActivationContainer() + { + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::~CVRRecViewActivationContainer +// +// --------------------------------------------------------------------------- +// +CVRRecViewActivationContainer::~CVRRecViewActivationContainer() + { + delete iBackgroundSkinContext; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewActivationContainer::ConstructL( const TRect& aRect ) + { + CreateWindowL(); + + // Get the skin instance + iSkinInstance = AknsUtils::SkinInstance(); + + // Create background control context for skinning the background + iBackgroundSkinContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMain, aRect, ETrue ); + + SetRect( aRect ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::HandleResourceChange +// +// --------------------------------------------------------------------------- +// +void CVRRecViewActivationContainer::HandleResourceChange(TInt /*aType*/) + { + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::CountComponentControls +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewActivationContainer::CountComponentControls() const + { + return 0; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::ComponentControl +// +// --------------------------------------------------------------------------- +// +CCoeControl* CVRRecViewActivationContainer::ComponentControl( + TInt /*aIndex*/ ) const + { + return NULL; + } + + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::OfferKeyEventL +// +// --------------------------------------------------------------------------- +// +TKeyResponse CVRRecViewActivationContainer::OfferKeyEventL( + const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) + { + return EKeyWasNotConsumed; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::SizeChanged +// +// --------------------------------------------------------------------------- +// +void CVRRecViewActivationContainer::SizeChanged() + { + TRect bgRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, bgRect); + iBackgroundSkinContext->SetRect( bgRect ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::Draw +// +// --------------------------------------------------------------------------- +// +void CVRRecViewActivationContainer::Draw( const TRect& /*aRect*/ ) const + { + CWindowGc& gc = SystemGc(); + + // Fill the background with the background bitmap from the skin + // Note: if the skin doesn't define a background the area is simply + // cleared (which is OK for us). + AknsDrawUtils::Background( iSkinInstance, iBackgroundSkinContext, + this, gc, Rect() ); + + } + + +// --------------------------------------------------------------------------- +// CVRRecViewActivationContainer::MopSupplyObject +// +// --------------------------------------------------------------------------- +// +TTypeUid::Ptr CVRRecViewActivationContainer::MopSupplyObject(TTypeUid aId) + { + + if ( aId.iUid == MAknsControlContext::ETypeId ) + { + // Return the control context for the childs + return MAknsControlContext::SupplyMopObject( aId, + iBackgroundSkinContext ); + + } + return CCoeControl::MopSupplyObject( aId ); + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecViewActivationContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecViewActivationContainer.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2002-2006 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: +* An empty control that is displayed until application is fully +* constructed +* +*/ + + +#ifndef CVRRECVIEWACTIVATIONCONTAINER_H +#define CVRRECVIEWACTIVATIONCONTAINER_H + +// INCLUDES +#include +#include +#include "MVRObserver.h" +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CVRButtonPanel; +class CVRStateInfoPanel; +class MVRButtonPanelModel; +class MVRDecoratorModel; +class MVRStateInfoModel; +class MVRKeyObserver; +class MVRVolumeChangeObserver; +class CVRRecView; +class CAknNavigationDecorator; +class CAknNavigationControlContainer; +class MAknsSkinInstance; +class CAknsBasicBackgroundControlContext; + + +// CLASS DEFINITION +/** +* An empty control that is displayed until application is fully +* constructed +*/ +NONSHARABLE_CLASS( CVRRecViewActivationContainer ) + : public CCoeControl + { + public: // Constructors and destructor + + /** + * Default constructor. + */ + CVRRecViewActivationContainer(); + + /** + * Destructor + */ + ~CVRRecViewActivationContainer(); + + /** + * 2nd phase constructor + * @param aRect The screen rectangle for this component + */ + void ConstructL( const TRect& aRect ); + public: // from CCoeControl + /* + * + */ + void HandleResourceChange(TInt aType); + + public: + // from CCoeControl + + /** + * Called by the framework to get the number of sub-components + * contained in this component. + * @return The number of component controls contained by this control + */ + TInt CountComponentControls() const; + + /** + * Called by the framework to get a specified sub-component + * of this component. + * @param aIndex The index of the component to get. + * @return The component control with an index of aIndex. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * When a key event occurs, the control framework calls this function + * for each control on the control stack, until one of them can process + * the key event (and returns EKeyWasConsumed). + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown + * @return Indicates whether or not the key event was used by this + * control + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + private: // from CCoeControl + + /* + * From CCoeControl + * @see CCoeControl + */ + void SizeChanged(); + + /** + * Draws this control. + * @param aRect The area that needs updating. Ignored. + */ + void Draw( const TRect& aRect ) const; + + /* + * From CCoeControl + * @see CCoeControl + */ + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + + /** + * Handles a change to the application's resources + * @param aType The type of changed resource + */ + void HandleResourceChangeL( TInt aType ); + + private: // data + /** + * Skin instance from AknsUtils. Not owned. + */ + MAknsSkinInstance* iSkinInstance; + + /** + * Background context for clearing screen. Owned. + */ + CAknsBasicBackgroundControlContext* iBackgroundSkinContext; + }; + +#endif // CVRRECVIEWACTIVATIONCONTAINER_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecViewContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecViewContainer.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,707 @@ +/* +* Copyright (c) 2002 - 2006 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: +* A compound control class. It is responsible for owning CVRButtonPanel +* and CVRStateInfoPanel. It also handles the changing of softkeys, menubar +* and volume control. +* +*/ + + +// INCLUDE FILES + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For layout change event definitions +#include +#include // Feature manager + +#include "CVRRecViewContainer.h" +#include "CVRButtonPanel.h" +#include "CVRStateInfoPanel.h" +#include "MVRDecoratorModel.h" +#include "MVRVolumeChangeObserver.h" +#include "CVRRecView.h" +#include "MVRKeyObserver.h" +#include "CVRRemConObserver.h" +#include "VRConsts.h" + +#include + +#include "VRUtils.h" + +// ================= MEMBER FUNCTIONS ========================================= + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::CVRRecViewContainer +// +// ---------------------------------------------------------------------------- +// +CVRRecViewContainer::CVRRecViewContainer() + { + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::~CVRRecViewContainer +// +// ---------------------------------------------------------------------------- +// +CVRRecViewContainer::~CVRRecViewContainer() + { + if ( iModel ) + { + iModel->SetDecoratorObserver( NULL ); + } + delete iButtonPanel; + delete iStateInfoPanel; + delete iIhfVolumeControl; + delete iEarPieceVolumeControl; + + delete iBackgroundSkinContext; + + delete iRemConObserver; + + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::ConstructL +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::ConstructL( const TRect& aRect, + MVRButtonPanelModel* aButtonModel, + MVRDecoratorModel* aDecoratorModel, + MVRStateInfoModel* aStateInfoModel, + CVRRecView* aOwningView ) + { + CreateWindowL(); + + iRemConObserver = CVRRemConObserver::NewL( this ); + + // Get the skin instance + iSkinInstance = AknsUtils::SkinInstance(); + if ( !iSkinInstance ) + { + User::Leave( KErrNoMemory ); + } + + // Create background control context for skinning the background + iBackgroundSkinContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMain, aRect, ETrue ); + + // Refer to Series 60 European Application LAF for coordinate descriptions + iButtonPanel = new( ELeave ) CVRButtonPanel( aButtonModel, + aOwningView->Id() ); + iButtonPanel->SetContainerWindowL( *this ); + iButtonPanel->ConstructL(); + iButtonPanel->SetMopParent( this ); + TAknWindowLineLayout buttonPanelLayout = AppLayout::grid_vorec_pane(); + AknLayoutUtils::LayoutControl( iButtonPanel, Rect(), buttonPanelLayout ); + + // Refer to Series 60 European Application LAF for coordinate descriptions + iStateInfoPanel = new( ELeave ) CVRStateInfoPanel( aStateInfoModel, + aOwningView->Id() ); + iStateInfoPanel->SetContainerWindowL( *this ); + iStateInfoPanel->ConstructL(); + iStateInfoPanel->SetRect( TRect( TPoint( 0,0 ), aRect.Size() ) ); + + // Set state info panel's MOP-parent so that it can get hold of the bg + // control context + iStateInfoPanel->SetMopParent( this ); + + iNaviPane = static_cast< CAknNavigationControlContainer* >( + iEikonEnv->AppUiFactory()->StatusPane()->ControlL( + TUid::Uid( EEikStatusPaneUidNavi ) ) ); + + + // Volume indicator with IHF icon + iIhfVolumeControl = iNaviPane->CreateVolumeIndicatorL( + R_AVKON_NAVI_PANE_VOLUME_INDICATOR ); + // when touch UI is enabled + if ( AknLayoutUtils::PenEnabled() ) + { + static_cast + ( iIhfVolumeControl->DecoratedControl() )->SetObserver( this ); + } + + iEarPieceVolumeControl = iNaviPane->CreateVolumeIndicatorL( + R_AVKON_NAVI_PANE_EARPIECE_VOLUME_INDICATOR ); + + // when touch UI is enabled + if ( AknLayoutUtils::PenEnabled() ) + { + static_cast + ( iEarPieceVolumeControl->DecoratedControl() )->SetObserver( this ); + } + + iIhfVolumeControl->MakeVisible( ETrue ); + iEarPieceVolumeControl->MakeVisible( ETrue ); + + iModel = aDecoratorModel; + iModel->SetDecoratorObserver( this ); + + iOwningView = aOwningView; + + SetRect( aRect ); + // Update child control rects and other co-ordinates for current + // layout ( Euro/APAC/Arabic&Hebrew ) + UpdateLayoutL(); + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::GetHelpContext +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = TUid::Uid( KVoiceRecorderAppUID3 ); + if ( iModel ) + { + iModel->GetHelpContext( aContext ); + } + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::CountComponentControls +// +// ---------------------------------------------------------------------------- +// +TInt CVRRecViewContainer::CountComponentControls() const + { + return 2; + + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::ComponentControl +// +// ---------------------------------------------------------------------------- +// +CCoeControl* CVRRecViewContainer::ComponentControl( TInt aIndex ) const + { + switch ( aIndex ) + { + case 0: + { + return iButtonPanel; + } + case 1: + { + return iStateInfoPanel; + } + + case 2: + { + return iIhfVolumeControl->DecoratedControl(); + } + case 3: + { + return iEarPieceVolumeControl->DecoratedControl(); + } + + default: + { + return NULL; + } + } + } + + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::OfferKeyEventL +// +// ---------------------------------------------------------------------------- +// +TKeyResponse CVRRecViewContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + TBool consumed( EFalse ); + + if ( aType == EEventKeyDown ) + { + aType = aType; + } + + if ( iKeyObserver ) + { + consumed = iKeyObserver->ProcessKeyEventL( aKeyEvent, aType ); + } + + if ( !consumed ) + { + if ( iActiveVolumeControl && iVolumeChangeObserver->CanSetVolume() && + !FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) ) + { + if ( ( aKeyEvent.iCode == EKeyLeftArrow ) || + ( aKeyEvent.iCode == EKeyRightArrow ) ) + { + HandleVolumeChangeL( aKeyEvent, aType ); + } + } + + return iButtonPanel->OfferKeyEventL( aKeyEvent, aType ); + } + + return EKeyWasNotConsumed; + + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::SizeChanged +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::SizeChanged() + { + iStateInfoPanel->SetRect( Rect() ); + + TRect bgRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, bgRect); + iBackgroundSkinContext->SetRect( bgRect ); + + TAknWindowLineLayout buttonPanelLayout = AppLayout::grid_vorec_pane(); + AknLayoutUtils::LayoutControl( iButtonPanel, Rect(), buttonPanelLayout ); + + TAknWindowLineLayout statusPaneLayout = + AknLayout::status_pane( Rect(), 0 ); + + TAknLayoutRect statusPanelRect; + statusPanelRect.LayoutRect( Rect(), statusPaneLayout ); + + TAknWindowLineLayout verticalLineLayout = + AppLayout::Voice_Recorder_elements_Line_2(); + + iVerticalLineRect.LayoutRect( statusPanelRect.Rect(), verticalLineLayout ); + + TAknWindowLineLayout horizontalLineLayout = + AppLayout::Voice_Recorder_elements_Line_3(); + + iHorizontalLineRect.LayoutRect( statusPanelRect.Rect(), + horizontalLineLayout ); + } + + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::Draw +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::Draw( const TRect& /*aRect*/ ) const + { + CWindowGc& gc = SystemGc(); + + // Fill the background with the background bitmap from the skin + // Note: if the skin doesn't define a background the area is simply + // cleared (which is OK for us). + AknsDrawUtils::Background( iSkinInstance, iBackgroundSkinContext, + this, gc, Rect() ); + + iVerticalLineRect.DrawRect( gc ); + iHorizontalLineRect.DrawRect( gc ); + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::SetKeyObserver +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::SetKeyObserver( MVRKeyObserver* aObserver ) + { + iKeyObserver = aObserver; + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::SetVolumeChangeObserver +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::SetVolumeChangeObserver( + MVRVolumeChangeObserver* aObserver ) + { + iVolumeChangeObserver = aObserver; + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::Update +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::Update( TVRUpdateCommand aCommand ) + { + + if ( aCommand == EVRUpdateCBA ) + { + UpdateCBA(); + return; + } + + // Change menubar + iOwningView->MenuBar()->SetMenuTitleResourceId( + iModel->MenuBarResourceId() ); + + // error ignored, this rarely leaves but just to make sure + TRAP_IGNORE( iNaviPane = static_cast< CAknNavigationControlContainer* >(iEikonEnv->AppUiFactory()->StatusPane()->ControlL( // CSI: 42 # + TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); + + iNaviPane->DrawNow(); + + UpdateCBA(); + + TRAP_IGNORE( UpdateVolumeControlL() ); + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::UpdateCBA +// Updates the CBA buttons (LSK, MSK & RSK) according to the current state and +// draws them +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::UpdateCBA() + { + // Change CBA buttons + // Ignore any errors. SetCommandSetL() will leave if there is + // not enough memory + CEikButtonGroupContainer* cba = iOwningView->Cba(); + + // e.g. recording is about to start and options menu shouldn't be opened + if ( iModel->CbaResourceId() == R_VR_SOFTKEYS_OPTIONS_EXIT_SELECT && + !iModel->CBAEnabled() ) + { + // Same texts remain but disables LSK and RSK use + TRAP_IGNORE( cba->SetCommandSetL( + R_VR_SOFTKEYS_OPTIONS_EXIT_SELECT_NO_COMMAND ) ); + } + + // jeffery: added for CR to disable "Pause" key, will remove it later when plugin is updatedd + +#ifdef __AAC_ENCODER_PLUGIN + if (!iOwningView->IsEmbedded() && (iOwningView->Quality() == EQualityHigh) && (iOwningView->GetStateId() == EStateRecording )) + + { + TRAP_IGNORE(cba->SetCommandSetL(R_VR_SOFTKEYS_STOP_SELECT)); + } +#endif + + else + { + // Normal behaviour + TRAP_IGNORE( cba->SetCommandSetL( iModel->CbaResourceId() ) ); + } + + cba->DrawNow(); + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::UpdateVolumeControlL +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::UpdateVolumeControlL() + { + TVRVolumeControlState state; + TInt volume; + + // Get volume control data from model + iModel->GetVolumeControlState( state, volume ); + + if ( iActiveVolumeControl ) + { + // pop the previous volume control if there was one + iNaviPane->Pop(); + } + + switch ( state ) + { + case EDisabled: + { + iActiveVolumeControl = NULL; + break; + } + + case EIhf: + { + + iActiveVolumeControl = iIhfVolumeControl; + + break; + } + + case EEarPiece: + { + + iActiveVolumeControl = iEarPieceVolumeControl; + break; + } + } + + if ( state != EDisabled ) + if(iActiveVolumeControl != NULL) + { + iNaviPane->PushL( *iActiveVolumeControl ); + CAknVolumeControl* control = static_cast< CAknVolumeControl* >( + iActiveVolumeControl->DecoratedControl() ); + + + control->SetValue( volume ); + } + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::UpdateLayoutL +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::UpdateLayoutL() + { + SizeChanged(); + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::MopSupplyObject +// +// ---------------------------------------------------------------------------- +// +TTypeUid::Ptr CVRRecViewContainer::MopSupplyObject(TTypeUid aId) + { + if ( aId.iUid == MAknsControlContext::ETypeId ) + { + // Return the control context for the childs + return MAknsControlContext::SupplyMopObject( aId, iBackgroundSkinContext ); + } + return CCoeControl::MopSupplyObject( aId ); + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::HandleResourceChangeL +// +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::HandleResourceChangeL( TInt aType ) + { + CCoeControl::HandleResourceChange( aType ); + + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + UpdateLayoutL(); + } + else if ( aType == KAknsMessageSkinChange ) + { + // New skin instance is loaded + iSkinInstance = AknsUtils::SkinInstance(); + } + + // Inform other controls + iButtonPanel->HandleResourceChangeL( aType ); + iStateInfoPanel->HandleResourceChangeL( aType ); + + } + + +// ---------------------------------------------------------------------------- +// CVRRecViewContainer::HandleVolumeChangeL +// +// ---------------------------------------------------------------------------- +// +TInt CVRRecViewContainer::HandleVolumeChangeL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + + if( iActiveVolumeControl == NULL || iVolumeChangeObserver == NULL || !iVolumeChangeObserver->CanSetVolume() ) + { + // Can't process volume change yet + return KErrNotReady; + } + + CAknAppUi* appUi = static_cast< CAknAppUi* >( + iEikonEnv->EikAppUi() ); + CAknVolumeControl* control = static_cast< CAknVolumeControl* > + ( iActiveVolumeControl->DecoratedControl() ); + + TInt prevLevel( control->Value() ); + + control->OfferKeyEventL( aKeyEvent, aType ); + + // Values range from 1 to 10 so the cast is ok + TUint8 newValue( ( TUint8 ) control->Value() ); + + if ( iVolumeChangeObserver ) + { + iVolumeChangeObserver->SetVolume( newValue, + KVRMaxVolumeSteps ); + } + + // determine if the volume was already at either end + // (of the scale) + // play a system sound in that case. + if ( prevLevel == control->Value() ) + { + TInt sid( EAvkonSIDVolumeMaxTone ); + if ( prevLevel == 1 ) + { + sid = EAvkonSIDVolumeMinTone; + } + appUi->KeySounds()->PlaySound( sid ); + return KErrTooBig; + } + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewContainer::HandlePointerEventL +// Handles pointer events by passing them on to controls +// --------------------------------------------------------------------------- +// +void CVRRecViewContainer::HandlePointerEventL( const TPointerEvent& aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + CCoeControl::HandlePointerEventL(aPointerEvent); + iButtonPanel->HandlePointerEventL(aPointerEvent); + + if ( iActiveVolumeControl && iVolumeChangeObserver->CanSetVolume() ) + { + if ( (iOwningView->GetStateId() == EStatePlayingPaused ) || (iOwningView->GetStateId() == EStatePlaying ) ) + { + // pop the previous volume control if there was one + CAknVolumeControl* control = static_cast< CAknVolumeControl* > + ( iActiveVolumeControl->DecoratedControl() ); + CAknVolumePopup* popup = static_cast ( control->Parent() ); + TRect volumePopupRect( popup->Rect() ); + volumePopupRect.Move( popup->Position() ); + if( volumePopupRect.Contains(aPointerEvent.iParentPosition) ) + { + TRAP_IGNORE( popup->ShowVolumePopupL() ); + } + } + } + } + } + +// --------------------------------------------------------------------------- +// CVRRecViewContainer::FocusedButton +// Returns the currently focused button in Button Panel +// --------------------------------------------------------------------------- +// +TInt CVRRecViewContainer::FocusedButton() const + { + return iButtonPanel->FocusedButton(); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewContainer::UpdateButtonPanel +// Gives the update command to Button Panel +// --------------------------------------------------------------------------- +// +void CVRRecViewContainer::UpdateButtonPanel( TVRUpdateCommand aCommand ) + { + iButtonPanel->Update( aCommand ); + } + + +// ---------------------------------------------------------------------------- +// void CVRRecViewContainer::HandleControlEventL +// ---------------------------------------------------------------------------- +// +void CVRRecViewContainer::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) + { + // Added for touch UI to adjust volume + if( AknLayoutUtils::PenEnabled() ) + { + switch( aEventType ) + { + case EEventStateChanged: + { + if ( iActiveVolumeControl && aControl == static_cast< CAknVolumeControl*>(iActiveVolumeControl->DecoratedControl())) + { + if(iVolumeChangeObserver == NULL || !iVolumeChangeObserver->CanSetVolume() ) + { + // Can't process volume change yet + User::Leave(KErrNotReady); + } + + CAknAppUi* appUi = static_cast< CAknAppUi* >(iEikonEnv->EikAppUi() ); + CAknVolumeControl* control = static_cast< CAknVolumeControl* >(iActiveVolumeControl->DecoratedControl() ); + + TInt prevLevel( control->Value() ); + + // Values range from 1 to 10 so the cast is ok + TUint8 newValue( ( TUint8 ) control->Value() ); + + if ( iVolumeChangeObserver ) + { + iVolumeChangeObserver->SetVolume( newValue, KVRMaxVolumeSteps ); + } + + TInt sid( EAvkonSIDStandardKeyClick ); + + if ( prevLevel <= KVRVolumeControlMin ) + { + sid = EAvkonSIDVolumeMinTone; + } + else if ( prevLevel >= KVRVolumeControlMax ) + { + sid = EAvkonSIDVolumeMaxTone; + } + appUi->KeySounds()->PlaySound( sid ); + User::Leave(KErrTooBig); + + } + else if(iActiveVolumeControl == NULL) + { + User::Leave(KErrNotReady); + } + } + default: + break; + } + } + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecViewContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecViewContainer.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,315 @@ +/* +* Copyright (c) 2002-2006 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: +* A compound control class. It is responsible for owning CVRButtonPanel +* and CVRStateInfoPanel. It also handles the changing of softkeys, menubar +* and volume control. +* +*/ + + +#ifndef __CVRRECVIEWCONTAINER_H__ +#define __CVRRECVIEWCONTAINER_H__ + +// INCLUDES +#include +#include +#include "MVRObserver.h" +#include "MVRVolumeEventObserver.h" +#include + +// FORWARD DECLARATIONS +class CVRButtonPanel; +class CVRStateInfoPanel; +class MVRButtonPanelModel; +class MVRDecoratorModel; +class MVRStateInfoModel; +class MVRKeyObserver; +class MVRVolumeChangeObserver; +class MVRVolumeEventObserver; +class CVRRecView; +class CAknNavigationDecorator; +class CAknNavigationControlContainer; +class MAknsSkinInstance; +class CAknsBasicBackgroundControlContext; +class CVRRemConObserver; + + +// CLASS DEFINITION +/** +* A compound control class. It is responsible for owning CVRButtonPanel +* and CVRStateInfoPanel. It also handles the changing of softkeys, menubar, +* volume control and navipane. It also observers volume changes through +* MRemConCoreApiTargetObserver interface. +*/ +NONSHARABLE_CLASS( CVRRecViewContainer ) + : public CCoeControl, + public MVRObserver, + public MVRVolumeEventObserver, + public MCoeControlObserver + { + public: // Constructors and destructor + + /** + * Default constructor. + */ + CVRRecViewContainer(); + + /** + * Destructor + */ + ~CVRRecViewContainer(); + + /** + * 2nd phase constructor + * @param aRect The screen rectangle for this component + * @param aButtonModelPointer to a button panel observer (or NULL) + * @param aDecoratorModel Pointer to a decorator observer (or NULL) + * @param aStateInfoModel Pointer to a state info observer (or NULL) + * @param aOwningView Pointer to the view that owns us. + */ + void ConstructL( const TRect& aRect, + MVRButtonPanelModel* aButtonModel, + MVRDecoratorModel* aDecoratorModel, + MVRStateInfoModel* aStateInfoModel, + CVRRecView* aOwningView ); + + public: // from CCoeControl + + /** + * Specifies the help context for this form. + * @param aContext the context IDs are placed here + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + + public: + // from CCoeControl + + /** + * Called by the framework to get the number of sub-components + * contained in this component. + * @return The number of component controls contained by this control + */ + TInt CountComponentControls() const; + + /** + * Called by the framework to get a specified sub-component + * of this component. + * @param aIndex The index of the component to get. + * @return The component control with an index of aIndex. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * When a key event occurs, the control framework calls this function + * for each control on the control stack, until one of them can process + * the key event (and returns EKeyWasConsumed). + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown + * @return Indicates whether or not the key event was used by this + * control + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + private: // from CCoeControl + + /* + * From CCoeControl + * @see CCoeControl + */ + void SizeChanged(); + + /** + * Draws this control. + * @param aRect The area that needs updating. Ignored. + */ + void Draw( const TRect& aRect ) const; + + /* + * From CCoeControl + * @see CCoeControl + */ + TTypeUid::Ptr MopSupplyObject(TTypeUid aId); + + /* + * From CCoeControl + * @see CCoeControl + */ + void HandlePointerEventL( const TPointerEvent& aPointerEvent ); + + /** + *From MCoeControlObserver. To handle the volume events for touch UI. + */ + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); + + + + public: // from MVRObserver + + /** + * Called to notify a change in the observed subject's state. + */ + void Update( TVRUpdateCommand aCommand = EVRUpdate ); + + public: // from MVRVolumeEventObserver + + /** + * Handles volume change event received from either side volume + * keys or left-right rocker presses. + * @param aKeyEvent The key event. Will be forwarded to CAknVolumeControl + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown. Will be forwarded to CAknVolumeControl + */ + + TInt HandleVolumeChangeL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + + public: // new methods + + /** + * Registers an observer for receiving + * key event notifications from this class. + * @param aObserver The observer object. + */ + void SetKeyObserver( MVRKeyObserver* aObserver ); + + /** + * Registers an observer for receiving + * audio volume change notifications from this class. + * @param aObserver The observer object. + */ + void SetVolumeChangeObserver( MVRVolumeChangeObserver* aObserver ); + + /** + * Updates the layout of all child controls to current active + * layout (Euro, Apac, Arabic/Hebrew) + */ + void UpdateLayoutL(); + + /** + * Handles a change to the application's resources + * @param aType The type of changed resource + */ + void HandleResourceChangeL( TInt aType ); + + /** + * Returns the currently focused button index in Button Panel + * @return The focused button index + */ + TInt FocusedButton() const; + + /** + * Gives the update command to Button Panel + * @param Update command + */ + void UpdateButtonPanel( TVRUpdateCommand aCommand ); + + + private: + + /** + * Tells the volume observer to update the volume + */ + void UpdateVolumeObserver(); + + /** + * Updates the navipane according to the current IHF setting + */ + void UpdateVolumeControlL(); + + /** + * Updates the CBA Buttons (LSK, RSK, MSK) + */ + void UpdateCBA(); + + private: // data + + /** + * The ihf volume control (in navi pane), + */ + CAknNavigationDecorator* iIhfVolumeControl; + + /** + * The ear piece volume control (in navi pane), + */ + CAknNavigationDecorator* iEarPieceVolumeControl; + + /** + * A pointer to the active volume control (ihf or ear piece) + */ + CAknNavigationDecorator* iActiveVolumeControl; + + /** + * Pointer to the navi pane, + * used as a short cut. Not owned. + */ + CAknNavigationControlContainer* iNaviPane; + + /** + * Pointer to the button panel component. Owned. + */ + CVRButtonPanel* iButtonPanel; + + /** + * Pointer to the state info panel component. Owned. + */ + CVRStateInfoPanel* iStateInfoPanel; + + /** + * Pointer to the view that owns us. Not owned. + */ + CVRRecView* iOwningView; + + /** + * Pointer to the decorator data model. Not owned. + */ + MVRDecoratorModel* iModel; + + /** + * Pointer to the key event observer (or NULL). Not owned. + */ + MVRKeyObserver* iKeyObserver; + + /** + * Pointer to the audio volume change observer (or NULL). Not owned. + */ + MVRVolumeChangeObserver* iVolumeChangeObserver; + + TRect iHorizontalLine; + TRect iVerticalLine; + + TAknLayoutRect iHorizontalLineRect; + TAknLayoutRect iVerticalLineRect; + TAknLayoutRect iButtonPanelRect; + + /** + * Skin instance from AknsUtils. Not owned. + */ + MAknsSkinInstance* iSkinInstance; + + /** + * Background context for clearing screen. Owned. + */ + CAknsBasicBackgroundControlContext* iBackgroundSkinContext; + + /** + * Notifier for side volume key events. Owned. + */ + CVRRemConObserver* iRemConObserver; + }; + +#endif // __CVRRECVIEWCONTAINER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecViewModel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecViewModel.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,2476 @@ +/* +* Copyright (c) 2002 - 2006 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 class is the data model and state machine of the Recorder View. +* The state machine is defined by a VR_STATEMACHINE resource structure. +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // Key definitions +#include +#include +#include +#include +#include +#include +#include + +#include // Feature manager +#include // Disable e-mail +#include "MessagingDomainCRKeys.h" // Disable e-mail variation flag + +#include // link against centralrepository.lib +#ifdef RD_MULTIPLE_DRIVE +#include +#endif +#include "VoiceRecorderInternalCRKeys.h" + +#include +#include "CVRMemo.h" +#include "TVRState.h" +#include "CVRMdaRecorder.h" +#include "VRConsts.h" +#include "CVRSystemEventHandler.h" +#include "CVRMediaRemovalMonitor.h" +#include "VRUtils.h" +#include "CVRRecViewModel.h" +#include + +#include "VRUSBStateHanlder.h" + + +// CONSTANTS +const TInt KAllowInCallRecording( 1 ); + +// Shown if maximum recording time is not known +_LIT( KVRBeforeFirstEstimateLabel, "--:--:--" ); +// MMS/High text is inserted here +_LIT( placeForQuality, "%U" ); + + +// ================= MEMBER FUNCTIONS ======================================== +// --------------------------------------------------------------------------- +// CVRRecViewModel::CVRRecViewModel +// +// --------------------------------------------------------------------------- +// +CVRRecViewModel::CVRRecViewModel() + : iStateArray( 2 ), + iLabelSets( 2 ), + iPreviousCallState( EPSCTsyCallStateNone ), + iCanHandleCommands( ETrue ), + iCBAEnabled( ETrue ), + iIsDriveReady( ETrue ) + { + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::~CVRRecViewModel +// +// --------------------------------------------------------------------------- +// +CVRRecViewModel::~CVRRecViewModel() + { + // It might be possible to make this method leaving and put it + // somewhere else than destructor + SaveVolumeSettings(); + iLabelSets.ResetAndDestroy(); + iStateArray.Reset(); + + delete[] iLabelLayoutLinks; + delete iMemo; + delete iRecorder; + if ( iGlobalNote && iIsNoteLaunched ) + { + // nothing much to do but ignore. + TRAP_IGNORE( iGlobalNote->CancelNoteL( iNoteId ) ); + } + + delete iGlobalNote; + + if (iCurrentCallHandler) + { + delete iCurrentCallHandler; + } + delete iCurrentMMCEjectHandler; + + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ConstructFromResourceL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::ConstructFromResourceL( TResourceReader& aReader ) + { + + TRAP_IGNORE( iCurrentCallHandler = CVRSystemEventHandler::NewL() ); + iCurrentCallHandler->Listen( KPSUidCtsyCallInformation, KCTsyCallState, + this ); + //listen MMC eject + TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); + iCurrentMMCEjectHandler = CVRMediaRemovalMonitor::NewL(driveRemovableMassStorage, CEikonEnv::Static()->FsSession(), this); + + if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) && + FeatureManager::FeatureSupported( + KFeatureIdApplicationControllableAudioRouting ) ) + { + ReadDefaultSpeakerL(); + } + else + { + iIhfState = ETrue; + } + + LoadVolumeSettingsL(); + // Connecting and initialization: + CRepository* myRepSession = CRepository::NewLC( KCRUidVoiceRecorder ); + + // Get the values from the repository + User::LeaveIfError( myRepSession->Get( KVRDefaultAudioFormat, + iVRAudioFormat ) ); + + User::LeaveIfError( myRepSession->Get( KVRAllowInCallRecording, + iVRAllowInCallRecording ) ); + CleanupStack::PopAndDestroy( myRepSession ); + + iGlobalNote = CAknGlobalNote::NewL(); + + iMemo = new( ELeave ) CVRMemo; + iMemo->ConstructL( iVRAudioFormat ); + + TInt numLabelSets( aReader.ReadInt16() ); + TInt i; + + for ( i = 0; i < numLabelSets; i++ ) + { + CDesCArray* labelSet; + TInt numLabels( aReader.ReadInt16() ); + + if ( numLabels > 0 ) + { + // TResourceReader re-reads the length, have to rewind + aReader.Rewind( sizeof( TInt16 ) ); + labelSet = aReader.ReadDesCArrayL(); + } + else + { + // create an empty array "by hand", + // TResourceReader is not able to do this + labelSet = new( ELeave ) CDesCArrayFlat( 1 ); + } + + CleanupStack::PushL( labelSet ); + iLabelSets.AppendL( labelSet ); + CleanupStack::Pop( labelSet); + } + + TInt linkCount( aReader.ReadInt16() ); + iLabelLayoutLinks = new( ELeave ) TVRLabelLayoutLink[ linkCount ]; + for ( i = 0; i < linkCount; i++ ) + { + iLabelLayoutLinks[ i ].ReadFromResource( aReader ); + } + + TInt numUiStates( aReader.ReadInt16() ); + + TVRState uistate; + for ( i = 0; i < numUiStates; i++ ) + { + uistate.ReadFromResource( aReader ); + uistate.iId = i; + iStateArray.AppendL( uistate ); + } + + iState = &iStateArray.At( 0 ); + + TInt numContexts( aReader.ReadInt16() ); + for ( i = 0; i < numContexts; i++ ) + { + TInt id( aReader.ReadInt8() ); + TVRContext* context = &iContexts[ id ]; + context->iValid = ETrue; + context->iInitialTransition.iCommandId = aReader.ReadUint8(); + context->iInitialTransition.iNewState = aReader.ReadUint8(); + context->iInitialTransition.iFunctionId = aReader.ReadUint8(); + context->iInitialTransition.iValid = ETrue; + + + TInt numStates( aReader.ReadInt16() ); + for ( TInt j = 0; j < numStates; j++ ) + { + TInt id( aReader.ReadInt8() ); + TVRContext::TState* state = &context->iStates[ id ]; + state->iValid = ETrue; + TInt numTransitions( aReader.ReadInt16() ); + __ASSERT_DEBUG( numTransitions <= KVRMaxTransitions, + User::Panic( KVRPanic, EPanicTooManyTransitions ) ); + + for ( TInt k = 0; k < numTransitions; k++ ) + { + TVRContext::TTransition* trans = &state->iTransitions[ k ]; + trans->iCommandId = aReader.ReadUint8(); + trans->iNewState = aReader.ReadUint8(); + trans->iFunctionId = aReader.ReadUint8(); + trans->iValid = ETrue; + } + } + } + + StringLoader::Load( iDateUsualWithZero, R_QTN_DATE_USUAL_WITH_ZERO ); + StringLoader::Load( iTimeUsualWithZero, R_QTN_TIME_USUAL_WITH_ZERO ); + StringLoader::Load( iTimeDuratLong, R_QTN_TIME_DURAT_LONG ); + StringLoader::Load( iTimeDuratMinSecWithZero, + R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO ); + + + + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ProcessKeyEventL +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::ProcessKeyEventL( const TKeyEvent& aKeyEvent, + const TEventCode aType ) + { + TBool retval( EFalse ); + if ( aType != EEventKey ) + { + return retval; + } + + switch ( aKeyEvent.iCode ) + { + case EKeyPhoneEnd: + { + TInt currentState( iCurrentCallHandler->StateL(KPSUidCtsyCallInformation, KCTsyCallState) ); + + if ( ( currentState != EPSCTsyCallStateNone ) ) + { + HandleCommandL( ECmdDisconnectCall ); + retval = EKeyWasNotConsumed; + } + else + { + // Voice recorder wasn't here =), retval stays EFalse + iIsEndKey = ETrue; + + // Exit if app is not fully initialized + if ( !iContextEntered ) + { + CEikonEnv::Static()->EikAppUi()-> + HandleCommandL( EEikCmdExit ); + } + } + break; + } + case EKeyBackspace: + { + HandleCommandL( ECmdDelete ); + retval = ETrue; + break; + } + case EKeyYes: + { + if( aKeyEvent.iRepeats > 0 ) + { + if( VisualStateId() == EStateRecording || + VisualStateId() == EStatePlaying ) + { + HandleCommandL( ECmdPause ); + } + } + break; + } + case EKeySide: + { + retval = ETrue; + + if ( aKeyEvent.iRepeats ) + { + switch ( iState->iId ) + { + case EStateIdle: + { + HandleCommandL( ECmdPlay ); + break; + } + case EStateRecording: + case EStateRecordEmbedded: + case EStateRecordingPaused: + case EStatePlaying: + case EStatePlayingPaused: + { + HandleCommandL( ECmdStop ); + break; + } + case EStateDeleted: + default: + { + retval = EFalse; + break; + } + } + } + else + { + switch ( iState->iId ) + { + case EStateIdle: + case EStateDeleted: + case EStateRecordingPaused: + { + HandleCommandL( ECmdRecord ); + break; + } + case EStateRecording: + case EStateRecordEmbedded: + case EStatePlaying: + { + HandleCommandL( ECmdPause ); + break; + } + case EStatePlayingPaused: + { + HandleCommandL( ECmdPlay ); + break; + } + default: + { + retval = EFalse; + break; + } + } + } + break; + } + default: + { + break; + } + } + return retval; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::HandleCommandL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::HandleCommandL( TInt aCommandId ) + { + // This command must be acceptable all times. + if ( aCommandId == ECmdCancelNote ) + { + if ( iIsNoteLaunched ) + { + // nothing much to do but ignore. + TRAP_IGNORE( iGlobalNote->CancelNoteL( iNoteId ) ); + } + return; + } + + if ( !CanAcceptCommands() ) + { + return; + } + + if ( !CanHandleCommands() ) + { + return; + } + if ( EStateRecording == iState->iId && ECmdRecord == aCommandId || + EStateRecording == iState->iId && ECmdRename == aCommandId ) + { + return; + } + + switch ( aCommandId ) + { + case ECmdHelp: + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + case EEikCmdExit: + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( EAknSoftkeyExit); + break; + } + + case EAknSoftkeyExit: + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + case ECmdSendVia: + { + CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommandId ); + break; + } + case ECmdSaveAttachment: + { + __ASSERT_DEBUG( iRecorder, User::Panic( KVRPanic, KErrNotFound ) ); + iRecorder->DetachMemo(); + // Save permanently but do not remove the original + + HBufC* label = StringLoader::LoadLC( R_VR_SAVE_WAITNOTE_LABEL ); + + iIsNoteLaunched = ETrue; + iMemo->SavePermanentlyL( iGlobalNote, iNoteId, *label, ETrue ); + + if ( iStateInfoObserver ) + { + iStateInfoObserver->Update(); + } + iRecorder->AttachToMemoL( iMemo ); + + // Remove the waitnote + iGlobalNote->CancelNoteL( iNoteId ); + iIsNoteLaunched = EFalse; + + CleanupStack::PopAndDestroy( label ); + break; + } + // FLOWTHROUGH + // in case of end key, different command must be given to state + // machine - recview gives ECmdAutoStopInterrupted + case ECmdAutoStopInterrupted: + { + if ( iIsEndKey ) + { + aCommandId = ECmdEndKey; + iIsEndKey = EFalse; + } + } + // Other commands are given to the state machine + default: + { + TVRContext::TTransition transition; + GetTransition( transition, aCommandId ); + TBool functionOK( ETrue ); + TRAPD( err, functionOK = + CallFunctionByIdL( transition.iFunctionId ) ); + + if ( err != KErrNone ) + { + // This is done to enable button events + iCanHandleCommands = ETrue; + } + + // We may have detached memo and we must reattach + if ( err == KErrInUse ) + { + __ASSERT_DEBUG( iRecorder, + User::Panic( KVRPanic, KErrNotFound ) ); + iRecorder->AttachToMemoL( iMemo ); + } + + if ( err == KErrNotReady && iIsNoteLaunched && iGlobalNote ) + { + // nothing much to do but ignore. + TRAP_IGNORE( iGlobalNote->CancelNoteL( iNoteId ) ); + } + + // If the disk gets full while saving, the next state is deleted + if ( err == KErrDiskFull || err == KErrArgument ) + { + if ( iContext == EContextRecordNewNormal || + iContext == EContextNormal || + iContext == EContextEmptyNormal ) + { + ChangeState( EStateDeleted, ETrue ); + } + else + { + // In record new embedded context the UI is left in + // idle state, so the memo must be attached + // (EFunctionOK detaches it) + __ASSERT_DEBUG( iRecorder, + User::Panic( KVRPanic, KErrNotFound ) ); + if(!dynamic_cast(iRecorder)->IsAttachedToMemo()) + { + iRecorder->AttachToMemoL( iMemo ); + } + } + + if ( err == KErrDiskFull ) + { + // Maybe an error note should be shown + return; + } + + // Propagate to the error handler to show a note. + User::Leave( err ); + } + else + { + // The LeaveIfError must be here because CallFunctionByIdL + // might have called Exit() (leaving with -1002) and the + // framework might be half-dead leading to access violation, + // if the UI state is changed + User::LeaveIfError( err ); + if ( functionOK ) + { + // If the in-call recording disabling feature is active, + // then the state of the UI will have to reflect that + TUint newState(transition.iNewState); + + if ( iVRAllowInCallRecording != KAllowInCallRecording ) + { + TInt currentState( iCurrentCallHandler->StateL( KPSUidCtsyCallInformation, KCTsyCallState ) ); + + if ( currentState != EPSCTsyCallStateNone ) + { + currentState = iCurrentCallHandler->StateL( + KPSUidCtsyCallInformation, KCTsyCallType ); + + switch ( currentState ) + { + case EPSCTsyCallTypeCSVoice: + case EPSCTsyCallTypeHSCSD: + case EPSCTsyCallTypeH324Multimedia: + case EPSCTsyCallTypeVoIP: + { + newState = EStateDisableButtons; + break; + } + default: + { + break; + } + } + + } + } + + // Function didn't want to cancel the state change + ChangeState( newState ); + } + } + + break; + } + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetTransition +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::GetTransition( TVRContext::TTransition& aTransition, + TUint aCommandId ) const + { + __ASSERT_DEBUG( iContexts[ iContext ].iValid, User::Panic( KVRPanic, + EPanicInvalidContext ) ); + __ASSERT_DEBUG( iContexts[ iContext ].iStates[ iState->iId ].iValid, + User::Panic( KVRPanic, EPanicInvalidState ) ); + + const TVRContext::TState* state = + &(iContexts[ iContext ].iStates[ iState->iId ]); + for ( TInt i = 0; i < KVRMaxTransitions; i++ ) + { + const TVRContext::TTransition* transition = &state->iTransitions[ i ]; + if ( ( transition->iCommandId == aCommandId ) && + ( transition->iValid ) ) + { + aTransition = *transition; + return; + } + } + + User::Panic( KVRPanic, EPanicInvalidTransition ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetTransition +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::GetTransition( + TVRContext::TTransition& aTransition ) const + { + aTransition = iContexts[ iContext ].iInitialTransition; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ChangeState +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::ChangeState( TUint aNewState, TBool aForced ) + { + if ( !aForced ) + { + if ( ( aNewState == iState->iId ) || ( aNewState == EStateInitial ) ) + { + return; + } + } + + iState = &iStateArray.At( aNewState ); + + if ( iStateInfoObserver ) + { + iStateInfoObserver->Update(); + } + if ( iButtonPanelObserver ) + { + iResetButtons = ETrue; + iButtonPanelObserver->Update( EVRUpdateStateChange ); + } + if ( iDecoratorObserver ) + { + iDecoratorObserver->Update(); + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::EnterContextL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::EnterContextL( const TVRRecViewContexts& aContext ) + { + iContextEntered = EFalse; + if ( iRecorder ) + { + delete iRecorder; + iRecorder = NULL; + } + + CVRMdaRecorder* recorder = new( ELeave ) CVRMdaRecorder(); + CleanupStack::PushL( recorder ); + recorder->ConstructL(); + CleanupStack::Pop(); + iRecorder = recorder; + + iRecorder->RegisterObserver( iStateInfoObserver ); + iRecorder->SetAutoStopObserver( this ); + + LeaveContext(); + iContext = aContext; + + iRecorder->AttachToMemoL(iMemo); + + TVRContext::TTransition transition; + GetTransition( transition ); + + ChangeState( transition.iNewState, ETrue ); + CallFunctionByIdL( transition.iFunctionId ); + + iContextEntered = ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::LeaveContext +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::LeaveContext() + { + iContextEntered = EFalse; + if( iRecorder ) + { + iRecorder->UnregisterObserver( iStateInfoObserver ); + iRecorder->UnregisterObserver( iButtonPanelObserver ); + + iRecorder->DetachMemo(); + + iRecorder->RegisterObserver( iStateInfoObserver ); + iRecorder->RegisterObserver( iButtonPanelObserver ); + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CbaResourceId +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::CbaResourceId() const + { + return iState->iCbaResourceId; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetHelpContext +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::GetHelpContext( TCoeHelpContext& aContext ) const + { + if (FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + if ( iState->iId == EStateDeleted ) + { + aContext.iContext = KVOREC_HLP_EMPTY_RECORDER; + } + else + { + aContext.iContext = KVOREC_HLP_MAIN; + } + } + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetDecoratorObserver +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetDecoratorObserver( MVRObserver* aObserver ) + { + iDecoratorObserver = aObserver; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::MenuBarResourceId +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::MenuBarResourceId() const + { + return iState->iMenubarResourceId; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ButtonCount +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::ButtonCount() const + { + + return iState->iButtonCount; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CBAEnabled +// from MVRDecoratorModel +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::CBAEnabled() const + { + return iCBAEnabled; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ButtonState +// Checks and returns whether the state of the button should be in active or +// dimmed state. aButtonId tells the index of the button to be checked. Few +// special cases (end and the beginning of the clip) can be handled here. +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::ButtonState( TInt aButtonId ) const + { + if(CVRUSBStateHanlder::IsUsbActive() || !iIsDriveReady) + { + return EDimmed; + } + // Disable rewind button if there's nothing to rewind + if ( aButtonId == EButtonRewind && + ( Position().Int64() / KVRSecondAsMicroSeconds ) < 1 ) + { + return EDimmed; + } + + // Disable forward button if position is at the end or the length of the + // clip is smaller than 1 + if ( aButtonId == EButtonForward && ( Position() == Duration() || + ( Duration().Int64() / KVRSecondAsMicroSeconds ) < 1 ) ) + { + return EDimmed; + } + + // Jeffery: the following ifs are temperary. they need to be removed after "Pause" is supported in plugin +#ifdef __AAC_ENCODER_PLUGIN + if ( iState->iId == EStateRecording && aButtonId == EButtonRecord && iMemo->Quality() == EQualityHigh) + { + return EDimmed; + } +#endif + + return iState->ButtonState( aButtonId ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CommandId +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::CommandId( TInt aButtonId ) const + { + return iState->ButtonCommandId( aButtonId ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::InitialFocusButtonId +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::InitialFocusButtonId() const + { + return iState->iFocusButtonId; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetButtonPanelObserver +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetButtonPanelObserver( MVRObserver* aObserver ) + { + if ( iRecorder ) + { + if ( iButtonPanelObserver ) + { + iRecorder->RegisterObserver( aObserver ); + } + else + { + iRecorder->UnregisterObserver( iButtonPanelObserver ); + } + } + + iButtonPanelObserver = aObserver; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ResetNeeded +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::ResetNeeded() + { + if ( iResetButtons ) + { + iResetButtons = EFalse; + return ETrue; + } + + return iResetButtons; // EFalse always + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::VisualStateId() +// Returns the id of VR current (visual) state +// --------------------------------------------------------------------------- +// +TUint CVRRecViewModel::VisualStateId() const + { + return iState->iStateId; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CanHandleCommands() +// Returns ETrue if model can handle new commands, EFalse otherwise +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::CanHandleCommands() const + { + return iCanHandleCommands; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::Duration +// +// --------------------------------------------------------------------------- +// +TTimeIntervalMicroSeconds CVRRecViewModel::Duration() const + { + if ( ( iState->iId == EStateRecording ) || + ( iState->iId == EStateRecordingPaused ) ) + { + return iMemo->MaxDuration(); + } + return iMemo->Duration(); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::Position +// +// --------------------------------------------------------------------------- +// +TTimeIntervalMicroSeconds CVRRecViewModel::Position() const + { + if ( ( iState->iId == EStateRecording ) || + ( iState->iId == EStateRecordingPaused ) ) + { + return iMemo->Duration(); + } + return iMemo->Position(); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetLabel +// Non-leaving version +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::GetLabel( TDes& aName, TInt aLabelIndex ) const + { + TRAP_IGNORE( GetLabelL( aName, aLabelIndex ) ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetLabelL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::GetLabelL( TDes& aName, TInt aLabelIndex ) const + { + if ( !iMemo->IsValid() ) + { + aName.SetLength( 0 ); + return; + } + + CDesCArray* labels = iLabelSets.At( iState->iLabelSetId ); + User::LeaveIfNull( labels ); + + if ( aLabelIndex < labels->Count() ) + { + TInt index = aLabelIndex; + + TBuf< VRLABELMAXLENGTH > formatStr( + labels->MdcaPoint( index ) ); + TBuf< VRLABELMAXLENGTH > formattedTime; + + switch ( aLabelIndex ) + { + case ELabelMemoName: + { + //StringLoader::Format( aName, formatStr, -1, iMemo->Name() ); + aName.Copy(iMemo->Name()); + break; + } + case ELabelMemoDate: + { + iMemo->DateCreated().FormatL( formattedTime, + iDateUsualWithZero ); + StringLoader::Format( aName, formatStr, 0, formattedTime ); + + iMemo->DateCreated().FormatL( formattedTime, + iTimeUsualWithZero ); + formatStr.Copy( aName ); + StringLoader::Format( aName, formatStr, 1, formattedTime ); + AknTextUtils::LanguageSpecificNumberConversion( aName ); + break; + } + case ELabelMemoQuality: + { + // Display empty row if feature is not on + if ( !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + aName.Copy( KNullDesC ); + break; + } + + aName.Copy( formatStr ); + break; + } + case ELabelQualityText: + { + // Display empty row if feature is not on + if ( !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + aName.Copy( KNullDesC ); + break; + } + + formatStr.Copy( placeForQuality ); + + switch( iMemo->Quality() ) + { + case EQualityMMSOptimized: + { + StringLoader::Load( formattedTime, R_VOREC_QUALITY_MMS_OPTIMIZED ); + StringLoader::Format( aName, formatStr, -1, formattedTime ); + break; + } + + // EQualityNormal is used only when mp4 is supported. In this case the file is saved as wav. +#ifdef __AAC_ENCODER_PLUGIN + case EQualityNormal: + { + StringLoader::Load( formattedTime, R_VOREC_QUALITY_NORMAL ); + StringLoader::Format( aName, formatStr, -1, formattedTime ); + break; + } +#endif + + case EQualityHigh: + { + StringLoader::Load( formattedTime, R_VOREC_QUALITY_HIGH ); + StringLoader::Format( aName, formatStr, -1, formattedTime ); + break; + } + default: + { + aName.Copy( KNullDesC ); + break; + } + } + break; + } + case ELabelBarMin: + { + aName.Copy( KNullDesC ); + break; + } + case ELabelBarMax: + { + // This label layout is nowadays taking automatically care of + // string mirroring in the case of mirrored layout. So use of + // AknLayoutUtils::LayoutMirrored() isn't needed anymore + + TTimeIntervalMicroSeconds max( 0 ); + if ( ( iState->iId == EStateRecording ) || + ( iState->iId == EStateRecordingPaused ) ) + { + max = iMemo->MaxDuration(); + } + else + { + max = iMemo->Duration().Int64(); + + if ( max.Int64() < 0 ) + { + max = 0; + } + } + + TTime lengthAsTime( max.Int64() ); + TTime positionAsTime( iMemo->Position().Int64() ); + TBuf< VRLABELMAXLENGTH > formattedPosition; + + // current memo quality + TVRQuality quality( iMemo->Quality() ); + + // Show --:--:-- if estimate for maximum recording time is not + // known yet. Done only when memo quality is High + if ( ( ( iState->iId == EStateRecording ) || + ( iState->iId == EStateRecordingPaused )) && + ( Position() < KVRFirstEstimateTime ) && + ( quality == EQualityHigh ) && + ( max.Int64() < 0) ) + { + formattedTime.Append( KVRBeforeFirstEstimateLabel ); + } + // Show normal maximum time + else + { + // Show longer format if time is more than 1 hour + FormatTimeL( lengthAsTime, formattedTime ); + } + + // Show longer format if time is more than 1 hour + FormatTimeL( positionAsTime, formattedPosition ); + + StringLoader::Format( aName, formatStr, 0, formattedPosition ); + formatStr.Copy( aName ); + StringLoader::Format( aName, formatStr, 1, formattedTime ); + AknTextUtils::LanguageSpecificNumberConversion( aName ); + + break; + } + case ELabelStatus: + { + aName.Copy( iState->iStatus ); + break; + } + default: + { + break; + } + } + } + else + { + aName.SetLength( 0 ); + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ResourceIdForLabel +// +// --------------------------------------------------------------------------- +// +TInt CVRRecViewModel::ResourceIdForLabel( TInt aLabelIndex, + TAknLayoutId aLayout ) const + { + switch ( aLayout ) + { + case EAknLayoutIdELAF: + default: + return iLabelLayoutLinks[ aLabelIndex ].iEuroId; + + case EAknLayoutIdABRW: + return iLabelLayoutLinks[ aLabelIndex ].iArabicHebrewId; + + case EAknLayoutIdAPAC: + return iLabelLayoutLinks[ aLabelIndex ].iApacId; + + } + + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetStateInfoObserver +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetStateInfoObserver( MVRObserver* aObserver ) + { + iStateInfoObserver = aObserver; + if( iRecorder ) + { + iRecorder->RegisterObserver( iStateInfoObserver ); + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetStateInfoPanelObserver +// Observes changes in state info panel +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetStateInfoPanelObserver( MVRStateInfoObserver* + aObserver ) + { + iStateInfoPanelObserver = aObserver; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::HasProgressBar +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::HasProgressBar() const + { + return iState->iHasProgressBar; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetSelectedFilesLC +// +// --------------------------------------------------------------------------- +// +MDesCArray* CVRRecViewModel::GetSelectedFilesLC() const + { + CDesCArray* array = new( ELeave ) CDesCArrayFlat( 1 ); // granularity = 1 + CleanupStack::PushL( array ); + array->AppendL( iMemo->Filename() ); + return array; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetVolume +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetVolume( TInt aStep, TInt aMaxSteps ) + { + iIhfVolume = aStep; + iRecorder->SetVolume( aStep, aMaxSteps ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetMemoName +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetMemoName( const TDesC& aFilename ) + { + iMemo->SetName( aFilename ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetMemoNameNewL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetMemoNameNewL( TBool aEmbedded ) + { + iMemo->SetTemporaryNameL( aEmbedded ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::Filename +// +// --------------------------------------------------------------------------- +// +const TDesC& CVRRecViewModel::Filename() const + { + return iMemo->Filename(); + } + +void CVRRecViewModel::SetSavingLocationL( const TDesC& aPath ) + { + iMemo->SetSavingLocationL( aPath ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::Update +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::Update( TVRUpdateCommand /*aCommand*/ ) + { + // Error is propagated to error handling method + TRAPD( err, HandleCommandL( ECmdAutoStopAtEnd ) ); + + // Ignore further errors + TRAP_IGNORE( HandleUpdateErrorL( err ) ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::IsEmbedded +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::IsEmbedded() const + { + return ( iContext == EContextRecordNewForRemote ) + || ( iContext == EContextViewer ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CanAcceptCommands +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::CanAcceptCommands() const + { + return ( iContextEntered != EFalse ) && iRecorder->CanAcceptCommands(); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SendViaL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SendViaL( CSendUi* aSendUi ) + { + // Don't accept commands during sending operation + iContextEntered = EFalse; + + iRecorder->DetachMemo(); + // Detaching resets the clip position so button panel needs to be updated + iButtonPanelObserver->Update( EVRUpdatePositionChange ); + + TSendingCapabilities capabilities + (0, KVRSendUiMsgSize, TSendingCapabilities::ESupportsAttachments); + CMessageData* messageData = CMessageData::NewL(); + CleanupStack::PushL( messageData ); + + messageData->AppendAttachmentHandleL( iMemo->File() ); + + // Get an array of the services that should be dimmed + CArrayFixFlat< TUid >* servicesToDim = SendViaServicesToDimLC(); + + // For some reason this function leaves when 'NO' is selected in bluetooth + // case's activation question. If this is not Trapped iContextEntered stays + // EFalse and no commands can be executed + TRAPD( err, aSendUi->ShowQueryAndSendL( messageData, + capabilities, + servicesToDim ) ); + + CleanupStack::PopAndDestroy( servicesToDim ); + CleanupStack::PopAndDestroy( messageData ); + + iRecorder->AttachToMemoL( iMemo ); + + iContextEntered = ETrue; + + // This is done so we get possible "Feature not supported" + // infonote from the framework + User::LeaveIfError( err ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SendViaServicesToDimLC +// Generates an array of the services (Uids) that should be dimmed from Send +// via menu. Returns a pointer to that array. Configuration in Messaging +// central repository defines services to dim. +// --------------------------------------------------------------------------- +// +CArrayFixFlat* CVRRecViewModel::SendViaServicesToDimLC() + { + CArrayFixFlat< TUid >* servicesToDim = + new( ELeave ) CArrayFixFlat< TUid >( 1 ); + CleanupStack::PushL( servicesToDim ); + + CRepository* repository = + CRepository::NewL( KCRUidMuiuMessagingConfiguration ); + TInt configuration = 0; + if ( !repository->Get( KMuiuSendUiConfiguration, configuration ) ) + { + configuration = configuration & KMuiuEmailDisabledInMultimedia; + } + delete repository; + + if ( configuration ) + { + servicesToDim->AppendL( KSenduiMtmSmtpUid ); // normal email + servicesToDim->AppendL( KSenduiMtmSyncMLEmailUid ); // sync email + } + + return servicesToDim; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CallFunctionByIdL +// +// --------------------------------------------------------------------------- +// +/* +IMPLEMENTATION NOTE: +This method needs refactoring with CVRMemo and CVRMdaRecorder. +Probably most of the logic should be transferred to CVRMemo. +*/ +TBool CVRRecViewModel::CallFunctionByIdL( TInt aFunctionId ) + { + switch ( aFunctionId ) + { + case EFunctionPlay: + { + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) || iRecorderUtility == NULL || !iRecorderUtility->IsAttachedToMemo()) + { + return EFalse; + } + + iIgnoreNextIhfChange = EFalse; + SetRecorderVolume(); + SetIHFIfCallNotActive( iIhfState ); + TInt mediaservErr( KErrNone ); + + // Don't accept CBA commands + iCBAEnabled = EFalse; + // Update CBAs + iDecoratorObserver->Update( EVRUpdateCBA ); + TRAPD( leaveErr, mediaservErr = iRecorder->PlayL() ); + + // Accept CBAs again. CBAs are updated when state is changed + iCBAEnabled = ETrue; + + if ( leaveErr == KErrNotReady ) + { + ShowNoteL( R_VR_CORRUPT_INFONOTE_LABEL, EAknGlobalErrorNote ); + return EFalse; + } + + if ( mediaservErr != KErrNone ) + { + // cancel the state change + // the error note is shown in CVRMdaRecorder + return EFalse; + } + User::LeaveIfError( leaveErr ); + break; + } + case EFunctionStop: + { + // Turn off the IHF after playing + SetIHFIfCallNotActive( EFalse ); + iRecorder->Stop(); + CheckIhfState(); + break; + } + case EFunctionStopWithNote: + { + // No need to do anything to IHF here since this is + // called after recording (IHF is not used) + iRecorder->Stop(); + ShowNoteL( R_VR_STOP_INFONOTE_LABEL, EAknGlobalInformationNote ); + break; + } + case EFunctionStopAndSave: + { + // No need to do anything to IHF here since this is + // called after recording (IHF is not used) + StopAndSaveL( 0 ); + break; + } + case EFunctionAutoStopAndSave: + { + // No need to do anything to IHF here since this is + // called after recording (IHF is not used) + StopAndSaveL( R_VR_STOP_INFONOTE_LABEL ); + break; + } + case EFunctionSilentStopAndSave: + { + // No need to do anything to IHF here since this is + // called after recording (IHF is not used) + StopAndSaveL( 0 ); + break; + } + + case EFunctionAutoStop: + { + // Turn off the IHF after playing + SetIHFIfCallNotActive( EFalse ); + iRecorder->Stop(); + CheckIhfState(); + break; + } + case EFunctionSaveBeforeExit: + { + StopAndCloseL( R_VR_STOP_SAVE_WAITNOTE_LABEL ); + break; + } + case EFunctionRecord: + { + CVRMdaRecorder* iRecorderUtility = NULL; + if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) ) + { + return EFalse; + } + + //if ( iRecorder->RecordL() != KErrNone ) + // { + // return EFalse; + // } + + if(iCurrentCallHandler->StateL(KPSUidCtsyCallInformation,KCTsyCallState )==EPSCTsyCallStateConnected) + { + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + iRecorderUtility->SetAudioInputL(CAudioInput::EVoiceCall); + iRecorderUtility->ConfigSampleRateOfVoiceCallL(); + } + } + //Audioinput can't be changed after Record + if ( iRecorder->RecordL() != KErrNone ) + { + return EFalse; + } + break; + } + case EFunctionPause: + { + + iRecorder->Pause(); + // Turn off the IHF after playing + SetIHFIfCallNotActive( EFalse ); + break; + } + case EFunctionForward: + { + TInt result = iRecorder->ForwardL(); + + // The volume setting is lost when the media server client object + // is stopped. + SetRecorderVolume(); + + if ( result ) + { + return EFalse; + } + break; + } + case EFunctionRewind: + { + iRecorder->RewindL(); + if ( iButtonPanelObserver ) + { + iButtonPanelObserver->Update(); + } + + // The volume setting is lost when the media server client object + // is stopped + SetRecorderVolume(); + break; + } + case EFunctionRecordNew: + { + CVRMdaRecorder* iRecorderUtility = NULL; + if ( VRUtils::UnsupportedCallTypeOngoing( ETrue ) ) + { + return EFalse; + } + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility == NULL) + { + return EFalse; + } + iRecorderUtility->SetInRecordingFlag(ETrue); + + iCanHandleCommands = EFalse; + // Don't accept CBA commands + iCBAEnabled = EFalse; + // Update CBAs + iDecoratorObserver->Update( EVRUpdateCBA ); + + iRecorder->DetachMemo(); + + TRAPD( leaveErr1, SetMemoNameNewL( + iContext == EContextRecordNewForRemote ) ); + + // Can't attach if memo name couldn't be generated + TInt leaveErr2( KErrNone ); + if( !leaveErr1 ) + { + TRAP( leaveErr2, iRecorder->AttachToMemoL( iMemo ) ); + } + + TBool ifAttach = iRecorderUtility->IsAttachedToMemo(); + + if ( leaveErr1 || leaveErr2 || !ifAttach) + { + iCanHandleCommands = ETrue; + iCBAEnabled = ETrue; + if ( leaveErr1 == KErrDiskFull || leaveErr2 == KErrDiskFull ) + { + if ( iMemo->StorageDrive() == VRUtils::GetRemovableMassStorageL()) + { + VRUtils::ShowMemoryFullConfirmationQuery(ETrue); + } + else + { + VRUtils::ShowMemoryFullConfirmationQuery(); + } + } + } + + User::LeaveIfError( leaveErr1 ); + User::LeaveIfError( leaveErr2 ); + if(!ifAttach) + { + User::Leave(KErrNotReady); + } + + // Indicates that a new memo is attached but not yet recording + // started -> handle can be reused and memo can be deleted in exit + iMemo->SetRecorded( EFalse ); + + TInt recError( KErrNone ); + + //TRAPD( recLeaveErr, recError = iRecorder->RecordL() ); + if(iCurrentCallHandler->StateL(KPSUidCtsyCallInformation,KCTsyCallState )==EPSCTsyCallStateConnected) + { + iRecorderUtility->SetAudioInputL(CAudioInput::EVoiceCall); + iRecorderUtility->ConfigSampleRateOfVoiceCallL(); + } + //Change for CS call:Audio input can't be changed after Record + TRAPD( recLeaveErr, recError = iRecorder->RecordL() ); + + if (GetInRecordingFlag()) + { + iRecorderUtility->SetInRecordingFlag(EFalse); + } + + if ( recError != KErrNone || recLeaveErr ) + { + iCanHandleCommands = ETrue; + iCBAEnabled = ETrue; + if ( recLeaveErr ) + { + User::LeaveIfError( recLeaveErr ); + } + else + { + return EFalse; + } + } + + + iCanHandleCommands = ETrue; + // Accept CBAs again. CBAs are updated when state is changed + iCBAEnabled = ETrue; + break; + } + case EFunctionDelete: + { + iRecorder->DetachMemo(); + // Detaching resets the clip position so button panel + // needs to be updated + iButtonPanelObserver->Update( EVRUpdatePositionChange ); + if ( !iMemo->QueryAndDeleteL() ) + { + iRecorder->AttachToMemoL( iMemo ); + return EFalse; + } + break; + } + case EFunctionRename: + { + iRecorder->DetachMemo(); + // Detaching resets the clip position so button panel + // needs to be updated + iButtonPanelObserver->Update( EVRUpdatePositionChange ); + if ( iMemo->QueryAndRenameL() ) + { + if ( iStateInfoObserver ) + { + iStateInfoObserver->Update(); + } + } + iRecorder->AttachToMemoL( iMemo ); + break; + } + case EFunctionOk: + { + + HBufC* label = StringLoader::LoadLC( R_VR_SAVE_WAITNOTE_LABEL ); + + iRecorder->DetachMemo(); + iIsNoteLaunched = ETrue; + iMemo->SavePermanentlyL( iGlobalNote, iNoteId, *label ); + + CEikonEnv::Static()->EikAppUi()->HandleCommandL( + ECmdEmbeddedRecordingReady ); + + iGlobalNote->CancelNoteL( iNoteId ); + iIsNoteLaunched = EFalse; +#ifdef _DEBUG + RDebug::Print( _L( + "VoiceRecorder: CVRRecViewModel Note cancelled" ) ); +#endif + CleanupStack::PopAndDestroy( label ); + + HandleCommandL( EEikCmdExit ); + break; + } + case EFunctionCancel: + { + iRecorder->DetachMemo(); + iMemo->DeleteL(); + HandleCommandL( EEikCmdExit ); + break; + } + case EFunctionNop: + { + // dummy command, do nothing + break; + } + case EFunctionNRTStop: + { + // Turn off the IHF after playing + SetIHFIfCallNotActive( EFalse ); + + iRecorder->Stop(); + CheckIhfState(); + break; + } + case EFunctionNRTAutoStop: + { + // Turn off the IHF after playing + SetIHFIfCallNotActive( EFalse ); + CheckIhfState(); + break; + } + case EFunctionSetNewPosition: + { + TInt newValue( 0 ); + if ( iStateInfoPanelObserver ) + { + newValue = iStateInfoPanelObserver->ProgressBarPosition(); + } + + iRecorder->SetPositionL( newValue ); + + //Inform button Panel + if ( iButtonPanelObserver ) + { + iButtonPanelObserver->Update( EVRUpdateStateChange ); + } + break; + } + default: + { + User::Panic( KVRPanic, EPanicFunctionUnknown ); + break; + } + } + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::StopAndSaveL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::StopAndSaveL( TInt aResourceId ) + { + HBufC* label = NULL; + + // Don't show the note if aResourceId was not defined + if ( aResourceId ) + { + label = StringLoader::LoadLC( aResourceId ); + } + + iRecorder->DetachMemo(); + + if ( label ) + { + iIsNoteLaunched = ETrue; + if(iMemo) + { + iMemo->SavePermanentlyL( iGlobalNote, iNoteId, *label ); + } + + // There is no more note showing in SavePermanentlyL() -function + // the note is shown here + ShowNoteL( aResourceId, EAknGlobalInformationNote ); + } + else + { + iIsNoteLaunched = ETrue; + if(iMemo) + { + iMemo->SavePermanentlyL( iGlobalNote, iNoteId, KNullDesC ); + } + } + + TRAP_IGNORE(iRecorder->AttachToMemoL( iMemo )); + + iGlobalNote->CancelNoteL( iNoteId ); + iIsNoteLaunched = EFalse; + + if ( aResourceId ) + { + CleanupStack::PopAndDestroy( label ); + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::StopAndCloseL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::StopAndCloseL( TInt aResourceId ) + { + HBufC* label = NULL; + + // Don't show the note if aResourceId was not defined + if ( aResourceId ) + { + label = StringLoader::LoadLC( aResourceId ); + } + + iRecorder->DetachMemo(); + + if ( label ) + { + iIsNoteLaunched = ETrue; + if(iMemo) + { + iMemo->SavePermanentlyL( iGlobalNote, iNoteId, *label ); + } + } + else + { + iIsNoteLaunched = ETrue; + if(iMemo) + { + iMemo->SavePermanentlyL( iGlobalNote, iNoteId, KNullDesC ); + } + } + + iGlobalNote->CancelNoteL( iNoteId ); + iIsNoteLaunched = EFalse; + + if ( aResourceId ) + { + CleanupStack::PopAndDestroy( label ); + } + } + +void CVRRecViewModel::ShowNoteL( TInt aResourceId, + TAknGlobalNoteType aNoteType ) + { + HBufC* label = StringLoader::LoadLC( aResourceId ); + iGlobalNote->ShowNoteL( aNoteType, *label ); + CleanupStack::PopAndDestroy( label ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetVolumeControlState +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::GetVolumeControlState( TVRVolumeControlState& aState, + TInt& aVolume ) + { + // ignored + TRAP_IGNORE( ReadDefaultSpeakerL() ); + if ( iState->iHasVolumeControl ) + { + if ( iIhfState ) + { + aState = EIhf; + + } + else + { + aState = EEarPiece; + } + aVolume = iIhfVolume; + } + else + { + aState = EDisabled; + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::LoadVolumeSettingsL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::LoadVolumeSettingsL() + { + iIhfVolume = VRUtils::DefaultVolumeL( ESpeakerIhf ); + // Prevent using incorrect values + if ( iIhfVolume < KVRVolumeControlMin || + iIhfVolume > KVRVolumeControlMax ) + { + iIhfVolume = KVRDefaultVolume; + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SaveVolumeSettings +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SaveVolumeSettings() + { + // Ignore all errors, because this will be called in destructor. It isn't + // disastrous if new values aren't saved, the previous values will be there + TRAP_IGNORE( VRUtils::SetDefaultVolumeL( ESpeakerIhf, iIhfVolume ); ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::HandleSystemEventL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::HandleSystemEventL() + { + // Fetch the changed value from Pubsub + TInt currentState( iCurrentCallHandler->StateL(KPSUidCtsyCallInformation, KCTsyCallState ) ); + + if ( !iActive ) + { + iPreviousCallState = currentState; + return; + } + + + // Actions to take when playing + if ( iState->iId == EStatePlaying ) + { + switch ( currentState ) + { + case EPSCTsyCallStateAlerting: + case EPSCTsyCallStateRinging: + case EPSCTsyCallStateAnswering: + { + HandleCommandL( ECmdAutoStopAtEnd ); + break; + } + default: + { + break; + } + } + } + + // Actions to take when recording + if ( iState->iId == EStateRecording ) + { + switch ( currentState ) + { + case EPSCTsyCallStateAlerting: + case EPSCTsyCallStateRinging: + case EPSCTsyCallStateAnswering: + case EPSCTsyCallStateDisconnecting: + { + HandleCommandL( ECmdAutoStopAtEnd ); + break; + } + case EPSCTsyCallStateNone: + { + if( iPreviousCallState == EPSCTsyCallStateConnected ) + { + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + iRecorderUtility->SetAudioInputL(CAudioInput::EDefaultMic); + } + HandleCommandL( ECmdAutoStopAtEnd ); + } + break; + } + default: + { + break; + } + } + } + + if ( iState->iId == EStateIdle && + currentState == EPSCTsyCallStateNone ) + { + iIhfState = ETrue; + } + + /* ------------------------- + * Disable in-call recording + * ------------------------- + */ + if ( iVRAllowInCallRecording != KAllowInCallRecording ) + { + if (( iState->iId == EStateIdle || iState->iId == EStateDeleted ) && + currentState == EPSCTsyCallStateAnswering) + { + // Disable record button + ChangeState( EStateDisableButtons, ETrue ); + } + if (( iState->iId == EStateDisableButtons ) && + ((currentState == EPSCTsyCallStateDisconnecting)|| (currentState == EPSCTsyCallStateNone))) + { + if (iContext != EContextRecordNewForRemote) + { + // Enable record button + ChangeState( EStateDeleted, ETrue ); + } + else + { + if (!(iMemo->Duration() > TTimeIntervalMicroSeconds(0))) + { + ChangeState( EStateRecordEmbedded, ETrue ); + } + else + { + ChangeState( EStateIdleRecordEmbedded, ETrue ); + } + } + } + } + + iPreviousCallState = currentState; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetIHFIfCallNotActive +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetIHFIfCallNotActive( TBool aIhf ) + { + if ( FeatureManager::FeatureSupported( + KFeatureIdApplicationControllableAudioRouting ) ) + { + TInt currentState( EPSCTsyCallStateNone ); + // Ignore the error, ihf is not set + TRAP_IGNORE( currentState = iCurrentCallHandler->StateL( + KPSUidCtsyCallInformation, KCTsyCallState ) ); + + if ( currentState == EPSCTsyCallStateNone ) + { + if ( iRecorder->SetIhf( aIhf ) == KErrNone ) + { + // So that the model knows that the next notify from shared + // data client is not a voice key activated IHF change. + iIgnoreNextIhfChange = ETrue; + } + } + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CheckIhfState +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::CheckIhfState() + { + if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) && + FeatureManager::FeatureSupported( + KFeatureIdApplicationControllableAudioRouting ) ) + { + if ( iDefaultSpeaker == ESpeakerIhf ) + { + iIhfState = ETrue; + } + else + { + iIhfState = EFalse; + } + } + else + { + // IHF is default on phones with voice key + iIhfState = ETrue; + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetRecorderVolume +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetRecorderVolume() + { + TInt activeVolume = iIhfVolume; + iRecorder->SetVolume( activeVolume, KVRMaxVolumeSteps ); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ActivateL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::ActivateL() + { + iActive = ETrue; + + if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) && + FeatureManager::FeatureSupported( + KFeatureIdApplicationControllableAudioRouting ) ) + { + // The user has visited another view and possibly altered the + // settings + ReadDefaultSpeakerL(); + } + + // If the in-call disable recording feature has been enabled, then check + // current status and enable/disable UI accordingly + if ( iVRAllowInCallRecording != KAllowInCallRecording ) + { + TInt currentState( iCurrentCallHandler->StateL( + KPSUidCtsyCallInformation, KCTsyCallState ) ); + if ( currentState != EPSCTsyCallStateNone ) + { + ChangeState (EStateDisableButtons, ETrue); + } + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::Deactivate +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::Deactivate() + { + iActive = EFalse; + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::ReadDefaultSpeakerL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::ReadDefaultSpeakerL() + { + iDefaultSpeaker = VRUtils::DefaultSpeakerL(); + + if ( iDefaultSpeaker == ESpeakerIhf ) + { + iIhfState = ETrue; + } + else + { + iIhfState = EFalse; + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::TVRLabelLayoutLink::ReadFromResource +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::TVRLabelLayoutLink::ReadFromResource + ( TResourceReader& aReader ) + { + iEuroId = aReader.ReadUint32(); + iApacId = aReader.ReadUint32(); + iArabicHebrewId = aReader.ReadUint32(); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::CanSetVolume +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::CanSetVolume() + { + return ETrue; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::HandleUpdateErrorL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::HandleUpdateErrorL( TInt aErr ) + { + // Show error note. + if ( aErr == KErrDiskFull ) + { + +#ifndef RD_MULTIPLE_DRIVE + if ( VRUtils::MemoStoreL() == EMemoStorePhoneMemory ) + { + ShowNoteL( R_VR_MEMORY_WARNING, EAknGlobalWarningNote ); + } + else + { + ShowNoteL( R_VR_MEMORY_MMC_WARNING, EAknGlobalWarningNote ); + } + +//multiple drive +#else + TInt memoDrive = VRUtils::MemoDriveL(); + TUint status( 0 ); + VRUtils::GetDriveInfo( memoDrive, status ); + + if ( status & DriveInfo::EDriveInternal ) + { + ShowNoteL( R_VR_MEMORY_WARNING, EAknGlobalWarningNote ); + } + else + { + ShowNoteL( R_VR_MEMORY_MMC_WARNING, EAknGlobalWarningNote ); + } +#endif + + + } + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::MemoFileHandle +// +// --------------------------------------------------------------------------- +// +RFile& CVRRecViewModel::MemoFileHandle() + { + return iMemo->File(); + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetFileHandle +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetFileHandle( RFile& aFile ) + { + // Use app startup type as embbedding flag + iMemo->SetFileHandle( aFile, CEikonEnv::Static()->StartedAsServerApp() ); + if ( iRecorder ) + { + // First detach if already attached + iRecorder->DetachMemo(); + // The media server error will rise again somewhere where it's + // easier to handle if needed + TRAP_IGNORE( iRecorder->AttachToMemoL( iMemo ) ); + } + + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::FormatTimeL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::FormatTimeL( const TTime& aTime, TDes& aString ) const + { + + // Show longer format if duration more than 1 hour + if ( aTime.DateTime().Hour() >= 1 ) + { + aTime.FormatL( aString, + iTimeDuratLong ); + } + else + { + aTime.FormatL( aString, + iTimeDuratMinSecWithZero ); + } + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::EnableVolumeControl +// Enables/Disables the navi pane Volume Control drawing in the VR current +// visual state +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::EnableVolumeControl( TBool aVolumeControl ) + { + iState->iHasVolumeControl = aVolumeControl; + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::HasVolumeControl +// Returns ETrue if volume setting is enabled in this VoiceRecorder state. +// Otherwise returns EFalse +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::HasVolumeControl() const + { + if( iState->iHasVolumeControl ) + { + return ETrue; + } + return EFalse; + } + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::IncomingCall +// Returns ETrue if a phone call is coming. +// Otherwise returns EFalse +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::IncomingCall() const + { +#ifdef _DEBUG + RDebug::Print( _L("CVRRecViewModel::IncomingCall enter") ); +#endif + + // Fetch the current value from Pubsub + TInt currentState = 0; + TRAP_IGNORE(currentState = iCurrentCallHandler->StateL( KPSUidCtsyCallInformation, KCTsyCallState )); + + if (currentState == EPSCTsyCallStateAlerting || + currentState == EPSCTsyCallStateRinging || + currentState == EPSCTsyCallStateAnswering ) + { + return ETrue; + } + else + { + return EFalse; + } + } + + +// --------------------------------------------------------------------------- +//Returns the active quality setting. +//return Quality setting of the active memo +// --------------------------------------------------------------------------- +TVRQuality CVRRecViewModel::Quality() const + { + return iMemo->Quality(); + } + + +// --------------------------------------------------------- +// GetInRecordingFlag +// +// --------------------------------------------------------- +// +TBool CVRRecViewModel::GetInRecordingFlag() + { + if(iRecorder) + { + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + return iRecorderUtility->GetInRecordingFlag(); + } + return EFalse; + } + else + { + return EFalse; + } + + } + + +// --------------------------------------------------------- +// GetIfStopCalled +// +// --------------------------------------------------------- +// +TBool CVRRecViewModel::GetIfStopCalled() + { + if(iRecorder) + { + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + return iRecorderUtility->GetIfStopCalled(); + } + return EFalse; + } + else + { + return EFalse; + } + + } + + +// --------------------------------------------------------- +// SetInRecordingFlag +// --------------------------------------------------------- +// +void CVRRecViewModel::SetInRecordingFlag(TBool aFlag) + { + if(iRecorder) + { + CVRMdaRecorder* iRecorderUtility = NULL; + iRecorderUtility = dynamic_cast(iRecorder); + if(iRecorderUtility != NULL) + { + return iRecorderUtility->SetInRecordingFlag(aFlag); + } + } + } + + + + +// --------------------------------------------------------------------------- +// CVRRecViewModel::HandleMMCEjectEventL +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::HandleMMCEjectEventL() + { + + // Actions to take when recording + TInt storageDrive = VRUtils::MemoDriveL(); + if ( ( ( storageDrive == VRUtils::GetRemovableMassStorageL()) || + ( iMemo != NULL && iMemo->StorageDrive() == VRUtils::GetRemovableMassStorageL() ) ) && + ( !CVRUSBStateHanlder::IsUsbActive() ) ) + { + //exit for mmc dismount + SendExitEvent(); + } + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SendExitEvent +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SendExitEvent() + { + TWsEvent event; + event.SetType( EAknSoftkeyExit ); + event.SetTimeNow(); + event.SetHandle( CCoeEnv::Static()->WsSession().WsHandle() ); + CCoeEnv::Static()->WsSession().SendEventToWindowGroup( CEikonEnv::Static()->RootWin().Identifier(), event ); + return; + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::SetIsDriveReady +// +// --------------------------------------------------------------------------- +// +void CVRRecViewModel::SetIsDriveReady(TBool aIsDriveReady) + { + iIsDriveReady = aIsDriveReady; + } + +// --------------------------------------------------------------------------- +// CVRRecViewModel::GetIsDriveReady +// +// --------------------------------------------------------------------------- +// +TBool CVRRecViewModel::GetIsDriveReady() + { + return iIsDriveReady; + } + + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRecViewModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRecViewModel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,761 @@ +/* +* Copyright (c) 2002 - 2006 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 class is the data model and state machine of the Recorder View. +* The state machine is defined by a VR_STATEMACHINE resource structure. +* +*/ + + +#ifndef __CVRRECVIEWMODEL_H__ +#define __CVRRECVIEWMODEL_H__ + +// INCLUDES +#include +#include +#include +#include +#include + +#include "MVRIHFObserver.h" +#include "MVRKeyObserver.h" +#include "MVRDecoratorModel.h" +#include "MVRButtonPanelModel.h" +#include "MVRStateInfoModel.h" +#include "MVRObserver.h" +#include "MVRSelectionProvider.h" +#include "MVRVolumeChangeObserver.h" + +#include "MVRSystemEventObserver.h" +#include "MVRMediaRemovalObserver.h" + + +#include "TVRContext.h" +#include "voicerecorder.hrh" + +#include "MVRStateInfoObserver.h" + +// FORWARD DECLARATIONS +class CAknGlobalNote; +class CSendUi; +class MVRMdaRecorder; +class CVRMemo; +class MVRObserver; +class TResourceReader; +class TVRState; +class CVRSystemEventHandler; +class CVRMediaRemovalMonitor; + + +// CLASS DEFINITION +/** +* This class is the data model and state machine of the Recorder View. +* The state machine is defined by a VR_STATEMACHINE resource structure. +*/ +NONSHARABLE_CLASS( CVRRecViewModel ): + public CBase, + public MVRDecoratorModel, public MVRButtonPanelModel, + public MVRStateInfoModel, public MVRObserver, + public MVRKeyObserver, public MVRVolumeChangeObserver, + public MVRSystemEventObserver, + public MVRMediaRemovalObserver + { + private: // nested classes + + class TVRLabelLayoutLink + { + public: + /** + * Constructs this object from a VR_LABEL_LINK resource + * @param aReader A resource reader object initialised + * to a resource. + */ + void ReadFromResource( TResourceReader& aReader ); + public: + + // Link to the latin layout + TInt iEuroId; + + // Link to the APAC layout + TInt iApacId; + + // Link to the A/H layout + TInt iArabicHebrewId; + }; + + public: // Constructors and destructor + + /** + * Default constructor. + */ + CVRRecViewModel(); + + /** + * Destructor + */ + ~CVRRecViewModel(); + + /** + * Constructs the model from a VR_STATEMACHINE resource. + * @param aReader A resource reader object initialised to a resource. + */ + void ConstructFromResourceL( TResourceReader& aReader ); + + public: // from MVRKeyObserver + + /** + * This function is called when a subject wants to report a key event. + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown + * @return Indicates whether or not the key event was used. + */ + TBool ProcessKeyEventL( const TKeyEvent& aKeyEvent, + const TEventCode aType ); + + public: // from MVRDecoratorModel + + /** + * Returns the resource id for current softkeys + * @return Softkey resource identifier + */ + TInt CbaResourceId() const; + + /** + * Returns the resource id for current menu bar + * @return Menu bar resource identifier. + */ + TInt MenuBarResourceId() const; + + /** + * Used to get the state of the volume control component. + */ + void GetVolumeControlState( TVRVolumeControlState& aState, + TInt& aVolume ); + + /** + * Specifies the current help context. + * @param aContext the context IDs are placed here + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + + + /** + * Registers an observer for receiving + * update notifications from this interface. + * @param aObserver The observer object. + */ + void SetDecoratorObserver( MVRObserver* aObserver ); + + /** + * Tells in return value if CBA Buttons should be enabled or not + * @return ETrue if buttons should be enabled, EFalse otherwise + */ + TBool CBAEnabled() const; + + public: // from MVRButtonPanelModel + + /** + * Returns the number of buttons. + * @return number of buttons (>=0) + */ + TInt ButtonCount() const; + + /** + * Returns the state of a specific button. + * @param aButtonId Button identifier + * @return ENormal or EDimmed + */ + TInt ButtonState( TInt aButtonId ) const; + + /** + * Returns the command id of a specific button. + * @param aButtonId Button identifier + * @return One of TVRCommands + */ + TInt CommandId( TInt aButtonId ) const; + + /** + * Returns the id of the button that should have initial focus. + * @return Button identifier + */ + TInt InitialFocusButtonId() const; + + /** + * Registers an observer for receiving + * update notifications from this interface. + * @param aObserver The observer object. + */ + void SetButtonPanelObserver( MVRObserver* aObserver ); + + /** + * Checks if button panel model needs to reset the focus + * for example after a state change + * @return Is reset needed + */ + TBool ResetNeeded(); + + /** + * Returns an ID of the current visual state. + * @returns Visual state Id. + */ + TUint VisualStateId() const; + + /** + * Checks if there is a call incoming at the moment + * @return ETrue if call incoming, EFalse otherwise + */ + TBool IncomingCall() const; + + /** + * Checks if model is in a state where it can take and handle + * new commands + * @return Can model handle new commands + */ + TBool CanHandleCommands() const; + + public: // from MVRStateInfoModel + + /** + * Returns the length of the current memo + * @return The duration in microseconds. + */ + TTimeIntervalMicroSeconds Duration() const; + + /** + * Returns the playing or recording position of the current memo. + * @return The position in microseconds. + */ + TTimeIntervalMicroSeconds Position() const; + + /** + * Returns the text content for a label. + * @param aName Returned text is placed in this descriptor + * @param aLabelIndex Label identifier (>=0) + */ + void GetLabel( TDes& aName, TInt aLabelIndex ) const; + + /** + * Returns the resource id for a label. + * @param aLabelIndex Label identifier (>=0) + * @return The resource id for the specified label + */ + TInt ResourceIdForLabel( TInt aLabelIndex, TAknLayoutId aLayout ) const; + + /** + * Registers an observer for receiving + * update notifications from this interface. + * @param aObserver The observer object. + */ + void SetStateInfoObserver( MVRObserver* aObserver ); + + /** + * Determines if model has a progress bar + * @return ETrue, if model has a progress bar, otherwise EFalse + */ + TBool HasProgressBar() const; + + /** + * Determines if model has a volume control in this state + * @return ETrue, if model has a volume control, otherwise EFalse + */ + TBool HasVolumeControl() const; + + /** + * Registers an observer to communicate about the changes in InfoPanel. + * @param aObserver The observer object. + */ + void SetStateInfoPanelObserver( MVRStateInfoObserver* aObserver ); + + public: // from MVRObserver + + /** + * Called to notify a change in the observed subject's state. + */ + void Update( TVRUpdateCommand aCommand ); + + public: // from MVRSelectionProvider + + /** + * Returns the current memo name in an array + * Ownership is transferred. Caller must destroy the returned array. + * @return The array containing 0 or 1 names. + */ + MDesCArray* GetSelectedFilesLC() const; + + public: // from MVRVolumeChangeObserver + + /** + * Called to notify a change in volume settings. + * @param aStep Volume level in steps + * @param aMaxSteps How many steps there are (10 usually). + */ + void SetVolume( TInt aStep, TInt aMaxSteps ); + + /*** + * Indicates if volume can be set, because rinto tone + * volume change has no effect if the tone is playing. + */ + TBool CanSetVolume(); + + public: // CVRSystemEventObserver + + void HandleSystemEventL(); + + void HandleMMCEjectEventL(); + + public: // new methods + + /** + * Handles a option menu / command button / softkey command. + * @param aCommandId Command identifier, one of TVRCommands + */ + void HandleCommandL( TInt aCommandId ); + + /** + * Returns iInRecording flag + * @return True or False + */ + TBool GetInRecordingFlag(); + + /** + * set iInRecording flag + * + */ + void SetInRecordingFlag(TBool); + + + /** + * Check if stop has been called before + * @return True or False + */ + TBool GetIfStopCalled(); + + + /** + * Enters a new state machine context. + * Executes the initial state transition defined by the context. + * @param aContext Identifies the new context. + */ + void EnterContextL( const TVRRecViewContexts& aContext ); + + /** + * Leaves the current state machine context. + */ + void LeaveContext(); + + /** + * Sets the memo name. Forwards the call to CVRMemo. + * @param aFilename The new file name + */ + void SetMemoName( const TDesC& aFilename ); + + /** + * Sets the memo name to a new, unique, one. + * Forwards the call to CVRMemo. + */ + void SetMemoNameNewL( TBool aEmbedded = EFalse ); + + /** + * Sets the path to directory where memos will be saved. + * Forwards the call to CVRMemo. + */ + void SetSavingLocationL( const TDesC& aPath ); + + /** + * Returns the complete file name (path and everything). + * @return Reference to the memo name. + */ + const TDesC& Filename() const; + + /** + * Returns embedding status. + * @param ETrue if the current context is an embedded one. + */ + TBool IsEmbedded() const; + + /** + * Indicates if we are in a state that can accept + * more commands (i.e. all async calls have completed). + * @return ETrue if it's ok to proceed calling methods. + */ + TBool CanAcceptCommands() const; + + /** + * Sends the current memo via MMS/Infra/Bluetooth/Email + * @param aSendUi The CSendUi object used for sending + */ + void SendViaL( CSendUi* aSendUi ); + + /** + * Activates the recorder view model + */ + void ActivateL(); + + /** + * Deactivates the recorder view model + */ + void Deactivate(); + + /** + * Sets the file handle to record into + */ + void SetFileHandle( RFile& aFile ); + + /** + * Returns the active file handle of CVRMemo object + */ + RFile& MemoFileHandle(); + + /** + * Enables or disables the Volume Control drawing in current + * visual state + * @param aVolumeControl ETrue if Volume Control should be enabled + * EFalse if disabled + */ + void EnableVolumeControl( TBool aVolumeControl ); + + /** + * Returns the active quality setting. + * @return Quality setting of the active memo + */ + TVRQuality Quality() const; + + /** + * Send exit event to UI + */ + void SendExitEvent(); + + /** + * Set the value of iIsDriveReady. + * @param The new value of iIsDriveReady. + */ + void SetIsDriveReady(TBool aIsDriveReady); + + /** + * Get the value of iIsDriveReady. + * @return The value of iIsDriveReady. + */ + TBool GetIsDriveReady(); + + private: // new methods + + /** + * Enters a new state. + * Executes a function identified by the state transition. + * Notifies all registered observers. + * @param aNewState identifies the new state. + * @param aForce force change state (even if new is same as old) + */ + void ChangeState( TUint aNewState, TBool aForced = EFalse ); + + /** + * Retrieves transition information to the given transition object. + * @param aTransition Transition to be filled in. + * @param aCommandId The command that triggered this transition. + */ + void GetTransition( TVRContext::TTransition& aTransition, + TUint aCommandId ) const; + + /** + * Retrieves transition information to the given transition object. + * This is used the retrieve the initial transition of a state. + * @param aTransition Transition to be filled in. + */ + void GetTransition( TVRContext::TTransition& aTransition ) const; + + /** + * Calls the specified function. + * @param aFunctionId Function identifier (TVRFunctions) + * @return EFalse if the function want's to cancel the state change + */ + TBool CallFunctionByIdL( TInt aFunctionId ); + + /** + * Returns the text content for a label. + * This is a leaving variant of GetLabel(). It is called by + * GetLabel() inside a TRAP. + * @param aName Returned text is placed in this descriptor + * @param aLabelIndex Label identifier (>=0) + */ + void GetLabelL( TDes& aName, TInt aLabelIndex ) const; + + /** + * Stops recording and saves the memo. + * The specified note text is displayed while saving. + * @param aResourceId Identifies the note text. + */ + void StopAndSaveL( TInt aResourceId ); + + /** + * Stops recording and saves the memo. + * The specified note text is displayed while saving. + * Leaves the memo detached so that application can be closed. + * @param aResourceId Identifies the note text. + */ + void StopAndCloseL( TInt aResourceId ); + + /** + * Shows a global note. + * @param aResourceId Identifies the note text. + * @param aNoteType Identifies the note type. + */ + void ShowNoteL( TInt aResourceId, TAknGlobalNoteType aNoteType ); + + /** + * Loads the volume settings (IHF & ear piece) from VoiceRecorder.ini + */ + void LoadVolumeSettingsL(); + + /** + * Saves the volume settings (IHF & ear piece) to VoiceRecorder.ini + * Note: This method is non-leaving and ignores all errors, because + * it's called inside the destructor. LoadVolumeSettingsL() has + * sanity checking so the situation isn't fatal if the saving fails. + */ + void SaveVolumeSettings(); + + /** + * Sets IHF on/off, if the phone is not in voice on alerting state + * @param aIhf ETrue == set IHF on, EFalse == set IHF off + */ + void SetIHFIfCallNotActive( TBool aIhf ); + + /* + * Checks if the current default speaker is loudspeaker or earpiece + */ + void CheckIhfState(); + + /** + * Sets the volume on the media server client object according + * to the current active IHF setting. + */ + void SetRecorderVolume(); + + /** + * Reads the default speaker setting and sets iIhfState accordingly + */ + void ReadDefaultSpeakerL(); + + /* + * Handles error in Update method. + * @param aErr Id of the error + */ + void HandleUpdateErrorL( TInt aErr ); + + /* + * Formats time to R_QTN_TIME_DURAT_LONG or + * R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO depending of time value + * @param aTime Time that is formatted + * @param aString Buffer that holds the formatted time + */ + void FormatTimeL( const TTime& aTime, TDes& aString ) const; + + /* + * Generates an array of services that should be dimmed from the + * options menu "Send" selection list + * @return A pointer to an array that consists of the service Uids + * that should be dimmed + */ + CArrayFixFlat* SendViaServicesToDimLC(); + + private: // data + + /** + * The state machine structure. + */ + TVRContext iContexts[ ENumContexts ]; + + /** + * The current context. + */ + TVRRecViewContexts iContext; + + /** + * Pointer to the current state. Contained in iContexts. + */ + TVRState* iState; + + /** + * Pointer to the voice memo object. Owned + */ + CVRMemo* iMemo; + + /** + * Pointer to the recorder object. Owned + */ + MVRMdaRecorder* iRecorder; + + /** + * Pointer to a global information note object. Owned + */ + CAknGlobalNote* iGlobalNote; + + /** + * Pointer to an array of UI states. Owned + */ + CArrayFixSeg< TVRState > iStateArray; + + /** + * Pointer to an array of label sets. Owned. + */ + CArrayPtrSeg< CDesCArray > iLabelSets; + + /** + * Pointer to an array of label resource ids. Owned. + */ + TVRLabelLayoutLink* iLabelLayoutLinks; + + /** + * Pointer to the button panel observer. Not owned. + */ + MVRObserver* iButtonPanelObserver; + + /** + * Pointer to the decorator observer. Not owned. + */ + MVRObserver* iDecoratorObserver; + + /** + * Pointer to the state info observer. Not owned. + */ + MVRObserver* iStateInfoObserver; + + /** + * Format string placeholder. + * R_QTN_DATE_USUAL_WITH_ZERO is loaded to it in construction. + */ + TBuf< VRLABELMAXLENGTH > iDateUsualWithZero; + + /** + * Format string placeholder. + * R_QTN_TIME_USUAL_WITH_ZERO is loaded to it in construction. + */ + TBuf< VRLABELMAXLENGTH > iTimeUsualWithZero; + + /** + * Format string placeholder. + * R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO is loaded to it in construction. + */ + TBuf< VRLABELMAXLENGTH > iTimeDuratMinSecWithZero; + + /** + * Format string placeholder. + * R_QTN_TIME_DURAT_LONG is loaded to it in construction. + */ + TBuf< VRLABELMAXLENGTH > iTimeDuratLong; + + /** + * ETrue if the model has succesfully entered a context. + */ + TBool iContextEntered; + + /** + * For listening call events. Owned. + */ + CVRSystemEventHandler* iCurrentCallHandler; + + CVRMediaRemovalMonitor* iCurrentMMCEjectHandler; + + + /** + * Current logical state (i.e. what the user sees, not the actual + * state of the HW) of the IHF + */ + TBool iIhfState; + + /** + * Prefered volume of the IHF + */ + TInt iIhfVolume; + + /** + * Used to tell the IHF change event listener, that the next IHF + * change is not made with voice key and is to be ignored + */ + TBool iIgnoreNextIhfChange; + + /** + * Indicates if the view is actually active, so that the model + * knows when to ignore IHF change events + */ + TBool iActive; + + /** + * Default speaker when playing + */ + TVRSpeaker iDefaultSpeaker; + + /** + * Indicates if End key is pressed so view deactivation can trigger + * right operation ( paused memo is saved as well ) + */ + TBool iIsEndKey; + + /* + * Id for canceling waitnote + */ + TInt iNoteId; + + /* + * + */ + TBool iIsNoteLaunched; + + /** + * Default audio format for recording audio clip + */ + TInt iVRAudioFormat; + + /** + * Allow In-call recording functionality + */ + TInt iVRAllowInCallRecording; + + + /** + * The call state retrieved on previous notification + */ + TInt iPreviousCallState; + + /** + * Should the button panel reset itself on update + */ + TBool iResetButtons; + + /** + * If model can handle commands. i.e. no critical command handling + * just ongoing, e.g. waiting start tone play before starting + * recording + */ + TBool iCanHandleCommands; + + /** + * Pointer to the state info panel observer. Not owned. + */ + MVRStateInfoObserver* iStateInfoPanelObserver; + + /** + * State of the CBA buttons. If EFalse LSK/RSK deliver ECmdNOP which + * causes no action. + */ + TBool iCBAEnabled; + + /** + * To judge whether the current drive is ready for recording + */ + TBool iIsDriveReady; + }; + +#endif // __CVRRECVIEWMODEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRemConObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRemConObserver.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,185 @@ +/* +* Copyright (c) 2002 - 2006 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: Class that observer remote controller framework events +* and forwards them as key events to observe +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +#include "MVRVolumeEventObserver.h" +#include "CVRRemConObserver.h" + + +// ============================ MEMBER FUNCTIONS ============================== + +// ---------------------------------------------------------------------------- +// CVRRemConObserver::CVRRemConObserver +// C++ default constructor can NOT contain any code, that +// might leave. +// ---------------------------------------------------------------------------- +// +CVRRemConObserver::CVRRemConObserver( MVRVolumeEventObserver* aObserver ) + : iObserver( aObserver ) + { + } + +// ---------------------------------------------------------------------------- +// CVRRemConObserver::ConstructL +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CVRRemConObserver::ConstructL() + { + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + + iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); + + iInterfaceSelector->OpenTargetL(); + + iVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityHigh ); + } + +// ---------------------------------------------------------------------------- +// CVRRemConObserver::NewL +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CVRRemConObserver* CVRRemConObserver::NewL( MVRVolumeEventObserver* aObserver ) + { + CVRRemConObserver* self = new( ELeave ) CVRRemConObserver( aObserver ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// ---------------------------------------------------------------------------- +// CVRRemConObserver::~CVRRemConObserver +// Destructor +// ---------------------------------------------------------------------------- +// +CVRRemConObserver::~CVRRemConObserver() + { + delete iInterfaceSelector; // it internally deletes iCoreTarget + + if( iVolumeRepeatTimer->IsActive() ) + { + iVolumeRepeatTimer->Cancel(); + } + delete iVolumeRepeatTimer; + } + + +// ---------------------------------------------------------------------------- +// CVRRemConObserver::MrccatoCommand +// +// ---------------------------------------------------------------------------- +// +EXPORT_C void CVRRemConObserver::MrccatoCommand( + TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) + { + TKeyEvent myEvent; + + if( iVolumeRepeatTimer->IsActive()) + { + iVolumeRepeatTimer->Cancel(); + } + + switch( aOperationId ) + { + case ERemConCoreApiVolumeUp: + { + // Simulate a "right button event" for CAknVolumeControl + myEvent.iCode = EKeyRightArrow; + break; + } + case ERemConCoreApiVolumeDown: + { + // Simulate a "left button event" for CAknVolumeControl + myEvent.iCode = EKeyLeftArrow; + break; + } + default: + { + // Ignore other commands + return; + } + } + + // Convert the remote control event to a button click and send it to + // volume control + switch( aButtonAct ) + { + case ERemConCoreApiButtonClick: + { + TRAP_IGNORE( iObserver->HandleVolumeChangeL( myEvent, + EEventKey ) ); + break; + } + case ERemConCoreApiButtonPress: + { + // Start repeat + iVolumeChange = myEvent; + iVolumeRepeatTimer->Cancel(); + iVolumeRepeatTimer->Start( + KAknStandardKeyboardRepeatRate, + KAknStandardKeyboardRepeatRate, + TCallBack( DoHandleVolumeRepeatL, this ) ); + break; + } + case ERemConCoreApiButtonRelease: + { + iVolumeChange.iCode = 0; + break; + } + default: + { + break; + } + } + + } + + +// ---------------------------------------------------------------------------- +// CVRRemConObserver::DoHandleVolumeRepeatL +// +// ---------------------------------------------------------------------------- +// +TInt CVRRemConObserver::DoHandleVolumeRepeatL( TAny* aAny ) + { + // Repeat last keypress + CVRRemConObserver* self = reinterpret_cast< CVRRemConObserver* >( aAny ); + if ( self->iObserver->HandleVolumeChangeL( self->iVolumeChange, EEventKey ) + != KErrNone ) + { + self->iVolumeChange.iCode = 0; + self->iVolumeRepeatTimer->Cancel(); + } + return KErrNone; + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRRemConObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRRemConObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2002-2006 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: Class that observer remote controller framework events +* and forwards them as key events to observe +* +*/ + + +#ifndef __CVRREMCONOBSERVER_H +#define __CVRREMCONOBSERVER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MVRVolumeEventObserver; +class CRemConInterfaceSelector; +class CRemConCoreApiTarget; + +// CLASS DECLARATION + +/** +* Class for monitoring side volume key events. +* Is also responsible for creating repeating keypresses if key is held down +* +*/ +NONSHARABLE_CLASS( CVRRemConObserver ) + : public CBase, public MRemConCoreApiTargetObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CVRRemConObserver* NewL( MVRVolumeEventObserver* aObserver ); + + /** + * Destructor. + */ + virtual ~CVRRemConObserver(); + + protected: // Functions from base classes + + /** + * @see MRemConCoreApiTargetObserver. + * + * A command has been received. + * @param aOperationId The operation ID of the command. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoCommand( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct); + + private: + + /** + * C++ default constructor. + */ + CVRRemConObserver( MVRVolumeEventObserver* aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Catch timer event. Volume command is repeated + @param aAny + */ + static TInt DoHandleVolumeRepeatL( TAny* aAny ); + + private: // Data + /** Observer to notify about a event. Not owned. **/ + MVRVolumeEventObserver* iObserver; + + /** Remote Controller. Owned */ + CRemConInterfaceSelector* iInterfaceSelector; + + /** Remote Controller. Not owned. */ + CRemConCoreApiTarget* iCoreTarget; + + /** Timer for counting key press. Owned. */ + CPeriodic *iVolumeRepeatTimer; + + /** Status of volume command */ + TBool iRemConVolumeCommandOk; + + /** Volume change that is repeated */ + TKeyEvent iVolumeChange; + }; + +#endif // CVRRemConObserver_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRStateInfoPanel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRStateInfoPanel.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,521 @@ +/* +* Copyright (c) 2002 - 2006 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: +* A compound control class. It is responsible for drawing and updating +* a set of labels, and a progress bar. +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CVRLabel.h" +#include "CVRStateInfoPanel.h" +#include "MVRStateInfoModel.h" +#include "voicerecorder.hrh" +#include "VRConsts.h" + +// CONSTANTS +const TInt KVRLabelMap[] = + { + CVRStateInfoPanel::ELabelName, + CVRStateInfoPanel::ELabelDate, + CVRStateInfoPanel::ELabelQuality, + CVRStateInfoPanel::ELabelStatus, + CVRStateInfoPanel::ELabelMax, + CVRStateInfoPanel::ELabelMin, + CVRStateInfoPanel::ELabelQualityText + }; + +_LIT( KVREmptyLabel, " " ); + + +// ================= MEMBER FUNCTIONS ======================================== + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::CVRStateInfoPanel +// +// ---------------------------------------------------------------------------- +// +CVRStateInfoPanel::CVRStateInfoPanel( MVRStateInfoModel* aModel ) + : iModel( aModel ), iLabels( ENumLabels ), iPBposition( 0 ) + { + if ( iModel ) + { + iModel->SetStateInfoObserver( this ); + } + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::CVRStateInfoPanel +// +// ---------------------------------------------------------------------------- +// +CVRStateInfoPanel::CVRStateInfoPanel( MVRStateInfoModel* aModel, + TUid aParentViewUid ) + : iModel( aModel ), + iLabels( ENumLabels ), + iParentViewUid( aParentViewUid ), + iPBposition( 0 ) + { + if ( iModel ) + { + iModel->SetStateInfoObserver( this ); + iModel->SetStateInfoPanelObserver( this ); + } + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::~CVRStateInfoPanel +// +// ---------------------------------------------------------------------------- +// +CVRStateInfoPanel::~CVRStateInfoPanel() + { + if ( iModel ) + { + iModel->SetStateInfoObserver( NULL ); + } + iLabels.ResetAndDestroy(); + delete iProgressBar; + iSkin = NULL; + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::ConstructL +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::ConstructL() + { + // New skin instance is loaded + iSkin = AknsUtils::SkinInstance(); + + // Create labels + for ( TInt i = 0; i < ENumLabels; i++ ) + { + CVRLabel* label = CVRLabel::NewLC( *this ); + + // Set the MOP-parent so that the labels can get the + // skin context from rec view container + label->SetMopParent( this ); + iLabels.AppendL( label ); + CleanupStack::Pop(); // label; + + // Set initial text for label + TBuf< VRLABELMAXLENGTH > str; + iModel->GetLabel( str, i ); + label->SetText( str ); + } + + CreateProgressBarL(); + UpdateLayoutL(); + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::CreateProgressBarL +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::CreateProgressBarL() + { + delete iProgressBar; + iProgressBar = NULL; + + // Create progress bar + CEikProgressInfo::SInfo info = ProgressInfo(); + + iProgressBar = new( ELeave ) CEikProgressInfo( info ); + iProgressBar->SetContainerWindowL( *this ); + + // Set the MOP-parent so that the progress bar can get the + // skin context from rec view container + iProgressBar->SetMopParent( this ); + iProgressBar->ConstructL(); + + iProgressBar->ActivateL(); + AknLayoutUtils::LayoutControl( iProgressBar, Rect(), + AppLayout::Voice_Recorder_elements_Line_4() ); + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::SizeChanged +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::SizeChanged() + { + TAknTextComponentLayout layoutText; + + for ( TInt i = 0; i < ENumLabels; i++ ) + { + switch ( KVRLabelMap[i] ) + { + case 0: + layoutText = AknLayoutScalable_Apps::vorec_t1(); + break; + case 1: + layoutText = AknLayoutScalable_Apps::vorec_t2(); + break; + case 2: + layoutText = AknLayoutScalable_Apps::vorec_t3(); + break; + case 3: + layoutText = AknLayoutScalable_Apps::vorec_t4(); + break; + case 4: + layoutText = AknLayoutScalable_Apps::vorec_t5(); + break; + case 5: + layoutText = AknLayoutScalable_Apps::vorec_t6(); + break; + case 6: + layoutText = AknLayoutScalable_Apps::vorec_t7(); + break; + } + AknLayoutUtils::LayoutLabel( iLabels.At( i ), Rect(), layoutText.LayoutLine() ); + + CCoeControl* label( iLabels.At( i ) ); + TRgb color( KRgbBlack ); + AknsUtils::GetCachedColor( iSkin, color, KAknsIIDQsnTextColors, + EAknsCIQsnTextColorsCG6 ); + // We can ignore the error, it only means we will have wrong color + TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *label, + EColorLabelText, color ) ); + } + + // There's nothing rational to do here if it leaves + TRAP_IGNORE( CreateProgressBarL() ); + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::Draw +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::Draw( const TRect& /*aRect*/ ) const + { + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::CountComponentControls +// +// ---------------------------------------------------------------------------- +// +TInt CVRStateInfoPanel::CountComponentControls() const + { + TInt componentCount( 0 ); + if ( iProgressBar ) + { + componentCount = ENumLabels + 1; // +1 means iProgressBar + } + return componentCount; + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::ComponentControl +// +// ---------------------------------------------------------------------------- +// +CCoeControl* CVRStateInfoPanel::ComponentControl( TInt aIndex ) const + { + if ( aIndex < ENumLabels ) + { + return iLabels.At( aIndex ); + } + else + { + return iProgressBar; + } + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::Update +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::Update( TVRUpdateCommand /*aCommand*/ ) + { + for ( TInt i = 0; i < ENumLabels; i++ ) + { + TBuf< VRLABELMAXLENGTH > str; + iModel->GetLabel( str, i ); + if ( str.Length() < 1 ) + { + // "" doesn't empty the label, so use space + str = KVREmptyLabel; + } + iLabels.At( i )->SetTextAndDraw( str ); + } + + UpdateProgressBar(); + + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::UpdateLayoutL +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::UpdateLayoutL() + { + SizeChanged(); + } + + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::ProgressInfo +// +// ---------------------------------------------------------------------------- +// +CEikProgressInfo::SInfo CVRStateInfoPanel::ProgressInfo() + { + CEikProgressInfo::SInfo info; + + TAknWindowLineLayout infobarLayout = + AppLayout::Voice_Recorder_elements_Line_4(); + TAknLayoutRect infobarRect; + infobarRect.LayoutRect( Rect(), infobarLayout ); + + info.iWidth = infobarRect.Rect().Width(); + info.iHeight = infobarRect.Rect().Height(); + + return info; + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::HandleResourceChangeL +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::HandleResourceChangeL( TInt aType ) + { + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + UpdateLayoutL(); + } + else if ( aType == KAknsMessageSkinChange ) + { + // New skin instance is loaded + iSkin = AknsUtils::SkinInstance(); + } + + for ( TInt i = 0; i < ENumLabels; i++ ) + { + if ( i < iLabels.Count() ) + { + iLabels.At( i )->HandleResourceChange( aType ); + } + } + + iProgressBar->HandleResourceChange( aType ); + UpdateProgressBar(); + + CCoeControl::HandleResourceChange( aType ); + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::UpdateProgressBar +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::UpdateProgressBar() + { + + if ( iProgressBar ) + { + if ( iModel->HasProgressBar() ) + { + iProgressBar->SetFinalValue( I64INT( iModel->Duration().Int64() / + KVRSecondAsMicroSeconds ) ); + iProgressBar->SetAndDraw( I64INT( iModel->Position().Int64() / + KVRSecondAsMicroSeconds ) ); + iProgressBar->MakeVisible( ETrue ); + + iPBposition = I64INT( iModel->Position().Int64() / + KVRSecondAsMicroSeconds ); + } + else + { + iProgressBar->MakeVisible( EFalse ); + } + } + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::HandlePointerEventL +// From CCoeControl +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::HandlePointerEventL( const TPointerEvent& + aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() && iModel->HasProgressBar() && + iProgressBar ) + { + CCoeControl::HandlePointerEventL( aPointerEvent ); + + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + TRect progressBarRect( iProgressBar->Rect() ); + // Check if pressed position is in progress bar's rect + if( progressBarRect.Contains( aPointerEvent.iPosition ) ) + { + HandleProgressBarTouchL( progressBarRect, + aPointerEvent.iPosition.iX ); + } + break; + } + case TPointerEvent::EDrag: + { + TRect progressBarRect( iProgressBar->Rect() ); + if( progressBarRect.Contains( aPointerEvent.iPosition ) ) + { + HandleProgressBarTouchL( progressBarRect, + aPointerEvent.iPosition.iX ); + } + break; + } + case TPointerEvent::EButton1Up: + { + break; + } + default: + { + break; + } + } + } + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::HandleProgressBarTouchL +// +// ---------------------------------------------------------------------------- +// +void CVRStateInfoPanel::HandleProgressBarTouchL( TRect aPBRect, + TInt aPressedPoint ) + { + if ( AknLayoutUtils::PenEnabled() ) + { +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: HandleProgressBarTouchL enter" ) ); +#endif + // Progress Bar start and end points + TInt pbEndPoint( aPBRect.iBr.iX ); + TInt pbStartPoint( aPBRect.iTl.iX ); + + TInt totalPBLength( pbEndPoint - pbStartPoint ); + // calculate what is the time position that was pressed in + // the progress bar + TTimeIntervalMicroSeconds newPosition( + ( ( aPressedPoint - pbStartPoint ) * + iModel->Duration().Int64() ) / + totalPBLength ); + + // Round the position to the nearest second value + TInt roundedNewPosition( RoundMicroSecsToSecs( newPosition ) ); + + // Performace issue. Send command only if value has changed + if ( roundedNewPosition != iPBposition ) + { + iPBposition = roundedNewPosition; + + CAknViewAppUi* appUi = reinterpret_cast< CAknViewAppUi* >( + CEikonEnv::Static()->EikAppUi() ); + CAknView* view = appUi->View( iParentViewUid ); + + // inform the view that position has changed. + view->HandleCommandL( ECmdSetNewPosition ); + } +#ifdef _DEBUG + RDebug::Print( _L( "VoiceRecorder: HandleProgressBarTouchL exit" ) ); +#endif + + } // PenEnabled + + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::RoundMicroSecsToSecs +// Rounds aMicroSecs value to nearest second value (Round) +// ---------------------------------------------------------------------------- +// +TInt CVRStateInfoPanel::RoundMicroSecsToSecs( TTimeIntervalMicroSeconds + aMicroSecs ) + { + // Rounds to secondss resolution (Floor) + Int64 secondsInMicroSecs( ( ( aMicroSecs.Int64() / + KVRSecondAsMicroSeconds ) * + KVRSecondAsMicroSeconds ) ); + + // takes the leftover part in seconds resolution + Int64 leftoversInMicroSecs ( aMicroSecs.Int64() - secondsInMicroSecs ); + + // Nearer to upper sec value + if ( leftoversInMicroSecs / ( KVRSecondAsMilliSeconds ) > + KVRHalfSecondAsMilliSeconds ) + { + // + 1 sec + return ( ( secondsInMicroSecs + KVRSecondAsMicroSeconds ) / + KVRSecondAsMicroSeconds ); + } + // Nearer to lower sec value + else + { + return secondsInMicroSecs / KVRSecondAsMicroSeconds; + } + } + + +// ---------------------------------------------------------------------------- +// CVRStateInfoPanel::ProgressBarPosition +// Just returns the current progress bar position +// ---------------------------------------------------------------------------- +// +TInt CVRStateInfoPanel::ProgressBarPosition() const + { + return iPBposition; + } + +// End of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRStateInfoPanel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRStateInfoPanel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2002 - 2006 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: +* A compound control class. It is responsible for drawing and updating +* a set of labels, and a progress bar. +* +*/ + + +#ifndef __CVRSTATEINFOPANEL_H__ +#define __CVRSTATEINFOPANEL_H__ + +// INCLUDES +#include +#include +#include + +#include "MVRObserver.h" +#include "MVRStateInfoObserver.h" + +// FORWARD DECLARATIONS +class CEikProgressInfo; +class CVRLabel; +class MVRStateInfoModel; + + +// CLASS DEFINITION +/** +* A compound control class. It is responsible for drawing and updating +* a set of labels, and a progress bar. +*/ +NONSHARABLE_CLASS( CVRStateInfoPanel ) + : public CCoeControl, public MVRObserver, public MVRStateInfoObserver + { + public: // data types + enum TVRLabels + { + ELabelName = 0, + ELabelDate, + ELabelQuality, + ELabelMin, + ELabelMax, + ELabelStatus, + ELabelQualityText + }; + + public: // constructors and destructor + + /** + * Constructor. + * @param aModel Pointer to the state info model. + * Ownership is not transferred. + */ + CVRStateInfoPanel( MVRStateInfoModel* aModel ); + + /** + * Constructor. + * @param aModel Pointer to the state info model. + * @param aParentViewUid Uid of CVRRecView for fast swap + * Ownership is not transferred. + */ + CVRStateInfoPanel( MVRStateInfoModel* aModel, + TUid aParentViewUid ); + /** + * Destructor + */ + virtual ~CVRStateInfoPanel(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + private: // constructors + + /** + * Default constructor. Not implemented. + */ + CVRStateInfoPanel(); + + public: + /** + * Handles a change to the application's resources + * @param aType The type of changed resource + */ + void HandleResourceChangeL( TInt aType ); + + public: // from CCoeControl + + /* + * From CCoeControl + * @see CCoeControl + */ + void SizeChanged(); + + /** + * Called by the framework to get the number of sub-components + * contained in this component. + * @return The number of component controls contained by this control + */ + TInt CountComponentControls() const; + + /** + * Called by the framework to get a specified sub-component + * of this component. + * @param aIndex The index of the component to get. + * @return The component control with an index of aIndex. + */ + CCoeControl* ComponentControl( TInt aIndex ) const; + + /** + * Gets called whenever a pointer event occurs. + * @param aPointerEvent The pointer event to handle. + */ + void HandlePointerEventL( const TPointerEvent& aPointerEvent ); + + private: // From CCoeControl + + void Draw( const TRect& aRect ) const; + + public: // from MVRObserver + + /** + * Called to notify a change in the observed subject's state. + */ + void Update( TVRUpdateCommand aCommand ); + + public: // from MVRStateInfoObserver + + /** + * Returns the current progress bar position value + * @return Position value + */ + TInt ProgressBarPosition() const; + + private: // Helpers + + CEikProgressInfo::SInfo ProgressInfo(); + + void UpdateLayoutL(); + + void CreateProgressBarL(); + + /** + * Updates the progress bar + */ + void UpdateProgressBar(); + + /** + * Handles progress bar touch events + * @param aPBRect Current progress bar rectangle + * @param aPressedPoint The x coordinate value that was pressed + * inside the progress bar + */ + void HandleProgressBarTouchL( TRect aPBRect, TInt aPressedPoint ); + + /** + * Rounds the parameter value to nearest second value + * @param aMicroSecs Time value in microseconds + * @return Rounded value in seconds + */ + TInt RoundMicroSecsToSecs( TTimeIntervalMicroSeconds aMicroSecs ); + + + private: // Data + + /** + * Pointer to the button panel model. Not owned. + */ + MVRStateInfoModel* iModel; + + /** + * Pointer to an array of labels. Owned. + */ + CArrayPtrSeg< CVRLabel > iLabels; + + /** + * Pointer to a progress bar control. Owned. + */ + CEikProgressInfo* iProgressBar; + + /** + * Uid of the parent view + */ + TUid iParentViewUid; + + /** + * Current progress bar position + */ + TInt iPBposition; + + // Skin instance. Not owned. + MAknsSkinInstance* iSkin; + + }; + +#endif // __CVRSTATEINFOPANEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRSystemEventHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRSystemEventHandler.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2005 - 2006 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: An active object class that is used to receive +* phone call related events from Publish&Subscribe and forward them +* to an MVRSystemEventObserver instance. +* Has to be attached to certain P&S -key, so it means having multiple +* +* +* +*/ + + +// INCLUDE FILES +#include + +#include "CVRSystemEventHandler.h" +#include "MVRSystemEventObserver.h" + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::CVRSystemEventHandler +// +// --------------------------------------------------------------------------- +// +CVRSystemEventHandler::CVRSystemEventHandler() : CActive( EPriorityLow ) + { + CActiveScheduler::Add( this ); + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRSystemEventHandler::ConstructL() + { + + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::NewL +// +// --------------------------------------------------------------------------- +// +// Two-phased constructor. +CVRSystemEventHandler* CVRSystemEventHandler::NewL() + { + CVRSystemEventHandler* self = new (ELeave) CVRSystemEventHandler; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::~CVRSystemEventHandler +// +// --------------------------------------------------------------------------- +// +// Destructor +CVRSystemEventHandler::~CVRSystemEventHandler() + { + Cancel(); + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::IssueRequest +// +// --------------------------------------------------------------------------- +// +void CVRSystemEventHandler::IssueRequest() + { + SetActive(); + iProperty.Subscribe( iStatus ); + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::RunL +// +// --------------------------------------------------------------------------- +// +void CVRSystemEventHandler::RunL() + { + // Event received + + if ( iStatus != KErrCancel ) + { + // Request a new event + IssueRequest(); + // Notify the observer + iObserver->HandleSystemEventL(); + } + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::Listen +// +// --------------------------------------------------------------------------- +// +void CVRSystemEventHandler::Listen( TUid aUid, + TUint aKey, + MVRSystemEventObserver* aObserver ) + { + iProperty.Attach( aUid, aKey ); + + iObserver = aObserver; + IssueRequest(); + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::DoCancel +// +// --------------------------------------------------------------------------- +// +void CVRSystemEventHandler::DoCancel() + { + iProperty.Cancel(); + } + + +// --------------------------------------------------------------------------- +// CVRSystemEventHandler::StateL +// +// --------------------------------------------------------------------------- +// +TInt CVRSystemEventHandler::StateL( TUid aUid, TUint aKey ) + { + TInt value; + User::LeaveIfError( RProperty::Get( aUid, aKey, value ) ); + return value; + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRSystemEventHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRSystemEventHandler.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2002-2006 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: An active object class that is used to receive +* phone call related events from PS API and forward them +* to an MVRSystemEventObserver instance. +* +* +*/ + + + +#ifndef __CVRSYSTEMEVENTHANDLER_H +#define __CVRSYSTEMEVENTHANDLER_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MVRSystemEventObserver; + +// CLASS DECLARATION + +/** +* An active object class that is used to receive +* phone call related events from RSystemAgent and forward them +* to an MVRSystemEventObserver instance. +*/ +NONSHARABLE_CLASS( CVRSystemEventHandler ): public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @return A pointer to fully constructed instance of CVRSystemEventHandler + */ + static CVRSystemEventHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CVRSystemEventHandler(); + + public: // New functions + /** + * Get the current state of any pubsub key + * @param aUid The UID of the PS category + * @param aKey The id identifying the PS key + * @return The value of the state variable + */ + TInt StateL( TUid aUid, TUint aKey ); + + /** + * Start listening to system events + * @param aUid The UID identifying the system agent's state variable + * @param aObserver The observer who will be notified of events + */ + void Listen( TUid aUid, TUint aKey, MVRSystemEventObserver* aObserver ); + + public: // from CActive + + /** + * When this method is called, an event has been received. + * Notify the observer. + */ + void RunL(); + + /** + * Cancel the request for event notifications. + */ + void DoCancel(); + + private: + + /** + * Ask system agent to notify us about events + */ + void IssueRequest(); + + /** + * Default constructor. + */ + CVRSystemEventHandler(); + + /** + * 2nd phase constructor. + */ + void ConstructL(); + + private: // Data + + /** + * For observing the system events + */ + RProperty iProperty; + + /** + * Pointer to the observer. Not owned. + */ + MVRSystemEventObserver* iObserver; + }; + +#endif // __CVRSYSTEMEVENTHANDLER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRTonePlayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRTonePlayer.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,254 @@ +/* +* Copyright (c) 2005 - 2006 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: Class that handles playback of tones in VoiceRec application +* +*/ + + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +#include "CVRTonePlayer.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CVRTonePlayer::CVRTonePlayer +// +// --------------------------------------------------------------------------- +// +CVRTonePlayer::CVRTonePlayer() + : iState( EVRToneIdle ) + { + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::ConstructL +// +// --------------------------------------------------------------------------- +// +void CVRTonePlayer::ConstructL() + { + iPlayer = CMdaAudioToneUtility::NewL( *this ); + + iSoundSystem = ( static_cast< CAknAppUi* >( + CEikonEnv::Static()->EikAppUi() )->KeySounds() ); + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::NewL +// +// --------------------------------------------------------------------------- +// +CVRTonePlayer* CVRTonePlayer::NewL() + { + CVRTonePlayer* self = new ( ELeave ) CVRTonePlayer; + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::~CVRTonePlayer +// +// --------------------------------------------------------------------------- +// +CVRTonePlayer::~CVRTonePlayer() + { + if ( iPlayer ) + { + switch ( iPlayer->State() ) + { + case EMdaAudioToneUtilityNotReady: + { + iPlayer->CancelPrepare(); + break; + } + case EMdaAudioToneUtilityPlaying: + { + iPlayer->CancelPlay(); + break; + } + } + } + delete iPlayer; + + // if tone play is not finished before, finish waitloop + if ( iShedulerWait.IsStarted() ) + { + iShedulerWait.AsyncStop(); + } + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::PrepareToneL +// Starts preparing the specified tone, preparing completes with call-back to +// MatoPrepareComplete +// --------------------------------------------------------------------------- +// +void CVRTonePlayer::PrepareToneL( TInt aToneId ) + { + if ( iState != EVRToneIdle ) + { + iQueuedTone = aToneId; + return; + } + + // Retrieve the tone + CAknSoundInfo* info = CAknSoundInfo::NewL(); + CleanupStack::PushL( info ); + User::LeaveIfError( iSoundSystem->RequestSoundInfoL( + aToneId, *info ) ); + + iPreparedTone = aToneId; + iState = EVRTonePreparing; + + iPlayer->PrepareToPlayDesSequence( *info->iSequence ); + CleanupStack::PopAndDestroy( info ); + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::PrepareTone +// Non-leaving version of PrepareToneL +// --------------------------------------------------------------------------- +// +void CVRTonePlayer::PrepareTone( TInt aToneId ) + { + TRAP_IGNORE( PrepareToneL( aToneId ) ); + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::PlayTone +// Starts playback of specified tone. Completes with call-back to +// MatoPlayComplete +// --------------------------------------------------------------------------- +// +void CVRTonePlayer::PlayTone( TInt aToneId ) + { + if ( iState != EVRToneIdle || iPreparedTone != aToneId || + iPlayer->State() == EMdaAudioToneUtilityPlaying ) + { + // Preparing an unprepared tone synchronously is not supported, + // tone playback is skipped + return; + } + + // Preferences need to be set according to tone + switch( aToneId ) + { + case EAvkonSIDVoiceRecordingStartTone: + { + iPlayer->SetPriority( KAudioPriorityRecording, + TMdaPriorityPreference( KAudioPrefVoiceRecStart ) ); + break; + } + case EAvkonSIDVoiceRecordingStopTone: + { + iPlayer->SetPriority( KAudioPriorityRecording, + TMdaPriorityPreference( KAudioPrefVoiceRecStop ) ); + break; + } + default: + { + break; + } + } + + iState = EVRTonePlaying; + + iPlayer->Play(); + + // Do not continue until start tone play is finished + if( aToneId == EAvkonSIDVoiceRecordingStartTone ) + { +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: Waiting for Start tone play complete") ); +#endif + iShedulerWait.Start(); + } + } + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::MatoPrepareComplete +// +// --------------------------------------------------------------------------- +// +void CVRTonePlayer::MatoPrepareComplete(TInt aError) + { + if ( aError ) + { + iPreparedTone = 0; + } + + iState = EVRToneIdle; + + // Prepare the next tone in queue + if ( iQueuedTone ) + { + TRAP_IGNORE( PrepareToneL( iQueuedTone ) ); + iQueuedTone = 0; + } + } + + + +// --------------------------------------------------------------------------- +// CVRTonePlayer::MatoPlayComplete +// +// --------------------------------------------------------------------------- +// +#ifdef _DEBUG +void CVRTonePlayer::MatoPlayComplete(TInt aError ) + { + RDebug::Print( _L("VoiceRecorder: Tone %d played, error %d"), + iPreparedTone, aError ); +#else +void CVRTonePlayer::MatoPlayComplete(TInt /*aError*/ ) + { +#endif + + iState = EVRToneIdle; + + // Prepare the next tone in queue + if ( iQueuedTone ) + { + TRAP_IGNORE( PrepareToneL( iQueuedTone ) ); + iQueuedTone = 0; + } + + // Started only for start-tone + if ( iShedulerWait.IsStarted() ) + { +#ifdef _DEBUG + RDebug::Print( _L("VoiceRecorder: Start tone play completed -> Recording started") ); +#endif + // Start tone played -> Recording can be started + iShedulerWait.AsyncStop(); + } + + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/CVRTonePlayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/CVRTonePlayer.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2005-2006 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: Class that handles playback of tones in Voice Recorder application +* +*/ + + +#ifndef CVRTONEPLAYER_H +#define CVRTONEPLAYER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CAknKeySoundSystem; +class CAknSoundInfo; + +/** + * Class that handles playback of tones in Voice Recorder application + * + * @lib VoiceRecorderRecView.lib + * @since S60 v3.0 + */ +NONSHARABLE_CLASS( CVRTonePlayer ) + : public CBase, public MMdaAudioToneObserver + { + +private: + enum TVRTonePlayerState + { + EVRToneIdle, + EVRTonePreparing, + EVRTonePlaying + }; + +public: + + static CVRTonePlayer* NewL(); + virtual ~CVRTonePlayer(); + + /** + * Prepares a tone for playback. This does not guarantee + * that preparing is ready after completion. + * + * @since S60 v3.0 + * @param aToneId Predefined id of the tone to be prepared + */ + void PrepareToneL( TInt aToneId ); + + /** + * Non-leaving method that calls PrepareToneL and ignores all leaves + * + * @since S60 v3.0 + * @param aToneId Predefined id of the tone to be prepared + */ + void PrepareTone( TInt aToneId ); + + /** + * Starts playback of tone. Playback starts immediately if the tone + * specified has been already been prepared. Otherwise the tone + * is first prepared. + * + * @since S60 v3.0 + * @param aToneId Predefined id of the tone to be played + */ + void PlayTone( TInt aToneId ); + +// from base class MMdaAudioToneObserver + + /** + * From MMdaAudioToneObserver. + * Defines required client behaviour when an attempt to configure the + * audio tone player utility has completed, successfully or otherwise. + * + * @param aError KErrNone if successful. One of the system + * wide error codes if the attempt failed. The possible + * values depend on the EPOC platform. + */ + void MatoPrepareComplete(TInt aError); + + /** + * From MMdaAudioToneObserver. + * Defines required client behaviour when the tone playing operation has + * completed, successfully or otherwise. + * + * @param aError KErrNone if successful. One of the system + * wide error codes if the attempt failed. The possible + * values depend on the EPOC platform. + */ + void MatoPlayComplete(TInt aError); + +private: + + CVRTonePlayer(); + void ConstructL(); + +private: // data + + /** + * Instance of the player class. + * Own. + */ + CMdaAudioToneUtility* iPlayer; + + /** + * Pointer to sound system utility that retrieves the sound data. + * Not owned. + */ + CAknKeySoundSystem* iSoundSystem; + + /** + * The id of the tone that is currently prepared + */ + TInt iPreparedTone; + + /** + * The id of the tone that is in queue + */ + TInt iQueuedTone; + + /** + * Is a tone currently in preparation + */ + TVRTonePlayerState iState; + + /** + * Used for waiting tone play comlete until continuing + */ + CActiveSchedulerWait iShedulerWait; + + }; + +#endif // CVRTONEPLAYER_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/DllMain.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2002 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: +* Dll entry point +* +* +*/ + + +#include + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRButtonPanelModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRButtonPanelModel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,92 @@ +/* +* Copyright (c) 2002 - 2006 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 class defines the data model interface for CVRButtonPanel. +* +*/ + + +#ifndef __MVRBUTTONPANELMODEL_H__ +#define __MVRBUTTONPANELMODEL_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MVRObserver; + +// CLASS DEFINITION +/** +* This class defines the data model interface for CVRButtonPanel. +*/ +class MVRButtonPanelModel + { + public: // new methods + + /** + * Returns the number of buttons. + * @return number of buttons (>=0) + */ + virtual TInt ButtonCount() const = 0; + + /** + * Returns the state of a specific button. + * @param aButtonId Button identifier + * @return ENormal or EDimmed + */ + virtual TInt ButtonState( TInt aButtonId ) const = 0; + + /** + * Returns the command id of a specific button. + * @param aButtonId Button identifier + * @return One of TVRCommands + */ + virtual TInt CommandId( TInt aButtonId ) const = 0; + + /** + * Returns the id of the button that should have initial focus. + * @return Button identifier + */ + virtual TInt InitialFocusButtonId() const = 0; + + /** + * Registers an observer for receiving + * update notifications from this interface. + * @param aObserver The observer object. + */ + virtual void SetButtonPanelObserver( MVRObserver* aObserver ) = 0; + + /** + * Checks if button panel model needs to reset the focus + * for example after a state change + * @return Is reset needed + */ + virtual TBool ResetNeeded() = 0; + + /** + * Returns an ID of the current visual state. + * @returns Visual state Id. + */ + virtual TUint VisualStateId() const = 0; + + /** + * Checks if model is in a state where it can take and handle + * new commands + * @return Can model handle new commands + */ + virtual TBool CanHandleCommands() const = 0; + + }; + +#endif // __MVRBUTTONPANELMODEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRDecoratorModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRDecoratorModel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2002-2006 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 class defines the data model interface for CVRViewContainer. +* +*/ + + +#ifndef __MVRDECORATORMODEL_H__ +#define __MVRDECORATORMODEL_H__ + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS +class MVRObserver; +class TCoeHelpContext; + +// ENUMERATIONS +enum TVRVolumeControlState{ EDisabled, EIhf, EEarPiece }; + +// CLASS DEFINITION +/** +* This class defines the data model interface for CVRViewContainer. +*/ +class MVRDecoratorModel + { + public: // new methods + + /** + * Returns the resource id for current softkeys + * @return Softkey resource identifier + */ + virtual TInt CbaResourceId() const = 0; + + /** + * Returns the resource id for current menu bar + * @return Menu bar resource identifier. + */ + virtual TInt MenuBarResourceId() const = 0; + + /** + * Used to get the state of the volume control component. + */ + virtual void GetVolumeControlState( TVRVolumeControlState& aState, + TInt& aVolume ) = 0; + /** + * Specifies the current help context. + * @param aContext the context IDs are placed here + */ + virtual void GetHelpContext( TCoeHelpContext& aContext ) const = 0; + + /** + * Registers an observer for receiving + * update notifications from this interface. + * @param aObserver The observer object. + */ + virtual void SetDecoratorObserver( MVRObserver* aObserver ) = 0; + + /** + * Tells in return value if CBA Buttons should be enabled or not + * @return ETrue if buttons should be enabled, EFalse otherwise + */ + virtual TBool CBAEnabled() const = 0; + + }; + +#endif // __MVRDECORATORMODEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRIHFObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRIHFObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2004-2006 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: Template class for IHF change observers +* +*/ + + +#ifndef __MVRIHFOBSERVER_H__ +#define __MVRIHFOBSERVER_H__ + +// CLASS DEFINITION +/** + * + * Template class for observers of IHF mode changes + * + */ +class MVRIHFObserver + { + public: // New functions + + /** + * This is a callback function which is called when a IHF mode changes. + * User must derive his class from MVRIHFObserver + * and implement this method if he is to use notify services. + */ + virtual void HandleIHFChange() = 0; + }; + +#endif // __MVRIHFOBSERVER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRKeyObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRKeyObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2002-2006 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: +* An observer class used to hand over key events to classes +* that can't receive them by themselves (i.e. not CCoeControl derived +* classes) +* +*/ + + +#ifndef __MVRKEYOBSERVER_H__ +#define __MVRKEYOBSERVER_H__ + +// INCLUDES +#include + +// CLASS DECLARATION +/** +* An observer class used to hand over key events to classes +* that can't receive them by themselves (i.e. not CCoeControl derived +* classes) +*/ +class MVRKeyObserver + { + + public: // new methods + + /** + * This function is called when a subject wants to report a key event. + * @param aKeyEvent The key event. + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown + * @return Indicates whether or not the key event was used. + */ + virtual TBool ProcessKeyEventL( const TKeyEvent& aKeyEvent, + const TEventCode aType ) = 0; + + }; + +#endif // __MVRKEYOBSERVER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRMdaRecorder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRMdaRecorder.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2002-2006 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 interface acts as a high level wrapper around the media server +* playback and recording functionalities. It is inherited by both +* CVRMdaRecorder +* +*/ + + +#ifndef __MVRMDARECORDER_H__ +#define __MVRMDARECORDER_H__ + + +// FORWARD DECLARATIONS +class CVRMemo; +class MVRObserver; + +// CLASS DEFINITION +/** +* This class acts as a high level wrapper around the media server +* playback and recording functionalities. +*/ +class MVRMdaRecorder +{ + + public: // new methods + + /** + * Registers an observer for receiving update notifications. + * @param aObserver The observer object. + */ + virtual void RegisterObserver( MVRObserver* aObserver ) = 0; + + /** + * Unregisters a previously registered observer + * @param aObserver The observer object. + */ + virtual void UnregisterObserver( MVRObserver* aObserver ) = 0; + + /** + * Registers an observer for receiving auto stop notifications. + * @param aObserver The observer object. + */ + virtual void SetAutoStopObserver( MVRObserver* aObserver ) = 0; + + /** + * Attachs this recorder to a memo file, i.e. opens it + * and initialises media server. + * @param aMemo Specifies the file to be attached to. + */ + virtual void AttachToMemoL( CVRMemo* aMemo ) = 0; + + /** + * Creates a new memo file and attachs to it. + * @param aMemo Specifies the file to be created. + */ + virtual void CreateNewMemoL( CVRMemo* aMemo ) = 0; + + /** + * Detachs from the current memo, i.e. closes the file. + */ + virtual void DetachMemo() = 0; + + /** + * Sets playback volume. + * @param aStep Volume level in steps + * @param aMaxSteps How many steps there are (10 usually). + */ + virtual void SetVolume( TInt aStep, TInt aMaxSteps )= 0; + + /** + * Starts playback. + * @return System wide error code + */ + virtual TInt PlayL() = 0; + + /** + * Starts recording. + * @return System wide error code + */ + virtual TInt RecordL() = 0; + + /** + * Stops playback or recording. + */ + virtual void Stop() = 0; + + /** + * Pauses playback or recording. + */ + virtual void Pause() = 0; + + /** + * Moves the playing position forward 5 seconds. + * @return System wide error code. KErrOverflow if the + * position was forwarded past the end. + */ + virtual TInt ForwardL() = 0; + + /** + * Moves the playing position backward 5 seconds. + * @return System wide error code + */ + virtual TInt RewindL() = 0; + + /** + * Indicates if we are in a state that can accept + * more commands (i.e. all async calls have completed). + * @return ETrue if it's ok to proceed calling methods. + */ + virtual TBool CanAcceptCommands() const = 0; + + /** + * Set active speaker if feature is supported + * @param aEnabled ETrue if playback should be routed to IHF + * @return Error code returned by routing operation + */ + virtual TInt SetIhf( TBool aEnabled ) = 0; + + /** + * Set the audio recorder position to a new value + * @param aSeconds The position to set + */ + virtual void SetPositionL( TInt aSeconds ) = 0; + + virtual ~MVRMdaRecorder() {}; + }; + +#endif // __MVRMDARECORDER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRMediaRemovalObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRMediaRemovalObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2002-2006 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 class can be used to observe changes that has been happened in +* CVRMediaRemovalHandler class +* +*/ + + +#ifndef __MVRMEDIAREMOVALOBSERVER_H +#define __MVRMEDIAREMOVALOBSERVER_H + +// INCLUDES +#include +#include + +// CLASS DECLARATION +/** +* __MVRMEDIAREMOVALOBSERVER_H +*/ +class MVRMediaRemovalObserver + { + public: // Constructors and destructor + + virtual void HandleMMCEjectEventL( ) = 0; + + }; + +#endif + +// __MVRMEDIAREMOVALOBSERVER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2002-2006 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 class defines a generic observer interface. +* +*/ + + +#ifndef __MVROBSERVER_H__ +#define __MVROBSERVER_H__ + +// INCLUDES +#include "VRConsts.h" + +// CLASS DEFINITION +/** +* This class defines a generic observer interface. +*/ +class MVRObserver + { + public: // new methods + + /** + * Called to notify a change in the observed subject's state. + */ + virtual void Update( TVRUpdateCommand aCommand = EVRUpdate ) = 0; + + }; + +#endif // __MVROBSERVER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRStateInfoModel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRStateInfoModel.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2002-2006 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 class defines the data model interface for CVRStateInfoPanel. +* +*/ + + +#ifndef __MVRSTATEINFOMODEL_H__ +#define __MVRSTATEINFOMODEL_H__ + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class MVRObserver; +class MVRStateInfoObserver; + +// CLASS DEFINITION +/** +* This class defines the data model interface for CVRStateInfoPanel. +**/ +class MVRStateInfoModel + { + public: // new methods + + /** + * Returns the length of the current memo + * @return The duration in microseconds. + */ + virtual TTimeIntervalMicroSeconds Duration() const = 0; + + /** + * Returns the playing or recording position of the current memo. + * @return The position in microseconds. + */ + virtual TTimeIntervalMicroSeconds Position() const = 0; + + /** + * Returns the text content for a label. + * @param aName Returned text is placed in this descriptor + * @param aLabelIndex Label identifier (>=0) + */ + virtual void GetLabel( TDes& aName, TInt aLabelIndex ) const = 0; + + /** + * Returns the resource id for a label. + * @param aLabelIndex Label identifier (>=0) + * @return The resource id for the specified label + */ + virtual TInt ResourceIdForLabel( TInt aLabelIndex, TAknLayoutId aLayout ) const = 0; + + /** + * Registers an observer for receiving + * update notifications from this interface. + * @param aObserver The observer object. + */ + virtual void SetStateInfoObserver( MVRObserver* aObserver ) = 0; + + /** + * Determines is view has a progress bar + * @return ETrue if view has a progress bar, otherwise EFalse + */ + virtual TBool HasProgressBar() const = 0; + + /** + * Registers an observer to communicate about the changes in InfoPanel. + * @param aObserver The observer object. + */ + virtual void SetStateInfoPanelObserver( MVRStateInfoObserver* aObserver ) = 0; + + }; + +#endif // __MVRSTATEINFOMODEL_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRStateInfoObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRStateInfoObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2006 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 class can be used to observe changes that has been happened in +* CVRStateInfoPanel class +* +* +*/ + + +#ifndef __MVRSTATEINFOOBSERVER_H__ +#define __MVRSTATEINFOOBSERVER_H__ + +// CLASS DEFINITION +/** +* This class can be used to observe changes that has been happened in +* CVRStateInfoPanel class +*/ +class MVRStateInfoObserver + { + public: // new methods + + /** + * Returns the current progress bar position value + * @return Position value + */ + virtual TInt ProgressBarPosition() const = 0; + + }; + +#endif // __MVRSTATEINFOOBSERVER_H__ + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRSystemEventObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRSystemEventObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2002-2006 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 class can be used to observe changes that has been happened in +* CVRSystemEventHandler class +* +*/ + + +#ifndef __MVRSYSTEMEVENTOBSERVER_H +#define __MVRSYSTEMEVENTOBSERVER_H + +// INCLUDES +#include +#include + +// CLASS DECLARATION +/** +* MVRSystemEventObserver +*/ +class MVRSystemEventObserver + { + public: // Constructors and destructor + + virtual void HandleSystemEventL() = 0; + + }; + +#endif // __MVRSYSTEMEVENTOBSERVER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRUpdateEventProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRUpdateEventProvider.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2002-2006 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: +* MVRUpdateEventProvider provides an interface for registering +* and unregistering several MVRObserver derived observers +* +*/ + + +#ifndef __MVRUPDATEEVENTPROVIDER_H +#define __MVRUPDATEEVENTPROVIDER_H + +// INCLUDES +#include + +#include "MVRObserver.h" + +// CLASS DECLARATION + +/** +* MVRUpdateEventProvider provides an interface for registering +* and unregistering several MVRObserver derived observers +* +*/ +class MVRUpdateEventProvider + { + public: + /** + * Registers an observer for receiving update notifications. + * @param aObserver The observer object. + */ + virtual void RegisterObserver( MVRObserver* aObserver ) = 0; + + /** + * Unregisters a previously registered observer + * @param aObserver The observer object. + */ + virtual void UnregisterObserver( MVRObserver* aObserver ) = 0; + }; + +#endif // __MVRUPDATEEVENTPROVIDER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRVolumeChangeObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRVolumeChangeObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002-2006 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 class defines a audio volume change observer interface. +* +*/ + + +#ifndef __MVRVOLUMECHANGEOBSERVER_H__ +#define __MVRVOLUMECHANGEOBSERVER_H__ + +// INCLUDES +#include + +// CLASS DEFINITION +/** +* This class defines a audio volume change observer interface. +*/ +class MVRVolumeChangeObserver + { + public: // new methods + + /** + * Called to notify a change in volume settings. + * @param aStep Volume level in steps + * @param aMaxSteps How many steps there are (10 usually). + */ + virtual void SetVolume( TInt aStep, TInt aMaxSteps ) = 0; + + /*** + * Indicates if volume can be set, because rinto tone + * volume change has no effect if the tone is playing. + */ + virtual TBool CanSetVolume() = 0; + }; + +#endif // __MVRVOLUMECHANGEOBSERVER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/MVRVolumeEventObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/MVRVolumeEventObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2002-2006 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: Common interface for observing volume events provided by +* either key presses or side volume keys +* +*/ + + + +#ifndef __MVRVOLUMEEVENTOBSERVER_H +#define __MVRVOLUMEEVENTOBSERVER_H + +// CLASS DECLARATION + +/** +* Interface for passing volume events to observer +*/ +class MVRVolumeEventObserver + { + public: // New functions + + /** + * Handles volume change event received from either side volume + * keys or left-right rocker presses. + * @param aKeyEvent The key event. Will be forwarded to CAknVolumeControl + * @param aType The type of key event: EEventKey, EEventKeyUp + * or EEventKeyDown. Will be forwarded to CAknVolumeControl + */ + + virtual TInt HandleVolumeChangeL( const TKeyEvent& aKeyEvent, + TEventCode aType ) = 0; + + }; + +#endif // MVRVOLUMEEVENTOBSERVER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/TVRContext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/TVRContext.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2002-2006 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 class is a data container for a single RecView context. +* A context contains a set of states. Each state +* contains a set of valid state transitions. +* Different contexts are defined in VoiceRecorder.hrh. +* +* +*/ + + +#ifndef __TVRCONTEXT_H__ +#define __TVRCONTEXT_H__ + +// INCLUDES +#include "voicerecorder.hrh" +#include "VRConsts.h" + +// CLASS DEFINITION +/** +* This class is a data container for a single RecView context. +* A context contains a set of states. Each state +* contains a set of valid state transitions. +* Different contexts are defined in VoiceRecorder.hrh. +*/ +class TVRContext + { + public: + + // CLASS DEFINITION + /** + * This class is a data container for a single RecView + * state transition. + */ + class TTransition + { + public: // data + + /** + * ETrue if this transition has been succesfully initialised. + */ + TBool iValid; + + /** + * Identifies the command that executes this transition. + * This is one of TVRCommands. + */ + TUint iCommandId; + + /** + * Identifies the state that is entered by this transition. + * This is an index into the TState::iStates array. + */ + TUint iNewState; + + /** + * Identifies the function that gets called after the + * state transition is complete. + */ + TUint iFunctionId; + + }; + + // CLASS DEFINITION + /** + * This class is a data container for a single RecView + * state. It contains a set of valid state transitions. + */ + class TState + { + public: // data + + /** + * ETrue if this state has been succesfully initialised + */ + TBool iValid; + + /** + * A static array of valid transitions (in this State). + */ + TTransition iTransitions[ KVRMaxTransitions ]; + + }; + + public: // data + + /** + * ETrue if this context has been succesfully initialised + */ + TBool iValid; + + /** + * A static array of valid states (in this context). + */ + TState iStates[ ENumStates ]; + + /** + * Defines the transition that is automatically + * executed after entering this context. + */ + TTransition iInitialTransition; + + }; + +#endif // __TVRCONTEXT_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/TVRState.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/TVRState.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2002 - 2006 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 class is a data container for a single RecView visual (UI) state +* It is able to read its parameters from a resource file. +* The run-time size of a single TVRState instance is 152 bytes +* (unicode build) +* +*/ + + +// INCLUDE FILES +#include // TResourceReader +#include "TVRState.h" + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// TVRState::ReadFromResource +// +// --------------------------------------------------------------------------- +// +// Reads a STRUCT VR_STATE +void TVRState::ReadFromResource( TResourceReader& aReader ) + { + iMenubarResourceId = aReader.ReadUint32(); + iCbaResourceId = aReader.ReadUint32(); + iStatus.Copy( aReader.ReadTPtrC() ); + iLabelSetId = TUint8( aReader.ReadUint8() ); + iHasVolumeControl = TUint8( aReader.ReadUint8() ); + iHasProgressBar = TUint8( aReader.ReadUint8() ); + iFocusButtonId = TUint8( aReader.ReadUint8() ); + iStateId = aReader.ReadUint8(); + + // Reads an array of STRUCT VR_BUTTON_INFO + iButtonCount = aReader.ReadInt16(); + for ( TInt i = 0; i < iButtonCount; i++ ) + { + iButtons[ i ].ReadFromResource( aReader ); + } + } + + +// --------------------------------------------------------------------------- +// TVRState::TButton::ReadFromResource +// Reads a STRUCT VR_BUTTON +// --------------------------------------------------------------------------- +// +void TVRState::TButton::ReadFromResource( TResourceReader& aReader ) + { + iCommandId = aReader.ReadUint16(); + iState = TUint8( aReader.ReadUint8() ); + } + + +// --------------------------------------------------------------------------- +// TVRState::ButtonState +// +// --------------------------------------------------------------------------- +// +TUint TVRState::ButtonState( TInt aButtonId ) const + { + // aButtonId cannot be out of bounds + return iButtons[ aButtonId ].iState; + } + + +// --------------------------------------------------------------------------- +// TVRState::ButtonCommandId +// +// --------------------------------------------------------------------------- +// +TUint TVRState::ButtonCommandId( TInt aButtonId ) const + { + // aButtonId cannot be out of bounds + return iButtons[ aButtonId ].iCommandId; + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/RecViewSrc/TVRState.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/RecViewSrc/TVRState.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,162 @@ +/* +* Copyright (c) 2002 - 2006 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 class is a data container for a single RecView visual (UI) state +* It is able to read its parameters from a resource file. +* The run-time size of a single TVRState instance is 152 bytes +* (unicode build) +* +*/ + + +#ifndef __TVRSTATE_H__ +#define __TVRSTATE_H__ + +// INCLUDES +#include +#include "voicerecorder.hrh" + +// CONSTANTS +const TInt KVRMaxButtons( 5 ); // defined by UI spec + +// FORWARD DECLARATIONS +class TResourceReader; + +// CLASS DEFINITION +/** +* This class is a data container for a single Voice Recorder visual (UI) state +* It is able to read its parameters from a resource file. +* The run-time size of a single TVRState instance is 152 bytes (unicode build) +*/ +class TVRState + { + private: // nested classes + + // CLASS DEFINITION + /** + * This class is a data container for a single CVRButtonPanel button + * defeinition. It is able to read its parameters from a resource file. + * The run-time size of a single TButton instance is 12 bytes. + */ + class TButton + { + public: // new methods + + /** + * Constructs this button from a VR_BUTTON resource + * @param aReader A resource reader object initialised + * to a resource. + */ + void ReadFromResource( TResourceReader& aReader ); + + public: // data + + /** + * The command id of this button (for HandleCommandL use). + */ + TUint iCommandId; + + /** + * The visual state of this button + * (see TVRButtonStates in VoiceRecorder.hrh) + */ + TUint8 iState; + + }; + + public: // new methods + + /** + * Constructs this state from a VR_STATE resource + * @param aReader A resource reader object initialised to a resource. + */ + void ReadFromResource( TResourceReader& aReader ); + + /** + * Returns the state of a button. + * @param aButtonId Identifies a button in iButtons array; + * @return The current state of this button. See TButton. + */ + TUint ButtonState( TInt aButtonId ) const; + + /** + * Returns the command id of a button. + * @param aButtonId Identifies a button in iButtons array; + * @return The command id of this button. See TButton. + */ + TUint ButtonCommandId( TInt aButtonId ) const; + + public: // data + + /** + * An unique identifier for this visual state. + */ + TUint iStateId; + + /** + * An unique identifier for this state. + */ + TUint iId; + + /** + * Identifies the menu bar resource for this state (or null). + */ + TUint iMenubarResourceId; + + /** + * Identifies the softkey resource for this state (or null). + */ + TUint iCbaResourceId; + + /** + * Identifies the button that should gain initial focus. + */ + TUint8 iFocusButtonId; + + /** + * Nonzero if this state should have a volume control. + */ + TUint8 iHasVolumeControl; + + /** + * Nonzero if this state should have a progress bar. + */ + TUint8 iHasProgressBar; + + /** + * Identifies the set of labels for this state. + */ + TUint8 iLabelSetId; + + /** + * The number of buttons in this state. + */ + TInt iButtonCount; + + /** + * Status text for this state (or KNullDesc). + */ + TBuf< VRLABELMAXLENGTH > iStatus; + + private: // data + + /** + * An array of buttons in this state. + * The run-time size of iButtons is 60 bytes. + */ + TButton iButtons[ KVRMaxButtons ]; + + }; + +#endif // __TVRSTATE_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsInc/MVRLayoutChangeObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsInc/MVRLayoutChangeObserver.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2002-2006 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: Declares an interface for observing +* +*/ + + + +#ifndef MVRLAYOUTCHANGEOBSERVER_H +#define MVRLAYOUTCHANGEOBSERVER_H + +// INCLUDES +#include + + +// CLASS DECLARATION +/** +* Notifies layot change. +* +* @lib VoiceRecorderUtils.dll +* @since 2.0 +*/ +class MVRLayoutChangeObserver + { + public: + /* + * Used to forward HandleResourceChangeL events to observers + * @param aType The type of resources that have changed. + */ + virtual void LayoutChangedL( TInt aType ) = 0; + }; + +#endif // MVRLAYOUTCHANGEOBSERVER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsInc/MVRSelectionProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsInc/MVRSelectionProvider.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2002-2006 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: +* Interface for file selection +* +* +*/ + + +#ifndef __MVRSELECTIONPROVIDER_H__ +#define __MVRSELECTIONPROVIDER_H__ + +// INCLUDES +#include +#include + +// ENUMERATIONS +enum TVRSelectionStyle { EEmptyList, EFocusedItem, ESingleMarkedItem, EMarkedItems }; + +// CLASS DEFINITION +/** +* +*/ +class MVRSelectionProvider + { + public: // new methods + + /** + * Ownership is transferred. Caller must destroy the returned array. + * @return array of file names + */ + virtual MDesCArray* GetSelectedFilesLC( TVRSelectionStyle& aStyle ) const = 0; + + /** + * Transfer the file handle to view + * @param aFile File handle + */ + virtual void SetFileHandle( RFile& aFile ) = 0; + + /** + * Get the handle to the recorded clip. + * @return Open file handle + */ + virtual RFile& GetFile() = 0; + }; + +#endif // __MVRSELECTIONPROVIDER_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsInc/TVRRename.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsInc/TVRRename.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2002-2006 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 class encapsulates the functionality associated with renaming +* files in different situation. The implementation is made according +* to the Folders v.4.0 specification. +* +* +*/ + + +#ifndef __TVRRENAME_H +#define __TVRRENAME_H + +// INCLUDES +#include + +// CLASS DECLARATION + +/** +* This class provides functionality to use in renaming operations +*/ +class TVRRename + { + public: // Constructors and destructor + + /** + * C++ constructor. + * @param aFs A reference to an open file server session. + */ + IMPORT_C TVRRename( RFs& aFs ); + + public: // New functions + + /** + * This method executes a set of operations to do a file renaming operation + * according to the Folders specification v.4.0. The method doesn't do the + * actual renaming of the file, but returns the result path. + * + * @param aOldName A descriptor containing path to the file to be renamed. + * @param aNewName A descriptor with a size of atleast KMaxFileName. The + * new path for the renamed is stored here. Do not rely on the contents + * of this descriptor if the method returns EFalse. + * @param aPrompt A resource id to a string that is used as a prompt for the + * name query dialog. + * @return (TBool) ETrue if the user confirmed the operation. + * EFalse if the user canceled the operation. + */ + IMPORT_C TBool GetNewNameL( const TDesC& aOldName, TDes& aNewName, const TInt aPrompt ); + + /** + * This method executes a set of operations to do a file renaming operation + * according to the Folders specification v.4.0. This method carries out + * the actual renaming of the file. + * + * @param aName A descriptor containing path to the file to be renamed. + * @param aPrompt A resource id to a string that is used as a prompt for the + * name query dialog. + * @return (TBool) ETrue if the user confirmed the operation. + * EFalse if the user canceled the operation. + */ + IMPORT_C TBool RenameL( TDes& aName, const TInt aPrompt ); + + /** + * This method executes a set of operations to do a file renaming operation + * according to the Folders specification v.4.0. This method carries out + * the actual renaming of the file. + * + * @param aFile A handle to the file to be renamed + * @param aPrompt A resource id to a string that is used as a prompt for the + * name query dialog. + * @return (TBool) ETrue if the user confirmed the operation. + * EFalse if the user canceled the operation. + */ + IMPORT_C TBool RenameL( RFile& aFile, const TInt aPrompt ); + + private: // Data + + // A reference to an open file server session + RFs& iFs; + + }; + +#endif // __TVRRENAME_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsInc/VRUSBStateHanlder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsInc/VRUSBStateHanlder.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2002-2006 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: +* CVRUSBStateHanlder declaration +* +* +*/ + + +#ifndef VRUSBSTATEHANLDER_H +#define VRUSBSTATEHANLDER_H + +#include // For CActive, link against: euser.lib +#include // For RTimer, link against: euser.lib +#include + +//#include "DummyUSBState.h" // for dummy testing + +class MVRUSBStateObserver + { +public: + // Constructors and destructor + + virtual TInt HandleUsbPlugInL() = 0; + virtual TInt HandleUsbPlugOutL() = 0; + + }; + +class CVRUSBStateHanlder : public CActive + { +public: + // Cancel and destroy + ~CVRUSBStateHanlder(); + + IMPORT_C static CVRUSBStateHanlder* NewL(MVRUSBStateObserver* aObserver); + +public: + + IMPORT_C static TBool IsUsbActive(); + +private: + // C++ constructor + CVRUSBStateHanlder(MVRUSBStateObserver* aObserver); + + // Second-phase constructor + void ConstructL(); + +private: + // From CActive + // Handle completion + void RunL(); + + // How to cancel me + void DoCancel(); + + // Override to handle leaves from RunL(). Default implementation causes + // the active scheduler to panic. + TInt RunError(TInt aError); + + void StartL(); + +private: +#ifdef DUMMY_USB_TESTING + RTimer iTimer; // Provides async timing service, for dummy testing + TInt isUSBActive; +#else + RProperty iProperty; +#endif + MVRUSBStateObserver* iObserver; + enum TUSBConnectionStatus + { + EStateUninitialized, + EStateConnected, + EStateDisConnected + }; + TUSBConnectionStatus iConnectionStatus; + }; + +#endif // VRUSBSTATEHANLDER_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsInc/VRUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsInc/VRUtils.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,303 @@ +/* +* Copyright (c) 2002-2006 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 class contains a collection of small static utility functions +* needed all around the application. The class has no prefix letter +* +* +*/ + + +#ifndef __VRUTILS_H +#define __VRUTILS_H + +// INCLUDES +#include +#include +#include +#include "VRConsts.h" +#include "voicerecorder.hrh" + +// CLASS DECLARATION + +class TVRDriveInfo + { + public: + TBool iDrivePresent; + TBool iDriveLocked; + TBool iDriveCorrupted; + TBool iDriveReadOnly; + TBool iDriveFull; + }; + +class VRUtils + { + public: // New functions + + /** + * Returns the currently effective path where to store voice memos + * The directory is affected by the settings and the availability of MMC + * + * @return Returns a non-modifiable pointer descriptor containing the + * currently effective path where to store voice memos. + The descriptor is left on cleanup stack. + */ + IMPORT_C static void MemoStoreDirectoryL( TDes &aPath ); + + /** + * This method sets the default memo store setting (Phone Memory / MMC) + * + * @param aMemory Memory to set as default store + */ + IMPORT_C static void SetMemoStoreL( TVRMemoStore aMemory ); + + /** + * This method returns the default memo store setting + * @return The default memo store + */ + IMPORT_C static TVRMemoStore MemoStoreL(); + + /** + * This method returns the current status of MMC (inserted/locked/etc...) + * @param aDriveInfo MMC status + */ + IMPORT_C static void GetMMCInfo( TVRDriveInfo& aDriveInfo ); + + /** + * Set the default speaker + * @param aSpeaker ESpeakerEarPiece or ESpeakerIhf + */ + IMPORT_C static void SetDefaultSpeakerL( const TVRSpeaker aSpeaker); + + /** + * This method returns the current speaker + * @return Default speaker, either ESpeakerEarPiece or ESpeakerIhf + */ + IMPORT_C static TVRSpeaker DefaultSpeakerL(); + + /** + * Set the default volume setting for specified speaker + * @param aSpeaker ESpeakerEarPiece or ESpeakerIhf + * @param aVolume New TInt value to save + */ + IMPORT_C static void SetDefaultVolumeL( const TVRSpeaker aSpeaker, const TInt aVolume ); + + /** + * This method returns the default volume setting for specivied speaker + * @param aSpeaker ESpeakerEarPiece or ESpeakerIhf + * @return The retrieved volume setting value + */ + IMPORT_C static TInt DefaultVolumeL( const TVRSpeaker aSpeaker ); + + + /** + * Set the default quality setting + * @param aSpeaker EQualityMMSOptimized or EQualityHigh + */ + IMPORT_C static void SetQualityL( const TVRQuality aQuality ); + + /** + * This method returns the current quality setting + * @return Default quality, either EQualityMMSOptimized or EQualityHigh + */ + IMPORT_C static TVRQuality QualityL(); + + /** + * This method shows the out-of-memory confirmation query + * @param aMmc Shows qtn_memlo_not_enough_memory if EFalse or + * qtn_memlo_mmc_not_enough_memory if ETrue + */ + IMPORT_C static void ShowMemoryFullConfirmationQuery( TBool aMmc = EFalse ); + + /** + * This method checks if video or VOIP call is ongoing + * @param aShowNote Show error note if ETrue + * @return ETrue if unsupported call is ongoing, EFalse otherwise + */ + IMPORT_C static TBool UnsupportedCallTypeOngoing( TBool aShowNote = EFalse ); + + /** + * This method returns the maximum length for a memo + * @return Maximum length + */ + IMPORT_C static TInt MaxLengthL(); + + /** + * Check if variated feature is configured on + * @param aFeature Internal feature id + * @return ETrue if feature is enabled + */ + IMPORT_C static TBool FeatureEnabled( TVRFeature aFeature ); + + /** + * Generate a filename that has unique body in given path. + * @param aFs Reference to connected file server session handle + * @param aName Path to destination folder. On return contains + * a unique file name with full path and extension + * @param aType The type of file to be generated. Extension will be + appended according to this parameter. + */ + IMPORT_C static void GenerateUniqueFilenameL( RFs& aFs, + TFileName& aName, TVRFiletype aType ); + + /** + * This method returns the running count of recorded memos + * @return Count of recorded memos + */ + IMPORT_C static TInt MemoCount(); + + /** + * This method returns the running count of recorded memos + * @return Count of recorded memos + */ + IMPORT_C static void SetMemoCount( TInt aNewCount ); + + /** + * This method returns the bitrate that is used when recording amr clips + * @return Bitrate + */ + IMPORT_C static TUint AMRBitrateL(); + + + /** + * This method returns the bitrate that is used when recording amr clips + * @return Bitrate + */ + IMPORT_C static TUint AACBitrateL(); + + + /** + * This method returns the AAC-LC sampling rate that is used when recording AAC-LC clips + * @return Sampleing rate + */ + IMPORT_C static TInt AACSamplerateL(); + + /** + * This method returns the audio mode that is used when recording AAC-LC clips + * @return audio mode + */ + IMPORT_C static TInt AACAudioModeL(); + + /** + * This method checks the drive is valid or not + * @param aDrive is the drive id + * @param aNoteId store the note id + * @return The default memo store + */ + IMPORT_C static TBool DriveValid( const TInt aDrive ); + + /** + * This method checks which MassStorage is/are valid + * @return The MassStorage is multi (ETrue) or only one (EFlase) + */ + IMPORT_C static TBool MultipleMassStorageAvailable(); + + /** + * This wrapper method return the removable MassStorage drive + * @return the drive + */ + IMPORT_C static TInt GetRemovableMassStorageL(); + +#ifdef RD_MULTIPLE_DRIVE + /** + * This method sets the default memo store setting (to support multipledrives) + * + * @param aMemory Memory to set as default store + */ + IMPORT_C static void SetMemoDriveL( TDriveNumber aDrive ); + + /** + * This method returns default phone memory drive + * + * + */ + IMPORT_C static TInt DefaultMemoDriveL(); + + /** + * This method returns the current status of Drive (inserted/locked/etc...) + * @param aDriveInfo MMC status + */ + IMPORT_C static TInt GetDriveInfo( TInt aDrive, TUint& aDriveInfo ); + + /** + * This method returns the default memo drive setting + * @return The default memo store + */ + IMPORT_C static TInt MemoDriveL(); +#endif + + private: + + /** + * Default constructor declared as private to prohibit construction. + */ + VRUtils(); + + /** + * Store a setting in Central Repository + * @param aKey The Central Repository key + * @param aValue The value for the key + */ + static void SetSettingValueL( const TUint32 aKey, const TInt aValue ); + + /** + * Get a setting from Central Repository + * @param aKey The requested Central Repository key + * @param aDefaultValue If key was not found, this is the value used + * @return The value of the requested key + */ + static TInt SettingValueL( const TUint32 aKey, const TInt aValue ); + + /** + * This method shows the out-of-memory confirmation query + * @param aMmc Shows qtn_memlo_not_enough_memory if EFalse or + * qtn_memlo_mmc_not_enough_memory if ETrue + */ + static void ShowMemoryFullConfirmationQueryL( TBool aMmc = EFalse ); + + /** + * This method is called if video or VOIP call is ongoing and + * information note needs to be shown + * @param aResourceId + */ + static void ShowUnsupportedCallTypeNoteL( TInt aResourceId ); + + /** + * This method appends the requested file type extension to filename + * @param aName Contains full file name after completion + * @param aType File type that defines the extension to be appended + */ + static void AppendExtension( TFileName& aName, TVRFiletype aType ); + + /** + * This method does the full check for the parameter filename existence + * @param aFs Reference to connected file server session handle + * @param aName Filename to check. No Path nor extension included. + * @return ETrue if file exists, EFalse otherwise + */ + static TBool DoesFileExistL( RFs& aFs, TFileName aName ); + + /** + * This method checks if parameter filename exists or not + * @param aFs Reference to connected file server session handle + * @param aName Filename to check. Path included. Extension excluded. + * @return ETrue if file exists, EFalse otherwise + */ + static TBool CheckFileExistence( RFs& aFs, TFileName aName ); + + }; + +#endif // __VRUTILS_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsSrc/DllMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsSrc/DllMain.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2002-2006 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: +* Dll entry point +* +* +*/ + + +// INCLUDES +#include + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsSrc/TVRRename.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsSrc/TVRRename.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,245 @@ +/* +* Copyright (c) 2002-2006 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 class encapsulates the functionality associated with renaming +* files in different situation. The implementation is made according +* to the Folders v.4.0 specification. +* +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include +#include "voicerecorder.hrh" +#include "TVRRename.h" + +// CONSTANTS +const TInt KMaxFileNameLength( 64 ); + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// TVRRename::TVRRename +// +// --------------------------------------------------------------------------- +// +EXPORT_C TVRRename::TVRRename( RFs& aFs ) : iFs( aFs ) + { + } + + +// --------------------------------------------------------------------------- +// TVRRename::GetNewNameL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TBool TVRRename::GetNewNameL( const TDesC& aOldName, + TDes& aNewName, + const TInt aPrompt ) + { + CCoeEnv* coeEnv = CCoeEnv::Static(); + + TParsePtrC nameParse( aOldName ); + TBuf fileName; + + // The query can fit only VRMEMONAMEMAXLENGTH characters + fileName.Copy( nameParse.Name().Left( VRMEMONAMEMAXLENGTH ) ); + + CAknStaticSizeDataQuerydialog* nameDlg = new( ELeave ) + CAknTextQueryDialog( fileName ); // CSI: 35 # + + nameDlg->PrepareLC( R_VR_RENAME_DIALOG ); + HBufC* prompt = StringLoader::LoadLC( aPrompt, coeEnv ); + nameDlg->SetPromptL( *prompt ); + CleanupStack::PopAndDestroy(); + + while ( nameDlg->RunLD() != 0 ) + { + // Construct the full path of the new proposed (by the user) name + aNewName.Copy( nameParse.DriveAndPath() ); + aNewName.Append( fileName ); + aNewName.Append( nameParse.Ext() ); + + TInt backslash = fileName.Find(_L( "\\" ) ); + + // Check that the name is valid for the fs32 + // Is ValidFileName does not check backslash + if ( iFs.IsValidName( aNewName ) && backslash == KErrNotFound ) + { + // Check if it exists? + if ( !BaflUtils::FileExists( iFs, aNewName ) || + aOldName == aNewName ) + { + // Nope => accepted + return ETrue; + } + + // Prompt the user for "Overwrite?" + prompt = StringLoader::LoadLC( R_QTN_FLDR_OVERWRITE_QUERY, + fileName, + coeEnv ); + + CAknQueryDialog* queryDlg = CAknQueryDialog::NewL(); + TBool accepted( queryDlg->ExecuteLD( R_VR_CONFIRMATION_QUERY, + *prompt ) ); + + CleanupStack::PopAndDestroy( prompt ); + + if ( accepted ) + { + // User accepted overwrite + return ETrue; + } + + // Create a new dialog for the next round + // TfileName. (CApaApplication::GenerateFileName needs it) + TFileName generatedName; + generatedName.Copy( nameParse.DriveAndPath() ); + generatedName.Append( fileName ); + generatedName.Append( nameParse.Ext() ); + User::LeaveIfError( + CApaApplication::GenerateFileName( iFs, generatedName ) ); + + TParsePtrC generatedNameParse( generatedName ); + TPtrC generatedNamePtr( generatedNameParse.Name() ); + if ( generatedNamePtr.Length() > VRMEMONAMEMAXLENGTH ) + { + // Name got too long => clip the suffix + fileName.Copy( generatedNamePtr.Left( + generatedNamePtr.LocateReverse( '(' ) ) ); + } + else + { + fileName.Copy( generatedNamePtr ); + } + + } + else + { + // The name wasn't a valid fs32 filename => show info note + HBufC* noteText = coeEnv->AllocReadResourceLC + ( R_QTN_FLDR_ILLEGAL_CHARACTERS ); + CAknInformationNote* infoNote = new( ELeave ) + CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy(); // noteText + } + + nameDlg = new( ELeave ) CAknTextQueryDialog( fileName ); + nameDlg->PrepareLC( R_VR_RENAME_DIALOG ); + } + + // User canceled + return EFalse; + } + + +// --------------------------------------------------------------------------- +// TVRRename::RenameL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TBool TVRRename::RenameL( TDes& aName, const TInt aPrompt ) + { + HBufC* oldName = aName.AllocLC(); + if ( GetNewNameL( *oldName, aName, aPrompt ) ) + { + TInt err ( BaflUtils::RenameFile( iFs, *oldName, aName ) ); + if ( err ) + { + // Show error note "Unable to rename %U" + CAknInformationNote* infoNote = NULL; + TParsePtrC parse( oldName->Des() ); + HBufC* noteText = StringLoader::LoadLC( R_QTN_FLDR_CANT_RENAME_ITEM, + parse.Name(), + CCoeEnv::Static() ); + if ( !noteText ) + { + CleanupStack::PopAndDestroy(); // oldName + return EFalse; + } + + infoNote = new( ELeave ) CAknInformationNote( ETrue ); + if ( infoNote ) + { + infoNote->ExecuteLD( *noteText ); + } + CleanupStack::PopAndDestroy( 2 ); // oldName, noteText + return EFalse; + } + + CleanupStack::PopAndDestroy( oldName ); + return ETrue; + } + else + { + CleanupStack::PopAndDestroy( oldName ); + return EFalse; + } + } + + +// --------------------------------------------------------------------------- +// TVRRename::RenameL +// The file handle may not point to private folder, since renaming can't be +// used in embedded mode +// --------------------------------------------------------------------------- +// +EXPORT_C TBool TVRRename::RenameL( RFile& aFile, const TInt aPrompt ) + { + TFileName name( KNullDesC ); + aFile.FullName( name ); + HBufC* oldName = name.AllocLC(); + + if ( GetNewNameL( *oldName, name, aPrompt ) ) + { + aFile.Close(); + TInt err ( BaflUtils::RenameFile( iFs, *oldName, name ) ); + if ( err ) + { + // Show error note "Unable to rename %U" + // and open the old file again + User::LeaveIfError( aFile.Open( iFs, oldName->Des(), + EFileShareReadersOnly ) ); + + CAknInformationNote* infoNote = NULL; + TParsePtrC parse( oldName->Des() ); + HBufC* noteText = StringLoader::LoadLC( + R_QTN_FLDR_CANT_RENAME_ITEM, parse.Name(), CCoeEnv::Static() ); + + infoNote = new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + + CleanupStack::PopAndDestroy( 2 ); // oldName, noteText + return EFalse; + } + CleanupStack::PopAndDestroy( oldName ); + User::LeaveIfError( aFile.Open( iFs, name, EFileShareReadersOnly ) ); + return ETrue; + } + else + { + CleanupStack::PopAndDestroy( oldName ); + return EFalse; + } + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsSrc/VRUSBStateHanlder.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,159 @@ +/* +* Copyright (c) 2002-2006 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: +* CVRUSBStateHanlder implementation +* +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include + +#include +#include + +#include "VRUSBStateHanlder.h" +#include "CVRRecView.h" + +CVRUSBStateHanlder::CVRUSBStateHanlder(MVRUSBStateObserver* aObserver) : + CActive(EPriorityStandard), // Standard priority + iObserver(aObserver), + iConnectionStatus(EStateUninitialized) + { + } + +EXPORT_C CVRUSBStateHanlder* CVRUSBStateHanlder::NewL( + MVRUSBStateObserver* aObserver) + { + CVRUSBStateHanlder* self = new (ELeave) CVRUSBStateHanlder(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); // self; + return self; + } + +void CVRUSBStateHanlder::ConstructL() + { +#ifdef DUMMY_USB_TESTING + User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer +#else + iProperty.Attach(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality); +#endif + CActiveScheduler::Add(this); // Add to scheduler + StartL(); + } + +CVRUSBStateHanlder::~CVRUSBStateHanlder() + { + Cancel(); // Cancel any request, if outstanding +#ifdef DUMMY_USB_TESTING + iTimer.Close(); +#else + iProperty.Close(); +#endif + } + +void CVRUSBStateHanlder::DoCancel() + { +#ifdef DUMMY_USB_TESTING + iTimer.Cancel(); +#else + iProperty.Cancel(); +#endif + + } + +void CVRUSBStateHanlder::StartL() + { + Cancel(); // Cancel any request, just to be sure +#ifdef DUMMY_USB_TESTING + iTimer.After(iStatus, 10000000); // Set for later + SetActive(); // Tell scheduler a request is active +#else + SetActive(); + iProperty.Subscribe(iStatus); +#endif + } + +void CVRUSBStateHanlder::RunL() + { +#ifdef DUMMY_USB_TESTING + CDummyUSBState::HandleUSBEventL(); +#else + StartL(); +#endif + + + TBool isUsbActive (IsUsbActive()); + + if (isUsbActive) + { + if(iConnectionStatus != EStateConnected) + { + iObserver->HandleUsbPlugInL(); + iConnectionStatus = EStateConnected; + } + } + else + { + if(iConnectionStatus != EStateDisConnected) + { + iObserver->HandleUsbPlugOutL(); + iConnectionStatus = EStateDisConnected; + } + } + +#ifdef DUMMY_USB_TESTING + // iStatus = KRequestPending; + SetActive(); // Tell scheduler a request is active + iTimer.After(iStatus, 10000000); // Set for later + + +#endif + + + } + +TInt CVRUSBStateHanlder::RunError(TInt aError) + { + return aError; + } + +EXPORT_C TBool CVRUSBStateHanlder::IsUsbActive() + { +#ifdef DUMMY_USB_TESTING + //dummy + return CDummyUSBState::IsUSBActive(); +#else + + TInt usbState; + TInt err = RProperty::Get(KPSUidUsbWatcher, + KUsbWatcherSelectedPersonality, usbState); + + if (KErrNone == err && KUsbPersonalityIdMS == usbState) + { + return true; + } + else + { + return false; + } +#endif + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/UtilsSrc/VRUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/UtilsSrc/VRUtils.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,1172 @@ +/* +* Copyright (c) 2002-2006 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 class contains a collection of small static utility functions +* needed all around the application. The class has no prefix letter +* +* +*/ + + +// INCLUDES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#endif + +#include "VoiceRecorderInternalCRKeys.h" +#include "VRUtils.h" +#include "VRConsts.h" +#include + +// CONSTANTS +_LIT( KVRAMRFileNameExtension, ".amr" ); +_LIT( KVRWAVFileNameExtension, ".wav" ); + +// added for AAC +#ifdef __AAC_ENCODER_PLUGIN +_LIT( KVRAAC_LCFileNameExtension,".mp4" ); +#endif + +_LIT( KVROneToNineClipCountFormat, "%02d" ); // used with clip numbers 1..9 +_LIT( KVRDefaultClipCountFormat, "%d" ); // used with clip numbers 10-> + + +// ================= MEMBER FUNCTIONS ======================================== + +// --------------------------------------------------------------------------- +// VRUtils::MemoStoreDirectoryL +// Checks what is the current storage place and returns the corresponding path +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::MemoStoreDirectoryL( TDes &aPath ) + { + + TFileName phoneMemoryPath; + +#ifndef RD_MULTIPLE_DRIVE + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + + TVRMemoStore memoStore = MemoStoreL(); + if ( memoStore == EMemoStorePhoneMemory ) + { + phoneMemoryPath = PathInfo::PhoneMemoryRootPath(); + phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( phoneMemoryPath ); + return; + } + else + { + // MMC is the selected memo store. Check if it's available. + TVRDriveInfo mmcInfo; + GetMMCInfo( mmcInfo ); + if ( mmcInfo.iDrivePresent && !mmcInfo.iDriveLocked && + !mmcInfo.iDriveCorrupted && !mmcInfo.iDriveReadOnly ) + { + // MMC usage is OK. + TFileName mmcPath = PathInfo::MemoryCardRootPath(); + mmcPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( mmcPath ); + return; + } + else + { + // MMC is unavailable => return phone memory path + phoneMemoryPath = PathInfo::PhoneMemoryRootPath(); + phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( phoneMemoryPath ); + return; + } + + } + + } + else + { + phoneMemoryPath = PathInfo::PhoneMemoryRootPath(); + phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( phoneMemoryPath ); + return; + } + +// using multiple drive +#else + TInt memoDrive = MemoDriveL(); + TInt defaultDrive(0); + User::LeaveIfError( defaultDrive = DefaultMemoDriveL()); + //default drive + if ( memoDrive == defaultDrive ) + { + User::LeaveIfError( PathInfo::GetRootPath( phoneMemoryPath, memoDrive ) ); + phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( phoneMemoryPath ); + return; + } + // other drives + else + { + TUint status( 0 ); + TInt err = VRUtils::GetDriveInfo(memoDrive, status); + // check if drive status is ok + if ( ( err == KErrNone ) && (status & DriveInfo::EDrivePresent) && !(status & DriveInfo::EDriveLocked) && + !( status & DriveInfo::EDriveCorrupt ) && !( status & DriveInfo::EDriveReadOnly ) ) + { + // Drive usage is OK. + User::LeaveIfError( PathInfo::GetRootPath( phoneMemoryPath, memoDrive ) ); + phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( phoneMemoryPath ); + return; + } + + // if not ok, save to default device drive + else + { + memoDrive = defaultDrive; + User::LeaveIfError( PathInfo::GetRootPath( phoneMemoryPath, memoDrive ) ); + phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() ); + aPath.Copy( phoneMemoryPath ); + return; + } + + } +#endif + } + + +// --------------------------------------------------------------------------- +// VRUtils::SetMemoStoreL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::SetMemoStoreL( TVRMemoStore aMemory ) + { + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + SetSettingValueL( KVRMemoStore, aMemory ); + } + else + { + __ASSERT_DEBUG( ETrue, User::Panic( KVRPanic, EPanicInvalidSetting ) ); + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::MemoStoreL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TVRMemoStore VRUtils::MemoStoreL() + { + // Phone memory is the default + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + TInt ret = SettingValueL( KVRMemoStore, + EMemoStorePhoneMemory ); + return static_cast< TVRMemoStore >( ret ); + } + else + { + return EMemoStorePhoneMemory; + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::DefaultSpeakerL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TVRSpeaker VRUtils::DefaultSpeakerL() + { + if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) && + FeatureManager::FeatureSupported( + KFeatureIdApplicationControllableAudioRouting ) ) + { + return ( TVRSpeaker ) SettingValueL( KVRDefaultSpeaker, ESpeakerIhf ); + } + else + { + return ESpeakerIhf; + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::SetDefaultSpeakerL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::SetDefaultSpeakerL( const TVRSpeaker aSpeaker ) + { + if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoVoiceKey ) && + FeatureManager::FeatureSupported( + KFeatureIdApplicationControllableAudioRouting ) ) + { + SetSettingValueL( KVRDefaultSpeaker, aSpeaker ); + } + else + { + __ASSERT_DEBUG( ETrue, User::Panic( KVRPanic, EPanicInvalidSetting ) ); + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::QualityL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TVRQuality VRUtils::QualityL() + { + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + return ( TVRQuality ) SettingValueL( KVRQuality, + EQualityMMSOptimized ); + } + else + { + return EQualityMMSOptimized; + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::SetQualityL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::SetQualityL( const TVRQuality aQuality ) + { + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + SetSettingValueL( KVRQuality, aQuality ); + } + else + { + __ASSERT_DEBUG( ETrue, User::Panic( KVRPanic, EPanicInvalidSetting ) ); + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::SetDefaultVolumeL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::SetDefaultVolumeL( const TVRSpeaker aSpeaker, + const TInt aVolume ) + { + switch ( aSpeaker ) + { + case ESpeakerEarPiece: + { + SetSettingValueL( KVREarPieceVolume, aVolume ); + break; + } + case ESpeakerIhf: + { + SetSettingValueL( KVRIHFVolume, aVolume ); + break; + } + default: + { + break; + } + } + return; + } + + +// --------------------------------------------------------------------------- +// VRUtils::DefaultVolumeL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt VRUtils::DefaultVolumeL( const TVRSpeaker aSpeaker ) + { + TInt volume( KVRDefaultVolume ); + switch ( aSpeaker ) + { + case ESpeakerEarPiece: + { + volume = SettingValueL( KVREarPieceVolume, KVRDefaultVolume ); + break; + } + case ESpeakerIhf: + { + volume = SettingValueL( KVRIHFVolume, KVRDefaultVolume ); + break; + } + default: + { + break; + } + } + return volume ? volume : KVRDefaultVolume; + } + + + +// --------------------------------------------------------------------------- +// VRUtils::SetSettingValueL, +// save the data to central repository +// --------------------------------------------------------------------------- +// +void VRUtils::SetSettingValueL( const TUint32 aKey, const TInt aValue ) + { + CRepository* repository = CRepository::NewL( KCRUidVoiceRecorder ); + CleanupStack::PushL( repository ); + User::LeaveIfError( repository->Set( aKey, aValue ) ); + CleanupStack::PopAndDestroy( repository ); + } + + +// --------------------------------------------------------------------------- +// VRUtils::SettingValueL +// +// --------------------------------------------------------------------------- +// +TInt VRUtils::SettingValueL( const TUint32 aKey, const TInt aDefaultValue ) + { + TInt data; + + CRepository* repository = CRepository::NewL( KCRUidVoiceRecorder ); + CleanupStack::PushL( repository ); + + // Get the value, create the key if no value was found + if ( repository->Get( aKey, data ) != KErrNone ) + { + User::LeaveIfError( repository->Create( aKey, aDefaultValue ) ); + data = aDefaultValue; + } + + CleanupStack::PopAndDestroy( repository ); + + return data; + } + + +// --------------------------------------------------------------------------- +// VRUtils::GetMMCInfo +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::GetMMCInfo( TVRDriveInfo& aMMCInfo ) + { + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + TDriveInfo driveInfo; + TVolumeInfo volumeInfo; + RFs& fss = CCoeEnv::Static()->FsSession() ; + + TInt err( fss.Drive( driveInfo, EDriveE ) ); + + if ( driveInfo.iType != EMediaNotPresent ) + { + aMMCInfo.iDrivePresent = ETrue; + if ( fss.Volume( volumeInfo, EDriveE ) == KErrCorrupt ) + { + aMMCInfo.iDriveCorrupted = ETrue; + } + else + { + aMMCInfo.iDriveCorrupted = EFalse; + } + } + else + { + aMMCInfo.iDriveCorrupted = EFalse; + aMMCInfo.iDrivePresent = EFalse; + } + + if ( driveInfo.iMediaAtt & KMediaAttLocked || err == KErrLocked ) + { + aMMCInfo.iDriveLocked = ETrue; + } + else + { + aMMCInfo.iDriveLocked = EFalse; + } + + if ( driveInfo.iMediaAtt & KMediaAttWriteProtected ) + { + aMMCInfo.iDriveReadOnly = ETrue; + } + else + { + aMMCInfo.iDriveReadOnly = EFalse; + } + if ( volumeInfo.iFree ==0 ) + { + aMMCInfo.iDriveFull = ETrue; + } + else + { + aMMCInfo.iDriveFull = EFalse; + } + + + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::ShowMemoryFullConfirmationQuery +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::ShowMemoryFullConfirmationQuery( TBool aMmc ) + { + // Error ignored. If the note fails, there's nothing to do. + TRAP_IGNORE( ShowMemoryFullConfirmationQueryL( aMmc ) ); + } + + +// --------------------------------------------------------------------------- +// VRUtils::UnsupportedCallTypeOngoing +// +// --------------------------------------------------------------------------- +// +EXPORT_C TBool VRUtils::UnsupportedCallTypeOngoing( TBool aShowNote ) + { + TBool unsupported( EFalse ); + TInt value( 0 ); + + TInt err( 0 ); + RProperty property; + err = property.Attach( KPSUidCtsyCallInformation, KCTsyCallState ); + if ( err ) + { + return EFalse; + } + + property.Get( value ); + + switch ( value ) + { + case EPSCTsyCallStateUninitialized: + case EPSCTsyCallStateNone: + { // No any kind of call in progress + return EFalse; + } + default: // Call in progress, check if it is videocall + { + err = property.Attach( KPSUidCtsyCallInformation, KCTsyCallType); + if ( err ) + { + return EFalse; + } + value = 0; + property.Get( value ); + break; + } + } + + switch( value ) + { + // Video call ongoing + case EPSCTsyCallTypeH324Multimedia: + { + unsupported = ETrue; + + if ( aShowNote ) + { + // If the note fails, it's no big deal + TRAP_IGNORE( ShowUnsupportedCallTypeNoteL( + R_VR_VIDEO_CALL_INFONOTE_LABEL ) ); + } + break; + } + // Voip call ongoing + case EPSCTsyCallTypeVoIP: + { + unsupported = ETrue; + + if ( aShowNote ) + { + // If the note fails, it's no big deal + TRAP_IGNORE( ShowUnsupportedCallTypeNoteL( + R_VR_INTERNET_CALL_INFONOTE_LABEL ) ); + } + break; + } + } + + return unsupported; + } + + +// --------------------------------------------------------------------------- +// VRUtils::ShowMemoryFullConfirmationQueryL +// +// --------------------------------------------------------------------------- +// +void VRUtils::ShowMemoryFullConfirmationQueryL( TBool aMmc ) + { + CAknGlobalNote* note = NULL; + + note = CAknGlobalNote::NewLC(); + + HBufC* label = NULL; + TInt noteId( 0 ); + if ( aMmc ) + { + noteId = R_VR_MEMORY_MMC_WARNING; + } + else + { + noteId = R_VR_MEMORY_WARNING; + } + + label = StringLoader::LoadLC( noteId ); + + note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY ); + note->ShowNoteL( EAknGlobalWarningNote, *label ); + CleanupStack::PopAndDestroy( 2 ); // label, note; + } + + +// --------------------------------------------------------------------------- +// VRUtils::ShowUnsupportedCallTypeNoteL +// +// --------------------------------------------------------------------------- +// +void VRUtils::ShowUnsupportedCallTypeNoteL( TInt aResourceId ) + { + CAknInformationNote* infoNote; + HBufC* noteText; + + noteText = CEikonEnv::Static()-> + AllocReadResourceLC( aResourceId ); + + infoNote = new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + + CleanupStack::PopAndDestroy( noteText ); + } + + +// --------------------------------------------------------------------------- +// VRUtils::MaxLengthL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt VRUtils::MaxLengthL() + { + // If no value can be retrieved, use 60 minutes as max length + TInt value( 0 ); + +#ifdef __AAC_ENCODER_PLUGIN // mp4 is supported now. + if (QualityL() == EQualityHigh) + { + TRAPD( err, value = SettingValueL( KVRAacRecordLength, + KVRDefaultAacRecordLength ) ); + + if ( err || value <= 0 || value > 9999 ) + { + return KVRDefaultAacRecordLength; + } + } +#endif + TRAPD( err, value = SettingValueL( KVRMaxRecordTime, + KVRDefaultMaxLength ) ); + + if ( err || value <= 0 || value > 9999 ) + { + return KVRDefaultMaxLength; + } + + + return value; + } + + +// --------------------------------------------------------------------------- +// VRUtils::FeatureEnabled +// +// --------------------------------------------------------------------------- +// +EXPORT_C TBool VRUtils::FeatureEnabled( TVRFeature aFeature ) + { + TBool ret( EFalse ); + TInt data( 0 ); + + TRAPD( err, data = SettingValueL( KVRVariationFlags, 0 ) ); + if( err != KErrNone ) + { + return EFalse; + } + + // Compare feature to bitmask + if ( data & aFeature ) + { + ret = ETrue; + } + return ret; + } + + +// --------------------------------------------------------------------------- +// VRUtils::GenerateUniqueFilename +// Generates unique filename that doesn't exist in the directories where VR +// operates in. Unique filename is generated in Media Gallery sense so that no +// two sound clips can have same name there +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::GenerateUniqueFilenameL( RFs& aFs, TFileName& aName, + TVRFiletype aType ) + { + + TBuf< VRLABELMAXLENGTH > valueStr; + TBuf< VRLABELMAXLENGTH > formatStr; + TFileName name( aName ); + TFileName clipName; // Used for file existence checking + TBool fileExists( EFalse ); + + // Get current count from cenrep + TInt value( MemoCount() ); + + TBool uniqueFound( EFalse ); + + // First memo + if ( !value ) + { + StringLoader::Load( formatStr, R_VOREC_FIRST_MEMO_NAME ); + name.Append( formatStr ); + clipName.Append( formatStr ); + + TRAPD( err1, fileExists = DoesFileExistL( aFs, clipName ) ); + if ( err1 ) + { + // if error occurs, no much to do->generate new filename + fileExists = ETrue; + } + + AppendExtension( name, aType ); + + if ( fileExists ) + { + // Memo exists, continue name generation with next name + ++value; + } + else + { + uniqueFound = ETrue; + ++value; // This is saved to cenrep + } + } + + // Continue generation + if ( !uniqueFound ) + { + StringLoader::Load( formatStr, R_VOREC_DEFAULT_MEMO_NAME ); + + + // Loop until unique filename is generated + FOREVER + { + // 0 is added before clip number when number is between 1 and 9 + if(value >= 1 && value <= 9) + { + valueStr.Format( KVROneToNineClipCountFormat, value); + } + // no addings for clip numbers 10-> + else + { + valueStr.Format( KVRDefaultClipCountFormat, value); + } + + StringLoader::Format( name, formatStr, -1, valueStr ); + + // name copied before the path is added + clipName = name; + + // Insert path to beginning + name.Insert( 0, aName ); + + AknTextUtils::LanguageSpecificNumberConversion( name ); + + TRAPD( err2, fileExists = DoesFileExistL( aFs, clipName ) ); + if ( err2 ) + { + fileExists = ETrue; + } + + AppendExtension( name, aType ); + if ( !fileExists ) + { + // Accept the name and increase value + // Value increasing is mandatory to prevent similarly named clips when quality + // or store place is changed + ++value; + break; + } + // Try next... + ++value; + } + } + + aName = name; + + // Save the new value to cenrep + SetMemoCount( value ); + } + + +// --------------------------------------------------------------------------- +// VRUtils::AppendExtension +// +// --------------------------------------------------------------------------- +// +void VRUtils::AppendExtension( TFileName& aName, TVRFiletype aType ) + { + switch ( aType ) + { + case EVRFileWav: + { + aName.Append( KVRWAVFileNameExtension ); + break; + } + +//Jeffery: the following case added for the new CR +#ifdef __AAC_ENCODER_PLUGIN + case EVRFileAAC_LC: + { + aName.Append( KVRAAC_LCFileNameExtension ); + break; + } +#endif + + // In error case amr extension is appended + case EVRFileAmr: + default: + { + aName.Append( KVRAMRFileNameExtension ); + break; + } + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::MemoCount +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt VRUtils::MemoCount() + { + // If no value can be retrieved, use zero + TInt value( 0 ); + TRAPD( err, value = SettingValueL( KVRMemoCount, 0 ) ); + if ( err != KErrNone ) + { + return 0; + } + return value; + } + + +// --------------------------------------------------------------------------- +// VRUtils::SetMemoCount +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::SetMemoCount( TInt aNewCount ) + { + TRAP_IGNORE( SetSettingValueL( KVRMemoCount, aNewCount ) ); + } + + +// --------------------------------------------------------------------------- +// VRUtils::AMRBitrateL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TUint VRUtils::AMRBitrateL() + { + TUint bitrate(KVRDefaultAmrBitrate); + + // Fetch bitrate from + TRAPD( err, bitrate = SettingValueL( KVRBitrateAmr, + KVRDefaultAmrBitrate ) ); + + if ( err || bitrate <= 0 || bitrate > 12200 ) + { + bitrate = KVRDefaultAmrBitrate; + } + + return bitrate; + } + + +// --------------------------------------------------------------------------- +// VRUtils::AACBitrateL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TUint VRUtils::AACBitrateL() + { + + TUint bitrate(KVRDefaultBitrateAac); + + // Fetch bitrate from + TRAPD( err, bitrate = SettingValueL( KVRBitrateAac, + KVRDefaultBitrateAac ) ); + + if ( err || bitrate <= 8000 || bitrate > 288000 ) + { + bitrate = KVRDefaultBitrateAac; + } + return bitrate; + } + +// --------------------------------------------------------------------------- +// VRUtils::DoesFileExistL +// Makes the full checking if the filename (aName) exists in the directories +// that Voice Recorder uses for clip storage +// --------------------------------------------------------------------------- +// +TBool VRUtils::DoesFileExistL( RFs& aFs, TFileName aName ) + { +// old memory storage +#ifndef RD_MULTIPLE_DRIVE + // Storage place at the moment + TVRMemoStore memoStore = MemoStoreL(); + TFileName path; + TFileName fileName(aName); + + // The path for the current storage place + VRUtils::MemoStoreDirectoryL( path ); + + // Add the path to the filename + fileName.Insert( 0, path ); + + if ( CheckFileExistence( aFs, fileName ) ) + { + return ETrue; + } + + // Check possible alternative storage place + TVRMemoStore secondaryStore; + if ( memoStore == EMemoStorePhoneMemory ) + { + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + secondaryStore = EMemoStoreMMC; + } + else + { + secondaryStore = EMemoStorePhoneMemory; + } + } + else + { + secondaryStore = EMemoStorePhoneMemory; + } + + // If there is some secondary storage place to check + if( memoStore != secondaryStore ) + { + // Temporarily change the storage place (needed by MemoStoreDirectoryL) + VRUtils::SetSettingValueL( KVRMemoStore, secondaryStore ); + + // Retrieve the path and add it to the filename + VRUtils::MemoStoreDirectoryL( path ); + + fileName = aName; + fileName.Insert( 0, path ); + + // Change back to the original + VRUtils::SetSettingValueL( KVRMemoStore, memoStore ); + + if ( CheckFileExistence( aFs, fileName ) ) + { + return ETrue; + } + } + +// for multiple drives +#else + TFileName path; + TFileName fileName(aName); + + TDriveList allDrives; + TInt allDriveCount( 0 ); + + User::LeaveIfError(DriveInfo::GetUserVisibleDrives( aFs, allDrives, allDriveCount )); + + TInt max( allDrives.Length()); + for ( TInt i = 0; i < max; i++ ) + { + if ( allDrives[ i ] ) + { + TUint status( 0 ); + VRUtils::GetDriveInfo( i, status); + + if( status & DriveInfo::EDriveRemote ) + { + continue; + } + + User::LeaveIfError( PathInfo::GetRootPath( path, i) ); + path.Append( PathInfo::DigitalSoundsPath() ); + + // Add the path to the filename + fileName.Insert( 0, path ); + + if ( CheckFileExistence( aFs, fileName ) ) + { + return ETrue; + } + + fileName.Copy(aName); + } + } +#endif + + return EFalse; + + } + + +// --------------------------------------------------------------------------- +// VRUtils::CheckFileExistence +// Checks if the filename given as a parameter exists. This function checks all +// possible extensions (in VR). Note that aName includes path but no extension. +// --------------------------------------------------------------------------- +// +TBool VRUtils::CheckFileExistence( RFs& aFs, TFileName aName ) + { + TFileName fileName( aName ); + + // AMR file + AppendExtension( fileName, EVRFileAmr ); + AknTextUtils::LanguageSpecificNumberConversion( fileName ); + if ( BaflUtils::FileExists( aFs, fileName ) ) + { + return ETrue; + } + + // WAV file + fileName = aName; + AppendExtension( fileName, EVRFileWav ); + AknTextUtils::LanguageSpecificNumberConversion( fileName ); + if ( BaflUtils::FileExists( aFs, fileName ) ) + { + return ETrue; + } + + + // AAC_LC file + #ifdef __AAC_ENCODER_PLUGIN + fileName = aName; + AppendExtension( fileName, EVRFileAAC_LC ); + AknTextUtils::LanguageSpecificNumberConversion( fileName ); + + if ( BaflUtils::FileExists( aFs, fileName ) ) + { + return ETrue; + } + #endif + + return EFalse; + } + + +// --------------------------------------------------------------------------- +// VRUtils::AACSamplerateL +// --------------------------------------------------------------------------- +// + +EXPORT_C TInt VRUtils::AACSamplerateL() + { + + TUint samplerate( KVRDefaultSamplerateAac ); + + // Fetch bitrate from + TRAPD( err, samplerate = SettingValueL( KVRSamplerateAac, + KVRDefaultSamplerateAac ) ); + + if ( err || samplerate < 8000 || samplerate > 48000 ) + { + return KVRDefaultSamplerateAac; + } + + + return samplerate; + } + + +// --------------------------------------------------------------------------- +// VRUtils::AACAudioModeL +// --------------------------------------------------------------------------- +// + +EXPORT_C TInt VRUtils::AACAudioModeL() + { + + TUint mode( KVRDefaultStereoMonoFlag ); + + // Fetch audiomode from + TRAPD( err, mode = SettingValueL( KVRStereoMonoFlag, + KVRDefaultStereoMonoFlag ) ); + + if ( err || (mode != 1 && mode != 2)) + { + return KVRDefaultStereoMonoFlag; + } + + + return mode; + } + +// --------------------------------------------------------------------------- +// DriveValid checks the drive is valid or not +// --------------------------------------------------------------------------- +// +EXPORT_C TBool VRUtils::DriveValid( const TInt aDrive ) + { + TUint status( 0 ); + TBool flag( ETrue ); + TInt err = VRUtils::GetDriveInfo( aDrive, status ); + if ( err != KErrNone ) + { flag = EFalse; } + else + { + if ( !(status & DriveInfo::EDrivePresent) || + (status & DriveInfo::EDriveLocked) || + (status & DriveInfo::EDriveReadOnly) || + (status & DriveInfo::EDriveCorrupt) || + (status & DriveInfo::EDriveInUse) ) + { flag = EFalse; } + } + return flag; + + } + +EXPORT_C TBool VRUtils::MultipleMassStorageAvailable() + { + TBool flag( ETrue ); + TInt driveDefaultMassStorage(0); + TInt driveRemovableMassStorage(0); + TInt defaultStorageErr = DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultMassStorage, driveDefaultMassStorage ); + TInt removableStorageErr = DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRemovableMassStorage, driveRemovableMassStorage ); + if ( (defaultStorageErr) || (removableStorageErr) || + ( driveDefaultMassStorage == driveRemovableMassStorage ) ) + { flag = EFalse; } + + return flag; + } + +EXPORT_C TInt VRUtils::GetRemovableMassStorageL() + { + TInt drive(0); + User::LeaveIfError( DriveInfo::GetDefaultDrive( + DriveInfo::EDefaultRemovableMassStorage , drive ) ); + return drive; + } + +#ifdef RD_MULTIPLE_DRIVE +// --------------------------------------------------------------------------- +// VRUtils::SetMemoDriveL +// +// --------------------------------------------------------------------------- +// +EXPORT_C void VRUtils::SetMemoDriveL( TDriveNumber aDrive ) + { + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + SetSettingValueL( KVRMemoStore, aDrive ); + } + else + { + __ASSERT_DEBUG( ETrue, User::Panic( KVRPanic, EPanicInvalidSetting ) ); + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::MemoDriveL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt VRUtils::MemoDriveL() + { + TInt defaultDrive = DefaultMemoDriveL(); + // Phone memory is the default + if ( FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + TInt ret = SettingValueL( KVRMemoStore, + defaultDrive ); + return static_cast< TInt >( ret ); + } + else + { + return defaultDrive; + } + } + + +// --------------------------------------------------------------------------- +// VRUtils::DefaultMemoDriveL +// +// --------------------------------------------------------------------------- +// +EXPORT_C TInt VRUtils::DefaultMemoDriveL() + { + TInt drive(0); + User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) ); + return drive; + } + + +// --------------------------------------------------------------------------- +// VRUtils::Get drive Info +// it is for multiple drive feature +// --------------------------------------------------------------------------- +// +EXPORT_C TInt VRUtils::GetDriveInfo( TInt aDrive, TUint& aDriveInfo ) + { + RFs& iFs = CCoeEnv::Static()->FsSession() ; + TInt err = DriveInfo::GetDriveStatus( iFs, aDrive, aDriveInfo ); + return err; + } +#endif + + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/cenrep/keys_voicerecorder.xls Binary file voicerecorder/cenrep/keys_voicerecorder.xls has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/App.lnt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/App.lnt Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,12 @@ +// Unused header scan ++e766 + +// standard lint check +-w2 + +-i..\RecViewInc +-i..\UtilsInc +-i..\AppSrc +-i\epoc32\include\oem + +..\AppSrc\*.cpp diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/NewService.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/NewService.mmp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002-2006 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: +* NewService mmp file +* +* +*/ + + +#include + +TARGET NewService.dll +TARGETTYPE dll + +// the following UIDs are exported to system include by VoiceRecorderUID.h +UID 0x1000008d 0x101F8862 + +VERSION 10.0 + +LANG SC +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../NewServiceSrc +SOURCE DllMain.cpp +SOURCE CNewFileServiceClientImpl.cpp +SOURCE CNewFileServiceDiscovery.cpp +SOURCE RNewFileServiceClient.cpp +SOURCE CNewFileServiceBase.cpp +SOURCE cnewfileserviceserverobserver.cpp + + +USERINCLUDE ../NewServiceInc +USERINCLUDE ../group +USERINCLUDE ../NewServiceSrc +USERINCLUDE ../../inc // ADo level inc dir +APP_LAYER_SYSTEMINCLUDE + +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY eikcore.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY ServiceHandler.lib diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/ProjLint.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/ProjLint.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,19 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Use lint for Project static analysis. +rem + +call "c:\Program Files\tools\Lint\lint" Utils.lnt +call "c:\Program Files\tools\Lint\lint" RecView.lnt +call "c:\Program Files\tools\Lint\lint" App.lnt diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/RecView.lnt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/RecView.lnt Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,12 @@ +// Unused header scan ++e766 + +// standard lint check +-w2 + +-i..\RecViewSrc +-i..\RecViewInc +-i..\UtilsInc +-i\epoc32\include\oem + +..\RecViewSrc\*.cpp diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/RecView.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/RecView.mmp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2002-2006 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: +* RecView mmp file +* +* +*/ + + +#include + +TARGET VoiceRecorderRecView.dll +TARGETTYPE dll + +// the following UIDs are exported to system include by VoiceRecorderUID.h +UID 0x1000008d 0x100058CA + +VERSION 10.0 + +LANG SC +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../RecViewSrc +SOURCE DllMain.cpp +SOURCE CVRButtonPanel.cpp +SOURCE CVRLabel.cpp +SOURCE CVRRecViewContainer.cpp +SOURCE CVRRecViewActivationContainer.cpp +SOURCE CVRRecViewModel.cpp +SOURCE CVRRecView.cpp +SOURCE CVRMdaRecorder.cpp +SOURCE CVRSystemEventHandler.cpp +SOURCE CVRMemo.cpp +SOURCE CVRStateInfoPanel.cpp +SOURCE TVRState.cpp +SOURCE CVRRemConObserver.cpp +SOURCE CVRTonePlayer.cpp +SOURCE CVRDiskSpaceWatcher.cpp +SOURCE CVRMediaRemovalMonitor.cpp + +USERINCLUDE ../RecViewSrc +USERINCLUDE ../RecViewInc +USERINCLUDE ../group +USERINCLUDE ../UtilsInc +USERINCLUDE ../../inc // ADo level inc dir + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY eikcoctl.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY euser.lib +LIBRARY featmgr.lib + +LIBRARY aknnotify.lib +LIBRARY commonengine.lib +LIBRARY commonui.lib // CErrorUI +LIBRARY mediaclientaudio.lib +LIBRARY sendui.lib // CSendAppUi + +LIBRARY sysutil.lib +LIBRARY voicerecorderutils.lib +LIBRARY aknskins.lib +LIBRARY platformenv.lib // PathInfo +LIBRARY apgrfx.lib // RApaLsSession +LIBRARY apmime.lib // TDataType +LIBRARY ws32.lib + +LIBRARY CdlEngine.lib +LIBRARY AknIcon.lib +LIBRARY centralrepository.lib +LIBRARY RemConCoreApi.lib // CRemConCoreApiTarget +LIBRARY RemConInterfaceBase.lib // CRemConInterfaceSelector +LIBRARY aknlayout2scalable.lib +LIBRARY HWRMLightClient.lib // for light control + +LIBRARY ServiceHandler.lib // For AIW + +#ifdef RD_MULTIPLE_DRIVE +LIBRARY PlatformEnv.lib +#endif + +LIBRARY AudioInputRouting.lib +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/RecViewLint.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/RecViewLint.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Use lint for RecView static analysis. +rem + +"c:\Program Files\tools\Lint\lint" RecView.lnt + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/Utils.lnt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/Utils.lnt Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,11 @@ +// Unused header scan ++e766 + +// standard lint check +-w2 + +-i..\UtilsSrc +-i..\UtilsInc +-i\epoc32\include\oem + +..\UtilsSrc\*.cpp \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/Utils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/Utils.mmp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2002-2006 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 project specification file for the Voice Recorder utils +* +* +*/ + + +#include +#include + +TARGET VoiceRecorderUtils.dll +TARGETTYPE DLL + +// the following UIDs are exported to system include by VoiceRecorderUID.h +UID 0x1000008d 0x100058CA + +VERSION 10.0 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../UtilsSrc +SOURCE TVRRename.cpp +SOURCE DllMain.cpp +SOURCE VRUtils.cpp VRUSBStateHanlder.cpp + +USERINCLUDE ../UtilsInc ../group ../../inc .. +USERINCLUDE ../RecViewInc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY avkon.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY apparc.lib +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY aknnotify.lib +LIBRARY platformenv.lib // PathInfo +LIBRARY featmgr.lib +LIBRARY commonengine.lib +LIBRARY centralrepository.lib + +#ifdef RD_MULTIPLE_DRIVE +LIBRARY PlatformEnv.lib +#if defined(ARMCC) +deffile ../EABI/VoiceRecorderUtilsU.DEF +#elif defined( WINS ) +deffile ../BWINS/VoiceRecorderUtilsU.DEF +#endif + +#else +#if defined(ARMCC) +deffile ../EABI/VoiceRecorderUtils.DEF +#elif defined( WINS ) +deffile ../BWINS/VoiceRecorderUtils.def +#endif + +#endif + + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/UtilsLint.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/UtilsLint.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,17 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Use lint for Utils static analysis. +rem + +"c:\Program Files\tools\Lint\lint" Utils.lnt diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VRConsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VRConsts.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2002 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 header file defines some constants, string literals and +* enumerations used globally in Voice Recorder. +* +*/ + + +#ifndef __VRCONSTS_H__ +#define __VRCONSTS_H__ + +// INCLUDES +#include +#include +#include + +// STRING LITERALS +_LIT( KVRAppResourceFile, "z:VoiceRecorder.rsc" ); + +_LIT( KVRBitmapFile, "z:VoiceRecorder.mbm" ); +_LIT(KVRGSBitmapFile,"z:VoiceRecorder_aif.mif"); + +_LIT( KVRMemoStoreSharedDataKey, "MemoStore"); +_LIT( KVRDefaultSpeakerSharedDataKey, "DefaultSpeaker" ); +_LIT( KVRPanic, "VoiceRec" ); + +_LIT( KVRPluginFile,"z:GSVoiceRecorderPlugin.mif" ); + +// CONSTANTS +const TInt KVRBytes60SecAmr( 5000 ); +const TInt KVRMaxTransitions( 13 ); +const TInt KVRDefaultVolume( 4 ); +const TInt KVRDefaultMaxLength( 60 ); +const TInt KVRMaxVolumeSteps( 10 ); +const TInt KVRSecondAsMicroSeconds( 1000000 ); +const TInt KVRMinuteAsMicroSeconds( 60000000 ); +const TInt KVRDisplayUpdateDelay( 250000 ); + +const TInt KVRHalfSecondAsMilliSeconds( 500 ); +const TInt KVRSecondAsMilliSeconds( 1000 ); +// Critical memory level that has to be taken into account when +// calculating estimate for Max recording time +//const TInt KVRCriticalMemoryLevel( 130000 ); // In Bytes + +const TInt KVRAACCriticalMemoryLevel( 400000 ); // In Bytes + +// This should so big that is covers 60 secs AMR or alternatively +// 5 secs WAV recording. +const TInt KVRRecStartMemBuf( 100000 ); // In Bytes + +const TInt KVRSendUiMsgSize( 1024 ); + +// AVKON volume control values go from 1 to 10 +const TInt KVRVolumeControlMin( 1 ); +const TInt KVRVolumeControlMax( 10 ); + +const TUint KVRDefaultAmrBitrate( 12200 ); + +// Time after which the maximum recording time label is updated for +// the first time in milliseconds +const TInt KVRFirstEstimateTime( 3000000 ); + +const TUint KVRDefaultBitrateAac(64000); + +const TInt KVRDefaultSamplerateAac(48000); + +const TInt KVRDefaultStereoMonoFlag(1); + +const TInt KVRDefaultAacRecordLength(60); + +// ENUMERATIONS + +// Don't change the order (snagged from SharedDataKeys.h) + +enum TVRStateForVD + { + EVRIdle = 0, + EVRRecording, + EVRPlaying + }; + +enum TVRAllowScreenSaver + { + EVRScreenSaverAllowed = 0, + EVRScreenSaverNotAllowed + }; + +enum TVRMemoStore + { + EMemoStorePhoneMemory, + EMemoStoreMMC + }; + +enum TVRPanic + { + EPanicUnknown, // 0 + EPanicUnknownViewId, // 1 + EPanicFunctionUnknown, // 2 + EPanicInvalidContext, // 3 + EPanicInvalidState, // 4 + EPanicInvalidTransition, // 5 + EPanicTooManyTransitions, // 6 + EPanicNotAttached, // 7 + EPanicAlreadyAttached, // 8 + EPanicInvalidSetting // 9 + }; + +// These values are used against a bitmask +// All values should be powers of 2 +enum TVRFeature + { + EVRFeatureShowQualitySetting = 1, + EVRFeatureNext = 2 + }; + +enum TVRFiletype + { + EVRFileAmr = 1, + EVRFileQCelp, + EVRFileWav + +#ifdef __AAC_ENCODER_PLUGIN + , EVRFileAAC_LC +#endif + }; + +// Commands for special update events +enum TVRUpdateCommand + { + EVRUpdate = 1, + EVRUpdate1Second, // Called when 1 second limit is passed during playback + EVRUpdateStateChange, // Called when state machine state has changed + EVRUpdatePositionChange, // Position changes so that update is needed + EVRUpdateCBA // Called when CBA buttons have to be updated + }; + +#endif // __VRCONSTS_H__ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorder.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorder.pkg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,26 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Package file for project VoiceRecorder. +; +; VoiceRecorder.pkg +; +&EN +#{"Voice Recorder"},(0x100058CA),1,0,0 +"..\..\epoc32\release\thumb\urel\VoiceRecorder.app"-"!:\system\apps\VoiceRecorder\VoiceRecorder.app" +"..\..\epoc32\release\thumb\urel\VoiceRecorder.rsc"-"!:\system\apps\VoiceRecorder\VoiceRecorder.rsc" +"..\..\epoc32\release\thumb\urel\VoiceRecorder.aif"-"!:\system\apps\VoiceRecorder\VoiceRecorder.aif" +"..\..\epoc32\release\thumb\urel\VoiceRecorder.mbm"-"c:\system\data\VoiceRecorder.mbm" +"..\..\epoc32\release\thumb\urel\VoiceRecorder_Caption.rsc"-"!:\system\apps\VoiceRecorder\VoiceRecorder_Caption.rsc" +"..\..\epoc32\release\thumb\urel\VoiceRecorderRecView.dll"-"!:\system\apps\VoiceRecorder\VoiceRecorderRecView.dll" +"..\..\epoc32\release\thumb\urel\VoiceRecorderUtils.dll"-"!:\system\apps\VoiceRecorder\VoiceRecorderUtils.dll" diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorder.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorder.rh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2002 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 file contains declarations for resources of VoiceRecorder +* The file can be included only in resource file. +* +* +*/ + + +#include "voicerecorder.hrh" + +// STRUCTURE DEFINITIONS + +STRUCT VR_FILETYPE + { + BYTE typeid; + LTEXT mimetype; + } + +STRUCT VR_FILETYPE_ARRAY + { + STRUCT filetypes[]; // VR_FILETYPE array + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorderApp.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorderApp.mmp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2002-2006 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 project specification file for the Voice Recorder application +* +* +*/ + + +#include +#include +#include "VoiceRecorderSingleClick.hrh" + +TARGET VoiceRecorder.exe +TARGETTYPE exe +epocstacksize 0x5000 + +// the following UIDs are exported to system include by VoiceRecorderUID.h +UID 0x100039ce 0x100058CA + +VERSION 10.0 + +CAPABILITY CAP_APPLICATION +VENDORID VID_DEFAULT + +#ifdef IAD_INCLUDE_SINGLE_CLICK +MACRO SINGLE_CLICK_INCLUDED +#endif + +SOURCEPATH ../AppSrc + +SOURCE CVRApplication.cpp +SOURCE CVRDocument.cpp +SOURCE CVRAppUI.cpp + +SOURCE CVRNewFileService.cpp +SOURCE CVRAppServer.cpp +SOURCE CVRSettingItem.cpp + +#ifdef __SERIES60_MMC +SOURCE CVRSettingsDialogMMCSupported.cpp +#else +SOURCE CVRSettingsDialog.cpp +#endif + + +USERINCLUDE ../AppSrc +USERINCLUDE ../group +USERINCLUDE ../UtilsInc +USERINCLUDE ../RecViewInc +USERINCLUDE ../../inc + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY eikcore.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY commonui.lib +LIBRARY sysutil.lib + +LIBRARY VoiceRecorderRecView.lib +LIBRARY VoiceRecorderUtils.lib +LIBRARY featmgr.lib // featuremanager + +// new file service +LIBRARY bafl.lib +LIBRARY newservice.lib + +// settings dialog dependencies +LIBRARY eikdlg.lib +LIBRARY eikcoctl.lib +LIBRARY hlplch.lib +LIBRARY efsrv.lib +LIBRARY commonengine.lib + +#ifdef __SERIES60_MMC +LIBRARY commondialogs.lib +#endif + +#ifdef RD_MULTIPLE_DRIVE +LIBRARY PlatformEnv.lib +#endif + +START RESOURCE ../group/voicerecorder.rss + TARGETPATH APP_RESOURCE_DIR + HEADER + LANGUAGE_IDS +END // RESOURCE + +SOURCEPATH . +START RESOURCE VoiceRecorder_reg.rss +DEPENDS voicerecorder.rsg + // Do not change the UID below. + TARGETPATH /private/10003a3f/apps +END diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorderInternalCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorderInternalCRKeys.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2004 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: Voice Recorder internal Central Repository keys +* +*/ + + + +#ifndef VOICERECORDERINTERNALCRKEYS_H +#define VOICERECORDERINTERNALCRKEYS_H + +// INCLUDES +#include + +// CONSTANTS + +/****************************************************************************** +* Voice Recorder Settings CentRep API +* Keys under this category are used in defining telephony +* variant configuration. +*/ +const TUid KCRUidVoiceRecorder = {0x101F87A3}; + +/** + * To allow or prohibit in-call recording. + * + * Possible values are 0 (no), 1 (yes). + * Default value is 1. + */ +const TUint32 KVRAllowInCallRecording = 0x00000000; + +/** + * This key determines which audio format should be used as a default for + * recording. + * + * Possible values = 0 (AMR), 1 (wav) and 2 (mp4) + * Default value is 0. + */ +const TUint32 KVRDefaultAudioFormat = 0x00000001; + +/** + * Determines which speaker is used, when sound files are played by Voice + * Recorder. + * + * Possible values are 0 ( ESpeakerEarPiece ) and 1 ( ESpeakerIhf ) + * Default value is 1. + */ +const TUint32 KVRDefaultSpeaker = 0x00000002; + +/** + * Tells where to store music files recorder by Voice Recorder. + * + * Possible values are 0 ( EMemoStorePhoneMemory ) and 1 ( EMemoStoreMMC ) + * Default value is 0. + */ +const TUint32 KVRMemoStore = 0x00000003; + +/** + * Volume setting for the ear piece. Loaded on startup and saved when closing VR. + * + * Possible values are currently 0 to 10 + * Default value is 4. + */ +const TUint32 KVREarPieceVolume = 0x00000004; + +/** + * Volume setting for the IHF. Loaded on startup and saved when closing VR. + * + * Possible values are currently 0 to 10 + * Default value is 4. + */ +const TUint32 KVRIHFVolume = 0x00000005; + +/** + * Quality setting for recorded memos. + * + * Possible values are 0 (EQualityMMSOptimized), 1 (EQualityHigh AAC-LC supported, or EqualityNormal AAC-LC not supported ), 2 (only when AAC-LC is supported) + */ +const TUint32 KVRQuality = 0x00000006; + +/** + * Maximum recording time for memo in minutes. Only used if no stricter + * limit is set runtime (eg. file size limitation) + */ +const TUint32 KVRMaxRecordTime = 0x00000007; + +/** +* Bitmask specifying the elements that should be variated on or off in a +* release. See VoiceRecorderLocalVariation.txt for description of specific bit. +*/ +const TUint32 KVRVariationFlags = 0x00000008; + +/** +* Count of recorded memos. This number is used in name of memo, eg. "Memo(25).amr" +*/ +const TUint32 KVRMemoCount = 0x00000009; + +/** +* Bitrate used in AMR-NB recording +* +* Possible values: 4750, 5150, 5900, 6700, 7400, 7950, 10200, 12200 +* Note that selected bitrate may not be supported by codec. In this case, +* the default bitrate of 12200 is used. +*/ +const TUint32 KVRBitrateAmr = 0x00000010; + +/** +* Bitrate used in AAC-LC recording +* +* Possible values: 8000 - 288000 +* Note that selected bitrate may not be supported by codec. In this case, +* the default bitrate of 32000 is used. +*/ +const TUint32 KVRBitrateAac = 0x00000011; + +/** +* Sampling rate used in AAC-LC recording +* +* Possible values: 8, 11.025, 12, 16, 22.05, 24, 32, 44.1 and 48kHz +* Note that selected bitrate may not be supported by codec. In this case, +* the default sampling rate of 48 is used. +*/ +const TUint32 KVRSamplerateAac = 0x00000012; + +/** +* Audio mode (mono or stereo) flag +* +* Possible values: 1 (mono) and 2 (stereo) +* the default is 1. +*/ +const TUint32 KVRStereoMonoFlag = 0x00000013; + +/** +* AAC-LC recording Length +* +* Possible values: to be determined +* the default is 60 minutes. +*/ +const TUint32 KVRAacRecordLength = 0x00000014; + + + + +#endif // VOICERECORDERINTERNALCRKEYS_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorderPrivatePSKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorderPrivatePSKeys.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2004 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: Voice Recorder Internal Publish & Subscribe keys +* +*/ + + + +#ifndef VOICERECORDERPSKEYS_H +#define VOICERECORDERPSKEYS_H + +// INCLUDES +#include + +// CONSTANTS + +/****************************************************************************** +* Voice Recorder Private Settings Pub&Sub API +* Keys under this category are used within Voice Recorder +*/ +const TUid KPSUidVoiceRecorder = {0x101F87A4}; + +/** + * Current mode of Voice Recorder. (Recording, playing etc.) + * Possible values are EIdle = 0, ERecording, EPlaying + * Default value is 0. + */ +const TUint32 KVoiceRecorderMode = 0x00000000; + +#endif // VOICERECORDERPSKEYS_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorderSingleClick.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorderSingleClick.hrh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2002 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: +* bldvariant headers for project Voice Recorder +* +*/ + + +#ifndef VOICERECORDERSINGLECLICK_HRH_ +#define VOICERECORDERSINGLECLICK_HRH_ + +#define IAD_INCLUDE_SINGLE_CLICK + + +#endif /* VOICERECORDERSINGLECLICK_HRH_ */ + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/VoiceRecorder_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/VoiceRecorder_reg.rss Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2004-2006 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: register resource file of VoiceRecorder +* +*/ + + +#include +#include +#include +#include + +UID2 KUidAppRegistrationResourceFile +UID3 KVoiceRecorderAppUID3 + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "VoiceRecorder"; + hidden = KAppNotHidden; + embeddability = KAppEmbeddable; + + localisable_resource_file = APP_RESOURCE_DIR"\\VoiceRecorder"; + localisable_resource_id = R_VR_LOCALISABLE_APP_INFO; + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/backup_registration.xml Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,11 @@ + + + + + + + + + + + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2002-2006 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 file provides the information required for building +* Voice Recorder. +* +*/ + + +#include + +PRJ_PLATFORMS + DEFAULT + +// Help exports +#include "../help/group/bld.inf" + +PRJ_EXPORTS +../sis/VoiceRecorder_stub.sis /epoc32/data/z/system/install/VoiceRecorder_stub.SIS +../rom/Voicerecorder.iby CORE_APP_LAYER_IBY_EXPORT_PATH(Voicerecorder.iby) +../rom/VoicerecorderResources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(VoicerecorderResources.iby) +../loc/voicerecorder.loc APP_LAYER_LOC_EXPORT_PATH(voicerecorder.loc) + +// Generic configuration interface for component cenrep settings +// voicerecorder_101F87A3 implementation specifics for cenrep data +../Conf/voicerecorder.confml APP_LAYER_CONFML(voicerecorder.confml) +../Conf/voicerecorder_101F87A3.crml APP_LAYER_CRML(voicerecorder_101F87A3.crml) + +// Backup registration file +backup_registration.xml z:/private/100058CA/backup_registration.xml + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE voicerecorder_aif.mif +OPTION SOURCES -c8,8 qgn_menu_voirec +END + +START EXTENSION s60/mifconv +OPTION TARGETFILE voicerecorder.mif +OPTION HEADERFILE voicerecorder.mbg +OPTION SOURCES -c8,1 qgn_indi_vorec_button_forw\ + -c8,8 qgn_indi_vorec_button_forw_inactive\ + -c8,1 qgn_indi_vorec_button_pause\ + -c8,8 qgn_indi_vorec_button_pause_inactive\ + -c8,1 qgn_indi_vorec_button_play\ + -c8,8 qgn_indi_vorec_button_play_inactive\ + -c8,1 qgn_indi_vorec_button_rec\ + -c8,8 qgn_indi_vorec_button_rec_inactive\ + -c8,1 qgn_indi_vorec_button_rew\ + -c8,8 qgn_indi_vorec_button_rew_inactive\ + -c8,1 qgn_indi_vorec_button_stop\ + -c8,8 qgn_indi_vorec_button_stop_inactive +END + +START EXTENSION s60/mifconv +OPTION TARGETFILE gsvoicerecorderplugin.mif +OPTION HEADERFILE gsvoicerecorderplugin.mbg +OPTION SOURCES -c8,8 qgn_prop_set_apps_voirec +END + +PRJ_MMPFILES +Utils.mmp +RecView.mmp +NewService.mmp +VoiceRecorderApp.mmp +../gsplugin/group/GSVoiceRecorderPlugin.mmp + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/lscan.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/lscan.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,39 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Checks voicerecorder code respects the naming +rem conventions for leaving functions. +rem + +@echo off +leavescan ..\RecViewSrc\CVRButtonPanel.cpp +leavescan ..\RecViewSrc\CVRLabel.cpp +leavescan ..\RecViewSrc\CVRRecViewContainer.cpp +leavescan ..\RecViewSrc\CVRRecViewModel.cpp +leavescan ..\RecViewSrc\CVRRecView.cpp +leavescan ..\RecViewSrc\CVRMdaRecorder.cpp +leavescan ..\RecViewSrc\CVRSystemEventHandler.cpp +leavescan ..\RecViewSrc\CVRMemo.cpp +leavescan ..\RecViewSrc\CVRStateInfoPanel.cpp +leavescan ..\RecViewSrc\TVRState.cpp +leavescan ..\UtilsSrc\VRUtils.cpp +leavescan ..\UtilsSrc\CVRFileRecognizer.cpp +leavescan ..\AppSrc\CVRApplication.cpp +leavescan ..\AppSrc\CVRDocument.cpp +leavescan ..\AppSrc\CVRAppUI.cpp +leavescan ..\AppSrc\CVRNewFileService.cpp +leavescan ..\AppSrc\CVRAppServer.cpp +leavescan ..\NewServiceSrc\CNewFileServiceClientImpl.cpp +leavescan ..\NewServiceSrc\CNewFileServiceDiscovery.cpp +leavescan ..\NewServiceSrc\RNewFileServiceClient.cpp +leavescan ..\NewServiceSrc\CNewFileServiceBase.cpp diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/moveudeb.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/moveudeb.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,17 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Move voicerecorder file from \udeb path to \urel path. +rem + +move \epoc32\release\thumb\udeb\voicerecorder* \epoc32\release\thumb\urel\ \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/voicerecorder.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/voicerecorder.hrh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2002 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: +* Defines commands and control identifiers. +* The file can be included in C++ or resource file. +* +*/ + + +#ifndef __VOICERECORDER_HRH_ +#define __VOICERECORDER_HRH_ + +// INCLUDES +#include "VoiceRecorderContexts.h" +#include + +enum TVRDialogIds + { + EVRSettingsListboxId = 1 //Dialog control ID can't be zero + }; + +enum TVRButtonStates + { + ENormal = 0, + EDimmed, + EPressed + }; + +enum TVRCommands + { + ECmdPlay = 100, // Don't override EIKON IDs.. + ECmdPause, + ECmdStop, + ECmdAutoStopInterrupted, + ECmdAutoStopAtEnd, + ECmdSilentStop, + ECmdRecord, + ECmdRewind, + ECmdForward, + ECmdRecordNew, + ECmdOpen, + ECmdDelete, + ECmdAddToPinboard, + ECmdRename, + ECmdSaveAttachment, + ECmdOk, + ECmdCancel, + ECmdSettings, + ECmdEditListCascade, + ECmdChange, + ECmdHelp, + ECmdEndKey, + ECmdCancelNote, + ECmdEmbeddedRecordingReady, + ECmdDisconnectCall, + ECmdNewFileServiceNotify, + ECmdMSK, // When Middle Softkey is pressed + ECmdSetNewPosition, // Progress Bar Touch + ECmdNOP, // No operation + ECmdGoToMyClips, + ECmdUSBChange, + + ECmdSendVia // This MUST be the last entry + }; + +enum TVRRecViewStates + { + EStateIdle = 0, + EStateDeleted, + EStateRecording, + EStateRecordEmbedded, + EStatePlaying, + EStatePlayingPaused, + EStateRecordingPaused, + EStateIdleEmbedded, + EStateIdleRecordEmbedded, + EStateNRTIdle, + EStateNRTPlaying, + EStateDisableButtons, // all buttons disabled for no in-call recording feature + + ENumStates, // this must be the last line + EStateInitial = 255 + }; + +enum TVRRecViewLabels + { + ELabelMemoName = 0, + ELabelMemoDate, + ELabelMemoQuality, + ELabelBarMin, + ELabelBarMax, + ELabelStatus, + ELabelQualityText, + ENumLabels // this must be the last line + }; + +enum TVRFunctions + { + EFunctionNop = 0, + EFunctionPlay, + EFunctionStop, + EFunctionRecord, + EFunctionPause, + EFunctionForward, + EFunctionRewind, + EFunctionRecordNew, + EFunctionDelete, + EFunctionRename, + EFunctionStopAndSave, + EFunctionStopWithNote, + EFunctionOk, + EFunctionCancel, + EFunctionAutoStopAndSave, + EFunctionSilentStopAndSave, + EFunctionAutoStop, + EFunctionNRTStop, + EFunctionNRTAutoStop, + EFunctionSaveBeforeExit, + EFunctionSetNewPosition, // Progress Bar Touch + ENumFunctions + }; + +enum TVRSpeaker + { + ESpeakerEarPiece, + ESpeakerIhf + }; + +// EQualityMMSOptimized -> save file as amr +// EQualityNormal is used only when mp4 is supported, save file as wav +// EQualityHigh -> when mp4 is supported, save file as mp4, otherwise save as wave +enum TVRQuality + { + EQualityMMSOptimized, + +#ifdef __AAC_ENCODER_PLUGIN + EQualityNormal, +#endif + + EQualityHigh + }; + +enum TVRButtons + { + EButtonPlay = 0, + EButtonStop, + EButtonRecord, + EButtonRewind, + EButtonForward + }; + +enum TVRSettingFeatures + { + ESettingQuality = 0, + ESettingMemoStore + }; + +#define VRMEMONAMEMAXLENGTH 20 +#define VRLABELMAXLENGTH 32 + +#endif // __VOICERECORDER_HRH_ diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/group/voicerecorder.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/group/voicerecorder.rss Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,2255 @@ +/* +* Copyright (c) 2002 - 2006 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: +* Voice Recorder resource file +* +* +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "RecView.rh" +#include +#include "voicerecorder.hrh" +#include "VoiceRecorder.rh" +#include +#include + +NAME VREC + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf = qtn_vorec_first_memo_name; } //default document name + +RESOURCE EIK_APP_INFO + { + } + +// For the scalable AIF +RESOURCE LOCALISABLE_APP_INFO r_vr_localisable_app_info + { + short_caption = qtn_vorec_app_menu_grid; + caption_and_icon = CAPTION_AND_ICON_INFO + { + caption = qtn_vorec_app_title; +#ifdef __SCALABLE_ICONS + number_of_icons = 1; + icon_file = APP_BITMAP_DIR"\\VoiceRecorder_aif.mif"; +#else + number_of_icons = 2; + icon_file = APP_BITMAP_DIR"\\VoiceRecorder_aif.mbm"; +#endif + }; + } + + +RESOURCE AVKON_VIEW r_vr_recorder_view + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_options_back_select; + } + + +RESOURCE MENU_PANE r_vr_editlist_menupane + { + items = + { + MENU_ITEM { command = EAknCmdMark; txt=qtn_options_list_mark_one; }, + MENU_ITEM { command = EAknCmdUnmark; txt=qtn_options_list_unmark_one; }, + MENU_ITEM { command = EAknMarkAll; txt=qtn_options_list_mark_all; }, + MENU_ITEM { command = EAknUnmarkAll; txt=qtn_options_list_unmark_all; } + }; + } + + +RESOURCE MENU_BAR r_vr_recview_menubar_empty + { + titles= + { + }; + } + +RESOURCE MENU_BAR r_vr_recview_menubar_default + { + titles= + { + MENU_TITLE { menu_pane = r_vr_rec_menupane_default; } + }; + } + + +RESOURCE MENU_PANE r_vr_rec_menupane_default + { + items= + { + MENU_ITEM { command = ECmdRecord; txt = qtn_vorec_rec_new; }, + MENU_ITEM { command = ECmdDelete; txt = qtn_vorec_delete; }, + MENU_ITEM { command = ECmdRename; txt = text_voice_rec_edit_title; }, + MENU_ITEM { command = ECmdGoToMyClips; txt = qtn_vorec_goto_my_clips; }, +#if defined ( __SERIES60_MMC ) + MENU_ITEM { command = ECmdSettings; txt = qtn_vorec_settings; }, +#endif + + MENU_ITEM { command = ECmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_BAR r_vr_recview_menubar_deleted + { + titles= + { + MENU_TITLE { menu_pane = r_vr_rec_menupane_deleted; } + }; + } + +RESOURCE MENU_PANE r_vr_rec_menupane_deleted + { + items= + { + MENU_ITEM { command = ECmdRecord; txt = qtn_vorec_rec_new; }, + MENU_ITEM { command = ECmdGoToMyClips; txt = qtn_vorec_goto_my_clips; }, +#if defined ( __SERIES60_MMC ) + MENU_ITEM { command = ECmdSettings; txt = qtn_vorec_settings; }, +#endif + + MENU_ITEM { command = ECmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_BAR r_vr_recview_menubar_viewer + { + titles= + { + MENU_TITLE { menu_pane = r_vr_rec_menupane_viewer; } + }; + } + +RESOURCE MENU_PANE r_vr_rec_menupane_viewer + { + items= + { + MENU_ITEM { command = ECmdSaveAttachment; txt = qtn_vorec_save_mail_atta; }, + MENU_ITEM { command = ECmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + +// In-call recording disabled menu +RESOURCE MENU_BAR r_vr_recview_menupane_incall_recording_disabled + { + titles= + { + MENU_TITLE { menu_pane = r_vr_rec_menupane_incall_recording_disabled; } + }; + } + +RESOURCE MENU_PANE r_vr_rec_menupane_incall_recording_disabled + { + items= + { + MENU_ITEM { command = ECmdGoToMyClips; txt = qtn_vorec_goto_my_clips; }, +#if defined ( __SERIES60_MMC ) + MENU_ITEM { command = ECmdSettings; txt = qtn_vorec_settings; }, +#endif + MENU_ITEM { command = ECmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EAknCmdExit; txt = qtn_options_exit; } + }; + } + + + +RESOURCE TBUF r_qtn_query_common_conf_delete { buf = qtn_query_common_conf_delete; } +RESOURCE TBUF r_qtn_vorec_quest_delete_many { buf = qtn_vorec_quest_delete_many; } + +RESOURCE TBUF r_qtn_fldr_overwrite_query { buf = qtn_fldr_overwrite_query; } +RESOURCE TBUF r_qtn_fldr_item_name_prmpt { buf = qtn_fldr_item_name_prmpt; } +RESOURCE TBUF r_qtn_fldr_illegal_characters { buf = qtn_fldr_illegal_characters; } +RESOURCE TBUF r_qtn_fldr_cant_rename_item { buf = qtn_fldr_cant_rename_item; } + +// MMC usage related strings + +RESOURCE TBUF r_qtn_vorec_set_store { buf = qtn_vorec_set_store; } +RESOURCE TBUF r_qtn_memc_vorec_note1 { buf = qtn_memc_vorec_note1; } +RESOURCE TBUF r_qtn_memc_vorec_note2 { buf = qtn_memc_vorec_note2; } +RESOURCE TBUF r_qtn_memc_unlock_query1 { buf = qtn_memc_unlock_query1; } +RESOURCE TBUF r_qtn_memc_set_password_error { buf = qtn_memc_set_password_error; } +RESOURCE TBUF r_qtn_memc_readonly { buf = qtn_memc_memorycard_read_only; } +RESOURCE TBUF r_qtn_ccor_insert_mmc { buf = qtn_ccor_insert_mmc; } +RESOURCE TBUF r_qtn_usb_mode_note_mode { buf = qtn_usb_mode_note_mode_activated; } + +RESOURCE DIALOG r_insert_f_card_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagWait | EEikDialogFlagNoBackgroundFade; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + +RESOURCE DIALOG r_insert_f_usb_plug_in_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagWait | EEikDialogFlagNoBackgroundFade; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + +// Settings dialog stuff needed when there's an MMC (default store setting) +// or the voice key is missing (defauly speaker setting) + +RESOURCE MENU_PANE r_vr_settings_menupane + { + items= + { + MENU_ITEM { command = ECmdChange; txt = qtn_vorec_settings_change; flags = EEikMenuItemAction ; }, + MENU_ITEM { command = ECmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = EEikCmdExit; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_BAR r_vr_settings_menubar + { + titles= + { + MENU_TITLE { menu_pane = r_vr_settings_menupane; } + }; + } + +RESOURCE DIALOG r_vr_settings_dialog + { + buttons = r_vr_softkeys_options_back_change; + flags = EEikDialogFlagWait | EEikDialogFlagNoDrag + | EEikDialogFlagCbaButtons | EEikDialogFlagNoTitleBar + | EEikDialogFlagFillAppClientRect; + items = + { + DLG_LINE + { + type = EAknCtSettingListBox; + id = EVRSettingsListboxId; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + +RESOURCE TBUF r_qtn_vorec_set_ihf { buf = qtn_vorec_set_ihf; } +RESOURCE TBUF r_qtn_vorec_set_quality { buf = qtn_vorec_set_quality; } + +RESOURCE AVKON_POPUP_SETTING_TEXTS r_vr_settings_default_speaker_texts + { + setting_texts_resource = r_vr_settings_default_speaker; + popped_up_texts_resource = r_vr_settings_default_speaker_popup; + } + +RESOURCE AVKON_POPUP_SETTING_TEXTS r_vr_settings_quality_texts + { + setting_texts_resource = r_vr_settings_quality; + popped_up_texts_resource = r_vr_settings_quality_popup; + } + +RESOURCE ARRAY r_vr_settings_default_speaker + { + items= + { + AVKON_ENUMERATED_TEXT { value = ESpeakerEarPiece; text = qtn_vorec_settings_ihf_ear; }, + AVKON_ENUMERATED_TEXT { value = ESpeakerIhf; text = qtn_vorec_settings_ihf_hf; } + }; + } + +RESOURCE ARRAY r_vr_settings_default_speaker_popup + { + items= + { + LBUF { txt = qtn_vorec_settings_ihf_ear; }, + LBUF { txt = qtn_vorec_settings_ihf_hf; } + }; + } + +RESOURCE ARRAY r_vr_settings_quality + { + items= + { + AVKON_ENUMERATED_TEXT { value = EQualityMMSOptimized; text = qtn_vorec_settings_quality_mms_optimized; }, + +#ifdef __AAC_ENCODER_PLUGIN + AVKON_ENUMERATED_TEXT { value = EQualityNormal; text = qtn_vorec_settings_quality_normal; }, +#endif + + AVKON_ENUMERATED_TEXT { value = EQualityHigh; text = qtn_vorec_settings_quality_high; } + }; + } + +RESOURCE ARRAY r_vr_settings_quality_popup + { + items= + { + LBUF { txt = qtn_vorec_settings_quality_mms_optimized; }, + +#ifdef __AAC_ENCODER_PLUGIN + LBUF { txt = qtn_vorec_settings_quality_normal; }, +#endif + + LBUF { txt = qtn_vorec_settings_quality_high; } + }; + } + +RESOURCE POPUP_SETTING_LIST r_vr_settings_popup_control + { + } + +RESOURCE AVKON_SETTING_PAGE r_vr_settings_default_speaker_page + { + type = EAknCtPopupSettingList; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; + editor_resource_id = r_vr_settings_popup_control; + } + +RESOURCE TBUF r_vr_video_call_infonote_label { buf = qtn_vorec_info_video_call_ongoing; } +RESOURCE TBUF r_vr_internet_call_infonote_label { buf = qtn_vorec_info_internet_call_ongoing; } +RESOURCE TBUF r_vr_save_waitnote_label { buf = qtn_vorec_wait_saving_memo; } +RESOURCE TBUF r_vr_stop_save_waitnote_label { buf = qtn_vorec_wait_stop_saved; } +RESOURCE TBUF r_vr_stop_infonote_label { buf = qtn_vorec_info_record_stopped; } +RESOURCE TBUF r_vr_corrupt_infonote_label { buf = qtn_vorec_info_memo_corrupted; } +RESOURCE TBUF r_vr_unsupported_infonote_label { buf = qtn_vorec_info_memo_unsupported; } +RESOURCE TBUF r_vr_server_error_infonote_label { buf = qtn_vorec_info_server_error; } +RESOURCE TBUF r_vr_memory_warning { buf = qtn_memlo_memory_running_out; } +RESOURCE TBUF r_vr_memory_mmc_warning { buf = qtn_memlo_mmc_memory_running_out; } +RESOURCE TBUF r_vr_memory_low_stop_warning { buf = qtn_memlo_not_enough_memory; } + +// Quality strings for UI +RESOURCE TBUF r_vorec_quality_mms_optimized { buf = qtn_vorec_quality_mms_optimized; } + +#ifdef __AAC_ENCODER_PLUGIN +RESOURCE TBUF r_vorec_quality_normal { buf = qtn_vorec_quality_normal; } +#endif + +RESOURCE TBUF r_vorec_quality_high { buf = qtn_vorec_quality_high; } + +// Memo naming strings +RESOURCE TBUF r_vorec_first_memo_name { buf = qtn_vorec_first_memo_name; } +RESOURCE TBUF r_vorec_memo_name { buf = qtn_vorec_memo_name; } +RESOURCE TBUF r_vorec_default_memo_name { buf = qtn_vorec_default_memo_name; } + +RESOURCE DIALOG r_vr_rename_dialog + { + flags = EEikDialogFlagWait|EEikDialogFlagNoDrag | EEikDialogFlagNoTitleBar | EEikDialogFlagCbaButtons | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = qtn_fldr_item_name_prmpt; + control = EDWIN + { + flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable + | EEikEdwinNoLineOrParaBreaks; + maxlength = VRMEMONAMEMAXLENGTH; + lines = 1; + width = 16; + }; + }; + } + }; + } + +// For remote recording +RESOURCE DIALOG r_vr_confirmation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + // r_vr_softkeys_ok_cancel; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + }; + } + }; + } + + +// ------- RECORDER VIEW STUFF --------------------------------------- + +RESOURCE VR_STATEMACHINE r_vr_recview_states + { + labelsets = + { + VR_LABELSET + { + labels = + { + LBUF { txt = qtn_vorec_memo_label; }, + LBUF { txt = qtn_vorec_date_label; }, + LBUF { txt = qtn_vorec_quality_label; }, + LBUF { txt = qtn_vorec_min_label; }, + LBUF { txt = qtn_vorec_time_indic; }, + LBUF { txt = " "; }, // this is a placeholder for the status text, don't touch :-) + LBUF { txt = " "; } // this is a placeholder for quality text (MMS or High) + }; + }, + + VR_LABELSET + { + }, + + VR_LABELSET // for .rng:s + { + labels = + { + LBUF { txt = qtn_vorec_memo_label; }, + LBUF { txt = qtn_vorec_date_label; }, + LBUF { txt = " "; } // this is a placeholder for the status text, don't touch :-) + }; + } + }; + labelLayouts = + { + VR_LABEL_LINK { euroLabelId = r_vr_statusinfo_label_1_euro; + apacLabelId = r_vr_statusinfo_label_1_apac; + arabicHebrewLabelId = r_vr_statusinfo_label_1_arabic_hebrew; + }, + VR_LABEL_LINK { euroLabelId = r_vr_statusinfo_label_2_euro; + apacLabelId = r_vr_statusinfo_label_2_apac; + arabicHebrewLabelId = r_vr_statusinfo_label_2_arabic_hebrew; + }, + VR_LABEL_LINK { euroLabelId = r_vr_statusinfo_label_3_euro; + apacLabelId = r_vr_statusinfo_label_3_apac; + arabicHebrewLabelId = r_vr_statusinfo_label_3_arabic_hebrew; + }, + VR_LABEL_LINK { euroLabelId = r_vr_statusinfo_label_4_euro; + apacLabelId = r_vr_statusinfo_label_4_apac; + arabicHebrewLabelId = r_vr_statusinfo_label_4_arabic_hebrew; + }, + VR_LABEL_LINK { euroLabelId = r_vr_statusinfo_label_5_euro; + apacLabelId = r_vr_statusinfo_label_5_apac; + arabicHebrewLabelId = r_vr_statusinfo_label_5_arabic_hebrew; + }, + VR_LABEL_LINK { euroLabelId = r_vr_statusinfo_label_6_euro; + apacLabelId = r_vr_statusinfo_label_6_apac; + arabicHebrewLabelId = r_vr_statusinfo_label_6_arabic_hebrew; + } + }; + states = + { + // memo_open + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_default; + cba = r_vr_softkeys_options_exit_select; + status = ""; + labelSetId = 0; + hasVolumeControl = 1; + focusButton = 0; + stateID = EStateIdle; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = ENormal; } + }; + }, + // memo_deleted + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_deleted; + cba = r_vr_softkeys_options_exit_select; + status = ""; + labelSetId = 1; + focusButton = 2; + stateID = EStateDeleted; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = EDimmed; } + }; + }, + // memo_recording + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_pause_stop_select; + status = qtn_vorec_recording; + labelSetId = 0; + focusButton = 1; + stateID = EStateRecording; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdPause; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = EDimmed; } + }; + }, + // memo_record_embed + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_record_back_select; + status = ""; + labelSetId = 1; + focusButton = 2; + stateID = EStateRecordEmbedded; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = EDimmed; } + }; + }, + // memo_playing + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_pause_stop_select; + status = qtn_vorec_playback; + labelSetId = 0; + hasVolumeControl = 1; + focusButton = 1; + stateID = EStatePlaying; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPause; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = ENormal; } + }; + }, + // memo_paused_playback + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_play_stop_select; + status = qtn_vorec_paused; + labelSetId = 0; + hasVolumeControl = 1; + focusButton = 0; + stateID = EStatePlayingPaused; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = ENormal; } + }; + }, + // memo_paused_record + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_record_stop_select; + status = qtn_vorec_paused; + labelSetId = 0; + focusButton = 2; + stateID = EStateRecordingPaused; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = EDimmed; } + }; + }, + // memo_open_embed + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_viewer; + cba = r_vr_softkeys_options_back_select; + status = ""; + labelSetId = 0; + hasVolumeControl = 1; + focusButton = 0; + stateID = EStateIdleEmbedded; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = ENormal; } + }; + }, + // memo_record_embed_idle + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_empty; + cba = r_vr_softkeys_ok_cancel_select; + status = ""; + labelSetId = 0; + hasVolumeControl = 1; + focusButton = 0; + stateID = EStateIdleRecordEmbedded; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = ENormal; } + }; + }, + // nokia_ringing_tone_idle + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_viewer; + cba = r_vr_softkeys_options_back_select; + status = ""; + labelSetId = 2; + hasVolumeControl = 1; + hasProgressBar = 0; + focusButton = 0; + stateID = EStateNRTIdle; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = EDimmed; } + }; + }, + // nokia_ringing_tone_playing + VR_VISUAL_STATE + { + menubar = r_vr_recview_menubar_viewer; + cba = r_vr_softkeys_stop_select; + status = ""; + labelSetId = 2; + hasVolumeControl = 1; + hasProgressBar = 0; + focusButton = 1; + stateID = EStateNRTPlaying; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = ENormal; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward; state = EDimmed; } + }; + }, + // disable_buttons + VR_VISUAL_STATE + { + menubar = r_vr_recview_menupane_incall_recording_disabled; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + status = ""; + labelSetId = 0; + hasVolumeControl = 0; + hasProgressBar = 0; + focusButton = 0; + stateID = EStateDisableButtons; + buttons = + { + VR_BUTTON_INFO { commandId = ECmdPlay; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdStop; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRecord; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdRewind; state = EDimmed; }, + VR_BUTTON_INFO { commandId = ECmdForward;state = EDimmed; } + }; + } + }; + + contexts = + { + VR_CONTEXT + { + id = EContextNormal; + transition = VR_TRANSITION { next = EStateIdle; }; + states = + { + VR_STATE + { + id = EStateIdle; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecordNew; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateDeleted; function = EFunctionDelete; }, + VR_TRANSITION { cmd = ECmdRename; next = EStateIdle; function = EFunctionRename; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateDeleted; + transitions = + { + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecordNew; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateDeleted; function = EFunctionNop; } + }; + }, + VR_STATE + { + id = EStateRecording; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdPause; next = EStateRecordingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionSilentStopAndSave; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecording; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecording; function = EFunctionNop; } + }; + }, + VR_STATE + { + id = EStatePlaying; + transitions = + { + VR_TRANSITION { cmd = ECmdPause; next = EStatePlayingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlaying; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlaying; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlaying; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStatePlayingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlayingPaused; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlayingPaused; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlayingPaused; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateRecordingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecord; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionSilentStopAndSave; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecordingPaused; function = EFunctionSetNewPosition; } + }; + }, + // Disabled button state + VR_STATE + { + id = EStateDisableButtons; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateDisableButtons; function = EFunctionNop; } + }; + + } + }; + }, + VR_CONTEXT + { + id = EContextEmptyNormal; + transition = VR_TRANSITION { next = EStateDeleted; }; + states = + { + VR_STATE + { + id = EStateIdle; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecordNew; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateDeleted; function = EFunctionDelete; }, + VR_TRANSITION { cmd = ECmdRename; next = EStateIdle; function = EFunctionRename; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateDeleted; + transitions = + { + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecordNew; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateDeleted; function = EFunctionNop; } +// Bentley + }; + }, + VR_STATE + { + id = EStateRecording; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdPause; next = EStateRecordingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionSilentStopAndSave; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecording; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionSaveBeforeExit; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecording; function = EFunctionNop; } + }; + }, + VR_STATE + { + id = EStatePlaying; + transitions = + { + VR_TRANSITION { cmd = ECmdPause; next = EStatePlayingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlaying; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlaying; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlaying; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStatePlayingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlayingPaused; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlayingPaused; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlayingPaused; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateRecordingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecord; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionSaveBeforeExit; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecordingPaused; function = EFunctionNop; } + }; + }, + // Disabled button state + VR_STATE + { + id = EStateDisableButtons; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionNop; } + }; + } + + }; + }, + VR_CONTEXT + { + id = EContextRecordNewNormal; + transition = VR_TRANSITION { next = EStateRecording; function = EFunctionRecord; }; + states = + { + VR_STATE + { + id = EStateIdle; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecordNew; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateDeleted; function = EFunctionDelete; }, + VR_TRANSITION { cmd = ECmdRename; next = EStateIdle; function = EFunctionRename; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateDeleted; + transitions = + { + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecordNew; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateDeleted; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateDeleted; function = EFunctionNop; } +// Bentley + }; + }, + VR_STATE + { + id = EStateRecording; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdPause; next = EStateRecordingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionSilentStopAndSave; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecording; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionSaveBeforeExit; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecording; function = EFunctionNop; } + }; + }, + VR_STATE + { + id = EStatePlaying; + transitions = + { + VR_TRANSITION { cmd = ECmdPause; next = EStatePlayingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlaying; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlaying; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlaying; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStatePlayingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlayingPaused; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlayingPaused; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdle; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlayingPaused; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateRecordingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionStopAndSave; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecord; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionAutoStopAndSave; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecordingPaused; function = EFunctionNop; } + }; + }, + // Disabled button state + VR_STATE + { + id = EStateDisableButtons; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionNop; } + }; + } + }; + }, + VR_CONTEXT + { + id = EContextRecordNewForRemote; + transition = VR_TRANSITION { next = EStateRecordEmbedded; }; + states = + { + VR_STATE + { + id = EStateRecordEmbedded; + transitions = + { + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecord; }, + VR_TRANSITION { cmd = ECmdCancel; next = EStateRecordEmbedded; function = EFunctionCancel; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecordEmbedded; function = EFunctionNop; } +// Bentley + }; + }, + VR_STATE + { + id = EStateRecording; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdleRecordEmbedded; function = EFunctionStopWithNote; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdPause; next = EStateRecordingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecording; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdleRecordEmbedded; function = EFunctionStopWithNote; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleRecordEmbedded; function = EFunctionStopWithNote; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecording; function = EFunctionNop; } + }; + }, + VR_STATE + { + id = EStateIdleRecordEmbedded; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdleRecordEmbedded; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdleRecordEmbedded; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdOk; next = EStateIdleRecordEmbedded; function = EFunctionOk; }, + VR_TRANSITION { cmd = ECmdCancel; next = EStateIdleRecordEmbedded; function = EFunctionCancel; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdleRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdleRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdleRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdleRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleRecordEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdleRecordEmbedded; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateRecordingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateRecording; function = EFunctionRecord; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateRecordingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleRecordEmbedded; function = EFunctionStopWithNote; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateRecordingPaused; function = EFunctionNop; } + }; + }, + VR_STATE + { + id = EStatePlaying; + transitions = + { + VR_TRANSITION { cmd = ECmdPause; next = EStatePlayingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleRecordEmbedded; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlaying; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlaying; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlaying; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStatePlayingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlayingPaused; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlayingPaused; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleRecordEmbedded; function = EFunctionAutoStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleRecordEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlayingPaused; function = EFunctionSetNewPosition; } + }; + }, + // Disabled button state + VR_STATE + { + id = EStateDisableButtons; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionNop; } + }; + } + }; + }, + + VR_CONTEXT + { + id = EContextViewer; + transition = VR_TRANSITION { next = EStateIdleEmbedded; }; + states = + { + VR_STATE + { + id = EStateIdleEmbedded; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdleEmbedded; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdleEmbedded; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdleEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdleEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdleEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdleEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleEmbedded; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdleEmbedded; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStatePlaying; + transitions = + { + VR_TRANSITION { cmd = ECmdPause; next = EStatePlayingPaused; function = EFunctionPause; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlaying; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlaying; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlaying; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlaying; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStatePlayingPaused; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStatePlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStatePlayingPaused; function = EFunctionForward; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStatePlayingPaused; function = EFunctionRewind; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStatePlayingPaused; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdleEmbedded; function = EFunctionStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStatePlayingPaused; function = EFunctionSetNewPosition; } + }; + }, + // Disabled button state + VR_STATE + { + id = EStateDisableButtons; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDisconnectCall; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionNop; } + }; + + } + }; + }, + + VR_CONTEXT + { + id = EContextNokiaRingTone; + transition = VR_TRANSITION { next = EStateNRTIdle; }; + states = + { + VR_STATE + { + id = EStateNRTIdle; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateNRTPlaying; function = EFunctionPlay; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateNRTIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateNRTIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateNRTIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateNRTIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateNRTIdle; function = EFunctionSetNewPosition; } + }; + }, + VR_STATE + { + id = EStateNRTPlaying; + transitions = + { + VR_TRANSITION { cmd = ECmdStop; next = EStateNRTIdle; function = EFunctionNRTStop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateNRTIdle; function = EFunctionNRTStop; }, + VR_TRANSITION { cmd = ECmdAutoStopAtEnd; next = EStateNRTIdle; function = EFunctionNRTAutoStop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateNRTIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateNRTIdle; function = EFunctionNRTStop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateNRTIdle; function = EFunctionNRTStop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateNRTPlaying; function = EFunctionSetNewPosition; } + }; + }, + // Disabled button state + VR_STATE + { + id = EStateDisableButtons; + transitions = + { + VR_TRANSITION { cmd = ECmdPlay; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdForward; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRewind; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdRecord; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdAutoStopInterrupted; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSilentStop; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdDelete; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdEndKey; next = EStateIdle; function = EFunctionNop; }, + VR_TRANSITION { cmd = ECmdSetNewPosition; next = EStateIdle; function = EFunctionNop; } + }; + } + }; + } + }; + } + + +// --------------------------------------------------------- +// +// New VoiceRecorder Avkon buttons' resources +// Each button has as many states as there are visual states +// in VR +// +// --------------------------------------------------------- +// +RESOURCE VR_BUTTONS_NEW r_vr_button_panel_buttons + { + buttons = + { + // PLAY BUTTON + AVKON_BUTTON + { + flags = KAknButtonNoFrame | KAknButtonReportOnKeyDown; + states = + { + // memo_open + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_mask; + }, + // memo_deleted + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive_mask; + }, + // memo_recording + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive_mask; + }, + // memo_record_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive_mask; + }, + // memo_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_pause; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_pause_mask; + }, + // memo_paused_playback + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_mask; + }, + // memo_paused_record + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive_mask; + }, + // memo_open_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_mask; + }, + // memo_record_embed_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_mask; + }, + // nokia_ringing_tone_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_mask; + }, + // nokia_ringing_tone_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive_mask; + }, + // disable_buttons + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_play_inactive_mask; + } + }; + }, + + // STOP BUTTON + AVKON_BUTTON + { + flags = KAknButtonNoFrame | KAknButtonReportOnKeyDown; + states = + { + // memo_open + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + }, + // memo_deleted + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + }, + // memo_recording + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_mask; + }, + // memo_record_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + }, + // memo_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_mask; + }, + // memo_paused_playback + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_mask; + }, + // memo_paused_record + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_mask; + }, + // memo_open_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + }, + // memo_record_embed_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + }, + // nokia_ringing_tone_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + }, + // nokia_ringing_tone_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_mask; + }, + // disable_buttons + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_stop_inactive_mask; + } + }; + }, + + // RECORD BUTTON + AVKON_BUTTON + { + flags = KAknButtonNoFrame | KAknButtonReportOnKeyDown; + states = + { + // memo_open + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_mask; + }, + // memo_deleted + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_mask; + }, + // memo_recording + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_pause; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_pause_mask; + }, + // memo_record_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_mask; + }, + // memo_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive_mask; + }, + // memo_paused_playback + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive_mask; + }, + // memo_paused_record + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_mask; + }, + // memo_open_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive_mask; + }, + // memo_record_embed_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_mask; + }, + // nokia_ringing_tone_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive_mask; + }, + // nokia_ringing_tone_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive_mask; + }, + // disable_buttons + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rec_inactive_mask; + } + }; + }, + + // REWIND BUTTON + AVKON_BUTTON + { + flags = KAknButtonNoFrame | KAknButtonReportOnKeyDown; + states = + { + // memo_open + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_mask; + }, + // memo_deleted + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + }, + // memo_recording + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + }, + // memo_record_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + }, + // memo_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_mask; + }, + // memo_paused_playback + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_mask; + }, + // memo_paused_record + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + }, + // memo_open_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_mask; + }, + // memo_record_embed_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_mask; + }, + // nokia_ringing_tone_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + }, + // nokia_ringing_tone_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + }, + // disable_buttons + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_rew_inactive_mask; + } + + }; + }, + + // FORWARD BUTTON + AVKON_BUTTON + { + flags = KAknButtonNoFrame | KAknButtonReportOnKeyDown; + states = + { + // memo_open + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_mask; + }, + // memo_deleted + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + }, + // memo_recording + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + }, + // memo_record_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + }, + // memo_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_mask; + }, + // memo_paused_playback + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_mask; + }, + // memo_paused_record + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + }, + // memo_open_embed + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_mask; + }, + // memo_record_embed_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_mask; + }, + // nokia_ringing_tone_idle + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + }, + // nokia_ringing_tone_playing + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + }, + // disable_buttons + AVKON_BUTTON_STATE + { + bmpfile = "z:\\Resource\\apps\\voicerecorder.mif"; + bmpid = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive; + bmpmask = EMbmVoicerecorderQgn_indi_vorec_button_forw_inactive_mask; + } + + }; + } + }; + } + +// ELAF variants +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_1_euro + { + font = ELatinBold13; C = 215; l = 57; r = 5; B = 23; W = 114; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_2_euro + { + font = ELatinPlain12; C = 215; l = 62; r = 5; B = 39; W = 109; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_3_euro + { + font = ELatinPlain12; C = 215; l = 62; r = 5; B = 54; W = 109; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_4_euro + { + font = ELatinPlain12; C = 215; l = 58; r = 100; B = 115; W = 18; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_5_euro + { + font = ELatinPlain12; C = 215; l = 142; r = 4; B = 115; W = 30; J = ELayoutAlignRight; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_6_euro + { + font = ELatinBold13; C = 35; l = 57; r = 5; B = 98; W = 114; J = ELayoutAlignLeft; + } + + +// APAC variants + +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_1_apac + { + font = EApacPlain16; C = 215; l = 57; r = 5; B = 25; W = 114; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_2_apac + { + font = EApacPlain12; C = 215; l = 64; r = 5; B = 41; W = 107; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_3_apac + { + font = EApacPlain12; C = 215; l = 64; r = 5; B = 56; W = 107; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_4_apac + { + font = EApacPlain12; C = 215; l = 58; r = 100; B = 117; W = 18; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_5_apac + { + font = EApacPlain12; C = 215; l = 142; r = 4; B = 117; W = 30; J = ELayoutAlignRight; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_6_apac + { + font = EApacPlain16; C = 35; l = 57; r = 5; B = 100; W = 114; J = ELayoutAlignLeft; + } + + +// ABRW variants +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_1_arabic_hebrew + { + font = ELatinBold13; C = 215; l = 5; r = 57; B = 23; W = 114; J = ELayoutAlignRight; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_2_arabic_hebrew + { + font = ELatinPlain12; C = 215; l = 5; r = 62; B = 39; W = 109; J = ELayoutAlignRight; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_3_arabic_hebrew + { + font = ELatinPlain12; C = 215; l = 5; r = 62; B = 54; W = 109; J = ELayoutAlignRight; + } +// l changed from 100 to 90 to make max length label fit +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_4_arabic_hebrew + { + font = ELatinPlain12; C = 215; l = 90; r = 58; B = 115; W = 30; J = ELayoutAlignRight; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_5_arabic_hebrew + { + font = ELatinPlain12; C = 215; l = 4; r = 124; B = 115; W = 30; J = ELayoutAlignLeft; + } +RESOURCE AVKON_LAYOUT_LABEL r_vr_statusinfo_label_6_arabic_hebrew + { + font = ELatinBold13; C = 35; l = 5; r = 57; B = 98; W = 114; J = ELayoutAlignRight; + } + + + +//--------------------------------------------------------------- +// Old CBA resources +// Middle Softkey not included +//--------------------------------------------------------------- +// +RESOURCE CBA r_vr_softkeys_pause_stop + { + buttons = + { + CBA_BUTTON { id = ECmdPause; txt = qtn_vorec_pause_sk; }, + CBA_BUTTON { id = ECmdStop; txt = qtn_vorec_stop_sk; } + }; + } + +RESOURCE CBA r_vr_softkeys_play_stop + { + buttons = + { + CBA_BUTTON { id = ECmdPlay; txt = text_softkey_play; }, + CBA_BUTTON { id = ECmdStop; txt = qtn_vorec_stop_sk; } + }; + } + +RESOURCE CBA r_vr_softkeys_record_stop + { + buttons = + { + CBA_BUTTON { id = ECmdRecord; txt = qtn_vorec_rec_sk; }, + CBA_BUTTON { id = ECmdStop; txt = qtn_vorec_stop_sk; } + }; + } + +RESOURCE CBA r_vr_softkeys_record_back + { + buttons = + { + CBA_BUTTON { id = ECmdRecord; txt = qtn_vorec_rec_sk; }, + CBA_BUTTON { id = ECmdCancel; txt = text_softkey_back; } + }; + } + +RESOURCE CBA r_vr_softkeys_ok_cancel + { + buttons = + { + CBA_BUTTON {id=ECmdOk; txt=text_softkey_select;}, + CBA_BUTTON {id=ECmdCancel; txt= text_softkey_cancel;} + }; + } + +RESOURCE CBA r_vr_softkeys_stop + { + buttons = + { + CBA_BUTTON { txt =" "; }, + CBA_BUTTON {id=ECmdStop; txt= qtn_vorec_stop_sk;} + }; + } + + +//--------------------------------------------------------------- +// New CBA resources +// Middle Softkey included +//--------------------------------------------------------------- +// +RESOURCE CBA r_vr_softkeys_pause_stop_select + { + buttons = + { + CBA_BUTTON { id = ECmdPause; txt = qtn_vorec_pause_sk; }, + CBA_BUTTON { id = ECmdStop; txt = qtn_vorec_stop_sk; }, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +RESOURCE CBA r_vr_softkeys_play_stop_select + { + buttons = + { + CBA_BUTTON { id = ECmdPlay; txt = text_softkey_play; }, + CBA_BUTTON { id = ECmdStop; txt = qtn_vorec_stop_sk; }, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +RESOURCE CBA r_vr_softkeys_record_stop_select + { + buttons = + { + CBA_BUTTON { id = ECmdRecord; txt = qtn_vorec_rec_sk; }, + CBA_BUTTON { id = ECmdStop; txt = qtn_vorec_stop_sk; }, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +RESOURCE CBA r_vr_softkeys_record_back_select + { + buttons = + { + CBA_BUTTON { id = ECmdRecord; txt = qtn_vorec_rec_sk; }, + CBA_BUTTON { id = ECmdCancel; txt = text_softkey_back; }, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + + +#ifdef __SERIES60_31__ +// LSK in 3.1 is "Select" +RESOURCE CBA r_vr_softkeys_ok_cancel_select + { + buttons = + { + CBA_BUTTON { id = ECmdOk; txt = text_softkey_select;}, + CBA_BUTTON { id = ECmdCancel; txt = text_softkey_cancel;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } +#else +// LSK in 3.2 is "Insert" +RESOURCE CBA r_vr_softkeys_ok_cancel_select + { + buttons = + { + CBA_BUTTON { id = ECmdOk; txt = qtn_vorec_insert_sk;}, + CBA_BUTTON { id = ECmdCancel; txt = text_softkey_cancel;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } +#endif + + +RESOURCE CBA r_vr_softkeys_stop_select + { + buttons = + { + CBA_BUTTON { txt =" "; }, + CBA_BUTTON { id = ECmdStop; txt= qtn_vorec_stop_sk;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +// A new CBA resource with MSK. Replaces R_AVKON_SOFTKEYS_OPTIONS_BACK +RESOURCE CBA r_vr_softkeys_options_back_select + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EAknCmdExit; txt = text_softkey_back;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +// A new CBA resource with MSK. Replaces R_AVKON_SOFTKEYS_OPTIONS_EXIT +RESOURCE CBA r_vr_softkeys_options_exit_select + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EAknCmdExit; txt = text_softkey_exit;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +// A CBA resource for disabling CBA use. The texts are shown but LSK and RSK +// cause no operation. +RESOURCE CBA r_vr_softkeys_options_exit_select_no_command + { + buttons = + { + CBA_BUTTON { id = ECmdNOP; txt = text_softkey_option; }, + CBA_BUTTON { id = ECmdNOP; txt = text_softkey_exit;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_select;} + }; + } + +// A new CBA resource for settings dialog +RESOURCE CBA r_vr_softkeys_options_back_change + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = EAknCmdExit; txt = text_softkey_back;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_change;} + }; + } + +// A new CBA resource for General Settings dialog +RESOURCE CBA r_vr_softkeys_gs_options_back_change + { + buttons = + { + CBA_BUTTON { id = EAknSoftkeyOptions; txt = text_softkey_option; }, + CBA_BUTTON { id = ECmdCancel; txt = text_softkey_back;}, + CBA_BUTTON { id = ECmdMSK; txt = qtn_msk_change;} + }; + } + +// Resources for General Settings plugin + +//---------------------------------------------------- +// +// r_vorec_gs_setting_list_view +// Main settings view +// +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_vorec_gs_setting_list_view + { + menubar = r_vorec_gs_settings_menubar; + cba = r_vr_softkeys_gs_options_back_change; + } + +//---------------------------------------------------- +// +// r_vorec_gs_settings_title_name +// Title name used as name of plugin +// +//---------------------------------------------------- +// +RESOURCE TBUF r_vorec_gs_settings_title + { + buf = qtn_vorec_app_title; + } + +//---------------------------------------------------- +// +// r_vorec_gs_view_title +// Setting view's title. +// +//---------------------------------------------------- +// +RESOURCE TITLE_PANE r_vorec_gs_view_title + { + txt = qtn_vorec_app_title; + } + +//---------------------------------------------------- +// +// r_vorec_gs_settings_menupane +// GS Plugin options menu, EEikCmdExit replaced with +// ECmdOk to ensure that we can save the settings +// +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_vorec_gs_settings_menupane + { + items= + { + MENU_ITEM { command = ECmdChange; txt = qtn_vorec_settings_change; flags = EEikMenuItemAction ; }, + MENU_ITEM { command = EAknCmdHelp; txt = qtn_options_help; }, + MENU_ITEM { command = ECmdOk; txt = qtn_options_exit; } + }; + } + +RESOURCE MENU_BAR r_vorec_gs_settings_menubar + { + titles= + { + MENU_TITLE { menu_pane = r_vorec_gs_settings_menupane; } + }; + } + +// --------------------------------------------------------- +// +// r_vorec_memory_selection_dialog +// Memory selection dialog, setting page resource +// +// --------------------------------------------------------- +// +RESOURCE MEMORYSELECTIONDIALOG r_vorec_memory_selection_dialog + { + title = qtn_vorec_set_store; + softkey_1 = text_softkey_ok; + softkey_2 = text_softkey_cancel; + + locations = + { + LOCATION + { + root_path = text_phone_memory_root_path; + default_folder = text_digital_sounds_path; + }, + LOCATION + { + root_path = text_memory_card_root_path; + } + }; + } + +RESOURCE DIALOG r_vorec_usb_connected_dialog + { + flags = EAknWaitNoteFlags|EEikDialogFlagModeless; + buttons = R_AVKON_SOFTKEYS_BACK; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralQuery; + control= AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_usb_mode_note_mode_activated; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/data/1020729D.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/data/1020729D.rss Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2006 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: +* ECOM plugin resource file for GS VoiceRecorder plugin. +* +* +*/ + +#include + +/** +* How to use the resource definition: +* +* IMPLEMENTATION_INFO +* { +* implementation_uid = ; +* version_no = 1; +* display_name = ""; +* default_data = ""; +* opaque_data = ""; +* } +* +* For example plugins wishing to use Apps Plugin as a parent use +* KGSAppsPluginUid (defined in GSFWViewUIDs.h): +* +* default_data = "0x10207239"; +* +* Note that position of the plugin is supported only for internally provided +* plugins. Others, such as 3rd party plugins, are sorted according to their +* name and plugin provider category. +* +* Plugin position must follow the postition defined in UI specification. +* Position starts from 0. Use -1 if position is not to be used in sorting. +* +*/ +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x1020729D; // Plugin dll UID + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10207236; // UID for CGSPluginInterface - do not change. + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x1020729D; // Plugin UID + version_no = 1; + display_name = "Voice Recorder settings"; // Plugin debug name + default_data = "0x10207239"; // Parent UID + opaque_data = "90"; // Order number + } + }; + } + }; + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/group/GSVoiceRecorderPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/group/GSVoiceRecorderPlugin.mmp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2006 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 project specification file for GS VoiceRecorder Plugin . +* +*/ + + +#include +#include + +CAPABILITY CAP_ECOM_PLUGIN +TARGET GSVoiceRecorderPlugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D 0x1020729D +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE VRGSPluginImplementationTable.cpp +SOURCE CVRGSPlugin.cpp +SOURCE CVRGSPluginContainer.cpp + +USERINCLUDE ../inc +USERINCLUDE ../data +USERINCLUDE ../../group +USERINCLUDE ../../UtilsInc +USERINCLUDE ../../../inc // ADo level inc dir + +APP_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../data + +// ECOM resource definition +START RESOURCE 1020729D.rss +TARGET GSVoiceRecorderPlugin.rsc +END // ECOM resource definition + +LANG SC +LIBRARY euser.lib +LIBRARY GSEcomPlugin.lib +LIBRARY GSFramework.lib +LIBRARY GSListBox.lib // For CGSListBoxItemTextArray +LIBRARY cone.lib +LIBRARY commonengine.lib//For RConeResourceLoader +LIBRARY commondialogs.lib // CAknMemorySelectionDialog +LIBRARY egul.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY eikcoctl.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY FeatMgr.lib // Feature manager +LIBRARY avkon.lib +LIBRARY aknskins.lib // AknsUtils.h +LIBRARY hlplch.lib // for "Help" options menu +LIBRARY VoiceRecorderUtils.lib + +#ifdef RD_MULTIPLE_DRIVE +LIBRARY PlatformEnv.lib +#endif + +// - used only by Codewarrior for convenience. +DOCUMENT 1020729D.rss +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006 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 file provides the information required for building +* VoiceRecorderGSPlugin +* +*/ + + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +GSVoiceRecorderPlugin.mmp + + +PRJ_TESTMMPFILES + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/inc/CVRGSPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/inc/CVRGSPlugin.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,208 @@ +/* +* Copyright (c) 2005 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: Main settings view class. +* +*/ + + +#ifndef GS_VOICERECORDERGSPLUGIN_H +#define GS_VOICERECORDERGSPLUGIN_H + +// Includes +#include +#include +#include +#include +#include + + +// Classes referenced +class CVRGSPluginContainer; +class CAknViewAppUi; +class CGSBaseView; + +// Constants + +/** +* UPDATE THIS: +* +* This UID is used for both the view UID and the ECOM plugin implementation +* UID. +*/ +const TUid KGSVoiceRecorderGSPluginUid = { 0x1020729D }; + +// CLASS DECLARATION + +/** +* CVRGSPlugin view class. +* +* This is an VoiceRecorderGS of the minimal GS plugin.CGSPluginInterface +*/ +class CVRGSPlugin : public CGSBaseView + { + + public: // Constructors and destructor + + /** + * Symbian OS two-phased constructor + * @return + * @since 3.1 + */ + static CVRGSPlugin* NewL( TAny* aInitParams ); + + /** + * Destructor. + */ + ~CVRGSPlugin(); + + + public: // Functions from base classes + + /** + * From CAknView, returns the views id. + * @return Returns id of the view. + * @since 3.1 + */ + TUid Id() const; + + /** + * From MEikCommandObserver, handles the menu based commands. + * @param aCommand identifies the given command. + * @since 3.1 + */ + void HandleCommandL( TInt aCommand ); + + /** + * Updates specific value to container + * @param aListItem item index to update + * @param aNewValue new value for the setting + * @since 3.1 + */ + void UpdateListBoxL( const TInt& aListItem, TInt aNewValue ); + + public: // From CGSPluginInterface + + /** + * Method for getting caption of this plugin. This should be the + * localized name of the settings view to be shown in parent view. + * @param aCaption pointer to Caption variable + * @since 3.1 + */ + void GetCaptionL( TDes& aCaption ) const; + + /** + * Creates a new icon of desired type. Override this to provide custom + * icons. Othervise default icon is used. Ownership of the created icon + * is transferred to the caller. + * + * Icon type UIDs (use these defined constants): + * KGSIconTypeLbxItem - ListBox item icon. + * KGSIconTypeTab - Tab icon. + * + * @param aIconType UID Icon type UID of the icon to be created. + * @return Pointer of the icon. NOTE: Ownership of this icon is + * transferred to the caller. + * @since 3.1 + */ + CGulIcon* CreateIconL( const TUid aIconType ); + + /** + * Method for checking, if plugin should be visible and used in GS FW. + * (for example shown in listbox of the parent view). + * + * On default plugin is visible. Overwrite this function to enable or + * disable your plugin dynamically. + * + * @return ETrue if plugin should be visible in GS. + * @return EFalse if plugin should not be visible in GS. + * @since 3.1 + */ + TBool Visible() const; + + /** + * Reserved for future use/plugin's custom functionality. This can be + * overwritten if plugin needs to have custom functionality which cannot + * be fulfilled otherwise. + * @since 3.1 + */ + TAny* CustomOperationL( TAny* aParam1, TAny* aParam2 ); + + /** + * From CEikAppUi + * Handle skin change event. + * @since 3.1 + */ + void HandleClientRectChange(); + + /** + * From CAknView Activate this view + * @param aPrevViewId + * @param aCustomMessageId + * @param aCustomMessage + * @since 3.1 + */ + void DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ); + + /** + * From CAknView Deactivate this view + * @since 3.1 + */ + void DoDeactivate(); + + /** + * Get VoiceRecorderGSPlugin's container. + * @since 3.1 + */ + CVRGSPluginContainer* Container(); + + protected: + + /** + * C++ default constructor. + */ + CVRGSPlugin(); + + /** + * Symbian OS default constructor. + */ + void ConstructL(); + + /** + * Handles OK key press. + * @since 3.1 + */ + void HandleListBoxSelectionL(); + + /** + * Creates new container. + * @since 3.1 + */ + void NewContainerL(); + + void CVRGSPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + + + protected: //Data + + RConeResourceLoader iResourceLoader; + + // Buffered caption of the plugin. Owned + HBufC* iCaption; + + private: + }; + +#endif // GS_VoiceRecorderGSPLUGIN_H diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/inc/CVRGSPluginContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/inc/CVRGSPluginContainer.h Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2006 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: Voice Recorder sub-menu in General Settings. +* +*/ + + +#ifndef VOICERECORDERGSPLUGINCONTAINER_H +#define VOICERECORDERGSPLUGINCONTAINER_H + +// INCLUDES +#include "voicerecorder.hrh" + +// System includes +#include +#include + +// FORWARD DECLARATIONS +class CAknSettingItemArray; + +// CLASS DECLARATION +/** +* CVRGSPluginContainer class +*/ +class CVRGSPluginContainer : public CGSBaseContainer + { + public: // Constructors and destructor + + /** + * Default C++ constructor + */ + CVRGSPluginContainer(); + + /** + * Symbian OS default constructor. + * + * @param aRect gives the correct TRect for construction. + */ + void ConstructL( const TRect& aRect ); + + /** + * Destructor. + */ + ~CVRGSPluginContainer(); + + public: + + /** + * Updates list box + * + * @param aFeatureId is a updated list box item + */ + virtual void UpdateListBoxL( TInt aFeatureId ); + + /** + * Creates list box + * + * @param aResLbxId is resource number to create. + */ + void ConstructListBoxL( TInt aResLbxId ); + + /** + * Retrieves the currently selected listbox feature id + * @return feature id. + * @since 3.1 + */ + TInt CurrentFeatureId() const; + + /** + * From CCoeControl changes the size of the list box + */ + void SizeChanged(); + + /** + * Handle listbox selection event + * @param aCommand Command id to tell origin of event + */ + void HandleListBoxSelectionL( TInt aCommand ); + + /** + * Store all values from setting items to permanent storage + */ + void StoreAllL(); + + protected: //new + + /** + * Creates list box items + */ + virtual void CreateListBoxItemsL(); + + /** + * Required for help. + */ + void GetHelpContext( TCoeHelpContext& aContext ) const; + + + private: + /** + * Array of setting items contained in the listbox. Owned. + */ + CAknSettingItemArray* iSettingItemArray; + + /** + * Selected memo quality + */ + TVRQuality iQuality; + + /** + * Selected memo store + */ + CAknMemorySelectionDialog::TMemory iMemoStore; + + /** + * Selected memo store + */ + TDriveNumber iDrive; + + }; + +#endif // VOICERECORDERGSPLUGINCONTAINER_H + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/src/CVRGSPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/src/CVRGSPlugin.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,373 @@ +/* +* Copyright (c) 2006 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: Main settings view class +* +*/ + + +// INCLUDE FILES +#include "CVRGSPlugin.h" +#include "CVRGSPluginContainer.h" + +#include "VRConsts.h" +#include +#include "voicerecorder.hrh" + +#include "VRUtils.h" + +#include // For icon generation +#include // For icon generation + +#include +#include +#include +#include // CAknTitlePane +#include +#include //for StringLoader +#include //for KGSMainViewUid +#include // For HlpLauncher +#include // for BaflUtils +#include + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CVRGSPlugin::CVRGSPlugin +// C++ constructor +// --------------------------------------------------------------------------- +// +CVRGSPlugin::CVRGSPlugin() + : iResourceLoader( *iCoeEnv ) + { + + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::NewLC +// Symbian OS two-phased constructor +// --------------------------------------------------------------------------- +// +CVRGSPlugin* CVRGSPlugin::NewL( TAny* /*aInitParams*/ ) + { + CVRGSPlugin* self = new(ELeave) CVRGSPlugin(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::ConstructL +// Symbian OS 2nd phase constructor +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::ConstructL() + { +#ifdef _DEBUG + RDebug::Print(_L("[CVRGSPlugin] ConstructL()" )); + RDebug::Print( _L( "[CVRGSPlugin] Loading resource from :" ) ); + RDebug::Print( KVRAppResourceFile ); +#endif + + // Find the resource file + TParse parse; + parse.Set( KVRAppResourceFile, + &KDC_APP_RESOURCE_DIR, + NULL ); + TFileName fileName( parse.FullName() ); + + // Get language of resource file + BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); + + // Open resource file + iResourceLoader.OpenL( fileName ); + FeatureManager::InitializeLibL(); + + BaseConstructL( R_VOREC_GS_SETTING_LIST_VIEW ); + + iCaption = StringLoader::LoadL( R_VOREC_GS_SETTINGS_TITLE ); + } + + +// Destructor +CVRGSPlugin::~CVRGSPlugin() + { + FeatureManager::UnInitializeLib(); + + if( iContainer ) + { + if ( iAppUi ) + { + iAppUi->RemoveFromViewStack( *this, iContainer ); + } + delete iContainer; + iContainer=NULL; + } + + iResourceLoader.Close(); + + delete iCaption; + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::Id +// Return UID of view +// --------------------------------------------------------------------------- +// +TUid CVRGSPlugin::Id() const + { + return KGSVoiceRecorderGSPluginUid; + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::HandleCommandL +// Handle commands +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::HandleCommandL( TInt aCommand ) + { + + switch ( aCommand ) + { + case ECmdChange: + case EAknCmdOpen: + // Delegate to container + Container()->HandleListBoxSelectionL( EAknCmdOpen ); + break; + case ECmdMSK: + // Delegate to container + // Selection view is not open when command is ECmdMSK + Container()->HandleListBoxSelectionL( ECmdMSK ); + break; + case EAknSoftkeyBack: + case ECmdCancel: + // Activate previous view +#ifdef _DEBUG + RDebug::Print(_L("VRGS: activating view 0x%x"), iPrevViewId.iViewUid.iUid); +#endif + iAppUi->ActivateLocalViewL( iPrevViewId.iViewUid ); + break; + case EAknCmdHelp: + if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) + { + HlpLauncher::LaunchHelpApplicationL( + iEikonEnv->WsSession(), iAppUi->AppHelpContextL() ); + } + break; + case ECmdOk: // Exit selected from options menu + { + iAppUi->HandleCommandL( EEikCmdExit ); + break; + } + default: + iAppUi->HandleCommandL( aCommand ); + break; + } + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::DoActivate +// Activate this view +// --------------------------------------------------------------------------- +// + +void CVRGSPlugin::DoActivateL( const TVwsViewId& aPrevViewId, + TUid aCustomMessageId, + const TDesC8& aCustomMessage ) + { + CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::DoDeactivate +// Deactivate this view +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::DoDeactivate() + { + CGSBaseView::DoDeactivate(); + } + + +// ----------------------------------------------------------------------------- +// CVRGSPlugin::HandleClientRectChange +// Handle screen size change. +// ----------------------------------------------------------------------------- +// +void CVRGSPlugin::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::Container +// Return handle to container class. +// --------------------------------------------------------------------------- +// +CVRGSPluginContainer* CVRGSPlugin::Container() + { + return static_cast( iContainer ); + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::HandleListBoxSelectionL +// Handle any user actions while in the list view. +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::HandleListBoxSelectionL() + { + // Delegate to container + Container()->HandleListBoxSelectionL( ECmdChange ); + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::GetCaptionL +// Caption text for view to be displayed in NaviPane. +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::GetCaptionL( TDes& aCaption ) const + { + aCaption.Copy( *iCaption ); + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::NewContainerL +// Creates new iContainer. +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::NewContainerL() + { + iContainer = new( ELeave ) CVRGSPluginContainer; + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::CreateIconL +// Return the icon, if has one. +// --------------------------------------------------------------------------- +// +CGulIcon* CVRGSPlugin::CreateIconL( const TUid /*aIconType*/ ) + { + + // New implementation + TParse* fp = new(ELeave) TParse(); + CleanupStack::PushL( fp ); + TInt err = fp->Set( KVRPluginFile, &KDC_APP_BITMAP_DIR, NULL ); + + if ( err != KErrNone ) + { + User::Leave( err ); + } + + TBuf fileName = fp->FullName(); + CleanupStack::PopAndDestroy(); //fp + + CGulIcon* icon; + + icon = AknsUtils::CreateGulIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSetAppsVoirec, + fileName, + EMbmGsvoicerecorderpluginQgn_prop_set_apps_voirec, + EMbmGsvoicerecorderpluginQgn_prop_set_apps_voirec_mask ); + + return icon; + + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::Visible() +// Method for checking, if plugin should be visible and used in GS. +// --------------------------------------------------------------------------- +// +TBool CVRGSPlugin::Visible() const + { + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) || + FeatureManager::FeatureSupported( KFeatureIdMmc ) ) + { + return ETrue; + } + else + { + return EFalse; + } + + } + + +// --------------------------------------------------------------------------- +// CVRGSPlugin::CustomOperationL() +// Reserved for later use. +// --------------------------------------------------------------------------- +// +TAny* CVRGSPlugin::CustomOperationL( TAny* aParam1, TAny* /*aParam2*/ ) + { + return aParam1; + } + + +// --------------------------------------------------------------------------- +// CVRSettingsDialog::DynInitMenuPaneL +// +// --------------------------------------------------------------------------- +// +void CVRGSPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + + switch ( aResourceId ) + { + case R_VOREC_GS_SETTINGS_MENUPANE: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); + } + break; + } + case R_VR_SETTINGS_MENUPANE: + { + // Check if HELP is enabled in FeatureManager, if not, disable the Help menu item + if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) + { + aMenuPane->SetItemDimmed(ECmdHelp, ETrue); + } + break; + } + + + default: + { + break; + } + } + } + +// End of file + + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/src/CVRGSPluginContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/src/CVRGSPluginContainer.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,369 @@ +/* +* Copyright (c) 2006 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: Voice Recorder sub-menu in General Settings. +* +*/ + + +// INCLUDES +#include "CVRGSPluginContainer.h" +#include "CVRGSPlugin.h" + +#include +#include + +#include "VRConsts.h" +#include "VRUtils.h" +#include + + +#include //for CAknSettingStyleListBox +#include +#include +#include // for CAknInformationNote +//#include +#include //for listbox clases +#include // CAknIconArray +#include // CColumnListBoxData + +#ifdef RD_MULTIPLE_DRIVE +#include +#include +#include +#endif + +const TUid KVRAppUID = { KVoiceRecorderAppUID3 }; + +// ListBox item index +enum TListItemIndex + { + EListItemQualityIndex = 0, + ElistItemMemoStoreIndex, + }; + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::ConstructL +// Symbian OS default constructor +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::ConstructL( const TRect& aRect ) + { + // Construct iListBox + iListBox = new ( ELeave ) CAknSettingStyleListBox; + iSettingItemArray = new(ELeave) CAknSettingItemArray(2,0,0); + + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + iQuality = VRUtils::QualityL(); + } + + // Convert the internal memory enumeration to CFD enumeration +#ifndef RD_MULTIPLE_DRIVE + if ( VRUtils::MemoStoreL() == EMemoStorePhoneMemory ) + { + iMemoStore = CAknMemorySelectionSettingPage::EPhoneMemory; + } + else + { + iMemoStore = CAknMemorySelectionSettingPage::EMemoryCard; + } +#else + iDrive = (TDriveNumber)VRUtils::MemoDriveL(); + +#endif + + BaseConstructL( aRect, R_VOREC_GS_VIEW_TITLE, 0 ); + } + + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::~CGSTelPluginContainer +// Destructor +// --------------------------------------------------------------------------- +// +CVRGSPluginContainer::~CVRGSPluginContainer() + { + if ( iSettingItemArray ) + { + iSettingItemArray->ResetAndDestroy(); + } + + delete iSettingItemArray; + } + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::CGSTelPluginContainer +// Default constructor +// --------------------------------------------------------------------------- +// +CVRGSPluginContainer::CVRGSPluginContainer() + : iQuality( EQualityMMSOptimized ), + iMemoStore( CAknMemorySelectionSettingPage::EPhoneMemory ) + { + } + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::UpdateListBoxL +// Update listbox item +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::UpdateListBoxL( TInt /*aFeatureId*/ ) + { + + // Update the listbox + iListBox->HandleItemAdditionL(); + } + + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::ConstructListBoxL +// Update listbox item +// Items are added manually, instead of loading them from resources +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::ConstructListBoxL( TInt /*aResLbxId*/ ) + { + iListBox->ConstructL( this, EAknListBoxSelectionList ); + + // Create items to array + CreateListBoxItemsL(); + + // Set array to listbox + CTextListBoxModel* model = iListBox->Model(); + model->SetItemTextArray( iSettingItemArray ); + // Ownership retained by us + model->SetOwnershipType( ELbmDoesNotOwnItemArray ); + + iSettingItemArray->RecalculateVisibleIndicesL(); + iListBox->CreateScrollBarFrameL( ETrue ); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( + CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::CreateListBoxItemsL +// Update listbox item +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::CreateListBoxItemsL() + { + CAknSettingItem* settingItem; + HBufC* itemTitle; + + // Add quality setting + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + + // Add quality setting +#ifdef __AAC_ENCODER_PLUGIN + settingItem = new( ELeave ) CAknEnumeratedTextPopupSettingItem ( 0, ( TInt& ) iQuality ); + +#else + settingItem = new( ELeave ) CAknBinaryPopupSettingItem ( 0, ( TInt& ) iQuality ); +#endif + CleanupStack::PushL( settingItem ); + + itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_QUALITY ); + settingItem->ConstructL( EFalse, EListItemQualityIndex, *itemTitle, NULL, + R_VR_SETTINGS_DEFAULT_SPEAKER_PAGE, + EAknCtPopupField, NULL, + R_VR_SETTINGS_QUALITY_TEXTS ); + + CleanupStack::PopAndDestroy(); // itemTitle + + // Add quality item to the settings array + iSettingItemArray->AppendL( settingItem ); + CleanupStack::Pop(); // settingItem + } + if ( VRUtils::MultipleMassStorageAvailable() ) + { + // Add memo store setting + // Create the memo store item +#ifndef RD_MULTIPLE_DRIVE + settingItem = + new( ELeave ) CAknMemorySelectionSettingItem( 0, iMemoStore ); + //multiple drives +#else + settingItem = + new( ELeave ) CAknMemorySelectionSettingItemMultiDrive(0, iDrive ); + TInt includedMedias = AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage | + AknCommonDialogsDynMem::EMemoryTypeMMCExternal; + static_cast< CAknMemorySelectionSettingItemMultiDrive *> ( settingItem )->SetIncludedMediasL( includedMedias ); +#endif + + CleanupStack::PushL( settingItem ); + + itemTitle = iCoeEnv->AllocReadResourceLC( R_QTN_VOREC_SET_STORE ); + +#ifndef RD_MULTIPLE_DRIVE + // Set memo store item's title + settingItem->ConstructL( EFalse, id, *itemTitle, NULL, + R_VOREC_MEMORY_SELECTION_DIALOG, EAknCtPopupSettingList ); +#else + settingItem->ConstructL( EFalse, ElistItemMemoStoreIndex, *itemTitle, NULL, 0, EAknCtPopupSettingList ); +#endif + + CleanupStack::PopAndDestroy(); // itemTitle + + // Add memo store item to the settings array + iSettingItemArray->AppendL( settingItem ); + CleanupStack::Pop(); // settingItem + } + } + + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::CurrentFeatureId +// Get the currently selected feature +// --------------------------------------------------------------------------- +// +TInt CVRGSPluginContainer::CurrentFeatureId() const + { + if ( iSettingItemArray ) + { + return iSettingItemArray->MdcaCount(); + } + else + { + return 0; + } + } + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::GetHelpContext +// Get help for this view +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KVRAppUID; + aContext.iContext = KVOREC_HLP_SETTINGS; + } + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::SizeChanged +// Set the size and position of component controls. +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::SizeChanged() + { + if ( iListBox ) + { + iListBox->SetRect( Rect() ); + } + } + +void CVRGSPluginContainer::HandleListBoxSelectionL( TInt aCommand ) + { + TInt index( iListBox->CurrentItemIndex() ); + TInt driveDefaultMassStorage = VRUtils::DefaultMemoDriveL(); + TInt driveRemovableMassStorage = VRUtils::GetRemovableMassStorageL(); + + if ( index >=0 ) // index is -1 if there are no items in the list + { + if(index == ElistItemMemoStoreIndex && + !VRUtils::DriveValid(driveDefaultMassStorage) && + !VRUtils::DriveValid(driveRemovableMassStorage) ) + { + return; + } + // Open edit dialog if EAknCmdOpen, invert the value otherwise + iSettingItemArray->At( index )->EditItemL( aCommand == EAknCmdOpen ); + iListBox->DrawItem( index ); + //Store all settings after change + StoreAllL(); + } + } + +// --------------------------------------------------------------------------- +// CVRGSPluginContainer::StoreAll +// Stores values in settings list to permanent storage +// --------------------------------------------------------------------------- +// +void CVRGSPluginContainer::StoreAllL() + { + // Retrieve values to member variables + TInt settingItemCount( iSettingItemArray->Count() ); + + for ( TInt i( 0 ); i < settingItemCount; i++ ) + { + iSettingItemArray->At( i )->StoreL(); + } + + // Save memo store setting +#ifndef RD_MULTIPLE_DRIVE + if ( iMemoStore == CAknMemorySelectionSettingPage::EPhoneMemory ) + { + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + else + { + // check if MMC is read-only + TVRDriveInfo mmcInfo; + VRUtils::GetMMCInfo( mmcInfo ); + + if ( mmcInfo.iDriveReadOnly ) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC( + R_QTN_MEMC_READONLY ); + CAknInformationNote* infoNote = + new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy(); // noteText + VRUtils::SetMemoStoreL( EMemoStorePhoneMemory ); + } + else + { + VRUtils::SetMemoStoreL( EMemoStoreMMC ); + } + } +#else + TUint status( 0 ); + TInt defaultDrive = VRUtils::DefaultMemoDriveL(); + if (VRUtils::MemoDriveL() != defaultDrive) + { + VRUtils::GetDriveInfo(iDrive, status); + // check if drive status is ok + if ( status & DriveInfo::EDriveReadOnly ) + { + HBufC* noteText = iCoeEnv->AllocReadResourceLC(R_QTN_MEMC_READONLY ); + CAknInformationNote* infoNote = new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( *noteText ); + CleanupStack::PopAndDestroy(); // noteText + + // use default device drive to save files + iDrive = (TDriveNumber)defaultDrive; + } + } + if(iDrive == defaultDrive || iDrive == VRUtils::GetRemovableMassStorageL()) + { + VRUtils::SetMemoDriveL( iDrive ); + } +#endif + + // Save quality setting + if ( VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) ) + { + // Save the quality setting + VRUtils::SetQualityL( iQuality ); + } + + } + +// End of File diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/gsplugin/src/VRGSPluginImplementationTable.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/gsplugin/src/VRGSPluginImplementationTable.cpp Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2006 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: +* ECOM proxy table for this plugin +* +*/ + + +// System includes +#include +#include + +// User includes +#include "CVRGSPlugin.h" + +// Constants +const TImplementationProxy KVoiceRecorderGSPluginImplementationTable[] = + { + // UPDATE THIS - Uid for plugin implementation: + IMPLEMENTATION_PROXY_ENTRY( 0x1020729D, CVRGSPlugin::NewL ) + }; + + +// --------------------------------------------------------------------------- +// ImplementationGroupProxy +// Gate/factory function +// --------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(KVoiceRecorderGSPluginImplementationTable) + / sizeof(TImplementationProxy); + return KVoiceRecorderGSPluginImplementationTable; + } + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/help/data/xhtml.zip Binary file voicerecorder/help/data/xhtml.zip has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/help/group/bld.inf Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - Initial contribution +* +* Contributors: +* +* +* Description: +* Export help related files. +* +*/ + +#include +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/vorec.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/vorec.hlp.hrh) +../rom/voicerechelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(voicerechelps_variant.iby) diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/help/inc/vorec.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/help/inc/vorec.hlp.hrh Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// +// vorec.hlp.hrh generated by CSXHelp Utilities. +// + +#ifndef __VOREC_HLP_HRH__ +#define __VOREC_HLP_HRH__ + +_LIT(KVOREC_HLP_EMPTY_RECORDER, "VOREC_HLP_EMPTY_RECORDER"); // +_LIT(KVOREC_HLP_MAIN, "VOREC_HLP_MAIN"); // +_LIT(KVOREC_HLP_SETTINGS, "VOREC_HLP_SETTINGS"); // + +#endif \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/help/rom/voicerechelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/help/rom/voicerechelps_variant.iby Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - Initial contribution +* +* Contributors: +* +* +* Description: +* Export resource files for S60 Voice Recorder helps. +* +*/ + +#ifndef __VOICERECHELPS_VARIANT_IBY__ +#define __VOICERECHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x100058CA\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x100058CA\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x100058CA\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x100058CA\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x100058CA\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x100058CA\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x100058CA\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x100058CA\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/loc/voicerecorder.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/loc/voicerecorder.loc Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2002 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 localisation file for VoiceRecorder.app +* A .loc file is the one and only place where the logical strings +* to be localised are defined. +* +* +*/ + + +// LOCALISATION STRINGS + +// d: Application title from list. +// l: list_single_large_graphic_pane_t1 +// w: +// r: 3.0 +#define qtn_vorec_app_title "Recorder" + +// d: Application title from grid. +// l: cell_app_pane_t1 +#define qtn_vorec_app_menu_grid "Recorder" + +// d: Default file name created by VoiceRec application. +// d: The first memo will be assigned with this name. +// d: The maximum length for the name is 20 characters +// d: The filename extension (.amr) is NOT included in the translation. +// l: vorec_t1 +// w: +// r: 1.0 +#define qtn_vorec_first_memo_name "Sound clip" + +// d: Default file name created by VoiceRec application. +// d: Memos after the first memo will be assigned with this name +// d: The maximum name length is specified as 20 characters, but the +// d: number formatting must be taken into account ( Memo(105) ). +// d: The filename extension (.amr) is NOT included in the translation. +// d: Can be removed after qtn_vorec_default_memo_name has been taken in use +// l: vorec_t1 +// w: +// r: 3.1 +#define qtn_vorec_memo_name "Sound clip(%N)" + +//d: A new default file name created by VoiceRec application. +//d: Replaces qtn_vorec_memo_name. +//d: Memos after the first memo will be assigned with this name +//d: The maximum name length is specified as 20 characters, but the +//d: number formatting must be taken into account (e.g. Memo(105) ). +//d: The filename extension (.amr) is NOT included in the translation. +//d: %U is replaced by the running memo count number retrieved from the Central Repository +//l: vorec_t1 +//w: +//r: 3.1 +// +#define qtn_vorec_default_memo_name "Sound clip(%U)" + +// d: Menu string +// d: Close memo and open empty to record option on menu. +// l: list_single_pane_t1_cp2 +#define qtn_vorec_rec_new "Record new" + +// d: Menu string +// d: Erase current memo menu item. +// l: list_single_pane_t1_cp2 +#define qtn_vorec_delete "Delete" + +// d: Menu string +// d: Change name of current memo option on menu. +// l: list_single_pane_t1_cp2 +#define text_voice_rec_edit_title "Edit name" + +// d: Menu string +// d: Go to File Manager app at location of clips. +// l: list_single_pane_t1_cp2 +#define qtn_vorec_goto_my_clips "Go to my clips" + +// d: Menu item +// d: Save mail attachment. +// l: list_single_pane_t1_cp2 +#define qtn_vorec_save_mail_atta "Save" + +// d: Softkey text +// d: provides the command to record +// l: control_pane_t1/opt7 +#define qtn_vorec_rec_sk "Record" + +// d: Softkey text +// d: provides the command to play +// l: control_pane_t1/opt7 +#define text_softkey_play "Play" + +// d: Softkey text +// d: provides the command to pause +// l: control_pane_t1/opt7 +#define qtn_vorec_pause_sk "Pause" + +// d: Softkey text +// d: Provides the command to stop +// l: control_pane_t1/opt7 +#define qtn_vorec_stop_sk "Stop" + +//d:Softkey text +//l:control_pane_t1/opt7 +//w: +//r:3.2 +// +#define qtn_vorec_insert_sk "Insert" + +// d: Information Note +// d: Shown when recording is stopped while in embedded mode +// l: popup_note_window +#define qtn_vorec_info_record_stopped "Recording stopped" + +// d: Information Note +// d: Shown when trying to use Voice Recorder during a video call +// l: popup_note_window +#define qtn_vorec_info_video_call_ongoing "Voice Recorder cannot be used during video call" + +// d: Information Note +// d: Shown when trying to use Voice Recorder during an internet call +// l: popup_note_window +// w: +// r: 3.0 +#define qtn_vorec_info_internet_call_ongoing "Voice Recorder cannot be used during an internet call" + +// d: Error note text +// d: Failed to open or play memo. File format error. +// l: popup_note_window +#define qtn_vorec_info_memo_unsupported "Unable to play memo. Memo format not supported." + +// d: Error note text +// d: Failed to open or play memo. File format error. +// l: popup_note_window +#define qtn_vorec_info_memo_corrupted "Unable to play memo. Memo corrupted." + +// d: Error note text +// d: Failed to play or record. Media Server error. +// l: popup_note_window +#define qtn_vorec_info_server_error "Unable to continue. Media server error." + +// d: Wait note text +// d: Shown when voice memo is being saved to permanent storage +// d: Recording is stopped by user +// l: popup_note_wait_window +#define qtn_vorec_wait_saving_memo "Saving memo..." + +// d: Wait note text +// d: Shown when voice memo is being saved to permanent storage +// d: Recording is stopped automatically +// l: popup_note_wait_window +#define qtn_vorec_wait_stop_saved "Saving stopped memo..." + +// d: Menu string +// d: Settings Options submenu item for changing item settings. +// l: list_single_pane_t1_cp2 +#define qtn_vorec_settings_change "Change" + +// d: Recorder View Status text +// d: Displayed while recording is in progress +// l: vorec_t4 +#define qtn_vorec_recording "Recording" + +// d: Recorder View Status text +// d: Displayed while playback is in progress +// l: vorec_t4 +// w: +// r: 3.1 +#define qtn_vorec_playback "Playing" + +// d: Recorder View Status text +// d: Displayed while playing/recording is paused +// l: vorec_t4 +#define qtn_vorec_paused "Paused" + +// d: Format string for the memo name +// d: Memo name is placed in %U +// l: vorec_t1 +#define qtn_vorec_memo_label "%U" + +// d: Format string for the creation date of the memo +// d: Date is placed in %0U and time in %1U +// d: %0U is formatted with R_QTN_DATE_USUAL_WITH_ZERO +// d: %1U is formatted with R_QTN_TIME_USUAL_WITH_ZERO +// l: vorec_t2 +// w: +// r: 3.1 +#define qtn_vorec_date_label "%0U %1U" + +// d: Min/Start value of the memo play/record progress bar +// d: Always zero. +// l: vorec_t6 +#define qtn_vorec_min_label "0" + +// d: Format for displaying elapsed time and time left in recording and playback states. +// d: %0U is elapsed time +// d: %1U is maximum recording time, estimated time left or length of played memo +// d: %0U and %1U are formatted with R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO, or +// d: R_QTN_TIME_DURAT_LONG if the time is longer than one hour +// l: vorec_t5 +// w: +// r: 3.1 +#define qtn_vorec_time_indic "%0U / %1U" + +// d: Recorder view quality text +// l: vorec_t7 +// w: +// r: 3.1 +#define qtn_vorec_quality_label "Quality:" + +// d: Recorder view quality text for MMS optimized quality +// l: vorec_t3 +// w: +// r: 3.1 +#define qtn_vorec_quality_mms_optimized "MMS" + +// d: Recorder view quality text for High quality +// l: vorec_t3 +// w: +// r: 3.1 +#define qtn_vorec_quality_high "High" + +// d: Recorder view quality text for Normal quality +// l: vorec_t7 +// w: +// r: 3.2 +#define qtn_vorec_quality_normal "Normal" + +// --------------------------------------------------------------------------- +// Memory store usage specific strings + +// d: Information note +// d: Shown when VR is started and MMC is selected as default store, +// d: but MMC is not available or it is locked +// l: popup_note_window +// w: +// r: 1.0 +#define qtn_memc_vorec_note1 "The selected memory store is not accessible. Phone memory will be used instead." + +// d: Information note +// d: Shown when VR is started and MMC is selected as default store, but MMC is read-only +// l: popup_note_window +// w: +// r: 3.1 +#define qtn_memc_vorec_note2 "The selected memory store is read-only. Phone memory will be used instead." + +// d: Error note +// d: Shown when user tries to unlock MMC, but enters an incorrect password +// l: popup_note_window +#define qtn_memc_set_password_error "The passwords don't match, try again!" + +// d: Setting item title +// d: Title for Memo Store Setting Item +// l: list_setting_pane_t1 +#define qtn_vorec_set_store "Memo store" + +// d: Confirmation note +// d: Shown if when VR is started and MMC is locked +// l: popup_note_window +#define qtn_memc_unlock_query1 "The selected memory store is locked, it can't be used. Do you want to unlock it?" + +// d: Information note +// d: Shown when VR is started and the SD card is not inserted +// l: popup_note_window +// w: +// r: 3.1 +#define qtn_ccor_insert_mmc "Please insert memory card." + +// d: Information note +// d: Shown when VR is started and the USB is inserted in Mass Storage mode +// l: popup_note_window +// w: +// r: 3.1 +#define qtn_usb_mode_note_mode_activated "USB connected in Mass storage mode" + +// --------------------------------------------------------------------------- +// No voice key specific strings + +// d: Setting item title +// d: Title for Memo Store Setting Item +// l: list_setting_pane_t1 +#define qtn_vorec_set_ihf "Default speaker" + +// d: setting_item_with_two_available_ values +// d: Indicates that the IHF is being selected as default speaker +// l: list_set_graphic_pane_t1 +#define qtn_vorec_settings_ihf_hf "Handsfree" + +// d: setting_item_with_two_available_ values +// d: Indicates that the earpiece is being selected as default speaker +// l: list_set_graphic_pane_t1 +#define qtn_vorec_settings_ihf_ear "Earpiece" + + +// --------------------------------------------------------------------------- +// No voice key AND MMC specific strings + +// d: Menu string +// d: Displays the settings dialog. +// l: list_single_pane_t1_cp2 +// w: +// r: 3.0 +#define qtn_vorec_settings "Settings" + +// --------------------------------------------------------------------------- +// Quality specific strings + +// d: Setting item title +// d: Title for Recording quality setting item +// l: list_setting_pane_t1 +// w: +// r: 3.1 +#define qtn_vorec_set_quality "Recording quality" + +// d: setting_item_with_two_available_ values +// d: Indicates that memo quality is MMS Optimized +// l: list_set_graphic_pane_t1 +// w: +// r: 3.1 +#define qtn_vorec_settings_quality_mms_optimized "MMS Optimized" + +// d: setting_item_with_two_available_ values +// d: Indicates that memo quality is High quality +// l: list_set_graphic_pane_t1 +// w: +// r: 3.1 +#define qtn_vorec_settings_quality_high "High" + + +// d: setting_item_with_three_available_ values +// d: Indicates that memo quality is Normal quality +// l: list_set_graphic_pane_t1 +// w: +// r: 3.2 +#define qtn_vorec_settings_quality_normal "Normal" diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/rom/Voicerecorder.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/rom/Voicerecorder.iby Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2005 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: +* Image description file for project Voicerecorder +* +* +*/ + +#ifndef __VOICERECORDER_IBY__ +#define __VOICERECORDER_IBY__ + +S60_APP_EXE(Voicerecorder) +S60_APP_AIF_ICONS(Voicerecorder) +S60_UPGRADABLE_APP_REG_RSC(Voicerecorder) + +ECOM_PLUGIN(GSVoiceRecorderPlugin.dll,GSVoiceRecorderPlugin.rsc) + +SCALABLE_IMAGE(Resource\apps,APP_BITMAP_DIR,Voicerecorder) + +file=ABI_DIR\BUILD_DIR\VoicerecorderUtils.DLL SHARED_LIB_DIR\VoicerecorderUtils.DLL +file=ABI_DIR\BUILD_DIR\VoicerecorderRecview.DLL SHARED_LIB_DIR\VoicerecorderRecview.DLL +file=ABI_DIR\BUILD_DIR\NewService.DLL SHARED_LIB_DIR\NewService.DLL + +data=DATAZ_\BITMAP_DIR\GSVoiceRecorderPlugin.mif BITMAP_DIR\GSVoiceRecorderPlugin.mif + +data=ZPRIVATE\100058CA\backup_registration.xml private\100058CA\backup_registration.xml + +data=ZSYSTEM\Install\VoiceRecorder_stub.SIS System\install\VoiceRecorder_stub.SIS + +#endif + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/rom/VoicerecorderResources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/rom/VoicerecorderResources.iby Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2005 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: +* The iby file contains files that must be included in image +* +* +*/ + +#ifndef __VOICERECORDERRESOURCES_IBY__ +#define __VOICERECORDERRESOURCES_IBY__ + +S60_APP_CAPTION(Voicerecorder) + +data=DATAZ_\APP_RESOURCE_DIR\Voicerecorder.rsc APP_RESOURCE_DIR\Voicerecorder.rsc +//data=ZSYSTEM\Data\voicerecview.rsc System\Data\voicerecview.rsc + +#endif + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/101F87A3.cre Binary file voicerecorder/sis/101F87A3.cre has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/VoiceRecorder.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/VoiceRecorder.pkg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,43 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Package file for VoiceRecorder. +; +; Languages +&EN + +; Packet-header (name, uid, major, minor, build, type) +#{"Voice Recorder"},(0x10207BB4),1,1,0,TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Nokia" +"\epoc32\release\armv5\urel\VoiceRecorder.exe" -"c:\sys\bin\VoiceRecorder.exe" +"\epoc32\release\armv5\urel\VoiceRecorderUtils.dll" -"c:\sys\bin\VoiceRecorderUtils.dll" +"\epoc32\release\armv5\urel\VoiceRecorderRecView.dll" -"c:\sys\bin\VoiceRecorderRecView.dll" +"\epoc32\release\armv5\urel\NewService.dll" -"c:\sys\bin\NewService.dll" +"\epoc32\release\armv5\urel\GSVoiceRecorderPlugin.dll" -"c:\sys\bin\GSVoiceRecorderPlugin.dll" + +"\epoc32\data\Z\resource\apps\VoiceRecorder.rsc" -"c:\resource\apps\VoiceRecorder.rsc" +"\epoc32\data\Z\private\10003a3f\apps\VoiceRecorder_reg.rsc" -"c:\private\10003a3f\import\apps\VoiceRecorder_reg.rsc" +"\epoc32\data\Z\resource\plugins\GSVoiceRecorderPlugin.rsc" -"c:\resource\plugins\GSVoiceRecorderPlugin.rsc" + +"\epoc32\data\Z\resource\apps\voicerecorder.mif" -"c:\resource\apps\voicerecorder.mif" +"\epoc32\data\Z\resource\apps\voicerecorder_aif.mif" -"c:\resource\apps\voicerecorder_aif.mif" +"\epoc32\data\Z\resource\apps\GSVoiceRecorderPlugin.mif" -"c:\resource\apps\GSVoiceRecorderPlugin.mif" + +; CenRep ini file +;"\epoc32\data\z\private\10202be9\101F87A3.txt" -"c:\private\10202BE9\persists\101F87A3.txt" +"101F87A3.cre" - "c:\private\10202be9\101F87A3.cre" \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/VoiceRecorder.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/VoiceRecorder.xml Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,54 @@ + + + + + + + 1 + + S60 VoiceRecorder + + VoiceRecorder + + + + + + S60 + + + 5 + 0 + + + 2008 + 46 + + + + + 5 + 0 + + 2010 + 1 + + + + + + \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/VoiceRecorderCenrep.pkg Binary file voicerecorder/sis/VoiceRecorderCenrep.pkg has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/VoiceRecorder_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/VoiceRecorder_stub.pkg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,27 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Package file for project VoiceRecorder stub sis. +; +;Language +&EN + +;Header +# {"Voice Recorder"}, (0x10207BB4), 1, 0, 0, TYPE=SA + +; Localised Vendor Name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/VoiceRecorder_stub.sis Binary file voicerecorder/sis/VoiceRecorder_stub.sis has changed diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/VoiceRecorder_udeb.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/VoiceRecorder_udeb.pkg Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,48 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Package file for VoiceRecorder udeb version. +; +; Languages +&EN + +; Packet-header (name, uid, major, minor, build, type) +#{"Voice Recorder"},(0x10207BB4),1,1,0,TYPE=SA, RU + +; Localised vendor name +%{"Nokia"} + +; Unique vendor name +:"Vendor" + +"\epoc32\release\armv5\udeb\VoiceRecorder.exe" -"c:\sys\bin\VoiceRecorder.exe" +"\epoc32\release\armv5\udeb\VoiceRecorderUtils.dll" -"c:\sys\bin\VoiceRecorderUtils.dll" +"\epoc32\release\armv5\udeb\VoiceRecorderRecView.dll" -"c:\sys\bin\VoiceRecorderRecView.dll" +"\epoc32\release\armv5\udeb\NewService.dll" -"c:\sys\bin\NewService.dll" +"\epoc32\release\armv5\udeb\GSVoiceRecorderPlugin.dll" -"c:\sys\bin\GSVoiceRecorderPlugin.dll" + +"\epoc32\data\Z\resource\apps\VoiceRecorder.rsc" -"c:\resource\apps\VoiceRecorder.rsc" +"\epoc32\data\Z\private\10003a3f\apps\VoiceRecorder_reg.rsc" -"c:\private\10003a3f\import\apps\VoiceRecorder_reg.rsc" +"\epoc32\data\Z\resource\plugins\GSVoiceRecorderPlugin.rsc" -"c:\resource\plugins\GSVoiceRecorderPlugin.rsc" + +"\epoc32\data\Z\resource\apps\voicerecorder.mif" -"c:\resource\apps\voicerecorder.mif" +"\epoc32\data\Z\resource\apps\voicerecorder_aif.mif" -"c:\resource\apps\voicerecorder_aif.mif" +"\epoc32\data\Z\resource\apps\GSVoiceRecorderPlugin.mif" -"c:\resource\apps\GSVoiceRecorderPlugin.mif" + + + + + +; CenRep ini file +;"\epoc32\data\z\private\10202be9\101F87A3.txt" -"c:\private\10202BE9\persists\101F87A3.txt" +"101F87A3.cre" - "c:\private\10202be9\101F87A3.cre" diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/build_cenrep_sisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/build_cenrep_sisx.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,20 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Bat file for making mpxcenrep.sisx. +rem +Echo please copy key files to ROOT before build sis file +del voicerecordercenrep.sis voicerecordercenrep.sisx +makesis -v voicerecordercenrep.pkg +signsis voicerecordercenrep.sis voicerecordercenrep.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key +//del voicerecordercenrep.sis \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/build_sis_stub.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/build_sis_stub.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,16 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Bat file for making VoiceRecorder_stub.sis. +rem +makesis -s VoiceRecorder_stub.pkg VoiceRecorder_stub.sis \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/build_sisx.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/build_sisx.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,19 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Delete old sis file, creating new sis package and sign it. +rem + +del VoiceRecorder.sis VoiceRecorder.sisx +makesis -v VoiceRecorder.pkg +signsis -v VoiceRecorder.sis VoiceRecorder.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/build_sisx_udeb.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/build_sisx_udeb.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,19 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: Delete old udeb sis file, creating new sis package and sign it. +rem + +del VoiceRecorder_udeb.sis VoiceRecorder_udeb.sisx +makesis -v VoiceRecorder_udeb.pkg +signsis -v VoiceRecorder_udeb.sis VoiceRecorder_udeb.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/change_version.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/change_version.bat Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,27 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: A utility to change version of the binaries. +rem + +elftran.exe -version 15.9 \epoc32\release\armv5\urel\VoiceRecorder.exe +elftran.exe -version 15.9 \epoc32\release\armv5\urel\VoiceRecorderUtils.dll +elftran.exe -version 15.9 \epoc32\release\armv5\urel\VoiceRecorderRecView.dll +elftran.exe -version 15.9 \epoc32\release\armv5\urel\NewService.dll +elftran.exe -version 15.9 \epoc32\release\armv5\urel\GSVoiceRecorderPlugin.dll + +elftran.exe -version 15.9 \epoc32\release\armv5\udeb\VoiceRecorder.exe +elftran.exe -version 15.9 \epoc32\release\armv5\udeb\VoiceRecorderUtils.dll +elftran.exe -version 15.9 \epoc32\release\armv5\udeb\VoiceRecorderRecView.dll +elftran.exe -version 15.9 \epoc32\release\armv5\udeb\NewService.dll +elftran.exe -version 15.9 \epoc32\release\armv5\udeb\GSVoiceRecorderPlugin.dll \ No newline at end of file diff -r 072a5fa0c63b -r c6bafb5162d8 voicerecorder/sis/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/voicerecorder/sis/readme.txt Wed Sep 01 12:29:14 2010 +0100 @@ -0,0 +1,35 @@ +*************************************** +* Steps to create Voice Recorder SISX +*************************************** + +************ Voice Recorder has to be upgraded as "full upgrade" package +************ The DLLs and the resource file will always be upgraded together + + +1. Upgrade the DLLs version number (refer to: Upgrade dll version number) +2. Build the VoiceRecorder sisx file +3. Build the cenrep sisx file + + +************************************** +* Cenrep +************************************** +1. Build centrepconv.exe (refer to IAD wiki) + +2. Create the cenrep.txt file using the "cenrep Configuration Tool" +Refer to: +K:\s60\tools\toolsextensions\ConfigurationTool + +3. Copy the cenrep .txt file into c:\cenrep\ + +4. Create the cenrep .cre file: +K:\epoc32\release\winscw\udeb>centrepconv.exe -nowait -o c:\cenrep\101F87A3.cre c:\cenrep\101F87A3.txt + +5. To create the cenrep sis file: +- copy "101F87A3.cre" into the "\voicerec\VoiceRecorder\sis" directory, then run the "build_cenrep_sisx.bat" + + +************************************** +* Upgrade dll version number +************************************** +1. Run "change_version.bat" script from \voicerec\VoiceRecorder\sis