mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	MainWindow: fix setTitle() calls
setTitle() works with an enum that can be fed different values, and other we may have eventually. For example not only "app title", or "app title: filename", but others, like dates, certain app status and so on. Patch fixes an issue where deleting a single dive in the divelist resets the title to "Subsurface" only. clearUpEmpty() should only call setTitle(MWTF_DEFAULT) if no file is currently open. It also adds a safe-guard to revert back to MWTF_DEFAULT if no file is open but setTitle is called with MWTF_FILENAME. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									94f85bbef9
								
							
						
					
					
						commit
						26d2cc0fef
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -135,6 +135,7 @@ void MainWindow::cleanUpEmpty() | |||
| 	ui.ProfileWidget->clear(); | ||||
| 	ui.ListWidget->reload(DiveTripModel::TREE); | ||||
| 	ui.globe->reload(); | ||||
| 	if (!existing_filename) | ||||
| 		setTitle(MWTF_DEFAULT); | ||||
| } | ||||
| 
 | ||||
|  | @ -790,6 +791,10 @@ void MainWindow::setTitle(enum MainWindowTitleFormat format) | |||
| 		setWindowTitle("Subsurface"); | ||||
| 		break; | ||||
| 	case MWTF_FILENAME: | ||||
| 		if (!existing_filename) { | ||||
| 			setTitle(MWTF_DEFAULT); | ||||
| 			return; | ||||
| 		} | ||||
| 		QFile f(existing_filename); | ||||
| 		QFileInfo fileInfo(f); | ||||
| 		QString fileName(fileInfo.fileName()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue