mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Don't just change the location when double clicking on the globe
Instead be consistent with other parts of the code and put us in editing mode so the user can accept / reject the change. See #800 Fixes #801 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									83018619d6
								
							
						
					
					
						commit
						df46b85ee1
					
				
					 4 changed files with 14 additions and 13 deletions
				
			
		|  | @ -307,21 +307,14 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U | ||||||
| 		lon = lon * 180 / M_PI; | 		lon = lon * 180 / M_PI; | ||||||
| 		lat = lat * 180 / M_PI; | 		lat = lat * 180 / M_PI; | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| 	// right now we try to only ever do this with one dive selected,
 |  | ||||||
| 	// but we keep the code here that changes the coordinates for each selected dive
 |  | ||||||
| 	int i; |  | ||||||
| 	struct dive *dive; |  | ||||||
| 	for_each_dive (i, dive) { |  | ||||||
| 		if (!dive->selected) |  | ||||||
| 			continue; |  | ||||||
| 		dive->latitude.udeg = lrint(lat * 1000000.0); |  | ||||||
| 		dive->longitude.udeg = lrint(lon * 1000000.0); |  | ||||||
| 	} |  | ||||||
| 	centerOn(lon, lat, true); | 	centerOn(lon, lat, true); | ||||||
|  | 
 | ||||||
|  | 	// change the location of the displayed_dive and put the UI in edit mode
 | ||||||
|  | 	displayed_dive.latitude.udeg = lrint(lat * 1000000.0); | ||||||
|  | 	displayed_dive.longitude.udeg = lrint(lon * 1000000.0); | ||||||
|  | 	emit(coordinatesChanged()); | ||||||
|  | 	repopulateLabels(); | ||||||
| 	editingDiveLocation = false; | 	editingDiveLocation = false; | ||||||
| 	mark_divelist_changed(true); |  | ||||||
| 	MainWindow::instance()->refreshDisplay(); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void GlobeGPS::mousePressEvent(QMouseEvent *event) | void GlobeGPS::mousePressEvent(QMouseEvent *event) | ||||||
|  |  | ||||||
|  | @ -39,6 +39,9 @@ private: | ||||||
| 	bool editingDiveLocation; | 	bool editingDiveLocation; | ||||||
| 	bool doubleClick; | 	bool doubleClick; | ||||||
| 
 | 
 | ||||||
|  | signals: | ||||||
|  | 	void coordinatesChanged(void); | ||||||
|  | 
 | ||||||
| public | public | ||||||
| slots: | slots: | ||||||
| 	void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit); | 	void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit); | ||||||
|  |  | ||||||
|  | @ -1246,6 +1246,9 @@ void MainTab::updateCoordinatesText(qreal lat, qreal lon) | ||||||
| 
 | 
 | ||||||
| void MainTab::updateGpsCoordinates() | void MainTab::updateGpsCoordinates() | ||||||
| { | { | ||||||
|  | 	if (editMode == NONE) | ||||||
|  | 		enableEdition(); | ||||||
|  | 
 | ||||||
| 	ui.coordinates->setText(printGPSCoords(displayed_dive.latitude.udeg, displayed_dive.longitude.udeg)); | 	ui.coordinates->setText(printGPSCoords(displayed_dive.latitude.udeg, displayed_dive.longitude.udeg)); | ||||||
| 	ui.coordinates->setModified(displayed_dive.latitude.udeg || displayed_dive.longitude.udeg); | 	ui.coordinates->setModified(displayed_dive.latitude.udeg || displayed_dive.longitude.udeg); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -96,6 +96,8 @@ MainWindow::MainWindow() : QMainWindow(), | ||||||
| #ifdef NO_MARBLE | #ifdef NO_MARBLE | ||||||
| 	ui.globePane->hide(); | 	ui.globePane->hide(); | ||||||
| 	ui.menuView->removeAction(ui.actionViewGlobe); | 	ui.menuView->removeAction(ui.actionViewGlobe); | ||||||
|  | #else | ||||||
|  | 	connect(ui.globe, SIGNAL(coordinatesChanged()), ui.InfoWidget, SLOT(updateGpsCoordinates())); | ||||||
| #endif | #endif | ||||||
| #ifdef NO_USERMANUAL | #ifdef NO_USERMANUAL | ||||||
| 	ui.menuHelp->removeAction(ui.actionUserManual); | 	ui.menuHelp->removeAction(ui.actionUserManual); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue