|
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 IRQISDSDATASTRUCTURE_H |
|
18 #define IRQISDSDATASTRUCTURE_H |
|
19 #include <QList> |
|
20 #include <QString> |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #define DEBUG_ISDS_DATA 0 |
|
25 |
|
26 class QDataStream; |
|
27 |
|
28 class IRQBrowseCategoryItem |
|
29 { |
|
30 public: |
|
31 QString catName; |
|
32 int size; |
|
33 }; |
|
34 |
|
35 |
|
36 class IRQChannelItem |
|
37 { |
|
38 public: |
|
39 QString channelName; |
|
40 QString shortDescription; |
|
41 QString imageURL; |
|
42 }; |
|
43 |
|
44 class IRQChannelServerURL |
|
45 { |
|
46 public: |
|
47 void internalize(QDataStream &aStream); |
|
48 void externalize(QDataStream &aStream) const; |
|
49 |
|
50 public: |
|
51 QString serverName; |
|
52 QString url; |
|
53 int bitrate; |
|
54 }; |
|
55 |
|
56 class IRQPreset |
|
57 { |
|
58 public: |
|
59 enum IRQPresetType |
|
60 { |
|
61 EUser, |
|
62 EIsds |
|
63 }; |
|
64 |
|
65 |
|
66 IMPORT_C IRQPreset(); |
|
67 IMPORT_C ~IRQPreset(); |
|
68 IMPORT_C IRQPreset& operator = (const IRQPreset& aOther); |
|
69 |
|
70 IMPORT_C void internalize(QDataStream &aStream); |
|
71 IMPORT_C void externalize(QDataStream &aStream) const; |
|
72 |
|
73 /* get the bitrates of the preset. |
|
74 */ |
|
75 IMPORT_C void getAvailableBitrates(QList<int>& aBitrates) const; |
|
76 /* get the url for the specify bitrate |
|
77 * the caller should delete the QList */ |
|
78 IMPORT_C QList<QString> * getURLsForBitrate(int aBitrate) const; |
|
79 /* the following functions may be changed in future */ |
|
80 IMPORT_C int getChannelUrlAt(int aIndex, QString& aURL) const; |
|
81 IMPORT_C int getChannelBitrate(int aIndex, int &aBitrate) const; |
|
82 |
|
83 /* sort the urlArray with bitrates by ascending. for |
|
84 * there are not many items, here we use bubble sorting. |
|
85 */ |
|
86 IMPORT_C void sortURLArray(); |
|
87 /* check wether the internal list is sorted |
|
88 */ |
|
89 IMPORT_C bool isSorted() const; |
|
90 /* append a channel server into a internal list |
|
91 */ |
|
92 IMPORT_C void insertChannelServer(const IRQChannelServerURL& aURL); |
|
93 /* clear the internal list |
|
94 */ |
|
95 IMPORT_C void clearChannelServerList(); |
|
96 |
|
97 IMPORT_C int getChannelURLCount() const; |
|
98 |
|
99 IMPORT_C bool setUrlBitrate(const int aUrlIndex, const int aBitrate); |
|
100 |
|
101 int uniqID; //unique id generated for the preset saved at favourite |
|
102 |
|
103 int type; //0 for user defined 1 for isds type. |
|
104 int index;//index in the preset table |
|
105 int presetId;//isds generated preset id |
|
106 QString name; //preset name |
|
107 QString languageCode;//preset language code |
|
108 QString languageName; // preset language |
|
109 QString countryCode;//preset country of origin code |
|
110 QString countryName;//preset country of origin |
|
111 QString lastModified;//preset last modified |
|
112 QString musicStoreStatus;//musicStoreEnabled value |
|
113 //QByteArray logoData;//Logo Data |
|
114 RBuf8 logoData; |
|
115 QString description;//channel description |
|
116 QString shortDesc;//channel short desription |
|
117 QString genreName;//channel genre name |
|
118 QString genreId;//channel genre id |
|
119 int bitrate;//channel bitrate |
|
120 |
|
121 //in our spec but not in current code |
|
122 QString advertisementUrl; |
|
123 QString advertisementInUse; |
|
124 QString imgUrl; |
|
125 |
|
126 |
|
127 private: |
|
128 /* for one preset, there may be many servers*/ |
|
129 QList<IRQChannelServerURL> urlArray; |
|
130 bool iIsSorted; |
|
131 int iChannelUrlCount; //no of channel urls |
|
132 |
|
133 private: |
|
134 friend class IRQUtility; |
|
135 |
|
136 }; |
|
137 |
|
138 bool bitrateLessThan(const IRQChannelServerURL &url1, const IRQChannelServerURL &url2); |
|
139 |
|
140 #endif /* IRQISDSDATASTRUCTURE_H */ |