[PATCH] fixup: Don't confuse EAD and END

Rick Walsh rickmwalsh at gmail.com
Sat May 21 03:14:23 PDT 2016


The previous patch (Planner: add best mix EAD preference) used the term EAD
(equivalent air depth) in variable names and strings, when it should have been
END (equivalent narcotic depth).
They're not the same thing and shouldn't be confused.

Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
---
I blame lack of diving

 core/dive.c                                  |  2 +-
 core/pref.h                                  |  2 +-
 core/subsurface-qt/SettingsObjectWrapper.cpp | 12 ++++++------
 core/subsurface-qt/SettingsObjectWrapper.h   |  8 ++++----
 core/subsurfacestartup.c                     |  2 +-
 desktop-widgets/diveplanner.cpp              | 16 ++++++++--------
 desktop-widgets/diveplanner.h                |  2 +-
 desktop-widgets/plannerSettings.ui           |  8 ++++----
 8 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/core/dive.c b/core/dive.c
index c4f5dd7..20ab2e5 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3654,7 +3654,7 @@ fraction_t best_He(depth_t depth, struct dive *dive)
 {
 	fraction_t fhe;
 	int pnarcotic, ambient;
-	pnarcotic = depth_to_mbar(prefs.bestmixead, dive);
+	pnarcotic = depth_to_mbar(prefs.bestmixend, dive);
 	ambient = depth_to_mbar(depth.mm, dive);
 	fhe.permille = (100 - 100 * pnarcotic / ambient) * 10;	//use integer arithmetic to round up to nearest percent
 	if (fhe.permille < 0)
diff --git a/core/pref.h b/core/pref.h
index be34379..a0f9158 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -92,7 +92,7 @@ struct preferences {
 	int descrate;
 	int bottompo2;
 	int decopo2;
-	int bestmixead;
+	int bestmixend;
 	int proxy_type;
 	char *proxy_host;
 	int proxy_port;
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index eeb4c96..b8865e2 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -915,9 +915,9 @@ int DivePlannerSettings::decopo2() const
 	return prefs.decopo2;
 }
 
-int DivePlannerSettings::bestmixead() const
+int DivePlannerSettings::bestmixend() const
 {
-	return prefs.bestmixead;
+	return prefs.bestmixend;
 }
 
 int DivePlannerSettings::reserveGas() const
@@ -1094,13 +1094,13 @@ void DivePlannerSettings::setDecopo2(int value)
 	emit decopo2Changed(value);
 }
 
-void DivePlannerSettings::setBestmixead(int value)
+void DivePlannerSettings::setBestmixend(int value)
 {
 	QSettings s;
 	s.beginGroup(group);
-	s.setValue("bestmixead", value);
-	prefs.bestmixead = value;
-	emit bestmixeadChanged(value);
+	s.setValue("bestmixend", value);
+	prefs.bestmixend = value;
+	emit bestmixendChanged(value);
 }
 
 void DivePlannerSettings::setReserveGas(int value)
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index b4b898a..3b19c9a 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -327,7 +327,7 @@ class DivePlannerSettings : public QObject {
 	Q_PROPERTY(int descrate             READ descrate             WRITE setDescrate             NOTIFY descrateChanged)
 	Q_PROPERTY(int bottompo2            READ bottompo2            WRITE setBottompo2            NOTIFY bottompo2Changed)
 	Q_PROPERTY(int decopo2              READ decopo2              WRITE setDecopo2              NOTIFY decopo2Changed)
-	Q_PROPERTY(int bestmixead           READ bestmixead           WRITE setBestmixead           NOTIFY bestmixeadChanged)
+	Q_PROPERTY(int bestmixend           READ bestmixend           WRITE setBestmixend           NOTIFY bestmixendChanged)
 	Q_PROPERTY(int reserve_gas          READ reserveGas           WRITE setReserveGas           NOTIFY reserveGasChanged)
 	Q_PROPERTY(int min_switch_duration  READ minSwitchDuration    WRITE setMinSwitchDuration    NOTIFY minSwitchDurationChanged)
 	Q_PROPERTY(int bottomsac            READ bottomSac            WRITE setBottomSac            NOTIFY bottomSacChanged)
@@ -353,7 +353,7 @@ public:
 	int descrate() const;
 	int bottompo2() const;
 	int decopo2() const;
-	int bestmixead() const;
+	int bestmixend() const;
 	int reserveGas() const;
 	int minSwitchDuration() const;
 	int bottomSac() const;
@@ -378,7 +378,7 @@ public slots:
 	void setDescrate(int value);
 	void setBottompo2(int value);
 	void setDecopo2(int value);
-	void setBestmixead(int value);
+	void setBestmixend(int value);
 	void setReserveGas(int value);
 	void setMinSwitchDuration(int value);
 	void setBottomSac(int value);
@@ -403,7 +403,7 @@ signals:
 	void descrateChanged(int value);
 	void bottompo2Changed(int value);
 	void decopo2Changed(int value);
-	void bestmixeadChanged(int value);
+	void bestmixendChanged(int value);
 	void reserveGasChanged(int value);
 	void minSwitchDurationChanged(int value);
 	void bottomSacChanged(int value);
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index f58efb1..1dba381 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -52,7 +52,7 @@ struct preferences default_prefs = {
 	.descrate = 18000 / 60,
 	.bottompo2 = 1400,
 	.decopo2 = 1600,
-	.bestmixead = 30000,
+	.bestmixend = 30000,
 	.doo2breaks = false,
 	.drop_stone_mode = false,
 	.switch_at_req_stop = false,
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index ac322d2..0455573 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -288,7 +288,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 	prefs.descrate = s.value("descrate", prefs.descrate).toInt();
 	prefs.bottompo2 = s.value("bottompo2", prefs.bottompo2).toInt();
 	prefs.decopo2 = s.value("decopo2", prefs.decopo2).toInt();
-	prefs.bestmixead = s.value("bestmixead", prefs.bestmixead).toInt();
+	prefs.bestmixend = s.value("bestmixend", prefs.bestmixend).toInt();
 	prefs.doo2breaks = s.value("doo2breaks", prefs.doo2breaks).toBool();
 	prefs.switch_at_req_stop = s.value("switch_at_req_stop", prefs.switch_at_req_stop).toBool();
 	prefs.min_switch_duration = s.value("min_switch_duration", prefs.min_switch_duration).toInt();
@@ -352,7 +352,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 	connect(ui.descRate, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
 	connect(ui.bottompo2, SIGNAL(valueChanged(double)), this, SLOT(setBottomPo2(double)));
 	connect(ui.decopo2, SIGNAL(valueChanged(double)), this, SLOT(setDecoPo2(double)));
-	connect(ui.bestmixEAD, SIGNAL(valueChanged(int)), this, SLOT(setBestmixEAD(int)));
+	connect(ui.bestmixEND, SIGNAL(valueChanged(int)), this, SLOT(setBestmixEND(int)));
 	connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool)));
 	connect(ui.bottomSAC, SIGNAL(valueChanged(double)), this, SLOT(bottomSacChanged(double)));
 	connect(ui.decoStopSAC, SIGNAL(valueChanged(double)), this, SLOT(decoSacChanged(double)));
@@ -382,7 +382,7 @@ void PlannerSettingsWidget::updateUnitsUI()
 	ui.ascRateStops->setValue(rint(prefs.ascratestops / UNIT_FACTOR));
 	ui.ascRateLast6m->setValue(rint(prefs.ascratelast6m / UNIT_FACTOR));
 	ui.descRate->setValue(rint(prefs.descrate / UNIT_FACTOR));
-	ui.bestmixEAD->setValue(rint(get_depth_units(prefs.bestmixead, NULL, NULL)));
+	ui.bestmixEND->setValue(rint(get_depth_units(prefs.bestmixend, NULL, NULL)));
 }
 
 PlannerSettingsWidget::~PlannerSettingsWidget()
@@ -403,7 +403,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
 	s.setValue("descrate", prefs.descrate);
 	s.setValue("bottompo2", prefs.bottompo2);
 	s.setValue("decopo2", prefs.decopo2);
-	s.setValue("bestmixead", prefs.bestmixead);
+	s.setValue("bestmixend", prefs.bestmixend);
 	s.setValue("doo2breaks", prefs.doo2breaks);
 	s.setValue("drop_stone_mode", prefs.drop_stone_mode);
 	s.setValue("switch_at_req_stop", prefs.switch_at_req_stop);
@@ -426,13 +426,13 @@ void PlannerSettingsWidget::settingsChanged()
 		ui.lastStop->setText(tr("Last stop at 20ft"));
 		ui.asc50to6->setText(tr("50% avg. depth to 20ft"));
 		ui.asc6toSurf->setText(tr("20ft to surface"));
-		ui.bestmixEAD->setSuffix(tr("ft"));
+		ui.bestmixEND->setSuffix(tr("ft"));
 	} else {
 		vs.append(tr("m/min"));
 		ui.lastStop->setText(tr("Last stop at 6m"));
 		ui.asc50to6->setText(tr("50% avg. depth to 6m"));
 		ui.asc6toSurf->setText(tr("6m to surface"));
-		ui.bestmixEAD->setSuffix(tr("m"));
+		ui.bestmixEND->setSuffix(tr("m"));
 	}
 	if(get_units()->volume == units::CUFT) {
 		ui.bottomSAC->setSuffix(tr("cuft/min"));
@@ -514,9 +514,9 @@ void PlannerSettingsWidget::setDecoPo2(double po2)
 	prefs.decopo2 = (int) (po2 * 1000.0);
 }
 
-void PlannerSettingsWidget::setBestmixEAD(int depth)
+void PlannerSettingsWidget::setBestmixEND(int depth)
 {
-	prefs.bestmixead = units_to_depth(depth);
+	prefs.bestmixend = units_to_depth(depth);
 }
 
 void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks)
diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h
index 69f9938..cf3a172 100644
--- a/desktop-widgets/diveplanner.h
+++ b/desktop-widgets/diveplanner.h
@@ -78,7 +78,7 @@ slots:
 	void setDescRate(int rate);
 	void setBottomPo2(double po2);
 	void setDecoPo2(double po2);
-	void setBestmixEAD(int depth);
+	void setBestmixEND(int depth);
 	void setBackgasBreaks(bool dobreaks);
 	void disableDecoElements(int mode);
 
diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui
index 2ec8d4a..81783cf 100644
--- a/desktop-widgets/plannerSettings.ui
+++ b/desktop-widgets/plannerSettings.ui
@@ -589,7 +589,7 @@
            </widget>
           </item>
           <item row="4" column="1">
-           <widget class="QSpinBox" name="bestmixEAD">
+           <widget class="QSpinBox" name="bestmixEND">
             <property name="suffix">
              <string>m</string>
             </property>
@@ -622,9 +622,9 @@
            </widget>
           </item>
           <item row="4" column="0">
-           <widget class="QLabel" name="bestEAD">
+           <widget class="QLabel" name="bestEND">
             <property name="text">
-             <string>Best mix EAD</string>
+             <string>Best mix END</string>
             </property>
            </widget>
           </item>
@@ -765,7 +765,7 @@
   <tabstop>decoStopSAC</tabstop>
   <tabstop>bottompo2</tabstop>
   <tabstop>decopo2</tabstop>
-  <tabstop>bestmixEAD</tabstop>
+  <tabstop>bestmixEND</tabstop>
   <tabstop>display_runtime</tabstop>
   <tabstop>display_duration</tabstop>
   <tabstop>display_transitions</tabstop>
-- 
2.5.5



More information about the subsurface mailing list