mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Planner settings ascend and descende rate: Wire up UI elements correctly
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate (1x) correctly so that the profile and calculation is updated immediately after the value is changed (e.g. increased/decresed by 1) by clicking the QSpinBox arrows. Until now one had to click into the profile or change another planner preference first before the change became effective. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
		
							parent
							
								
									52445ec8f5
								
							
						
					
					
						commit
						cf409b59ba
					
				
					 4 changed files with 67 additions and 25 deletions
				
			
		|  | @ -10,6 +10,8 @@ | |||
| #include <QApplication> | ||||
| #include <QTextDocument> | ||||
| 
 | ||||
| #define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0) | ||||
| 
 | ||||
| /* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and
 | ||||
|  * use the signal warningMessage() to communicate errors to the MainWindow. | ||||
|  */ | ||||
|  | @ -494,6 +496,41 @@ void DivePlannerPointsModel::setLastStop6m(bool value) | |||
| 	emitDataChanged(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerPointsModel::setAscrate75(int rate) | ||||
| { | ||||
| 	auto planner = SettingsObjectWrapper::instance()->planner_settings; | ||||
| 	planner->setAscrate75(lrint(rate * UNIT_FACTOR)); | ||||
| 	emitDataChanged(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerPointsModel::setAscrate50(int rate) | ||||
| { | ||||
| 	auto planner = SettingsObjectWrapper::instance()->planner_settings; | ||||
| 	planner->setAscrate50(lrint(rate * UNIT_FACTOR)); | ||||
| 	emitDataChanged(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerPointsModel::setAscratestops(int rate) | ||||
| { | ||||
| 	auto planner = SettingsObjectWrapper::instance()->planner_settings; | ||||
| 	planner->setAscratestops(lrint(rate * UNIT_FACTOR)); | ||||
| 	emitDataChanged(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerPointsModel::setAscratelast6m(int rate) | ||||
| { | ||||
| 	auto planner = SettingsObjectWrapper::instance()->planner_settings; | ||||
| 	planner->setAscratelast6m(lrint(rate * UNIT_FACTOR)); | ||||
| 	emitDataChanged(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerPointsModel::setDescrate(int rate) | ||||
| { | ||||
| 	auto planner = SettingsObjectWrapper::instance()->planner_settings; | ||||
| 	planner->setDescrate(lrint(rate * UNIT_FACTOR)); | ||||
| 	emitDataChanged(); | ||||
| } | ||||
| 
 | ||||
| void DivePlannerPointsModel::setVerbatim(bool value) | ||||
| { | ||||
| 	auto planner = SettingsObjectWrapper::instance()->planner_settings; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue