mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Cleanup: fold cleanUpEmpty() into closeCurrentFile()
The latter was the only caller of the former and there seems to be no clear separation between the two. By making a single function out of this the code is easier to follow and duplicate code can be more easily detected. Matter of fact, the profile was cleared twice. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									36094e4a18
								
							
						
					
					
						commit
						808316f434
					
				
					 2 changed files with 11 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -634,21 +634,6 @@ void MainWindow::on_actionCloudOnline_triggered()
 | 
			
		|||
	updateCloudOnlineStatus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::cleanUpEmpty()
 | 
			
		||||
{
 | 
			
		||||
	current_dive = nullptr;
 | 
			
		||||
	mainTab->clearTabs();
 | 
			
		||||
	mainTab->updateDiveInfo();
 | 
			
		||||
	graphics->setEmptyState();
 | 
			
		||||
	diveList->reload();
 | 
			
		||||
	diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
 | 
			
		||||
	MapWidget::instance()->reload();
 | 
			
		||||
	LocationInformationModel::instance()->update();
 | 
			
		||||
	if (!existing_filename)
 | 
			
		||||
		setTitle();
 | 
			
		||||
	disableShortcuts();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool MainWindow::okToClose(QString message)
 | 
			
		||||
{
 | 
			
		||||
	if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
 | 
			
		||||
| 
						 | 
				
			
			@ -670,12 +655,21 @@ void MainWindow::setFileClean()
 | 
			
		|||
 | 
			
		||||
void MainWindow::closeCurrentFile()
 | 
			
		||||
{
 | 
			
		||||
	graphics->setEmptyState();
 | 
			
		||||
	/* free the dives and trips */
 | 
			
		||||
	clear_git_id();
 | 
			
		||||
	clear_dive_file_data();
 | 
			
		||||
	current_dive = nullptr;
 | 
			
		||||
	setCurrentFile(nullptr);
 | 
			
		||||
	cleanUpEmpty();
 | 
			
		||||
	graphics->setEmptyState();
 | 
			
		||||
	mainTab->clearTabs();
 | 
			
		||||
	mainTab->updateDiveInfo();
 | 
			
		||||
	diveList->reload();
 | 
			
		||||
	diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
 | 
			
		||||
	MapWidget::instance()->reload();
 | 
			
		||||
	LocationInformationModel::instance()->update();
 | 
			
		||||
	if (!existing_filename)
 | 
			
		||||
		setTitle();
 | 
			
		||||
	disableShortcuts();
 | 
			
		||||
	setFileClean();
 | 
			
		||||
 | 
			
		||||
	clear_events();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,7 +71,6 @@ public:
 | 
			
		|||
 | 
			
		||||
	void loadFiles(const QStringList files);
 | 
			
		||||
	void importFiles(const QStringList importFiles);
 | 
			
		||||
	void cleanUpEmpty();
 | 
			
		||||
	void setToolButtonsEnabled(bool enabled);
 | 
			
		||||
	void printPlan();
 | 
			
		||||
	void checkSurvey();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue