Withings, Summary + Cache refresh update

.. when downloading withings data the cache is refreshed

.. when the cache refreshes it notifies the *current* ride
   changes if it is refreshed

.. ridesummary has been updated to process rideChanged() signals.
This commit is contained in:
Mark Liversedge
2014-12-29 22:41:08 +00:00
parent 17b4477a8c
commit 30cfaf853a
4 changed files with 13 additions and 4 deletions

View File

@@ -128,7 +128,7 @@ RideCache::itemChanged()
if (item == context->currentRideItem()) {
// in lieu of chart refresh code
//qDebug()<<"RIDE CHANGED:"<<item->fileName;
qDebug()<<"RIDE CHANGED:"<<item->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

View File

@@ -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

View File

@@ -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()));

View File

@@ -19,6 +19,7 @@
#include "WithingsDownload.h"
#include "MainWindow.h"
#include "Athlete.h"
#include "RideCache.h"
#include <QMessageBox>
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;
}