summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-09-14 21:09:03 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-15 09:01:10 -0700
commit8d8e694b0dae1d84c27d76aa7c68749ab2a014ac (patch)
treef6f0b09af59f5ffb562a08cb6744a83529effe05 /profile-widget
parent803e98befee02600a69b7d8a2cef958eaaea2465 (diff)
downloadsubsurface-8d8e694b0dae1d84c27d76aa7c68749ab2a014ac.tar.gz
End tankbar at the correct end of the dive plot
Go back to the old startegy of retrieving the correct end of the dive plot by looking at the plot data instead of looking at dc->duration. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/tankitem.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/profile-widget/tankitem.cpp b/profile-widget/tankitem.cpp
index b6e099c7b..c4c1aeeee 100644
--- a/profile-widget/tankitem.cpp
+++ b/profile-widget/tankitem.cpp
@@ -97,6 +97,9 @@ void TankItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &b
qreal width, left;
+ // Find correct end of the dive plot for correct end of the tankbar
+ struct plot_data *last_entry = &pInfoEntry[pInfoNr-1];
+
// get the information directly from the displayed_dive (the dc always exists)
struct divecomputer *dc = get_dive_dc(&displayed_dive, dc_number);
@@ -107,7 +110,7 @@ void TankItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &b
// work through all the gas changes and add the rectangle for each gas while it was used
struct event *ev = get_next_event(dc->events, "gaschange");
- while (ev && ev->time.seconds < dc->duration.seconds) {
+ while (ev && ev->time.seconds < last_entry->sec) {
width = hAxis->posAtValue(ev->time.seconds) - hAxis->posAtValue(startTime);
left = hAxis->posAtValue(startTime);
createBar(left, width, gasmix);
@@ -115,7 +118,7 @@ void TankItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &b
gasmix = get_gasmix_from_event(&displayed_dive, ev);
ev = get_next_event(ev->next, "gaschange");
}
- width = hAxis->posAtValue(dc->duration.seconds) - hAxis->posAtValue(startTime);
+ width = hAxis->posAtValue(last_entry->sec) - hAxis->posAtValue(startTime);
left = hAxis->posAtValue(startTime);
createBar(left, width, gasmix);
}