gssettingsuis/Gs/GSDisplayPlugin/Inc/GSDisplayPluginModel.h
branchRCL_3
changeset 54 7e0eff37aedb
equal deleted inserted replaced
53:8ee96d21d9bf 54:7e0eff37aedb
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Display Settings model.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GSDISPLAYPLUGINMODEL_H
       
    20 #define GSDISPLAYPLUGINMODEL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32property.h>
       
    24 #include <centralrepository.h>
       
    25 #include <cenrepnotifyhandler.h>
       
    26 #include <backgroundimage.h>
       
    27 
       
    28 class CGSDisplayPluginContainer;
       
    29 
       
    30 // CONSTANTS
       
    31 // maximum string sizes
       
    32 const TInt KGSMaxImagePath = 256;  // max lenght of image paths
       
    33 const TInt KGSMaxWNText = 50;      // max length of welcome note text
       
    34 const TInt KGSMaxSSText = 15;      // max lenght of screen saver text
       
    35 const TInt KGSWelcomeNoteTypeValue = 0;
       
    36 const TInt KGSScreenSaverObjectValue = 0;
       
    37 const TInt KGSScreenSaverPeriodValue = 5;
       
    38 const TInt KGSWNTextIndex = 1;
       
    39 const TInt KGSWNImageIndex = 2;
       
    40 const TInt KGSBgImageIndex = 1;
       
    41 const TInt KGSSSTextObjectIndex = 0;
       
    42 
       
    43 //for switching values in SwitchValue()
       
    44 const TInt KGSSettingOff = 0;
       
    45 const TInt KGSSettingOn = 1;
       
    46 
       
    47 // Setting values for Background and Welcome note image
       
    48 const TInt KGSUWNoteSupportedValue = 1; // default is show the item
       
    49 const TInt KGSWelcomeNoteTypeImage = 2;
       
    50 
       
    51 _LIT( KGSWelcomeNoteImgPath, "c:\\private\\100058ec\\welcomeimage.mbm" );
       
    52 
       
    53 // MACROS
       
    54 
       
    55 // DATA TYPES
       
    56 
       
    57 // FUNCTION PROTOTYPES
       
    58 
       
    59 // FORWARD DECLARATIONS
       
    60 class CGSBackgroundImage;
       
    61 
       
    62 // CLASS DEFINITION
       
    63 /**
       
    64 *  CGSDisplayPluginModel is the model class of GS display plugin.
       
    65 *  It provides functions to get and set setting values.
       
    66 *  @lib GSDisplayPlugin.lib
       
    67 *  @since Series 60_3.1
       
    68 
       
    69 */
       
    70 NONSHARABLE_CLASS( CGSDisplayPluginModel ): public CBase,
       
    71                                             public MCenRepNotifyHandlerCallback
       
    72     {
       
    73     public:  // Constructor and destructor
       
    74         /**
       
    75         * Two-phased constructor
       
    76         * @param aInitBackgrooundApi Set to ETrue if CGSBackgroundImage is to 
       
    77         *        be initialized. This is not to possible if model is created in
       
    78         *        a process without a Avkon UI.
       
    79         */
       
    80         static CGSDisplayPluginModel* NewL( TBool aInitBackgroundApi );
       
    81         static CGSDisplayPluginModel* NewL();
       
    82 
       
    83         /**
       
    84         * Destructor
       
    85         */
       
    86         ~CGSDisplayPluginModel();
       
    87 
       
    88     public: // new ones
       
    89 
       
    90         /**
       
    91         * Returns welcome note type.
       
    92         * @return 0: default
       
    93         *         1: text
       
    94         *         2: image
       
    95         */
       
    96         TInt WelcomeNoteTypeL();
       
    97 
       
    98         /**
       
    99         * Sets welcomenote type.
       
   100         * @param aType Type of the welcome note.
       
   101         */
       
   102         void SetWelcomeNoteTypeL( TInt aType );
       
   103 
       
   104         /**
       
   105         * Gets welcome note text from shared data.
       
   106         * @param aNote Descriptor which will contain the welcome note text.
       
   107         *              Max length is KGSMaxWNText.
       
   108         */
       
   109         void WelcomeNoteTextL( TDes& aNote );
       
   110 
       
   111         /**
       
   112         * Stores welcome note text to shared data.
       
   113         * @param aNote Descriptor which contains the welcome note text.
       
   114         *              Max length is KGSMaxWNText.
       
   115         */
       
   116         void SetWelcomeNoteTextL( const TDesC& aNote );
       
   117 
       
   118         /**
       
   119         * Returns the deviation from the calibrated contrast value.
       
   120         * @return Deviation from the calibrated contrast value.
       
   121         *         Min value is -15 and max value is 15.
       
   122         */
       
   123         TInt ContrastL();
       
   124 
       
   125         /**
       
   126         * Sets the deviation from the calibrated contrast value.
       
   127         * @param aContrast Deviation from the calibrated contrast value.
       
   128         *                  Min value is -15 and max value is 15.
       
   129         */
       
   130         void SetContrastL( const TInt aContrast );
       
   131 
       
   132         /**
       
   133         * Return value tells what is screen saver object.
       
   134         * @return 0: text
       
   135         *         1: time and date
       
   136         */
       
   137         TInt ScreenSaverObjectL();
       
   138 
       
   139         /**
       
   140         * Sets screen saver object.
       
   141         * @param aObject screen saver object.
       
   142         */
       
   143         void SetScreenSaverObjectL( const TInt aObject );
       
   144 
       
   145         /**
       
   146         * Gets screen saver text from shared data.
       
   147         * @param aText Descriptor which will contain the screen saver text.
       
   148         *              Max length is KGSMaxSSText.
       
   149         */
       
   150         void GetScreenSaverTextL( TDes& aText );
       
   151 
       
   152         /**
       
   153         * Stores screen saver text to shared data.
       
   154         * @param aText Descriptor which contains the screen saver text.
       
   155         *              Max length is KGSMaxSSText.
       
   156         */
       
   157         void SetScreenSaverTextL( const TDesC& aText );
       
   158 
       
   159         /**
       
   160         * Returns the period of time after which the screen saver starts
       
   161         * if the keys are not pressed.
       
   162         * @return Minutes between 1 and 30.
       
   163         */
       
   164         TInt ScreenSaverAndKeyguardPeriodL();
       
   165 
       
   166         /**
       
   167         * Sets the period of time after which the screen saver starts
       
   168         * if the keys are not pressed.
       
   169         * @param aPeriod Screen saver period (minutes between 1 and 30).
       
   170         */
       
   171         void SetScreenSaverAndKeyguardPeriodL( const TInt aPeriod );
       
   172 
       
   173         /**
       
   174         * Returns the period of time after which the backlight fades out
       
   175         * if the keys are not pressed.
       
   176         * @return Seconds between 5 and 60.
       
   177         */
       
   178         TInt BacklightPeriodL();
       
   179 
       
   180         /**
       
   181         * Sets the period of time after which the backlights fades out
       
   182         * if the keys are not pressed.
       
   183         * @param aPeriod backlight period (seconds between 5 and 60).
       
   184         */
       
   185         void SetBacklightPeriodL( const TInt aPeriod );
       
   186 
       
   187         /**
       
   188         * Checks whether the user welcome note is supported
       
   189         * @return TInt
       
   190         */
       
   191         TInt IsUWNoteSupportedL();
       
   192 
       
   193         /**
       
   194         * Returns the deviation from the calibrated brightness value.
       
   195         * @return Deviation from the calibrated brightness value.
       
   196         *         Min value is 1 and max value is 31.
       
   197         */
       
   198         TInt BrightnessL();
       
   199 
       
   200         /**
       
   201         * Sets the deviation from the calibrated brightness value.
       
   202         * @param aBrightness Deviation from the calibrated brightness value.
       
   203         *                  Min value is 1 and max value is 31.
       
   204         */
       
   205         void SetBrightnessL( const TInt aBrightness );
       
   206 
       
   207         /**
       
   208         * Returns the deviation from the calibrated light sensor value.
       
   209         * @return Deviation from the calibrated light sensor value.
       
   210         *         Min value is 1 and max value is 5.
       
   211         */
       
   212         TInt AmbientLightSensorL();
       
   213 
       
   214         /**
       
   215         * Sets the deviation from the calibrated light sensor value.
       
   216         * @param aSensorSensivity Deviation from the calibrated brightness value.
       
   217         *                  Min value is 1 and max value is 5.
       
   218         */
       
   219         void SetAmbientLightSensorL( const TInt aSensorSensitivity );
       
   220 
       
   221         /**
       
   222         * Returns the current display text size.
       
   223         * @return One of the following values:
       
   224         *         Large
       
   225         *         Normal (default)
       
   226         *         Small
       
   227         */
       
   228         TInt DisplayTextSizeL();
       
   229 
       
   230         /**
       
   231         * Set the new display text size.
       
   232         * @param aSize. One of the following values:
       
   233         *         Large
       
   234         *         Normal (default)
       
   235         *         Small
       
   236         */
       
   237         void SetDisplayTextSizeL( TInt aSize );
       
   238 
       
   239 
       
   240         /**
       
   241         * Get the Power Save Led value
       
   242         * @return:
       
   243         * 0: Disabled
       
   244         * 1: Enabled
       
   245         */
       
   246         TInt PowerSaveLedL();
       
   247 
       
   248         /**
       
   249         * Set the Power Save Led value
       
   250         * @param aPowerLedState
       
   251         * 0: Disabled
       
   252         * 1: Enabled
       
   253         */
       
   254         void SetPowerSaveLedL( const TInt aPowerLedState );
       
   255 
       
   256         /**
       
   257         * Checks Power Save Led support
       
   258         * @return:
       
   259         * 0: Disabled
       
   260         * 1: Enabled
       
   261         */
       
   262         TInt CheckPowerSaveLedSupportL();
       
   263 
       
   264         /**
       
   265         * @return pointer to background image. Does not transfer ownership.
       
   266         */
       
   267         CGSBackgroundImage* BackgroundImage();
       
   268         
       
   269         /**
       
   270         * Checks ScreenSaver timeout support
       
   271         * @return:
       
   272         * ETrue: ScreenSaver timeout setting is supported
       
   273         * EFalse: ScreenSaver timeout setting is not supported 
       
   274         */
       
   275         TBool CheckScreenSaverTimeoutSupportL();
       
   276         
       
   277         /**
       
   278         * Checks if Operator Logo setting item is to be made visible.
       
   279         * @return ETrue if setting item is to be shown.
       
   280         *         EFalse if setting item is not to be shown.
       
   281         */
       
   282         TBool ShowOperatorLogoSettingL();
       
   283 
       
   284         /**
       
   285         * Gets operator logo state.
       
   286         * @return KGSSettingOn  if logo is used.
       
   287         *         KGSSettingOff if logo is not used.
       
   288         */
       
   289         TInt OperatorLogoL();
       
   290         
       
   291         /**
       
   292         * @param
       
   293         */
       
   294         void SetOperatorLogoL( TInt aOperatorLogo );
       
   295         
       
   296         /**
       
   297          * @param
       
   298          */
       
   299         void SetOwner( CGSDisplayPluginContainer* aPlugin);
       
   300 
       
   301     private: // Private constructors
       
   302 
       
   303         /**
       
   304         * Default C++ contructor
       
   305         */
       
   306         CGSDisplayPluginModel();
       
   307 
       
   308         /**
       
   309         * Symbian OS default constructor
       
   310         * @return void
       
   311         */
       
   312         void ConstructL( TBool aInitBackgroundApi );
       
   313 
       
   314         /**
       
   315         * Initialize CenRep keys used in this class
       
   316         */
       
   317         void InitializeCentralRepositoryL();
       
   318 
       
   319         /**
       
   320         * Un-initialize CenRep keys used in this class
       
   321         */
       
   322         void UninitializeCentralRepository();
       
   323 
       
   324     private: // new ones
       
   325 
       
   326         void SetBackLightValueL();
       
   327 		TInt ScaleIntensityValues( TInt aValue, TBool aSample );
       
   328 		TInt ScaleLightSensorValues( TInt aValue, TBool aDirection );
       
   329 		
       
   330 		// From MCenRepNotifyHandlerCallback
       
   331 		void HandleNotifyInt( TUint32 aId, TInt aNewValue);
       
   332 
       
   333     private:
       
   334         //Central repository objects
       
   335         CRepository* iPersonalizationRepository;
       
   336         CRepository* iStartupConfRepository;
       
   337         CRepository* iScreensaverRepository;
       
   338         CRepository* iLightRepository;
       
   339         CRepository* iSecurityRepository;
       
   340         CRepository* iGSVariationRepository;
       
   341         CRepository* iAvkonRepository;
       
   342         // Used for OperatorLogo
       
   343         CCenRepNotifyHandler* iNotifyHandlerForOpLogo;
       
   344         CCenRepNotifyHandler* iNotifyHandlerForOpLogoVisible;
       
   345         CGSDisplayPluginContainer* iContainer;
       
   346 
       
   347         //P&S keys
       
   348         RProperty* iCoreAppProperty;
       
   349 
       
   350         //local variated constants
       
   351         TInt iLocalVariationValues;
       
   352 
       
   353         CGSBackgroundImage* iBackgroundApi;
       
   354     };
       
   355 
       
   356 #endif //GSDISPLAYPLUGINMODEL_H
       
   357 
       
   358 // End of File