From 22eb8e06177fb395a03c9404e46d48fbc3f5cf37 Mon Sep 17 00:00:00 2001 From: Yousef Hamza Date: Wed, 11 Mar 2015 02:00:18 +0200 Subject: Removing gas change events @0:00 when new one is added Remove the existing gas change events @0:00 when new one is added @0:00. Signed-off-by: Yousef Hamza Signed-off-by: Dirk Hohndel --- qt-ui/profile/profilewidget2.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index d385e0c30..68b1cbe70 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -1391,6 +1391,29 @@ void ProfileWidget2::changeGas() struct gasmix gasmix; int seconds = timeAxis->valueAt(scenePos); + if (seconds == 0) { + bool eventRemoved = false; + QString tempStr = "gaschange"; + char *gaschangeStr = tempStr.toUtf8().data(); + + struct event *gasChangeEvent = get_next_event(current_dc->events, gaschangeStr); + struct event *temp; + + while (gasChangeEvent) { + temp = get_next_event(current_dc->events, gaschangeStr); + if (gasChangeEvent->time.seconds == 0) { + remove_event(gasChangeEvent); + eventRemoved = true; + } + gasChangeEvent = temp; + } + + if (eventRemoved) { + mark_divelist_changed(true); + replot(); + } + } + validate_gas(gas.toUtf8().constData(), &gasmix); QRegExp rx("\\(\\D*(\\d+)"); int tank; -- cgit v1.2.3-70-g09d2