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.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 93d1ab7c4..43763e338 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -1,4 +1,5 @@
#include "globe.h"
+#include "kmessagewidget.h"
#include "../dive.h"
#include <QDebug>
@@ -40,10 +41,13 @@ void GlobeGPS::reload()
model()->treeModel()->removeDocument(loadedDives);
delete loadedDives;
}
+
if (editingDiveCoords){
editingDiveCoords = 0;
}
+ messageWidget->animatedHide();
+
loadedDives = new GeoDataDocument;
int idx = 0;
@@ -64,6 +68,13 @@ void GlobeGPS::reload()
void GlobeGPS::centerOn(dive* dive)
{
+ // dive has changed, if we had the 'editingDive', hide it.
+ if(messageWidget->isVisible()){
+ messageWidget->animatedHide();
+ }
+
+ editingDiveCoords = 0;
+
qreal longitude = dive->longitude.udeg / 1000000.0;
qreal latitude = dive->latitude.udeg / 1000000.0;
@@ -77,9 +88,9 @@ void GlobeGPS::centerOn(dive* dive)
void GlobeGPS::prepareForGetDiveCoordinates(dive* dive)
{
- QMessageBox::warning(parentWidget(),
- tr("This dive has no location!"),
- tr("Move the planet to the desired position, then \n double-click to set the new location of this dive."));
+ messageWidget->setMessageType(KMessageWidget::Warning);
+ messageWidget->setText(QObject::tr("This dive has no location! Please move the planet to the desired position, then double-click to set the new location for this dive."));
+ messageWidget->animatedShow();
editingDiveCoords = dive;
}
@@ -101,6 +112,7 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U
centerOn(lon, lat, true);
reload();
editingDiveCoords = 0;
+ messageWidget->animatedHide();
}
void GlobeGPS::mousePressEvent(QMouseEvent* event)
@@ -111,3 +123,9 @@ void GlobeGPS::mousePressEvent(QMouseEvent* event)
}
}
+void GlobeGPS::setMessageWidget(KMessageWidget* globeMessage)
+{
+ messageWidget = globeMessage;
+}
+
+