mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
QT5 -- Part 3 of 3
Fixup crashes and major issues created by porting to QT5. These have included; * Fix CP plot log scale * AllPlot axes and tooltip * DBAccess prepare/bind bug * LTMSettings crash * LTMWindow zoomer/picker crash * LTMPlot axes hack There are still issues remaining but we can start working through them at leisure -- the product now builds and runs.
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -6,3 +6,10 @@ Makefile
|
|||||||
# osx noise
|
# osx noise
|
||||||
.DS_Store
|
.DS_Store
|
||||||
profile
|
profile
|
||||||
|
|
||||||
|
moc/
|
||||||
|
obj/
|
||||||
|
lib/
|
||||||
|
bin/
|
||||||
|
plugins/
|
||||||
|
resources/
|
||||||
|
|||||||
3
src/.gitignore
vendored
3
src/.gitignore
vendored
@@ -39,3 +39,6 @@ GoldenCheetah.app
|
|||||||
|
|
||||||
#ignore ctags for vim
|
#ignore ctags for vim
|
||||||
tags
|
tags
|
||||||
|
|
||||||
|
#ignore patches
|
||||||
|
*.patch
|
||||||
|
|||||||
205
src/AllPlot.cpp
205
src/AllPlot.cpp
@@ -262,6 +262,10 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context):
|
|||||||
setCanvasBackground(GColor(CRIDEPLOTBACKGROUND));
|
setCanvasBackground(GColor(CRIDEPLOTBACKGROUND));
|
||||||
canvas()->setFrameStyle(QFrame::NoFrame);
|
canvas()->setFrameStyle(QFrame::NoFrame);
|
||||||
|
|
||||||
|
// set the axes that we use..
|
||||||
|
setAxesCount(QwtAxis::yLeft, 2);
|
||||||
|
setAxesCount(QwtAxis::yRight, 3);
|
||||||
|
|
||||||
setXTitle();
|
setXTitle();
|
||||||
|
|
||||||
wattsCurve = new QwtPlotCurve(tr("Power"));
|
wattsCurve = new QwtPlotCurve(tr("Power"));
|
||||||
@@ -277,23 +281,23 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context):
|
|||||||
apCurve->setYAxis(yLeft);
|
apCurve->setYAxis(yLeft);
|
||||||
|
|
||||||
hrCurve = new QwtPlotCurve(tr("Heart Rate"));
|
hrCurve = new QwtPlotCurve(tr("Heart Rate"));
|
||||||
hrCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
hrCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
|
|
||||||
speedCurve = new QwtPlotCurve(tr("Speed"));
|
speedCurve = new QwtPlotCurve(tr("Speed"));
|
||||||
speedCurve->setYAxis(yRight);
|
speedCurve->setYAxis(yRight);
|
||||||
|
|
||||||
cadCurve = new QwtPlotCurve(tr("Cadence"));
|
cadCurve = new QwtPlotCurve(tr("Cadence"));
|
||||||
cadCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
cadCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
|
|
||||||
altCurve = new QwtPlotCurve(tr("Altitude"));
|
altCurve = new QwtPlotCurve(tr("Altitude"));
|
||||||
// altCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
|
// altCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
|
||||||
altCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 2));
|
altCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 1));
|
||||||
|
|
||||||
tempCurve = new QwtPlotCurve(tr("Temperature"));
|
tempCurve = new QwtPlotCurve(tr("Temperature"));
|
||||||
if (context->athlete->useMetricUnits)
|
if (context->athlete->useMetricUnits)
|
||||||
tempCurve->setYAxis(yRight); // with speed
|
tempCurve->setYAxis(yRight); // with speed
|
||||||
else
|
else
|
||||||
tempCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2)); // with cadence
|
tempCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1)); // with cadence
|
||||||
|
|
||||||
windCurve = new QwtPlotIntervalCurve(tr("Wind"));
|
windCurve = new QwtPlotIntervalCurve(tr("Wind"));
|
||||||
windCurve->setYAxis(yRight);
|
windCurve->setYAxis(yRight);
|
||||||
@@ -302,17 +306,17 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context):
|
|||||||
torqueCurve->setYAxis(yRight);
|
torqueCurve->setYAxis(yRight);
|
||||||
|
|
||||||
balanceLCurve = new QwtPlotCurve(tr("Left Balance"));
|
balanceLCurve = new QwtPlotCurve(tr("Left Balance"));
|
||||||
balanceLCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
balanceLCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
|
|
||||||
balanceRCurve = new QwtPlotCurve(tr("Right Balance"));
|
balanceRCurve = new QwtPlotCurve(tr("Right Balance"));
|
||||||
balanceRCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
balanceRCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
|
|
||||||
wCurve = new QwtPlotCurve(tr("W' Balance (j)"));
|
wCurve = new QwtPlotCurve(tr("W' Balance (j)"));
|
||||||
wCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 3));
|
wCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 2));
|
||||||
|
|
||||||
mCurve = new QwtPlotCurve(tr("Matches"));
|
mCurve = new QwtPlotCurve(tr("Matches"));
|
||||||
mCurve->setStyle(QwtPlotCurve::Dots);
|
mCurve->setStyle(QwtPlotCurve::Dots);
|
||||||
mCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 3));
|
mCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 2));
|
||||||
|
|
||||||
curveTitle.attach(this);
|
curveTitle.attach(this);
|
||||||
curveTitle.setLabelAlignment(Qt::AlignRight);
|
curveTitle.setLabelAlignment(Qt::AlignRight);
|
||||||
@@ -333,9 +337,9 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context):
|
|||||||
plotLayout()->setAlignCanvasToScales(true);
|
plotLayout()->setAlignCanvasToScales(true);
|
||||||
setAxisMaxMinor(xBottom, 0);
|
setAxisMaxMinor(xBottom, 0);
|
||||||
setAxisMaxMinor(yLeft, 0);
|
setAxisMaxMinor(yLeft, 0);
|
||||||
setAxisMaxMinor(QwtAxisId(QwtAxis::yLeft, 2), 0);
|
setAxisMaxMinor(QwtAxisId(QwtAxis::yLeft, 1), 0);
|
||||||
setAxisMaxMinor(yRight, 0);
|
setAxisMaxMinor(yRight, 0);
|
||||||
setAxisMaxMinor(QwtAxisId(QwtAxis::yRight, 2), 0);
|
setAxisMaxMinor(QwtAxisId(QwtAxis::yRight, 1), 0);
|
||||||
|
|
||||||
axisWidget(QwtPlot::yLeft)->installEventFilter(this);
|
axisWidget(QwtPlot::yLeft)->installEventFilter(this);
|
||||||
|
|
||||||
@@ -524,10 +528,10 @@ AllPlot::configChanged()
|
|||||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
||||||
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
||||||
setAxisScaleDraw(QwtAxisId(QwtAxis::yLeft, 2), sd);
|
setAxisScaleDraw(QwtAxisId(QwtAxis::yLeft, 1), sd);
|
||||||
pal.setColor(QPalette::WindowText, GColor(CHEARTRATE));
|
pal.setColor(QPalette::WindowText, GColor(CHEARTRATE));
|
||||||
pal.setColor(QPalette::Text, GColor(CHEARTRATE));
|
pal.setColor(QPalette::Text, GColor(CHEARTRATE));
|
||||||
axisWidget(QwtAxisId(QwtAxis::yLeft, 2))->setPalette(pal);
|
axisWidget(QwtAxisId(QwtAxis::yLeft, 1))->setPalette(pal);
|
||||||
|
|
||||||
sd = new QwtScaleDraw;
|
sd = new QwtScaleDraw;
|
||||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
@@ -542,20 +546,20 @@ AllPlot::configChanged()
|
|||||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
||||||
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
||||||
setAxisScaleDraw(QwtAxisId(QwtAxis::yRight, 2), sd);
|
setAxisScaleDraw(QwtAxisId(QwtAxis::yRight, 1), sd);
|
||||||
pal.setColor(QPalette::WindowText, GColor(CALTITUDE));
|
pal.setColor(QPalette::WindowText, GColor(CALTITUDE));
|
||||||
pal.setColor(QPalette::Text, GColor(CALTITUDE));
|
pal.setColor(QPalette::Text, GColor(CALTITUDE));
|
||||||
axisWidget(QwtAxisId(QwtAxis::yRight, 2))->setPalette(pal);
|
axisWidget(QwtAxisId(QwtAxis::yRight, 1))->setPalette(pal);
|
||||||
|
|
||||||
sd = new QwtScaleDraw;
|
sd = new QwtScaleDraw;
|
||||||
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
||||||
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
||||||
sd->setLabelRotation(90);// in the 000s
|
sd->setLabelRotation(90);// in the 000s
|
||||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
setAxisScaleDraw(QwtAxisId(QwtAxis::yRight, 3), sd);
|
setAxisScaleDraw(QwtAxisId(QwtAxis::yRight, 2), sd);
|
||||||
pal.setColor(QPalette::WindowText, GColor(CWBAL));
|
pal.setColor(QPalette::WindowText, GColor(CWBAL));
|
||||||
pal.setColor(QPalette::Text, GColor(CWBAL));
|
pal.setColor(QPalette::Text, GColor(CWBAL));
|
||||||
axisWidget(QwtAxisId(QwtAxis::yRight, 3))->setPalette(pal);
|
axisWidget(QwtAxisId(QwtAxis::yRight, 2))->setPalette(pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DataPoint {
|
struct DataPoint {
|
||||||
@@ -914,7 +918,7 @@ AllPlot::recalc()
|
|||||||
|
|
||||||
if (!hrArray.empty()) {
|
if (!hrArray.empty()) {
|
||||||
hrCurve->setSamples(xaxis.data() + startingIndex, smoothHr.data() + startingIndex, totalPoints);
|
hrCurve->setSamples(xaxis.data() + startingIndex, smoothHr.data() + startingIndex, totalPoints);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!speedArray.empty()) {
|
if (!speedArray.empty()) {
|
||||||
@@ -924,12 +928,12 @@ AllPlot::recalc()
|
|||||||
|
|
||||||
if (!cadArray.empty()) {
|
if (!cadArray.empty()) {
|
||||||
cadCurve->setSamples(xaxis.data() + startingIndex, smoothCad.data() + startingIndex, totalPoints);
|
cadCurve->setSamples(xaxis.data() + startingIndex, smoothCad.data() + startingIndex, totalPoints);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!altArray.empty()) {
|
if (!altArray.empty()) {
|
||||||
altCurve->setSamples(xaxis.data() + startingIndex, smoothAltitude.data() + startingIndex, totalPoints);
|
altCurve->setSamples(xaxis.data() + startingIndex, smoothAltitude.data() + startingIndex, totalPoints);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tempArray.empty()) {
|
if (!tempArray.empty()) {
|
||||||
@@ -937,7 +941,7 @@ AllPlot::recalc()
|
|||||||
if (context->athlete->useMetricUnits)
|
if (context->athlete->useMetricUnits)
|
||||||
intervalHighlighterCurve->setYAxis(yRight);
|
intervalHighlighterCurve->setYAxis(yRight);
|
||||||
else
|
else
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -953,9 +957,9 @@ AllPlot::recalc()
|
|||||||
|
|
||||||
if (!balanceArray.empty()) {
|
if (!balanceArray.empty()) {
|
||||||
balanceLCurve->setSamples(xaxis.data() + startingIndex, smoothBalanceL.data() + startingIndex, totalPoints);
|
balanceLCurve->setSamples(xaxis.data() + startingIndex, smoothBalanceL.data() + startingIndex, totalPoints);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
balanceRCurve->setSamples(xaxis.data() + startingIndex, smoothBalanceR.data() + startingIndex, totalPoints);
|
balanceRCurve->setSamples(xaxis.data() + startingIndex, smoothBalanceR.data() + startingIndex, totalPoints);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
setYMax();
|
setYMax();
|
||||||
@@ -964,7 +968,7 @@ AllPlot::recalc()
|
|||||||
refreshCalibrationMarkers();
|
refreshCalibrationMarkers();
|
||||||
refreshZoneLabels();
|
refreshZoneLabels();
|
||||||
|
|
||||||
//replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1118,9 +1122,9 @@ AllPlot::setYMax()
|
|||||||
// set axis scales
|
// set axis scales
|
||||||
if (wCurve->isVisible()) {
|
if (wCurve->isVisible()) {
|
||||||
|
|
||||||
setAxisTitle(QwtAxisId(QwtAxis::yRight, 3).id, tr("W' Balance (j)"));
|
setAxisTitle(QwtAxisId(QwtAxis::yRight, 2).id, tr("W' Balance (j)"));
|
||||||
setAxisScale(QwtAxisId(QwtAxis::yRight, 3),parent->wpData->minY-1000,parent->wpData->maxY+1000);
|
setAxisScale(QwtAxisId(QwtAxis::yRight, 2),parent->wpData->minY-1000,parent->wpData->maxY+1000);
|
||||||
setAxisLabelAlignment(QwtAxisId(QwtAxis::yRight, 3),Qt::AlignVCenter);
|
setAxisLabelAlignment(QwtAxisId(QwtAxis::yRight, 2),Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wattsCurve->isVisible()) {
|
if (wattsCurve->isVisible()) {
|
||||||
@@ -1203,8 +1207,8 @@ AllPlot::setYMax()
|
|||||||
for (int i=0;i<ymax;i+=step)
|
for (int i=0;i<ymax;i+=step)
|
||||||
xytick[QwtScaleDiv::MajorTick]<<i;
|
xytick[QwtScaleDiv::MajorTick]<<i;
|
||||||
|
|
||||||
setAxisTitle(QwtAxisId(QwtAxis::yLeft, 2).id, labels.join(" / "));
|
setAxisTitle(QwtAxisId(QwtAxis::yLeft, 1).id, labels.join(" / "));
|
||||||
setAxisScaleDiv(QwtAxisId(QwtAxis::yLeft, 2),QwtScaleDiv(ymin, ymax, xytick));
|
setAxisScaleDiv(QwtAxisId(QwtAxis::yLeft, 1),QwtScaleDiv(ymin, ymax, xytick));
|
||||||
//setAxisLabelAlignment(yLeft2,Qt::AlignVCenter);
|
//setAxisLabelAlignment(yLeft2,Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
if (speedCurve->isVisible() || (context->athlete->useMetricUnits && tempCurve->isVisible()) || torqueCurve->isVisible()) {
|
if (speedCurve->isVisible() || (context->athlete->useMetricUnits && tempCurve->isVisible()) || torqueCurve->isVisible()) {
|
||||||
@@ -1247,7 +1251,7 @@ AllPlot::setYMax()
|
|||||||
//setAxisLabelAlignment(yRight,Qt::AlignVCenter);
|
//setAxisLabelAlignment(yRight,Qt::AlignVCenter);
|
||||||
}
|
}
|
||||||
if (altCurve->isVisible()) {
|
if (altCurve->isVisible()) {
|
||||||
setAxisTitle(QwtAxisId(QwtAxis::yRight, 2).id, context->athlete->useMetricUnits ? tr("Meters") : tr("Feet"));
|
setAxisTitle(QwtAxisId(QwtAxis::yRight, 1).id, context->athlete->useMetricUnits ? tr("Meters") : tr("Feet"));
|
||||||
double ymin,ymax;
|
double ymin,ymax;
|
||||||
|
|
||||||
if (referencePlot == NULL) {
|
if (referencePlot == NULL) {
|
||||||
@@ -1274,16 +1278,22 @@ AllPlot::setYMax()
|
|||||||
xytick[QwtScaleDiv::MajorTick]<<i;
|
xytick[QwtScaleDiv::MajorTick]<<i;
|
||||||
|
|
||||||
//setAxisScale(QwtAxisId(QwtAxis::yRight, 2), ymin, ymax);
|
//setAxisScale(QwtAxisId(QwtAxis::yRight, 2), ymin, ymax);
|
||||||
setAxisScaleDiv(QwtAxisId(QwtAxis::yRight, 2),QwtScaleDiv(ymin,ymax,xytick));
|
setAxisScaleDiv(QwtAxisId(QwtAxis::yRight, 1),QwtScaleDiv(ymin,ymax,xytick));
|
||||||
//setAxisLabelAlignment(QwtAxisId(QwtAxis::yRight, 2),Qt::AlignVCenter);
|
//setAxisLabelAlignment(QwtAxisId(QwtAxis::yRight, 2),Qt::AlignVCenter);
|
||||||
altCurve->setBaseline(ymin);
|
altCurve->setBaseline(ymin);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableAxis(yLeft, wattsCurve->isVisible() || npCurve->isVisible() || xpCurve->isVisible() || apCurve->isVisible());
|
enableAxis(yLeft, wattsCurve->isVisible() || npCurve->isVisible() || xpCurve->isVisible() || apCurve->isVisible());
|
||||||
enableAxis(QwtAxisId(QwtAxis::yLeft, 2).id, hrCurve->isVisible() || cadCurve->isVisible());
|
enableAxis(QwtAxisId(QwtAxis::yLeft, 1).id, hrCurve->isVisible() || cadCurve->isVisible());
|
||||||
enableAxis(yRight, speedCurve->isVisible());
|
enableAxis(yRight, speedCurve->isVisible());
|
||||||
enableAxis(QwtAxisId(QwtAxis::yRight, 2).id, altCurve->isVisible());
|
enableAxis(QwtAxisId(QwtAxis::yRight, 1).id, altCurve->isVisible());
|
||||||
enableAxis(QwtAxisId(QwtAxis::yRight, 3).id, wCurve->isVisible());
|
enableAxis(QwtAxisId(QwtAxis::yRight, 2).id, wCurve->isVisible());
|
||||||
|
|
||||||
|
setAxisVisible(yLeft, wattsCurve->isVisible() || npCurve->isVisible() || xpCurve->isVisible() || apCurve->isVisible());
|
||||||
|
setAxisVisible(QwtAxisId(QwtAxis::yLeft, 1).id, hrCurve->isVisible() || cadCurve->isVisible());
|
||||||
|
setAxisVisible(yRight, speedCurve->isVisible());
|
||||||
|
setAxisVisible(QwtAxisId(QwtAxis::yRight, 1).id, altCurve->isVisible());
|
||||||
|
setAxisVisible(QwtAxisId(QwtAxis::yRight, 2).id, wCurve->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1444,19 +1454,138 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
|
|||||||
sym->setStyle(QwtSymbol::NoSymbol);
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
sym->setSize(0);
|
sym->setSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
wCurve->setSymbol(sym);
|
wCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
wattsCurve->setSymbol(sym);
|
wattsCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
npCurve->setSymbol(sym);
|
npCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
xpCurve->setSymbol(sym);
|
xpCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
apCurve->setSymbol(sym);
|
apCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
hrCurve->setSymbol(sym);
|
hrCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
speedCurve->setSymbol(sym);
|
speedCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
cadCurve->setSymbol(sym);
|
cadCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
altCurve->setSymbol(sym);
|
altCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
tempCurve->setSymbol(sym);
|
tempCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
torqueCurve->setSymbol(sym);
|
torqueCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
balanceLCurve->setSymbol(sym);
|
balanceLCurve->setSymbol(sym);
|
||||||
|
|
||||||
|
sym = new QwtSymbol;
|
||||||
|
sym->setPen(QPen(GColor(CPLOTMARKER)));
|
||||||
|
if (stopidx-startidx < 150) {
|
||||||
|
sym->setStyle(QwtSymbol::Ellipse);
|
||||||
|
sym->setSize(3);
|
||||||
|
} else {
|
||||||
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
|
sym->setSize(0);
|
||||||
|
}
|
||||||
balanceRCurve->setSymbol(sym);
|
balanceRCurve->setSymbol(sym);
|
||||||
|
|
||||||
setYMax();
|
setYMax();
|
||||||
@@ -1465,7 +1594,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
|
|||||||
|
|
||||||
if (!plot->smoothAltitude.empty()) {
|
if (!plot->smoothAltitude.empty()) {
|
||||||
altCurve->attach(this);
|
altCurve->attach(this);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yRight, 1));
|
||||||
}
|
}
|
||||||
if (parent->wpData->xdata().count()) {
|
if (parent->wpData->xdata().count()) {
|
||||||
wCurve->attach(this);
|
wCurve->attach(this);
|
||||||
@@ -1489,7 +1618,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
|
|||||||
}
|
}
|
||||||
if (!plot->smoothHr.empty()) {
|
if (!plot->smoothHr.empty()) {
|
||||||
hrCurve->attach(this);
|
hrCurve->attach(this);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
if (!plot->smoothSpeed.empty()) {
|
if (!plot->smoothSpeed.empty()) {
|
||||||
speedCurve->attach(this);
|
speedCurve->attach(this);
|
||||||
@@ -1497,7 +1626,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
|
|||||||
}
|
}
|
||||||
if (!plot->smoothCad.empty()) {
|
if (!plot->smoothCad.empty()) {
|
||||||
cadCurve->attach(this);
|
cadCurve->attach(this);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
if (!plot->smoothTemp.empty()) {
|
if (!plot->smoothTemp.empty()) {
|
||||||
tempCurve->attach(this);
|
tempCurve->attach(this);
|
||||||
@@ -1514,7 +1643,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx)
|
|||||||
if (!plot->smoothBalanceL.empty()) {
|
if (!plot->smoothBalanceL.empty()) {
|
||||||
balanceLCurve->attach(this);
|
balanceLCurve->attach(this);
|
||||||
balanceRCurve->attach(this);
|
balanceRCurve->attach(this);
|
||||||
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 2));
|
intervalHighlighterCurve->setYAxis(QwtAxisId(QwtAxis::yLeft, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <qwt_scale_widget.h>
|
#include <qwt_scale_widget.h>
|
||||||
#include "RideItem.h"
|
#include "RideItem.h"
|
||||||
#include "LogTimeScaleDraw.h"
|
#include "LogTimeScaleDraw.h"
|
||||||
#include "LogTimeScaleEngine.h"
|
|
||||||
#include "RideFile.h"
|
#include "RideFile.h"
|
||||||
#include "Season.h"
|
#include "Season.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
@@ -61,7 +60,7 @@ CpintPlot::CpintPlot(Context *context, QString p, const Zones *zones, bool range
|
|||||||
LogTimeScaleDraw *ld = new LogTimeScaleDraw;
|
LogTimeScaleDraw *ld = new LogTimeScaleDraw;
|
||||||
ld->setTickLength(QwtScaleDiv::MajorTick, 3);
|
ld->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
setAxisScaleDraw(xBottom, ld);
|
setAxisScaleDraw(xBottom, ld);
|
||||||
setAxisScaleEngine(xBottom, new LogTimeScaleEngine);
|
setAxisScaleEngine(xBottom, new QwtLogScaleEngine);
|
||||||
setAxisScale(xBottom, (double)0.017, (double)60);
|
setAxisScale(xBottom, (double)0.017, (double)60);
|
||||||
|
|
||||||
QwtScaleDraw *sd = new QwtScaleDraw;
|
QwtScaleDraw *sd = new QwtScaleDraw;
|
||||||
@@ -150,7 +149,7 @@ CpintPlot::setSeries(RideFile::SeriesType x)
|
|||||||
series = x;
|
series = x;
|
||||||
|
|
||||||
// Log scale for all bar Energy
|
// Log scale for all bar Energy
|
||||||
setAxisScaleEngine(xBottom, new LogTimeScaleEngine);
|
setAxisScaleEngine(xBottom, new QwtLogScaleEngine);
|
||||||
setAxisScaleDraw(xBottom, new LogTimeScaleDraw);
|
setAxisScaleDraw(xBottom, new LogTimeScaleDraw);
|
||||||
setAxisTitle(xBottom, tr("Interval Length"));
|
setAxisTitle(xBottom, tr("Interval Length"));
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ DBAccess::initDatabase(QDir home)
|
|||||||
db->setDatabaseName(home.absolutePath() + "/metricDBv3");
|
db->setDatabaseName(home.absolutePath() + "/metricDBv3");
|
||||||
|
|
||||||
if (!db->database(sessionid).isOpen()) {
|
if (!db->database(sessionid).isOpen()) {
|
||||||
|
|
||||||
QMessageBox::critical(0, qApp->translate("DBAccess","Cannot open database"),
|
QMessageBox::critical(0, qApp->translate("DBAccess","Cannot open database"),
|
||||||
qApp->translate("DBAccess","Unable to establish a database connection.\n"
|
qApp->translate("DBAccess","Unable to establish a database connection.\n"
|
||||||
"This feature requires SQLite support. Please read "
|
"This feature requires SQLite support. Please read "
|
||||||
@@ -156,6 +157,7 @@ bool DBAccess::createMetricsTable()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need to create it!
|
// we need to create it!
|
||||||
if (rc && createTables) {
|
if (rc && createTables) {
|
||||||
QString createMetricTable = "create table metrics (filename varchar primary key,"
|
QString createMetricTable = "create table metrics (filename varchar primary key,"
|
||||||
@@ -293,6 +295,7 @@ bool DBAccess::createDatabase()
|
|||||||
|
|
||||||
void DBAccess::checkDBVersion()
|
void DBAccess::checkDBVersion()
|
||||||
{
|
{
|
||||||
|
|
||||||
// get a CRC for metadata.xml
|
// get a CRC for metadata.xml
|
||||||
QString metadataXML = QString(context->athlete->home.absolutePath()) + "/metadata.xml";
|
QString metadataXML = QString(context->athlete->home.absolutePath()) + "/metadata.xml";
|
||||||
int metadatacrcnow = computeFileCRC(metadataXML);
|
int metadatacrcnow = computeFileCRC(metadataXML);
|
||||||
@@ -334,21 +337,25 @@ void DBAccess::checkDBVersion()
|
|||||||
bool dropMeasures = false;
|
bool dropMeasures = false;
|
||||||
|
|
||||||
while (query.next()) {
|
while (query.next()) {
|
||||||
|
|
||||||
QString table_name = query.value(0).toString();
|
QString table_name = query.value(0).toString();
|
||||||
int currentversion = query.value(1).toInt();
|
int currentversion = query.value(1).toInt();
|
||||||
//int creationdate = query.value(2).toInt(); // not relevant anymore, we use version/crc
|
//int creationdate = query.value(2).toInt(); // not relevant anymore, we use version/crc
|
||||||
int crc = query.value(3).toInt();
|
int crc = query.value(3).toInt();
|
||||||
|
|
||||||
if (table_name == "metrics" && (currentversion != DBSchemaVersion || crc != metadatacrcnow)) {
|
if (table_name == "metrics" && (currentversion != DBSchemaVersion || crc != metadatacrcnow)) {
|
||||||
|
|
||||||
dropMetric = true;
|
dropMetric = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (table_name == "measures" && crc != measurescrcnow) {
|
if (table_name == "measures" && crc != measurescrcnow) {
|
||||||
|
|
||||||
dropMeasures = true;
|
dropMeasures = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
query.finish();
|
query.finish();
|
||||||
|
|
||||||
|
|
||||||
// "metrics" table, is it up-to-date?
|
// "metrics" table, is it up-to-date?
|
||||||
if (dropMetric) {
|
if (dropMetric) {
|
||||||
dropMetricTable();
|
dropMetricTable();
|
||||||
@@ -540,6 +547,7 @@ DBAccess::getRide(QString filename, SummaryMetrics &summaryMetrics, QColor&color
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
query.finish();
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,10 +574,12 @@ QList<SummaryMetrics> DBAccess::getAllMetricsFor(QDateTime start, QDateTime end)
|
|||||||
" ORDER BY ride_date;";
|
" ORDER BY ride_date;";
|
||||||
|
|
||||||
// execute the select statement
|
// execute the select statement
|
||||||
QSqlQuery query(selectStatement, db->database(sessionid));
|
QSqlQuery query(db->database(sessionid));
|
||||||
|
query.prepare(selectStatement);
|
||||||
query.bindValue(":start", start.date());
|
query.bindValue(":start", start.date());
|
||||||
query.bindValue(":end", end.date());
|
query.bindValue(":end", end.date());
|
||||||
query.exec();
|
query.exec();
|
||||||
|
|
||||||
while(query.next())
|
while(query.next())
|
||||||
{
|
{
|
||||||
SummaryMetrics summaryMetrics;
|
SummaryMetrics summaryMetrics;
|
||||||
@@ -612,11 +622,13 @@ SummaryMetrics DBAccess::getRideMetrics(QString filename)
|
|||||||
selectStatement += QString(", Z%1 ").arg(context->specialFields.makeTechName(field.name));
|
selectStatement += QString(", Z%1 ").arg(context->specialFields.makeTechName(field.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectStatement += " FROM metrics where filename == :filename ;";
|
selectStatement += " FROM metrics WHERE filename = :filename ;";
|
||||||
|
|
||||||
// execute the select statement
|
// execute the select statement
|
||||||
QSqlQuery query(selectStatement, db->database(sessionid));
|
QSqlQuery query(db->database(sessionid));
|
||||||
query.bindValue(":filename", filename);
|
query.prepare(selectStatement);
|
||||||
|
query.bindValue(":filename", QVariant(filename));
|
||||||
|
|
||||||
query.exec();
|
query.exec();
|
||||||
while(query.next())
|
while(query.next())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include <qwt_series_data.h>
|
#include <qwt_series_data.h>
|
||||||
|
#include <qwt_scale_widget.h>
|
||||||
#include <qwt_legend.h>
|
#include <qwt_legend.h>
|
||||||
#include <qwt_plot_curve.h>
|
#include <qwt_plot_curve.h>
|
||||||
#include <qwt_curve_fitter.h>
|
#include <qwt_curve_fitter.h>
|
||||||
@@ -42,17 +43,43 @@
|
|||||||
|
|
||||||
#include <math.h> // for isinf() isnan()
|
#include <math.h> // for isinf() isnan()
|
||||||
|
|
||||||
static int supported_axes[] = { QwtPlot::yLeft,
|
|
||||||
QwtPlot::yRight,
|
|
||||||
QwtAxisId(QwtAxis::yLeft,2).id,
|
|
||||||
QwtAxisId(QwtAxis::yRight,2).id,
|
|
||||||
QwtAxisId(QwtAxis::yLeft,3).id,
|
|
||||||
QwtAxisId(QwtAxis::yRight,3).id
|
|
||||||
};
|
|
||||||
|
|
||||||
LTMPlot::LTMPlot(LTMWindow *parent, Context *context) :
|
LTMPlot::LTMPlot(LTMWindow *parent, Context *context) :
|
||||||
bg(NULL), parent(parent), context(context), highlighter(NULL)
|
bg(NULL), parent(parent), context(context), highlighter(NULL)
|
||||||
{
|
{
|
||||||
|
// don't do this ..
|
||||||
|
setAutoReplot(false);
|
||||||
|
|
||||||
|
// setup my axes
|
||||||
|
// for now we limit to 4 on left and 4 on right
|
||||||
|
setAxesCount(QwtAxis::yLeft, 2);
|
||||||
|
setAxesCount(QwtAxis::yRight, 2);
|
||||||
|
|
||||||
|
int n=0;
|
||||||
|
for (int i=0; i<2; i++) {
|
||||||
|
|
||||||
|
// lefts
|
||||||
|
supported_axes[n++] = QwtAxisId(QwtAxis::yLeft, i).id;
|
||||||
|
|
||||||
|
QwtScaleDraw *sd = new QwtScaleDraw;
|
||||||
|
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
|
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
||||||
|
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
||||||
|
setAxisScaleDraw(supported_axes[n], sd);
|
||||||
|
setAxisMaxMinor(supported_axes[n], 0);
|
||||||
|
setAxisVisible(supported_axes[n], false);
|
||||||
|
|
||||||
|
// lefts
|
||||||
|
supported_axes[n++] = QwtAxisId(QwtAxis::yLeft, i).id;
|
||||||
|
|
||||||
|
sd = new QwtScaleDraw;
|
||||||
|
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
||||||
|
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
||||||
|
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
||||||
|
setAxisScaleDraw(supported_axes[n], sd);
|
||||||
|
setAxisMaxMinor(supported_axes[n], 0);
|
||||||
|
setAxisVisible(supported_axes[n], false);
|
||||||
|
}
|
||||||
|
|
||||||
// get application settings
|
// get application settings
|
||||||
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
|
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
|
||||||
setAxisTitle(yLeft, tr(""));
|
setAxisTitle(yLeft, tr(""));
|
||||||
@@ -163,7 +190,11 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// disable all y axes until we have populated
|
// disable all y axes until we have populated
|
||||||
for (int i=0; i<8; i++) enableAxis(supported_axes[i], false);
|
for (int i=0; i<4; i++) {
|
||||||
|
setAxisVisible(supported_axes[i], false);
|
||||||
|
enableAxis(supported_axes[i], false);
|
||||||
|
axisWidget(supported_axes[i])->hide();
|
||||||
|
}
|
||||||
axes.clear();
|
axes.clear();
|
||||||
|
|
||||||
// reset all min/max Y values
|
// reset all min/max Y values
|
||||||
@@ -296,9 +327,6 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
current->setPen(cpen);
|
current->setPen(cpen);
|
||||||
current->setStyle(metricDetail.curveStyle);
|
current->setStyle(metricDetail.curveStyle);
|
||||||
|
|
||||||
QwtSymbol *sym = new QwtSymbol;
|
|
||||||
sym->setStyle(metricDetail.symbolStyle);
|
|
||||||
|
|
||||||
// choose the axis
|
// choose the axis
|
||||||
int axisid = chooseYAxis(metricDetail.uunits);
|
int axisid = chooseYAxis(metricDetail.uunits);
|
||||||
current->setYAxis(axisid);
|
current->setYAxis(axisid);
|
||||||
@@ -345,6 +373,7 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
current->setPen(QPen(Qt::NoPen));
|
current->setPen(QPen(Qt::NoPen));
|
||||||
current->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
current->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
||||||
|
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
sym->setStyle(QwtSymbol::NoSymbol);
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
current->setSymbol(sym);
|
current->setSymbol(sym);
|
||||||
|
|
||||||
@@ -443,9 +472,6 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
current->setPen(cpen);
|
current->setPen(cpen);
|
||||||
current->setStyle(metricDetail.curveStyle);
|
current->setStyle(metricDetail.curveStyle);
|
||||||
|
|
||||||
QwtSymbol *sym = new QwtSymbol;
|
|
||||||
sym->setStyle(metricDetail.symbolStyle);
|
|
||||||
|
|
||||||
// choose the axis
|
// choose the axis
|
||||||
int axisid = chooseYAxis(metricDetail.uunits);
|
int axisid = chooseYAxis(metricDetail.uunits);
|
||||||
current->setYAxis(axisid);
|
current->setYAxis(axisid);
|
||||||
@@ -547,8 +573,11 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
|
|
||||||
// we might have hidden the symbols for this curve
|
// we might have hidden the symbols for this curve
|
||||||
// if its set to none then default to a rectangle
|
// if its set to none then default to a rectangle
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
if (metricDetail.symbolStyle == QwtSymbol::NoSymbol)
|
if (metricDetail.symbolStyle == QwtSymbol::NoSymbol)
|
||||||
sym->setStyle(QwtSymbol::Rect);
|
sym->setStyle(QwtSymbol::Rect);
|
||||||
|
else
|
||||||
|
sym->setStyle(metricDetail.symbolStyle);
|
||||||
sym->setSize(20);
|
sym->setSize(20);
|
||||||
QColor lighter = metricDetail.penColor;
|
QColor lighter = metricDetail.penColor;
|
||||||
lighter.setAlpha(50);
|
lighter.setAlpha(50);
|
||||||
@@ -610,8 +639,11 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
|
|
||||||
// we might have hidden the symbols for this curve
|
// we might have hidden the symbols for this curve
|
||||||
// if its set to none then default to a rectangle
|
// if its set to none then default to a rectangle
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
if (metricDetail.symbolStyle == QwtSymbol::NoSymbol)
|
if (metricDetail.symbolStyle == QwtSymbol::NoSymbol)
|
||||||
sym->setStyle(QwtSymbol::Rect);
|
sym->setStyle(QwtSymbol::Rect);
|
||||||
|
else
|
||||||
|
sym->setStyle(metricDetail.symbolStyle);
|
||||||
sym->setSize(12);
|
sym->setSize(12);
|
||||||
QColor lighter = metricDetail.penColor;
|
QColor lighter = metricDetail.penColor;
|
||||||
lighter.setAlpha(200);
|
lighter.setAlpha(200);
|
||||||
@@ -638,6 +670,7 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
current->setPen(QPen(Qt::NoPen));
|
current->setPen(QPen(Qt::NoPen));
|
||||||
current->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
current->setCurveAttribute(QwtPlotCurve::Inverted, true);
|
||||||
|
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
sym->setStyle(QwtSymbol::NoSymbol);
|
sym->setStyle(QwtSymbol::NoSymbol);
|
||||||
current->setSymbol(sym);
|
current->setSymbol(sym);
|
||||||
|
|
||||||
@@ -689,6 +722,7 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
|
|
||||||
QPen cpen = QPen(metricDetail.penColor);
|
QPen cpen = QPen(metricDetail.penColor);
|
||||||
cpen.setWidth(width);
|
cpen.setWidth(width);
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
sym->setSize(6);
|
sym->setSize(6);
|
||||||
sym->setStyle(metricDetail.symbolStyle);
|
sym->setStyle(metricDetail.symbolStyle);
|
||||||
sym->setPen(QPen(metricDetail.penColor));
|
sym->setPen(QPen(metricDetail.penColor));
|
||||||
@@ -705,6 +739,8 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
|
|
||||||
|
|
||||||
} else if (metricDetail.curveStyle == QwtPlotCurve::Dots) {
|
} else if (metricDetail.curveStyle == QwtPlotCurve::Dots) {
|
||||||
|
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
sym->setSize(6);
|
sym->setSize(6);
|
||||||
sym->setStyle(metricDetail.symbolStyle);
|
sym->setStyle(metricDetail.symbolStyle);
|
||||||
sym->setPen(QPen(metricDetail.penColor));
|
sym->setPen(QPen(metricDetail.penColor));
|
||||||
@@ -713,6 +749,7 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
|
|
||||||
} else if (metricDetail.curveStyle == QwtPlotCurve::Sticks) {
|
} else if (metricDetail.curveStyle == QwtPlotCurve::Sticks) {
|
||||||
|
|
||||||
|
QwtSymbol *sym = new QwtSymbol;
|
||||||
sym->setSize(4);
|
sym->setSize(4);
|
||||||
sym->setStyle(metricDetail.symbolStyle);
|
sym->setStyle(metricDetail.symbolStyle);
|
||||||
sym->setPen(QPen(metricDetail.penColor));
|
sym->setPen(QPen(metricDetail.penColor));
|
||||||
@@ -780,8 +817,8 @@ LTMPlot::setData(LTMSettings *set)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString format = axisTitle(yLeft).text();
|
QString format = axisTitle(yLeft).text();
|
||||||
parent->toolTip()->setAxes(xBottom, yLeft);
|
//XXX parent->toolTip()->setAxes(xBottom, yLeft);
|
||||||
parent->toolTip()->setFormat(format);
|
//XXX parent->toolTip()->setFormat(format);
|
||||||
|
|
||||||
// draw zone labels axisid of -1 means delete whats there
|
// draw zone labels axisid of -1 means delete whats there
|
||||||
// cause no watts are being displayed
|
// cause no watts are being displayed
|
||||||
@@ -901,7 +938,7 @@ LTMPlot::createCurveData(LTMSettings *settings, MetricDetail metricDetail, QVect
|
|||||||
int lastDay=0;
|
int lastDay=0;
|
||||||
unsigned long secondsPerGroupBy=0;
|
unsigned long secondsPerGroupBy=0;
|
||||||
bool wantZero = (metricDetail.curveStyle == QwtPlotCurve::Steps);
|
bool wantZero = (metricDetail.curveStyle == QwtPlotCurve::Steps);
|
||||||
foreach (SummaryMetrics rideMetrics, *data) {
|
foreach (SummaryMetrics rideMetrics, *data) {
|
||||||
|
|
||||||
// filter out unwanted rides but not for PMC type metrics
|
// filter out unwanted rides but not for PMC type metrics
|
||||||
// because that needs to be done in the stress calculator
|
// because that needs to be done in the stress calculator
|
||||||
@@ -1094,18 +1131,14 @@ LTMPlot::chooseYAxis(QString units)
|
|||||||
|
|
||||||
// return the YAxis to use
|
// return the YAxis to use
|
||||||
if ((chosen = axes.value(units, -1)) != -1) return chosen;
|
if ((chosen = axes.value(units, -1)) != -1) return chosen;
|
||||||
else if (axes.count() < 8) {
|
else if (axes.count() < 4) {
|
||||||
chosen = supported_axes[axes.count()];
|
chosen = supported_axes[axes.count()];
|
||||||
if (units == "seconds" || units == tr("seconds")) setAxisTitle(chosen, tr("hours")); // we convert seconds to hours
|
if (units == "seconds" || units == tr("seconds")) setAxisTitle(chosen, tr("hours")); // we convert seconds to hours
|
||||||
else setAxisTitle(chosen, units);
|
else setAxisTitle(chosen, units);
|
||||||
enableAxis(chosen, true);
|
enableAxis(chosen, true);
|
||||||
|
setAxisVisible(chosen, true);
|
||||||
|
axisWidget(chosen)->show();
|
||||||
axes.insert(units, chosen);
|
axes.insert(units, chosen);
|
||||||
QwtScaleDraw *sd = new QwtScaleDraw;
|
|
||||||
sd->setTickLength(QwtScaleDiv::MajorTick, 3);
|
|
||||||
sd->enableComponent(QwtScaleDraw::Ticks, false);
|
|
||||||
sd->enableComponent(QwtScaleDraw::Backbone, false);
|
|
||||||
setAxisScaleDraw(chosen, sd);
|
|
||||||
setAxisMaxMinor(chosen, 0);
|
|
||||||
return chosen;
|
return chosen;
|
||||||
} else {
|
} else {
|
||||||
// eek!
|
// eek!
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <qwt_plot_curve.h>
|
#include <qwt_plot_curve.h>
|
||||||
#include <qwt_plot_grid.h>
|
#include <qwt_plot_grid.h>
|
||||||
#include <qwt_scale_draw.h>
|
#include <qwt_scale_draw.h>
|
||||||
|
#include <qwt_axis_id.h>
|
||||||
|
|
||||||
#include "LTMTool.h"
|
#include "LTMTool.h"
|
||||||
#include "LTMSettings.h"
|
#include "LTMSettings.h"
|
||||||
@@ -102,6 +103,8 @@ class LTMPlot : public QwtPlot
|
|||||||
// remember the coggan or skiba stress calculators
|
// remember the coggan or skiba stress calculators
|
||||||
// so it isn't recalculated for each data series!
|
// so it isn't recalculated for each data series!
|
||||||
StressCalculator *cogganPMC, *skibaPMC;
|
StressCalculator *cogganPMC, *skibaPMC;
|
||||||
|
|
||||||
|
int supported_axes[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Produce Labels for X-Axis
|
// Produce Labels for X-Axis
|
||||||
|
|||||||
@@ -128,6 +128,9 @@ LTMSettings::readChartXML(QDir home, QList<LTMSettings> &charts)
|
|||||||
*----------------------------------------------------------------------*/
|
*----------------------------------------------------------------------*/
|
||||||
QDataStream &operator<<(QDataStream &out, const LTMSettings &settings)
|
QDataStream &operator<<(QDataStream &out, const LTMSettings &settings)
|
||||||
{
|
{
|
||||||
|
// 4.6 - 4.9 all the same
|
||||||
|
out.setVersion(QDataStream::Qt_4_9);
|
||||||
|
|
||||||
// all the baisc fields first
|
// all the baisc fields first
|
||||||
out<<settings.name;
|
out<<settings.name;
|
||||||
out<<settings.title;
|
out<<settings.title;
|
||||||
@@ -176,6 +179,9 @@ QDataStream &operator<<(QDataStream &out, const LTMSettings &settings)
|
|||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, LTMSettings &settings)
|
QDataStream &operator>>(QDataStream &in, LTMSettings &settings)
|
||||||
{
|
{
|
||||||
|
// 4.6 - 4.9 all the same
|
||||||
|
in.setVersion(QDataStream::Qt_4_9);
|
||||||
|
|
||||||
RideMetricFactory &factory = RideMetricFactory::instance();
|
RideMetricFactory &factory = RideMetricFactory::instance();
|
||||||
int counter=0;
|
int counter=0;
|
||||||
int version=0;
|
int version=0;
|
||||||
@@ -198,8 +204,7 @@ QDataStream &operator>>(QDataStream &in, LTMSettings &settings)
|
|||||||
in>>version;
|
in>>version;
|
||||||
in>>counter;
|
in>>counter;
|
||||||
}
|
}
|
||||||
|
while(counter-- && !in.atEnd()) {
|
||||||
while(counter--) {
|
|
||||||
MetricDetail m;
|
MetricDetail m;
|
||||||
in>>m.type;
|
in>>m.type;
|
||||||
in>>m.stack;
|
in>>m.stack;
|
||||||
|
|||||||
@@ -118,7 +118,6 @@ class MetricDetail {
|
|||||||
// do this
|
// do this
|
||||||
QDataStream &operator<<(QDataStream &out, const LTMSettings &settings);
|
QDataStream &operator<<(QDataStream &out, const LTMSettings &settings);
|
||||||
QDataStream &operator>>(QDataStream &in, LTMSettings &settings);
|
QDataStream &operator>>(QDataStream &in, LTMSettings &settings);
|
||||||
Q_DECLARE_METATYPE(LTMSettings);
|
|
||||||
|
|
||||||
// used to maintain details about the metrics being plotted
|
// used to maintain details about the metrics being plotted
|
||||||
class LTMSettings {
|
class LTMSettings {
|
||||||
@@ -128,6 +127,8 @@ class LTMSettings {
|
|||||||
LTMSettings() {
|
LTMSettings() {
|
||||||
// we need to register the stream operators
|
// we need to register the stream operators
|
||||||
qRegisterMetaTypeStreamOperators<LTMSettings>("LTMSettings");
|
qRegisterMetaTypeStreamOperators<LTMSettings>("LTMSettings");
|
||||||
|
data = measures = bests = NULL;
|
||||||
|
ltmTool = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeChartXML(QDir, QList<LTMSettings>);
|
void writeChartXML(QDir, QList<LTMSettings>);
|
||||||
@@ -150,6 +151,7 @@ class LTMSettings {
|
|||||||
LTMTool *ltmTool;
|
LTMTool *ltmTool;
|
||||||
QString field1, field2;
|
QString field1, field2;
|
||||||
};
|
};
|
||||||
|
Q_DECLARE_METATYPE(LTMSettings);
|
||||||
|
|
||||||
class EditChartDialog : public QDialog
|
class EditChartDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ LTMWindow::LTMWindow(Context *context) :
|
|||||||
popupLayout->addWidget(ltmPopup);
|
popupLayout->addWidget(ltmPopup);
|
||||||
popup->setLayout(popupLayout);
|
popup->setLayout(popupLayout);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// zoomer on the plot
|
// zoomer on the plot
|
||||||
ltmZoomer = new QwtPlotZoomer(ltmPlot->canvas());
|
ltmZoomer = new QwtPlotZoomer(ltmPlot->canvas());
|
||||||
ltmZoomer->setRubberBand(QwtPicker::RectRubberBand);
|
ltmZoomer->setRubberBand(QwtPicker::RectRubberBand);
|
||||||
@@ -120,6 +121,7 @@ LTMWindow::LTMWindow(Context *context) :
|
|||||||
picker->setEnabled(true);
|
picker->setEnabled(true);
|
||||||
|
|
||||||
_canvasPicker = new LTMCanvasPicker(ltmPlot);
|
_canvasPicker = new LTMCanvasPicker(ltmPlot);
|
||||||
|
#endif
|
||||||
|
|
||||||
ltmTool = new LTMTool(context, &settings);
|
ltmTool = new LTMTool(context, &settings);
|
||||||
|
|
||||||
@@ -153,8 +155,8 @@ LTMWindow::LTMWindow(Context *context) :
|
|||||||
connect(context, SIGNAL(filterChanged()), this, SLOT(refresh()));
|
connect(context, SIGNAL(filterChanged()), this, SLOT(refresh()));
|
||||||
|
|
||||||
// connect pickers to ltmPlot
|
// connect pickers to ltmPlot
|
||||||
connect(_canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), ltmPlot, SLOT(pointHover(QwtPlotCurve*, int)));
|
//XXX connect(_canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), ltmPlot, SLOT(pointHover(QwtPlotCurve*, int)));
|
||||||
connect(_canvasPicker, SIGNAL(pointClicked(QwtPlotCurve*, int)), ltmPlot, SLOT(pointClicked(QwtPlotCurve*, int)));
|
//XXX connect(_canvasPicker, SIGNAL(pointClicked(QwtPlotCurve*, int)), ltmPlot, SLOT(pointClicked(QwtPlotCurve*, int)));
|
||||||
|
|
||||||
connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void)));
|
connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void)));
|
||||||
connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void)));
|
connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void)));
|
||||||
|
|||||||
@@ -48,7 +48,24 @@ struct tick_info_t {
|
|||||||
char *label;
|
char *label;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern tick_info_t tick_info[];
|
static tick_info_t tick_info[] = {
|
||||||
|
{ 1.0/60.0, "1s" },
|
||||||
|
{ 5.0/60.0, "5s" },
|
||||||
|
{ 15.0/60.0, "15s" },
|
||||||
|
{ 0.5, "30s" },
|
||||||
|
{ 1.0, "1m" },
|
||||||
|
{ 2.0, "2m" },
|
||||||
|
{ 3.0, "3m" },
|
||||||
|
{ 5.0, "5m" },
|
||||||
|
{ 10.0, "10m" },
|
||||||
|
{ 20.0, "20m" },
|
||||||
|
{ 30.0, "30m" },
|
||||||
|
{ 60.0, "1h" },
|
||||||
|
{ 120.0, "2h" },
|
||||||
|
{ 180.0, "3h" },
|
||||||
|
{ 300.0, "5h" },
|
||||||
|
{ -1.0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
LogTimeScaleDraw::drawLabel(QPainter *painter, double value) const
|
LogTimeScaleDraw::drawLabel(QPainter *painter, double value) const
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ HEADERS += \
|
|||||||
Library.h \
|
Library.h \
|
||||||
LibraryParser.h \
|
LibraryParser.h \
|
||||||
LogTimeScaleDraw.h \
|
LogTimeScaleDraw.h \
|
||||||
LogTimeScaleEngine.h \
|
|
||||||
LTMCanvasPicker.h \
|
LTMCanvasPicker.h \
|
||||||
LTMChartParser.h \
|
LTMChartParser.h \
|
||||||
LTMOutliers.h \
|
LTMOutliers.h \
|
||||||
@@ -502,7 +501,6 @@ SOURCES += \
|
|||||||
Library.cpp \
|
Library.cpp \
|
||||||
LibraryParser.cpp \
|
LibraryParser.cpp \
|
||||||
LogTimeScaleDraw.cpp \
|
LogTimeScaleDraw.cpp \
|
||||||
LogTimeScaleEngine.cpp \
|
|
||||||
LTMCanvasPicker.cpp \
|
LTMCanvasPicker.cpp \
|
||||||
LTMChartParser.cpp \
|
LTMChartParser.cpp \
|
||||||
LTMOutliers.cpp \
|
LTMOutliers.cpp \
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user