|
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 IRFAVORITESMODEL_H |
|
19 #define IRFAVORITESMODEL_H |
|
20 |
|
21 #include <QAbstractItemModel> |
|
22 |
|
23 class IRQPreset; |
|
24 class IRQFavoritesDB; |
|
25 class HbIcon; |
|
26 |
|
27 class IRFavoritesModel : public QAbstractListModel |
|
28 { |
|
29 |
|
30 Q_OBJECT |
|
31 |
|
32 public: |
|
33 explicit IRFavoritesModel(IRQFavoritesDB *aFavoritesDb, QObject *aParent = NULL); |
|
34 ~IRFavoritesModel(); |
|
35 |
|
36 IRQPreset* getPreset(int aIndex) const; |
|
37 QString getImgUrl(int aIndex) const; |
|
38 |
|
39 int rowCount(const QModelIndex &aParent = QModelIndex()) const; |
|
40 QVariant data(const QModelIndex &aIndex, int aRole = Qt::DisplayRole) const; |
|
41 void setLogo(HbIcon *aIcon, int aIndex); |
|
42 bool checkFavoritesUpdate(); |
|
43 |
|
44 void clearFavoriteDB(); |
|
45 void clearAndDestroyLogos(); |
|
46 bool deleteOneFavorite(int aIndex); |
|
47 |
|
48 signals: |
|
49 void modelChanged(); |
|
50 |
|
51 |
|
52 private: |
|
53 void clearPresetList(); |
|
54 |
|
55 private: |
|
56 IRQFavoritesDB *iFavoritesDb; |
|
57 QList<IRQPreset*> *iPresetsList; |
|
58 HbIcon *iStationLogo; |
|
59 QMap<int, HbIcon*> iLogos; |
|
60 }; |
|
61 |
|
62 #endif |