1 /** |
1 /** |
2 * @file smfmusicrating.h |
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
3 * @author Nalina Hariharan, Sasken Communication Technologies Ltd - Initial contribution |
3 * All rights reserved. |
4 * @version 1.0 |
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" |
5 * |
8 * |
6 * @section LICENSE |
9 * Initial Contributors: |
|
10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
7 * |
11 * |
8 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
12 * Contributors: |
9 * All rights reserved. |
13 * Manasij Roy, Nalina Hariharan |
10 * This component and the accompanying materials are made available |
|
11 * under the terms of the "{License}" |
|
12 * which accompanies this distribution, and is available |
|
13 * at the URL "{LicenseUrl}". |
|
14 * |
14 * |
15 * @section DESCRIPTION |
15 * Description: |
|
16 * The music rating class represents an instance of rating |
|
17 * about a music track |
16 * |
18 * |
17 * The music rating class represents an instance of rating |
|
18 * about a music track |
|
19 */ |
19 */ |
20 |
20 |
21 #ifndef SMFMUSICRATING_H_ |
21 #ifndef SMFMUSICRATING_H_ |
22 #define SMFMUSICRATING_H_ |
22 #define SMFMUSICRATING_H_ |
23 |
23 |
24 #include <QObject> |
24 #include <QObject> |
25 #include "SmfClientGlobal.h" |
25 #include <QSharedData> |
|
26 #include <smfclientglobal.h> |
|
27 |
26 class SmfTrackInfo; |
28 class SmfTrackInfo; |
|
29 class SmfMusicRatingPrivate; |
|
30 |
27 /** |
31 /** |
28 * Rating value, services should define their own scale |
32 * Indicates range of values to represent ratings, |
|
33 * SP should normalize their rating value to this scale |
29 */ |
34 */ |
30 class SMFCLIENT_EXPORT SmfMusicRating : QObject |
35 const int SMF_MAX_RATING = 10; |
|
36 const int SMF_MIN_RATING = 0; |
|
37 |
|
38 /** |
|
39 * @ingroup smf_common_group |
|
40 * The music rating class represents an instance of rating |
|
41 * about a music track |
|
42 */ |
|
43 class SMFCLIENT_EXPORT SmfMusicRating : public QObject |
31 { |
44 { |
32 Q_OBJECT |
45 Q_OBJECT |
33 |
|
34 public: |
46 public: |
35 /** |
47 /** |
36 * Constructs the rating for the given track |
48 * Constructor with default argument |
|
49 * @param aParent The parent object |
|
50 * (parent should be of type SmfTrackInfo) |
37 */ |
51 */ |
38 SmfMusicRating(SmfTrackInfo* track); |
52 SmfMusicRating(SmfTrackInfo *aParent = 0); |
39 /** |
|
40 * Gets the rating |
|
41 */ |
|
42 int getRating(); |
|
43 |
53 |
44 /** |
54 /** |
45 * Gets the max for the rating scale |
55 * Copy Constructor |
|
56 * @param aOther The reference object |
46 */ |
57 */ |
47 int getMax(); |
58 SmfMusicRating( const SmfMusicRating &aOther ); |
48 |
59 |
49 /** |
60 /** |
50 * Gets the min for the rating scale |
61 * Overloaded = operator |
|
62 * @param aOther The reference object |
51 */ |
63 */ |
52 int getMin(); |
64 SmfMusicRating operator=( const SmfMusicRating &aOther ); |
53 |
65 |
54 /** |
66 /** |
55 * Gets the rating |
67 * Destructor |
56 */ |
68 */ |
57 void setRating(int rating); |
69 ~SmfMusicRating( ); |
58 |
70 |
59 /** |
71 /** |
60 * Sets the max for the rating scale |
72 * Method to get the rating |
|
73 * @return The rating value |
61 */ |
74 */ |
62 void setMax(int max); |
75 int rating( ) const; |
|
76 |
|
77 /** |
|
78 * Method to get the max rating |
|
79 * @return The max rating value |
|
80 */ |
|
81 int maxRating( ) const; |
63 |
82 |
64 /** |
83 /** |
65 * Sets the min for the rating scale |
84 * Method to get the min rating |
|
85 * @return The min rating value |
66 */ |
86 */ |
67 void setMin(int min); |
87 int minRating( ) const; |
|
88 |
|
89 private: |
|
90 QSharedDataPointer<SmfMusicRatingPrivate> d; |
|
91 |
|
92 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
93 const SmfMusicRating &aMusicRating ); |
68 |
94 |
69 private: |
95 friend QDataStream &operator>>( QDataStream &aDataStream, |
70 int m_rating; |
96 SmfMusicRating &aMusicRating ); |
71 int m_max; |
97 |
72 int m_min; |
|
73 }; |
98 }; |
|
99 |
|
100 |
74 /** |
101 /** |
75 * Externalization |
102 * Method for Externalization. Writes the SmfMusicRating object to |
76 */ |
103 * the stream and returns a reference to the stream. |
77 QDataStream &operator<<(QDataStream &, const SmfMusicRating&); |
104 * @param aDataStream Stream to be written |
|
105 * @param aMusicRating The SmfMusicRating object to be externalized |
|
106 * @return reference to the written stream |
|
107 */ |
|
108 QDataStream &operator<<( QDataStream &aDataStream, |
|
109 const SmfMusicRating &aMusicRating ); |
|
110 |
78 /** |
111 /** |
79 * Internalization |
112 * Method for Internalization. Reads a SmfMusicRating object from |
|
113 * the stream and returns a reference to the stream. |
|
114 * @param aDataStream Stream to be read |
|
115 * @param aMusicRating The SmfMusicRating object to be internalized |
|
116 * @return reference to the stream |
80 */ |
117 */ |
81 QDataStream &operator>>(QDataStream &, SmfMusicRating&); |
118 QDataStream &operator>>( QDataStream &aDataStream, |
|
119 SmfMusicRating &aMusicRating); |
|
120 |
82 #endif /* SMFMUSICRATING_H_ */ |
121 #endif /* SMFMUSICRATING_H_ */ |