Skip to content

Commit

Permalink
widget/woverview: Show "passthrough" on Waveform Overviews if enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Mar 20, 2020
1 parent 7f6fd5a commit 4634ac6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/widget/woverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ WOverview::WOverview(
m_group(group),
m_pConfig(pConfig),
m_endOfTrack(false),
m_bPassthroughEnabled(false),
m_pCueMenuPopup(std::make_unique<WCueMenuPopup>(pConfig, this)),
m_bShowCueTimes(true),
m_iPosSeconds(0),
Expand All @@ -80,6 +81,9 @@ WOverview::WOverview(
m_trackSamplesControl =
new ControlProxy(m_group, "track_samples", this);
m_playpositionControl = new ControlProxy(m_group, "playposition", this);
m_pPassthroughControl =
new ControlProxy(m_group, "passthrough", this);
m_pPassthroughControl->connectValueChanged(this, &WOverview::onPassthroughChange);
setAcceptDrops(true);

setMouseTracking(true);
Expand Down Expand Up @@ -342,6 +346,31 @@ void WOverview::onRateRatioChange(double v) {
update();
}

void WOverview::onPassthroughChange(double v) {
m_bPassthroughEnabled = static_cast<bool>(v);

if (m_bPassthroughEnabled) {
if (m_pCurrentTrack != nullptr) {
disconnect(
m_pCurrentTrack.get(),
&Track::waveformSummaryUpdated,
this,
&WOverview::slotWaveformSummaryUpdated);
}
setEnabled(false);
update();
} else {
if (m_pCurrentTrack != nullptr) {
connect(m_pCurrentTrack.get(),
&Track::waveformSummaryUpdated,
this,
&WOverview::slotWaveformSummaryUpdated);
}
setEnabled(true);
slotWaveformSummaryUpdated();
}
}

void WOverview::updateCues(const QList<CuePointer> &loadedCues) {
m_marksToRender.clear();
for (CuePointer currentCue: loadedCues) {
Expand Down Expand Up @@ -540,6 +569,11 @@ void WOverview::paintEvent(QPaintEvent* pEvent) {
painter.drawPixmap(rect(), m_backgroundPixmap);
}

if (m_bPassthroughEnabled) {
paintText(tr("Passthrough"), &painter);
return;
}

if (m_pCurrentTrack) {
// Refer to util/ScopePainter.h to understand the semantics of
// ScopePainter.
Expand Down
3 changes: 3 additions & 0 deletions src/widget/woverview.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class WOverview : public WWidget, public TrackDropTarget {
void onMarkChanged(double v);
void onMarkRangeChange(double v);
void onRateRatioChange(double v);
void onPassthroughChange(double v);
void receiveCuesUpdated();

void slotWaveformSummaryUpdated();
Expand Down Expand Up @@ -132,10 +133,12 @@ class WOverview : public WWidget, public TrackDropTarget {
UserSettingsPointer m_pConfig;
ControlProxy* m_endOfTrackControl;
bool m_endOfTrack;
bool m_bPassthroughEnabled;
ControlProxy* m_pRateRatioControl;
ControlProxy* m_trackSampleRateControl;
ControlProxy* m_trackSamplesControl;
ControlProxy* m_playpositionControl;
ControlProxy* m_pPassthroughControl;

// Current active track
TrackPointer m_pCurrentTrack;
Expand Down

0 comments on commit 4634ac6

Please sign in to comment.