LevelPanToolButton.h
Go to the documentation of this file.
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 LEVEL_PAN_TOOLBUTTON_H
16 #define LEVEL_PAN_TOOLBUTTON_H
17 
18 #include <QToolButton>
19 
20 class LevelPanWidget;
21 class QMenu;
22 
23 class LevelPanToolButton : public QToolButton
24 {
25  Q_OBJECT
26 
27 public:
28  LevelPanToolButton(QWidget *parent = 0);
30 
32  float getLevel() const;
33 
35  float getPan() const;
36 
38  bool includesMute() const;
39 
40  void setImageSize(int pixels);
41 
43  void setProvideContextMenu(bool);
44 
45  void setBigImageSize(int pixels);
46 
47 public slots:
49  void setLevel(float);
50 
52  void setPan(float);
53 
55  void setMonitoringLevels(float, float);
56 
58  void setIncludeMute(bool);
59 
60  void setEnabled(bool enabled);
61 
62 protected slots:
63  void contextMenuRequested(const QPoint &);
64 
65 signals:
66  void levelChanged(float);
67  void panChanged(float);
68 
69  void mouseEntered();
70  void mouseLeft();
71 
72 private slots:
73  void selfLevelChanged(float);
74  void selfClicked();
75 
76 protected:
77  void paintEvent(QPaintEvent *) override;
78  void enterEvent(QEvent *) override;
79  void leaveEvent(QEvent *) override;
80  void mousePressEvent(QMouseEvent *) override;
81  void wheelEvent(QWheelEvent *e) override;
82 
84  int m_pixels;
86  bool m_muted;
87  float m_savedLevel;
90 };
91 
92 #endif
void setLevel(float)
Set level in the range [0,1] – will be rounded.
float getLevel() const
Return level as a gain value in the range [0,1].
void setEnabled(bool enabled)
void wheelEvent(QWheelEvent *e) override
LevelPanToolButton(QWidget *parent=0)
bool includesMute() const
Discover whether the level range includes muting or not.
float getPan() const
Return pan as a value in the range [-1,1].
void setPan(float)
Set pan in the range [-1,1] – will be rounded.
void setMonitoringLevels(float, float)
Set left and right peak monitoring levels in the range [0,1].
void paintEvent(QPaintEvent *) override
void panChanged(float)
void setIncludeMute(bool)
Specify whether the level range should include muting or not.
LevelPanWidget * m_lpw
void contextMenuRequested(const QPoint &)
void enterEvent(QEvent *) override
void setBigImageSize(int pixels)
void setImageSize(int pixels)
A simple widget for coarse level and pan control.
void leaveEvent(QEvent *) override
void levelChanged(float)
void mousePressEvent(QMouseEvent *) override
void setProvideContextMenu(bool)
Specify whether a right-click context menu is provided.