mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Mobile: improve helper function to track selected dives
While on mobile there should always be only one selected dive, it's very cheap to make sure that amount_selected is tracked correctly. The incrementing of amount_selected is done in case an invalid id is passed in. Suggested-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									4fb2f89bb5
								
							
						
					
					
						commit
						5f11c94f02
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -1378,10 +1378,17 @@ bool QMLManager::undoDelete(int id) | |||
| void QMLManager::selectDive(int id) | ||||
| { | ||||
| 	int i; | ||||
| 	extern int amount_selected; | ||||
| 	struct dive *dive = NULL; | ||||
| 
 | ||||
| 	for_each_dive (i, dive) | ||||
| 	amount_selected = 0; | ||||
| 	for_each_dive (i, dive) { | ||||
| 		dive->selected = (dive->id == id); | ||||
| 		if (dive->selected) | ||||
| 			amount_selected++; | ||||
| 	} | ||||
| 	if (amount_selected == 0) | ||||
| 		qWarning("QManager::selectDive() called with unknown id"); | ||||
| } | ||||
| 
 | ||||
| void QMLManager::deleteDive(int id) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue