radioapp/radiouiengine/inc/radioplaylogmodel.h
changeset 16 f54ebcfc1b80
parent 14 63aabac4416d
child 17 2cf3bab7c5c6
child 19 afea38384506
equal deleted inserted replaced
14:63aabac4416d 16:f54ebcfc1b80
     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 RADIOPLAYLOGMODEL_H
       
    19 #define RADIOPLAYLOGMODEL_H
       
    20 
       
    21 // System includes
       
    22 #include <QAbstractListModel>
       
    23 
       
    24 // User includes
       
    25 #include "radiouiengineexport.h"
       
    26 #include "radioplaylogitem.h"
       
    27 
       
    28 // Forward declarations
       
    29 class RadioPlayLogModelPrivate;
       
    30 class RadioUiEngine;
       
    31 class RadioStation;
       
    32 
       
    33 class UI_ENGINE_DLL_EXPORT RadioPlayLogModel : public QAbstractListModel
       
    34 {
       
    35     Q_OBJECT
       
    36     Q_DECLARE_PRIVATE_D( d_ptr, RadioPlayLogModel )
       
    37     Q_DISABLE_COPY( RadioPlayLogModel )
       
    38 
       
    39     friend class RadioUiEngine;
       
    40     friend class RadioStationModelPrivate;
       
    41     friend class TestRadioUiEngine;
       
    42     
       
    43 public:
       
    44 
       
    45     enum PlayLogRole
       
    46     {
       
    47         PlayLogItemRole = Qt::UserRole + 100,
       
    48         SetFavoriteRole
       
    49     };
       
    50 
       
    51 // from base class QAbstractListModel
       
    52 
       
    53     Qt::ItemFlags flags ( const QModelIndex& index ) const;
       
    54     int rowCount( const QModelIndex& parent = QModelIndex() ) const;
       
    55     QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
       
    56     bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole );
       
    57 
       
    58 // New functions
       
    59 
       
    60     bool isCurrentSongRecognized() const;
       
    61     void setShowDetails( bool showDetails );
       
    62 
       
    63 signals:
       
    64 
       
    65     void itemAdded();
       
    66     void currentSongReset();
       
    67 
       
    68 public slots:
       
    69 
       
    70     void resetCurrentSong();
       
    71     void setFavorite();
       
    72     void removeAll();
       
    73 
       
    74 private:
       
    75 
       
    76     explicit RadioPlayLogModel( RadioUiEngine& uiEngine );
       
    77 
       
    78     ~RadioPlayLogModel();
       
    79 
       
    80     void addItem( const QString& artist, const QString& title, const RadioStation& station );
       
    81 
       
    82     void clearRadioTextPlus();
       
    83     void addRadioTextPlus( int rtClass, const QString& rtItem, const RadioStation& station );
       
    84 
       
    85     int findItem( const QString& artist, const QString& title, RadioPlayLogItem& item );
       
    86 
       
    87     void updateItem( int index, const RadioPlayLogItem& item, bool prepend = false );
       
    88 
       
    89 private: // data
       
    90 
       
    91     /**
       
    92      * Unmodifiable pointer to the private implementation
       
    93      */
       
    94     RadioPlayLogModelPrivate* const d_ptr;
       
    95 
       
    96 };
       
    97 
       
    98 #endif // RADIOPLAYLOGMODEL_H