Skip to content

Commit

Permalink
Copy the simulation output without HTML formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Dec 5, 2018
1 parent 3ab3f3d commit 6abfbe4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
6 changes: 5 additions & 1 deletion OMEdit/OMEditGUI/Simulation/SimulationOutputHandler.cpp
Expand Up @@ -336,7 +336,11 @@ bool SimulationOutputHandler::startElement(const QString &namespaceURI, const QS
if (atts.value("text").compare("The embedded server is initialized.") == 0) {
mpSimulationOutputWidget->embeddedServerInitialized();
}
mpSimulationMessage->mText = Qt::convertFromPlainText(atts.value("text"));
if (mpSimulationOutputWidget->isOutputStructured()) {
mpSimulationMessage->mText = Qt::convertFromPlainText(atts.value("text"));
} else {
mpSimulationMessage->mText = atts.value("text");
}
mpSimulationMessage->mLevel = mLevel;
mSimulationMessagesLevelMap.insert(mLevel, mpSimulationMessage);
if (mLevel > 0) {
Expand Down
21 changes: 11 additions & 10 deletions OMEdit/OMEditGUI/Simulation/SimulationOutputWidget.cpp
Expand Up @@ -157,10 +157,12 @@ void SimulationOutputTree::copyMessages()
foreach (QModelIndex modelIndex, modelIndexes) {
SimulationMessage *pSimulationMessage = static_cast<SimulationMessage*>(modelIndex.internalPointer());
if (pSimulationMessage) {
textToCopy.append(QString("%1 | %2 | %3")
.arg(pSimulationMessage->mStream)
.arg(StringHandler::getSimulationMessageTypeString(pSimulationMessage->mType))
.arg(pSimulationMessage->mText));
/* Ticket:4778 Remove HTML formatting. */
// textToCopy.append(QString("%1 | %2 | %3")
// .arg(pSimulationMessage->mStream)
// .arg(StringHandler::getSimulationMessageTypeString(pSimulationMessage->mType))
// .arg(pSimulationMessage->mText));
textToCopy.append(QString(pSimulationMessage->mText).remove("<p>").remove("</p>"));
}
}
QApplication::clipboard()->setText(textToCopy.join("\n"));
Expand Down Expand Up @@ -622,15 +624,14 @@ void SimulationOutputWidget::simulationProcessStarted()
*/
void SimulationOutputWidget::writeSimulationOutput(QString output, StringHandler::SimulationMessageType type, bool textFormat)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QString escaped = QString(output).toHtmlEscaped();
#else /* Qt4 */
QString escaped = Qt::escape(output);
#endif

mpGeneratedFilesTabWidget->setTabEnabled(0, true);
if (isOutputStructured()) {
if (textFormat) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
QString escaped = QString(output).toHtmlEscaped();
#else /* Qt4 */
QString escaped = Qt::escape(output);
#endif
output = QString("<message stream=\"stdout\" type=\"%1\" text=\"%2\" />")
.arg(StringHandler::getSimulationMessageTypeString(type))
.arg(escaped);
Expand Down

0 comments on commit 6abfbe4

Please sign in to comment.