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>
This commit is contained in:
Dirk Hohndel 2013-05-22 07:28:25 -07:00
parent 375faa5cff
commit d8673f9867

View file

@ -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;
}