From ee76e6769a42aa77c71b11fc463bdf9f614664d3 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 11 Jan 2014 10:55:23 +0000 Subject: [PATCH] Compromise on import .. signal when importing a relatively small number of items (less than 20) .. don't signal when importing a lot of items (more than 20). --- src/RideImportWizard.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/RideImportWizard.cpp b/src/RideImportWizard.cpp index db171270a..7a9d21649 100644 --- a/src/RideImportWizard.cpp +++ b/src/RideImportWizard.cpp @@ -825,7 +825,8 @@ RideImportWizard::abortClicked() tableWidget->item(i,5)->setText(tr("File Overwritten")); } else { tableWidget->item(i,5)->setText(tr("File Saved")); - context->athlete->addRide(QFileInfo(fulltarget).fileName(), false); + context->athlete->addRide(QFileInfo(fulltarget).fileName(), + tableWidget->rowCount() < 20 ? true : false); // don't signal if mass importing } } @@ -870,7 +871,9 @@ RideImportWizard::abortClicked() QFile source(filenames[i]); if (source.copy(fulltarget)) { tableWidget->item(i,5)->setText(tr("File Saved")); - context->athlete->addRide(QFileInfo(fulltarget).fileName(), false); // add to tree view + context->athlete->addRide(QFileInfo(fulltarget).fileName(), + tableWidget->rowCount() < 20 ? true : false); // don't signal if mass importing + // free immediately otherwise all imported rides are cached // and with large imports this can lead to memory exhaustion // BUT! Some charts/windows will hava snaffled away the ridefile