CuteLogger
Fast and simple logging solution for Qt based applications
scrubbar.h
1 /*
2  * Copyright (c) 2011 Meltytech, LLC
3  * Author: Dan Dennedy <dan@dennedy.org>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef SCRUBBAR_H
20 #define SCRUBBAR_H
21 
22 #include <QWidget>
23 
24 class ScrubBar : public QWidget
25 {
26  Q_OBJECT
27 
28  enum controls {
29  CONTROL_NONE,
30  CONTROL_HEAD,
31  CONTROL_IN,
32  CONTROL_OUT
33  };
34 
35 public:
36  explicit ScrubBar(QWidget *parent = 0);
37 
38  virtual void mousePressEvent(QMouseEvent * event);
39  virtual void mouseReleaseEvent(QMouseEvent * event);
40  virtual void mouseMoveEvent(QMouseEvent * event);
41  void setScale(int maximum);
42  void setFramerate(double fps);
43  int position() const;
44  void setInPoint(int in);
45  void setOutPoint(int out);
46  void setMarkers(const QList<int>&);
47  QList<int> markers() const {
48  return m_markers;
49  }
50 
51 signals:
52  void seeked(int);
53  void inChanged(int);
54  void outChanged(int);
55 
56 public slots:
57  bool onSeek(int value);
58 
59 protected:
60  virtual void paintEvent(QPaintEvent *e);
61  virtual void resizeEvent(QResizeEvent *);
62  virtual bool event(QEvent *event);
63 
64 private:
65  int m_cursorPosition;
66  int m_head;
67  double m_scale;
68  double m_fps;
69  int m_interval;
70  int m_max;
71  int m_in;
72  int m_out;
73  enum controls m_activeControl;
74  QPixmap m_pixmap;
75  int m_timecodeWidth;
76  int m_secondsPerTick;
77  QList<int> m_markers;
78 
79  void updatePixmap();
80 };
81 
82 #endif // SCRUBBAR_H