fix season selector in cp plot

This commit is contained in:
Sean Rhea
2009-11-27 16:45:05 -05:00
parent 411abf55b8
commit 7324ebda06
3 changed files with 14 additions and 7 deletions

View File

@@ -256,6 +256,17 @@ read_one(const QDir& dir, const QString &filename, QVector<double> &bests,
return 0;
}
void
CpintPlot::changeSeason(const QDate &start, const QDate &end)
{
startDate = start;
endDate = end;
needToScanRides = true;
delete CPCurve;
CPCurve = NULL;
clear_CP_Curves();
}
void
CpintPlot::setEnergyMode(bool value)
{

View File

@@ -47,8 +47,7 @@ class CpintPlot : public QwtPlot
double cp, tau, t0; // CP model parameters
void deriveCPParameters();
bool deleteCpiFile(QString filename);
void setStartDate(QDate date) { startDate = date; }
void setEndDate(QDate date) { endDate = date; }
void changeSeason(const QDate &start, const QDate &end);
void setEnergyMode(bool value);
bool energyMode() const { return energyMode_; }

View File

@@ -238,17 +238,14 @@ void CriticalPowerWindow::addSeasons()
if (!seasons.empty()) {
cComboSeason->setCurrentIndex(cComboSeason->count() - 1);
Season season = seasons.last();
cpintPlot->setStartDate(season.getStart());
cpintPlot->setEndDate(season.getEnd());
cpintPlot->changeSeason(season.getStart(), season.getEnd());
}
}
void CriticalPowerWindow::seasonSelected(int iSeason)
{
Season season = seasons.at(iSeason);
cpintPlot->setStartDate(season.getStart());
cpintPlot->setEndDate(season.getEnd());
cpintPlot->needToScanRides = true;
cpintPlot->changeSeason(season.getStart(), season.getEnd());
cpintPlot->calculate(currentRide);
}