[Marble-commits] KDE/kdeedu/marble/src/lib/routing
Dennis Nienhüser
earthwings at gentoo.org
Mon May 10 20:49:32 CEST 2010
SVN commit 1125136 by nienhueser:
When retrieving no data (e.g. server timeout), display a "please try again" message. Also display a warning if ors reports an error that is not attached to any route point (usually happens when ways are not connected).
CCBUG: 237122
M +9 -0 RoutingManager.cpp
M +7 -0 RoutingModel.cpp
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.cpp #1125135:1125136
@@ -10,11 +10,14 @@
#include "RoutingManager.h"
+#include "MarbleDebug.h"
#include "MarbleWidget.h"
#include "OrsRoutingProvider.h"
#include "RouteSkeleton.h"
#include "RoutingModel.h"
+#include <QtGui/QMessageBox>
+
namespace Marble
{
@@ -70,8 +73,14 @@
/** @todo: switch to using GeoDataDocument* */
Q_UNUSED( format );
+ if ( data.size() ) {
d->m_routingModel->importOpenGis( data );
d->m_marbleWidget->repaint();
+ } else {
+ mDebug() << "Got an empty result instead of route data";
+ QString message = tr("Sorry, the route could not be retrieved. Please try again later.");
+ QMessageBox::warning( d->m_marbleWidget, "Route Error", message );
+ }
emit stateChanged( Retrieved, d->m_route );
}
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingModel.cpp #1125135:1125136
@@ -20,8 +20,10 @@
#include "RouteSkeleton.h"
#include <QtCore/QBuffer>
+#include <QtCore/QPointer>
#include <QtCore/QRegExp>
#include <QtCore/QVector>
+#include <QtGui/QMessageBox>
#include <QtGui/QPixmap>
#include <QtXml/QDomDocument>
@@ -158,6 +160,11 @@
}
} else {
mDebug() << "Error message " << errorMessage << " not parsable.";
+ QString message = tr( "Sorry, a problem occurred when calculating the route. Try adjusting start and destination points." );
+ QPointer<QMessageBox> messageBox = new QMessageBox( QMessageBox::Warning, "Route Error", message );
+ messageBox->setDetailedText( errorMessage );
+ messageBox->exec();
+ delete messageBox;
}
}
}
More information about the Marble-commits
mailing list