Decoupled classes from MainWindow to reference Context
and Athlete (and introduced a couple of new headers).
We no longer pass around a MainWindow pointer to children
but pass a context instead.
There are still a few pieces left in MainWindow that need
to move to a better place;
* Setting/clearing filter selection
* Working with Intervals
* Adding/Deleting Rides
* Save on Exit
As mentioned previously there are lots of other parts to
this refactor left to do;
* break MainWindow Gui elements into Toolbar and Views
* migrate from RideItem and Ridelist to ActivityCollection
and Activity classes that are not tied into gui elements.
* introduce Application Context and AthleteCollection
The call to RideFile::getWeight() in RideFileCache
computation ends up with a call the read the measures
table in the DB. This is BAD since it is called from
a thread.
We now call getWeight() in the metric aggregator before
launching the ridefilecache computation -- this will cache
the weight and avoid db access.
I've also removed the duplicate code in the w/kg metric code
too and it should be marginally faster at computing metrics
now.
BIG THANKS TO ILJA BOOIJ FOR HIGHLIGHTING THIS, DESPITE MY
INITIAL SCEPTICISM. I OWE HIM A PINT (OR TWO) :)
Fixes#604
The code setting metric names and units was moved from constructors to
an initialize method, to be called after translator initialization.
English Name is preserved as InternalName for metadata.xlm compatibility
in metric override.
Q_DECLARE_TR_FUNCTIONS(class-name) macro is used to set tr() context
when class-name is not QObject sub-class.
A few months ago I commented out the calculation of metrics
for manual ride files. This was a hack to avoid fixing the code
to handle metric calculations from overrides where there are no
data points.
This annoyingly meant that the 'rides' metric was zero for manual
ride files, and any derived metrics similarly were zero.
This patch fixes that.
All the existing wpk metrics concentrate
on the wpk for a fixed period, which is great
but we should also support it for an interval
(where it is arguably most interesting).
This patch fixes that.
Fixes#467.