class library: PriorityQueue - implement removeValue, hide array
[supercollider.git] / QtCollider / widgets / QcLevelIndicator.h
blob0d413c1fe802f3d1cd74e67bdcc989a7cfea2d7a
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"
27 #include <QWidget>
28 #include <QTimer>
30 class QcLevelIndicator : public QWidget, public QcHelper
32 Q_OBJECT
33 Q_PROPERTY( float value READ dummyFloat WRITE setValue );
34 Q_PROPERTY( float warning READ dummyFloat WRITE setWarning );
35 Q_PROPERTY( float critical READ dummyFloat WRITE setCritical );
36 Q_PROPERTY( float peak READ dummyFloat WRITE setPeak );
37 Q_PROPERTY( bool drawPeak READ dummyBool WRITE setDrawPeak );
38 Q_PROPERTY( int ticks READ dummyInt WRITE setTicks );
39 Q_PROPERTY( int majorTicks READ dummyInt WRITE setMajorTicks );
41 public:
42 QcLevelIndicator();
43 void setValue( float f ) { _value = f; update(); }
44 void setWarning( float f ) { _warning = f; update(); }
45 void setCritical( float f ) { _critical = f; update(); }
46 void setPeak( float f ) { _peak = f; update(); }
47 void setDrawPeak( bool b ) { _drawPeak = b; update(); }
48 void setTicks( int i ) { _ticks = qMax(i,0); update(); }
49 void setMajorTicks( int i ) { _majorTicks = qMax(i,0); update(); }
50 virtual QSize sizeHint() const { return QSize( 25, 150 ); }
51 private Q_SLOTS:
52 void clipTimeout();
53 private:
54 void paintEvent( QPaintEvent *e );
55 float _value;
56 float _warning;
57 float _critical;
58 float _peak;
59 bool _drawPeak;
60 int _ticks;
61 int _majorTicks;
62 bool _clipped;
63 QTimer *_clipTimer;
66 #endif