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