mobilemessaging/audiomsg/inc/audiomessageprogressdialog.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Class that handles voice progressdialog operations.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef AUDIOMESSAGEPROGRESSDIALOG_H
       
    21 #define AUDIOMESSAGEPROGRESSDIALOG_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <AknProgressDialog.h>
       
    25 #include <notecontrol.h>
       
    26 #include <remconcoreapitargetobserver.h>
       
    27 #include <e32debug.h>
       
    28 #include "amsvoiceobserver.h"
       
    29 #include <AknNaviDecoratorObserver.h>
       
    30 
       
    31 class CAudioMessageRecorder;
       
    32 class MAmsVolumeObserver;
       
    33 class CRemConInterfaceSelector;
       
    34 class CRemConCoreApiTarget;
       
    35 class CAknVolumePopup;
       
    36 class CAudioMessageDocument;
       
    37 
       
    38 /**
       
    39  *  Shows dialog with progressbar, states and time of duration. 
       
    40  *	Controls recording and playing via AudioMessageRecoder object
       
    41  *
       
    42  *  @lib audiomessage.exe
       
    43  *  @since S60 v3.1
       
    44  */
       
    45 class CAudioMessageProgressDialog : public CAknProgressDialog, 
       
    46  									public MAmsVoiceObserver,	
       
    47  									public MRemConCoreApiTargetObserver,
       
    48                                     public MAknNaviDecoratorObserver
       
    49     {
       
    50     protected:
       
    51     	enum TAmsProgressFlags
       
    52     		{
       
    53     		EAmsWorkingModeRecorder = 0x1,
       
    54     		EAmsSetExit = 0x2,
       
    55     		EAmsWsEventStop = 0x4,
       
    56     		EAmsPause = 0x8,
       
    57     		EAmsSupportAudioOutput = 0x10,
       
    58     		EAmsAudioOutputEarpiece = 0x20
       
    59     		};
       
    60     public:  // Constructors and destructor
       
    61         /**
       
    62          * Constructor
       
    63          */
       
    64         CAudioMessageProgressDialog( CAudioMessageDocument& aDocument);
       
    65 
       
    66         /**
       
    67          * Destructor
       
    68          */
       
    69         virtual ~CAudioMessageProgressDialog();
       
    70 
       
    71 	    /**
       
    72 	     * Factory function to create this object
       
    73 	     *
       
    74 	     * @param aFile filehandle for voice 
       
    75 	     * @param aVolume volume level
       
    76 	     * @param aSpeakerEarpiece speaker ETrue earpiece
       
    77 	     * @param aRecorder, record or play working mode
       
    78 	     */
       
    79        	static CAudioMessageProgressDialog* NewL( const RFile& aFile, TInt aVolume,
       
    80        		 TBool aSpeakerEarpiece, TBool aRecorder, CAudioMessageDocument& aDocument);
       
    81 	
       
    82         /**
       
    83          * set observer for navipane use
       
    84          */
       
    85 		void SetNaviObserver( MAmsVolumeObserver* aObserver );
       
    86 
       
    87         /**
       
    88          * set mode of progressdialog
       
    89          * @param ETrue recoding, EFalse playing
       
    90          */
       
    91 	//	void SetMode( TBool aMode );
       
    92 
       
    93         /**
       
    94          * set max message size
       
    95          * @param sSize
       
    96          */
       
    97 		void SetMaxMessageSize( TUint aSize );
       
    98 
       
    99         /**
       
   100          * stop recording/playing
       
   101          */
       
   102         void Stop();
       
   103 
       
   104         /**
       
   105          * Starts remove timer. Cancels running remove timer.
       
   106          * If SVK event occurs, the timer is cancelled and restarted.
       
   107          */
       
   108   		void StartRemoveTimerL( );
       
   109 
       
   110         /**
       
   111          * Cancels remove timer. 
       
   112          * If SVK event occurs, the timer is restarted.
       
   113          */
       
   114         void CancelRemoveTimer( );
       
   115         
       
   116 
       
   117         /**
       
   118          * From MAknNaviDecoratorObserver
       
   119          * Handles the navi decorator events.
       
   120          * These are created by pressing the arrows related on volumebar.
       
   121          */
       
   122         void HandleNaviDecoratorEventL( TInt aEventID );
       
   123 
       
   124         /**
       
   125          * From MCoeControlObserver
       
   126          * Handles the control events coming from the volumebar.
       
   127          * These events do not include the arrow-presses.
       
   128          */
       
   129         void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
       
   130 
       
   131         /**
       
   132          * Sets the observer for the volumecontrol
       
   133          */
       
   134         void SetVolCtrlObserver( MCoeControlObserver& aObserver );
       
   135 
       
   136 
       
   137     protected: // New functions
       
   138         /**
       
   139          * Constructor.
       
   140          */
       
   141 		void ConstructL( const RFile& aFile, TInt aVolume ,
       
   142 		TBool aSpeakerEarpiece, TBool aRecorder);
       
   143 		
       
   144 	protected:	// from MAmsRecObserver
       
   145 		/**
       
   146 		* Called to notify a change in the observed subject's state.
       
   147 		*/
       
   148      	void PlayingStops();
       
   149  
       
   150      	void UpdateL( TTimeIntervalMicroSeconds aCurrentDuration, TInt aErrorCode );
       
   151 	private:
       
   152         /**
       
   153         * Calls respective observer function
       
   154         */
       
   155         void DoChangeVolumeL( );
       
   156 
       
   157         /**
       
   158         * ChangeVolume is the callback function called from change volume timer.
       
   159         */
       
   160         static TInt ChangeVolume(TAny* aThis);
       
   161 
       
   162         /**
       
   163          * From CAknProgressDialog
       
   164          * keyevents
       
   165          */        
       
   166 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   167 
       
   168     //from MRemConCoreApiTargertObserver
       
   169     protected: 	
       
   170         /**
       
   171          * @see MRemConCoreApiTargetObserver.
       
   172          *
       
   173          * A command has been received. 
       
   174          * @param aOperationId The operation ID of the command.
       
   175          * @param aButtonAct The button action associated with the command.
       
   176          */
       
   177 		void MrccatoCommand( TRemConCoreApiOperationId   aOperationId, 
       
   178                                     TRemConCoreApiButtonAction  aButtonAct );
       
   179     // from CAknProgressDialog                                
       
   180     protected:  
       
   181         
       
   182         /**
       
   183         * From CAknProgressDialog
       
   184         * @see CAknProgressDialog for more information
       
   185         */
       
   186         void PreLayoutDynInitL();
       
   187 
       
   188         /**
       
   189         * From CAknProgressDialog
       
   190         * @see CAknProgressDialog for more information
       
   191         */
       
   192         void PostLayoutDynInitL();
       
   193 
       
   194         /**
       
   195         * From CAknProgressDialog
       
   196         * @see CAknProgressDialog for more information
       
   197         */
       
   198         TBool OkToExitL(TInt aButtonId);
       
   199 
       
   200     private:  // Functions from base classes
       
   201 
       
   202         /**
       
   203          * Called by Update 
       
   204          * updates the progress bar texts
       
   205          * @return void
       
   206          * @param text and interval
       
   207          */
       
   208        void UpdateProgressTextL( TInt aText, 
       
   209         			TTimeIntervalMicroSeconds aMicroSec );
       
   210         /**
       
   211          * Called by Update 
       
   212          * updates the progress bar
       
   213          * @return void
       
   214          * @param currrent value of timer
       
   215          */
       
   216 	   	void DoTickL(TTimeIntervalMicroSeconds aCurrValue);
       
   217 
       
   218         /**
       
   219          * pause recording
       
   220          */
       
   221        	void PauseL();
       
   222 
       
   223         /**
       
   224          * continue recording.
       
   225          */
       
   226        	void ContinueL();
       
   227 
       
   228         /**
       
   229          * set softkeys dynamically
       
   230          * @param resouce
       
   231          */
       
   232        	void SetSoftkeys( TInt aSk );
       
   233        	
       
   234         /**
       
   235          * set icon for progressdialog
       
   236          */
       
   237        	void SetProgressIconL( TInt aIconId, TInt aIconMask );
       
   238        	
       
   239         /**
       
   240          * change outputouting
       
   241          */
       
   242        	void ToLoudspeaker();
       
   243 
       
   244         /**
       
   245          * change outputouting
       
   246          */
       
   247        	void ToEarpiece();
       
   248         
       
   249         /**
       
   250          * sets navipanel volume indicator via appui
       
   251          */
       
   252        	void SetNaviVolL();
       
   253 
       
   254         /**
       
   255          * show note when max rec time appears
       
   256          */
       
   257        	void ShowInformationNoteL( TInt aResourceID, TBool aWaiting );
       
   258 
       
   259    private: //data
       
   260        	CAudioMessageDocument& iDocument;
       
   261        	/** 
       
   262        	 * Observer to notify about a event. 
       
   263        	 * Not owned. 
       
   264        	 **/
       
   265 		MAmsVolumeObserver* iNaviVolObserver;
       
   266        	CEikProgressInfo* iProgressInfo;
       
   267 
       
   268        	/** 
       
   269        	 * recorder. 
       
   270        	 * Owned. 
       
   271        	 **/
       
   272         CAudioMessageRecorder* iRecorder;
       
   273 
       
   274  		TTimeIntervalMicroSeconds iPausePosMicroSec;
       
   275 		
       
   276 		/** 
       
   277 		 * max rec/play time.
       
   278 		 */
       
   279  		TTimeIntervalMicroSeconds iMaxDurationMicroSec;
       
   280 
       
   281 		/** 
       
   282 		 * max size, sets by appui
       
   283 		 */
       
   284         TUint iMaxMessageSize;
       
   285        	
       
   286        	/** 
       
   287        	 * for storing current volume level
       
   288        	 **/
       
   289 		TInt iCurrentVolume;
       
   290         TInt iTickCount;
       
   291 		
       
   292 		CAknVolumePopup* iVolumePopup;
       
   293 		
       
   294 		/** 
       
   295 		 * max rec/play value.
       
   296 		 */
       
   297         TInt iFinalValue;
       
   298     	TInt iIncrement;
       
   299 		/** 
       
   300 		 * Remote Controller. 
       
   301 		 * Owned.
       
   302 		 */
       
   303 	    CRemConInterfaceSelector* iInterfaceSelector;
       
   304 
       
   305 		/** 
       
   306 		 * Remote Controller. 
       
   307 		 * Not owned.
       
   308 		 */
       
   309 	    CRemConCoreApiTarget* iCoreTarget;
       
   310 	    CPeriodic* iVolumeTimer;
       
   311 
       
   312        	/** 
       
   313        	 * for volume up/down use 
       
   314        	 **/
       
   315         TInt iChange;
       
   316 	    
       
   317        	/** 
       
   318        	 * for mode, exits, outputrouting, feature 
       
   319        	 **/
       
   320 	    TInt iFlags;
       
   321       	HBufC* iTimeDuratBase;
       
   322       	HBufC* iTextRecording;
       
   323       	HBufC* iTextPlaying;
       
   324       	HBufC* iTextPaused;
       
   325       	
       
   326       	//Following are made to reduce allocation in every 1 second when
       
   327       	//the progressbar is running
       
   328       	HBufC* iLengthMax;
       
   329       	HBufC* iLengthNow;
       
   330       	
       
   331 #ifdef RD_SCALABLE_UI_V2      	
       
   332       	MCoeControlObserver* iVolCtrlObserver;
       
   333 #endif      	
       
   334 
       
   335 
       
   336    };
       
   337 
       
   338 #endif  // AudioMessagePROGRESSDIALOG_H
       
   339 
       
   340 // End of File