ENH: make sure html < > & stuff is escaped for the output window

This commit is contained in:
Bill Hoffman 2008-02-14 15:06:05 -05:00
parent b459ec9f57
commit 7b1c305d86
2 changed files with 19 additions and 2 deletions

View File

@ -16,7 +16,6 @@
=========================================================================*/ =========================================================================*/
#include "CMakeSetupDialog.h" #include "CMakeSetupDialog.h"
#include <QFileDialog> #include <QFileDialog>
#include <QProgressBar> #include <QProgressBar>
#include <QMessageBox> #include <QMessageBox>
@ -177,7 +176,7 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->CMakeThread->cmakeInstance(), QObject::connect(this->CMakeThread->cmakeInstance(),
SIGNAL(outputMessage(QString)), SIGNAL(outputMessage(QString)),
this->Output, SLOT(append(QString))); this, SLOT(message(QString)));
QObject::connect(this->Advanced, SIGNAL(clicked(bool)), QObject::connect(this->Advanced, SIGNAL(clicked(bool)),
this->CacheValues, SLOT(setShowAdvanced(bool))); this->CacheValues, SLOT(setShowAdvanced(bool)));
@ -467,10 +466,27 @@ void CMakeSetupDialog::error(const QString& message)
QStringList messages = message.split('\n'); QStringList messages = message.split('\n');
foreach(QString m, messages) foreach(QString m, messages)
{ {
// make sure we escape html tags in the cmake messages
m.replace(QString("&"), QString("&amp;"));
m.replace(QString("<"), QString("&lt;"));
m.replace(QString(">"), QString("&gt;"));
this->Output->append(QString("<b><font color=red>%1</font></b>").arg(m)); this->Output->append(QString("<b><font color=red>%1</font></b>").arg(m));
} }
} }
void CMakeSetupDialog::message(const QString& message)
{
QStringList messages = message.split('\n');
foreach(QString m, messages)
{
// make sure we escape html tags in the cmake messages
m.replace(QString("&"), QString("&amp;"));
m.replace(QString("<"), QString("&lt;"));
m.replace(QString(">"), QString("&gt;"));
this->Output->append(m);
}
}
void CMakeSetupDialog::setEnabledState(bool enabled) void CMakeSetupDialog::setEnabledState(bool enabled)
{ {
// disable parts of the GUI during configure/generate // disable parts of the GUI during configure/generate

View File

@ -50,6 +50,7 @@ protected slots:
void finishConfigure(int error); void finishConfigure(int error);
void finishGenerate(int error); void finishGenerate(int error);
void error(const QString& message); void error(const QString& message);
void message(const QString& message);
void doSourceBrowse(); void doSourceBrowse();
void doBinaryBrowse(); void doBinaryBrowse();