CP Chart - Add Delta Compare to standard settings

It was available only via reveal controls,
which are disabled in v3.6.
Fixes #4256
This commit is contained in:
Alejandro Martinez
2023-02-07 22:07:57 -03:00
parent 0904ebe1e0
commit 13167e021c
2 changed files with 29 additions and 2 deletions

View File

@@ -271,6 +271,12 @@ CriticalPowerWindow::CriticalPowerWindow(Context *context, bool rangemode) :
showCSLinearLabel = new QLabel(tr("Show time scale linear"));
cl->addRow(showCSLinearLabel, showCSLinearCheck);
showDeltaCheck = new QCheckBox(this);
showDeltaCheck->setText(tr("Delta compare"));
showDeltaPercentCheck = new QCheckBox(this);
showDeltaPercentCheck->setText(tr("as percentage"));
cl->addRow(showDeltaCheck, showDeltaPercentCheck);
ridePlotStyleCombo = new QComboBox(this);
ridePlotStyleCombo->addItem(tr("Activity Mean Max"));
ridePlotStyleCombo->addItem(tr("Activity Centile"));
@@ -580,6 +586,8 @@ CriticalPowerWindow::CriticalPowerWindow(Context *context, bool rangemode) :
connect(rDeltaPercent, SIGNAL(stateChanged(int)), this, SLOT(rDeltaChanged()));
connect(showHeatByDateCheck, SIGNAL(stateChanged(int)), this, SLOT(showHeatByDateChanged(int)));
connect(showPercentCheck, SIGNAL(stateChanged(int)), this, SLOT(showPercentChanged(int)));
connect(showDeltaCheck, SIGNAL(stateChanged(int)), this, SLOT(showDeltaChanged()));
connect(showDeltaPercentCheck, SIGNAL(stateChanged(int)), this, SLOT(showDeltaChanged()));
connect(showPowerIndexCheck, SIGNAL(stateChanged(int)), this, SLOT(showPowerIndexChanged(int)));
connect(showTestCheck, SIGNAL(stateChanged(int)), this, SLOT(showTestChanged(int)));
connect(showBestCheck, SIGNAL(stateChanged(int)), this, SLOT(showBestChanged(int)));
@@ -987,6 +995,7 @@ CriticalPowerWindow::forceReplot()
{
stale = true; // we must become stale
CriticalSeriesType series = static_cast<CriticalSeriesType>(seriesCombo->itemData(seriesCombo->currentIndex()).toInt());
if ((rangemode && context->isCompareDateRanges) || (!rangemode && context->isCompareIntervals)) {
// hide in compare mode
@@ -1000,7 +1009,6 @@ CriticalPowerWindow::forceReplot()
} else {
// show helper if we're showing power
CriticalSeriesType series = static_cast<CriticalSeriesType>(seriesCombo->itemData(seriesCombo->currentIndex()).toInt());
updateOptions(series);
// these are allowed outside of compare mode
@@ -1009,6 +1017,7 @@ CriticalPowerWindow::forceReplot()
rDelta->hide();
rDeltaPercent->hide();
}
cpPlot->setSeries(series); // Update y-axis
if (rangemode) {
@@ -1961,7 +1970,16 @@ CriticalPowerWindow::rHeatChanged(int check)
void
CriticalPowerWindow::rDeltaChanged()
{
cpPlot->setShowDelta(rDelta->isChecked(), rDeltaPercent->isChecked());
showDeltaCheck->setChecked(rDelta->isChecked());
showDeltaPercentCheck->setChecked(rDeltaPercent->isChecked());
}
void
CriticalPowerWindow::showDeltaChanged()
{
rDelta->setChecked(showDeltaCheck->isChecked());
rDeltaPercent->setChecked(showDeltaPercentCheck->isChecked());
cpPlot->setShowDelta(showDeltaCheck->isChecked(), showDeltaPercentCheck->isChecked());
// redraw
if (rangemode) dateRangeChanged(DateRange());

View File

@@ -55,6 +55,8 @@ class CriticalPowerWindow : public GcChartWindow
Q_PROPERTY(bool showTest READ showTest WRITE setShowTest USER true)
Q_PROPERTY(bool filterBest READ filterBest WRITE setFilterBest USER true)
Q_PROPERTY(bool showPercent READ showPercent WRITE setShowPercent USER true)
Q_PROPERTY(bool showDelta READ showDelta WRITE setShowDelta USER true)
Q_PROPERTY(bool showDeltaPercent READ showDeltaPercent WRITE setShowDeltaPercent USER true)
Q_PROPERTY(bool showPowerIndex READ showPowerIndex WRITE setShowPowerIndex USER true)
Q_PROPERTY(bool showGrid READ showGrid WRITE setShowGrid USER true)
@@ -233,6 +235,11 @@ class CriticalPowerWindow : public GcChartWindow
bool showPercent() { return showPercentCheck->isChecked(); }
void setShowPercent(bool x) { return showPercentCheck->setChecked(x); }
bool showDelta() { return showDeltaCheck->isChecked(); }
void setShowDelta(bool x) { return showDeltaCheck->setChecked(x); }
bool showDeltaPercent() { return showDeltaPercentCheck->isChecked(); }
void setShowDeltaPercent(bool x) { return showDeltaPercentCheck->setChecked(x); }
bool showPP() { return showPPCheck->isChecked(); }
void setShowPP(bool x) { return showPPCheck->setChecked(x); }
@@ -252,6 +259,7 @@ class CriticalPowerWindow : public GcChartWindow
void showCSLinearChanged(int state);
void showHeatByDateChanged(int check);
void showPercentChanged(int check);
void showDeltaChanged();
void showPowerIndexChanged(int check);
void showBestChanged(int check);
void showTestChanged(int check);
@@ -328,6 +336,7 @@ class CriticalPowerWindow : public GcChartWindow
QCheckBox *showHeatCheck;
QCheckBox *showHeatByDateCheck;
QCheckBox *showPercentCheck;
QCheckBox *showDeltaCheck, *showDeltaPercentCheck;
QCheckBox *showPowerIndexCheck;
QCheckBox *showBestCheck;
QCheckBox *showTestCheck;