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

Bernhard Beschow bbeschow at cs.tu-berlin.de
Sun Jan 9 17:47:50 CET 2011


SVN commit 1213212 by beschow:

make sure that d->format is always in lower-case

* fixes inconsistencies between DGML files and image file names

 M  +10 -11    MapWizard.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MapWizard.cpp #1213211:1213212
@@ -198,7 +198,7 @@
     QDomElement format = xml.documentElement().firstChildElement( "Capability" ).firstChildElement( "Request" )
                          .firstChildElement( "GetMap" ).firstChildElement( "Format" );
 
-    d->format = format.text().right( format.text().length() - format.text().indexOf( '/' ) - 1 );
+    d->format = format.text().right( format.text().length() - format.text().indexOf( '/' ) - 1 ).toLower();
 
     if( d->format == "jpeg" ) {
         d->format = "jpg";
@@ -274,7 +274,7 @@
         {
             // Source image
             QFile sourceImage( d->sourceImage );
-            d->format = d->sourceImage.right( d->sourceImage.length() - d->sourceImage.lastIndexOf( '.' ) - 1 );
+            d->format = d->sourceImage.right( d->sourceImage.length() - d->sourceImage.lastIndexOf( '.' ) - 1 ).toLower();
             sourceImage.copy( QString( "%1/%2/%2.%3" ).arg( maps.absolutePath() )
                                                       .arg( document->head()->theme() )
                                                       .arg( d->format ) );
@@ -720,9 +720,9 @@
     else if( d->mapProviderType == MapWizardPrivate::StaticImageMap )
     {
         QString image = d->uiWidget.lineEditSource->text();
-        QString extension = image.right( image.length() - image.lastIndexOf( '.' ) - 1 );
-        texture->setFileFormat( extension );
-        texture->setInstallMap( document->head()->theme() + "." + extension );
+        d->format = image.right( image.length() - image.lastIndexOf( '.' ) - 1 ).toLower();
+        texture->setFileFormat( d->format.toUpper() );
+        texture->setInstallMap( document->head()->theme() + "." + d->format );
         int imageWidth = QImage( image ).width();
         int tileSize = 675;
         
@@ -770,13 +770,14 @@
 
 void MapWizard::accept()
 {
+    Q_ASSERT( d->mapProviderType != MapWizardPrivate::NoMap );
+
+    Q_ASSERT( d->format == d->format.toLower() );
+    Q_ASSERT( !d->mapTheme.isEmpty() );
+
     QSharedPointer<GeoSceneDocument> document( createDocument() );
-    d->mapTheme = document->head()->theme();
     d->sourceImage = d->uiWidget.lineEditSource->text();
-    d->format = d->sourceImage.right( d->sourceImage.length() - d->sourceImage.lastIndexOf( '.' ) - 1 );
 
-    QString wmsUrl = d->uiWidget.lineEditWmsUrl->text();
-
     if( d->uiWidget.radioButtonWms->isChecked() )
     {
         QUrl wmsUrl( d->uiWidget.lineEditWmsUrl->text() );
@@ -795,8 +796,6 @@
         d->path =  QUrl::fromPercentEncoding( staticImageUrl.encodedPath() );
     }
 
-    Q_ASSERT( d->mapProviderType != MapWizardPrivate::NoMap );
-
     if( d->mapProviderType == MapWizardPrivate::StaticImageMap && d->uiWidget.lineEditSource->text().isEmpty() )
     {
         QMessageBox::information( this, tr( "Problem with map information" ), tr( "Please specify a source image." ) );


More information about the Marble-commits mailing list