radioapp/radiouiengine/src/radiohistoryitem_p.cpp
branchRCL_3
changeset 19 cce62ebc198e
equal deleted inserted replaced
18:1a6714c53019 19:cce62ebc198e
       
     1 /*
       
     2 * Copyright (c) 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:
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <QSqlRecord>
       
    20 #include <QVariant>
       
    21 
       
    22 // User includes
       
    23 #include "radiohistoryitem.h"
       
    24 #include "radiohistoryitem_p.h"
       
    25 
       
    26 /*!
       
    27  *
       
    28  */
       
    29 RadioHistoryItemPrivate::RadioHistoryItemPrivate()
       
    30 {
       
    31     init( "", "" );
       
    32 }
       
    33 
       
    34 /*!
       
    35  *
       
    36  */
       
    37 RadioHistoryItemPrivate::RadioHistoryItemPrivate( const RadioHistoryItemPrivate& other ) :
       
    38     QSharedData( other ),
       
    39     mId( other.mId ),
       
    40     mArtist( other.mArtist ),
       
    41     mTitle( other.mTitle ),
       
    42     mFrequency( other.mFrequency ),
       
    43     mTagged( other.mTagged ),
       
    44     mFromRds( other.mFromRds )
       
    45 {
       
    46 }
       
    47 
       
    48 /*!
       
    49  *
       
    50  */
       
    51 RadioHistoryItemPrivate::RadioHistoryItemPrivate( const QString& artist,
       
    52                                                   const QString& title )
       
    53 {
       
    54     init( artist, title );
       
    55 }
       
    56 
       
    57 /*!
       
    58  *
       
    59  */
       
    60 void RadioHistoryItemPrivate::init( const QString& artist, const QString& title )
       
    61 {
       
    62     mId = -1;
       
    63     mArtist = artist;
       
    64     mTitle = title;
       
    65     mFrequency = 0;
       
    66     mTagged = false;
       
    67     mFromRds = true;
       
    68 }
       
    69 
       
    70 /*!
       
    71  *
       
    72  */
       
    73 void RadioHistoryItemPrivate::initFromRecord( const QSqlRecord& record )
       
    74 {
       
    75     mId = record.value( RadioHistoryValue::Id ).toInt();
       
    76     mArtist = record.value( RadioHistoryValue::Artist ).toString();
       
    77     mTitle = record.value( RadioHistoryValue::Title ).toString();
       
    78     mFrequency = record.value( RadioHistoryValue::Frequency ).toUInt() * 1000;
       
    79     mStation = record.value( RadioHistoryValue::Station ).toString();
       
    80     mTagged = record.value( RadioHistoryValue::Tagged ).toBool();
       
    81     mFromRds = record.value( RadioHistoryValue::FromRds ).toBool();
       
    82     mTime = record.value( RadioHistoryValue::Time ).toDateTime();
       
    83 }