From 18efc12755bb3ceca58b13ca7e544c5f49be5aa0 Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Fri, 31 May 2024 20:17:55 +0200 Subject: [PATCH] Move "Rec" to lower left Move the recording symbol and the "Rec" string to the lower left of the clip so that it does not overlap with the clip name if it is shown. Make the "Rec" string translatable and increase the font size. --- src/gui/clips/SampleClipView.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/gui/clips/SampleClipView.cpp b/src/gui/clips/SampleClipView.cpp index 2074e7944..bb0937381 100644 --- a/src/gui/clips/SampleClipView.cpp +++ b/src/gui/clips/SampleClipView.cpp @@ -310,15 +310,31 @@ void SampleClipView::paintEvent( QPaintEvent * pe ) if (m_clip->isRecord()) { - p.setFont(adjustedToPixelSize(p.font(), 7)); + p.setFont(adjustedToPixelSize(p.font(), 10)); - p.setPen( textShadowColor() ); - p.drawText( 10, p.fontMetrics().height()+1, "Rec" ); - p.setPen( textColor() ); - p.drawText( 9, p.fontMetrics().height(), "Rec" ); + const auto fontHeight = p.fontMetrics().height(); - p.setBrush( QBrush( textColor() ) ); - p.drawEllipse( 4, 5, 4, 4 ); + const auto baseLine = height() - 3; + + const int recordSymbolRadius = 3; + const int recordSymbolCenterX = recordSymbolRadius + 4; + const int recordSymbolCenterY = baseLine - fontHeight / 2 + 1; + + const int textStartX = recordSymbolCenterX + recordSymbolRadius + 4; + + auto textPos = QPoint(textStartX, baseLine); + + const auto rec = tr("Rec"); + + p.setPen(textShadowColor()); + p.drawText(textPos + QPoint(1, 1), rec); + + p.setPen(textColor()); + p.drawText(textPos, rec); + + p.setBrush(QBrush(textColor())); + + p.drawEllipse(QPoint(recordSymbolCenterX, recordSymbolCenterY), recordSymbolRadius, recordSymbolRadius); } p.end();