mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Planner: Autom. move first datapoint gas to first gaslist position p2
This is a amendment to 24bd5a8dce
Move the cylinder also to first position if first planner datapoint
cylinder change because a row is added or deleted to the dive datapoints.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
			
			
This commit is contained in:
		
							parent
							
								
									7a82103c99
								
							
						
					
					
						commit
						27a8fd51ed
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -756,12 +756,15 @@ void DivePlannerPointsModel::editStop(int row, divedatapoint newData)
 | 
			
		|||
	 * When moving divepoints rigorously, we might end up with index
 | 
			
		||||
	 * out of range, thus returning the last one instead.
 | 
			
		||||
	 */
 | 
			
		||||
	int old_first_cylid = divepoints[0].cylinderid;
 | 
			
		||||
	if (row >= divepoints.count())
 | 
			
		||||
		return;
 | 
			
		||||
	divepoints[row] = newData;
 | 
			
		||||
	std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
 | 
			
		||||
	if (updateMaxDepth())
 | 
			
		||||
		CylindersModel::instance()->updateBestMixes();
 | 
			
		||||
	if (divepoints[0].cylinderid != old_first_cylid)
 | 
			
		||||
		CylindersModel::instance()->moveAtFirst(divepoints[0].cylinderid);
 | 
			
		||||
	emitDataChanged();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -790,6 +793,8 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
 | 
			
		|||
	if (!dp.entered)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	int old_first_cylid = divepoints[0].cylinderid;
 | 
			
		||||
 | 
			
		||||
/* TODO: this seems so wrong.
 | 
			
		||||
 * We can't do this here if we plan to use QML on mobile
 | 
			
		||||
 * as mobile has no ControlModifier.
 | 
			
		||||
| 
						 | 
				
			
			@ -809,6 +814,8 @@ void DivePlannerPointsModel::remove(const QModelIndex &index)
 | 
			
		|||
	}
 | 
			
		||||
	endRemoveRows();
 | 
			
		||||
	CylindersModel::instance()->updateTrashIcon();
 | 
			
		||||
	if (divepoints[0].cylinderid != old_first_cylid)
 | 
			
		||||
		CylindersModel::instance()->moveAtFirst(divepoints[0].cylinderid);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct diveplan &DivePlannerPointsModel::getDiveplan()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue