mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Undo: make diverse trip-related operations undo-able
AddDivesToTrip, CreateTrip, AutogroupDives, RemoveAutogenTrips and MergeTrips basically all did the same thing as RemoveDivesFromTrip, which was already implemented. Thus, factor our the common functionality and hook it up to make all these functions undo-able. Don't do the autogroup-call everytime the dive-list is rebuilt (that would create innumberable undo-actions), but only on dive-load / import or if expressly asked by the user [by switching the autogroup flag]. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									4fbb8ef399
								
							
						
					
					
						commit
						f427226b3b
					
				
					 11 changed files with 296 additions and 76 deletions
				
			
		|  | @ -48,6 +48,7 @@ | |||
| #include "desktop-widgets/mapwidget.h" | ||||
| #include "desktop-widgets/subsurfacewebservices.h" | ||||
| #include "desktop-widgets/tab-widgets/maintab.h" | ||||
| #include "desktop-widgets/undocommands.h" | ||||
| #include "desktop-widgets/updatemanager.h" | ||||
| #include "desktop-widgets/usersurvey.h" | ||||
| 
 | ||||
|  | @ -66,7 +67,6 @@ | |||
| #include "qt-models/tankinfomodel.h" | ||||
| #include "qt-models/weightsysteminfomodel.h" | ||||
| #include "qt-models/yearlystatisticsmodel.h" | ||||
| 
 | ||||
| #include "preferences/preferencesdialog.h" | ||||
| 
 | ||||
| #ifndef NO_USERMANUAL | ||||
|  | @ -618,6 +618,8 @@ void MainWindow::on_actionCloudstorageopen_triggered() | |||
| 	if (!parse_file(fileNamePtr.data(), &dive_table)) | ||||
| 		setCurrentFile(fileNamePtr.data()); | ||||
| 	process_loaded_dives(); | ||||
| 	if (autogroup) | ||||
| 		autogroup_dives(); | ||||
| 	undoStack->clear(); | ||||
| 	hideProgressBar(); | ||||
| 	refreshDisplay(); | ||||
|  | @ -1073,9 +1075,9 @@ void MainWindow::on_actionAutoGroup_triggered() | |||
| { | ||||
| 	set_autogroup(ui.actionAutoGroup->isChecked()); | ||||
| 	if (autogroup) | ||||
| 		autogroup_dives(); | ||||
| 		undoStack->push(new UndoAutogroupDives); | ||||
| 	else | ||||
| 		remove_autogen_trips(); | ||||
| 		undoStack->push(new UndoRemoveAutogenTrips); | ||||
| 	refreshDisplay(); | ||||
| 	mark_divelist_changed(true); | ||||
| } | ||||
|  | @ -1741,6 +1743,8 @@ void MainWindow::importFiles(const QStringList fileNames) | |||
| 		parse_file(fileNamePtr.data(), &table); | ||||
| 	} | ||||
| 	process_imported_dives(&table, false, false); | ||||
| 	if (autogroup) | ||||
| 		autogroup_dives(); | ||||
| 	undoStack->clear(); | ||||
| 	refreshDisplay(); | ||||
| } | ||||
|  | @ -1764,6 +1768,8 @@ void MainWindow::loadFiles(const QStringList fileNames) | |||
| 	hideProgressBar(); | ||||
| 	updateRecentFiles(); | ||||
| 	process_loaded_dives(); | ||||
| 	if (autogroup) | ||||
| 		autogroup_dives(); | ||||
| 	undoStack->clear(); | ||||
| 
 | ||||
| 	refreshDisplay(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue