#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:
g3rg
2012-03-13 22:17:36 +10:00
committed by Mark Liversedge
parent b1fddb9d22
commit 3d3af3b293
4 changed files with 17 additions and 1 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();
}