diff options
-rw-r--r-- | src/widget/woverview.cpp | 96 | ||||
-rw-r--r-- | src/widget/woverview.h | 6 |
2 files changed, 75 insertions, 27 deletions
diff --git a/src/widget/woverview.cpp b/src/widget/woverview.cpp index d9aac6b0a5..5454c91ada 100644 --- a/src/widget/woverview.cpp +++ b/src/widget/woverview.cpp @@ -113,11 +113,16 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) { m_scaleFactor = context.getScaleFactor(); m_signalColors.setup(node, context); - m_qColorBackground = m_signalColors.getBgColor(); + m_backgroundColor = m_signalColors.getBgColor(); + m_axesColor = m_signalColors.getAxesColor(); + m_playPosColor = m_signalColors.getPlayPosColor(); + m_passthroughOverlayColor = m_signalColors.getPassthroughOverlayColor(); + m_playedOverlayColor = m_signalColors.getPlayedOverlayColor(); + m_lowColor = m_signalColors.getLowColor(); m_labelBackgroundColor = context.selectColor(node, "LabelBackgroundColor"); if (!m_labelBackgroundColor.isValid()) { - m_labelBackgroundColor = m_qColorBackground; + m_labelBackgroundColor = m_backgroundColor; m_labelBackgroundColor.setAlpha(255 / 2); // 0 == fully transparent } @@ -148,8 +153,6 @@ 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); @@ -558,7 +561,7 @@ void WOverview::paintEvent(QPaintEvent* pEvent) { ScopedTimer t("WOverview::paintEvent"); QPainter painter(this); - painter.fillRect(rect(), m_qColorBackground); + painter.fillRect(rect(), m_backgroundColor); if (!m_backgroundPixmap.isNull()) { painter.drawPixmap(rect(), m_backgroundPixmap); @@ -605,7 +608,7 @@ void WOverview::drawEndOfTrackBackground(QPainter* pPainter) { void WOverview::drawAxis(QPainter* pPainter) { PainterScope painterScope(pPainter); - pPainter->setPen(QPen(m_signalColors.getAxesColor(), 1 * m_scaleFactor)); + pPainter->setPen(QPen(m_axesColor, m_scaleFactor)); if (m_orientation == Qt::Horizontal) { pPainter->drawLine(0, height() / 2, width(), height() / 2); } else { @@ -642,12 +645,11 @@ void WOverview::drawWaveformPixmap(QPainter* pPainter) { pPainter->drawImage(rect(), m_waveformImageScaled); // Overlay the played part of the overview-waveform with a skin defined color - QColor playedOverlayColor = m_signalColors.getPlayedOverlayColor(); - if (playedOverlayColor.alpha() > 0) { + if (m_playedOverlayColor.alpha() > 0) { if (m_orientation == Qt::Vertical) { - pPainter->fillRect(0, 0, m_waveformImageScaled.width(), m_iPlayPos, playedOverlayColor); + pPainter->fillRect(0, 0, m_waveformImageScaled.width(), m_iPlayPos, m_playedOverlayColor); } else { - pPainter->fillRect(0, 0, m_iPlayPos, m_waveformImageScaled.height(), playedOverlayColor); + pPainter->fillRect(0, 0, m_iPlayPos, m_waveformImageScaled.height(), m_playedOverlayColor); } } } @@ -659,7 +661,7 @@ void WOverview::drawWaveformPixmap(QPainter* pPainter) { } else { line.setLine(0.0, m_iPlayPos, width(), m_iPlayPos); } - pPainter->setPen(QPen(m_signalColors.getPlayPosColor(), 1 * m_scaleFactor)); + pPainter->setPen(QPen(m_playPosColor, m_scaleFactor)); pPainter->setOpacity(0.5); pPainter->drawLine(line); } @@ -679,7 +681,7 @@ void WOverview::drawAnalyzerProgress(QPainter* pPainter) { if ((m_analyzerProgress >= kAnalyzerProgressNone) && (m_analyzerProgress < kAnalyzerProgressDone)) { PainterScope painterScope(pPainter); - pPainter->setPen(QPen(m_signalColors.getAxesColor(), 3 * m_scaleFactor)); + pPainter->setPen(QPen(m_playPosColor, 3 * m_scaleFactor)); if (m_analyzerProgress > kAnalyzerProgressNone) { if (m_orientation == Qt::Horizontal) { @@ -870,7 +872,14 @@ void WOverview::drawMarks(QPainter* pPainter, const float offset, const float ga } } - pMark->m_label.prerender(textPoint, QPixmap(), text, markerFont, m_labelTextColor, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); + pMark->m_label.prerender(textPoint, + QPixmap(), + text, + markerFont, + m_labelTextColor, + m_labelBackgroundColor, + width(), + getDevicePixelRatioF(this)); } // Show cue position when hovered @@ -911,10 +920,26 @@ void WOverview::drawMarks(QPainter* pPainter, const float offset, const float ga cueTimeDistanceText = "-" + cueTimeDistanceText; } - m_cuePositionLabel.prerender(positionTextPoint, QPixmap(), cuePositionText, markerFont, m_labelTextColor, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); + m_cuePositionLabel.prerender(positionTextPoint, + QPixmap(), + cuePositionText, + markerFont, + m_labelTextColor, + m_labelBackgroundColor, + width(), + getDevicePixelRatioF(this)); + + QPointF timeDistancePoint(positionTextPoint.x(), + (fontMetrics.height() + height()) / 2); - QPointF timeDistancePoint(positionTextPoint.x(), (fontMetrics.height() + height()) / 2); - m_cueTimeDistanceLabel.prerender(timeDistancePoint, QPixmap(), cueTimeDistanceText, markerFont, m_labelTextColor, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); + m_cueTimeDistanceLabel.prerender(timeDistancePoint, + QPixmap(), + cueTimeDistanceText, + markerFont, + m_labelTextColor, + m_labelBackgroundColor, + width(), + getDevicePixelRatioF(this)); markHovered = true; } } @@ -931,12 +956,12 @@ void WOverview::drawPickupPosition(QPainter* pPainter) { pPainter->setTransform(QTransform(0, 1, 1, 0, 0, 0)); } - pPainter->setPen(QPen(QBrush(m_qColorBackground), 1 * m_scaleFactor)); + pPainter->setPen(QPen(QBrush(m_backgroundColor), m_scaleFactor)); pPainter->setOpacity(0.5); pPainter->drawLine(m_iPickupPos + 1, 0, m_iPickupPos + 1, breadth()); pPainter->drawLine(m_iPickupPos - 1, 0, m_iPickupPos - 1, breadth()); - pPainter->setPen(QPen(m_signalColors.getPlayPosColor(), 1 * m_scaleFactor)); + pPainter->setPen(QPen(m_playPosColor, m_scaleFactor)); pPainter->setOpacity(1.0); pPainter->drawLine(m_iPickupPos, 0, m_iPickupPos, breadth()); @@ -970,7 +995,7 @@ void WOverview::drawTimeRuler(QPainter* pPainter) { pPainter->setPen(shadowPen); pPainter->drawLine(line); - pPainter->setPen(QPen(m_signalColors.getPlayPosColor(), 1 * m_scaleFactor)); + pPainter->setPen(QPen(m_playPosColor, m_scaleFactor)); pPainter->drawLine(line); } @@ -998,7 +1023,14 @@ void WOverview::drawTimeRuler(QPainter* pPainter) { QString timeText = mixxx::Duration::formatTime(timePosition) + " -" + mixxx::Duration::formatTime(timePositionTillEnd); - m_timeRulerPositionLabel.prerender(textPoint, QPixmap(), timeText, markerFont, m_labelTextColor, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); + m_timeRulerPositionLabel.prerender(textPoint, + QPixmap(), + timeText, + markerFont, + m_labelTextColor, + m_labelBackgroundColor, + width(), + getDevicePixelRatioF(this)); m_timeRulerPositionLabel.draw(pPainter); QString timeDistanceText = mixxx::Duration::formatTime(fabs(timeDistance)); @@ -1007,7 +1039,14 @@ void WOverview::drawTimeRuler(QPainter* pPainter) { if (static_cast<int>(timeDistance) < 0) { timeDistanceText = "-" + timeDistanceText; } - m_timeRulerDistanceLabel.prerender(textPointDistance, QPixmap(), timeDistanceText, markerFont, m_labelTextColor, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); + m_timeRulerDistanceLabel.prerender(textPointDistance, + QPixmap(), + timeDistanceText, + markerFont, + m_labelTextColor, + m_labelBackgroundColor, + width(), + getDevicePixelRatioF(this)); m_timeRulerDistanceLabel.draw(pPainter); } else { m_timeRulerPositionLabel.clear(); @@ -1072,7 +1111,14 @@ void WOverview::drawMarkLabels(QPainter* pPainter, const float offset, const flo QPointF durationBottomLeft(x, fontMetrics.height()); - markRange.m_durationLabel.prerender(durationBottomLeft, QPixmap(), duration, markerFont, m_labelTextColor, m_labelBackgroundColor, width(), getDevicePixelRatioF(this)); + markRange.m_durationLabel.prerender(durationBottomLeft, + QPixmap(), + duration, + markerFont, + m_labelTextColor, + m_labelBackgroundColor, + width(), + getDevicePixelRatioF(this)); if (!(markRange.m_durationLabel.intersects(m_cuePositionLabel) || markRange.m_durationLabel.intersects(m_cueTimeDistanceLabel) || markRange.m_durationLabel.intersects(m_timeRulerPositionLabel) || markRange.m_durationLabel.intersects(m_timeRulerDistanceLabel))) { markRange.m_durationLabel.draw(pPainter); @@ -1090,11 +1136,9 @@ void WOverview::drawPassthroughOverlay(QPainter* pPainter) { void WOverview::paintText(const QString& text, QPainter* pPainter) { PainterScope painterScope(pPainter); - QColor lowColor = m_signalColors.getLowColor(); - lowColor.setAlphaF(0.5); + m_lowColor.setAlphaF(0.5); QPen lowColorPen( - QBrush(lowColor), 1.25 * m_scaleFactor, - Qt::SolidLine, Qt::RoundCap); + QBrush(m_lowColor), 1.25 * m_scaleFactor, Qt::SolidLine, Qt::RoundCap); pPainter->setPen(lowColorPen); QFont font = pPainter->font(); QFontMetrics fm(font); diff --git a/src/widget/woverview.h b/src/widget/woverview.h index 92bbcefa01..531ec358b4 100644 --- a/src/widget/woverview.h +++ b/src/widget/woverview.h @@ -165,12 +165,16 @@ class WOverview : public WWidget, public TrackDropTarget { QPixmap m_backgroundPixmap; QString m_backgroundPixmapPath; - QColor m_qColorBackground; + QColor m_backgroundColor; int m_iLabelFontSize; QColor m_labelTextColor; QColor m_labelBackgroundColor; + QColor m_axesColor; + QColor m_playPosColor; QColor m_endOfTrackColor; QColor m_passthroughOverlayColor; + QColor m_playedOverlayColor; + QColor m_lowColor; QLabel* m_pPassthroughLabel; // All WaveformMarks |