Immediately show new locations on globe widget

When modifying or adding a dive location on the globe widget while in dive
edit or dive add mode, we now show the modified / new location right away
on the globe (assuming a location name has been given). This makes it much
easier to manually reposition a dive location.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-11-19 04:23:59 -08:00
parent 7886719443
commit e8a4420c59
2 changed files with 13 additions and 8 deletions

View file

@ -120,19 +120,12 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
} }
} }
void GlobeGPS::reload() void GlobeGPS::repopulateLabels()
{ {
if (loadedDives) { if (loadedDives) {
model()->treeModel()->removeDocument(loadedDives); model()->treeModel()->removeDocument(loadedDives);
delete loadedDives; delete loadedDives;
} }
if (editingDiveCoords) {
editingDiveCoords = 0;
if (messageWidget->isVisible())
messageWidget->animatedHide();
}
loadedDives = new GeoDataDocument; loadedDives = new GeoDataDocument;
QMap<QString, GeoDataPlacemark *> locationMap; QMap<QString, GeoDataPlacemark *> locationMap;
@ -162,6 +155,16 @@ void GlobeGPS::reload()
model()->treeModel()->addDocument(loadedDives); model()->treeModel()->addDocument(loadedDives);
} }
void GlobeGPS::reload()
{
if (editingDiveCoords) {
editingDiveCoords = 0;
if (messageWidget->isVisible())
messageWidget->animatedHide();
}
repopulateLabels();
}
void GlobeGPS::centerOn(dive* dive) void GlobeGPS::centerOn(dive* dive)
{ {
// dive has changed, if we had the 'editingDive', hide it. // dive has changed, if we had the 'editingDive', hide it.
@ -255,6 +258,7 @@ void GlobeGPS::mousePressEvent(QMouseEvent* event)
if (mainWindow()->information()->isEditing() && if (mainWindow()->information()->isEditing() &&
geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) { geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) {
mainWindow()->information()->updateCoordinatesText(lat, lon); mainWindow()->information()->updateCoordinatesText(lat, lon);
repopulateLabels();
} else if (editingDiveCoords && } else if (editingDiveCoords &&
geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) { geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) {
changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Degree); changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Degree);

View file

@ -17,6 +17,7 @@ public:
using MarbleWidget::centerOn; using MarbleWidget::centerOn;
GlobeGPS(QWidget *parent); GlobeGPS(QWidget *parent);
void reload(); void reload();
void repopulateLabels();
void centerOn(struct dive* dive); void centerOn(struct dive* dive);
void diveEditMode(); void diveEditMode();