summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--planner.c2
-rw-r--r--planner.h1
-rw-r--r--qt-ui/profilegraphics.cpp8
3 files changed, 9 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index ba8e5dfab..f104ad7b7 100644
--- a/planner.c
+++ b/planner.c
@@ -76,7 +76,7 @@ static inline bool match_percent(int a, int b)
return (a + 5) / 10 == (b + 5) / 10;
}
-static int get_gasidx(struct dive *dive, int o2, int he)
+int get_gasidx(struct dive *dive, int o2, int he)
{
int gasidx = -1;
diff --git a/planner.h b/planner.h
index caecd513f..330d7df60 100644
--- a/planner.h
+++ b/planner.h
@@ -12,6 +12,7 @@ extern timestamp_t current_time_notz(void);
extern void show_planned_dive(char **error_string_p);
extern void set_last_stop(bool last_stop_6m);
extern void get_gas_from_events(struct divecomputer *dc, int time, int *o2, int *he);
+extern int get_gasidx(struct dive *dive, int o2, int he);
extern struct diveplan diveplan;
extern struct dive *planned_dive;
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 06caa67be..e0e759dd4 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -26,6 +26,7 @@
#include "../profile.h"
#include "../device.h"
#include "../helpers.h"
+#include "../planner.h"
#include <libdivecomputer/parser.h>
#include <libdivecomputer/version.h>
@@ -167,7 +168,12 @@ void ProfileGraphicsView::changeGas()
QPoint viewPos = mapFromGlobal(globalPos);
QPointF scenePos = mapToScene(viewPos);
QString gas = action->text();
- qDebug() << "Change Gas Event" << gas;
+ int o2, he;
+ validate_gas(gas.toUtf8().constData(), &o2, &he);
+ int seconds = scenePos.x() / gc.maxx * (gc.rightx - gc.leftx) + gc.leftx;
+ add_gas_switch_event(current_dive, current_dc, seconds, get_gasidx(current_dive, o2, he));
+ mark_divelist_changed(TRUE);
+ plot(current_dive, TRUE);
}
void ProfileGraphicsView::hideEvents()