[Marble-commits] KDE/kdeedu/marble/src

Dennis Nienhüser earthwings at gentoo.org
Wed Apr 21 22:29:28 CEST 2010


SVN commit 1117311 by nienhueser:

Determine a default map theme based on the available ones, preferring earth/srtm/srtml.dgml

 M  +19 -3     ControlView.cpp  
 M  +6 -0      ControlView.h  
 M  +1 -1      QtMainWindow.cpp  
 M  +5 -1      marble_part.cpp  


--- trunk/KDE/kdeedu/marble/src/ControlView.cpp #1117310:1117311
@@ -16,9 +16,11 @@
 #include <QtGui/QSplitter>
 #include <QtGui/QStringListModel>
 
-#include <MarbleWidget.h>
-#include <MarbleModel.h>
-#include <MapThemeManager.h>
+#include "GeoSceneDocument.h"
+#include "GeoSceneHead.h"
+#include "MarbleWidget.h"
+#include "MarbleModel.h"
+#include "MapThemeManager.h"
 
 namespace Marble
 {
@@ -123,6 +125,20 @@
     m_control->setFileViewTabShown( show );
 }
 
+QString ControlView::defaultMapThemeId() const
+{
+    QList<GeoSceneDocument const*> themes = m_mapThemeManager->mapThemes();
+    QString result;
+    foreach(GeoSceneDocument const* theme, themes) {
+        result = theme->head()->mapThemeId();
+        if ( result == "earth/srtm/srtm.dgml" ) {
+            return result;
+        }
+    }
+
+    return result;
 }
 
+}
+
 #include "ControlView.moc"
--- trunk/KDE/kdeedu/marble/src/ControlView.h #1117310:1117311
@@ -57,6 +57,12 @@
     
     SunLocator* sunLocator() { return m_marbleWidget->sunLocator(); }
     
+    /**
+      * Returns a default map theme: earth/srtm/srtm.dgml if installed,
+      * any other theme id if earth/srtm/srtm.dgml is not installed,
+      * or an empty string if no themes are installed at all
+      */
+    QString defaultMapThemeId() const;
 
  public slots:
     void setSideBarShown( bool );    
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1117310:1117311
@@ -729,7 +729,7 @@
      setUpdatesEnabled(false);
 
      settings.beginGroup("MarbleWidget");
-         QString mapThemeId = settings.value("mapTheme", "" ).toString();
+         QString mapThemeId = settings.value("mapTheme", m_controlView->defaultMapThemeId() ).toString();
          qDebug() << "ReadSettings: mapThemeId: " << mapThemeId;
          m_controlView->marbleWidget()->setMapThemeId( mapThemeId );
          m_controlView->marbleWidget()->setProjection(
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1117310:1117311
@@ -401,7 +401,11 @@
     }
 
     // Map theme and projection
-    m_controlView->marbleWidget()->setMapThemeId( MarbleSettings::mapTheme() );
+    QString mapTheme = MarbleSettings::mapTheme();
+    if ( mapTheme.isEmpty() ) {
+        mapTheme = m_controlView->defaultMapThemeId();
+    }
+    m_controlView->marbleWidget()->setMapThemeId( mapTheme );
     m_controlView->marbleWidget()->setProjection( (Projection) MarbleSettings::projection() );
 
     m_controlView->marbleWidget()->setShowClouds( MarbleSettings::showClouds() );


More information about the Marble-commits mailing list