author | hgs |
Fri, 15 Oct 2010 16:26:27 +0300 | |
changeset 57 | 21be958eb3ce |
parent 54 | a8ba0c289b44 |
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 |
||
57 | 65 |
void addItem( const QString& artist, const QString& title, const RadioStation& station, bool fromRds = true ); |
66 |
||
24 | 67 |
/*! |
68 |
* Sets the icons to be used in the list |
|
69 |
*/ |
|
70 |
void setIcons( const QIcon& nonTaggedIcon, const QIcon& taggedIcon ); |
|
71 |
||
72 |
bool isCurrentSongRecognized() const; |
|
73 |
void setShowDetails( bool showDetails ); |
|
74 |
void setShowTagged( bool showTagged ); |
|
75 |
void toggleTagging( const RadioHistoryItem& item, const int row ); |
|
76 |
||
77 |
RadioHistoryItem itemAtIndex( const QModelIndex& index ) const; |
|
78 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
79 |
void removeAll( bool removeTagged ); |
54 | 80 |
void removeByModelIndices( QModelIndexList& indices, bool removeTags ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
81 |
|
57 | 82 |
Q_SIGNALS: |
24 | 83 |
|
84 |
void itemAdded(); |
|
85 |
void currentSongReset(); |
|
86 |
||
57 | 87 |
public Q_SLOTS: |
24 | 88 |
|
89 |
void resetCurrentSong(); |
|
90 |
||
91 |
private: |
|
92 |
||
93 |
explicit RadioHistoryModel( RadioUiEngine& uiEngine ); |
|
94 |
||
95 |
void clearRadioTextPlus(); |
|
96 |
||
97 |
void reportChangedData( int start, int end = -1 ); |
|
98 |
||
99 |
void emitItemAdded(); |
|
100 |
||
101 |
private: // data |
|
102 |
||
103 |
/** |
|
104 |
* Unmodifiable pointer to the private implementation |
|
105 |
*/ |
|
34 | 106 |
const QScopedPointer<RadioHistoryModelPrivate> d_ptr; |
24 | 107 |
|
108 |
}; |
|
109 |
||
110 |
#endif // RADIOHISTORYMODEL_H |