author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 13:35:48 +0300 | |
changeset 34 | 84197e66a4bd |
parent 31 | ebfee66fde93 |
child 43 | 35b64624a9e7 |
permissions | -rw-r--r-- |
31 | 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:MsgConversationWidget Widget (aka Bubble Widget). |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef MSG_CONVERSATIONWIDGET_H |
|
19 |
#define MSG_CONVERSATIONWIDGET_H |
|
20 |
||
21 |
// SYSTEM INCLUDES |
|
22 |
#include <hbwidget.h> |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
23 |
#include <HbIcon> |
31 | 24 |
|
25 |
// FORWORD DECLARATIONS |
|
26 |
class HbFrameItem; |
|
27 |
class HbIconItem; |
|
28 |
class HbTextItem; |
|
29 |
||
30 |
/** |
|
31 |
* This class represents the custom layouted widget to show |
|
32 |
* the conversation inside a bubble shape in the conversation view. |
|
33 |
*/ |
|
34 |
class MsgConversationWidget: public HbWidget |
|
35 |
{ |
|
36 |
Q_OBJECT |
|
37 |
||
38 |
Q_ENUMS(SendingState) |
|
39 |
Q_PROPERTY(int priority READ priority WRITE setPriority) |
|
40 |
Q_PROPERTY(bool hasAttachment READ hasAttachment WRITE setAttachment) |
|
41 |
Q_PROPERTY(bool hasImage READ hasImage WRITE setImage) |
|
42 |
Q_PROPERTY(bool hasAudio READ hasAudio WRITE setAudio) |
|
43 |
Q_PROPERTY(bool hasVideo READ hasVideo WRITE setVideo) |
|
44 |
Q_PROPERTY(bool isPlayable READ isPlayable WRITE setPlayable) |
|
45 |
Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming) |
|
46 |
Q_PROPERTY(bool isMMS READ isMMS WRITE setMMS) |
|
47 |
Q_PROPERTY(bool isMMSNotification READ isMMSNotification WRITE setMMSNotification) |
|
48 |
Q_PROPERTY(bool isUnread READ isUnread WRITE setUnread) |
|
49 |
Q_PROPERTY(SendingState sendingState READ sendingState WRITE setSendingState) |
|
50 |
Q_PROPERTY(int notificationState READ notificationState WRITE setNotificationState) |
|
51 |
||
52 |
public: |
|
53 |
||
54 |
/** |
|
55 |
* Constructor |
|
56 |
* @param parent, reference of QGraphicsItem |
|
57 |
* default set to 0 |
|
58 |
*/ |
|
59 |
MsgConversationWidget(QGraphicsItem * parent = 0); |
|
60 |
||
61 |
/** |
|
62 |
* Destructor |
|
63 |
*/ |
|
64 |
virtual ~MsgConversationWidget(); |
|
65 |
||
66 |
public: |
|
67 |
||
68 |
/** |
|
69 |
* Enum defining Message Sending State |
|
70 |
* @attention This enum can have values from 0 to 255 only. |
|
71 |
*/ |
|
72 |
enum SendingState |
|
73 |
{ |
|
74 |
Unknown = 0x00, Sent = 0x01, Sending = 0x02, Pending = 0x03, Failed = 0x04 |
|
75 |
}; |
|
76 |
||
77 |
/** |
|
78 |
* Set subject for this widget |
|
79 |
* @param QString |
|
80 |
*/ |
|
81 |
void setSubject(const QString &subject); |
|
82 |
||
83 |
/** |
|
84 |
* Set body text for this widget |
|
85 |
* @param QString |
|
86 |
*/ |
|
87 |
void setBodyText(const QString &bodyText); |
|
88 |
||
89 |
/** |
|
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
90 |
* Set preview icon for this widget |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
91 |
* @param HbIcon, preview-icon |
31 | 92 |
*/ |
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
93 |
void setPreviewIcon(HbIcon& icon); |
31 | 94 |
|
95 |
/** |
|
96 |
* Set priority property |
|
97 |
* @param priority Set high/low/normal priority |
|
98 |
* @attention Pass high/low/normal priority to this function. |
|
99 |
* @see ConvergedMessage::Priority |
|
100 |
*/ |
|
101 |
void setPriority(int priority); |
|
102 |
||
103 |
/** |
|
104 |
* Get priority property |
|
105 |
* @return Returns high/low/normal priority. |
|
106 |
* @see ConvergedMessage::Priority |
|
107 |
*/ |
|
108 |
int priority(); |
|
109 |
||
110 |
/** |
|
111 |
* Specify if this widget's message has attachment |
|
112 |
* @param bool |
|
113 |
*/ |
|
114 |
void setAttachment(bool hasAttachment = true); |
|
115 |
||
116 |
/** |
|
117 |
* Get to find if this has attachment |
|
118 |
* @return bool |
|
119 |
*/ |
|
120 |
bool hasAttachment(); |
|
121 |
||
122 |
/** |
|
123 |
* Specify if this widget's message has image |
|
124 |
* @param bool |
|
125 |
*/ |
|
126 |
void setImage(bool image = true); |
|
127 |
||
128 |
/** |
|
129 |
* Get to find if this has image file |
|
130 |
* @return bool |
|
131 |
*/ |
|
132 |
bool hasImage(); |
|
133 |
||
134 |
/** |
|
135 |
* Specify if this widget's message has audio |
|
136 |
* @param bool |
|
137 |
*/ |
|
138 |
void setAudio(bool hasAudio = true); |
|
139 |
||
140 |
/** |
|
141 |
* Get to find if this has audio file |
|
142 |
* @return bool |
|
143 |
*/ |
|
144 |
bool hasAudio(); |
|
145 |
||
146 |
/** |
|
147 |
* Displays audio icon if audio media is present. |
|
148 |
*/ |
|
149 |
void displayAudioIcon(const QString &iconPath = QString()); |
|
150 |
||
151 |
/** |
|
152 |
* Specify if this widget's message has video |
|
153 |
* @param bool |
|
154 |
*/ |
|
155 |
void setVideo(bool hasVideo = true); |
|
156 |
||
157 |
/** |
|
158 |
* Get to find if this has video file |
|
159 |
* @return bool |
|
160 |
*/ |
|
161 |
bool hasVideo(); |
|
162 |
||
163 |
/** |
|
164 |
* Specify if this widget's message has playable content |
|
165 |
* @param bool |
|
166 |
*/ |
|
167 |
void setPlayable(bool playable = true); |
|
168 |
||
169 |
/** |
|
170 |
* Get to find if this has playable content |
|
171 |
* @return bool |
|
172 |
*/ |
|
173 |
bool isPlayable(); |
|
174 |
||
175 |
/** |
|
176 |
* Specify if this widget's message is incoming |
|
177 |
* @param bool |
|
178 |
*/ |
|
179 |
void setIncoming(bool incoming = true); |
|
180 |
||
181 |
/** |
|
182 |
* Get to find if this is incoming message |
|
183 |
* @return bool |
|
184 |
*/ |
|
185 |
bool isIncoming(); |
|
186 |
||
187 |
/** |
|
188 |
* Specify if this widget's message is unread |
|
189 |
* @param bool |
|
190 |
*/ |
|
191 |
void setUnread(bool unread = true); |
|
192 |
||
193 |
/** |
|
194 |
* Get to find if this is unread message |
|
195 |
* @return bool |
|
196 |
*/ |
|
197 |
bool isUnread(); |
|
198 |
||
199 |
/** |
|
200 |
* Set to know if this widget if of type MMS |
|
201 |
* @return bool |
|
202 |
*/ |
|
203 |
void setMMS(bool isMMS = true); |
|
204 |
||
205 |
/** |
|
206 |
* Get to find if this widget is of type MMS |
|
207 |
* @return bool |
|
208 |
*/ |
|
209 |
bool isMMS(); |
|
210 |
||
211 |
/** |
|
212 |
* Set to know if this widget if of type MMS Notification |
|
213 |
* @return bool |
|
214 |
*/ |
|
215 |
void setMMSNotification(bool isMMSNotification = true); |
|
216 |
||
217 |
/** |
|
218 |
* Get to find if this widget is of type MMS Notification |
|
219 |
* @return bool |
|
220 |
*/ |
|
221 |
bool isMMSNotification(); |
|
222 |
||
223 |
/** |
|
224 |
* Set the sending state. |
|
225 |
* Maps ConvergedMessage::SendingState to MessageState. |
|
226 |
* @see ConvergedMessage::SendingState |
|
227 |
*/ |
|
228 |
void setSendingState(int state); |
|
229 |
||
230 |
/** |
|
231 |
* Returns the sending state. |
|
232 |
* @return Returns one of the states from enum SendingState. |
|
233 |
*/ |
|
234 |
SendingState sendingState(); |
|
235 |
||
236 |
/** |
|
237 |
* Set the notification state. |
|
238 |
* Maps ConvergedMessage::NotificationState to MessageState. |
|
239 |
* @see ConvergedMessage::NotificationState |
|
240 |
*/ |
|
241 |
void setNotificationState(int state); |
|
242 |
||
243 |
/** |
|
244 |
* Returns the notification state. |
|
245 |
* @return Returns one of the states from enum NotificationState. |
|
246 |
*/ |
|
247 |
int notificationState(); |
|
248 |
||
249 |
/** |
|
250 |
* Sets the Timestamp. |
|
251 |
* @param timeStamp Timestamp to be set. |
|
252 |
*/ |
|
253 |
void setTimeStamp(const QString &timeStamp); |
|
254 |
||
255 |
/** |
|
256 |
* Draws the new message frame. |
|
257 |
*/ |
|
258 |
void drawNewItemFrame(); |
|
259 |
||
260 |
/** |
|
261 |
* Draws the normal/highlighted state bubble frame. |
|
262 |
*/ |
|
263 |
void drawBubbleFrame(); |
|
264 |
||
265 |
/** |
|
266 |
* Draws the pressed state bubble frame. |
|
267 |
*/ |
|
268 |
void drawPressedBubbleFrame(); |
|
269 |
||
270 |
/** |
|
271 |
* Function to receive item pressed events. |
|
272 |
* @see MsgConversationViewItem::pressStateChanged |
|
273 |
*/ |
|
274 |
void pressStateChanged(bool pressed, bool animate); |
|
275 |
||
276 |
/** |
|
277 |
* Function to reset widget items. |
|
278 |
*/ |
|
279 |
void resetProperties(); |
|
280 |
||
281 |
/** |
|
282 |
* Function to repolish the widget |
|
283 |
*/ |
|
284 |
void repolishWidget(); |
|
285 |
||
286 |
private: |
|
287 |
||
288 |
/** |
|
289 |
* Initialize the widget. |
|
290 |
*/ |
|
291 |
void init(); |
|
292 |
||
293 |
public: |
|
294 |
||
295 |
/** |
|
296 |
* Enum defining MMS Notification's Msg State |
|
297 |
* These are added here so that notification state |
|
298 |
* can be used inside css in future |
|
299 |
* @attention This enum can have values from 0 to 255 only |
|
300 |
* Add any new states only at the bottom of this enum |
|
301 |
*/ |
|
302 |
enum NotificationState |
|
303 |
{ |
|
304 |
NotifUnknown = 0x00, |
|
305 |
NotifReadyForFetching = 0x01, |
|
306 |
NotifRetrieving = 0x02, |
|
307 |
NotifExpired = 0x03, |
|
308 |
NotifFailed = 0x04, |
|
309 |
}; |
|
310 |
||
311 |
private: |
|
312 |
||
313 |
/** |
|
314 |
* Info if message has attachment. |
|
315 |
* true if message has attachment else false. |
|
316 |
*/ |
|
317 |
bool mHasAttachment; |
|
318 |
||
319 |
/** |
|
320 |
* Info if message has image. |
|
321 |
* true if message has image else false. |
|
322 |
*/ |
|
323 |
bool mHasImage; |
|
324 |
||
325 |
/** |
|
326 |
* Info if message has audio. |
|
327 |
* true if message has audio else false. |
|
328 |
*/ |
|
329 |
bool mHasAudio; |
|
330 |
||
331 |
/** |
|
332 |
* Info if message has video. |
|
333 |
* true if message has video else false. |
|
334 |
*/ |
|
335 |
bool mHasVideo; |
|
336 |
||
337 |
/** |
|
338 |
* Info if message is playable. |
|
339 |
* true if message is playable else false. |
|
340 |
*/ |
|
341 |
bool mIsPlayable; |
|
342 |
||
343 |
/** |
|
344 |
* Info about received or outgoing message. |
|
345 |
* true if received message else false. |
|
346 |
*/ |
|
347 |
bool mIncoming; |
|
348 |
||
349 |
/** |
|
350 |
* Info about message read/unread status. |
|
351 |
* true if message is unread else false. |
|
352 |
*/ |
|
353 |
bool mUnread; |
|
354 |
||
355 |
/** |
|
356 |
* Holds info if this widget is MMS |
|
357 |
*/ |
|
358 |
bool mIsMMS; |
|
359 |
||
360 |
/** |
|
361 |
* Holds info if this widget is MMS Notification |
|
362 |
*/ |
|
363 |
bool mIsMMSNotification; |
|
364 |
||
365 |
/** |
|
366 |
* Info about message priority. |
|
367 |
* @attention Stores high/low/normal priority. |
|
368 |
* @see ConvergedMessage::Priority |
|
369 |
*/ |
|
370 |
int mPriority; |
|
371 |
||
372 |
/** |
|
373 |
* Holds sending state information. |
|
374 |
*/ |
|
375 |
MsgConversationWidget::SendingState mSendingState; |
|
376 |
||
377 |
/** |
|
378 |
* Holds Notification state information. |
|
379 |
*/ |
|
380 |
int mNotificationState; |
|
381 |
||
382 |
/** |
|
383 |
* Graphics Item to hold new message icon. |
|
384 |
* Owned |
|
385 |
*/ |
|
386 |
HbFrameItem *mNewFrameItem; |
|
387 |
||
388 |
/** |
|
389 |
* Graphics Item to hold bubble frame. |
|
390 |
* Owned |
|
391 |
*/ |
|
392 |
HbFrameItem *mBubbleFrameItem; |
|
393 |
||
394 |
/** |
|
395 |
* Graphics Item to hold subject content. |
|
396 |
* Owned |
|
397 |
*/ |
|
398 |
HbTextItem *mSubjectTextItem; |
|
399 |
||
400 |
/** |
|
401 |
* Graphics Item to hold body text content. |
|
402 |
* Owned |
|
403 |
*/ |
|
404 |
HbTextItem *mBodyTextItem; |
|
405 |
||
406 |
/** |
|
407 |
* Graphics Item to hold Time stamp. |
|
408 |
* Owned |
|
409 |
*/ |
|
410 |
HbTextItem *mTimeStampTextItem; |
|
411 |
||
412 |
/** |
|
413 |
* Graphics Item to hold Icon. |
|
414 |
* Owned |
|
415 |
*/ |
|
416 |
HbIconItem *mPriorityIconItem; |
|
417 |
||
418 |
/** |
|
419 |
* Graphics Item to hold Attachment Icon. |
|
420 |
* Owned |
|
421 |
*/ |
|
422 |
HbIconItem *mAttachmentIconItem; |
|
423 |
||
424 |
/** |
|
425 |
* Graphics Item to hold Audio Icon. |
|
426 |
* Owned |
|
427 |
*/ |
|
428 |
HbIconItem *mAudioIconItem; |
|
429 |
||
430 |
/** |
|
431 |
* Graphics Item to hold Video Icon. |
|
432 |
* Owned |
|
433 |
*/ |
|
434 |
HbIconItem *mVideoIconItem; |
|
435 |
||
436 |
/** |
|
437 |
* Graphics Item to hold Play Icon. |
|
438 |
* Owned |
|
439 |
*/ |
|
440 |
HbIconItem *mPlayIconItem; |
|
441 |
||
442 |
/** |
|
443 |
* Graphics Item to hold Preview thumbnail. |
|
444 |
* Owned |
|
445 |
*/ |
|
446 |
HbIconItem *mPreviewIconItem; |
|
447 |
}; |
|
448 |
||
449 |
#endif // MSG_CONVERSATIONWIDGET_H |
|
450 |
// EOF |