diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 075b9021b..c370cda99 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -430,7 +430,7 @@ AllPlotWindow::AllPlotWindow(MainWindow *mainWindow) : // GC signals //connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected())); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected())); - connect(mainWindow, SIGNAL(rideDirty()), this, SLOT(rideSelected())); + connect(mainWindow, SIGNAL(rideDirty(RideItem*)), this, SLOT(rideSelected())); connect(mainWindow, SIGNAL(zonesChanged()), this, SLOT(zonesChanged())); connect(mainWindow, SIGNAL(intervalsChanged()), this, SLOT(intervalsChanged())); connect(mainWindow, SIGNAL(intervalZoom(IntervalItem*)), this, SLOT(zoomInterval(IntervalItem*))); diff --git a/src/CpintPlot.h b/src/CpintPlot.h index 2ed088f35..fd516c1b6 100644 --- a/src/CpintPlot.h +++ b/src/CpintPlot.h @@ -93,10 +93,12 @@ class CpintPlot : public QwtPlot void setAxisTitle(int axis, QString label); void setSeries(RideFile::SeriesType); - QVector getBests() { return bests->meanMaxArray(series); } QVector getBestDates() { return bests->meanMaxDates(series); } + QDate startDate; + QDate endDate; + public slots: void showGrid(int state); @@ -122,8 +124,6 @@ class CpintPlot : public QwtPlot void clear_CP_Curves(); QStringList filterForSeason(QStringList cpints, QDate startDate, QDate endDate); QwtPlotGrid *grid; - QDate startDate; - QDate endDate; const Zones *zones; int dateCP; RideFile::SeriesType series; diff --git a/src/CriticalPowerWindow.cpp b/src/CriticalPowerWindow.cpp index ce3dd035e..49df2e43c 100644 --- a/src/CriticalPowerWindow.cpp +++ b/src/CriticalPowerWindow.cpp @@ -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) { diff --git a/src/CriticalPowerWindow.h b/src/CriticalPowerWindow.h index 3ba737977..048811ada 100644 --- a/src/CriticalPowerWindow.h +++ b/src/CriticalPowerWindow.h @@ -128,6 +128,8 @@ class CriticalPowerWindow : public GcChartWindow void useStandardRange(); void useThruToday(); + void refreshRideSaved(); + private: // reveal controls QPushButton *rCpintSetCPButton; diff --git a/src/MainWindow.h b/src/MainWindow.h index 59b654b7c..5c5712cd7 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -222,8 +222,8 @@ class MainWindow : public QMainWindow // signal emitted to notify its children void notifyRideSelected(); // used by RideItem to notify when // rideItem date/time changes - void notifyRideClean() { rideClean(); } - void notifyRideDirty() { rideDirty(); } + void notifyRideClean() { rideClean(ride); } + void notifyRideDirty() { rideDirty(ride); } void notifyZonesChanged() { zonesChanged(); } // realtime signals @@ -263,8 +263,8 @@ class MainWindow : public QMainWindow void configChanged(); void rideAdded(RideItem *); void rideDeleted(RideItem *); - void rideDirty(); - void rideClean(); + void rideDirty(RideItem*); + void rideClean(RideItem*); // realtime void telemetryUpdate(RealtimeData rtData); diff --git a/src/MetricAggregator.cpp b/src/MetricAggregator.cpp index 03ae961d6..3e4a294e0 100644 --- a/src/MetricAggregator.cpp +++ b/src/MetricAggregator.cpp @@ -41,7 +41,7 @@ MetricAggregator::MetricAggregator(MainWindow *main, QDir home, const Zones *zon connect(main, SIGNAL(configChanged()), this, SLOT(update())); connect(main, SIGNAL(rideAdded(RideItem*)), this, SLOT(addRide(RideItem*))); connect(main, SIGNAL(rideDeleted(RideItem*)), this, SLOT(update(void))); - connect(main, SIGNAL(rideClean()), this, SLOT(update(void))); + connect(main, SIGNAL(rideClean(RideItem*)), this, SLOT(update(void))); } MetricAggregator::~MetricAggregator() diff --git a/src/RideEditor.cpp b/src/RideEditor.cpp index 7219816e3..fa8d65e82 100644 --- a/src/RideEditor.cpp +++ b/src/RideEditor.cpp @@ -142,8 +142,8 @@ RideEditor::RideEditor(MainWindow *main) : GcChartWindow(main), data(NULL), ride connect(main, SIGNAL(intervalSelected()), this, SLOT(intervalSelected())); //connect(main, SIGNAL(rideSelected()), this, SLOT(rideSelected())); connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected())); - connect(main, SIGNAL(rideDirty()), this, SLOT(rideDirty())); - connect(main, SIGNAL(rideClean()), this, SLOT(rideClean())); + connect(main, SIGNAL(rideDirty(RideItem*)), this, SLOT(rideDirty())); + connect(main, SIGNAL(rideClean(RideItem*)), this, SLOT(rideClean())); // put find tool and anomaly list in the controls findTool = new FindDialog(this);