mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Undo: make editing of dive-time an undoable operation
The whole undo system assumes that the indexes in the dive table do not change under its feet. On desktop, there seems only one exception left: editing of the dive time. To circumvent this, hook editing of the dive-time to the already existing UndoShiftTime command. This introduces a temporary UI-inconsistency: this is the only edit that is reflected in the undo-list. This will be fixed in due course, when other edit actions are also made undoable. UndoShiftTime is changed to take pointers to dives (which should be stable by now) instead of uniq-ids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									ba9c35215e
								
							
						
					
					
						commit
						dd9af8e72e
					
				
					 4 changed files with 16 additions and 24 deletions
				
			
		|  | @ -240,18 +240,13 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button) | |||
| 		if (amount != 0) { | ||||
| 			// DANGER, DANGER - this could get our dive_table unsorted...
 | ||||
| 			int i; | ||||
| 			struct dive *dive; | ||||
| 			QVector<int> affectedDives; | ||||
| 			for_each_dive (i, dive) { | ||||
| 				if (!dive->selected) | ||||
| 					continue; | ||||
| 
 | ||||
| 				affectedDives.append(dive->id); | ||||
| 			struct dive *d; | ||||
| 			QVector<dive *> affectedDives; | ||||
| 			for_each_dive (i, d) { | ||||
| 				if (d->selected) | ||||
| 					affectedDives.append(d); | ||||
| 			} | ||||
| 			MainWindow::instance()->undoStack->push(new UndoShiftTime(affectedDives, amount)); | ||||
| 			MainWindow::instance()->dive_list()->rememberSelection(); | ||||
| 			MainWindow::instance()->refreshDisplay(); | ||||
| 			MainWindow::instance()->dive_list()->restoreSelection(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue