Skip to content
Permalink
Browse files

better error message

git-svn-id: http://svn.osgeo.org/qgis/trunk@5109 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Mar 29, 2006
1 parent 3f6857d commit 790417800bc9c86580d0561a70bbadb44ed5f466
Showing with 24 additions and 7 deletions.
  1. +21 −7 src/plugins/grass/qgsgrassbrowser.cpp
  2. +3 −0 src/plugins/grass/qgsgrassbrowser.h
@@ -219,6 +219,11 @@ void QgsGrassBrowser::doubleClicked(const QModelIndex & index)
addMap();
}

QString QgsGrassBrowser::formatMessage( QString msg )
{
return msg.replace("<","&lt;").replace(">","&gt;").replace("\n","<br>");
}

void QgsGrassBrowser::copyMap()
{
#ifdef QGISDEBUG
@@ -274,14 +279,17 @@ void QgsGrassBrowser::copyMap()
module.append(".exe");
#endif
QProcess process(this);
process.start(module, QStringList( typeName + "=" + map + "@" + mapset + "," + newName ) );
QStringList args(typeName + "=" + map + "@" + mapset + "," + newName );
process.start(module, args );
if ( !process.waitForFinished() || process.exitCode() != 0 )
{
QString output ( process.readAllStandardOutput () );
QString error ( process.readAllStandardError () );
QMessageBox::warning( 0, "Warning", "Cannot copy map "
+ map + "@" + mapset + "<br>" + output.replace("\n","<br>")
+ "<br>" + error.replace("\n","<br>") );
+ map + "@" + mapset
+ "<br>command: " + module + " " + args.join(" ")
+ "<br>" + formatMessage(output)
+ "<br>" + formatMessage(error) );
}
else
{
@@ -337,14 +345,17 @@ void QgsGrassBrowser::renameMap()
module.append(".exe");
#endif
QProcess process(this);
QStringList args(typeName + "=" + map + "," + newName );
process.start(module, QStringList( typeName + "=" + map + "," + newName ) );
if ( !process.waitForFinished() || process.exitCode() != 0 )
{
QString output ( process.readAllStandardOutput () );
QString error ( process.readAllStandardError () );
QMessageBox::warning( 0, "Warning", "Cannot rename map "
+ map + "<br>" + output.replace("\n","<br>")
+ "<br>" + error.replace("\n","<br>") );
+ map
+ "<br>command: " + module + " " + args.join(" ")
+ "<br>" + formatMessage(output)
+ "<br>" + formatMessage(error) );
}
else
{
@@ -389,14 +400,17 @@ void QgsGrassBrowser::deleteMap()
module.append(".exe");
#endif
QProcess process(this);
QStringList args(typeName + "=" + map );
process.start(module, QStringList( typeName + "=" + map ) );
if ( !process.waitForFinished() || process.exitCode() != 0 )
{
QString output ( process.readAllStandardOutput () );
QString error ( process.readAllStandardError () );
QMessageBox::warning( 0, "Warning", "Cannot delete map "
+ map + "<br>" + output.replace("\n","<br>")
+ "<br>" + error.replace("\n","<br>") );
+ map
+ "<br>command: " + module + " " + args.join(" ")
+ "<br>" + formatMessage(output)
+ "<br>" + formatMessage(error) );
}
else
{
@@ -101,6 +101,9 @@ public slots:
QAction *mActionRenameMap;
QAction *mActionSetRegion;
QAction *mActionRefresh;

//! Escape HTML tags and convert \n to <br>
QString formatMessage ( QString msg );
};

#endif // QGSGRASSBROWSER_H

0 comments on commit 7904178

Please sign in to comment.
You can’t perform that action at this time.