void CriticalPowerWindow::pickerMoved(const QPoint &pos) { double minutes = cpintPlot->invTransform(QwtPlot::xBottom, pos.x()); cpintTimeValue->setText(interval_to_str(60.0*minutes)); updateCpint(minutes); }
void CriticalPowerWindow::pickerMoved(const QPoint &pos) { double minutes = cpintPlot->invTransform(QwtPlot::xBottom, pos.x()); cpintTimeValue->setText(interval_to_str(60.0*minutes)); // current ride { unsigned watts = curve_to_point(minutes, cpintPlot->getThisCurve()); QString label; if (watts > 0) label = QString("%1 watts").arg(watts); else label = tr("no data"); cpintTodayValue->setText(label); } // cp line if (cpintPlot->getCPCurve()) { unsigned watts = curve_to_point(minutes, cpintPlot->getCPCurve()); QString label; if (watts > 0) label = QString("%1 watts").arg(watts); else label = tr("no data"); cpintCPValue->setText(label); } // global ride { QString label; int index = (int) ceil(minutes * 60); if (cpintPlot->getBests().count() > index) { QDate date = cpintPlot->getBestDates()[index]; label = QString("%1 watts (%2)"). arg(cpintPlot->getBests()[index]). arg(date.isValid() ? date.toString("MM/dd/yyyy") : "no date"); } else label = tr("no data"); cpintAllValue->setText(label); } }