summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.c2
-rw-r--r--core/pref.h1
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp16
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h4
-rw-r--r--core/subsurfacestartup.c1
-rw-r--r--desktop-widgets/preferences/preferences_graph.cpp2
-rw-r--r--desktop-widgets/preferences/preferences_graph.ui7
7 files changed, 33 insertions, 0 deletions
diff --git a/core/dive.c b/core/dive.c
index 6d19b7e58..b405d7402 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -1182,6 +1182,8 @@ static void sanitize_cylinder_info(struct dive *dive)
*/
bool isobaric_counterdiffusion(struct gasmix *oldgasmix, struct gasmix *newgasmix, struct icd_data *results)
{
+ if (!prefs.show_icd)
+ return false;
results->dN2 = get_he(oldgasmix) + get_o2(oldgasmix) - get_he(newgasmix) - get_o2(newgasmix);
results->dHe = get_he(newgasmix) - get_he(oldgasmix);
return get_he(oldgasmix) > 0 && results->dN2 > 0 && results->dHe < 0 && get_he(oldgasmix) && results->dN2 > 0 && 5 * results->dN2 > -results->dHe;
diff --git a/core/pref.h b/core/pref.h
index 9f7192ca3..3ba7c26d3 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -94,6 +94,7 @@ struct preferences {
bool show_sac;
bool display_unused_tanks;
bool show_average_depth;
+ bool show_icd;
bool zoomed_plot;
bool hrgraph;
bool percentagegraph;
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 7dff976fb..54b03aaf9 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -423,6 +423,11 @@ bool TechnicalDetailsSettings::showAverageDepth() const
return prefs.show_average_depth;
}
+bool TechnicalDetailsSettings::showIcd() const
+{
+ return prefs.show_icd;
+}
+
bool TechnicalDetailsSettings::mod() const
{
return prefs.mod;
@@ -718,6 +723,17 @@ void TechnicalDetailsSettings::setShowAverageDepth(bool value)
emit showAverageDepthChanged(value);
}
+void TechnicalDetailsSettings::setShowIcd(bool value)
+{
+ if (value == prefs.show_icd)
+ return;
+ QSettings s;
+ s.beginGroup(group);
+ s.setValue("show_icd", value);
+ prefs.show_icd = value;
+ emit showIcdChanged(value);
+}
+
FacebookSettings::FacebookSettings(QObject *parent) :
QObject(parent),
group(QStringLiteral("WebApps")),
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index a41caae40..94bbcf5fc 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -139,6 +139,7 @@ class TechnicalDetailsSettings : public QObject {
Q_PROPERTY(bool show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged)
Q_PROPERTY(bool display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged)
Q_PROPERTY(bool show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged)
+ Q_PROPERTY(bool show_icd READ showIcd WRITE setShowIcd NOTIFY showIcdChanged)
Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged)
Q_PROPERTY(deco_mode deco READ deco WRITE setDecoMode NOTIFY decoModeChanged)
@@ -168,6 +169,7 @@ public:
bool showSac() const;
bool displayUnusedTanks() const;
bool showAverageDepth() const;
+ bool showIcd() const;
bool showPicturesInProfile() const;
deco_mode deco() const;
@@ -195,6 +197,7 @@ public slots:
void setShowSac(bool value);
void setDisplayUnusedTanks(bool value);
void setShowAverageDepth(bool value);
+ void setShowIcd(bool value);
void setShowPicturesInProfile(bool value);
void setDecoMode(deco_mode d);
@@ -222,6 +225,7 @@ signals:
void showSacChanged(bool value);
void displayUnusedTanksChanged(bool value);
void showAverageDepthChanged(bool value);
+ void showIcdChanged(bool value);
void showPicturesInProfileChanged(bool value);
void decoModeChanged(deco_mode m);
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index 90611a8dd..d4d191072 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -47,6 +47,7 @@ struct preferences default_prefs = {
.show_sac = false,
.display_unused_tanks = false,
.show_average_depth = true,
+ .show_icd = false,
.ascrate75 = 9000 / 60,
.ascrate50 = 9000 / 60,
.ascratestops = 9000 / 60,
diff --git a/desktop-widgets/preferences/preferences_graph.cpp b/desktop-widgets/preferences/preferences_graph.cpp
index 20e0918ab..ccc9aee65 100644
--- a/desktop-widgets/preferences/preferences_graph.cpp
+++ b/desktop-widgets/preferences/preferences_graph.cpp
@@ -46,6 +46,7 @@ void PreferencesGraph::refreshSettings()
ui->display_unused_tanks->setChecked(prefs.display_unused_tanks);
ui->show_average_depth->setChecked(prefs.show_average_depth);
+ ui->show_icd->setChecked(prefs.show_icd);
}
void PreferencesGraph::syncSettings()
@@ -72,6 +73,7 @@ void PreferencesGraph::syncSettings()
tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked());
tech->setDisplayUnusedTanks(ui->display_unused_tanks->isChecked());
tech->setShowAverageDepth(ui->show_average_depth->isChecked());
+ tech->setShowIcd(ui->show_icd->isChecked());
tech->setDecoMode(ui->vpmb->isChecked() ? VPMB : BUEHLMANN);
}
diff --git a/desktop-widgets/preferences/preferences_graph.ui b/desktop-widgets/preferences/preferences_graph.ui
index 2823c3c69..72d1010b3 100644
--- a/desktop-widgets/preferences/preferences_graph.ui
+++ b/desktop-widgets/preferences/preferences_graph.ui
@@ -354,6 +354,13 @@
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="show_icd">
+ <property name="text">
+ <string>Warn for isobaric counter diffusion</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>