Skip to content

Commit

Permalink
TEST add ControlPotmeter::stepUpDown() as shortcut for _selector cont…
Browse files Browse the repository at this point in the history
…rols
  • Loading branch information
ronso0 committed Jan 30, 2025
1 parent 0c69270 commit 33da9cd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/control/controlpotmeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ void ControlPotmeter::setRange(double dMinValue, double dMaxValue,
}
}

void ControlPotmeter::stepUpDown(double value) {
if (value > 0) {
m_controls.incValue(1.0);
} else if (value < 0) {
m_controls.decValue(1.0);
}
}

// slot
void ControlPotmeter::privateValueChanged(double dValue, QObject* pSender) {
Q_UNUSED(pSender);
Expand Down
2 changes: 2 additions & 0 deletions src/control/controlpotmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class ControlPotmeter : public ControlObject {
m_controls.addAlias(key);
};

void stepUpDown(double value);

private slots:
// Used to check if the current control value matches the default value.
void privateValueChanged(double dValue, QObject* pSender);
Expand Down
4 changes: 1 addition & 3 deletions src/mixer/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,8 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(
this,
[this](double value) {
int steps = static_cast<int>(fabs(std::round(value)));
const QString dir = std::round(value) > 0 ? "up" : "down";
while (steps > 0) {
ControlObject::set(ConfigKey(getGroup(), "waveform_zoom_" + dir), 1);
ControlObject::set(ConfigKey(getGroup(), "waveform_zoom_" + dir), 0);
m_pWaveformZoom->stepUpDown(value);
steps--;
}
});
Expand Down

0 comments on commit 33da9cd

Please sign in to comment.