mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Implement Interval Hover in PfPv
.. only from interval list .. need to also implement from chart hover too
This commit is contained in:
@@ -144,7 +144,7 @@ public:
|
||||
|
||||
|
||||
PfPvPlot::PfPvPlot(Context *context)
|
||||
: rideItem (NULL), context(context), cp_ (0), cad_ (85), cl_ (0.175), shade_zones(true)
|
||||
: rideItem (NULL), context(context), hover(NULL), cp_ (0), cad_ (85), cl_ (0.175), shade_zones(true)
|
||||
{
|
||||
static_cast<QwtPlotCanvas*>(canvas())->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
@@ -218,7 +218,7 @@ PfPvPlot::configChanged()
|
||||
// frame with inverse of background
|
||||
QwtSymbol *sym = new QwtSymbol;
|
||||
sym->setStyle(QwtSymbol::Ellipse);
|
||||
sym->setSize(6);
|
||||
sym->setSize(4);
|
||||
sym->setPen(QPen(Qt::red));
|
||||
sym->setBrush(QBrush(Qt::red));
|
||||
curve->setSymbol(sym);
|
||||
@@ -482,7 +482,7 @@ PfPvPlot::setData(RideItem *_rideItem)
|
||||
|
||||
QwtSymbol *sym = new QwtSymbol;
|
||||
sym->setStyle(QwtSymbol::Ellipse);
|
||||
sym->setSize(6);
|
||||
sym->setSize(4);
|
||||
sym->setPen(QPen(Qt::red));
|
||||
sym->setBrush(QBrush(Qt::red));
|
||||
curve->setSymbol(sym);
|
||||
@@ -504,6 +504,55 @@ PfPvPlot::setData(RideItem *_rideItem)
|
||||
replot();
|
||||
}
|
||||
|
||||
void
|
||||
PfPvPlot::intervalHover(RideFileInterval x)
|
||||
{
|
||||
if (!isVisible()) return;
|
||||
if (context->isCompareIntervals) return;
|
||||
if (!rideItem) return;
|
||||
if (!rideItem->ride());
|
||||
|
||||
// zap the old one
|
||||
if (hover) {
|
||||
hover->detach();
|
||||
delete hover;
|
||||
hover = NULL;
|
||||
}
|
||||
|
||||
// collect the data
|
||||
QVector<double> aepfArray, cpvArray;
|
||||
foreach(const RideFilePoint *p1, rideItem->ride()->dataPoints()) {
|
||||
|
||||
if (p1->secs < x.start || p1->secs > x.stop) continue;
|
||||
|
||||
if (p1->watts != 0 && p1->cad != 0) {
|
||||
double aepf = (p1->watts * 60.0) / (p1->cad * cl_ * 2.0 * PI);
|
||||
double cpv = (p1->cad * cl_ * 2.0 * PI) / 60.0;
|
||||
|
||||
aepfArray << aepf;
|
||||
cpvArray << cpv;
|
||||
}
|
||||
}
|
||||
|
||||
// any data ?
|
||||
if (aepfArray.size()) {
|
||||
QwtSymbol *sym = new QwtSymbol;
|
||||
sym->setStyle(QwtSymbol::Ellipse);
|
||||
sym->setSize(4);
|
||||
sym->setPen(QPen(Qt::gray));
|
||||
sym->setBrush(QBrush(Qt::gray));
|
||||
|
||||
hover = new QwtPlotCurve();
|
||||
hover->setSymbol(sym);
|
||||
hover->setStyle(QwtPlotCurve::Dots);
|
||||
hover->setRenderHint(QwtPlotItem::RenderAntialiased);
|
||||
hover->setSamples(cpvArray, aepfArray);
|
||||
hover->attach(this);
|
||||
}
|
||||
|
||||
replot(); // refresh
|
||||
}
|
||||
|
||||
void
|
||||
PfPvPlot::showIntervals(RideItem *_rideItem)
|
||||
{
|
||||
@@ -627,7 +676,7 @@ PfPvPlot::showIntervals(RideItem *_rideItem)
|
||||
|
||||
QwtSymbol *sym = new QwtSymbol;
|
||||
sym->setStyle(QwtSymbol::Ellipse);
|
||||
sym->setSize(6);
|
||||
sym->setSize(4);
|
||||
sym->setBrush(QBrush(Qt::NoBrush));
|
||||
|
||||
QPen pen;
|
||||
@@ -1081,7 +1130,7 @@ PfPvPlot::showCompareIntervals()
|
||||
|
||||
QwtSymbol *sym = new QwtSymbol;
|
||||
sym->setStyle(QwtSymbol::Ellipse);
|
||||
sym->setSize(6);
|
||||
sym->setSize(4);
|
||||
sym->setBrush(QBrush(Qt::NoBrush));
|
||||
|
||||
QPen pen;
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
#ifndef _GC_QaPlot_h
|
||||
#define _GC_QaPlot_h 1
|
||||
#include "GoldenCheetah.h"
|
||||
#include "RideFile.h"
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_point_3d.h>
|
||||
#include <qwt_compat.h>
|
||||
|
||||
// forward references
|
||||
class RideFile;
|
||||
class RideItem;
|
||||
struct RideFilePoint;
|
||||
class QwtPlotCurve;
|
||||
@@ -76,6 +76,7 @@ class PfPvPlot : public QwtPlot
|
||||
|
||||
public slots:
|
||||
void configChanged();
|
||||
void intervalHover(RideFileInterval);
|
||||
|
||||
signals:
|
||||
void changedCP( const QString& );
|
||||
@@ -90,6 +91,7 @@ class PfPvPlot : public QwtPlot
|
||||
|
||||
Context *context;
|
||||
QwtPlotCurve *curve;
|
||||
QwtPlotCurve *hover;
|
||||
QList <QwtPlotCurve *> intervalCurves;
|
||||
QwtPlotCurve *cpCurve;
|
||||
QList <QwtPlotCurve *> zoneCurves;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Athlete.h"
|
||||
#include "PfPvPlot.h"
|
||||
#include "RideItem.h"
|
||||
#include "RideFile.h"
|
||||
#include "Settings.h"
|
||||
#include "Colors.h"
|
||||
#include <QtGui>
|
||||
@@ -166,36 +167,25 @@ PfPvWindow::PfPvWindow(Context *context) :
|
||||
cl->addWidget(frameIntervalPfPvCheckBox);
|
||||
cl->addStretch();
|
||||
|
||||
connect(pfPvPlot, SIGNAL(changedCP(const QString&)),
|
||||
qaCPValue, SLOT(setText(const QString&)) );
|
||||
connect(pfPvPlot, SIGNAL(changedCAD(const QString&)),
|
||||
qaCadValue, SLOT(setText(const QString&)) );
|
||||
connect(pfPvPlot, SIGNAL(changedCL(const QString&)),
|
||||
qaClValue, SLOT(setText(const QString&)) );
|
||||
connect(qaCPValue, SIGNAL(editingFinished()),
|
||||
this, SLOT(setQaCPFromLineEdit()));
|
||||
connect(qaCadValue, SIGNAL(editingFinished()),
|
||||
this, SLOT(setQaCADFromLineEdit()));
|
||||
connect(qaClValue, SIGNAL(editingFinished()),
|
||||
this, SLOT(setQaCLFromLineEdit()));
|
||||
connect(shadeZonesPfPvCheckBox, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(setShadeZonesPfPvFromCheckBox()));
|
||||
connect(rShade, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(setrShadeZonesPfPvFromCheckBox()));
|
||||
connect(mergeIntervalPfPvCheckBox, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(setMergeIntervalsPfPvFromCheckBox()));
|
||||
connect(rMergeInterval, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(setrMergeIntervalsPfPvFromCheckBox()));
|
||||
connect(frameIntervalPfPvCheckBox, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(setFrameIntervalsPfPvFromCheckBox()));
|
||||
connect(rFrameInterval, SIGNAL(stateChanged(int)),
|
||||
this, SLOT(setrFrameIntervalsPfPvFromCheckBox()));
|
||||
connect(pfPvPlot, SIGNAL(changedCP(const QString&)), qaCPValue, SLOT(setText(const QString&)) );
|
||||
connect(pfPvPlot, SIGNAL(changedCAD(const QString&)), qaCadValue, SLOT(setText(const QString&)) );
|
||||
connect(pfPvPlot, SIGNAL(changedCL(const QString&)), qaClValue, SLOT(setText(const QString&)) );
|
||||
connect(qaCPValue, SIGNAL(editingFinished()), this, SLOT(setQaCPFromLineEdit()));
|
||||
connect(qaCadValue, SIGNAL(editingFinished()), this, SLOT(setQaCADFromLineEdit()));
|
||||
connect(qaClValue, SIGNAL(editingFinished()), this, SLOT(setQaCLFromLineEdit()));
|
||||
connect(shadeZonesPfPvCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setShadeZonesPfPvFromCheckBox()));
|
||||
connect(rShade, SIGNAL(stateChanged(int)), this, SLOT(setrShadeZonesPfPvFromCheckBox()));
|
||||
connect(mergeIntervalPfPvCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setMergeIntervalsPfPvFromCheckBox()));
|
||||
connect(rMergeInterval, SIGNAL(stateChanged(int)), this, SLOT(setrMergeIntervalsPfPvFromCheckBox()));
|
||||
connect(frameIntervalPfPvCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setFrameIntervalsPfPvFromCheckBox()));
|
||||
connect(rFrameInterval, SIGNAL(stateChanged(int)), this, SLOT(setrFrameIntervalsPfPvFromCheckBox()));
|
||||
connect(doubleClickPicker, SIGNAL(doubleClicked(int, int)), this, SLOT(doubleClicked(int, int)));
|
||||
|
||||
// GC signals
|
||||
connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
|
||||
connect(context, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
|
||||
connect(context, SIGNAL(intervalsChanged()), this, SLOT(intervalSelected()));
|
||||
connect(context, SIGNAL(intervalHover(RideFileInterval)), this, SLOT(intervalHover(RideFileInterval)));
|
||||
connect(context->athlete, SIGNAL(zonesChanged()), this, SLOT(zonesChanged()));
|
||||
connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
|
||||
connect(context, SIGNAL(configChanged()), pfPvPlot, SLOT(configChanged()));
|
||||
@@ -254,6 +244,12 @@ PfPvWindow::rideSelected()
|
||||
qaCPValue->setText(QString("%1").arg(pfPvPlot->getCP()));
|
||||
}
|
||||
|
||||
void
|
||||
PfPvWindow::intervalHover(RideFileInterval x)
|
||||
{
|
||||
pfPvPlot->intervalHover(x);
|
||||
}
|
||||
|
||||
void
|
||||
PfPvWindow::intervalSelected()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef _GC_PfPvWindow_h
|
||||
#define _GC_PfPvWindow_h 1
|
||||
#include "GoldenCheetah.h"
|
||||
#include "RideFile.h"
|
||||
|
||||
#include <QtGui>
|
||||
#include <QLineEdit>
|
||||
@@ -90,6 +91,7 @@ class PfPvWindow : public GcChartWindow
|
||||
|
||||
void rideSelected();
|
||||
void intervalSelected();
|
||||
void intervalHover(RideFileInterval);
|
||||
void zonesChanged();
|
||||
|
||||
protected slots:
|
||||
|
||||
Reference in New Issue
Block a user