Small fixes post Dan's Mega Patch..

This commit is contained in:
Justin F. Knotzke
2009-06-22 03:50:04 +00:00
parent d9baad3545
commit fcdd894c52
4 changed files with 35 additions and 7 deletions

View File

@@ -137,6 +137,7 @@ void ConfigDialog::save_Clicked()
QSettings settings(GC_SETTINGS_CO, GC_SETTINGS_APP);
settings.setValue(GC_UNIT, configPage->unitCombo->currentText());
settings.setValue(GC_ALLRIDES_ASCENDING, configPage->allRidesAscending->checkState());
settings.setValue(GC_CRANKLENGTH, configPage->crankLengthCombo->currentText());
// if the CP text entry reads invalid, there's nothing we can do
int cp = cyclistPage->getCP();

View File

@@ -26,6 +26,7 @@ class ConfigurationPage : public QWidget
QComboBox *unitCombo;
QComboBox *crankLengthCombo;
QCheckBox *allRidesAscending;
private:
QGroupBox *configGroup;

View File

@@ -161,6 +161,9 @@ PfPvPlot::PfPvPlot()
curve->setStyle(QwtPlotCurve::Dots);
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->attach(this);
QSettings settings(GC_SETTINGS_CO, GC_SETTINGS_APP);
cl_ = settings.value(GC_CRANKLENGTH).toDouble() / 1000.0;
recalc();
}
@@ -292,7 +295,12 @@ PfPvPlot::setData(RideItem *_rideItem)
// Rather than pass them all to the curve, use a set to strip
// out duplicates.
std::set<std::pair<double, double> > dataSet;
QListIterator<RideFilePoint*> i(ride->dataPoints());
long tot_cad = 0;
long tot_cad_points = 0;
QListIterator<RideFilePoint*> i(ride->dataPoints());
while (i.hasNext()) {
const RideFilePoint *p1 = i.next();
@@ -301,7 +309,12 @@ PfPvPlot::setData(RideItem *_rideItem)
double cpv = (p1->cad * cl_ * 2.0 * PI) / 60.0;
dataSet.insert(std::make_pair<double, double>(aepf, cpv));
}
tot_cad += p1->cad;
tot_cad_points++;
}
}
// Now that we have the set of points, transform them into the
@@ -317,7 +330,10 @@ PfPvPlot::setData(RideItem *_rideItem)
++j;
}
curve->setData(cpvArray, aepfArray);
setCAD(tot_cad / tot_cad_points);
curve->setData(cpvArray, aepfArray);
// now show the data (zone shading would already be visible)
curve->setVisible(true);
@@ -329,6 +345,9 @@ PfPvPlot::setData(RideItem *_rideItem)
}
replot();
QSettings settings(GC_SETTINGS_CO, GC_SETTINGS_APP);
setCL(settings.value(GC_CRANKLENGTH).toDouble() / 1000.0);
}
void
@@ -376,6 +395,7 @@ PfPvPlot::setCP(int cp)
{
cp_ = cp;
recalc();
emit changedCP( QString("%1").arg(cp) );
}
int
@@ -389,6 +409,7 @@ PfPvPlot::setCAD(int cadence)
{
cad_ = cadence;
recalc();
emit changedCAD( QString("%1").arg(cadence) );
}
double
@@ -402,6 +423,7 @@ PfPvPlot::setCL(double cranklen)
{
cl_ = cranklen;
recalc();
emit changedCL( QString("%1").arg(cranklen) );
}
// process checkbox for zone shading
void

View File

@@ -50,13 +50,17 @@ class PfPvPlot : public QwtPlot
RideItem *rideItem;
bool shadeZones() const { return shade_zones; }
public slots:
void setShadeZones(bool value);
public slots:
signals:
void changedCP( const QString& );
void changedCAD( const QString& );
void changedCL( const QString& );
protected:
QwtPlotCurve *curve;
QwtPlotCurve *curve;
QwtPlotCurve *cpCurve;
QList <QwtPlotCurve *> zoneCurves;
QList <PfPvPlotZoneLabel *> zoneLabels;