diff options
author | Robert C. Helling <helling@atdotde.de> | 2018-01-20 17:58:52 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2018-01-21 15:24:46 +0100 |
commit | 7b508e41cd1304834511f87dbe399398517aaeff (patch) | |
tree | ae6ca6ae95990b3f5d64c33b5a509d4dd432917c /profile-widget | |
parent | c866b82f35365136d52d3113517aa6d5627eded3 (diff) | |
download | subsurface-7b508e41cd1304834511f87dbe399398517aaeff.tar.gz |
Show ICD events data in infobox
If a gas switch violates our ICD criteria, show
this in the info box.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'profile-widget')
-rw-r--r-- | profile-widget/diveeventitem.cpp | 10 | ||||
-rw-r--r-- | profile-widget/diveeventitem.h | 4 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 4 |
3 files changed, 12 insertions, 6 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp index 28be9827c..630587375 100644 --- a/profile-widget/diveeventitem.cpp +++ b/profile-widget/diveeventitem.cpp @@ -49,7 +49,7 @@ struct event *DiveEventItem::getEvent() return internalEvent; } -void DiveEventItem::setEvent(struct event *ev) +void DiveEventItem::setEvent(struct event *ev, struct gasmix *lastgasmix) { if (!ev) return; @@ -57,7 +57,7 @@ void DiveEventItem::setEvent(struct event *ev) free(internalEvent); internalEvent = clone_event(ev); setupPixmap(); - setupToolTipString(); + setupToolTipString(lastgasmix); recalculatePos(true); } @@ -143,7 +143,7 @@ void DiveEventItem::setupPixmap() #undef EVENT_PIXMAP_BIGGER } -void DiveEventItem::setupToolTipString() +void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix) { // we display the event on screen - so translate QString name = gettextFromC::instance()->tr(internalEvent->name); @@ -158,6 +158,10 @@ void DiveEventItem::setupToolTipString() /* Do we have an explicit cylinder index? Show it. */ if (internalEvent->gas.index >= 0) name += tr(" (cyl. %1)").arg(internalEvent->gas.index + 1); + icd_data icd_data; + if (isobaric_counterdiffusion(lastgasmix, mix, &icd_data)) + name += tr("\nICD ΔN2/ΔHe=%1/%2=%3%").arg(icd_data.dN2 / 10).arg(-icd_data.dHe / 10).arg((-100 * icd_data.dN2 / icd_data.dHe)); + *lastgasmix = *mix; } else if (value) { if (type == SAMPLE_EVENT_PO2 && same_string(internalEvent->name, "SP change")) { name += QString(": %1bar").arg((double)value / 1000, 0, 'f', 1); diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h index d00d3ce85..51eead5d0 100644 --- a/profile-widget/diveeventitem.h +++ b/profile-widget/diveeventitem.h @@ -13,7 +13,7 @@ class DiveEventItem : public DivePixmapItem { public: DiveEventItem(QObject *parent = 0); virtual ~DiveEventItem(); - void setEvent(struct event *ev); + void setEvent(struct event *ev, struct gasmix *lastgasmix); struct event *getEvent(); void eventVisibilityChanged(const QString &eventName, bool visible); void setVerticalAxis(DiveCartesianAxis *axis); @@ -25,7 +25,7 @@ slots: void recalculatePos(bool instant = false); private: - void setupToolTipString(); + void setupToolTipString(struct gasmix *lastgasmix); void setupPixmap(); DiveCartesianAxis *vAxis; DiveCartesianAxis *hAxis; diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 1f382ebb4..85b6b1c78 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -715,6 +715,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) qDeleteAll(eventItems); eventItems.clear(); struct event *event = currentdc->events; + struct event *ev; + struct gasmix lastgasmix = *get_gasmix(&displayed_dive, current_dc, 1, &ev, NULL); while (event) { // if print mode is selected only draw headings, SP change, gas events or bookmark event if (printMode) { @@ -731,7 +733,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) item->setHorizontalAxis(timeAxis); item->setVerticalAxis(profileYAxis); item->setModel(dataModel); - item->setEvent(event); + item->setEvent(event, &lastgasmix); item->setZValue(2); scene()->addItem(item); eventItems.push_back(item); |