CuteLogger
Fast and simple logging solution for Qt based applications
scrubbar.h
1/*
2 * Copyright (c) 2011-2023 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
24class 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
35public:
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 {
49 return m_markers;
50 }
51 void setMargin(int margin)
52 {
53 m_margin = margin;
54 }
55 void setLoopRange(int start, int end);
56
57signals:
58 void seeked(int);
59 void inChanged(int);
60 void outChanged(int);
61
62public slots:
63 bool onSeek(int value);
64
65protected:
66 virtual void paintEvent(QPaintEvent *e);
67 virtual void resizeEvent(QResizeEvent *);
68 virtual bool event(QEvent *event);
69
70private:
71 int m_cursorPosition;
72 int m_head;
73 double m_scale;
74 double m_fps;
75 int m_interval;
76 int m_max;
77 int m_in;
78 int m_out;
79 int m_margin;
80 enum controls m_activeControl;
81 QPixmap m_pixmap;
82 int m_timecodeWidth;
83 int m_secondsPerTick;
84 QList<int> m_markers;
85 int m_loopStart;
86 int m_loopEnd;
87
88 void updatePixmap();
89};
90
91#endif // SCRUBBAR_H