mpx/tsrc/public/basic/common/testviewframework/inc/testplaybackview.h
changeset 62 b276843a15ba
equal deleted inserted replaced
58:c76ea6caa649 62:b276843a15ba
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  A view displaying basic playback state and feature
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TESTPLAYBACKVIEW_H
       
    19 #define TESTPLAYBACKVIEW_H
       
    20 
       
    21 /* INCLUDES */
       
    22 #include "testBaseview.h"
       
    23 #include "testplaybackviewobserver.h"
       
    24 
       
    25 /* DATA TYPE */
       
    26 _LIT(KTxtTestPlaybackView, "TestPlaybackView");
       
    27 
       
    28 /* FORWARD DECLARATION*/
       
    29 class MTestPlaybackViewObserver;
       
    30 
       
    31 /**
       
    32  *  UI of playback test
       
    33  *
       
    34  *  @lib testplaybackutility.lib
       
    35  *  @since S60 v3.0
       
    36  */
       
    37 class CTestPlaybackView : public CTestBaseView
       
    38     {
       
    39 public:
       
    40     
       
    41     IMPORT_C static CTestPlaybackView* NewL(CConsoleMain* aConsoleMain,
       
    42                                             CTestBaseView* aParent,
       
    43                                             const TDesC& aName,
       
    44                                             CStifLogger* aLogger);
       
    45 
       
    46     IMPORT_C virtual ~CTestPlaybackView();
       
    47     
       
    48     /**
       
    49      * Add observer
       
    50      * @since S60 v3.0
       
    51      * @param aObs an observer to add
       
    52      */
       
    53     IMPORT_C void AddObserver(MTestPlaybackViewObserver* aObs);
       
    54      
       
    55      /**
       
    56     * Update current index in the playlist
       
    57     * @param aIndex current index
       
    58     * @param aTotalItem total index
       
    59     */
       
    60     IMPORT_C void UpdateItemIndex(TInt aIndex, TInt aTotalItem);
       
    61     
       
    62     /**
       
    63     * Update position in the song
       
    64     * @param aPosition position
       
    65     * @param aDuration duration
       
    66     */
       
    67     IMPORT_C void UpdateProgress(TInt aPosition, TInt aDuration);
       
    68     
       
    69     /**
       
    70     * Update volume
       
    71     * @param aVolume current volume
       
    72     * @param @aMaxVolume maximum volume
       
    73     */
       
    74     IMPORT_C void UpdateVolume(TInt aVolume, TInt aMaxVolume);
       
    75     
       
    76     /**
       
    77     * Update artist and song name
       
    78     * @param aArtist artist name
       
    79     * @param aSongName song name
       
    80     */
       
    81     IMPORT_C void UpdateSongInfo(const TDesC& aArtist, const TDesC& aSongName);
       
    82     
       
    83     /**
       
    84     * Handles state changes in playbackutility
       
    85     */
       
    86     IMPORT_C void StateChanged(TTestPlaybackState aState);
       
    87 
       
    88 // from base class CTestBaseView
       
    89     /**
       
    90      * Initialization of a view before first time activation
       
    91      */
       
    92     void InitializeViewL();
       
    93     
       
    94     /**
       
    95      * Cleanup the child view before deactivate/destroy view
       
    96      */
       
    97     void CleanupViewL();
       
    98     
       
    99     /**
       
   100      * Display this view 
       
   101      */
       
   102     void DisplayViewL();
       
   103         
       
   104     /** 
       
   105      * Process keypresses on this view - called by ConsoleMain
       
   106      * @param aSelection, key pressed
       
   107      * @param aContinue, whether to continue or stop scheduler
       
   108      */
       
   109     void SelectL( TKeyCode aSelection, TBool& aContinue );
       
   110         
       
   111     /** 
       
   112      * Update display from timer - called by ConsoleMain
       
   113      */
       
   114     void TimerUpdate();
       
   115     
       
   116     
       
   117 protected:  //protected class
       
   118     class TPlaybackStatus
       
   119         {
       
   120     public:
       
   121         TBool iBackwardSeek;
       
   122         TBool iForwardSeek;
       
   123         TBool iPlaying;
       
   124         TBool iPause;
       
   125         TInt iVolume;
       
   126         TInt iMaxVolume;
       
   127         TInt iProgressPos;
       
   128         TInt iProgressDur;
       
   129         TInt iItemIndex;
       
   130         TInt iMaxItems;
       
   131         };
       
   132 
       
   133 private:
       
   134 
       
   135     CTestPlaybackView(CConsoleMain* aConsoleMain,
       
   136                       CTestBaseView* aParent,
       
   137                       const TDesC& aName,
       
   138                       CStifLogger* aLogger);
       
   139 
       
   140     void ConstructL();
       
   141     
       
   142     /**
       
   143     * The following functions redraw the playback view
       
   144     * base one iCurrentStatus except song info
       
   145     */
       
   146     void RedrawIndex();
       
   147     void RedrawProgress();
       
   148     void RedrawVolume();
       
   149     void RedrawPlayerStatue();
       
   150     
       
   151 private:    //data
       
   152     /**
       
   153      * Screen size
       
   154      */
       
   155     TSize iDisplaySize;
       
   156     
       
   157     /**
       
   158      * Player status
       
   159      */
       
   160     TPlaybackStatus iCurrentStatus;
       
   161     
       
   162     /**
       
   163      * Send user command to View observer
       
   164      * Not own.
       
   165      */
       
   166     MTestPlaybackViewObserver* iTestPlaybackViewObs;
       
   167     
       
   168     /**
       
   169      * Logger purpose
       
   170      * Not own.
       
   171      */
       
   172     CStifLogger* iLogger;
       
   173     
       
   174     
       
   175     };
       
   176 
       
   177 #endif      //TESTPLAYBACKVIEW_H
       
   178