mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Indicate that there are unsaved changes with a '*' in the window title
This seems to be a fairly common way to indicate this property. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									57f2c81125
								
							
						
					
					
						commit
						ef95bd9a27
					
				
					 5 changed files with 12 additions and 2 deletions
				
			
		|  | @ -43,6 +43,7 @@ | ||||||
| #include "divelist.h" | #include "divelist.h" | ||||||
| #include "display.h" | #include "display.h" | ||||||
| #include "planner.h" | #include "planner.h" | ||||||
|  | #include "qthelperfromc.h" | ||||||
| 
 | 
 | ||||||
| static short dive_list_changed = false; | static short dive_list_changed = false; | ||||||
| 
 | 
 | ||||||
|  | @ -920,6 +921,7 @@ void combine_trips(struct dive_trip *trip_a, struct dive_trip *trip_b) | ||||||
| void mark_divelist_changed(int changed) | void mark_divelist_changed(int changed) | ||||||
| { | { | ||||||
| 	dive_list_changed = changed; | 	dive_list_changed = changed; | ||||||
|  | 	updateWindowTitle(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int unsaved_changes() | int unsaved_changes() | ||||||
|  |  | ||||||
|  | @ -1429,7 +1429,8 @@ void MainWindow::setTitle(enum MainWindowTitleFormat format) | ||||||
| 		QFile f(existing_filename); | 		QFile f(existing_filename); | ||||||
| 		QFileInfo fileInfo(f); | 		QFileInfo fileInfo(f); | ||||||
| 		QString fileName(fileInfo.fileName()); | 		QString fileName(fileInfo.fileName()); | ||||||
| 		setWindowTitle("Subsurface: " + fileName); | 		QString unsaved = (unsaved_changes() ? " *" : ""); | ||||||
|  | 		setWindowTitle("Subsurface: " + fileName + unsaved); | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ public: | ||||||
| 	DivePlannerWidget *divePlannerWidget(); | 	DivePlannerWidget *divePlannerWidget(); | ||||||
| 	PlannerSettingsWidget *divePlannerSettingsWidget(); | 	PlannerSettingsWidget *divePlannerSettingsWidget(); | ||||||
| 	LocationInformationWidget *locationInformationWidget(); | 	LocationInformationWidget *locationInformationWidget(); | ||||||
| 	void setTitle(enum MainWindowTitleFormat format); | 	void setTitle(enum MainWindowTitleFormat format = MWTF_FILENAME); | ||||||
| 
 | 
 | ||||||
| 	// Some shortcuts like "change DC" or "copy/paste dive components"
 | 	// Some shortcuts like "change DC" or "copy/paste dive components"
 | ||||||
| 	// should only be enabled when the profile's visible.
 | 	// should only be enabled when the profile's visible.
 | ||||||
|  |  | ||||||
|  | @ -34,6 +34,7 @@ | ||||||
| #include <QtConcurrent> | #include <QtConcurrent> | ||||||
| #include "divepicturewidget.h" | #include "divepicturewidget.h" | ||||||
| #include "subsurfacewebservices.h" | #include "subsurfacewebservices.h" | ||||||
|  | #include "mainwindow.h" | ||||||
| 
 | 
 | ||||||
| #include <libxslt/documents.h> | #include <libxslt/documents.h> | ||||||
| 
 | 
 | ||||||
|  | @ -1057,3 +1058,8 @@ extern "C" bool canReachCloudServer() | ||||||
| { | { | ||||||
| 	return CheckCloudConnection::checkServer(); | 	return CheckCloudConnection::checkServer(); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | extern "C" void updateWindowTitle() | ||||||
|  | { | ||||||
|  | 	MainWindow::instance()->setTitle(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -3,5 +3,6 @@ | ||||||
| 
 | 
 | ||||||
| bool getProxyString(char **buffer); | bool getProxyString(char **buffer); | ||||||
| bool canReachCloudServer(); | bool canReachCloudServer(); | ||||||
|  | void updateWindowTitle(); | ||||||
| 
 | 
 | ||||||
| #endif // QTHELPERFROMC_H
 | #endif // QTHELPERFROMC_H
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue