24
|
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 RADIOHISTORYMODEL_H
|
|
19 |
#define RADIOHISTORYMODEL_H
|
|
20 |
|
|
21 |
// System includes
|
|
22 |
#include <QAbstractListModel>
|
|
23 |
|
|
24 |
// User includes
|
|
25 |
#include "radiouiengineexport.h"
|
|
26 |
#include "radiohistoryitem.h"
|
|
27 |
|
|
28 |
// Forward declarations
|
|
29 |
class RadioHistoryModelPrivate;
|
|
30 |
class RadioUiEngine;
|
|
31 |
class RadioStation;
|
|
32 |
class QIcon;
|
|
33 |
class RadioHistoryItem;
|
|
34 |
|
|
35 |
class UI_ENGINE_DLL_EXPORT RadioHistoryModel : public QAbstractListModel
|
|
36 |
{
|
|
37 |
Q_OBJECT
|
|
38 |
Q_DECLARE_PRIVATE_D( d_ptr, RadioHistoryModel )
|
|
39 |
Q_DISABLE_COPY( RadioHistoryModel )
|
|
40 |
|
|
41 |
friend class RadioUiEngine;
|
|
42 |
friend class RadioUiEnginePrivate;
|
|
43 |
friend class RadioStationModelPrivate;
|
|
44 |
|
|
45 |
friend class RadioHistoryView; // TEMPORARY TEST CODE, REMOVE
|
|
46 |
|
|
47 |
public:
|
|
48 |
|
|
49 |
~RadioHistoryModel();
|
|
50 |
|
|
51 |
enum HistoryRole
|
|
52 |
{
|
|
53 |
HistoryItemRole = Qt::UserRole + 100,
|
|
54 |
SetFavoriteRole
|
|
55 |
};
|
|
56 |
|
|
57 |
// from base class QAbstractListModel
|
|
58 |
|
|
59 |
int rowCount( const QModelIndex& parent = QModelIndex() ) const;
|
|
60 |
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const;
|
|
61 |
|
|
62 |
// New functions
|
|
63 |
|
|
64 |
/*!
|
|
65 |
* Sets the icons to be used in the list
|
|
66 |
*/
|
|
67 |
void setIcons( const QIcon& nonTaggedIcon, const QIcon& taggedIcon );
|
|
68 |
|
|
69 |
bool isCurrentSongRecognized() const;
|
|
70 |
void setShowDetails( bool showDetails );
|
|
71 |
void setShowTagged( bool showTagged );
|
|
72 |
void toggleTagging( const RadioHistoryItem& item, const int row );
|
|
73 |
|
|
74 |
RadioHistoryItem itemAtIndex( const QModelIndex& index ) const;
|
|
75 |
|
|
76 |
signals:
|
|
77 |
|
|
78 |
void itemAdded();
|
|
79 |
void currentSongReset();
|
|
80 |
|
|
81 |
public slots:
|
|
82 |
|
|
83 |
void resetCurrentSong();
|
|
84 |
void removeAll();
|
|
85 |
|
|
86 |
private:
|
|
87 |
|
|
88 |
explicit RadioHistoryModel( RadioUiEngine& uiEngine );
|
|
89 |
|
|
90 |
void addItem( const QString& artist, const QString& title, const RadioStation& station );
|
|
91 |
|
|
92 |
void clearRadioTextPlus();
|
|
93 |
void addRadioTextPlus( int rtClass, const QString& rtItem, const RadioStation& station );
|
|
94 |
|
|
95 |
void reportChangedData( int start, int end = -1 );
|
|
96 |
|
|
97 |
void emitItemAdded();
|
|
98 |
|
|
99 |
private: // data
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Unmodifiable pointer to the private implementation
|
|
103 |
*/
|
|
104 |
RadioHistoryModelPrivate* const d_ptr;
|
|
105 |
|
|
106 |
};
|
|
107 |
|
|
108 |
#endif // RADIOHISTORYMODEL_H
|