RideFileCache now refreshed in RideItem

.. and fixed sort order problem
This commit is contained in:
Mark Liversedge
2014-12-25 13:59:38 +00:00
parent 3561188711
commit 7ad2bda418
4 changed files with 55 additions and 6 deletions

View File

@@ -33,6 +33,10 @@
#include "JsonRideFile.h" // for DATETIME_FORMAT
// for sorting
bool rideCacheGreaterThan(const RideItem *a, const RideItem *b) { return a->dateTime > b->dateTime; }
bool rideCacheLessThan(const RideItem *a, const RideItem *b) { return a->dateTime < b->dateTime; }
RideCache::RideCache(Context *context) : context(context)
{
progress_ = 100;
@@ -139,7 +143,7 @@ RideCache::addRide(QString name, bool dosignal)
}
if (!added) rides_ << last;
qSort(rides_); // sort by date
qSort(rides_.begin(), rides_.end(), rideCacheLessThan);
// refresh metrics for *this ride only*
last->refresh();
@@ -321,11 +325,6 @@ RideCache::cancel()
future.waitForFinished();
}
}
// for reverse sorting
bool rideCacheGreaterThan(const RideItem *a, const RideItem *b)
{
return a->dateTime > b->dateTime;
}
// check if we need to refresh the metrics then start the thread if needed
void