summaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/globe.cpp')
-rw-r--r--qt-ui/globe.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 149f738e3..3ea01f0d8 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -212,6 +212,16 @@ void GlobeGPS::prepareForGetDiveCoordinates(dive* dive)
editingDiveCoords = dive;
}
+void GlobeGPS::diveEditMode()
+{
+ if (messageWidget->isVisible())
+ messageWidget->animatedHide();
+ messageWidget->setMessageType(KMessageWidget::Warning);
+ messageWidget->setText(QObject::tr("Editing dive - move the map and double-click to set the dive location"));
+ messageWidget->setWordWrap(true);
+ messageWidget->animatedShow();
+}
+
void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
{
// convert to degrees if in radian.
@@ -241,7 +251,12 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U
void GlobeGPS::mousePressEvent(QMouseEvent* event)
{
qreal lat, lon;
- if (editingDiveCoords && geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) {
+ // there could be two scenarios that got us here; let's check if we are editing a dive
+ if (mainWindow()->information()->isEditing() &&
+ geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) {
+ mainWindow()->information()->updateCoordinatesText(lat, lon);
+ } else if (editingDiveCoords &&
+ geoCoordinates(event->pos().x(), event->pos().y(), lon, lat, GeoDataCoordinates::Degree)) {
changeDiveGeoPosition(lon, lat, GeoDataCoordinates::Degree);
}
}