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 #ifndef IRQSONGHISTORYENGINE_H_ |
|
18 #define IRQSONGHISTORYENGINE_H_ |
|
19 |
|
20 #include <QObject> |
|
21 |
|
22 class IRQMetaData; |
|
23 class IRQPreset; |
|
24 class IRQSongHistoryInfo; |
|
25 class CIRSongHistoryDb; |
|
26 class IRQSongInfo; |
|
27 |
|
28 /** |
|
29 * Engine component for Internet Radio SongHistory. |
|
30 */ |
|
31 class IRQSongHistoryEngine : public QObject |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 |
|
37 IMPORT_C static IRQSongHistoryEngine* openInstance(); |
|
38 IMPORT_C void closeInstance(); |
|
39 |
|
40 /** |
|
41 * Get all history from daba base |
|
42 * @param QList<IRQSongHistoryInfo *> |
|
43 */ |
|
44 IMPORT_C void getAllHistory(QList<IRQSongHistoryInfo *>& aSongHistoryArr); |
|
45 |
|
46 /** |
|
47 * this is songs' get, the above will be changed to the stations only |
|
48 */ |
|
49 IMPORT_C void getAllSongHistory(QList<IRQSongInfo *>& aSongHistoryArr); |
|
50 |
|
51 /** |
|
52 * Clear all history in data base |
|
53 */ |
|
54 IMPORT_C int clearAllHistory(); |
|
55 |
|
56 IMPORT_C int clearAllSongHistory(); |
|
57 |
|
58 /** |
|
59 * Called by the UI when a particular channel has been removed from the ISDS. |
|
60 */ |
|
61 IMPORT_C void syncHistory(int aChannelId); |
|
62 |
|
63 /** |
|
64 * Called by the UI when a particular channel has been changed in the ISDS. |
|
65 */ |
|
66 |
|
67 IMPORT_C void updateSongHistoryDb(int aChannelId, |
|
68 const QString& aChannelName, const QString& aChannelUrl, |
|
69 const QString& aImageUrl, const QString& aGenreName, |
|
70 const QString& aCountryName, const QString& aLanguageName, |
|
71 const QString& aMusicFlag); |
|
72 |
|
73 /** |
|
74 * Connected with play controller with the song name changed. |
|
75 * @param aMetaData The meta data contains song name, artist and bitrate. |
|
76 * @param aPreset The preset contains other information. |
|
77 */ |
|
78 IMPORT_C void handleMetaDataReceived(const IRQMetaData& aMetaData, const IRQPreset& aPreset); |
|
79 /** |
|
80 * Connected with play controller with the song name changed. |
|
81 * @param aMetaData The meta data contains song name, artist and bitrate. |
|
82 * @param aMusicshopStatus The music shop status of the song |
|
83 */ |
|
84 IMPORT_C void handleSongMetaDataReceived(const IRQMetaData& aMetaData, const IRQPreset& preset); |
|
85 |
|
86 /* |
|
87 * delete one item from the station history db |
|
88 * @param aIndex the index of the item need deleted |
|
89 */ |
|
90 IMPORT_C bool deleteOneItem(int aIndex); |
|
91 |
|
92 /* |
|
93 * delete one item from the song history db |
|
94 * @param aIndex the index of the item need deleted |
|
95 */ |
|
96 IMPORT_C bool deleteOneSongHistoryItem(int aIndex); |
|
97 |
|
98 private: |
|
99 |
|
100 enum TSongHistoryItemChange |
|
101 { |
|
102 ENOCHANGE = 0, |
|
103 ECHANNELCHANGED, |
|
104 EMETADATACHANGED, |
|
105 EBLANKENTRIES |
|
106 }; |
|
107 |
|
108 private: |
|
109 |
|
110 /** |
|
111 * Creates IRQSongHistoryEngine instance |
|
112 */ |
|
113 static IRQSongHistoryEngine* createInstanceL(); |
|
114 |
|
115 void constructL(); |
|
116 |
|
117 /** |
|
118 * Constructor. |
|
119 */ |
|
120 IRQSongHistoryEngine(); |
|
121 |
|
122 /** |
|
123 * Destructor. |
|
124 */ |
|
125 ~IRQSongHistoryEngine(); |
|
126 |
|
127 TSongHistoryItemChange detectSongHistoryItemChangesL(const IRQMetaData& aMetaData, const QString& aChannelName); |
|
128 |
|
129 void handleMetaDataReceivedL(const IRQMetaData& aMetaData, const IRQPreset& aPreset); |
|
130 void getAllHistoryL(QList<IRQSongHistoryInfo *>& aSongHistoryArr); |
|
131 void handleSongMetaDataReceivedL(const IRQMetaData& aMetaData, const IRQPreset& aPreset); |
|
132 void getAllSongHistoryL(QList<IRQSongInfo *>& aSongHistoryArr); |
|
133 |
|
134 private: |
|
135 |
|
136 /** An instance of songhistory database. */ |
|
137 CIRSongHistoryDb* iSongHistoryDb; |
|
138 |
|
139 /** |
|
140 * Number of objects currently referring to the singleton object IRQSongHistoryEngine |
|
141 */ |
|
142 int iSingletonInstances; |
|
143 }; |
|
144 |
|
145 #endif //IRQSONGHISTORYENGINE_H_ |
|