|
From: Tapio V. <aa...@us...> - 2011-01-11 09:13:44
|
Module: editor
Branch: master
Commit: 4ff0959d6b2bcd330919fa5ba204ca49350a862e
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 11 11:12:45 2011 +0200
Note type visualization by color (and tooltip).
---
notelabel.cc | 31 ++++++++++++++++++-------------
notes.cc | 6 ++++++
notes.hh | 3 +++
3 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/notelabel.cc b/notelabel.cc
index 8e0d512..fd0094d 100644
--- a/notelabel.cc
+++ b/notelabel.cc
@@ -42,18 +42,23 @@ void NoteLabel::createPixmap(QSize size)
QLinearGradient gradient(0, 0, 0, image.height()-1);
gradient.setColorAt(0.0, Qt::white);
+ float ff = m_floating ? 1.0f : 0.5f;
if (m_selected) {
- gradient.setColorAt(0.2, QColor(100, 180, 100));
- gradient.setColorAt(0.8, QColor(100, 180, 100));
- gradient.setColorAt(1.0, QColor(100, 120, 100));
- } else if (m_floating) {
- gradient.setColorAt(0.2, QColor(160, 160, 180));
- gradient.setColorAt(0.8, QColor(160, 160, 180));
- gradient.setColorAt(1.0, QColor(100, 100, 120));
- } else {
- gradient.setColorAt(0.2, QColor(100, 100, 255));
- gradient.setColorAt(0.8, QColor(100, 100, 255));
- gradient.setColorAt(1.0, QColor(100, 100, 200));
+ gradient.setColorAt(0.2, QColor(180, 100, 100));
+ gradient.setColorAt(0.8, QColor(180, 100, 100));
+ gradient.setColorAt(1.0, QColor(120, 100, 100));
+ } else if (type == NORMAL) {
+ gradient.setColorAt(0.2, QColor(100 * ff, 100 * ff, 255 * ff));
+ gradient.setColorAt(0.8, QColor(100 * ff, 100 * ff, 255 * ff));
+ gradient.setColorAt(1.0, QColor(100 * ff, 100 * ff, 200 * ff));
+ } else if (type == GOLDEN) {
+ gradient.setColorAt(0.2, QColor(255 * ff, 255 * ff, 100 * ff));
+ gradient.setColorAt(0.8, QColor(255 * ff, 255 * ff, 100 * ff));
+ gradient.setColorAt(1.0, QColor(160 * ff, 160 * ff, 100 * ff));
+ } else if (type == FREESTYLE) {
+ gradient.setColorAt(0.2, QColor(100 * ff, 180 * ff, 100 * ff));
+ gradient.setColorAt(0.8, QColor(100 * ff, 180 * ff, 100 * ff));
+ gradient.setColorAt(1.0, QColor(100 * ff, 120 * ff, 100 * ff));
}
QPainter painter;
@@ -70,7 +75,7 @@ void NoteLabel::createPixmap(QSize size)
setPixmap(QPixmap::fromImage(image));
- setToolTip(m_labelText);
+ setToolTip(QString("\"%1\"\n%2").arg(m_labelText).arg(QString::fromStdString(typeString())));
setStatusTip(QString("Lyric: ") + m_labelText);
}
@@ -91,7 +96,7 @@ void NoteLabel::resizeEvent(QResizeEvent *event)
void NoteLabel::mouseMoveEvent(QMouseEvent *event)
{
- QToolTip::showText(event->globalPos(), getText(), this);
+ QToolTip::showText(event->globalPos(), toolTip(), this);
NoteGraphWidget* ngw = dynamic_cast<NoteGraphWidget*>(parent());
if (m_resizing != 0) {
diff --git a/notes.cc b/notes.cc
index 787908a..366a9b9 100644
--- a/notes.cc
+++ b/notes.cc
@@ -58,6 +58,12 @@ Note::Note(): duration(getNaN(), getNaN()), phase(getNaN()), type(NORMAL), note(
double Note::diff(double note, double n) { return remainder(n - note, 12.0); }
+std::string Note::typeString() const {
+ static const std::string typenames[] = { "Normal", "Bonus", "Freestyle" };
+ return typenames[type];
+}
+
+
VocalTrack::VocalTrack(std::string name) : name(name) {reload();}
void VocalTrack::reload() {
diff --git a/notes.hh b/notes.hh
index daca52f..ff7fee7 100644
--- a/notes.hh
+++ b/notes.hh
@@ -69,6 +69,9 @@ struct Note {
static bool ltBegin(Note const& a, Note const& b) { return a.duration.begin < b.duration.begin; }
/// compares end of two notes
static bool ltEnd(Note const& a, Note const& b) { return a.duration.end < b.duration.end; }
+
+ /// human-readable description of note type
+ std::string typeString() const;
};
typedef std::vector<Note> Notes;
|