mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Add preference to change deco model
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									b5de08b709
								
							
						
					
					
						commit
						0d20344c90
					
				
					 5 changed files with 130 additions and 70 deletions
				
			
		|  | @ -299,6 +299,11 @@ bool TechnicalDetailsSettings::calcndltts() const | |||
| 	return prefs.calcndltts; | ||||
| } | ||||
| 
 | ||||
| bool TechnicalDetailsSettings::buehlmann() const | ||||
| { | ||||
| 	return (prefs.deco_mode == BUEHLMANN); | ||||
| } | ||||
| 
 | ||||
| int TechnicalDetailsSettings::gflow() const | ||||
| { | ||||
| 	return prefs.gflow; | ||||
|  | @ -499,6 +504,17 @@ void TechnicalDetailsSettings::setCalcndltts(bool value) | |||
| 	emit calcndlttsChanged(value); | ||||
| } | ||||
| 
 | ||||
| void TechnicalDetailsSettings::setBuehlmann(bool value) | ||||
| { | ||||
| 	if (value == (prefs.deco_mode == BUEHLMANN)) | ||||
| 		return; | ||||
| 	QSettings s; | ||||
| 	s.beginGroup(group); | ||||
| 	s.setValue("buehlmann", value); | ||||
| 	prefs.deco_mode = value ? BUEHLMANN : VPMB; | ||||
| 	emit buehlmannChanged(value); | ||||
| } | ||||
| 
 | ||||
| void TechnicalDetailsSettings::setGflow(int value) | ||||
| { | ||||
| 	if (value == prefs.gflow) | ||||
|  | @ -2105,6 +2121,11 @@ void SettingsObjectWrapper::load() | |||
| 	GET_BOOL("tankbar", tankbar); | ||||
| 	GET_BOOL("RulerBar", rulergraph); | ||||
| 	GET_BOOL("percentagegraph", percentagegraph); | ||||
| 	v = s.value("buehlmann"); | ||||
| 	if (v.isValid()) | ||||
| 		prefs.deco_mode = v.toBool() ? BUEHLMANN : VPMB; | ||||
| 	else | ||||
| 		prefs.deco_mode = BUEHLMANN; | ||||
| 	GET_INT("gflow", gflow); | ||||
| 	GET_INT("gfhigh", gfhigh); | ||||
| 	GET_INT("vpmb_conservatism", vpmb_conservatism); | ||||
|  |  | |||
|  | @ -116,6 +116,7 @@ class TechnicalDetailsSettings : public QObject { | |||
| 	Q_PROPERTY(bool calcceiling3m    READ calcceiling3m   WRITE setCalcceiling3m   NOTIFY calcceiling3mChanged) | ||||
| 	Q_PROPERTY(bool calcalltissues   READ calcalltissues  WRITE setCalcalltissues  NOTIFY calcalltissuesChanged) | ||||
| 	Q_PROPERTY(bool calcndltts       READ calcndltts      WRITE setCalcndltts      NOTIFY calcndlttsChanged) | ||||
| 	Q_PROPERTY(bool buehlmann        READ buehlmann       WRITE setBuehlmann       NOTIFY buehlmannChanged) | ||||
| 	Q_PROPERTY(int gflow            READ gflow           WRITE setGflow           NOTIFY gflowChanged) | ||||
| 	Q_PROPERTY(int gfhigh           READ gfhigh          WRITE setGfhigh          NOTIFY gfhighChanged) | ||||
| 	Q_PROPERTY(short vpmb_conservatism READ vpmbConservatism WRITE setVpmbConservatism NOTIFY vpmbConservatismChanged) | ||||
|  | @ -143,6 +144,7 @@ public: | |||
| 	bool calcceiling3m() const; | ||||
| 	bool calcalltissues() const; | ||||
| 	bool calcndltts() const; | ||||
| 	bool buehlmann() const; | ||||
| 	int gflow() const; | ||||
| 	int gfhigh() const; | ||||
| 	short vpmbConservatism() const; | ||||
|  | @ -169,6 +171,7 @@ public slots: | |||
| 	void setCalcceiling3m(bool value); | ||||
| 	void setCalcalltissues(bool value); | ||||
| 	void setCalcndltts(bool value); | ||||
| 	void setBuehlmann(bool value); | ||||
| 	void setGflow(int value); | ||||
| 	void setGfhigh(int value); | ||||
| 	void setVpmbConservatism(short); | ||||
|  | @ -195,6 +198,7 @@ signals: | |||
| 	void calcceiling3mChanged(bool value); | ||||
| 	void calcalltissuesChanged(bool value); | ||||
| 	void calcndlttsChanged(bool value); | ||||
| 	void buehlmannChanged(bool value); | ||||
| 	void gflowChanged(int value); | ||||
| 	void gfhighChanged(int value); | ||||
| 	void vpmbConservatismChanged(short value); | ||||
|  |  | |||
|  | @ -25,6 +25,13 @@ void PreferencesGraph::refreshSettings() | |||
| 	ui->maxpo2->setValue(prefs.modpO2); | ||||
| 	ui->red_ceiling->setChecked(prefs.redceiling); | ||||
| 
 | ||||
| 	if (prefs.deco_mode == BUEHLMANN) { | ||||
| 		ui->buehlmann->setChecked(true); | ||||
| 		ui->vpmb->setChecked(false); | ||||
| 	} else { | ||||
| 		ui->buehlmann->setChecked(false); | ||||
| 		ui->vpmb->setChecked(false); | ||||
| 	} | ||||
| 	ui->gflow->setValue(prefs.gflow); | ||||
| 	ui->gfhigh->setValue(prefs.gfhigh); | ||||
| 	ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism); | ||||
|  | @ -54,6 +61,7 @@ void PreferencesGraph::syncSettings() | |||
| 	auto tech = SettingsObjectWrapper::instance()->techDetails; | ||||
| 	tech->setModp02(ui->maxpo2->value()); | ||||
| 	tech->setRedceiling(ui->red_ceiling->isChecked()); | ||||
| 	tech->setBuehlmann(ui->buehlmann->isChecked()); | ||||
| 	tech->setGflow(ui->gflow->value()); | ||||
| 	tech->setGfhigh(ui->gfhigh->value()); | ||||
| 	tech->setVpmbConservatism(ui->vpmb_conservatism->value()); | ||||
|  | @ -73,4 +81,13 @@ void PreferencesGraph::on_gfhigh_valueChanged(int gf) | |||
| { | ||||
| 	ui->gfhigh->setStyleSheet(DANGER_GF); | ||||
| } | ||||
| 
 | ||||
| void PreferencesGraph::on_buehlmann_toggled(bool buehlmann) | ||||
| { | ||||
| 	ui->gfhigh->setEnabled(buehlmann); | ||||
| 	ui->gflow->setEnabled(buehlmann); | ||||
| 	ui->gf_low_at_maxdepth->setEnabled(buehlmann); | ||||
| 	ui->vpmb_conservatism->setEnabled(!buehlmann); | ||||
| } | ||||
| 
 | ||||
| #undef DANGER_GF | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ public: | |||
| private slots: | ||||
| 	void on_gflow_valueChanged(int gf); | ||||
| 	void on_gfhigh_valueChanged(int gf); | ||||
| 	void on_buehlmann_toggled(bool buelmann); | ||||
| 
 | ||||
| private: | ||||
| 	Ui::PreferencesGraph *ui; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
|     <x>0</x> | ||||
|     <y>0</y> | ||||
|     <width>505</width> | ||||
|     <height>555</height> | ||||
|     <height>575</height> | ||||
|    </rect> | ||||
|   </property> | ||||
|   <property name="windowTitle"> | ||||
|  | @ -133,31 +133,14 @@ | |||
|       <string>Misc</string> | ||||
|      </property> | ||||
|      <layout class="QGridLayout" name="gridLayout_2"> | ||||
|       <item row="0" column="0"> | ||||
|       <item row="1" column="0"> | ||||
|        <widget class="QLabel" name="label_19"> | ||||
|         <property name="text"> | ||||
|          <string>GFLow</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="0" column="1"> | ||||
|        <widget class="QSpinBox" name="gflow"> | ||||
|         <property name="minimum"> | ||||
|          <number>1</number> | ||||
|         </property> | ||||
|         <property name="maximum"> | ||||
|          <number>150</number> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="1" column="0"> | ||||
|        <widget class="QLabel" name="label_20"> | ||||
|         <property name="text"> | ||||
|          <string>GFHigh</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="1" column="1"> | ||||
|       <item row="2" column="1"> | ||||
|        <widget class="QSpinBox" name="gfhigh"> | ||||
|         <property name="minimum"> | ||||
|          <number>1</number> | ||||
|  | @ -167,34 +150,86 @@ | |||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="8" column="0" colspan="2"> | ||||
|        <widget class="QCheckBox" name="show_ccr_setpoint"> | ||||
|         <property name="text"> | ||||
|          <string>CCR: show setpoints when viewing pO₂</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="7" column="0" colspan="2"> | ||||
|        <widget class="QCheckBox" name="gf_low_at_maxdepth"> | ||||
|         <property name="text"> | ||||
|          <string>GFLow at max depth</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="1" column="1"> | ||||
|        <widget class="QSpinBox" name="gflow"> | ||||
|         <property name="minimum"> | ||||
|          <number>1</number> | ||||
|         </property> | ||||
|         <property name="maximum"> | ||||
|          <number>150</number> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="2" column="0"> | ||||
|        <widget class="QLabel" name="label_20"> | ||||
|         <property name="text"> | ||||
|          <string>GFHigh</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="6" column="1"> | ||||
|        <widget class="QSpinBox" name="pscrfactor"> | ||||
|         <property name="suffix"> | ||||
|          <string/> | ||||
|         </property> | ||||
|         <property name="prefix"> | ||||
|          <string>1:</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="6" column="0"> | ||||
|        <widget class="QLabel" name="label_28"> | ||||
|         <property name="text"> | ||||
|          <string>pSCR ratio</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="3" column="0"> | ||||
|        <widget class="QLabel" name="label_21"> | ||||
|         <property name="text"> | ||||
|          <string>VPM-B Conservatism</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="2" column="1"> | ||||
|        <widget class="QSpinBox" name="vpmb_conservatism"> | ||||
|         <property name="prefix"> | ||||
|          <string>+</string> | ||||
|         </property> | ||||
|         <property name="minimum"> | ||||
|          <number>0</number> | ||||
|         </property> | ||||
|         <property name="maximum"> | ||||
|          <number>4</number> | ||||
|       <item row="9" column="0" colspan="2"> | ||||
|        <widget class="QCheckBox" name="show_ccr_sensors"> | ||||
|         <property name="text"> | ||||
|          <string>CCR: show individual O₂ sensor values when viewing pO₂</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="3" column="0"> | ||||
|       <item row="5" column="1"> | ||||
|        <widget class="QDoubleSpinBox" name="psro2rate"> | ||||
|         <property name="suffix"> | ||||
|          <string>ℓ/min</string> | ||||
|         </property> | ||||
|         <property name="decimals"> | ||||
|          <number>3</number> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="4" column="0"> | ||||
|        <widget class="QLabel" name="label_26"> | ||||
|         <property name="text"> | ||||
|          <string>Default CCR set-point for dive planning</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="3" column="1"> | ||||
|       <item row="4" column="1"> | ||||
|        <widget class="QDoubleSpinBox" name="defaultSetpoint"> | ||||
|         <property name="suffix"> | ||||
|          <string>bar</string> | ||||
|  | @ -210,58 +245,40 @@ | |||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="4" column="0"> | ||||
|       <item row="5" column="0"> | ||||
|        <widget class="QLabel" name="pSCR"> | ||||
|         <property name="text"> | ||||
|          <string>pSCR O₂ metabolism rate</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="4" column="1"> | ||||
|        <widget class="QDoubleSpinBox" name="psro2rate"> | ||||
|         <property name="suffix"> | ||||
|          <string>ℓ/min</string> | ||||
|         </property> | ||||
|         <property name="decimals"> | ||||
|          <number>3</number> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="5" column="0"> | ||||
|        <widget class="QLabel" name="label_28"> | ||||
|         <property name="text"> | ||||
|          <string>pSCR ratio</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="5" column="1"> | ||||
|        <widget class="QSpinBox" name="pscrfactor"> | ||||
|         <property name="suffix"> | ||||
|          <string/> | ||||
|         </property> | ||||
|       <item row="3" column="1"> | ||||
|        <widget class="QSpinBox" name="vpmb_conservatism"> | ||||
|         <property name="prefix"> | ||||
|          <string>1:</string> | ||||
|          <string>+</string> | ||||
|         </property> | ||||
|         <property name="minimum"> | ||||
|          <number>0</number> | ||||
|         </property> | ||||
|         <property name="maximum"> | ||||
|          <number>4</number> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="6" column="0" colspan="2"> | ||||
|        <widget class="QCheckBox" name="gf_low_at_maxdepth"> | ||||
|       <item row="0" column="0"> | ||||
|        <widget class="QRadioButton" name="buehlmann"> | ||||
|         <property name="text"> | ||||
|          <string>GFLow at max depth</string> | ||||
|          <string>Bühlmann</string> | ||||
|         </property> | ||||
|         <property name="checked"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="7" column="0" colspan="2"> | ||||
|        <widget class="QCheckBox" name="show_ccr_setpoint"> | ||||
|       <item row="0" column="1"> | ||||
|        <widget class="QRadioButton" name="vpmb"> | ||||
|         <property name="text"> | ||||
|          <string>CCR: show setpoints when viewing pO₂</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|       <item row="8" column="0" colspan="2"> | ||||
|        <widget class="QCheckBox" name="show_ccr_sensors"> | ||||
|         <property name="text"> | ||||
|          <string>CCR: show individual O₂ sensor values when viewing pO₂</string> | ||||
|          <string>VPM-B</string> | ||||
|         </property> | ||||
|        </widget> | ||||
|       </item> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue