diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-22 07:28:25 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-22 07:34:14 -0700 |
commit | d8673f986703439ceee6b037c14ff10526e6714a (patch) | |
tree | 78c62afe70ab8c23ea230b7243d39b5765d3fbf8 | |
parent | 375faa5cff7f220842491333aa222255be48588e (diff) | |
download | subsurface-d8673f986703439ceee6b037c14ff10526e6714a.tar.gz |
Calm down the Globe widget
This addresses two issues:
- the kMessageWidget did not word wrap, so if it was wider then the Globe
widget the Globe would expand (and divelist shrink) when the user
switched from a dive with location to a dive without location
- the code was also too aggressive removing and redrawing the message
widget when switching from dive to dive. with this change we only hide
the widget if the next dive has a location (and only show it if it isn't
shown already). We also hide the message if no dive is selected.
Reported-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/globe.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 5d3418662..1343734c5 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -76,7 +76,7 @@ void GlobeGPS::reload() void GlobeGPS::centerOn(dive* dive) { // dive has changed, if we had the 'editingDive', hide it. - if(messageWidget->isVisible()){ + if(messageWidget->isVisible() && (!dive || dive_has_gps_location(dive))){ messageWidget->animatedHide(); } @@ -95,10 +95,12 @@ void GlobeGPS::centerOn(dive* dive) void GlobeGPS::prepareForGetDiveCoordinates(dive* 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(); - + if (!messageWidget->isVisible()) { + 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->setWordWrap(true); + messageWidget->animatedShow(); + } editingDiveCoords = dive; } |