mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
56dbb7c2ff
commit
86021b24d9
7 changed files with 713 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue