[Marble-commits] KDE/kdeedu/marble/src
Thibaut Gridel
tgridel at free.fr
Sat Jan 23 09:06:30 CET 2010
SVN commit 1078921 by tgridel:
HttpDownloadManager: use MarbleModel's PluginManager
M +6 -0 lib/AbstractDataPlugin.cpp
M +3 -0 lib/AbstractDataPlugin.h
M +6 -3 lib/AbstractDataPluginModel.cpp
M +4 -1 lib/AbstractDataPluginModel.h
M +10 -6 lib/HttpDownloadManager.cpp
M +3 -1 lib/HttpDownloadManager.h
M +6 -0 lib/MarbleDataFacade.cpp
M +3 -0 lib/MarbleDataFacade.h
M +7 -1 lib/MarbleModel.cpp
M +3 -0 lib/MarbleModel.h
M +1 -1 plugins/render/photo/PhotoPlugin.cpp
M +3 -2 plugins/render/photo/PhotoPluginModel.cpp
M +2 -1 plugins/render/photo/PhotoPluginModel.h
M +3 -2 plugins/render/weather/WeatherModel.cpp
M +2 -1 plugins/render/weather/WeatherModel.h
M +1 -1 plugins/render/weather/WeatherPlugin.cpp
M +3 -2 plugins/render/wikipedia/WikipediaModel.cpp
M +2 -1 plugins/render/wikipedia/WikipediaModel.h
M +1 -1 plugins/render/wikipedia/WikipediaPlugin.cpp
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPlugin.cpp #1078920:1078921
@@ -16,6 +16,7 @@
#include "AbstractDataPluginItem.h"
#include "GeoPainter.h"
#include "GeoSceneLayer.h"
+#include "MarbleDataFacade.h"
#include "ViewportParams.h"
#include "MarbleDebug.h"
@@ -118,6 +119,11 @@
connect( d->m_model, SIGNAL( itemsUpdated() ), this, SLOT( requestRepaint() ) );
}
+PluginManager* AbstractDataPlugin::pluginManager() const
+{
+ return dataFacade()->pluginManager();
+}
+
QString AbstractDataPlugin::nameId() const
{
return d->m_name;
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPlugin.h #1078920:1078921
@@ -24,6 +24,7 @@
class AbstractDataPluginItem;
class AbstractDataPluginModel;
class AbstractDataPluginPrivate;
+class PluginManager;
/**
* @short: An abstract class for plugins that show data that has a geo coordinate
@@ -84,6 +85,8 @@
*/
void setModel( AbstractDataPluginModel* model );
+ PluginManager *pluginManager() const;
+
/**
* Set the name id of the plugin
*/
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPluginModel.cpp #1078920:1078921
@@ -51,7 +51,8 @@
class AbstractDataPluginModelPrivate
{
public:
- AbstractDataPluginModelPrivate( const QString& name, AbstractDataPluginModel * parent )
+ AbstractDataPluginModelPrivate( const QString& name,
+ AbstractDataPluginModel * parent )
: m_parent( parent ),
m_name( name ),
m_lastBox(),
@@ -101,14 +102,16 @@
HttpDownloadManager *m_downloadManager;
};
-AbstractDataPluginModel::AbstractDataPluginModel( const QString& name, QObject *parent )
+AbstractDataPluginModel::AbstractDataPluginModel( const QString& name,
+ PluginManager *pluginManager,
+ QObject *parent )
: QObject( parent ),
d( new AbstractDataPluginModelPrivate( name, this ) )
{
// Initializing file and download System
CacheStoragePolicy *storagePolicy = new CacheStoragePolicy( MarbleDirs::localPath()
+ "/cache/" + d->m_name + '/' );
- d->m_downloadManager = new HttpDownloadManager( storagePolicy );
+ d->m_downloadManager = new HttpDownloadManager( storagePolicy, pluginManager );
connect( d->m_downloadManager, SIGNAL( downloadComplete( QString, QString ) ),
this, SLOT( processFinishedJob( QString , QString ) ) );
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPluginModel.h #1078920:1078921
@@ -28,6 +28,7 @@
class AbstractDataPluginItem;
class GeoDataLatLonAltBox;
class MarbleDataFacade;
+class PluginManager;
class ViewportParams;
/**
@@ -45,7 +46,9 @@
Q_OBJECT
public:
- explicit AbstractDataPluginModel( const QString& name, QObject *parent = 0 );
+ explicit AbstractDataPluginModel( const QString& name,
+ PluginManager *pluginManager,
+ QObject *parent = 0 );
virtual ~AbstractDataPluginModel();
/**
--- trunk/KDE/kdeedu/marble/src/lib/HttpDownloadManager.cpp #1078920:1078921
@@ -32,7 +32,8 @@
class HttpDownloadManager::Private
{
public:
- explicit Private( StoragePolicy *policy );
+ explicit Private( StoragePolicy *policy,
+ PluginManager *pluginManager );
~Private();
HttpJob *createJob( const QUrl& sourceUrl, const QString& destFileName,
@@ -49,14 +50,17 @@
QList<QPair<DownloadPolicyKey, DownloadQueueSet *> > m_queueSets;
QMap<DownloadUsage, DownloadQueueSet *> m_defaultQueueSets;
StoragePolicy *m_storagePolicy;
+ PluginManager *m_pluginManager;
NetworkPlugin *m_networkPlugin;
};
-HttpDownloadManager::Private::Private( StoragePolicy *policy )
+HttpDownloadManager::Private::Private( StoragePolicy *policy,
+ PluginManager *pluginManager )
: m_downloadEnabled( true ), //enabled for now
m_requeueTimer( 0 ),
m_storagePolicy( policy ),
+ m_pluginManager( pluginManager ),
m_networkPlugin( 0 )
{
// setup default download policy and associated queue set
@@ -83,8 +87,7 @@
const QString &id )
{
if ( !m_networkPlugin ) {
- PluginManager pluginManager;
- QList<NetworkPlugin *> networkPlugins = pluginManager.createNetworkPlugins();
+ QList<NetworkPlugin *> networkPlugins = m_pluginManager->createNetworkPlugins();
if ( !networkPlugins.isEmpty() ) {
// FIXME: not just take the first plugin, but use some configuration setting
// take the first plugin and delete the rest
@@ -121,8 +124,9 @@
}
-HttpDownloadManager::HttpDownloadManager( StoragePolicy *policy )
- : d( new Private( policy ))
+HttpDownloadManager::HttpDownloadManager( StoragePolicy *policy,
+ PluginManager *pluginManager )
+ : d( new Private( policy, pluginManager ))
{
d->m_requeueTimer = new QTimer( this );
d->m_requeueTimer->setInterval( requeueTime );
--- trunk/KDE/kdeedu/marble/src/lib/HttpDownloadManager.h #1078920:1078921
@@ -31,6 +31,7 @@
class DownloadPolicy;
class DownloadQueueSet;
class HttpJob;
+class PluginManager;
class StoragePolicy;
/**
@@ -53,7 +54,8 @@
*
* @param policy The storage policy for this manager.
*/
- explicit HttpDownloadManager( StoragePolicy *policy );
+ explicit HttpDownloadManager( StoragePolicy *policy,
+ PluginManager *pluginManager );
/**
* Destroys the http download manager.
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDataFacade.cpp #1078920:1078921
@@ -27,6 +27,7 @@
#include "Planet.h"
#include "FileViewModel.h"
+#include "PluginManager.h"
#include "GeoDataParser.h"
#include "GeoSceneDocument.h"
@@ -119,5 +120,10 @@
return d->m_fileviewmodel;
}
+PluginManager* MarbleDataFacade::pluginManager()
+{
+ return d->m_model->pluginManager();
}
+}
+
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDataFacade.h #1078920:1078921
@@ -43,6 +43,7 @@
class FileViewModel;
class MarbleDataFacadePrivate;
class Planet;
+class PluginManager;
/**
* @short A read-only interface to internal Marble data.
@@ -81,6 +82,8 @@
MarblePlacemarkModel* placemarkModel();
FileViewModel* fileViewModel() const;
+ PluginManager* pluginManager();
+
private:
MarbleDataFacadePrivate * const d;
};
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.cpp #1078920:1078921
@@ -89,7 +89,8 @@
m_mapTheme( 0 ),
m_layerManager( 0 ),
m_downloadManager( new HttpDownloadManager( new FileStoragePolicy(
- MarbleDirs::localPath() ))),
+ MarbleDirs::localPath() ),
+ m_pluginManager ) ),
m_fileManager( 0 ),
m_placemarkmanager( 0 )
{
@@ -851,6 +852,11 @@
tile->initJumpTables( requestTileUpdate );
}
+PluginManager* MarbleModel::pluginManager() const
+{
+ return d->m_pluginManager;
+}
+
QList<RenderPlugin *> MarbleModel::renderPlugins() const
{
return d->m_layerManager->renderPlugins();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleModel.h #1078920:1078921
@@ -64,6 +64,7 @@
class TextureTile;
class MergedLayerDecorator;
class RenderPlugin;
+class PluginManager;
class AbstractFloatItem;
class GeoDataDocument;
class GeoSceneDocument;
@@ -257,6 +258,8 @@
*/
quint64 volatileTileCacheLimit() const;
+ PluginManager* pluginManager() const;
+
/**
* @brief Returns a list of all RenderPlugins in the model, this includes float items
* @return the list of RenderPlugins
--- trunk/KDE/kdeedu/marble/src/plugins/render/photo/PhotoPlugin.cpp #1078920:1078921
@@ -32,7 +32,7 @@
void PhotoPlugin::initialize()
{
mDebug() << "PhotoPlugin: Initialize";
- setModel( new PhotoPluginModel( this ) );
+ setModel( new PhotoPluginModel( pluginManager(), this ) );
setNumberOfItems( numberOfImagesPerFetch );
m_isInitialized = true;
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/photo/PhotoPluginModel.cpp #1078920:1078921
@@ -30,8 +30,9 @@
const QString flickrApiKey( "620131a1b82b000c9582b94effcdc636" );
-PhotoPluginModel::PhotoPluginModel( QObject *parent )
- : AbstractDataPluginModel( "photo", parent )
+PhotoPluginModel::PhotoPluginModel( PluginManager *pluginManager,
+ QObject *parent )
+ : AbstractDataPluginModel( "photo", pluginManager, parent )
{
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/photo/PhotoPluginModel.h #1078920:1078921
@@ -25,7 +25,8 @@
Q_OBJECT
public:
- PhotoPluginModel( QObject *parent = 0 );
+ PhotoPluginModel( PluginManager *pluginManager,
+ QObject *parent = 0 );
static QUrl generateUrl( const QString& service,
const QString& method,
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/WeatherModel.cpp #1078920:1078921
@@ -20,8 +20,9 @@
using namespace Marble;
-WeatherModel::WeatherModel( QObject *parent )
- : AbstractDataPluginModel( "weather", parent )
+WeatherModel::WeatherModel( PluginManager *pluginManager,
+ QObject *parent )
+ : AbstractDataPluginModel( "weather", pluginManager, parent )
{
// addService( new FakeWeatherService( this ) );
addService( new BBCWeatherService( this ) );
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/WeatherModel.h #1078920:1078921
@@ -29,7 +29,8 @@
Q_OBJECT
public:
- explicit WeatherModel( QObject *parent );
+ explicit WeatherModel( PluginManager *pluginManager,
+ QObject *parent );
~WeatherModel();
public Q_SLOTS:
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/WeatherPlugin.cpp #1078920:1078921
@@ -57,7 +57,7 @@
void WeatherPlugin::initialize()
{
- WeatherModel *model = new WeatherModel( this );
+ WeatherModel *model = new WeatherModel( pluginManager(), this );
setModel( model );
updateItemSettings();
setNumberOfItems( numberOfStationsPerFetch );
--- trunk/KDE/kdeedu/marble/src/plugins/render/wikipedia/WikipediaModel.cpp #1078920:1078921
@@ -34,8 +34,9 @@
using namespace Marble;
-WikipediaModel::WikipediaModel( QObject *parent )
- : AbstractDataPluginModel( "wikipedia", parent ),
+WikipediaModel::WikipediaModel( PluginManager *pluginManager,
+ QObject *parent )
+ : AbstractDataPluginModel( "wikipedia", pluginManager, parent ),
m_showThumbnail( true )
{
m_wikipediaIcon.addFile( MarbleDirs::path( "svg/wikipedia_shadow.svg" ) );
--- trunk/KDE/kdeedu/marble/src/plugins/render/wikipedia/WikipediaModel.h #1078920:1078921
@@ -28,7 +28,8 @@
Q_OBJECT
public:
- WikipediaModel( QObject *parent = 0 );
+ WikipediaModel( PluginManager *pluginManager,
+ QObject *parent = 0 );
~WikipediaModel();
void setShowThumbnail( bool show );
--- trunk/KDE/kdeedu/marble/src/plugins/render/wikipedia/WikipediaPlugin.cpp #1078920:1078921
@@ -51,7 +51,7 @@
void WikipediaPlugin::initialize()
{
- WikipediaModel *model = new WikipediaModel( this );
+ WikipediaModel *model = new WikipediaModel( pluginManager(), this );
// Ensure that all settings get forwarded to the model.
setModel( model );
updateItemSettings();
More information about the Marble-commits
mailing list