Changeset View
Changeset View
Standalone View
Standalone View
ui/pageviewutils.h
Show All 11 Lines | |||||
12 | 12 | | |||
13 | #ifndef _PAGEVIEW_UTILS_H_ | 13 | #ifndef _PAGEVIEW_UTILS_H_ | ||
14 | #define _PAGEVIEW_UTILS_H_ | 14 | #define _PAGEVIEW_UTILS_H_ | ||
15 | 15 | | |||
16 | #include <qwidget.h> | 16 | #include <qwidget.h> | ||
17 | #include <qpixmap.h> | 17 | #include <qpixmap.h> | ||
18 | #include <qrect.h> | 18 | #include <qrect.h> | ||
19 | #include <qhash.h> | 19 | #include <qhash.h> | ||
20 | #include <qtoolbutton.h> | | |||
21 | | ||||
22 | 20 | | |||
23 | #include "core/area.h" | 21 | #include "core/area.h" | ||
24 | 22 | | |||
25 | class QTimer; | 23 | class QTimer; | ||
26 | class FormWidgetIface; | 24 | class FormWidgetIface; | ||
27 | class PageView; | 25 | class PageView; | ||
28 | class VideoWidget; | 26 | class VideoWidget; | ||
29 | 27 | | |||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 119 | private: | |||
123 | void computeSizeAndResize(); | 121 | void computeSizeAndResize(); | ||
124 | QString m_message; | 122 | QString m_message; | ||
125 | QString m_details; | 123 | QString m_details; | ||
126 | QPixmap m_symbol; | 124 | QPixmap m_symbol; | ||
127 | QTimer * m_timer; | 125 | QTimer * m_timer; | ||
128 | int m_lineSpacing; | 126 | int m_lineSpacing; | ||
129 | }; | 127 | }; | ||
130 | 128 | | |||
131 | struct AnnotationToolItem | | |||
132 | { | | |||
133 | AnnotationToolItem() | | |||
134 | : id( -1 ), isText( false ) | | |||
135 | { | | |||
136 | } | | |||
137 | | ||||
138 | int id; | | |||
139 | QString text; | | |||
140 | QPixmap pixmap; | | |||
141 | QString shortcut; | | |||
142 | bool isText; | | |||
143 | }; | | |||
144 | | ||||
145 | class ToolBarButton : public QToolButton | | |||
146 | { | | |||
147 | Q_OBJECT | | |||
148 | public: | | |||
149 | static const int iconSize = 32; | | |||
150 | static const int buttonSize = 40; | | |||
151 | | ||||
152 | ToolBarButton( QWidget * parent, const AnnotationToolItem &item ); | | |||
153 | int buttonID() const { return m_id; } | | |||
154 | bool isText() const { return m_isText; } | | |||
155 | | ||||
156 | Q_SIGNALS: | | |||
157 | void buttonDoubleClicked( int buttonID ); | | |||
158 | | ||||
159 | protected: | | |||
160 | void mouseDoubleClickEvent( QMouseEvent * event ) override; | | |||
161 | | ||||
162 | private: | | |||
163 | int m_id; | | |||
164 | bool m_isText; | | |||
165 | }; | | |||
166 | | ||||
167 | /** | | |||
168 | * @short A widget containing exclusive buttons, that slides in from a side. | | |||
169 | * | | |||
170 | * This is a shaped widget that slides in from a side of the 'anchor widget' | | |||
171 | * it's attached to. It can be dragged and docked on {left,top,right,bottom} | | |||
172 | * sides and contains toggable exclusive buttons. | | |||
173 | * When a 'tool' of this 'toolBar' is selected, a signal is emitted. | | |||
174 | */ | | |||
175 | class PageViewToolBar : public QWidget | | |||
176 | { | | |||
177 | Q_OBJECT | | |||
178 | public: | | |||
179 | PageViewToolBar( PageView * parent, QWidget * anchorWidget ); | | |||
180 | ~PageViewToolBar(); | | |||
181 | | ||||
182 | // animated widget controls | | |||
183 | enum Side { Left = 0, Top = 1, Right = 2, Bottom = 3 }; | | |||
184 | | ||||
185 | void setItems( const QLinkedList<AnnotationToolItem> &items ); | | |||
186 | void setSide( Side side ); | | |||
187 | | ||||
188 | void showAndAnimate(); | | |||
189 | void hideAndDestroy(); | | |||
190 | | ||||
191 | void selectButton( int id ); | | |||
192 | | ||||
193 | void setToolsEnabled( bool on ); | | |||
194 | void setTextToolsEnabled( bool on ); | | |||
195 | | ||||
196 | // query properties | | |||
197 | | ||||
198 | Q_SIGNALS: | | |||
199 | // the tool 'toolID' has been selected | | |||
200 | void toolSelected( int toolID ); | | |||
201 | // orientation has been changed | | |||
202 | void orientationChanged( int side ); | | |||
203 | // a tool button of this toolbar has been double clicked | | |||
204 | void buttonDoubleClicked( int buttonID ); | | |||
205 | | ||||
206 | protected: | | |||
207 | // handle widget events { anchor_resize, paint, animation, drag } | | |||
208 | bool eventFilter( QObject * o, QEvent * e ) override; | | |||
209 | void paintEvent( QPaintEvent * ) override; | | |||
210 | void mousePressEvent( QMouseEvent * e ) override; | | |||
211 | void mouseMoveEvent( QMouseEvent * e ) override; | | |||
212 | void mouseReleaseEvent( QMouseEvent * e ) override; | | |||
213 | | ||||
214 | private: | | |||
215 | // private variables | | |||
216 | friend class ToolBarPrivate; | | |||
217 | class ToolBarPrivate * d; | | |||
218 | | ||||
219 | private Q_SLOTS: | | |||
220 | void slotAnimate(); | | |||
221 | void slotButtonClicked(); | | |||
222 | }; | | |||
223 | | ||||
224 | #endif | 129 | #endif |