photosgallery/common/src/glxsettingsmodel.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:    MC Photos settings model
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "glxsettingsmodel.h"
       
    24 
       
    25 #include <centralrepository.h>
       
    26 #include <featmgr.h>
       
    27 
       
    28 #include <glxgallery.hrh>
       
    29 #include <glxtracer.h>
       
    30 #include "glxsingletonstore.h"
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // InstanceL
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C CGlxSettingsModel* CGlxSettingsModel::InstanceL()
       
    37     {
       
    38     return CGlxSingletonStore::InstanceL(&NewL);
       
    39     }
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Close
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C void CGlxSettingsModel::Close()
       
    46     {
       
    47     CGlxSingletonStore::Close(this);
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // Destructor
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 CGlxSettingsModel::~CGlxSettingsModel()
       
    55     {
       
    56     if ( iFeatureManagerInitialised )
       
    57         {
       
    58         FeatureManager::UnInitializeLib();
       
    59         }
       
    60 
       
    61     delete iRepository;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // NewL
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CGlxSettingsModel* CGlxSettingsModel::NewL()
       
    69     {
       
    70     CGlxSettingsModel* self = new (ELeave) CGlxSettingsModel();
       
    71     CleanupStack::PushL(self);
       
    72     self->ConstructL();
       
    73     CleanupStack::Pop(self);
       
    74     return self;
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Default constructor
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 CGlxSettingsModel::CGlxSettingsModel()
       
    82     {
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // ConstructL
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CGlxSettingsModel::ConstructL()
       
    90     {
       
    91     TRACER( "CGlxSettingsModel::ConstructL()" );
       
    92     iRepository = CRepository::NewL( TUid::Uid(KGlxGalleryApplicationUid) );
       
    93 
       
    94     FeatureManager::InitializeLibL();
       
    95     iFeatureManagerInitialised = ETrue;
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // SupportedOrientations
       
   100 // ---------------------------------------------------------------------------
       
   101 //
       
   102 EXPORT_C CGlxSettingsModel::TSupportedOrientations
       
   103                                     CGlxSettingsModel::SupportedOrientations()
       
   104     {
       
   105     TInt value = ELandscapeAndPortrait;
       
   106     iRepository->Get( KGlxDefaultOrientation, value );
       
   107 
       
   108     return static_cast<TSupportedOrientations>( value );
       
   109     }
       
   110 
       
   111 // ---------------------------------------------------------------------------
       
   112 // ShowGeoCoordinatesInDisplay
       
   113 // ---------------------------------------------------------------------------
       
   114 //
       
   115 EXPORT_C TBool CGlxSettingsModel::ShowGeoCoordinatesInDisplay()
       
   116     {
       
   117     TRACER( "CGlxSettingsModel::ShowGeoCoordinatesInDisplay()" );
       
   118     TInt value = ETrue;
       
   119     iRepository->Get( KGlxShowGeoCoordinates, value );
       
   120 
       
   121     return ( value > 0);
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // IsTextEntryPortrait
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C TBool CGlxSettingsModel::IsTextEntryPortrait()
       
   129     {
       
   130     // Orientation changes to portrait for text entry in monoblock products
       
   131     return FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider );
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // ShowRotateInToolbar
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 EXPORT_C TBool CGlxSettingsModel::ShowRotateInToolbar()
       
   139     {
       
   140     // View in landscape/portrait toolbar option shown only in monoblock products
       
   141     return FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider );
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // ShowSlideshowInToolbar
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C TBool CGlxSettingsModel::ShowSlideshowInToolbar()
       
   149     {
       
   150     // Slideshow toolbar option shown only in slide products
       
   151     return !FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider );
       
   152     }