summaryrefslogtreecommitdiff
path: root/muse/awl/mslider.cpp
diff options
context:
space:
mode:
authorNil Geisweiller <a-lin@sourceforge.net>2006-11-21 19:58:02 +0000
committerNil Geisweiller <a-lin@sourceforge.net>2006-11-21 19:58:02 +0000
commit532937985c8afe35a5e5f07e3f025c34692a1f1b (patch)
tree1ec7af1adea138aa18a50e3f2070ed18afa8201a /muse/awl/mslider.cpp
parent137be86fba4cfc14a5902f7d796064b6dcefdca3 (diff)
see ChangeLog
Diffstat (limited to 'muse/awl/mslider.cpp')
-rw-r--r--muse/awl/mslider.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/muse/awl/mslider.cpp b/muse/awl/mslider.cpp
index 0bfac826..2639dde8 100644
--- a/muse/awl/mslider.cpp
+++ b/muse/awl/mslider.cpp
@@ -32,7 +32,7 @@ MeterSlider::MeterSlider(QWidget* parent)
: VolSlider(parent)
{
_channel = 0;
- yellowScale = -10;
+ yellowScale = -16; //-10;
redScale = 0;
_meterWidth = _scaleWidth * 3;
setChannel(1);
@@ -138,7 +138,41 @@ void MeterSlider::paint(const QRect& r)
h = 0;
else if (h > mh)
h = mh;
- if (h > h1) {
+
+ QColor yellowRed;
+ yellowRed.setHsv(QColor(Qt::yellow).hue()-8,
+ QColor(Qt::yellow).saturation(),
+ QColor(Qt::yellow).value());
+ QColor yellRedRed;
+ yellRedRed.setHsv(QColor(Qt::yellow).hue()-16,
+ QColor(Qt::yellow).saturation(),
+ QColor(Qt::yellow).value());
+ QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, mh));
+ linearGrad.setColorAt(0, Qt::red);
+ linearGrad.setColorAt(1-(double)(h1-5)/(double)mh, yellRedRed);
+ linearGrad.setColorAt(1-(double)(h1-6)/(double)mh, yellowRed);
+ linearGrad.setColorAt(1-(double)h2/(double)mh, Qt::yellow);
+ linearGrad.setColorAt(1, Qt::green);
+
+ QColor darkYellowRed;
+ darkYellowRed.setHsv(QColor(Qt::darkYellow).hue()-8,
+ QColor(Qt::darkYellow).saturation(),
+ QColor(Qt::darkYellow).value());
+ QColor darkYellRedRed;
+ darkYellRedRed.setHsv(QColor(Qt::darkYellow).hue()-16,
+ QColor(Qt::darkYellow).saturation(),
+ QColor(Qt::darkYellow).value());
+ QLinearGradient linearDarkGrad(QPointF(0, 0), QPointF(0, mh));
+ linearDarkGrad.setColorAt(0, Qt::darkRed);
+ linearDarkGrad.setColorAt(1-(double)(h1-5)/(double)mh, darkYellRedRed);
+ linearDarkGrad.setColorAt(1-(double)(h1-6)/(double)mh, darkYellowRed);
+ linearDarkGrad.setColorAt(1-(double)h2/(double)mh, Qt::darkYellow);
+ linearDarkGrad.setColorAt(1, Qt::darkGreen);
+
+ p.fillRect(x, y1, mw, mh, linearGrad);
+ p.fillRect(x, y1, mw, mh-h, linearDarkGrad);
+
+ /*if (h > h1) {
p.fillRect(x, y3-h2, mw, h2, QBrush(0x00ff00)); // green
p.fillRect(x, y3-h1, mw, h1 - h2, QBrush(0xffff00)); // yellow
p.fillRect(x, y3-h, mw, h - h1, QBrush(0xff0000)); // red
@@ -155,14 +189,17 @@ void MeterSlider::paint(const QRect& r)
p.fillRect(x, y3-h2, mw, h2-h, QBrush(0x007000)); // dark green
p.fillRect(x, y3-h1, mw, h1-h2, QBrush(0x8e8e00)); // dark yellow
p.fillRect(x, y1, mw, mh - h1, QBrush(0x8e0000)); // dark red
- }
+ }*/
//---------------------------------------------------
// draw peak line
//---------------------------------------------------
h = mh - (lrint(fast_log10(meterPeak[i]) * -20.0f * mh / range));
- p.drawLine(x, y3-h, x+mw, y3-h);
+ if (h > mh)
+ h = mh;
+ if (h > 0)
+ p.drawLine(x, y3-h, x+mw, y3-h);
x += mw;
}