mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Changed the backup implementation of the samples on EditDive.
Changed the backup implementation of the samples on EditDive, it's way cleaner now what's happening, and it's also better for the cancel edit. Next: The Cancel Edit. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
This commit is contained in:
		
							parent
							
								
									f7cd3e780c
								
							
						
					
					
						commit
						23a193b0d1
					
				
					 2 changed files with 5 additions and 10 deletions
				
			
		|  | @ -427,23 +427,17 @@ void DivePlannerPointsModel::createSimpleDive() | |||
| 
 | ||||
| void DivePlannerPointsModel::loadFromDive(dive* d) | ||||
| { | ||||
| 	int totalSamples = d->dc.samples -2; // removes begin and end.
 | ||||
| 	 | ||||
| 	/* We need to make a copy, because
 | ||||
| 	 * as soon as the model is modified, it will | ||||
| 	 * remove all samples from the current dive. | ||||
| 	 *  | ||||
| 	 * TODO: keep a backup of the values, | ||||
| 	 * so we can restore.  | ||||
| 	 * */ | ||||
| 	QList<QPair<int,int> > values; | ||||
| 	backupSamples.clear(); | ||||
| 	for(int i = 1; i < d->dc.samples-1; i++){ | ||||
| 		struct sample &s = d->dc.sample[i]; | ||||
| 		values.append( qMakePair(s.depth.mm, s.time.seconds)); | ||||
| 		backupSamples.push_back( d->dc.sample[i]); | ||||
| 	} | ||||
| 
 | ||||
| 	for(int i = 0; i < totalSamples; i++){ | ||||
| 		plannerModel->addStop(values[i].first, values[i].second, tr("Air"), 0); | ||||
| 	Q_FOREACH(const sample &s, backupSamples){ | ||||
| 		plannerModel->addStop(s.depth.mm, s.time.seconds, tr("Air"), 0); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue