mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 08:59:55 +00:00
RideFile reading refactoring
With the introduction of the rideSelected signal the RideFile was opened (as previously) by the RideSummaryWindow::htmlSummary() member. In some cases, this signal was processed by RideSummary window AFTER the other charts (AllPlot etc) this results in 'No data' being shown on other charts. This patch moves the file reading to RideItem::ride() which was previously a public RideFile * (that is now a protected member ride_). As a happy by product it removes the need to check if the file has already been read across all other functions ensuring in-core values are not accidentally overwritten. The read errors are made available by a new RideItem::errors() member. This modification is required to support the RideImportWizard in freeing loaded RideFiles during batch import to ensure virtual memory is not exhausted when large numbers of files are imported at once. This modification is also included in this patch.
This commit is contained in:
committed by
Sean Rhea
parent
71d67e2203
commit
feb111a4ff
@@ -521,7 +521,7 @@ MainWindow::currentRide()
|
||||
|| (treeWidget->selectedItems().first()->type() != RIDE_TYPE)) {
|
||||
return NULL;
|
||||
}
|
||||
return ((RideItem*) treeWidget->selectedItems().first())->ride;
|
||||
return ((RideItem*) treeWidget->selectedItems().first())->ride();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -578,7 +578,7 @@ MainWindow::exportCSV()
|
||||
return;
|
||||
}
|
||||
|
||||
ride->ride->writeAsCsv(file, useMetricUnits);
|
||||
ride->ride()->writeAsCsv(file, useMetricUnits);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -678,17 +678,17 @@ MainWindow::findPowerPeaks()
|
||||
return;
|
||||
}
|
||||
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 5, "Peak 5s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 10, "Peak 10s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 20, "Peak 20s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 30, "Peak 30s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 60, "Peak 1min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 120, "Peak 2min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 300, "Peak 5min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 600, "Peak 10min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 1200, "Peak 20min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 1800, "Peak 30min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride, 3600, "Peak 60min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 5, "Peak 5s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 10, "Peak 10s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 20, "Peak 20s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 30, "Peak 30s");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 60, "Peak 1min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 120, "Peak 2min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 300, "Peak 5min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 600, "Peak 10min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 1200, "Peak 20min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 1800, "Peak 30min");
|
||||
addIntervalForPowerPeaksForSecs(ride->ride(), 3600, "Peak 60min");
|
||||
|
||||
// now update the RideFileIntervals
|
||||
updateRideFileIntervals();
|
||||
@@ -725,7 +725,7 @@ MainWindow::rideTreeWidgetSelectionChanged()
|
||||
|
||||
// now add the intervals for the current ride
|
||||
if (ride) { // only if we have a ride pointer
|
||||
RideFile *selected = ride->ride;
|
||||
RideFile *selected = ride->ride();
|
||||
if (selected) {
|
||||
// get all the intervals in the currently selected RideFile
|
||||
QList<RideFileInterval> intervals = selected->intervals();
|
||||
@@ -743,7 +743,7 @@ MainWindow::rideTreeWidgetSelectionChanged()
|
||||
}
|
||||
|
||||
// turn off tabs that don't make sense for manual file entry
|
||||
if (ride->ride && ride->ride->deviceType() == QString("Manual CSV")) {
|
||||
if (ride->ride() && ride->ride()->deviceType() == QString("Manual CSV")) {
|
||||
tabWidget->setTabEnabled(3,false); // Power Histogram
|
||||
tabWidget->setTabEnabled(4,false); // PF/PV Plot
|
||||
}
|
||||
@@ -783,7 +783,7 @@ MainWindow::updateRideFileIntervals()
|
||||
// iterate over allIntervals as they are now defined
|
||||
// and update the RideFile->intervals
|
||||
RideItem *which = (RideItem *)treeWidget->selectedItems().first();
|
||||
RideFile *current = which->ride;
|
||||
RideFile *current = which->ride();
|
||||
current->clearIntervals();
|
||||
for (int i=0; i < allIntervals->childCount(); i++) {
|
||||
// add the intervals as updated
|
||||
|
||||
Reference in New Issue
Block a user