From 3eac2360e7173580c7325ccb9814be538d3ee078 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 10 Jun 2013 13:35:27 -0300 Subject: Moved the 'create fake dc' to it's own function in device.c Signed-off-by: Tomaz Canabrava --- qt-ui/profilegraphics.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 164de13ff..98d542788 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -17,6 +17,7 @@ #include "../display.h" #include "../dive.h" #include "../profile.h" +#include "../device.h" #include #include @@ -265,26 +266,7 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw) // plot_set_scale(scale_mode_t); if (!dc->samples) { - static struct sample fake[4]; - static struct divecomputer fakedc; - fakedc = dive->dc; - fakedc.sample = fake; - fakedc.samples = 4; - - /* The dive has no samples, so create a few fake ones. This assumes an - ascent/descent rate of 9 m/min, which is just below the limit for FAST. */ - int duration = dive->dc.duration.seconds; - int maxdepth = dive->dc.maxdepth.mm; - int asc_desc_time = dive->dc.maxdepth.mm*60/9000; - if (asc_desc_time * 2 >= duration) - asc_desc_time = duration / 2; - fake[1].time.seconds = asc_desc_time; - fake[1].depth.mm = maxdepth; - fake[2].time.seconds = duration - asc_desc_time; - fake[2].depth.mm = maxdepth; - fake[3].time.seconds = duration * 1.00; - fakedc.events = dc->events; - dc = &fakedc; + dc = fake_dc(dc); } /* -- cgit v1.2.3-70-g09d2