diff --git a/src/RideCache.cpp b/src/RideCache.cpp index 3898e2256..d2f8cb0af 100644 --- a/src/RideCache.cpp +++ b/src/RideCache.cpp @@ -128,7 +128,7 @@ RideCache::itemChanged() if (item == context->currentRideItem()) { // in lieu of chart refresh code - //qDebug()<<"RIDE CHANGED:"<fileName; + qDebug()<<"RIDE CHANGED:"<fileName; context->notifyRideChanged(item); } @@ -317,7 +317,13 @@ void itemRefresh(RideItem *&item) { // need parser to be reentrant !item->refresh(); - if (item->isstale) item->refresh(); + if (item->isstale) { + item->refresh(); + + // and trap changes during refresh to current ride + if (item == item->context->currentRideItem()) + item->context->notifyRideChanged(item); + } } void diff --git a/src/RideItem.h b/src/RideItem.h index b699f2dda..8b2373853 100644 --- a/src/RideItem.h +++ b/src/RideItem.h @@ -59,7 +59,6 @@ class RideItem : public QObject QStringList errors_; - Context *context; // to notify widgets when date/time changes unsigned long metaCRC(); @@ -76,6 +75,7 @@ class RideItem : public QObject public: + Context *context; // to notify widgets when date/time changes bool isdirty; // ride data has changed and needs saving bool isstale; // metric data is out of date and needs recomputing bool isedit; // is being edited at the moment diff --git a/src/RideSummaryWindow.cpp b/src/RideSummaryWindow.cpp index 142cddcd0..ecebfb129 100644 --- a/src/RideSummaryWindow.cpp +++ b/src/RideSummaryWindow.cpp @@ -103,6 +103,7 @@ RideSummaryWindow::RideSummaryWindow(Context *context, bool ridesummary) : if (ridesummary) { connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideItemChanged())); + connect(context, SIGNAL(rideChanged(RideItem*)), this, SLOT(refresh())); connect(context->athlete, SIGNAL(zonesChanged()), this, SLOT(refresh())); connect(context, SIGNAL(intervalsChanged()), this, SLOT(refresh())); connect(context, SIGNAL(compareIntervalsStateChanged(bool)), this, SLOT(compareChanged())); diff --git a/src/WithingsDownload.cpp b/src/WithingsDownload.cpp index 90b57f943..da9647282 100644 --- a/src/WithingsDownload.cpp +++ b/src/WithingsDownload.cpp @@ -19,6 +19,7 @@ #include "WithingsDownload.h" #include "MainWindow.h" #include "Athlete.h" +#include "RideCache.h" #include WithingsDownload::WithingsDownload(Context *context) : context(context) @@ -79,7 +80,8 @@ WithingsDownload::downloadFinished(QNetworkReply *reply) withingsJSON.close(); } - //XXXREFRESH context->athlete->metricDB->refreshMetrics(context->athlete->withings().first().when); + // apply across the ride items + context->athlete->rideCache->refresh(); } return; }