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>
This commit is contained in:
Yousef Hamza 2015-03-11 02:00:18 +02:00 committed by Dirk Hohndel
parent e70dbb568d
commit 22eb8e0617

View file

@ -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;