[Marble-commits] KDE/kdeedu/marble/src/lib
Dennis Nienhüser
earthwings at gentoo.org
Fri Mar 12 22:38:34 CET 2010
SVN commit 1102568 by nienhueser:
Add Openstreetmap nominatim runner. Make common userAgent method available in TinyWebBrowser, used by HttpJob and OsmNominatimRunner.
BUG: 230258
M +1 -0 CMakeLists.txt
M +4 -7 HttpJob.cpp
M +9 -1 MarbleRunnerManager.cpp
M +8 -0 TinyWebBrowser.cpp
M +2 -0 TinyWebBrowser.h
A runners/OsmNominatimRunner.cpp [License: LGPL]
A runners/OsmNominatimRunner.h [License: LGPL]
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1102567:1102568
@@ -200,6 +200,7 @@
runners/MarbleAbstractRunner.cpp
runners/LatLonRunner.cpp
runners/OnfRunner.cpp
+ runners/OsmNominatimRunner.cpp
runners/HostipRunner.cpp
)
--- trunk/KDE/kdeedu/marble/src/lib/HttpJob.cpp #1102567:1102568
@@ -12,6 +12,7 @@
//
#include "HttpJob.h"
+#include "TinyWebBrowser.h"
#include <QtCore/QDebug>
@@ -112,21 +113,17 @@
QByteArray HttpJob::userAgent() const
{
- QString result( "Mozilla/5.0 (compatible; Marble/%1; %2; %3)" );
- result.arg( MARBLE_VERSION_STRING );
switch ( d->m_downloadUsage ) {
case DownloadBrowse:
- result.arg( "Browser" );
+ return TinyWebBrowser::userAgent("Browser", d->m_pluginId);
break;
case DownloadBulk:
- result.arg( "BulkDownloader" );
+ return TinyWebBrowser::userAgent("BulkDownloader", d->m_pluginId);
break;
default:
qCritical() << "Unknown download usage value:" << d->m_downloadUsage;
- result.arg( "unknown" );
+ return TinyWebBrowser::userAgent("unknown", d->m_pluginId);
}
- result.arg( d->m_pluginId );
- return result.toAscii();
}
#include "HttpJob.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleRunnerManager.cpp #1102567:1102568
@@ -25,9 +25,10 @@
#include "PlacemarkManager.h"
#include "GeoDataPlacemark.h"
+#include "HostipRunner.h"
#include "LatLonRunner.h"
#include "OnfRunner.h"
-#include "HostipRunner.h"
+#include "OsmNominatimRunner.h"
#include <QtCore/QObject>
#include <QtCore/QString>
@@ -91,6 +92,13 @@
onfrunner->parse(text);
onfrunner->start();
+ OsmNominatimRunner* nominatim = new OsmNominatimRunner;
+ m_runners << nominatim;
+ connect( nominatim, SIGNAL( runnerFinished( MarbleAbstractRunner*, QVector<GeoDataPlacemark> ) ),
+ this, SLOT( slotRunnerFinished( MarbleAbstractRunner*, QVector<GeoDataPlacemark> ) ));
+ nominatim->parse(text);
+ nominatim->start();
+
HostipRunner* iprunner = new HostipRunner;
m_runners << iprunner;
connect( iprunner, SIGNAL( runnerFinished( MarbleAbstractRunner*, QVector<GeoDataPlacemark> ) ),
--- trunk/KDE/kdeedu/marble/src/lib/TinyWebBrowser.cpp #1102567:1102568
@@ -104,6 +104,14 @@
QDesktopServices::openUrl( url );
}
+QByteArray TinyWebBrowser::userAgent(const QString &platform, const QString &component)
+{
+ QString result( "Mozilla/5.0 (compatible; Marble/%1; %2; %3)" );
+ result = result.arg( MARBLE_VERSION_STRING, platform, component);
+ return result.toAscii();
+}
+
+
} // namespace Marble
#include "TinyWebBrowser.moc"
--- trunk/KDE/kdeedu/marble/src/lib/TinyWebBrowser.h #1102567:1102568
@@ -39,6 +39,8 @@
TinyWebBrowser( QWidget* parent = 0 );
~TinyWebBrowser();
+ static QByteArray userAgent(const QString &platform, const QString &plugin);
+
public Q_SLOTS:
void setWikipediaPath( const QString& relativeUrl );
void print();
More information about the Marble-commits
mailing list