Frapper  1.0a
TimelineWidget.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
33 
34 #ifndef TIMELINEWIDGET_H
35 #define TIMELINEWIDGET_H
36 
37 #include "GrabberWidget.h"
38 #include <QtGui/QWidget>
39 #include <QtGui/QMouseEvent>
40 #include <QtGui/QScrollArea>
41 #include <QtGui/QLineEdit>
42 #include <QtGui/QIntValidator>
43 
44 
45 namespace Frapper {
46 
50 class FRAPPER_GUI_EXPORT TimelineWidget : public QWidget
51 {
52 
53  Q_OBJECT
54 
55 public: // static data
56 
60  static const QSize DefaultFrameSize;
61 
62 public: // constructors and destructors
63 
70  TimelineWidget ( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
71 
79  virtual ~TimelineWidget ();
80 
81 public: // functions
82 
88  void setCurrentFrame ( int index );
89 
95  void setStartFrame ( int index );
96 
102  void setEndFrame ( int index );
103 
109  void setInFrame ( int index );
110 
116  void setOutFrame ( int index );
117 
125  int calculateFrameWidth ( bool inToOut = false );
126 
127 public slots: //
128 
135  void setAutoScroll ( bool autoScroll );
136 
142  void setFrameWidth ( int frameWidth );
143 
144 signals: //
145 
152  void currentFrameSet ( int index );
153 
160  void startFrameSet ( int index );
161 
168  void endFrameSet ( int index );
169 
176  void inFrameSet ( int index );
177 
184  void outFrameSet ( int index );
185 
186 protected: // event handlers
187 
193  virtual void paintEvent ( QPaintEvent *event );
194 
200  virtual void keyPressEvent ( QKeyEvent *event );
201 
207  virtual void mouseDoubleClickEvent ( QMouseEvent *event );
208 
214  virtual void mouseMoveEvent ( QMouseEvent *event );
215 
221  virtual void mousePressEvent ( QMouseEvent *event );
222 
228  virtual void mouseReleaseEvent ( QMouseEvent *event );
229 
230 private: // functions
231 
236  void updateWidth ();
237 
243  void paintImage ( const QRect &rectangle );
244 
252  GrabberWidget * grabberAt ( const QPoint &position, bool rangeGrabbersOnly = true );
253 
259  void editCurrentFrame ( bool startEditing = true );
260 
261 private slots: //
262 
269  void on_m_currentFrameEdit_returnPressed ();
270 
271 private: // data
272 
276  QImage m_image;
277 
281  QScrollArea *m_parentScrollArea;
282 
287 
292 
297 
302 
307 
312 
316  QLineEdit *m_currentFrameEdit;
317 
321  QIntValidator *m_currentFrameValidator;
322 
328 
333 
338 
343 
344 };
345 
346 } // end namespace Frapper
347 
348 #endif