# HG changeset patch # User Chris Cannam # Date 1427807286 -3600 # Node ID d6acb8e3660571ced8a0403095d210db7df2c3a4 # Parent 77110abca8a10e27fe34ead0191b847653ede412 Simpler colours in level pan widget diff -r 77110abca8a1 -r d6acb8e36605 widgets/LevelPanWidget.cpp --- a/widgets/LevelPanWidget.cpp Tue Mar 31 14:05:39 2015 +0100 +++ b/widgets/LevelPanWidget.cpp Tue Mar 31 14:08:06 2015 +0100 @@ -312,11 +312,21 @@ return std::min(th, tw); } +static QColor +level_to_colour(int level) +{ + assert(maxLevel == 4); + if (level == 0) return Qt::black; + else if (level == 1) return QColor(80, 0, 0); + else if (level == 2) return QColor(160, 0, 0); + else if (level == 3) return QColor(255, 0, 0); + else return QColor(255, 255, 0); +} + void LevelPanWidget::renderTo(QPaintDevice *dev, QRectF rect, bool asIfEditable) const { QPainter paint(dev); - ColourMapper mapper(ColourMapper::Sunset, 0, maxLevel); paint.setRenderHint(QPainter::Antialiasing, true); @@ -356,7 +366,7 @@ for (int level = 0; level <= m_level; ++level) { if (isEnabled()) { - paint.setBrush(mapper.map(level)); + paint.setBrush(level_to_colour(level)); } QRectF clr = cellLightRect(rect, level, m_pan); if (m_includeMute && m_level == 0) {