[Marble-commits] KDE/kdeedu/marble/src
Dennis Nienhüser
earthwings at gentoo.org
Fri Mar 12 19:29:23 CET 2010
SVN commit 1102516 by nienhueser:
Make MarbleRunnerManager aware of offline mode (do not run onf and hostip search in offline mode).
M +1 -4 QtMainWindow.cpp
M +9 -0 lib/MarbleControlBox.cpp
M +5 -0 lib/MarbleControlBox.h
M +8 -2 lib/MarbleRunnerManager.cpp
M +7 -0 lib/MarbleRunnerManager.h
M +1 -3 marble_part.cpp
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1102515:1102516
@@ -46,7 +46,6 @@
#include "lib/MarbleLocale.h"
#include "AbstractDataPlugin.h"
#include "AbstractFloatItem.h"
-#include "HttpDownloadManager.h"
#include "MarbleMap.h"
#include "MarbleModel.h"
@@ -505,9 +504,7 @@
void MainWindow::workOffline( bool offline )
{
- HttpDownloadManager * const downloadManager =
- m_controlView->marbleWidget()->map()->model()->downloadManager();
- downloadManager->setDownloadEnabled( !offline );
+ m_controlView->marbleControl()->setWorkOffline( offline );
}
void MainWindow::showAtmosphere( bool isChecked )
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.cpp #1102515:1102516
@@ -46,6 +46,7 @@
#include "GeoSceneDocument.h"
#include "GeoSceneHead.h"
#include "Planet.h"
+#include "HttpDownloadManager.h"
#include "GeoDataCoordinates.h"
@@ -666,6 +667,14 @@
}
}
+void MarbleControlBox::setWorkOffline(bool offline)
+{
+ HttpDownloadManager * const downloadManager =
+ d->m_widget->map()->model()->downloadManager();
+ downloadManager->setDownloadEnabled( !offline );
+ d->m_runnerManager->setWorkOffline( offline );
}
+}
+
#include "MarbleControlBox.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleControlBox.h #1102515:1102516
@@ -108,6 +108,11 @@
void updateCelestialModel();
+ /**
+ * Toggle offline mode of download manager and runners.
+ */
+ void setWorkOffline(bool offline);
+
Q_SIGNALS:
/**
* @brief Signal emitted when the Home button has been pressed.
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.cpp #1102515:1102516
@@ -41,7 +41,8 @@
m_activeRunners(0),
m_lastString(""),
m_model(new MarblePlacemarkModel),
- m_celestialBodyId("earth")
+ m_celestialBodyId("earth"),
+ m_workOffline(false)
{
m_model->setPlacemarkContainer(&m_placemarkContainer);
qRegisterMetaType<QVector<GeoDataPlacemark> >("QVector<GeoDataPlacemark>");
@@ -82,7 +83,7 @@
this, SLOT( slotRunnerFinished( MarbleAbstractRunner*, QVector<GeoDataPlacemark> ) ));
llrunner->parse(text);
- if (m_celestialBodyId == "earth") {
+ if (m_celestialBodyId == "earth" && !m_workOffline) {
OnfRunner* onfrunner = new OnfRunner;
m_runners << onfrunner;
connect( onfrunner, SIGNAL( runnerFinished( MarbleAbstractRunner*, QVector<GeoDataPlacemark> ) ),
@@ -127,6 +128,11 @@
m_celestialBodyId = celestialBodyId;
}
+void MarbleRunnerManager::setWorkOffline( bool offline )
+{
+ m_workOffline = offline;
}
+}
+
#include "MarbleRunnerManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.h #1102515:1102516
@@ -43,6 +43,12 @@
void setCelestialBodyId(const QString &celestialBodyId);
+ /**
+ * Toggle offline mode. In offline mode, runners shall not try to access
+ * the network (possibly not returning any results).
+ */
+ void setWorkOffline( bool offline );
+
public slots:
void newText(QString text);
signals:
@@ -61,6 +67,7 @@
QVector<GeoDataPlacemark> m_placemarkContainer;
QMutex m_modelMutex;
QString m_celestialBodyId;
+ bool m_workOffline;
};
}
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1102515:1102516
@@ -355,9 +355,7 @@
void MarblePart::workOffline( bool offline )
{
- HttpDownloadManager * const downloadManager =
- m_controlView->marbleWidget()->map()->model()->downloadManager();
- downloadManager->setDownloadEnabled( !offline );
+ m_controlView->marbleControl()->setWorkOffline( offline );
}
void MarblePart::copyMap()
More information about the Marble-commits
mailing list