radioapp/radiouiengine/inc/radiohistoryitem.h
branchRCL_3
changeset 20 93c594350b9a
parent 19 cce62ebc198e
equal deleted inserted replaced
19:cce62ebc198e 20:93c594350b9a
     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 #ifndef RADIOHISTORYITEM_H
       
    19 #define RADIOHISTORYITEM_H
       
    20 
       
    21 // System includes
       
    22 #include <QSharedDataPointer>
       
    23 #include <QMetaType>
       
    24 
       
    25 // User includes
       
    26 #include "radiouiengineexport.h"
       
    27 
       
    28 // Forward declarations
       
    29 class RadioHistoryItemPrivate;
       
    30 
       
    31 /*!
       
    32  * Radio history item implements a song recognized from the radio broadcast
       
    33  */
       
    34 class UI_ENGINE_DLL_EXPORT RadioHistoryItem
       
    35 {
       
    36 public:
       
    37 
       
    38     RadioHistoryItem();
       
    39     RadioHistoryItem( const QString& artist, const QString& title );
       
    40     RadioHistoryItem( const RadioHistoryItem& other );
       
    41 
       
    42     ~RadioHistoryItem();
       
    43 
       
    44     RadioHistoryItem& operator=( const RadioHistoryItem& other );
       
    45 
       
    46     bool isValid() const;
       
    47     void reset();
       
    48 
       
    49     int id() const;
       
    50 
       
    51     QString artist() const;
       
    52     void setArtist( const QString& artist );
       
    53 
       
    54     QString title() const;
       
    55     void setTitle( const QString& title );
       
    56 
       
    57     QString station() const;
       
    58     void setStation( const QString& station );
       
    59 
       
    60     uint frequency() const;
       
    61     void setFrequency( uint frequency );
       
    62 
       
    63     QString time() const;
       
    64     void setCurrentTime();
       
    65 
       
    66     bool isTagged() const;
       
    67 
       
    68     bool isRecognizedByRds() const;
       
    69 
       
    70 private: // data
       
    71 
       
    72     /*!
       
    73      * Pointer to the implicitly shared private implementation
       
    74      * Own.
       
    75      */
       
    76     QSharedDataPointer<RadioHistoryItemPrivate> mData;
       
    77 
       
    78 public:
       
    79 
       
    80     /**
       
    81      * Checks if the class is detached from implicitly shared data
       
    82      * Required by many QT convenience functions for implicitly shared classes
       
    83      */
       
    84     bool isDetached() const;
       
    85 
       
    86     typedef QSharedDataPointer<RadioHistoryItemPrivate> DataPtr;
       
    87     inline DataPtr &data_ptr() { return mData; }
       
    88 
       
    89 };
       
    90 
       
    91 Q_DECLARE_TYPEINFO( RadioHistoryItem, Q_MOVABLE_TYPE );  // Can be moved around in memory by containers if necessary
       
    92 Q_DECLARE_SHARED( RadioHistoryItem )                     // Uses implicit sharing
       
    93 Q_DECLARE_METATYPE( RadioHistoryItem )                   // To be usable in a QVariant
       
    94 
       
    95 #endif // RADIOHISTORYITEM_H