|
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 pixmap content in viewer. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef UNI_VIEWER_PIXMAP_WIDGET_H |
|
19 #define UNI_VIEWER_PIXMAP_WIDGET_H |
|
20 |
|
21 #include <HbIconItem> |
|
22 |
|
23 // FORWARD DECLARATIONS |
|
24 class UniViewerUtils; |
|
25 class UniMessageInfo; |
|
26 class ThumbnailManager; |
|
27 |
|
28 /** |
|
29 * This widget displays the pixmap content in viewer. |
|
30 */ |
|
31 class UniViewerPixmapWidget: public HbIconItem |
|
32 { |
|
33 Q_OBJECT |
|
34 |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Constructor |
|
39 */ |
|
40 UniViewerPixmapWidget(QGraphicsItem *parent = 0); |
|
41 |
|
42 /** |
|
43 * Destructor |
|
44 */ |
|
45 ~UniViewerPixmapWidget(); |
|
46 |
|
47 /** |
|
48 * Sets the pixmap content to be displayed. |
|
49 * @param info Object information. |
|
50 */ |
|
51 void populate(UniMessageInfo *info); |
|
52 |
|
53 signals: |
|
54 |
|
55 /** |
|
56 * Signal emitted when widget is clicked. |
|
57 * @param mediaPath File path of the media. |
|
58 */ |
|
59 void shortTap(const QString &mediaPath); |
|
60 |
|
61 /** |
|
62 * Signal emitted when widget is long tapped. |
|
63 * @param position Scene coordinates of tap. |
|
64 */ |
|
65 void longTap(const QPointF &position); |
|
66 |
|
67 /** |
|
68 * Signal emitted indicating if thumbnail was found or not |
|
69 * @param result true if thumbnail was found else false. |
|
70 * @param info UniMessageInfo of the media object. |
|
71 */ |
|
72 void thumbnailFound(bool result, UniMessageInfo *info); |
|
73 |
|
74 protected: |
|
75 |
|
76 /** |
|
77 * Event handler for gesture events. |
|
78 * Reimplemented from HbWidgetBase. |
|
79 * @see HbWidgetBase |
|
80 */ |
|
81 virtual void gestureEvent(QGestureEvent *event); |
|
82 |
|
83 private slots: |
|
84 |
|
85 /** |
|
86 * Handles opening of media. |
|
87 */ |
|
88 void handleOpen(); |
|
89 |
|
90 /** |
|
91 * Handles saving of media. |
|
92 */ |
|
93 void handleSave(); |
|
94 |
|
95 /** |
|
96 * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture |
|
97 * events back to back. |
|
98 */ |
|
99 void regrabGesture(); |
|
100 |
|
101 /** |
|
102 * Slot hit when the thumbnail is ready. |
|
103 */ |
|
104 void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error); |
|
105 |
|
106 private: |
|
107 |
|
108 /** |
|
109 * Initialization function. |
|
110 */ |
|
111 void init(); |
|
112 |
|
113 /** |
|
114 * Handles short tap event. |
|
115 */ |
|
116 void handleShortTap(); |
|
117 |
|
118 /** |
|
119 * Handles long tap event. |
|
120 * @param position Scene coordinates of tap. |
|
121 */ |
|
122 void handleLongTap(const QPointF &position); |
|
123 |
|
124 /** |
|
125 * Calculates the thumbnail size. |
|
126 * @return Thumbnail size |
|
127 */ |
|
128 QSize getThumbnailSize(); |
|
129 |
|
130 private: |
|
131 |
|
132 /** |
|
133 * UniMessageInfo object. |
|
134 * Own. |
|
135 */ |
|
136 UniMessageInfo *mInfo; |
|
137 |
|
138 /** |
|
139 * UniViewerUtils object. |
|
140 * Own |
|
141 */ |
|
142 UniViewerUtils *mViewerUtils; |
|
143 |
|
144 /** |
|
145 * ThumbnailManager |
|
146 * Own. |
|
147 */ |
|
148 ThumbnailManager *mThumbnailManager; |
|
149 |
|
150 /** |
|
151 * Mime Type of pixmap. |
|
152 */ |
|
153 QString mMimeType; |
|
154 |
|
155 /** |
|
156 * Pixmap file path being set. |
|
157 */ |
|
158 QString mPixmapPath; |
|
159 }; |
|
160 |
|
161 #endif /* UNI_VIEWER_PIXMAP_WIDGET_H */ |
|
162 |
|
163 // EOF |