mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Checkbox and preference for safety stop
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									cd34fea1db
								
							
						
					
					
						commit
						cc8d601422
					
				
					 6 changed files with 33 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -905,7 +905,7 @@ int plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool s
 | 
			
		|||
	bottom_time = clock = previous_point_time = displayed_dive.dc.sample[displayed_dive.dc.samples - 1].time.seconds;
 | 
			
		||||
	gi = gaschangenr - 1;
 | 
			
		||||
	if(prefs.recreational_mode) {
 | 
			
		||||
		bool safety_stop = true;
 | 
			
		||||
		bool safety_stop = prefs.safetystop;
 | 
			
		||||
		// How long can we stay at the current depth and still directly ascent to the surface?
 | 
			
		||||
		while (trial_ascent(depth, 0, avg_depth, bottom_time, tissue_tolerance, &displayed_dive.cylinder[current_cylinder].gasmix,
 | 
			
		||||
				  po2, diveplan->surface_pressure / 1000.0)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								pref.h
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								pref.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -79,6 +79,7 @@ struct preferences {
 | 
			
		|||
	bool display_duration;
 | 
			
		||||
	bool display_transitions;
 | 
			
		||||
	bool recreational_mode;
 | 
			
		||||
	bool safetystop;
 | 
			
		||||
	int bottomsac;
 | 
			
		||||
	int decosac;
 | 
			
		||||
	int o2consumption; // ml per min
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -394,6 +394,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 | 
			
		|||
	prefs.display_runtime = s.value("display_runtime", prefs.display_runtime).toBool();
 | 
			
		||||
	prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
 | 
			
		||||
	prefs.recreational_mode = s.value("recreational_mode", prefs.recreational_mode).toBool();
 | 
			
		||||
	prefs.safetystop = s.value("safetystop", prefs.safetystop).toBool();
 | 
			
		||||
	prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
 | 
			
		||||
	prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt();
 | 
			
		||||
	prefs.ascratestops = s.value("ascratestops", prefs.ascratestops).toInt();
 | 
			
		||||
| 
						 | 
				
			
			@ -416,6 +417,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 | 
			
		|||
	ui.display_runtime->setChecked(prefs.display_runtime);
 | 
			
		||||
	ui.display_transitions->setChecked(prefs.display_transitions);
 | 
			
		||||
	ui.recreational_mode->setChecked(prefs.recreational_mode);
 | 
			
		||||
	ui.safetystop->setChecked(prefs.safetystop);
 | 
			
		||||
	ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
 | 
			
		||||
	ui.decopo2->setValue(prefs.decopo2 / 1000.0);
 | 
			
		||||
	ui.backgasBreaks->setChecked(prefs.doo2breaks);
 | 
			
		||||
| 
						 | 
				
			
			@ -429,6 +431,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 | 
			
		|||
	connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
 | 
			
		||||
	connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
 | 
			
		||||
	connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
 | 
			
		||||
	connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
 | 
			
		||||
	connect(ui.recreational_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setRecreationalMode(bool)));
 | 
			
		||||
	connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
 | 
			
		||||
	connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
 | 
			
		||||
| 
						 | 
				
			
			@ -478,6 +481,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
 | 
			
		|||
	s.setValue("display_runtime", prefs.display_runtime);
 | 
			
		||||
	s.setValue("display_transitions", prefs.display_transitions);
 | 
			
		||||
	s.setValue("recreational_mode", prefs.recreational_mode);
 | 
			
		||||
	s.setValue("safetystop", prefs.safetystop);
 | 
			
		||||
	s.setValue("ascrate75", prefs.ascrate75);
 | 
			
		||||
	s.setValue("ascrate50", prefs.ascrate50);
 | 
			
		||||
	s.setValue("ascratestops", prefs.ascratestops);
 | 
			
		||||
| 
						 | 
				
			
			@ -871,6 +875,12 @@ void DivePlannerPointsModel::setRecreationalMode(bool value)
 | 
			
		|||
	emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DivePlannerPointsModel::setSafetyStop(bool value)
 | 
			
		||||
{
 | 
			
		||||
	prefs.safetystop = value;
 | 
			
		||||
	emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DivePlannerPointsModel::setDropStoneMode(bool value)
 | 
			
		||||
{
 | 
			
		||||
	prefs.drop_stone_mode = value;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,6 +83,7 @@ slots:
 | 
			
		|||
	void setDisplayDuration(bool value);
 | 
			
		||||
	void setDisplayTransitions(bool value);
 | 
			
		||||
	void setRecreationalMode(bool value);
 | 
			
		||||
	void setSafetyStop(bool value);
 | 
			
		||||
	void savePlan();
 | 
			
		||||
	void saveDuplicatePlan();
 | 
			
		||||
	void remove(const QModelIndex &index);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -262,21 +262,21 @@
 | 
			
		|||
          <property name="spacing">
 | 
			
		||||
           <number>2</number>
 | 
			
		||||
          </property>
 | 
			
		||||
          <item row="2" column="1">
 | 
			
		||||
          <item row="3" column="1">
 | 
			
		||||
           <widget class="QLabel" name="label_16">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>GF high</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="5" column="1" colspan="2">
 | 
			
		||||
          <item row="6" column="1" colspan="2">
 | 
			
		||||
           <widget class="QCheckBox" name="backgasBreaks">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Plan backgas breaks</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="2" column="2">
 | 
			
		||||
          <item row="3" column="2">
 | 
			
		||||
           <widget class="QSpinBox" name="gfhigh">
 | 
			
		||||
            <property name="suffix">
 | 
			
		||||
             <string>%</string>
 | 
			
		||||
| 
						 | 
				
			
			@ -289,14 +289,14 @@
 | 
			
		|||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="4" column="1" colspan="2">
 | 
			
		||||
          <item row="5" column="1" colspan="2">
 | 
			
		||||
           <widget class="QCheckBox" name="lastStop">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Last stop at 6m</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="6" column="1">
 | 
			
		||||
          <item row="7" column="1">
 | 
			
		||||
           <widget class="QComboBox" name="rebreathermode">
 | 
			
		||||
            <property name="currentText">
 | 
			
		||||
             <string/>
 | 
			
		||||
| 
						 | 
				
			
			@ -306,7 +306,7 @@
 | 
			
		|||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="1" column="2">
 | 
			
		||||
          <item row="2" column="2">
 | 
			
		||||
           <widget class="QSpinBox" name="gflow">
 | 
			
		||||
            <property name="suffix">
 | 
			
		||||
             <string>%</string>
 | 
			
		||||
| 
						 | 
				
			
			@ -319,14 +319,14 @@
 | 
			
		|||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="3" column="1" colspan="2">
 | 
			
		||||
          <item row="4" column="1" colspan="2">
 | 
			
		||||
           <widget class="QCheckBox" name="drop_stone_mode">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Drop to first depth</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="7" column="1">
 | 
			
		||||
          <item row="8" column="1">
 | 
			
		||||
           <spacer name="verticalSpacer_2">
 | 
			
		||||
            <property name="orientation">
 | 
			
		||||
             <enum>Qt::Vertical</enum>
 | 
			
		||||
| 
						 | 
				
			
			@ -339,7 +339,7 @@
 | 
			
		|||
            </property>
 | 
			
		||||
           </spacer>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="1" column="1">
 | 
			
		||||
          <item row="2" column="1">
 | 
			
		||||
           <widget class="QLabel" name="label_15">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>GF low</string>
 | 
			
		||||
| 
						 | 
				
			
			@ -353,6 +353,16 @@
 | 
			
		|||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item row="1" column="1">
 | 
			
		||||
           <widget class="QCheckBox" name="safetystop">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>Safety stop</string>
 | 
			
		||||
            </property>
 | 
			
		||||
            <property name="tristate">
 | 
			
		||||
             <bool>false</bool>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,7 @@ struct preferences default_prefs = {
 | 
			
		|||
	.display_duration = true,
 | 
			
		||||
	.display_transitions = true,
 | 
			
		||||
	.recreational_mode = false,
 | 
			
		||||
	.safetystop = true,
 | 
			
		||||
	.bottomsac = 20000,
 | 
			
		||||
	.decosac = 17000,
 | 
			
		||||
	.o2consumption = 720,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue