"Post Window" -> "Post window" prevents it being seen as two separate
[supercollider.git] / QtCollider / widgets / QcLevelIndicator.h
bloba99116a22f661e9605d42b5c70227d6483188e86
1 /************************************************************************
3 * Copyright 2010 Jakob Leben (jakob.leben@gmail.com)
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
22 #ifndef QC_LEVEL_INDICATOR_H
23 #define QC_LEVEL_INDICATOR_H
25 #include "../QcHelper.h"
26 #include "../style/style.hpp"
28 #include <QWidget>
29 #include <QTimer>
31 class QcLevelIndicator : public QWidget, QcHelper, QtCollider::Style::Client
33 Q_OBJECT
34 Q_PROPERTY( float value READ dummyFloat WRITE setValue );
35 Q_PROPERTY( float warning READ dummyFloat WRITE setWarning );
36 Q_PROPERTY( float critical READ dummyFloat WRITE setCritical );
37 Q_PROPERTY( float peak READ dummyFloat WRITE setPeak );
38 Q_PROPERTY( bool drawPeak READ dummyBool WRITE setDrawPeak );
39 Q_PROPERTY( int ticks READ dummyInt WRITE setTicks );
40 Q_PROPERTY( int majorTicks READ dummyInt WRITE setMajorTicks );
41 Q_PROPERTY( QColor grooveColor READ grooveColor WRITE setGrooveColor );
43 public:
44 QcLevelIndicator();
45 void setValue( float f ) { _value = f; update(); }
46 void setWarning( float f ) { _warning = f; update(); }
47 void setCritical( float f ) { _critical = f; update(); }
48 void setPeak( float f ) { _peak = f; update(); }
49 void setDrawPeak( bool b ) { _drawPeak = b; update(); }
50 void setTicks( int i ) { _ticks = qMax(i,0); update(); }
51 void setMajorTicks( int i ) { _majorTicks = qMax(i,0); update(); }
52 virtual QSize sizeHint() const { return QSize( 25, 150 ); }
53 private Q_SLOTS:
54 void clipTimeout();
55 private:
56 void paintEvent( QPaintEvent *e );
57 float _value;
58 float _warning;
59 float _critical;
60 float _peak;
61 bool _drawPeak;
62 int _ticks;
63 int _majorTicks;
64 bool _clipped;
65 QTimer *_clipTimer;
68 #endif