|
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: Widget for displaying attachment media objects. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef UNI_VIEWER_ATTACHMENT_WIDGET_H |
|
19 #define UNI_VIEWER_ATTACHMENT_WIDGET_H |
|
20 |
|
21 // SYSTEM INCLUDES |
|
22 #include <HbWidget> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class HbTextItem; |
|
26 class HbIconItem; |
|
27 class HbIcon; |
|
28 class HbFrameItem; |
|
29 class UniViewerUtils; |
|
30 |
|
31 /** |
|
32 * @class UniViewerAttachmentWidget |
|
33 * @brief Widget for displaying attachment media objects. |
|
34 */ |
|
35 class UniViewerAttachmentWidget: public HbWidget |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Constructor |
|
43 */ |
|
44 explicit UniViewerAttachmentWidget(QGraphicsItem *parent = 0); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 virtual ~UniViewerAttachmentWidget(); |
|
50 |
|
51 /** |
|
52 * Populates the widget contents. |
|
53 * @param mimeType Mime type of media. |
|
54 * @param filePath File path of media. |
|
55 */ |
|
56 void populate(const QString &mimeType, const QString &filePath); |
|
57 |
|
58 signals: |
|
59 |
|
60 /** |
|
61 * Signal emitted when widget is clicked. |
|
62 * @param mediaPath File path of the media. |
|
63 */ |
|
64 void shortTap(const QString &mediaPath); |
|
65 |
|
66 /** |
|
67 * Signal emitted when widget is long tapped. |
|
68 * @param position Scene coordinates of tap. |
|
69 */ |
|
70 void longTap(const QPointF &position); |
|
71 |
|
72 protected: |
|
73 |
|
74 /** |
|
75 * Event handler for gesture events. |
|
76 * Reimplemented from HbWidgetBase. |
|
77 * @see HbWidgetBase |
|
78 */ |
|
79 virtual void gestureEvent(QGestureEvent *event); |
|
80 |
|
81 private slots: |
|
82 |
|
83 /** |
|
84 * Handles opening of media. |
|
85 */ |
|
86 void handleOpen(); |
|
87 |
|
88 /** |
|
89 * Handles saving of media. |
|
90 */ |
|
91 void handleSave(); |
|
92 |
|
93 /** |
|
94 * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture |
|
95 * events back to back. |
|
96 */ |
|
97 void regrabGesture(); |
|
98 |
|
99 private: |
|
100 |
|
101 /** |
|
102 * Handles short tap event. |
|
103 */ |
|
104 void handleShortTap(); |
|
105 |
|
106 /** |
|
107 * Handles long tap event. |
|
108 * @param position Scene coordinates of tap. |
|
109 */ |
|
110 void handleLongTap(const QPointF &position); |
|
111 |
|
112 /** |
|
113 * Handles pressed state. |
|
114 */ |
|
115 void setPressed(bool pressed); |
|
116 |
|
117 private: |
|
118 |
|
119 /** |
|
120 * Media icon item. |
|
121 * Own |
|
122 */ |
|
123 HbIconItem *mMediaIcon; |
|
124 |
|
125 /** |
|
126 * Media name text item. |
|
127 * Own |
|
128 */ |
|
129 HbTextItem *mName; |
|
130 |
|
131 /** |
|
132 * Media information text item. |
|
133 * Own |
|
134 */ |
|
135 HbTextItem *mInfo; |
|
136 |
|
137 /** |
|
138 * Background item of widget. |
|
139 * Own |
|
140 */ |
|
141 HbFrameItem *mFrameItem; |
|
142 |
|
143 /** |
|
144 * UniViewerUtils object. |
|
145 * Own |
|
146 */ |
|
147 UniViewerUtils *mViewerUtils; |
|
148 |
|
149 /** |
|
150 * Media file path. |
|
151 */ |
|
152 QString mMediaPath; |
|
153 |
|
154 /** |
|
155 * Mime type of media. |
|
156 */ |
|
157 QString mMimeType; |
|
158 }; |
|
159 |
|
160 #endif // UNI_VIEWER_ATTACHMENT_WIDGET_H |
|
161 // EOF |