diff options
author | Yousef Hamza <jo.adam.93@gmail.com> | 2015-03-11 02:00:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-11 11:06:13 -0700 |
commit | 22eb8e06177fb395a03c9404e46d48fbc3f5cf37 (patch) | |
tree | 418ce51096ef9a005aa63f1a017373c10b3b8f7b /qt-ui | |
parent | e70dbb568d68f564c22b08a3ecaa5cbdb82c5dcb (diff) | |
download | subsurface-22eb8e06177fb395a03c9404e46d48fbc3f5cf37.tar.gz |
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 <jo.adam.93@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
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; |