mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Simplify update of gflow and gfhigh values in the code
The more complex handling is no longer needed because: - Keyboard tracking for gfhigh/low UI fields was switched off here:030c094854- GFhigh was limited to 40 here:53fffe0ce3Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
		
							parent
							
								
									3ad398e3a7
								
							
						
					
					
						commit
						d703ba99c1
					
				
					 3 changed files with 7 additions and 30 deletions
				
			
		| 
						 | 
					@ -430,8 +430,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 | 
				
			||||||
	connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool)));
 | 
						connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool)));
 | 
				
			||||||
	connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
 | 
						connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
 | 
				
			||||||
	connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
 | 
						connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
 | 
				
			||||||
	connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh()));
 | 
					 | 
				
			||||||
	connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
 | 
					 | 
				
			||||||
	connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int)));
 | 
						connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int)));
 | 
				
			||||||
	connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
 | 
						connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
 | 
				
			||||||
	connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool)));
 | 
						connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool)));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -404,9 +404,7 @@ int DivePlannerPointsModel::rowCount(const QModelIndex &parent) const
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent),
 | 
					DivePlannerPointsModel::DivePlannerPointsModel(QObject *parent) : QAbstractTableModel(parent),
 | 
				
			||||||
	mode(NOTHING),
 | 
						mode(NOTHING),
 | 
				
			||||||
	recalc(false),
 | 
						recalc(false)
 | 
				
			||||||
	tempGFHigh(100),
 | 
					 | 
				
			||||||
	tempGFLow(100)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	memset(&diveplan, 0, sizeof(diveplan));
 | 
						memset(&diveplan, 0, sizeof(diveplan));
 | 
				
			||||||
	startTime.setTimeSpec(Qt::UTC);
 | 
						startTime.setTimeSpec(Qt::UTC);
 | 
				
			||||||
| 
						 | 
					@ -455,25 +453,18 @@ void DivePlannerPointsModel::setProblemSolvingTime(int minutes)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DivePlannerPointsModel::setGFHigh(const int gfhigh)
 | 
					void DivePlannerPointsModel::setGFHigh(const int gfhigh)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	tempGFHigh = gfhigh;
 | 
						if (diveplan.gfhigh != gfhigh) {
 | 
				
			||||||
	// GFHigh <= 34 can cause infinite deco at 6m - don't trigger a recalculation
 | 
							diveplan.gfhigh = gfhigh;
 | 
				
			||||||
	// for smaller GFHigh unless the user explicitly leaves the field
 | 
					 | 
				
			||||||
	if (tempGFHigh > 34)
 | 
					 | 
				
			||||||
		triggerGFHigh();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void DivePlannerPointsModel::triggerGFHigh()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (diveplan.gfhigh != tempGFHigh) {
 | 
					 | 
				
			||||||
		diveplan.gfhigh = tempGFHigh;
 | 
					 | 
				
			||||||
		emitDataChanged();
 | 
							emitDataChanged();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DivePlannerPointsModel::setGFLow(const int gflow)
 | 
					void DivePlannerPointsModel::setGFLow(const int gflow)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	tempGFLow = gflow;
 | 
						if (diveplan.gflow != gflow) {
 | 
				
			||||||
	triggerGFLow();
 | 
							diveplan.gflow = gflow;
 | 
				
			||||||
 | 
							emitDataChanged();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DivePlannerPointsModel::setRebreatherMode(int mode)
 | 
					void DivePlannerPointsModel::setRebreatherMode(int mode)
 | 
				
			||||||
| 
						 | 
					@ -485,14 +476,6 @@ void DivePlannerPointsModel::setRebreatherMode(int mode)
 | 
				
			||||||
	emitDataChanged();
 | 
						emitDataChanged();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DivePlannerPointsModel::triggerGFLow()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (diveplan.gflow != tempGFLow) {
 | 
					 | 
				
			||||||
		diveplan.gflow = tempGFLow;
 | 
					 | 
				
			||||||
		emitDataChanged();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void DivePlannerPointsModel::setVpmbConservatism(int level)
 | 
					void DivePlannerPointsModel::setVpmbConservatism(int level)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (diveplan.vpmb_conservatism != level) {
 | 
						if (diveplan.vpmb_conservatism != level) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,9 +63,7 @@ slots:
 | 
				
			||||||
	int addStop(int millimeters = 0, int seconds = 0, int cylinderid_in = -1, int ccpoint = 0, bool entered = true);
 | 
						int addStop(int millimeters = 0, int seconds = 0, int cylinderid_in = -1, int ccpoint = 0, bool entered = true);
 | 
				
			||||||
	void addCylinder_clicked();
 | 
						void addCylinder_clicked();
 | 
				
			||||||
	void setGFHigh(const int gfhigh);
 | 
						void setGFHigh(const int gfhigh);
 | 
				
			||||||
	void triggerGFHigh();
 | 
					 | 
				
			||||||
	void setGFLow(const int gflow);
 | 
						void setGFLow(const int gflow);
 | 
				
			||||||
	void triggerGFLow();
 | 
					 | 
				
			||||||
	void setVpmbConservatism(int level);
 | 
						void setVpmbConservatism(int level);
 | 
				
			||||||
	void setSurfacePressure(int pressure);
 | 
						void setSurfacePressure(int pressure);
 | 
				
			||||||
	void setSalinity(int salinity);
 | 
						void setSalinity(int salinity);
 | 
				
			||||||
| 
						 | 
					@ -123,8 +121,6 @@ private:
 | 
				
			||||||
	bool recalc;
 | 
						bool recalc;
 | 
				
			||||||
	QVector<divedatapoint> divepoints;
 | 
						QVector<divedatapoint> divepoints;
 | 
				
			||||||
	QDateTime startTime;
 | 
						QDateTime startTime;
 | 
				
			||||||
	int tempGFHigh;
 | 
					 | 
				
			||||||
	int tempGFLow;
 | 
					 | 
				
			||||||
	int instanceCounter = 0;
 | 
						int instanceCounter = 0;
 | 
				
			||||||
	struct deco_state ds_after_previous_dives;
 | 
						struct deco_state ds_after_previous_dives;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue