changeset 941:d6acb8e36605 tonioni

Simpler colours in level pan widget
author Chris Cannam
date Tue, 31 Mar 2015 14:08:06 +0100
parents 77110abca8a1
children fcbfc7fad1f2
files widgets/LevelPanWidget.cpp
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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) {