summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-03-07 21:47:45 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-03-07 21:47:45 +0000
commit5354a83afb6b27ad3fd9de2c038f3fe2739f1f84 (patch)
treeec207d657155d9884c96bab050ae152640c2779a /muse2/muse
parente40fc849149dd97c248866a4a1d026dda5e57b62 (diff)
gradients
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp57
1 files changed, 40 insertions, 17 deletions
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 69412542..fb7274e2 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -20,6 +20,7 @@
#include <QPainter>
#include <QUrl>
#include <QPoint>
+#include <QLinearGradient>
#include "fastlog.h"
#include "widgets/tools.h"
@@ -1507,8 +1508,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
if (part->mute()) {
QColor c(Qt::white);
c.setAlpha(config.globalAlphaBlend);
- p.setBrush(c);
-
+ QLinearGradient gradient(r.topLeft(), r.bottomLeft());
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
+ QBrush cc(gradient);
+ p.setBrush(cc);
+
// NOTE: For one-pixel border use first line For two-pixel border use second.
p.drawRect(QRect(r.x(), r.y()-1, r.width(), r.height()));
//p.drawRect(r);
@@ -1518,8 +1523,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
if (item->isMoving()) {
QColor c(Qt::gray);
c.setAlpha(config.globalAlphaBlend);
- p.setBrush(c);
-
+ QLinearGradient gradient(r.topLeft(), r.bottomLeft());
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
+ QBrush cc(gradient);
+ p.setBrush(cc);
+
// NOTE: For one-pixel border use first line. For two-pixel border use second.
p.drawRect(QRect(r.x(), r.y()-1, r.width(), r.height()));
//p.drawRect(r);
@@ -1540,7 +1549,11 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
// Hm, put some kind of lower limit? If so do that globally to the adjustment.
QColor c(Qt::black);
c.setAlpha(config.globalAlphaBlend);
- p.setBrush(c);
+ QLinearGradient gradient(r.topLeft(), r.bottomLeft());
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
+ QBrush cc(gradient);
+ p.setBrush(cc);
p.drawRect(r);
}
else {
@@ -1554,8 +1567,12 @@ void PartCanvas::drawItem(QPainter& p, const CItem* item, const QRect& rect)
p.setPen(pen);
QColor c(config.partColors[i]);
c.setAlpha(config.globalAlphaBlend);
- p.setBrush(c);
-
+ QLinearGradient gradient(r.topLeft(), r.bottomLeft());
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
+ QBrush cc(gradient);
+ p.setBrush(cc);
+
p.drawRect(r);
}
@@ -2944,7 +2961,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect)
// primitive write recording while it happens
// should be enhanced/exchanged with solution that draws events and waveform
- ypos=0;
+ int yPos=0;
if (song->record() && audio->isPlaying()) {
for (iTrack it = tl->begin(); it != tl->end(); ++it) {
Track* track = *it;
@@ -2961,15 +2978,15 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect)
int startx = mapx(startPos);
int width = mapx(song->cpos()) - mapx(startPos);
- p.fillRect(startx,ypos, width, track->height(), config.partColors[0]);
+ p.fillRect(startx,yPos, width, track->height(), config.partColors[0]);
p.setPen(Qt::black);
- p.drawLine(startx,ypos,startx+width, ypos);
- p.drawLine(startx,ypos+1,startx+width, ypos+1);
- p.drawLine(startx,ypos+track->height(),startx+width, ypos+track->height());
- p.drawLine(startx,ypos+track->height()-1,startx+width, ypos+track->height()-1);
+ p.drawLine(startx,yPos,startx+width, yPos);
+ p.drawLine(startx,yPos+1,startx+width, yPos+1);
+ p.drawLine(startx,yPos+track->height(),startx+width, yPos+track->height());
+ p.drawLine(startx,yPos+track->height()-1,startx+width, yPos+track->height()-1);
}
}
- ypos+=track->height();
+ yPos+=track->height();
}
}
p.restore();
@@ -2987,15 +3004,21 @@ void PartCanvas::drawAudioTrack(QPainter& p, const QRect& r, AudioTrack* /* t */
//pen.setCosmetic(true);
p.setPen(pen);
//p.setBrush(Qt::gray);
+
QColor c(Qt::gray);
c.setAlpha(config.globalAlphaBlend);
- p.setBrush(c);
-
+ QLinearGradient gradient(r.topLeft(), r.bottomLeft());
+ gradient.setColorAt(0, c);
+ gradient.setColorAt(1, c.darker());
+ QBrush cc(gradient);
+ p.setBrush(cc);
+ p.drawRect(r);
+
// Factor in pen stroking size:
//QRect rr(r);
//rr.setHeight(rr.height() -1);
- p.drawRect(r);
+// p.fillRect(r, cc);
}
//---------------------------------------------------------