Commit 1ba4dedc authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Minor fix in audio levels look

parent 8ab8f8e5
......@@ -121,7 +121,6 @@ void AudioLevelWidget::drawBackground(int channels)
int labelHeight = fontMetrics().ascent();
int prevY = -1;
p.setPen(palette().text().color().rgb());
int y = 0;
for (int i = 0; i < dbLabelCount; i++) {
int value = dbscale[i];
......@@ -131,9 +130,11 @@ void AudioLevelWidget::drawBackground(int channels)
y = 0;
}
if (prevY < 0 || y - prevY > 2) {
p.setPen(palette().text().color().rgb());
p.drawText(QRectF(0, y, m_offset - 5, labelHeight), label, QTextOption(Qt::AlignRight));
prevY = y + labelHeight;
}
p.setPen(palette().window().color().rgb());
p.drawLine(m_offset, y + labelHeight / 2., m_offset + totalWidth - 1, y + labelHeight / 2.);
}
......
......@@ -150,22 +150,10 @@ void MonitorAudioLevel::drawBackground(int channels)
p.setPen(palette().dark().color());
// Clear space between the 2 channels
p.setCompositionMode(QPainter::CompositionMode_Source);
if (m_channelHeight < 4) {
// too many audio channels, simple line between channels
m_channelDistance = 1;
m_channelFillHeight = m_channelHeight;
for (int i = 0; i < channels; i++) {
p.drawLine(0, i * (m_channelHeight + m_channelDistance), rect.width() - 1, i * (m_channelHeight + m_channelDistance));
}
} else {
m_channelDistance = 2;
m_channelFillHeight = m_channelHeight - 2;
for (int i = 0; i < channels; i++) {
p.drawRect(0, i * (m_channelHeight + m_channelDistance), rect.width() - 1, m_channelHeight - 1);
if (i > 0) {
p.fillRect(0, i * (m_channelHeight + m_channelDistance) - 2, rect.width(), 2, Qt::transparent);
}
}
m_channelDistance = 1;
m_channelFillHeight = m_channelHeight;
for (int i = 0; i < channels; i++) {
p.drawLine(0, i * (m_channelHeight + m_channelDistance), rect.width() - 1, i * (m_channelHeight + m_channelDistance));
}
p.end();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment