Refresh all curve when spikes edited and saved

.. will refresh after the metrics and cpx have been refreshed

.. it invalidates the data rather than refreshing immediately
   since thats expensive and better wait until refresh is needed.
This commit is contained in:
Mark Liversedge
2013-03-29 19:33:43 +00:00
parent 81ecdf8d04
commit 440bbd203f
7 changed files with 31 additions and 11 deletions

View File

@@ -18,6 +18,7 @@
#include "CriticalPowerWindow.h"
#include "SearchFilterBox.h"
#include "MetricAggregator.h"
#include "CpintPlot.h"
#include "MainWindow.h"
#include "RideItem.h"
@@ -192,6 +193,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, b
// redraw on config change -- this seems the simplest approach
connect(mainWindow, SIGNAL(configChanged()), this, SLOT(rideSelected()));
connect(mainWindow->metricDB, SIGNAL(dataChanged()), this, SLOT(refreshRideSaved()));
connect(mainWindow, SIGNAL(rideAdded(RideItem*)), this, SLOT(newRideAdded(RideItem*)));
connect(mainWindow, SIGNAL(rideDeleted(RideItem*)), this, SLOT(newRideAdded(RideItem*)));
connect(seasons, SIGNAL(seasonsChanged()), this, SLOT(resetSeasons()));
@@ -201,6 +203,22 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, MainWindow *parent, b
connect(dateSetting, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
}
void
CriticalPowerWindow::refreshRideSaved()
{
const RideItem *current = mainWindow->rideItem();
if (!current) return;
// if the saved ride is in the aggregated time period
QDate date = current->dateTime.date();
if (date >= cpintPlot->startDate &&
date <= cpintPlot->endDate) {
// force a redraw next time visible
cpintPlot->changeSeason(cpintPlot->startDate, cpintPlot->endDate);
}
}
void
CriticalPowerWindow::newRideAdded(RideItem *here)
{