aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--planner.c8
-rw-r--r--qt-ui/mainwindow.cpp6
-rw-r--r--qt-ui/mainwindow.h1
-rw-r--r--qthelper.cpp6
4 files changed, 12 insertions, 9 deletions
diff --git a/planner.c b/planner.c
index c5f886c7b..f7b3a3f93 100644
--- a/planner.c
+++ b/planner.c
@@ -33,14 +33,6 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133
double plangflow, plangfhigh;
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;
-/* This is a bit round about: Currently, we only support VPM-B in the planner,
- * so, when we compute ceilings we have to know if we are in planning mode since
- * the maximally allowed gradient in the tissues is determined by the critical volume algorithm for
- * which we currently have no version for logged dives. But the information about the application state
- * is only available in the C++/Qt part. So this global variable is a way to leak this info. */
-
-bool in_planner = false;
-
const char *disclaimer;
#if DEBUG_PLAN
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index f22884a84..1a12305d9 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1716,7 +1716,6 @@ void MainWindow::setApplicationState(const QByteArray& state) {
return;
currentApplicationState = state;
- in_planner = (state == "PlanDive" || state == "EditPlannedDive");
#define SET_CURRENT_INDEX( X ) \
if (applicationState[state].X) { \
@@ -1732,3 +1731,8 @@ void MainWindow::setApplicationState(const QByteArray& state) {
SET_CURRENT_INDEX( bottomRight )
#undef SET_CURRENT_INDEX
}
+
+bool MainWindow::inPlanner()
+{
+ return (currentApplicationState == "PlanDive" || currentApplicationState == "EditPlannedDive");
+}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index 583dc591a..4df1d1238 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -89,6 +89,7 @@ public:
void printPlan();
void checkSurvey(QSettings *s);
void setApplicationState(const QByteArray& state);
+ bool inPlanner();
QUndoStack *undoStack;
NotificationWidget *getNotificationWidget();
void enableDisableCloudActions();
diff --git a/qthelper.cpp b/qthelper.cpp
index 14a48c151..44bb8a33a 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -12,6 +12,7 @@
#include <exif.h>
#include "file.h"
#include "prefs-macros.h"
+#include "mainwindow.h"
#include <QFile>
#include <QRegExp>
#include <QDir>
@@ -1272,3 +1273,8 @@ extern "C" void parse_display_units(char *line)
{
qDebug() << line;
}
+
+extern "C" bool in_planner()
+{
+ return MainWindow::instance()->inPlanner();
+}