summaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-17 21:58:49 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-17 21:58:49 -0300
commit86021b24d98c385b10ccc2fefab5cf22f3a03b54 (patch)
tree39a603640b2882cec9040c59f1a51bfe8e88bae6 /qt-ui/globe.cpp
parent56dbb7c2ff697a393f5051e2b5363bd4c0f2bb6e (diff)
downloadsubsurface-86021b24d98c385b10ccc2fefab5cf22f3a03b54.tar.gz
Borrowed the KMessageWidget code to better show passive information.
Borrowed the code from KMessageWidget from Aurelian Gateau, Kdelibs, to better show passive information and notifications. instead of a popup blowing in the user's face, a nice, animated and well designed widget will gracefully fade-in, show the notes, and fade out when not needed anymore. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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;
+}
+
+