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

Dennis Nienhüser earthwings at gentoo.org
Wed Jan 27 21:12:39 CET 2010


SVN commit 1081126 by nienhueser:

Remove exit() calls from the library part. Libraries should not force applications to terminate. Deal with no theme being loadable. While marble is not exactly useful without data, this prevents crashes and allows applications embedding a MarbleWidget to continue working even when marble is not correctly installed with regard to data files or their location.
CCBUG: 172830


 M  +12 -10    MarbleMap.cpp  
 M  +4 -5      TextureTile.cpp  
 M  +6 -5      ViewParams.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MarbleMap.cpp #1081125:1081126
@@ -964,18 +964,20 @@
     d->m_viewParams.setMapThemeId( mapThemeId );
     GeoSceneDocument *mapTheme = d->m_viewParams.mapTheme();
 
-    d->m_model->setMapTheme( mapTheme, d->m_viewParams.projection() );
-    
-    // We don't do this on every paintEvent to improve performance.
-    // Redrawing the atmosphere is only needed if the size of the
-    // globe changes.
-    d->doResize();
-    d->m_dirtyAtmosphere=true;
+    if (mapTheme) {
+        d->m_model->setMapTheme( mapTheme, d->m_viewParams.projection() );
 
-    centerSun();
+        // We don't do this on every paintEvent to improve performance.
+        // Redrawing the atmosphere is only needed if the size of the
+        // globe changes.
+        d->doResize();
+        d->m_dirtyAtmosphere=true;
 
-    // Update texture map during the repaint that follows:
-    setNeedsUpdate();
+        centerSun();
+
+        // Update texture map during the repaint that follows:
+        setNeedsUpdate();
+    }
 }
 
 void MarbleMap::setPropertyValue( const QString& name, bool value )
--- trunk/KDE/kdeedu/marble/src/lib/TextureTile.cpp #1081125:1081126
@@ -408,8 +408,8 @@
     //    mDebug() << "Entered initJumpTables( bool ) of Tile" << d->m_id;
 
     if ( d->m_rawtile.isNull() ) {
-        mDebug() << "An essential tile is missing. Please rerun the application.";
-        exit(-1);
+        qWarning() << "An essential tile is missing. Please rerun the application.";
+        return;
     }
 
     switch ( d->m_depth ) {
@@ -424,9 +424,8 @@
             d->jumpTable8 = jumpTableFromQImage8( d->m_rawtile );
             break;
         default:
-            mDebug() << QString("Color m_depth %1 of tile could not be retrieved. Exiting.").
-                arg( d->m_depth );
-            exit( -1 );
+            qWarning() << "Color depth" << d->m_depth << " is not supported.";
+            return;
     }
 
     d->m_isGrayscale = d->m_rawtile.isGrayscale();
--- trunk/KDE/kdeedu/marble/src/lib/ViewParams.cpp #1081125:1081126
@@ -137,17 +137,18 @@
         // Check whether the previous theme works 
         if ( !d->m_mapTheme ){ 
             // Fall back to default theme
-            mDebug() << "Falling back to default theme";
-            mapTheme = MapThemeManager::loadMapTheme("earth/srtm/srtm.dgml");
+            QString defaultTheme = "earth/srtm/srtm.dgml";
+            qWarning() << "Falling back to default theme " << defaultTheme;
+            mapTheme = MapThemeManager::loadMapTheme(defaultTheme);
 
             // If this last resort doesn't work either shed a tear and exit
             if ( !mapTheme ) {
-                mDebug() << "Couldn't find a valid DGML map.";
-                exit(-1);
+                qWarning() << "Couldn't find a valid DGML map.";
+                return;
             }
         }
         else {
-            mDebug() << "Selected theme doesn't work, so we stick to the previous one";
+            qWarning() << "Selected theme doesn't work, so we stick to the previous one";
             return;
         }
     }


More information about the Marble-commits mailing list