Code Cleanup ( that fix 2 bugs )

This code cleanup fixes the two issues that I raised on
my last e-mail. hurrah.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-03-09 10:59:31 -03:00 committed by Dirk Hohndel
parent b6bbfdcc5f
commit 24c5b2e3c1
5 changed files with 18 additions and 49 deletions

View file

@ -209,6 +209,13 @@ void ProfileWidget2::setupItemOnScene()
heartBeatAxis->setLinesVisible(true);
}
void ProfileWidget2::replot()
{
int diveId = dataModel->id();
dataModel->clear();
plotDives(QList<dive *>() << getDiveById(diveId));
}
void ProfileWidget2::setupItemSizes()
{
// Scene is *always* (double) 100 / 100.
@ -431,9 +438,7 @@ void ProfileWidget2::settingsChanged()
}
if (s.value("zoomed_plot").toBool() != isPlotZoomed) {
isPlotZoomed = s.value("zoomed_plot").toBool();
int diveId = dataModel->id();
dataModel->clear();
plotDives(QList<dive *>() << getDiveById(diveId));
replot();
}
if (currentState == PROFILE) {
@ -681,8 +686,5 @@ void ProfileWidget2::changeGas()
fixup_dive(d);
MainWindow::instance()->information()->updateDiveInfo(selected_dive);
mark_divelist_changed(true);
// force the redraw of the dive.
//TODO: find a way to make this do not need a full redraw
dataModel->clear();
plotDives(QList<dive *>() << getDiveById(diveId));
replot();
}