[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><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">General Information</span></p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please specify a name and an icon for your map theme. Add a description to let the user know what your map is about. </p></body></html></string>
+</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-weight:600;">General Information</span></p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">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. </span></p></body></html></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