[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Sat May 1 00:01:39 CEST 2010
SVN commit 1121239 by nienhueser:
Respect offline mode in online routing (disable route download and reverse geocoding when offline)
M +5 -2 MarbleControlBox.cpp
M +10 -2 routing/RoutingInputWidget.cpp
M +5 -0 routing/RoutingInputWidget.h
M +9 -2 routing/RoutingManager.cpp
M +5 -0 routing/RoutingManager.h
M +15 -1 routing/RoutingWidget.cpp
M +5 -0 routing/RoutingWidget.h
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1121238:1121239
@@ -257,8 +257,8 @@
d->m_widget = widget;
d->m_runnerManager->setMap( d->m_widget->map() );
- RoutingWidget *routingWidget = new RoutingWidget(widget, this);
- d->uiWidget.toolBox->addItem(routingWidget, tr("Routing"));
+ d->m_routingWidget = new RoutingWidget( widget, this );
+ d->uiWidget.toolBox->addItem( d->m_routingWidget, tr( "Routing" ) );
// Make us aware of all the Placemarks in the MarbleModel so that
// we can search them.
@@ -721,7 +721,10 @@
d->m_widget->map()->model()->downloadManager();
downloadManager->setDownloadEnabled( !offline );
d->m_runnerManager->setWorkOffline( offline );
+ if ( d->m_routingWidget ) {
+ d->m_routingWidget->setWorkOffline( offline );
}
+}
void MarbleControlBox::changePositionProvider( const QString &provider )
{
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.cpp #1121238:1121239
@@ -58,6 +58,8 @@
QTimer m_nominatimTimer;
+ bool m_workOffline;
+
/** Constructor */
RoutingInputWidgetPrivate( RouteSkeleton *skeleton, int index, QWidget *parent );
@@ -68,7 +70,8 @@
RoutingInputWidgetPrivate::RoutingInputWidgetPrivate( RouteSkeleton *skeleton, int index, QWidget *parent ) :
m_lineEdit( 0 ), m_runnerManager( new MarbleRunnerManager( parent ) ),
m_placemarkModel( 0 ), m_progress( ":/data/bitmaps/progress.mng" ),
- m_route( skeleton ), m_index( index ), m_manager( new QNetworkAccessManager( parent ) )
+ m_route( skeleton ), m_index( index ), m_manager( new QNetworkAccessManager( parent ) ),
+ m_workOffline( false )
{
m_stateButton = new QPushButton( parent );
m_stateButton->setToolTip( "Center Map here" );
@@ -156,7 +159,7 @@
void RoutingInputWidget::startHttpRequest()
{
- if ( !hasTargetPosition() ) {
+ if ( d->m_workOffline || !hasTargetPosition() ) {
return;
}
@@ -321,6 +324,11 @@
}
}
+void RoutingInputWidget::setWorkOffline( bool offline )
+{
+ d->m_workOffline = offline;
+}
+
} // namespace Marble
#include "RoutingInputWidget.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingInputWidget.h #1121238:1121239
@@ -75,6 +75,11 @@
*/
void setIndex( int index );
+ /**
+ * Toggle offline mode. In offline mode, reverse geocoding is disabled
+ */
+ void setWorkOffline( bool offline );
+
public Q_SLOTS:
/**
* Search for placemarks matching the current input text. Does nothing
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.cpp #1121238:1121239
@@ -30,12 +30,14 @@
RoutingManagerPrivate( MarbleWidget *widget, QObject *parent );
RouteSkeleton *m_route;
+
+ bool m_workOffline;
};
RoutingManagerPrivate::RoutingManagerPrivate( MarbleWidget *widget, QObject *parent ) :
m_routingModel( new RoutingModel( parent ) ),
m_routingProvider( new OrsRoutingProvider( parent ) ),
- m_marbleWidget( widget ), m_route( 0 )
+ m_marbleWidget( widget ), m_route( 0 ), m_workOffline( false )
{
// nothing to do
}
@@ -76,7 +78,7 @@
void RoutingManager::updateRoute()
{
- if ( d->m_route && d->m_route->size() > 1 ) {
+ if ( !d->m_workOffline && d->m_route && d->m_route->size() > 1 ) {
int realSize = 0;
for ( int i = 0; i < d->m_route->size(); ++i ) {
// Sort out dummy targets
@@ -95,6 +97,11 @@
}
}
+void RoutingManager::setWorkOffline( bool offline )
+{
+ d->m_workOffline = offline;
+}
+
} // namespace Marble
#include "RoutingManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingManager.h #1121238:1121239
@@ -62,6 +62,11 @@
*/
void retrieveRoute( RouteSkeleton *route );
+ /**
+ * Toggle offline mode. In offline mode, new routes cannot be downloaded
+ */
+ void setWorkOffline( bool offline );
+
public Q_SLOTS:
/** Update the route */
void updateRoute();
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.cpp #1121238:1121239
@@ -55,6 +55,8 @@
bool m_zoomRouteAfterDownload;
+ bool m_workOffline;
+
/** Constructor */
RoutingWidgetPrivate();
@@ -78,7 +80,8 @@
RoutingWidgetPrivate::RoutingWidgetPrivate() :
m_widget( 0 ), m_routingManager( 0 ), m_routingLayer( 0 ),
m_activeInput( 0 ), m_inputRequest( 0 ), m_routingProxyModel( 0 ),
- m_routeSkeleton( 0 ), m_zoomRouteAfterDownload( false )
+ m_routeSkeleton( 0 ), m_zoomRouteAfterDownload( false ),
+ m_workOffline( false )
{
// nothing to do
}
@@ -314,6 +317,7 @@
{
if ( index >= 0 && index <= d->m_inputWidgets.size() ) {
RoutingInputWidget *input = new RoutingInputWidget( d->m_routeSkeleton, index, this );
+ input->setWorkOffline( d->m_workOffline );
d->m_inputWidgets.insert( index, input );
connect( input, SIGNAL( searchFinished( RoutingInputWidget* ) ),
this, SLOT( handleSearchResult( RoutingInputWidget* ) ) );
@@ -449,6 +453,16 @@
}
}
+void RoutingWidget::setWorkOffline( bool offline )
+{
+ foreach ( RoutingInputWidget *widget, d->m_inputWidgets ) {
+ widget->setWorkOffline( offline );
+ }
+
+ d->m_workOffline = offline;
+ d->m_routingManager->setWorkOffline( offline );
+}
+
} // namespace Marble
#include "RoutingWidget.moc"
--- trunk/KDE/kdeedu/marble/src/lib/routing/RoutingWidget.h #1121238:1121239
@@ -46,6 +46,11 @@
/** Destructor */
~RoutingWidget();
+ /**
+ * Toggle offline mode. In offline mode, new routes cannot be downloaded
+ */
+ void setWorkOffline( bool offline );
+
private Q_SLOTS:
/** Retrieve route directions */
void retrieveRoute();
More information about the Marble-commits
mailing list