diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/waveform/renderers/waveformsignalcolors.cpp | 8 | ||||
-rw-r--r-- | src/waveform/renderers/waveformsignalcolors.h | 2 | ||||
-rw-r--r-- | src/widget/woverview.cpp | 40 | ||||
-rw-r--r-- | src/widget/woverview.h | 3 |
4 files changed, 42 insertions, 11 deletions
diff --git a/src/waveform/renderers/waveformsignalcolors.cpp b/src/waveform/renderers/waveformsignalcolors.cpp index ea800a7ee9..41bbf22b6a 100644 --- a/src/waveform/renderers/waveformsignalcolors.cpp +++ b/src/waveform/renderers/waveformsignalcolors.cpp @@ -62,6 +62,14 @@ bool WaveformSignalColors::setup(const QDomNode &node, const SkinContext& contex m_playedOverlayColor = Qt::transparent; } + // This color is used to draw an overlay over the entire overview-waveforms + // if vinyl passthrough is enabled + m_passthroughOverlayColor = context.selectColor(node, "PassthroughOverlayColor"); + m_passthroughOverlayColor = WSkinColor::getCorrectColor(m_passthroughOverlayColor).toRgb(); + if (!m_passthroughOverlayColor.isValid()) { + m_passthroughOverlayColor = WSkinColor::getCorrectColor(QColor(187, 0, 0, 0)).toRgb(); + } + m_bgColor = context.selectColor(node, "BgColor"); if (!m_bgColor.isValid()) { m_bgColor = Qt::transparent; diff --git a/src/waveform/renderers/waveformsignalcolors.h b/src/waveform/renderers/waveformsignalcolors.h index 825323c195..0e789ed1c3 100644 --- a/src/waveform/renderers/waveformsignalcolors.h +++ b/src/waveform/renderers/waveformsignalcolors.h @@ -23,6 +23,7 @@ class WaveformSignalColors { inline const QColor& getAxesColor() const { return m_axesColor; } inline const QColor& getPlayPosColor() const { return m_playPosColor; } inline const QColor& getPlayedOverlayColor() const { return m_playedOverlayColor; } + inline const QColor& getPassthroughOverlayColor() const { return m_passthroughOverlayColor; } inline const QColor& getBgColor() const { return m_bgColor; } protected: @@ -42,6 +43,7 @@ class WaveformSignalColors { QColor m_axesColor; QColor m_playPosColor; QColor m_playedOverlayColor; + QColor m_passthroughOverlayColor; QColor m_bgColor; }; diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index 1d86575c29..2e51b42f2a 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -17,7 +17,6 @@ #include <QMouseEvent> #include <QPaintEvent> #include <QPainter> -#include <QPixmap> #include <QUrl> #include <QtDebug> @@ -94,6 +93,18 @@ WOverview::WOverview( this, &WOverview::onTrackAnalyzerProgress); connect(m_pCueMenuPopup.get(), &WCueMenuPopup::aboutToHide, this, &WOverview::slotCueMenuPopupAboutToHide); + + m_pPassthroughLabel = new QLabel(this); + m_pPassthroughLabel->setObjectName("PassthroughLabel"); + m_pPassthroughLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + // Shown on the overview waveform when vinyl passthrough is enabled + m_pPassthroughLabel->setText(tr("Passthrough")); + m_pPassthroughLabel->hide(); + QVBoxLayout *pPassthroughLayout = new QVBoxLayout(this); + pPassthroughLayout->setContentsMargins(0,0,0,0); + pPassthroughLayout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + pPassthroughLayout->addWidget(m_pPassthroughLabel); + setLayout(pPassthroughLayout); } void WOverview::setup(const QDomNode& node, const SkinContext& context) { @@ -135,6 +146,8 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { m_endOfTrackColor = WSkinColor::getCorrectColor(m_endOfTrackColor); } + m_passthroughOverlayColor = m_signalColors.getPlayedOverlayColor(); + // setup hotcues and cue and loop(s) m_marks.setup(m_group, node, context, m_signalColors); @@ -243,11 +256,6 @@ void WOverview::onConnectedControlChanged(double dParameter, double dValue) { void WOverview::slotWaveformSummaryUpdated() { //qDebug() << "WOverview::slotWaveformSummaryUpdated()"; - // Do not draw the waveform when passthrough is enabled - if (m_bPassthroughEnabled) { - return; - } - TrackPointer pTrack(m_pCurrentTrack); if (!pTrack) { return; @@ -563,11 +571,6 @@ 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. @@ -589,7 +592,15 @@ void WOverview::paintEvent(QPaintEvent* pEvent) { drawMarkLabels(&painter, offset, gain); } } + + if (m_bPassthroughEnabled) { + drawPassthroughOverlay(&painter); + m_pPassthroughLabel->show(); + } else { + m_pPassthroughLabel->hide(); + } } + void WOverview::drawEndOfTrackBackground(QPainter* pPainter) { if (m_endOfTrack) { PainterScope painterScope(pPainter); @@ -1077,6 +1088,13 @@ void WOverview::drawMarkLabels(QPainter* pPainter, const float offset, const flo } } +void WOverview::drawPassthroughOverlay(QPainter* pPainter) { + if (!m_waveformSourceImage.isNull() && m_passthroughOverlayColor.alpha() > 0) { + // Overlay the entire overview-waveform with a skin defined color + pPainter->fillRect(rect(), m_passthroughOverlayColor); + } +} + void WOverview::paintText(const QString& text, QPainter* pPainter) { PainterScope painterScope(pPainter); QColor lowColor = m_signalColors.getLowColor(); diff --git a/src/widget/woverview.h b/src/widget/woverview.h index 85abc2cb81..b3b695cf58 100644 --- a/src/widget/woverview.h +++ b/src/widget/woverview.h @@ -117,6 +117,7 @@ class WOverview : public WWidget, public TrackDropTarget { void drawPickupPosition(QPainter* pPainter); void drawTimeRuler(QPainter* pPainter); void drawMarkLabels(QPainter* pPainter, const float offset, const float gain); + void drawPassthroughOverlay(QPainter* pPainter); void paintText(const QString& text, QPainter* pPainter); double samplePositionToSeconds(double sample); inline int valueToPosition(double value) const { @@ -170,6 +171,8 @@ class WOverview : public WWidget, public TrackDropTarget { QColor m_labelTextColor; QColor m_labelBackgroundColor; QColor m_endOfTrackColor; + QColor m_passthroughOverlayColor; + QLabel* m_pPassthroughLabel; // All WaveformMarks WaveformMarkSet m_marks; |