internetradio2.0/uicontrolssrc/irstationinformationdata.cpp
changeset 0 09774dfdd46b
equal deleted inserted replaced
-1:000000000000 0:09774dfdd46b
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Station information data container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <stringloader.h>
       
    20 #include <internetradio.rsg>
       
    21 
       
    22 #include "irstationinformationdata.h"
       
    23 
       
    24 // ======== LOCAL FUNCTIONS ========
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // Static two-phased constructor.
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CIRStationInformationData* CIRStationInformationData::NewL( CCoeEnv& aCoeEnv )
       
    33     {
       
    34     CIRStationInformationData* self = new ( ELeave ) CIRStationInformationData( aCoeEnv );
       
    35     CleanupStack::PushL( self );
       
    36     self->ConstructL();
       
    37     CleanupStack::Pop( self );
       
    38     return self;
       
    39     }
       
    40     
       
    41 // ---------------------------------------------------------------------------
       
    42 // Constructor.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 CIRStationInformationData::CIRStationInformationData( CCoeEnv& /*aCoeEnv*/ )
       
    46     //: iCoeEnv( aCoeEnv )
       
    47     {
       
    48     }
       
    49     
       
    50 // ---------------------------------------------------------------------------
       
    51 // Second-phase constructor.
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 void CIRStationInformationData::ConstructL()
       
    55     {
       
    56     iName.CreateL( KNullDesC );
       
    57     iRdsPsName.CreateL( KNullDesC );
       
    58     iIndex.CreateL( KNullDesC );
       
    59     
       
    60     }
       
    61     
       
    62 // ---------------------------------------------------------------------------
       
    63 // Destructor.
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CIRStationInformationData::~CIRStationInformationData()
       
    67     {
       
    68     
       
    69 
       
    70     iName.Close();
       
    71     iRdsPsName.Close();
       
    72     iIndex.Close();
       
    73 
       
    74     }
       
    75 
       
    76     
       
    77 // ---------------------------------------------------------------------------
       
    78 // Sets the name.
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 void CIRStationInformationData::SetNameL( const TDesC& aName )
       
    82     {
       
    83     iName.Close();
       
    84     iName.CreateL( aName );
       
    85     }
       
    86     
       
    87 // ---------------------------------------------------------------------------
       
    88 // Sets the RDS PS name.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CIRStationInformationData::SetRdsPsNameL( const TDesC& aRdsPsName )
       
    92     {
       
    93     iRdsPsName.Close();
       
    94     iRdsPsName.CreateL( aRdsPsName );
       
    95     }
       
    96     
       
    97 // ---------------------------------------------------------------------------
       
    98 // Sets the index.
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 void CIRStationInformationData::SetIndexL( TInt aIndex )
       
   102     {
       
   103     if ( aIndex >= 0 )
       
   104         {
       
   105         HBufC* index = StringLoader::LoadLC( R_IRAPP_STATIONS_NUMBERING, aIndex + 1);
       
   106         CleanupStack::Pop( index );
       
   107         
       
   108         iIndex.Close();
       
   109         iIndex.Assign( index );
       
   110         }
       
   111     }
       
   112     
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // Sets the visual service enabled or disabled.
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 void CIRStationInformationData::SetServiceEnabled( TBool aServiceEnabled )
       
   119     {
       
   120     iServiceEnabled = aServiceEnabled;
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // Sets the display style in use.
       
   125 // ---------------------------------------------------------------------------
       
   126 //
       
   127 void CIRStationInformationData::SetDisplayStyle( TIRDisplayStyle aDisplayStyle )
       
   128     {
       
   129     iDisplayStyle = aDisplayStyle;
       
   130     }
       
   131     
       
   132 // ---------------------------------------------------------------------------
       
   133 // Sets the fade directionality.
       
   134 // ---------------------------------------------------------------------------
       
   135 //
       
   136 void CIRStationInformationData::SetFadeDirectionality( TIRFadeStyle aFadeDirectionality )
       
   137     {
       
   138     iFadeDirectionality = aFadeDirectionality;
       
   139     }
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // Returns the frequency as a descriptor.
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 const TDesC& CIRStationInformationData::Frequency() const
       
   146     {
       
   147     return iFrequency;
       
   148     }
       
   149     
       
   150 // ---------------------------------------------------------------------------
       
   151 // Returns the name.
       
   152 // ---------------------------------------------------------------------------
       
   153 //
       
   154 const TDesC& CIRStationInformationData::Name() const
       
   155     {
       
   156     return iName;
       
   157     }
       
   158     
       
   159 // ---------------------------------------------------------------------------
       
   160 // Returns the RDS PS name.
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 const TDesC& CIRStationInformationData::RdsPsName() const
       
   164     {
       
   165     return iRdsPsName;
       
   166     }
       
   167     
       
   168 // ---------------------------------------------------------------------------
       
   169 // Returns the index as a descriptor.
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 const TDesC& CIRStationInformationData::Index() const
       
   173     {
       
   174     return iIndex;
       
   175     }
       
   176     
       
   177 // ---------------------------------------------------------------------------
       
   178 // Returns the location.
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 const TDesC& CIRStationInformationData::Location() const
       
   182     {
       
   183     return iLocation;
       
   184     }
       
   185 
       
   186 // ---------------------------------------------------------------------------
       
   187 // Returns whether or not visual service is enabled.
       
   188 // ---------------------------------------------------------------------------
       
   189 //
       
   190 TBool CIRStationInformationData::ServiceEnabled() const
       
   191     {
       
   192     return iServiceEnabled;
       
   193     }
       
   194 
       
   195 // ---------------------------------------------------------------------------
       
   196 // Returns the display style.
       
   197 // ---------------------------------------------------------------------------
       
   198 //
       
   199 TIRDisplayStyle CIRStationInformationData::DisplayStyle() const
       
   200     {
       
   201     return iDisplayStyle;
       
   202     }
       
   203 
       
   204 // ---------------------------------------------------------------------------
       
   205 // Returns the fade directionality.
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 TIRFadeStyle CIRStationInformationData::FadeDirectionality() const
       
   209     {
       
   210     return iFadeDirectionality;
       
   211     }
       
   212