[Marble-commits] KDE/kdeedu/marble/src
Bastian Holst
bastianholst at gmx.de
Fri Apr 16 15:23:36 CEST 2010
SVN commit 1115436 by bholst:
Marble GHNS fixes:
* KNewstuff3 downloads to the correct directory now (with http://reviewboard.kde.org/r/3598/ which will hopefully be reviewed soon)
* Marble doesn't crash anymore, when you select a theme that was not in the data directory at startup.
M +2 -0 ControlView.cpp
M +10 -2 lib/MapThemeManager.cpp
M +6 -0 lib/MapThemeManager.h
M +23 -9 lib/StackedTileLoader.cpp
M +3 -1 lib/StackedTileLoader.h
M +1 -1 marble.knsrc
--- trunk/KDE/kdeedu/marble/src/ControlView.cpp #1115435:1115436
@@ -50,6 +50,8 @@
m_control->addMarbleWidget( m_marbleWidget );
+ // TODO: Creating a second MapThemeManager may not be the best solution here.
+ // MarbleModel also holds one with a QFileSystemWatcher.
m_mapThemeManager = new MapThemeManager;
m_control->setMapThemeModel( m_mapThemeManager->mapThemeModel() );
--- trunk/KDE/kdeedu/marble/src/lib/MapThemeManager.cpp #1115435:1115436
@@ -68,6 +68,7 @@
: QObject( parent ),
d( new MapThemeManagerPrivate )
{
+ initFileSystemWatcher();
}
MapThemeManager::~MapThemeManager()
@@ -89,8 +90,6 @@
void MapThemeManager::initialize()
{
- initFileSystemWatcher();
-
// Delayed model initialization
updateMapThemeModel();
d->m_isInitialized = true;
@@ -151,6 +150,10 @@
const QString localMapPathName = MarbleDirs::localPath() + '/' + mapDirName;
const QString systemMapPathName = MarbleDirs::systemPath() + '/' + mapDirName;
+ if( !QDir().exists( localMapPathName ) ) {
+ QDir().mkpath( localMapPathName );
+ }
+
result << localMapPathName;
result << systemMapPathName;
addMapThemePaths( localMapPathName, result );
@@ -287,6 +290,7 @@
void MapThemeManager::updateMapThemeModel()
{
+ mDebug() << "updateMapThemeModel";
d->m_mapThemeModel->clear();
d->m_mapThemeModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
@@ -313,6 +317,8 @@
QStringList paths = pathsToWatch();
d->m_fileSystemWatcher->addPaths( paths );
+ mDebug() << "Emitting themesChanged()";
+ emit themesChanged();
updateMapThemeModel();
}
@@ -351,6 +357,8 @@
d->m_mapThemeModel->insertRow( insertAtRow, newMapThemeRow );
}
}
+
+ emit themesChanged();
}
//
--- trunk/KDE/kdeedu/marble/src/lib/MapThemeManager.h #1115435:1115436
@@ -90,6 +90,12 @@
void directoryChanged( const QString& path );
void fileChanged( const QString & path );
+ Q_SIGNALS:
+ /**
+ * @brief This signal will be emitted, when the themes change.
+ */
+ void themesChanged();
+
private:
Q_DISABLE_COPY( MapThemeManager )
--- trunk/KDE/kdeedu/marble/src/lib/StackedTileLoader.cpp #1115435:1115436
@@ -99,10 +99,11 @@
m_parent( model )
{
d->m_mapThemeManager = mapThemeManager;
+ connect( d->m_mapThemeManager, SIGNAL( themesChanged() ),
+ this, SLOT( updateTextureLayers() ) );
setTextureLayerSettings( textureLayerSettings );
- initTextureLayers();
d->m_tileLoader = new TileLoader( mapThemeManager, downloadManager );
- d->m_tileLoader->setTextureLayers( d->m_textureLayers );
+ updateTextureLayers();
connect( d->m_tileLoader, SIGNAL( tileCompleted( TileId, TileId )),
SLOT( updateTile( TileId, TileId )));
setDownloadManager( downloadManager );
@@ -122,12 +123,15 @@
void StackedTileLoader::setTextureLayerSettings( GeoSceneGroup * const textureLayerSettings )
{
- if ( d->m_textureLayerSettings )
- d->m_textureLayerSettings->disconnect( this );
+ if ( d->m_textureLayerSettings ) {
+ disconnect( d->m_textureLayerSettings, SIGNAL( valueChanged( QSting, bool ) ),
+ this, SLOT( reset() ) );
+ }
d->m_textureLayerSettings = textureLayerSettings;
- if ( d->m_textureLayerSettings )
+ if ( d->m_textureLayerSettings ) {
connect( d->m_textureLayerSettings, SIGNAL( valueChanged( QString, bool )),
- this, SLOT( reset() ));
+ this, SLOT( reset() ) );
+ }
}
void StackedTileLoader::resetTilehash()
@@ -443,7 +447,7 @@
return result;
}
-void StackedTileLoader::initTextureLayers()
+void StackedTileLoader::updateTextureLayers()
{
QList<GeoSceneDocument const *> const & mapThemes = d->m_mapThemeManager->mapThemes();
QList<GeoSceneDocument const *>::const_iterator pos = mapThemes.constBegin();
@@ -452,7 +456,7 @@
GeoSceneHead const * head = (*pos)->head();
Q_ASSERT( head );
const QString mapThemeId = head->target() + '/' + head->theme();
- mDebug() << "StackedTileLoader::initTextureLayers" << mapThemeId;
+ mDebug() << "StackedTileLoader::updateTextureLayers" << mapThemeId;
GeoSceneMap const * map = (*pos)->map();
Q_ASSERT( map );
@@ -462,6 +466,14 @@
continue;
}
+ uint hash = qHash( mapThemeId );
+ if ( d->m_sceneLayers.contains( hash ) ) {
+ mDebug() << "StackedTileLoader::updateTextureLayers:"
+ << hash << mapThemeId
+ << "already exists";
+ continue;
+ }
+
d->m_sceneLayers.insert( qHash( mapThemeId ), sceneLayer );
// find all texture layers
@@ -475,10 +487,12 @@
continue;
}
d->m_textureLayers.insert( qHash( textureLayer->sourceDir() ), textureLayer );
- mDebug() << "StackedTileLoader::initTextureLayers" << "added texture layer:"
+ mDebug() << "StackedTileLoader::updateTextureLayers" << "added texture layer:"
<< qHash( textureLayer->sourceDir() ) << textureLayer->sourceDir();
}
}
+
+ d->m_tileLoader->setTextureLayers( d->m_textureLayers );
}
void StackedTileLoader::mergeDecorations( StackedTile * const tile,
--- trunk/KDE/kdeedu/marble/src/lib/StackedTileLoader.h #1115435:1115436
@@ -160,6 +160,9 @@
*/
void tileUpdateAvailable();
+ private Q_SLOTS:
+ void updateTextureLayers();
+
private:
Q_DISABLE_COPY( StackedTileLoader )
GeoSceneLayer const * findSceneLayer( TileId const & ) const;
@@ -167,7 +170,6 @@
GeoSceneTexture * findTextureLayer( TileId const & );
QVector<GeoSceneTexture const *>
findRelevantTextureLayers( TileId const & stackedTileId ) const;
- void initTextureLayers();
void mergeDecorations( StackedTile * const, GeoSceneTexture * const ) const;
void reloadCachedTile( StackedTile * const cachedTile );
--- trunk/KDE/kdeedu/marble/src/marble.knsrc #1115435:1115436
@@ -6,5 +6,5 @@
[KNewStuff3]
ProvidersUrl=http://edu.kde.org/marble/newstuff/providers.xml
Categories=Marble,Maps
-TargetDir=marble/maps
+XdgTargetDir=marble/maps
Uncompress=archive
More information about the Marble-commits
mailing list