mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
UI Nits: LTM Sidebar (Part 2 of 3)
The last of a series of recent patches to address performance degradation from the introduction of the LTMSiebar. This last patch introduces a CPX aggregates cache to re-use aggregated CPX data (e.g. for plotting a specific season or date range). The cache is set to only hold 25 caches, which should be enough for most folks list of seasons. But won't get unwieldy if they scroll around in the diary view. The following will be introduced in the last patch of this series: 1. Introduce 'events' within a season and plot them on the LTM chart -- a form of 'annotation' but also the beginning of planned events in the future too. 2. Implement click functionality on LTM charts but decide if we use click to annotate or to define a new date range or both?
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QtAlgorithms> // for qStableSort
|
||||
|
||||
static const int maxcache = 25; // lets max out at 25 caches
|
||||
|
||||
// cache from ride
|
||||
RideFileCache::RideFileCache(MainWindow *main, QString fileName, RideFile *passedride, bool check) :
|
||||
main(main), rideFileName(fileName), ride(passedride)
|
||||
@@ -870,8 +872,17 @@ static void distAggregate(QVector<double> &into, QVector<double> &other)
|
||||
}
|
||||
|
||||
RideFileCache::RideFileCache(MainWindow *main, QDate start, QDate end, bool filter, QStringList files)
|
||||
: main(main), rideFileName(""), ride(0)
|
||||
: main(main), rideFileName(""), ride(0), start(start), end(end)
|
||||
{
|
||||
|
||||
// Oh lets get from the cache if we can
|
||||
foreach(RideFileCache *p, main->cpxCache) {
|
||||
if (p->start == start && p->end == end) {
|
||||
*this = *p;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// resize all the arrays to zero - expand as neccessary
|
||||
xPowerMeanMax.resize(0);
|
||||
npMeanMax.resize(0);
|
||||
@@ -941,6 +952,14 @@ RideFileCache::RideFileCache(MainWindow *main, QDate start, QDate end, bool filt
|
||||
|
||||
// set the cursor back to normal
|
||||
main->setCursor(Qt::ArrowCursor);
|
||||
|
||||
// lets add to the cache for others to re-use
|
||||
if (main->cpxCache.count() > maxcache) {
|
||||
delete(main->cpxCache.at(0));
|
||||
main->cpxCache.removeAt(0);
|
||||
}
|
||||
main->cpxCache.append(new RideFileCache(this));
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user