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