summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-19 20:35:15 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-19 20:35:15 -0800
commit36cb50fb37f8cede4f334b268406ebd55c12ece6 (patch)
tree475a1535d91cecce7158dce27d3166988fb6abc0 /qt-ui
parent28ad26e8787f966223e448aaf728918dff92149e (diff)
downloadsubsurface-36cb50fb37f8cede4f334b268406ebd55c12ece6.tar.gz
Add gas change event from profile context menu
This allows to add missing gas change events to the currently shown dive computer. Only gases defined in the Equipment section are offered. Fixes: #250 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profilegraphics.cpp8
1 files changed, 7 insertions, 1 deletions
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()