Mercurial > hg > svgui
comparison layer/TimeValueLayer.cpp @ 963:fa96108d552d osx-retina
Merge from default branch
author | Chris Cannam |
---|---|
date | Thu, 14 May 2015 15:39:47 +0100 |
parents | a5488775f880 6f97f5149cb3 |
children | ee01a4062747 |
comparison
equal
deleted
inserted
replaced
956:092de22db207 | 963:fa96108d552d |
---|---|
18 #include "data/model/Model.h" | 18 #include "data/model/Model.h" |
19 #include "base/RealTime.h" | 19 #include "base/RealTime.h" |
20 #include "base/Profiler.h" | 20 #include "base/Profiler.h" |
21 #include "base/LogRange.h" | 21 #include "base/LogRange.h" |
22 #include "base/RangeMapper.h" | 22 #include "base/RangeMapper.h" |
23 #include "base/Pitch.h" | |
23 #include "ColourDatabase.h" | 24 #include "ColourDatabase.h" |
24 #include "view/View.h" | 25 #include "view/View.h" |
25 | 26 |
26 #include "data/model/SparseTimeValueModel.h" | 27 #include "data/model/SparseTimeValueModel.h" |
27 #include "data/model/Labeller.h" | 28 #include "data/model/Labeller.h" |
604 | 605 |
605 sv_frame_t useFrame = points.begin()->frame; | 606 sv_frame_t useFrame = points.begin()->frame; |
606 | 607 |
607 RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate()); | 608 RealTime rt = RealTime::frame2RealTime(useFrame, m_model->getSampleRate()); |
608 | 609 |
610 QString valueText; | |
611 float value = points.begin()->value; | |
612 QString unit = getScaleUnits(); | |
613 | |
614 if (unit == "Hz") { | |
615 valueText = tr("%1 Hz (%2, %3)") | |
616 .arg(value) | |
617 .arg(Pitch::getPitchLabelForFrequency(value)) | |
618 .arg(Pitch::getPitchForFrequency(value)); | |
619 } else if (unit != "") { | |
620 valueText = tr("%1 %2").arg(value).arg(unit); | |
621 } else { | |
622 valueText = tr("%1").arg(value); | |
623 } | |
624 | |
609 QString text; | 625 QString text; |
610 QString unit = getScaleUnits(); | |
611 if (unit != "") unit = " " + unit; | |
612 | 626 |
613 if (points.begin()->label == "") { | 627 if (points.begin()->label == "") { |
614 text = QString(tr("Time:\t%1\nValue:\t%2%3\nNo label")) | 628 text = QString(tr("Time:\t%1\nValue:\t%2\nNo label")) |
615 .arg(rt.toText(true).c_str()) | 629 .arg(rt.toText(true).c_str()) |
616 .arg(points.begin()->value) | 630 .arg(valueText); |
617 .arg(unit); | |
618 } else { | 631 } else { |
619 text = QString(tr("Time:\t%1\nValue:\t%2%3\nLabel:\t%4")) | 632 text = QString(tr("Time:\t%1\nValue:\t%2\nLabel:\t%4")) |
620 .arg(rt.toText(true).c_str()) | 633 .arg(rt.toText(true).c_str()) |
621 .arg(points.begin()->value) | 634 .arg(valueText) |
622 .arg(unit) | |
623 .arg(points.begin()->label); | 635 .arg(points.begin()->label); |
624 } | 636 } |
625 | 637 |
626 pos = QPoint(v->getXForFrame(useFrame), | 638 pos = QPoint(v->getXForFrame(useFrame), |
627 getYForValue(v, points.begin()->value)); | 639 getYForValue(v, points.begin()->value)); |