mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Replace global in_planner variable by helper function
as promised earlier Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4e89a6020e
commit
72806e42bc
4 changed files with 12 additions and 9 deletions
|
@ -33,14 +33,6 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133
|
||||||
double plangflow, plangfhigh;
|
double plangflow, plangfhigh;
|
||||||
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;
|
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;
|
const char *disclaimer;
|
||||||
|
|
||||||
#if DEBUG_PLAN
|
#if DEBUG_PLAN
|
||||||
|
|
|
@ -1716,7 +1716,6 @@ void MainWindow::setApplicationState(const QByteArray& state) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
currentApplicationState = state;
|
currentApplicationState = state;
|
||||||
in_planner = (state == "PlanDive" || state == "EditPlannedDive");
|
|
||||||
|
|
||||||
#define SET_CURRENT_INDEX( X ) \
|
#define SET_CURRENT_INDEX( X ) \
|
||||||
if (applicationState[state].X) { \
|
if (applicationState[state].X) { \
|
||||||
|
@ -1732,3 +1731,8 @@ void MainWindow::setApplicationState(const QByteArray& state) {
|
||||||
SET_CURRENT_INDEX( bottomRight )
|
SET_CURRENT_INDEX( bottomRight )
|
||||||
#undef SET_CURRENT_INDEX
|
#undef SET_CURRENT_INDEX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::inPlanner()
|
||||||
|
{
|
||||||
|
return (currentApplicationState == "PlanDive" || currentApplicationState == "EditPlannedDive");
|
||||||
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@ public:
|
||||||
void printPlan();
|
void printPlan();
|
||||||
void checkSurvey(QSettings *s);
|
void checkSurvey(QSettings *s);
|
||||||
void setApplicationState(const QByteArray& state);
|
void setApplicationState(const QByteArray& state);
|
||||||
|
bool inPlanner();
|
||||||
QUndoStack *undoStack;
|
QUndoStack *undoStack;
|
||||||
NotificationWidget *getNotificationWidget();
|
NotificationWidget *getNotificationWidget();
|
||||||
void enableDisableCloudActions();
|
void enableDisableCloudActions();
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <exif.h>
|
#include <exif.h>
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "prefs-macros.h"
|
#include "prefs-macros.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -1272,3 +1273,8 @@ extern "C" void parse_display_units(char *line)
|
||||||
{
|
{
|
||||||
qDebug() << line;
|
qDebug() << line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" bool in_planner()
|
||||||
|
{
|
||||||
|
return MainWindow::instance()->inPlanner();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue