radioapp/radiouiengine/src/radiohistoryitem_p.cpp
changeset 23 a2b50a479edf
parent 19 afea38384506
child 24 6df133bd92e1
equal deleted inserted replaced
19:afea38384506 23:a2b50a479edf
     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 QString& artist,
       
    38                                                   const QString& title )
       
    39 {
       
    40     init( artist, title );
       
    41 }
       
    42 
       
    43 /*!
       
    44  *
       
    45  */
       
    46 void RadioHistoryItemPrivate::init( const QString& artist, const QString& title )
       
    47 {
       
    48     ref = 1;
       
    49     mId = -1;
       
    50     mArtist = artist;
       
    51     mTitle = title;
       
    52     mFrequency = 0;
       
    53     mTagged = false;
       
    54     mFromRds = true;
       
    55 }
       
    56 
       
    57 /*!
       
    58  *
       
    59  */
       
    60 void RadioHistoryItemPrivate::initFromRecord( const QSqlRecord& record )
       
    61 {
       
    62     mId = record.value( RadioHistoryValue::Id ).toInt();
       
    63     mArtist = record.value( RadioHistoryValue::Artist ).toString();
       
    64     mTitle = record.value( RadioHistoryValue::Title ).toString();
       
    65     mFrequency = record.value( RadioHistoryValue::Frequency ).toUInt() * 1000;
       
    66     mStation = record.value( RadioHistoryValue::Station ).toString();
       
    67     mTagged = record.value( RadioHistoryValue::Tagged ).toBool();
       
    68     mFromRds = record.value( RadioHistoryValue::FromRds ).toBool();
       
    69     mTime = record.value( RadioHistoryValue::Time ).toDateTime();
       
    70 }