|
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 picture class represents an instance of a picture |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef SMFPICTURE_H_ |
|
21 #define SMFPICTURE_H_ |
|
22 |
|
23 #include <QImage> |
|
24 #include <QDateTime> |
|
25 #include <QStringList> |
|
26 #include <QUrl> |
|
27 #include <qdatastream.h> |
|
28 #include <QSharedData> |
|
29 #include <smfclientglobal.h> |
|
30 #include <QMetaType> |
|
31 |
|
32 class SmfPicturePrivate; |
|
33 |
|
34 /** |
|
35 * SmfPictureVisibility enumeration |
|
36 */ |
|
37 enum SmfPictureVisibility |
|
38 { |
|
39 SMFVisibilityFriend, |
|
40 SMFVisibilityPersonal, |
|
41 SMFVisibilityFamily, |
|
42 SMFVisibilityGroup, |
|
43 SMFVisibilityPublic |
|
44 }; |
|
45 |
|
46 /** |
|
47 * @ingroup smf_common_group |
|
48 * The picture class represents an instance of a picture |
|
49 */ |
|
50 class SMFCLIENT_EXPORT SmfPicture : public QObject |
|
51 { |
|
52 Q_OBJECT |
|
53 public: |
|
54 /** |
|
55 * Constructor with default argument |
|
56 * @param aParent The parent object |
|
57 */ |
|
58 SmfPicture( QObject *aParent = 0 ); |
|
59 |
|
60 /** |
|
61 * Copy Constructor |
|
62 * @param aOther The reference object |
|
63 */ |
|
64 SmfPicture( const SmfPicture &aOther ); |
|
65 |
|
66 /** |
|
67 * CConstructs SmfPicture from QImage |
|
68 * @param aOther The QImage |
|
69 */ |
|
70 SmfPicture( const QImage &image ); |
|
71 |
|
72 /** |
|
73 * Destructor |
|
74 */ |
|
75 ~SmfPicture( ); |
|
76 |
|
77 /** |
|
78 * Method to get the id of the picture |
|
79 * @return The ID value |
|
80 */ |
|
81 QString id( ) const; |
|
82 |
|
83 /** |
|
84 * Method to get a picture owner |
|
85 * @return The owner of the picture |
|
86 */ |
|
87 QString owner( ) const; |
|
88 |
|
89 /** |
|
90 * Method to get a picture title |
|
91 * @return The title of the picture |
|
92 */ |
|
93 QString title( ) const; |
|
94 |
|
95 /** |
|
96 * Method to get a picture description |
|
97 * @return The description of the picture |
|
98 */ |
|
99 QString description( ) const; |
|
100 |
|
101 /** |
|
102 * Method to get a visibility of a picture for public |
|
103 * @return The visibility mode of this picture for others |
|
104 */ |
|
105 SmfPictureVisibility visibility( ) const; |
|
106 |
|
107 /** |
|
108 * Method to get the date of posting the picture |
|
109 * @return The posted date of the picture |
|
110 */ |
|
111 QDateTime postedDate( ) const; |
|
112 |
|
113 /** |
|
114 * Method to get the comments for the picture |
|
115 * @return The comments for the picture |
|
116 */ |
|
117 QStringList comments( ) const; |
|
118 |
|
119 /** |
|
120 * Method to get the tags for the picture |
|
121 * @return The tags for the picture |
|
122 */ |
|
123 QStringList tags( ) const; |
|
124 |
|
125 /** |
|
126 * Method to get the url of the picture |
|
127 * @return The url of the picture |
|
128 */ |
|
129 QUrl url( ) const; |
|
130 |
|
131 /** |
|
132 * Method to get the picture data as QImage |
|
133 * @return The picture as QImage |
|
134 */ |
|
135 QImage picture( ) const; |
|
136 |
|
137 /** |
|
138 * Method to set a picture owner |
|
139 * @param aOwner The owner of the picture |
|
140 */ |
|
141 void setOwner( const QString &aOwner ); |
|
142 |
|
143 /** |
|
144 * Method to set a picture title |
|
145 * @param aTitle The title of the picture |
|
146 */ |
|
147 void setTitle( const QString &aTitle ); |
|
148 |
|
149 /** |
|
150 * Method to set a picture description |
|
151 * @param aDescription The description of the picture |
|
152 */ |
|
153 void setDescription( const QString &aDescription ); |
|
154 |
|
155 /** |
|
156 * Method to set a visibility of a picture for public |
|
157 * @param aVisibility aVisibility The visibility mode of |
|
158 * this picture for others |
|
159 */ |
|
160 void setVisibility( const SmfPictureVisibility &aVisibility ); |
|
161 |
|
162 /** |
|
163 * Method to add comment on the picture |
|
164 * @param aComment The comment for the picture |
|
165 */ |
|
166 void addComment( const QString &aComment ); |
|
167 |
|
168 /** |
|
169 * Method to add tags for the picture |
|
170 * @param aTag The tag for the picture |
|
171 */ |
|
172 void addTags( const QStringList &aTags ); |
|
173 |
|
174 /** |
|
175 * Method to set the picture data as QImage |
|
176 * @param aData The picture as QImage |
|
177 */ |
|
178 void setPicture( const QImage &aData ); |
|
179 |
|
180 private: |
|
181 QSharedDataPointer<SmfPicturePrivate> d; |
|
182 |
|
183 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
184 const SmfPicture &aPic ); |
|
185 |
|
186 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
187 SmfPicture &aPic ); |
|
188 |
|
189 }; |
|
190 |
|
191 |
|
192 /** |
|
193 * Method for Externalization. Writes the SmfPicture object to |
|
194 * the stream and returns a reference to the stream. |
|
195 * @param aDataStream Stream to be written |
|
196 * @param aPic The SmfPicture object to be externalized |
|
197 * @return reference to the written stream |
|
198 */ |
|
199 QDataStream &operator<<( QDataStream &aDataStream, |
|
200 const SmfPicture &aPic ); |
|
201 |
|
202 /** |
|
203 * Method for Internalization. Reads a SmfPicture object from |
|
204 * the stream and returns a reference to the stream. |
|
205 * @param aDataStream Stream to be read |
|
206 * @param aPic The SmfPicture object to be internalized |
|
207 * @return reference to the stream |
|
208 */ |
|
209 QDataStream &operator>>( QDataStream &aDataStream, |
|
210 SmfPicture &aPic); |
|
211 |
|
212 // Make the class SmfPicture known to QMetaType, so that as to register it. |
|
213 Q_DECLARE_METATYPE(SmfPicture) |
|
214 |
|
215 #endif /* SMFPICTURE_H_ */ |