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