camerauis/cameraapp/generic/GsCamcorderPlugin/inc/GSCamQualitySettingSlider.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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 for showing the EV slider*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 #ifndef __CGSCAMQUALITYSETTINGSLIDER_H
       
    20 #define __CGSCAMQUALITYSETTINGSLIDER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <coecntrl.h>
       
    24 #include <AknUtils.h>               // for TAknLayoutText
       
    25 #include "CamPSI.h"                 // For Product Specific Information  
       
    26 #include "CamSettingsInternal.hrh"
       
    27 #include "CamSettings.hrh"  
       
    28 #include "GSCamcorderPlugin.hrh"
       
    29 #include "Cam.hrh"
       
    30 #include "CamSettingValueObserver.h"
       
    31 
       
    32 // CONSTANTS
       
    33 // The maximum number of divisions required for the quality slider.
       
    34 #define BITMAP_SHAFT_MAX_DIVISIONS 6
       
    35 
       
    36 class CCamConfiguration;
       
    37 
       
    38 
       
    39 /**
       
    40 * Utility class used to group together related layout information into one
       
    41 * object, and construct itself using a supplied resource reader.
       
    42 *
       
    43 *  @since 2.8
       
    44 */
       
    45 class CCamSliderLegend : public CBase
       
    46     {
       
    47     
       
    48 public:
       
    49 
       
    50     ~CCamSliderLegend();
       
    51 
       
    52     /**
       
    53     * Constructs the layout information for the object
       
    54     * @since 3.0
       
    55     * @param aLayoutRect Layout for the icon
       
    56     * @param aBitmap     Bitmap ID
       
    57     * @param aMask       Mask ID
       
    58     */
       
    59     void ConstructL( const TAknLayoutRect& aLayoutRect,
       
    60     				 TInt aBitmap, TInt aMask );
       
    61 
       
    62     /**
       
    63     * Draws the legend
       
    64     * @since 2.8
       
    65     * @param aGc The window contest to use for the drawing 
       
    66     */
       
    67     void Draw( CWindowGc& aGc ) const;
       
    68 
       
    69     /**
       
    70     * Returns the rect for the legend
       
    71     * @since 2.8
       
    72     * @return The rect for the legend
       
    73     */
       
    74     TRect Rect() const;
       
    75     
       
    76 private:
       
    77     TCamSliderLegendItem iItem;
       
    78     TAknLayoutText iPosition; 
       
    79     HBufC* iText;
       
    80 	TAknLayoutRect iIconRect;
       
    81 	CFbsBitmap* iBitmap;
       
    82 	CFbsBitmap* iMask;
       
    83     };
       
    84 
       
    85 
       
    86 
       
    87 /**
       
    88 *  Slider for showing Quality level settings 
       
    89 *
       
    90 *  @since 2.8
       
    91 */
       
    92 class CGSCamQualitySettingSlider : public CCoeControl
       
    93     {
       
    94     public:  // Constructors and destructor
       
    95         
       
    96         /**
       
    97         * Two-phased constructor.
       
    98         */
       
    99         static CGSCamQualitySettingSlider* NewL( const CCoeControl* aParent, 
       
   100                                                  MCamSettingValueObserver* aObserver,
       
   101                                                  TCamSettingItemIds aSettingType,                                         
       
   102                                                  TInt aSteps,
       
   103                                                  CCamConfiguration* aConfiguration
       
   104                                              );
       
   105         
       
   106         /**
       
   107         * Destructor.
       
   108         */
       
   109         virtual ~CGSCamQualitySettingSlider();
       
   110 
       
   111     public: // New functions
       
   112         
       
   113         /**
       
   114         * Sets up the range and initial value of the slider
       
   115         * @since 2.8
       
   116         * @param aValue The value to start with on the slider.                  
       
   117         */        
       
   118         void InitializeL( TInt aValue, 
       
   119                           HBufC* aTopSubtitle,
       
   120                           HBufC* aBottomSubtitle );
       
   121 
       
   122         /**
       
   123         * Returns the minium slider value
       
   124         * @since 2.8
       
   125         * @return The minimum slider value                  
       
   126         */  
       
   127         TInt MinValue() const;
       
   128 
       
   129         /**
       
   130         * Returns the maximum slider value
       
   131         * @since 2.8
       
   132         * @return The maximum slider value                  
       
   133         */  
       
   134         TInt MaxValue() const;
       
   135                 
       
   136         /**
       
   137         * Sets the minimum and maximum values of the slider control
       
   138         * @since 3.0
       
   139         * @param aMin The minimum slider value
       
   140         * @param aMax The maximum slider value
       
   141         */              
       
   142         void SetRange( TInt aMin, TInt aMax );
       
   143 
       
   144     public: // Functions from base classes
       
   145 
       
   146         /**
       
   147         * From CCoeControl
       
   148         * @since 2.8
       
   149         * @param aRect Rect indicating the specific area to draw
       
   150         */        
       
   151         void Draw( const TRect& aRect ) const;
       
   152 
       
   153         /**
       
   154         * From CCoeControl
       
   155         * @since 2.8
       
   156         * @param aKeyEvent Details of the key event
       
   157         * @param aType The keypress type
       
   158         * @return TKeyResponse whether the key event was handled or ignored
       
   159         */     
       
   160         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) ;
       
   161 
       
   162         /**
       
   163         * From CCoeControl
       
   164         * @since 2.8
       
   165         * @return The minimum size required for the control to display
       
   166         */     
       
   167         TSize MinimumSize();   
       
   168 
       
   169         /**
       
   170         * From CCoeControl
       
   171         * @since 2.8
       
   172         */    
       
   173         void SizeChanged();
       
   174         
       
   175         /**
       
   176         * From CCoeControl
       
   177         * @
       
   178         */   
       
   179         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   180         
       
   181     protected:  // New functions
       
   182 
       
   183     protected:  // Functions from base classes
       
   184 
       
   185     private:
       
   186 
       
   187         /**
       
   188         * C++ default constructor.
       
   189         */
       
   190         CGSCamQualitySettingSlider( MCamSettingValueObserver* aObserver, 
       
   191                                     TCamSettingItemIds aSettingType,
       
   192                                     TInt aSteps, 
       
   193                                     CCamConfiguration* aConfiguration ); 
       
   194 
       
   195         /**
       
   196         * By default Symbian 2nd phase constructor is private.
       
   197         */
       
   198         void ConstructL( const CCoeControl* aParent );
       
   199         
       
   200         /**
       
   201         * Called to read the layout information from a resource 
       
   202         * @since 2.8
       
   203         */  
       
   204         void ReadLayoutL();
       
   205 
       
   206         /**
       
   207         * Read touch layout
       
   208         */
       
   209         void TouchLayoutVideo();
       
   210         
       
   211         /**
       
   212         * Read nontouch layout
       
   213         */
       
   214         void NonTouchLayoutVideo();
       
   215         
       
   216         /**
       
   217         * Read touch layout
       
   218         */
       
   219         void TouchLayoutPhoto();
       
   220         
       
   221         /**
       
   222         * Read nontouch layout
       
   223         */
       
   224         void NonTouchLayoutPhoto();
       
   225 
       
   226         /**
       
   227         * Appends legends to iLegendArray by Product Specific Information key 
       
   228         * @since 5.0
       
   229         * @param aKey, Product Specific Information key
       
   230         * @param aNumSliderValues, number of slider values
       
   231         */
       
   232         void AppendLegendArrayL( TCamPsiKey aKey, TInt aNumSliderValues = 0 );
       
   233            
       
   234         /**
       
   235         * Get layout for video/image quality legend icons
       
   236         * @since S60 v5.0
       
   237         * @param aParentRect  Parent rectangle
       
   238         * @param aSettingType Setting type
       
   239         * @param aIndex       Item index
       
   240         * @return             Layout rect that has the correct layout set
       
   241         */
       
   242         TAknLayoutRect GetTouchVideoLegendLayout(
       
   243              const TRect& aParentRect, 
       
   244              TInt aIndex ) const;
       
   245         
       
   246         /**
       
   247         * Get layout for video/image quality legend icons
       
   248         * @since S60 v5.0
       
   249         * @param aParentRect  Parent rectangle
       
   250         * @param aSettingType Setting type
       
   251         * @param aIndex       Item index
       
   252         * @return             Layout rect that has the correct layout set
       
   253         */
       
   254         TAknLayoutRect GetNonTouchVideoLegendLayout(
       
   255              const TRect& aParentRect, 
       
   256              TInt aIndex ) const;
       
   257 
       
   258         /**
       
   259         * Get layout for video/image quality legend icons
       
   260         * @since S60 v5.0
       
   261         * @param aParentRect  Parent rectangle
       
   262         * @param aSettingType Setting type
       
   263         * @param aIndex       Item index
       
   264         * @return             Layout rect that has the correct layout set
       
   265         */
       
   266         TAknLayoutRect GetTouchPhotoLegendLayout(
       
   267              const TRect& aParentRect, 
       
   268              TInt aIndex ) const;
       
   269         
       
   270         /**
       
   271         * Get layout for three image quality legend icons
       
   272         * @since S60 v5.0
       
   273         * @param aParentRect  Parent rectangle
       
   274         * @param aSettingType Setting type
       
   275         * @param aIndex       Item index
       
   276         * @return             Layout rect that has the correct layout set
       
   277         */
       
   278         TAknLayoutRect GetNonTouchPhotoLegend3Layout(
       
   279              const TRect& aParentRect, 
       
   280              TInt aIndex ) const;
       
   281         
       
   282         /**
       
   283         * Get layout for five image quality legend icons
       
   284         * @since S60 v5.0
       
   285         * @param aParentRect  Parent rectangle
       
   286         * @param aSettingType Setting type
       
   287         * @param aIndex       Item index
       
   288         * @return             Layout rect that has the correct layout set
       
   289         */
       
   290         TAknLayoutRect GetNonTouchPhotoLegend5Layout(
       
   291              const TRect& aParentRect, 
       
   292              TInt aIndex ) const;
       
   293 
       
   294         /**
       
   295         * Counts quality setting steps. Available layouts are for three and 
       
   296         * five steps.
       
   297         * @return  TBool, ETrue if count is three or less
       
   298         */
       
   299         TBool IsThreeTicksSlider() const; 
       
   300         
       
   301     public:     // Data
       
   302     
       
   303     protected:  // Data
       
   304 
       
   305     private:    // Data
       
   306 
       
   307         // Bitmaps for the slider "shaft"
       
   308         CFbsBitmap* iBitmapShafts[BITMAP_SHAFT_MAX_DIVISIONS+1];
       
   309         CFbsBitmap* iBitmapShaftsMasks[BITMAP_SHAFT_MAX_DIVISIONS+1];
       
   310 
       
   311         // Current level to be indicated by the slider
       
   312         TInt iValue;
       
   313         
       
   314         // Pointer to the observer of slider events
       
   315         MCamSettingValueObserver* iSettingObserver;        
       
   316 
       
   317         // The values that 
       
   318         RPointerArray <CCamSliderLegend> iLegendArray;   
       
   319  
       
   320         // Layout structure for the Shaft
       
   321         TAknLayoutRect iShaftLayout;
       
   322 
       
   323         // The minimum size the control requires to be drawn
       
   324         TSize iMinimumSize;
       
   325 
       
   326         // The parent control of the slider
       
   327         const CCoeControl* iParentControl;
       
   328 
       
   329         // The maximum slider value
       
   330         TInt iMaxSliderValue;
       
   331 
       
   332         // The minium slider value
       
   333         TInt iMinSliderValue;
       
   334 
       
   335         // the number of slider values
       
   336         TInt iNumSliderValues;
       
   337 
       
   338         // Identifies which setting is being edited
       
   339         TCamSettingItemIds iSettingType;
       
   340         
       
   341         // number of slider steps
       
   342         TInt iSteps;
       
   343 
       
   344         // Configuration manager
       
   345         CCamConfiguration* iConfiguration;
       
   346 
       
   347         // The subtitle text at top of page
       
   348         HBufC* iTopSubtitle;
       
   349         // The subtitle text at bottom of page
       
   350         HBufC* iBottomSubtitle;
       
   351         // The layout for the subtitle text at top
       
   352         TAknLayoutText iLayoutSubtitleTop;
       
   353         // The layout for the subtitle text at bottom of page
       
   354         TAknLayoutText iLayoutSubtitleBottom;
       
   355         
       
   356     };
       
   357 
       
   358 #endif      // __CGSCAMQUALITYSETTINGSLIDER_H   
       
   359             
       
   360 // End of File