Mercurial > hg > easaier-soundaccess
comparison widgets/Fader.h @ 0:fc9323a41f5a
start base : Sonic Visualiser sv1-1.0rc1
author | lbajardsilogic |
---|---|
date | Fri, 11 May 2007 09:08:14 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:fc9323a41f5a |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #ifndef FADER_H | |
16 #define FADER_H | |
17 | |
18 /** | |
19 * Horizontal audio fader and meter widget. | |
20 * Based on the vertical fader and meter widget from: | |
21 * | |
22 * Hydrogen | |
23 * Copyright(c) 2002-2005 by Alex >Comix< Cominu [comix@users.sourceforge.net] | |
24 * http://www.hydrogen-music.org | |
25 */ | |
26 | |
27 | |
28 #include <string> | |
29 #include <iostream> | |
30 | |
31 #include <QWidget> | |
32 #include <QPixmap> | |
33 #include <QMouseEvent> | |
34 #include <QWheelEvent> | |
35 #include <QPaintEvent> | |
36 | |
37 class Fader : public QWidget | |
38 { | |
39 Q_OBJECT | |
40 | |
41 public: | |
42 Fader(QWidget *parent, bool withoutKnob = false); | |
43 ~Fader(); | |
44 | |
45 void setValue(float newValue); | |
46 float getValue(); | |
47 | |
48 void setPeakLeft(float); | |
49 float getPeakLeft() { return m_peakLeft; } | |
50 | |
51 void setPeakRight(float); | |
52 float getPeakRight() { return m_peakRight; } | |
53 | |
54 signals: | |
55 void valueChanged(float); // 0.0 -> 1.0 | |
56 | |
57 void mouseEntered(); | |
58 void mouseLeft(); | |
59 | |
60 protected: | |
61 virtual void mousePressEvent(QMouseEvent *ev); | |
62 virtual void mouseDoubleClickEvent(QMouseEvent *ev); | |
63 virtual void mouseMoveEvent(QMouseEvent *ev); | |
64 virtual void mouseReleaseEvent(QMouseEvent *ev); | |
65 virtual void wheelEvent( QWheelEvent *ev ); | |
66 virtual void paintEvent(QPaintEvent *ev); | |
67 virtual void enterEvent(QEvent *); | |
68 virtual void leaveEvent(QEvent *); | |
69 | |
70 int getMaxX() const; | |
71 | |
72 bool m_withoutKnob; | |
73 float m_value; | |
74 float m_peakLeft; | |
75 float m_peakRight; | |
76 | |
77 bool m_mousePressed; | |
78 int m_mousePressX; | |
79 float m_mousePressValue; | |
80 | |
81 QPixmap m_back; | |
82 QPixmap m_leds; | |
83 QPixmap m_knob; | |
84 QPixmap m_clip; | |
85 }; | |
86 | |
87 #endif |