Commit Graph

55 Commits

Author SHA1 Message Date
Mark Liversedge
d21ca376be MainWindow Refactor Part 3 of 5
Slowly migrating code  and data from the MainWindow
class to Athlete and Context classes.

This update moves the ride and interval lists and
data structures from MainWindow to Athlete.
2013-07-13 19:46:03 +01:00
Mark Liversedge
05f1d577db Refactor MainWindow Part 2 of 5
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
2013-07-11 14:02:02 +01:00
Mark Liversedge
e407237ac0 MainWindow Refactor Part 1 of 5
Breaking the MainWindow 'god object' into
separate classes for Athlete and Context.

Further updates will need to;
- 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

Once these are done we will be in a position to decouple
most classes from mainwindow and also introduce tabbed
athletes.
2013-07-07 15:50:28 +01:00
Mark Liversedge
fdf2149087 Visual cue for filter
.. by highlighting chart title too if a filter is
   being applied.

This is important to warn users that the data being plotted
is adjusted to the search/filter (either globally or in the
chart settings).
2013-04-26 12:44:51 +01:00
Mark Liversedge
fedc2acfc5 Fix CP chart SEGV on delete ride
.. referencing combo box when in range mode.
2013-04-10 19:29:06 +01:00
Mark Liversedge
01c4b436e6 Search/Filter on toolbar applies to Charts
When the user free text searches or applies a data filter in
the top right toolbar search box it gets applied to any charts
that plot data from many rides, including;

- CP curve
- Calendar
- Histogram
- LTM
- TreeMap
- Summary

I need to update on a Mac to no longer use a Mac text search box
but now use a search filter box on the top right.
2013-04-05 16:23:16 +01:00
Mark Liversedge
440bbd203f Refresh all curve when spikes edited and saved
.. will refresh after the metrics and cpx have been refreshed

.. it invalidates the data rather than refreshing immediately
   since thats expensive and better wait until refresh is needed.
2013-03-29 19:33:43 +00:00
Mark Liversedge
cfdb3037d8 Fixup last commit
.. strange edits lost related to widget layouts.
2013-02-16 14:21:12 +00:00
Mark Liversedge
b58a6e747b Shade Selector on CP chart
- none - no shading on the all curve
- derived CP - as before using the CP value derived from all curve data
- CP - the value of CP for the time of the ride

NOTE: When in rangemode (i.e. on home) the CP is set to the mean CP for
the date range selected.
2013-02-16 13:41:55 +00:00
Mark Liversedge
cd2fca9346 Code Cleanup: Remove #if 0 code
As a personal habit I tend to use the C pre-processor to
comment out code blocks I don't want to remove. This is in
case the code will be required in the future.

I think it is now safe to say the code commented out is not
required -- most of it is legacy and marks the transition from
earlier designs or legacy code.

I've done this in one big commit since in theory it has no
functional change, and in future can look in this commit for any
code we may want to reinstate.
2013-02-11 15:00:00 +00:00
Mark Liversedge
1eb06866cc Code Cleanup: CP chart 2013-02-10 21:11:39 +00:00
Mark Liversedge
82ecce3af6 BlankState: Analysis view more blanks
- Better handling of a NULL ride for most of the analysis charts
- Don't show activity editor if no data rows to edit
2013-02-06 11:48:52 +00:00
Damien
102fb30eae Show picker info in CriticalPowerWindow
Correct previous commit
2013-01-28 23:26:03 +01:00
Damien
204dbe3f48 UI Nits: GcChartWindow for CriticalPowerWindow and ModelWindow 2013-01-28 22:49:02 +01:00
Damien
cde2c48bbe Change animation for reveal on AllPlotWindow 2013-01-26 15:15:22 +01:00
Mark Liversedge
a2fd1a9d05 UI Nits: CP today 'gap'
.. when in rangemode.
2013-01-25 18:27:26 +00:00
Mark Liversedge
40e527d022 UI Nits: Reveal Controls Cosmetics
After discussion with Damien;

* solid white background for the controls looks best
* CP on chart labels need to be less obtrusive
* keep the controls to a simple but useful set

I also tidied up some of the margins since they were
also wrong.
2013-01-25 09:28:20 +00:00
Damien
5f1627bd57 Add reveal controls for CP Plot and PfPv Plot 2013-01-20 23:36:31 +01:00
Mark Liversedge
7bdeb82d71 UseThruToday: Fix CP chart 2013-01-14 09:44:46 +00:00
Mark Liversedge
a0a07e8b07 Chart Dates: Part 3b of 3
Added chart date selection to the CP chart.
Still need to add this to;
    - Summary
    - Histogram
2013-01-04 23:43:37 +00:00
Mark Liversedge
2df222f9ff Fix SEGV in CPPlot when ride added/deleted
The recent update to allow CP charts to be added to the home
view and display the cp chart for the range selected did not
update to cater for ride/add delete whilst the season combo
is not set.

As a result when a ride was added/deleted the current index for
the combo was used (-1) to reference the season array resulting
in an fatal assert on array bounds.
2012-12-13 14:44:09 +00:00
Mark Liversedge
4bd94e9411 UI Nits: LTMSidebar performance
Don't refresh CP, LTM or Histogram plots when dateRange property
is set, if the dateRange was previously plotted anyway. Will set
to stale if a ride is added or deleted too.

This means the replot of tabs is not performed when simply switching
between tabs. But will if the date range does change or a ride is
added or deleted meaning the aggregate needs to be re-calculated.

There is still one more performance improvement required;

1. get RideFileCache to have a cache of recent aggregations.
   Since (a) the same ranges will be called over and over by
   different charts when a season is selected and (b) there
   are only likely to be 20-30 seasons defined in total, so
   lets cache them instead of recalculating every time.
2012-11-27 13:41:36 +00:00
Mark Liversedge
6568a05703 UI Nits: LTMSidebar performance
Remove the double update from HomeWindow and only
update in CP and Histogram when visible.

Still need to:

1. get CP/Histogram to remember what the last update
was to not bother unless something has changed.

2. get RideFileCache to have a cache of recent aggregations.
   Since (a) the same ranges will be called over and over by
   different charts when a season is selected and (b) there
   are only likely to be 20-30 seasons defined in total, so
   lets cache them instead of recalculating every time.
2012-11-26 22:11:46 +00:00
Mark Liversedge
2dea77e1ae UI Nits: LTM Sidebar (Part 1 of 3)
We now have a date range selector in the sidebar.  The
sidebar has a date range selector and summary. It is
used to set the date range for the charts in the view.

As a result we can now add summary charts to the home view
and LTM/CP/Histogram charts to the Diary view. The weekly
summary chart is now deprecated.

Creating seasons has also been disabled on metric charts. We
will need to decide what clicking on an LTM chart should do,
and look at whether we want to keep the popup bubble or
adjust it.

There are some unfortunate performance degradations as a result
of this patch when selecting date ranges and switching between
charts in tab view. This needs to be addressed as a priority.

Follow up patches, part 2 and 3 will need to;
1. address performance degradations & cache results
2. introduce events in sidebar and as annotations on charts
3. implement click functionality on LTM charts (annotate vs
  define a new season/range)

NOTE: existing HOME, ANALYSIS and DIARY chart setups will need
      to be rebuilt since chart ids and properties have changed
      in this patch -- do not raise a bug until you have deleted
      and re-added the offending chart.
2012-11-26 20:20:36 +00:00
Mark Liversedge
d0b009c922 Data Filter (Part 3 of 3)
Last part of the search/filter functionality;

* SearchBox now incorporates filter and search
  with a new widget. We can update this widget
  to include more fancy UI/Interactions without
  having to change the ride list or charts etc.

* Added search/filter widget to the relevant charts
  and screens; Metrics, TreeMap, CP, Histogram,
  Activity Log, Ride list (refactored out of MainWindow)

* Added namedsearches.xml and adding/selecting them
  from a drop down menu on the search box.

* Fixed some performance bugs related to duplicate
  signals and redraw/reprocessing. Also ensured that
  CLucene remains optional -- but means no search or
  filter functionality unless it is available.
2012-11-05 15:44:01 +00:00
Damien
b116d3aac8 Add Watts/Kg in the cpx cache files and in the CP plot
modified:   src/CpintPlot.cpp
	modified:   src/CriticalPowerWindow.cpp
	modified:   src/CriticalPowerWindow.h
	modified:   src/HistogramWindow.cpp
	modified:   src/RideFile.cpp
	modified:   src/RideFile.h
	modified:   src/RideFileCache.cpp
	modified:   src/RideFileCache.h
2012-07-08 11:03:20 +01:00
Damien
c44758c5ad Qwt 6.0.1 Support
Upgrade to QWT 6.0.1, but still uses a locally patched copy
since support for 8 axes has not been included, despite it
being a relatively simple patch.

Fixes #634.
Fixes #567.
2012-02-12 10:43:15 +00:00
Damien
cf8310b1b9 Fix CriticalPowerWindow handle seasons changed
Fixes #575.
2012-01-15 09:22:45 +00:00
Mark Liversedge
d7e987d0a9 CP chart 'best date' doesn't fit
Aside from just expanding the sidebar to show it, this update
creates a bit more space for the display of best values in
the CP chart controls.

It would be better if the tooltip also showed the date.

Fixes #565.
2011-12-25 11:23:54 +00:00
Mark Liversedge
574a4c2905 Fix CP chart SEGV when season deleted
If the season selected is deleted then upon restart
the CP plot will crash (iSeason <0).

Fixes #446.
2011-09-04 15:43:15 +01:00
Mark Liversedge
e7bcaa2b25 Add VAM to CP curve
Very basic start, this will now let you plot
VAM on the CP curve. VAM is a measure of climbing
speed and for comparative purposes should be
normalised to the slope climbed.

In this first pass of implementation the VAM metric
is not normalised in any way. It merely represents
the climbing rate, in meters per hour, that was
sustained over each time interval from 5mins to the
ride duration.

If the ride is undulating then only ascension is
included, any time on the flat or descending is
included but meters climbed will be zero. This is
akin to the way we handle power where we include time
when freewheeling.

More sophistication is needed, especially normalising
the value to a common gradient (e.g. 10%). But this
will prove challenging when VAM is comprised of
undulating elements (i.e. gradient is cumulatively
zero, but could contain segments with steep parts).

It may be more appropriate to only measure VAM for
sustained climbing i.e. ignore ride sections when
descending or on the flat.

More thought needed.

Fixes #414.
2011-08-18 19:15:20 +01:00
Mark Liversedge
69f1340fb7 Critical Power Window delete current ride crash
The CP window tries to draw the current ride, even if it
has just been deleted (i.e. on delete event it tried to
calculate()) this fixes that.

Other widgets are fine, this is a consequence of trying to
redraw the aggregated curve and current curve when being
notified the ride has been deleted.
2011-08-07 19:25:57 +01:00
Mark Liversedge
8f53e1c2da Refresh CP curve when rides added/deleted
This patch forces a refresh of the CP curve
plot (if it is visible) when rides are added
or deleted.

Fixes #400.
2011-08-07 09:39:13 +01:00
Mark Liversedge
4972f2472e Remove console error for seasons.xml
There is no need to warn about seasons.xml missing, it
is quite acceptable to have none set. Worse still sending
to the console log is next to useless for users that
don't launch from the command line.
2011-07-29 22:17:05 +01:00
Mark Liversedge
498a7e3ec4 Add xPower and Normalized Power to Critical Plot
The Skiba and Coggan metrics for xPower and NP
respectively can now be plotted on the CP curve.

There are two issues;
* Downsampling of data to 5s samples skews xPower's EWMA
* Setting scale to start at 30mins breaks the x-axis scale engine

Both issues need fixing, since the first skews xPower upwards and
the second suggests that xPower/NP are meaningful for durations
less than 30 minutes.

Fixes #307.
2011-04-28 23:51:55 +01:00
Mark Liversedge
41eaaa866b Plot more data on the CP plot and use a binary cache file
This patch enables more data series to be plotted on a CP plot.
We can now show curves for heartrate, cadence, speed and torque
as well as the original power and energy.

The CP code is refactored into the plotting functions and a new
RideFileCache that precomputes the mean-max as well as distribution
data (for a later patch to show histograms across date ranges).

The code for computing mean-max values has been re-written and
significantly optimised by;
* computing 1s intervals up to 5mins only
* computing 20s intervals for the remainder of the ride
* downsampling data to 5s samples for longer durations
* using a binary file format (cpx) for faster read/aggregation
* using multiple threads

Testing on an old Athlon dual-core showed an increase in performance
over the old cpi code of approximately x20, but since new data series
are now computed it is only x4 faster. Quad/Octo core systems will
show a greater performance increase though.
2011-04-25 02:20:19 +01:00
Mark Liversedge
76d9bbcafd post merge master in release_3.0.0dev fixups. 2011-02-27 11:36:14 +00:00
kohasa
09bec66b38 enabled editing interval duration by keyboard.
Fixes #125
2011-02-27 11:07:48 +00:00
Mark Liversedge
3aba7dd788 Inital V3 Branch 2010-12-30 17:35:23 +00:00
Mark Liversedge
38df7c28bd User Configurable Colors
A new config pane for defining color preferences for chart
curves, shading, background and grid lines et al. Default values
echo the current hard-coded values.
2010-04-01 10:29:13 -04:00
Sean Rhea
cd4fe5fe2e combine setActive and rideSelected
And pay attention to MainWindow::activeTab, such that only the active
tab redraws itself when changing rides.  This change really increases
GC's responsiveness when scrolling through the ride list.
2010-03-21 22:03:12 -07:00
Sean Rhea
bd28d3b28e maybe fix problem with Set CP button not enabled 2010-03-12 10:45:08 -05:00
Mitsukuni Sato
009c013521 add calls to tr() for translation 2009-12-17 19:10:36 -05:00
Damien Grauser
216bc6ef4b add language selector and French translations 2009-12-12 15:23:46 -05:00
Sean Rhea
2db45dc0c5 introduce MainWindow rideSelected signal
...and use it to update the various tabs when a ride is selected.
2009-12-10 13:13:10 -08:00
Sean Rhea
1169ca9239 public zones in MainWindow is const 2009-12-10 10:16:58 -08:00
Sean Rhea
b2ef8940a7 cp plot gets zones in its constructor 2009-12-10 10:16:57 -08:00
Sean Rhea
7324ebda06 fix season selector in cp plot 2009-11-27 16:46:09 -05:00
Sean Rhea
1edd8c0767 add y-axis shows work mode to CP plot
This mode is fun because the "CP Curve" is a straight line,
just like in the model:

  work = CP * time + AWC

You can also see that the AWC is the y-intercept.
2009-11-09 09:05:03 -08:00
Sean Rhea
6d20bea968 don't show CP values off the end of lines
I.e., if the user selects a time to the left of the red dashed CP line,
we shouldn't show a value in the "CP Curve" box.
2009-11-09 10:03:50 -05:00