mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive pictures: Don't plot pictures twice when changing current dive
In MainWindow::current_dive_changed() first plotDive() is called, which replots all the pictures by calling plotPictures(). This is pointess, because it plots the pictures of the previous dive. Then, updateDiveInfo() is called, which resets the dive pictures and automatically replots them. Thus, switching between dives both with hundreds of pictures is way slower than necessary. Switching the plotDive() and updateDiveInfo() calls doesn't work. The reason is not 100% clear, but it doesn't make sense to plot pictures of the new dive as long as the profile still shows the old dive anyway. As a quick-fix, add a flag to plotDive(), which tells the function to clear the pictures list instead of redrawing it. Ultimately, plotDive() should probably be split in two functions. One for the callers who update the pictures themselves and one for the others. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f54268e527
commit
45395fd466
4 changed files with 11 additions and 11 deletions
|
@ -531,7 +531,7 @@ void MainWindow::current_dive_changed(int divenr)
|
|||
if (divenr >= 0) {
|
||||
select_dive(divenr);
|
||||
}
|
||||
graphics()->plotDive();
|
||||
graphics()->plotDive(nullptr, false, true);
|
||||
information()->updateDiveInfo();
|
||||
configureToolbar();
|
||||
MapWidget::instance()->reload();
|
||||
|
@ -1095,7 +1095,7 @@ void MainWindow::on_actionAddDive_triggered()
|
|||
graphics()->setAddState();
|
||||
DivePlannerPointsModel::instance()->createSimpleDive();
|
||||
configureToolbar();
|
||||
graphics()->plotDive();
|
||||
graphics()->plotDive(nullptr, false, true);
|
||||
fixup_dc_duration(&displayed_dive.dc);
|
||||
displayed_dive.duration = displayed_dive.dc.duration;
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ void MainWindow::on_actionPreviousDC_triggered()
|
|||
unsigned nrdc = number_of_computers(current_dive);
|
||||
dc_number = (dc_number + nrdc - 1) % nrdc;
|
||||
configureToolbar();
|
||||
graphics()->plotDive();
|
||||
graphics()->plotDive(nullptr, false, true);
|
||||
information()->updateDiveInfo();
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ void MainWindow::on_actionNextDC_triggered()
|
|||
unsigned nrdc = number_of_computers(current_dive);
|
||||
dc_number = (dc_number + 1) % nrdc;
|
||||
configureToolbar();
|
||||
graphics()->plotDive();
|
||||
graphics()->plotDive(nullptr, false, true);
|
||||
information()->updateDiveInfo();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue