|
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: This widget displays the body of the viewer |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef UNIVIEWER_BODY_WIDGET_H |
|
19 #define UNIVIEWER_BODY_WIDGET_H |
|
20 |
|
21 #include <hbwidget.h> |
|
22 |
|
23 #include "unidatamodelplugininterface.h" |
|
24 |
|
25 class UniViewerTextItem; |
|
26 class UniViewerPixmapWidget; |
|
27 class UniViewerAudioWidget; |
|
28 class HbTextItem; |
|
29 class HbIconItem; |
|
30 |
|
31 /** |
|
32 * @class UniViewerBodyWidget |
|
33 * @brief This widget displays the body of the viewer. |
|
34 */ |
|
35 class UniViewerBodyWidget: public HbWidget |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 Q_PROPERTY(bool hasText READ hasText WRITE setHasText) |
|
40 Q_PROPERTY(bool hasPixmap READ hasPixmap WRITE setHasPixmap) |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Constructor |
|
46 */ |
|
47 explicit UniViewerBodyWidget(QGraphicsItem *parent = 0); |
|
48 |
|
49 /** |
|
50 * Destructor |
|
51 */ |
|
52 ~UniViewerBodyWidget(); |
|
53 |
|
54 /** |
|
55 * Specify if this slide has text |
|
56 * @param bool |
|
57 */ |
|
58 void setHasText(bool text = true); |
|
59 |
|
60 /** |
|
61 * Get to find if slide has text file |
|
62 * @return bool |
|
63 */ |
|
64 bool hasText(); |
|
65 |
|
66 /** |
|
67 * Specify if this slide has pixmap |
|
68 * @param bool |
|
69 */ |
|
70 void setHasPixmap(bool text = true); |
|
71 |
|
72 /** |
|
73 * Returns true if body has pixmap |
|
74 * @return bool |
|
75 */ |
|
76 bool hasPixmap(); |
|
77 |
|
78 /** |
|
79 * Sets the side content |
|
80 * @param objList object list |
|
81 * @param slideString slide string |
|
82 */ |
|
83 void setSlideContents(UniMessageInfoList objList, QString slideString); |
|
84 |
|
85 /** |
|
86 * Clears the content on the widget |
|
87 */ |
|
88 void clearContent(); |
|
89 |
|
90 signals: |
|
91 |
|
92 /** |
|
93 * this signal is emitted when sendMessage is emitted from UniViewerTextItem. |
|
94 */ |
|
95 void sendMessage(const QString& phoneNumber); |
|
96 |
|
97 public slots: |
|
98 |
|
99 /** |
|
100 * Called to insert text content in viewer. |
|
101 * @param text Body text to be set. |
|
102 */ |
|
103 void setText(QString text); |
|
104 |
|
105 protected: |
|
106 |
|
107 /** |
|
108 * Reimplemented from base class to provide proper geometry for scrolling. |
|
109 * @see HbWidget |
|
110 */ |
|
111 QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; |
|
112 |
|
113 private: |
|
114 |
|
115 /** |
|
116 * Called to insert image content in viewer. |
|
117 * @param info Object information. |
|
118 */ |
|
119 void setPixmap(UniMessageInfo *info); |
|
120 |
|
121 /** |
|
122 * Called to insert audio content in viewer. |
|
123 * @param info Object information. |
|
124 */ |
|
125 void setAudio(UniMessageInfo *info); |
|
126 |
|
127 /** |
|
128 * Called to insert video content in viewer. |
|
129 * @param info Object information. |
|
130 */ |
|
131 void setVideo(UniMessageInfo *info); |
|
132 |
|
133 /** |
|
134 * Sets the slide counter. |
|
135 * @param slideCounter Slide counter string to be set. |
|
136 */ |
|
137 void setSlideCounter(QString &slideCounter); |
|
138 |
|
139 /** |
|
140 * Sets overlay icon on top of pixmap widget. |
|
141 * @param iconName Overlay icon name to be set. |
|
142 */ |
|
143 void setOverlayIcon(const QString &iconName); |
|
144 |
|
145 private slots: |
|
146 |
|
147 /** |
|
148 * Handles the cases related to video thumbnail generation success/failure. |
|
149 * @param result true if thumbnail was found else false. |
|
150 * @param info UniMessageInfo of the media object. |
|
151 */ |
|
152 void onThumbnailFound(bool result, UniMessageInfo *info); |
|
153 |
|
154 private: |
|
155 |
|
156 /** |
|
157 * Info if slide has text. |
|
158 * true if slide has text else false. |
|
159 */ |
|
160 bool mHasText; |
|
161 |
|
162 /** |
|
163 * Info if slide has pixmap. |
|
164 * true if slide has pixmap else false. |
|
165 */ |
|
166 bool mHasPixmap; |
|
167 |
|
168 /** |
|
169 * Editor to in put text. |
|
170 */ |
|
171 UniViewerTextItem* mTextItem; |
|
172 |
|
173 /** |
|
174 * Slide counter. |
|
175 */ |
|
176 HbTextItem *mSlideCounter; |
|
177 |
|
178 /** |
|
179 * Icon item to preview images. |
|
180 */ |
|
181 UniViewerPixmapWidget *mPixmapItem; |
|
182 |
|
183 /** |
|
184 * Media widget for embedded audio content. |
|
185 */ |
|
186 UniViewerAudioWidget *mAudioItem; |
|
187 |
|
188 /** |
|
189 * Overlay icon on top of pixmap widget. |
|
190 */ |
|
191 HbIconItem *mOverlayItem; |
|
192 }; |
|
193 |
|
194 #endif //UNIVIEWER_BODY_WIDGET_H |
|
195 // EOF |