mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
#381 Prevent statistics from refreshing for each file saved on close, and just run for the last file. Also covers #506 and #656 which are duplicates.
Fixes #381.
This commit is contained in:
@@ -143,6 +143,7 @@ class MainWindow : public QMainWindow
|
||||
SpecialFields specialFields;
|
||||
int session;
|
||||
bool isclean;
|
||||
bool ismultisave;
|
||||
|
||||
void setBubble(QString text, QPoint pos = QPoint(), Qt::Orientation o = Qt::Horizontal);
|
||||
|
||||
|
||||
@@ -205,6 +205,13 @@ void MetricAggregator::addRide(RideItem*ride)
|
||||
}
|
||||
}
|
||||
|
||||
void MetricAggregator::update() {
|
||||
main->isclean = false;
|
||||
if (!main->ismultisave) {
|
||||
refreshMetrics();
|
||||
}
|
||||
}
|
||||
|
||||
bool MetricAggregator::importRide(QDir path, RideFile *ride, QString fileName, unsigned long fingerprint, bool modify)
|
||||
{
|
||||
SummaryMetrics *summaryMetric = new SummaryMetrics();
|
||||
|
||||
@@ -56,7 +56,7 @@ class MetricAggregator : public QObject
|
||||
void dataChanged(); // when metricDB table changed
|
||||
|
||||
public slots:
|
||||
void update() { main->isclean = false; refreshMetrics(); }
|
||||
void update();
|
||||
void addRide(RideItem*);
|
||||
void importMeasure(SummaryMetrics *sm);
|
||||
|
||||
|
||||
@@ -320,12 +320,20 @@ SaveOnExitDialogWidget::saveClicked()
|
||||
{
|
||||
// whizz through the list and save one by one using
|
||||
// singleSave to ensure warnings are given if neccessary
|
||||
// use mainWindow->ismultisave to prevent refreshing stats
|
||||
// for each file
|
||||
mainWindow->ismultisave = true;
|
||||
for (int i=0; i<dirtyList.count(); i++) {
|
||||
QCheckBox *c = (QCheckBox *)dirtyFiles->cellWidget(i,0);
|
||||
if (c->isChecked()) {
|
||||
if (i==dirtyList.count()-1) {
|
||||
mainWindow->ismultisave = false;
|
||||
}
|
||||
mainWindow->saveRideSingleDialog(dirtyList.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
mainWindow->ismultisave = false;
|
||||
accept();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user