blob: 14081207eadb8a1996e171f496b1c83322850bf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#pragma once
#include "preferences/usersettings.h"
#include "control/controlobject.h"
class ControlPushButton;
class ControlProxy;
class PotmeterControls : public QObject {
Q_OBJECT
public:
PotmeterControls(const ConfigKey& key);
virtual ~PotmeterControls();
void setStepCount(int count) {
m_stepCount = count;
}
void setSmallStepCount(int count) {
m_smallStepCount = count;
}
public slots:
// Increases the value.
void incValue(double);
// Decreases the value.
void decValue(double);
// Increases the value by smaller step.
void incSmallValue(double);
// Decreases the value by smaller step.
void decSmallValue(double);
// Sets the value to 1.0.
void setToOne(double);
// Sets the value to -1.0.
void setToMinusOne(double);
// Sets the value to 0.0.
void setToZero(double);
// Sets the control to its default
void setToDefault(double);
// Toggles the value between 0.0 and 1.0.
void toggleValue(double);
// Toggles the value between -1.0 and 0.0.
void toggleMinusValue(double);
void setIsDefault(bool isDefault);
private:
ControlProxy* m_pControl;
ControlPushButton* m_pControlDefault;
int m_stepCount;
double m_smallStepCount;
};
class ControlPotmeter : public ControlObject {
Q_OBJECT
public:
ControlPotmeter(const ConfigKey& key,
double dMinValue = 0.0,
double dMaxValue = 1.0,
bool allowOutOfBounds = false,
bool bIgnoreNops = true,
bool bTrack = false,
bool bPersist = false,
double defaultValue = 0.0);
~ControlPotmeter() override = default;
// Sets the step count of the associated PushButtons.
void setStepCount(int count);
// Sets the small step count of the associated PushButtons.
void setSmallStepCount(int count);
// Sets the minimum and maximum allowed value. The control value is reset
// when calling this method
void setRange(double dMinValue, double dMaxValue, bool allowOutOfBounds);
private slots:
// Used to check if the current control value matches the default value.
void privateValueChanged(double dValue, QObject* pSender);
protected:
bool m_bAllowOutOfBounds;
PotmeterControls m_controls;
};
|