1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The music rating class represents an instance of rating |
|
17 * about a music track |
|
18 * |
|
19 */ |
|
20 |
|
21 #ifndef SMFMUSICRATING_H_ |
|
22 #define SMFMUSICRATING_H_ |
|
23 |
|
24 #include <QSharedData> |
|
25 #include <smfclientglobal.h> |
|
26 |
|
27 class SmfTrackInfo; |
|
28 class SmfMusicRatingPrivate; |
|
29 |
|
30 /** |
|
31 * Indicates range of values to represent ratings, |
|
32 * SP should normalize their rating value to this scale |
|
33 */ |
|
34 const int SMF_MAX_RATING = 10; |
|
35 const int SMF_MIN_RATING = 0; |
|
36 |
|
37 /** |
|
38 * @ingroup smf_common_group |
|
39 * The music rating class represents an instance of rating |
|
40 * about a music track |
|
41 */ |
|
42 class SMFCLIENT_EXPORT SmfMusicRating |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Constructor with default argument |
|
47 * @param aParent The SmfTrackInfo instance |
|
48 */ |
|
49 SmfMusicRating(SmfTrackInfo *aParent = 0); |
|
50 |
|
51 /** |
|
52 * Copy Constructor |
|
53 * @param aOther The reference object |
|
54 */ |
|
55 SmfMusicRating( const SmfMusicRating &aOther ); |
|
56 |
|
57 /** |
|
58 * Overloaded = operator |
|
59 * @param aOther The reference object |
|
60 */ |
|
61 SmfMusicRating& operator=( const SmfMusicRating &aOther ); |
|
62 |
|
63 /** |
|
64 * Destructor |
|
65 */ |
|
66 ~SmfMusicRating( ); |
|
67 |
|
68 /** |
|
69 * Method to get the rating |
|
70 * @return The rating value |
|
71 */ |
|
72 int rating( ) const; |
|
73 |
|
74 /** |
|
75 * Method to get the max rating |
|
76 * @return The max rating value |
|
77 */ |
|
78 int maxRating( ) const; |
|
79 |
|
80 /** |
|
81 * Method to get the min rating |
|
82 * @return The min rating value |
|
83 */ |
|
84 int minRating( ) const; |
|
85 |
|
86 /** |
|
87 * Method to set the rating |
|
88 * @param aRating The rating value |
|
89 */ |
|
90 void setRating( const int &aRating ); |
|
91 |
|
92 /** |
|
93 * Method to set the max rating |
|
94 * @param aMax The max rating value |
|
95 */ |
|
96 void setMaxRating( const int &aMax ); |
|
97 |
|
98 /** |
|
99 * Method to set the min rating |
|
100 * @param aMin The min rating value |
|
101 */ |
|
102 void setMinRating( const int &aMin ); |
|
103 |
|
104 private: |
|
105 QSharedDataPointer<SmfMusicRatingPrivate> d; |
|
106 |
|
107 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
108 const SmfMusicRating &aMusicRating ); |
|
109 |
|
110 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
111 SmfMusicRating &aMusicRating ); |
|
112 |
|
113 }; |
|
114 |
|
115 |
|
116 /** |
|
117 * Method for Externalization. Writes the SmfMusicRating object to |
|
118 * the stream and returns a reference to the stream. |
|
119 * @param aDataStream Stream to be written |
|
120 * @param aMusicRating The SmfMusicRating object to be externalized |
|
121 * @return reference to the written stream |
|
122 */ |
|
123 QDataStream &operator<<( QDataStream &aDataStream, |
|
124 const SmfMusicRating &aMusicRating ); |
|
125 |
|
126 /** |
|
127 * Method for Internalization. Reads a SmfMusicRating object from |
|
128 * the stream and returns a reference to the stream. |
|
129 * @param aDataStream Stream to be read |
|
130 * @param aMusicRating The SmfMusicRating object to be internalized |
|
131 * @return reference to the stream |
|
132 */ |
|
133 QDataStream &operator>>( QDataStream &aDataStream, |
|
134 SmfMusicRating &aMusicRating); |
|
135 |
|
136 |
|
137 // Make the class SmfMusicRating known to QMetaType, so that as to register it. |
|
138 Q_DECLARE_METATYPE(SmfMusicRating) |
|
139 |
|
140 |
|
141 #endif /* SMFMUSICRATING_H_ */ |
|