annotate widgets/LEDButton.h @ 33:651e4e868bcc
* Implement play mute, level and pan controls and a layer visibility control
* Handle swapping the buffers in AudioCallbackPlaySource more gracefully, so
that in many cases it can be done inaudibly. Still gets it wrong when
playing in a noncontiguous selection.
* Fix to SV file save for non-2d sparse models
* Fixes to LED button drawing and AudioDial mouse functionality
* Add progress bar for Ogg file import
* Reshuffle PropertyContainer and its subclasses so it can be a QObject
* Add layer dormancy (invisible layer permitted to free its cache space)
* Optimisations to SpectrogramLayer, removing locks when reading/writing
individual pixels in the cache (should be unnecessary there) -- there's
still an issue here as we need a lock when reading from the model in
case the model is replaced, and we don't currently have one
* Several munlock() calls to make it harder to exhaust real memory if
running in an RT mode with mlockall() active
author |
Chris Cannam |
date |
Fri, 17 Feb 2006 18:04:26 +0000 |
parents |
c53b949ef142 |
children |
c43f2c4f66f2 |
rev |
line source |
Chris@32
|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@32
|
2
|
Chris@32
|
3 /*
|
Chris@32
|
4 A waveform viewer and audio annotation editor.
|
Chris@32
|
5 Chris Cannam, Queen Mary University of London, 2005-2006
|
Chris@32
|
6
|
Chris@32
|
7 This is experimental software. Not for distribution.
|
Chris@32
|
8 */
|
Chris@32
|
9
|
Chris@32
|
10 /*
|
Chris@32
|
11 This is a modified version of a source file from the KDE
|
Chris@32
|
12 libraries. Copyright (c) 1998-2004 Jörg Habenicht, Richard J
|
Chris@32
|
13 Moore and others, distributed under the GNU Lesser General Public
|
Chris@32
|
14 License.
|
Chris@32
|
15
|
Chris@32
|
16 Ported to Qt4 by Chris Cannam.
|
Chris@32
|
17
|
Chris@32
|
18 The original KDE widget comes in round and rectangular and flat,
|
Chris@32
|
19 raised, and sunken variants. This version retains only the round
|
Chris@33
|
20 sunken variant. This version also implements a simple button API.
|
Chris@32
|
21 */
|
Chris@32
|
22
|
Chris@32
|
23 #ifndef _LED_BUTTON_H_
|
Chris@32
|
24 #define _LED_BUTTON_H_
|
Chris@32
|
25
|
Chris@32
|
26 #include <QWidget>
|
Chris@32
|
27
|
Chris@32
|
28 class QColor;
|
Chris@32
|
29
|
Chris@32
|
30 class LEDButton : public QWidget
|
Chris@32
|
31 {
|
Chris@32
|
32 Q_OBJECT
|
Chris@32
|
33 Q_ENUMS(State)
|
Chris@32
|
34 Q_PROPERTY(State state READ state WRITE setState)
|
Chris@32
|
35 Q_PROPERTY(QColor color READ color WRITE setColor)
|
Chris@32
|
36 Q_PROPERTY(int darkFactor READ darkFactor WRITE setDarkFactor)
|
Chris@32
|
37
|
Chris@32
|
38 public:
|
Chris@32
|
39 enum State { Off, On };
|
Chris@32
|
40
|
Chris@32
|
41 LEDButton(QWidget *parent = 0);
|
Chris@32
|
42 LEDButton(const QColor &col, QWidget *parent = 0);
|
Chris@32
|
43 LEDButton(const QColor& col, LEDButton::State state, QWidget *parent = 0);
|
Chris@32
|
44 ~LEDButton();
|
Chris@32
|
45
|
Chris@32
|
46 State state() const;
|
Chris@32
|
47 QColor color() const;
|
Chris@32
|
48 int darkFactor() const;
|
Chris@32
|
49
|
Chris@32
|
50 void setState(State state);
|
Chris@32
|
51 void toggleState();
|
Chris@32
|
52 void setColor(const QColor& color);
|
Chris@32
|
53 void setDarkFactor(int darkfactor);
|
Chris@32
|
54
|
Chris@32
|
55 virtual QSize sizeHint() const;
|
Chris@32
|
56 virtual QSize minimumSizeHint() const;
|
Chris@32
|
57
|
Chris@33
|
58 signals:
|
Chris@33
|
59 void stateChanged(bool);
|
Chris@33
|
60
|
Chris@32
|
61 public slots:
|
Chris@32
|
62 void toggle();
|
Chris@32
|
63 void on();
|
Chris@32
|
64 void off();
|
Chris@32
|
65
|
Chris@32
|
66 protected:
|
Chris@32
|
67 void paintEvent(QPaintEvent *);
|
Chris@33
|
68 void mousePressEvent(QMouseEvent *);
|
Chris@32
|
69
|
Chris@32
|
70 private:
|
Chris@32
|
71 State led_state;
|
Chris@32
|
72 QColor led_color;
|
Chris@32
|
73
|
Chris@32
|
74 private:
|
Chris@32
|
75 class LEDButtonPrivate;
|
Chris@32
|
76 LEDButtonPrivate *d;
|
Chris@32
|
77 };
|
Chris@32
|
78
|
Chris@32
|
79 #endif
|