mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
The training view has a number of improvements, most notable of which is the workout plot now plots the telemetry as you ride. This enables you to view your performance against the workout as you ride. In developing and testing this I found and fixed a number of other minor issues; * The workout plot didn't have any axes * The workout plot title didn't reflect the workout selected * The workout plot markers didn't honour preferences * Values didn't reset on stop/start of workout * The rolling 30 second power plot in realtime was broken * Lap numbers were not available for display In addition, some minor changes were made; * Save workout is no longer optional - it always saves * The control buttons/margins did not resize nicely * The workout plot uses colour to distinguish between workouts that are time or distance based. * A new default train layout for new users to avoid having to muck about with layouts * Removed the race servers since they are not used and steal screen estate. Will re-introduce when multi-rider or internet racing is implemented. I have also added a few workout files into the test/workouts directory, we should think about how we can distribute these and allow users to share and contribute them in the future. Fixes #493.
266 lines
4.9 KiB
C++
266 lines
4.9 KiB
C++
|
|
/*
|
|
* Copyright (c) 2009 Justin F. Knotzke (jknotzke@shampoo.ca)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc., 51
|
|
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include "RealtimeData.h"
|
|
|
|
#define tr(s) QObject::tr(s)
|
|
|
|
RealtimeData::RealtimeData()
|
|
{
|
|
name[0] = '\0';
|
|
lap = watts = hr = speed = wheelRpm = cadence = load = 0;
|
|
msecs = lapMsecs = bikeScore = joules = 0;
|
|
}
|
|
|
|
void RealtimeData::setName(char *name)
|
|
{
|
|
strcpy(this->name, name);
|
|
}
|
|
void RealtimeData::setWatts(double watts)
|
|
{
|
|
this->watts = (int)watts;
|
|
}
|
|
void RealtimeData::setHr(double hr)
|
|
{
|
|
this->hr = (int)hr;
|
|
}
|
|
void RealtimeData::setSpeed(double speed)
|
|
{
|
|
this->speed = speed;
|
|
}
|
|
void RealtimeData::setWheelRpm(double wheelRpm)
|
|
{
|
|
this->wheelRpm = wheelRpm;
|
|
}
|
|
void RealtimeData::setCadence(double aCadence)
|
|
{
|
|
cadence = (int)aCadence;
|
|
}
|
|
void RealtimeData::setLoad(double load)
|
|
{
|
|
this->load = load;
|
|
}
|
|
void RealtimeData::setMsecs(long x)
|
|
{
|
|
this->msecs = x;
|
|
}
|
|
void RealtimeData::setLapMsecs(long x)
|
|
{
|
|
this->lapMsecs = x;
|
|
}
|
|
void RealtimeData::setDistance(double x)
|
|
{
|
|
this->distance = x;
|
|
}
|
|
void RealtimeData::setJoules(long x)
|
|
{
|
|
this->joules = x;
|
|
}
|
|
void RealtimeData::setBikeScore(long x)
|
|
{
|
|
this->bikeScore = x;
|
|
}
|
|
void RealtimeData::setXPower(long x)
|
|
{
|
|
this->xPower = x;
|
|
}
|
|
|
|
const char *
|
|
RealtimeData::getName() const
|
|
{
|
|
return name;
|
|
}
|
|
double RealtimeData::getWatts() const
|
|
{
|
|
return watts;
|
|
}
|
|
double RealtimeData::getHr() const
|
|
{
|
|
return hr;
|
|
}
|
|
double RealtimeData::getSpeed() const
|
|
{
|
|
return speed;
|
|
}
|
|
double RealtimeData::getWheelRpm() const
|
|
{
|
|
return wheelRpm;
|
|
}
|
|
double RealtimeData::getCadence() const
|
|
{
|
|
return cadence;
|
|
}
|
|
double RealtimeData::getLoad() const
|
|
{
|
|
return load;
|
|
}
|
|
long RealtimeData::getMsecs() const
|
|
{
|
|
return msecs;
|
|
}
|
|
long RealtimeData::getLapMsecs() const
|
|
{
|
|
return lapMsecs;
|
|
}
|
|
double RealtimeData::getDistance() const
|
|
{
|
|
return distance;
|
|
}
|
|
long RealtimeData::getJoules() const
|
|
{
|
|
return joules;
|
|
}
|
|
long RealtimeData::getBikeScore() const
|
|
{
|
|
return bikeScore;
|
|
}
|
|
long RealtimeData::getXPower() const
|
|
{
|
|
return xPower;
|
|
}
|
|
|
|
double RealtimeData::value(DataSeries series) const
|
|
{
|
|
switch (series) {
|
|
|
|
case Time: return msecs;
|
|
break;
|
|
|
|
case Lap: return lap;
|
|
break;
|
|
|
|
case LapTime: return lapMsecs;
|
|
break;
|
|
|
|
case Distance: return distance;
|
|
break;
|
|
|
|
case Joules: return joules;
|
|
break;
|
|
|
|
case BikeScore: return bikeScore;
|
|
break;
|
|
|
|
case XPower: return xPower;
|
|
break;
|
|
|
|
case Watts: return watts;
|
|
break;
|
|
|
|
case Speed: return speed;
|
|
break;
|
|
|
|
case Cadence: return cadence;
|
|
break;
|
|
|
|
case HeartRate: return hr;
|
|
break;
|
|
|
|
case Load: return load;
|
|
break;
|
|
|
|
case None:
|
|
default:
|
|
return 0;
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
// provide a list of data series
|
|
const QList<RealtimeData::DataSeries> &RealtimeData::listDataSeries()
|
|
{
|
|
static QList<DataSeries> seriesList;
|
|
|
|
if (seriesList.count() == 0) {
|
|
|
|
// better populate it first!
|
|
seriesList << None;
|
|
seriesList << Time;
|
|
seriesList << Lap;
|
|
seriesList << LapTime;
|
|
seriesList << Distance;
|
|
seriesList << Watts;
|
|
seriesList << Speed;
|
|
seriesList << Cadence;
|
|
seriesList << HeartRate;
|
|
seriesList << Load;
|
|
seriesList << BikeScore;
|
|
seriesList << XPower;
|
|
seriesList << Joules;
|
|
}
|
|
return seriesList;
|
|
}
|
|
|
|
QString RealtimeData::seriesName(DataSeries series)
|
|
{
|
|
switch (series) {
|
|
|
|
default:
|
|
case None: return tr("None");
|
|
break;
|
|
|
|
case Time: return tr("Time");
|
|
break;
|
|
|
|
case Lap: return tr("Lap");
|
|
break;
|
|
|
|
case LapTime: return tr("Lap Time");
|
|
break;
|
|
|
|
case BikeScore: return tr("BikeScore");
|
|
break;
|
|
|
|
case Joules: return tr("Joules");
|
|
break;
|
|
|
|
case XPower: return tr("XPower");
|
|
break;
|
|
|
|
case Distance: return tr("Distance");
|
|
break;
|
|
|
|
case Watts: return tr("Power");
|
|
break;
|
|
|
|
case Speed: return tr("Speed");
|
|
break;
|
|
|
|
case Cadence: return tr("Cadence");
|
|
break;
|
|
|
|
case HeartRate: return tr("Heart Rate");
|
|
break;
|
|
|
|
case Load: return tr("Target Power");
|
|
break;
|
|
}
|
|
}
|
|
|
|
void RealtimeData::setLap(long lap)
|
|
{
|
|
this->lap = lap;
|
|
}
|
|
|
|
long RealtimeData::getLap() const
|
|
{
|
|
return lap;
|
|
}
|