Fix loading a second dive, after the first file was loaded.

This patch fixes loading a second dive-file after the first
one had been loaded. it simply clears some information and
makes sure that the current selected dive is invalid when
the file closes. I also did a bit of code cleanup on this one
to make things simpler in the future.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-05-16 16:00:33 -03:00 committed by Dirk Hohndel
parent e3cb36498d
commit d39b1aedcd
6 changed files with 41 additions and 35 deletions

View file

@ -206,16 +206,21 @@ void ProfileGraphicsView::showEvent(QShowEvent* event)
plot(dive);
}
void ProfileGraphicsView::clear()
{
scene()->clear();
resetTransform();
zoomLevel = 0;
toolTip = 0;
}
void ProfileGraphicsView::plot(struct dive *d)
{
if (dive == d)
return;
scene()->clear();
if (dive != d){
resetTransform();
zoomLevel = 0;
dive = d;
toolTip = 0;
}
clear();
dive = d;
if(!isVisible() || !dive){
return;