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

Bernhard Beschow bbeschow at cs.tu-berlin.de
Tue Jan 4 01:26:09 CET 2011


SVN commit 1211407 by beschow:

validate all metadata page in MapWizard

* map title (must not be empty)
* map name (must not be empty, must not exist already)
* preview icon (must be a valid image)

 M  +27 -1     MapWizard.cpp  
 M  +4 -4      MapWizard.ui  


--- trunk/KDE/kdeedu/marble/src/lib/MapWizard.cpp #1211406:1211407
@@ -676,10 +676,36 @@
         return false;
     }
 
-    if ( currentId() == 5 && d->previewImage.isNull() ) {
+    if ( currentId() == 5 ) {
+        if ( d->uiWidget.lineEditTitle->text().isEmpty() ) {
+            QMessageBox::information( this, tr( "Map Title" ), tr( "Please specify a map title." ) );
+            d->uiWidget.lineEditTitle->setFocus();
+            return false;
+        }
+
+        d->mapTheme = d->uiWidget.lineEditTheme->text();
+        if ( d->mapTheme.isEmpty() ) {
+            QMessageBox::information( this, tr( "Map Name" ), tr( "Please specify a map name." ) );
+            d->uiWidget.lineEditTheme->setFocus();
+            return false;
+        }
+
+        const QDir destinationDir( QString( "%1/maps/earth/%2" ).arg( MarbleDirs::localPath() ).arg( d->mapTheme ) );
+        if ( destinationDir.exists() ) {
+            QMessageBox::information( this,
+                                    tr( "Map Name" ),
+                                    tr( "Please specify another map name, since there is already a map named \"%1\"." ).arg( d->mapTheme ) );
+            d->uiWidget.lineEditTheme->setFocus();
+            d->uiWidget.lineEditTheme->selectAll();
+            return false;
+        }
+
+        if ( d->previewImage.isNull() ) {
         QMessageBox::information( this, tr( "Preview Image" ), tr( "Please specify a preview image." ) );
+            d->uiWidget.pushButtonPreview->setFocus();
         return false;
     }
+    }
 
     return QWizard::validateCurrentPage();
 }
--- trunk/KDE/kdeedu/marble/src/lib/MapWizard.ui #1211406:1211407
@@ -484,9 +484,9 @@
        <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
 &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
 p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;General Information&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Please specify a name and an icon for your map theme. Add a description to let the user know what your map is about. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-weight:600;&quot;&gt;General Information&lt;/span&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Please specify a title, a name and an icon for your new map. Add a description to let users know what your map is about. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
       </property>
       <property name="wordWrap">
        <bool>true</bool>
@@ -516,7 +516,7 @@
     <item row="2" column="0">
      <widget class="QLabel" name="labelMapTheme">
       <property name="text">
-       <string>Map Theme:</string>
+       <string>Map Name:</string>
       </property>
       <property name="alignment">
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>


More information about the Marble-commits mailing list