Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
audiomonitor.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef AUDIOMONITOR_H
22 #define AUDIOMONITOR_H
23 
24 #include <QWidget>
25 #include <QTimer>
26 
32 class AudioMonitor : public QWidget
33 {
34  Q_OBJECT
35 public:
42  explicit AudioMonitor(QWidget *parent = nullptr);
43 
55  void set_value(const QVector<double>& values);
56 
57 protected:
63  void paintEvent(QPaintEvent *);
64 
70  void resizeEvent(QResizeEvent *);
71 
72 signals:
73 
74 public slots:
75 
76 private:
80  QLinearGradient gradient;
81 
85  QVector<double> values;
86 
93  QTimer clear_timer;
94 
95 private slots:
99  void clear();
100 };
101 
102 #endif // AUDIOMONITOR_H
QLinearGradient gradient
Internal gradient object from red to yellow to green.
Definition: audiomonitor.h:80
void paintEvent(QPaintEvent *)
Internal paint event.
Definition: audiomonitor.cpp:70
AudioMonitor(QWidget *parent=nullptr)
AudioMonitor Constructor.
Definition: audiomonitor.cpp:41
void resizeEvent(QResizeEvent *)
Internal resize event handler.
Definition: audiomonitor.cpp:62
void set_value(const QVector< double > &values)
Set the current audio value.
Definition: audiomonitor.cpp:48
The AudioMonitor class.
Definition: audiomonitor.h:32
QVector< double > values
Internal value storage.
Definition: audiomonitor.h:85
void clear()
Slot to clear the audio monitor.
Definition: audiomonitor.cpp:55
QTimer clear_timer
Internal timer to clear the audio monitor after a certain amount of time.
Definition: audiomonitor.h:93