Re: [PATCH 4/4] kernel-shark: Use <br> for dialog and \n for console error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 10.07.19 г. 16:46 ч., Steven Rostedt wrote:
From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

The Qt dialog boxes require '<br>' to print a new line but consoles require
a '\n'. Instead of printing '<br>' to the console or '\n' to the dialog,
always have the '\n' turn into '<br>' for the dialog and all '<br>' turn
into '\n' for the console.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
  kernel-shark/src/KsMainWindow.cpp | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 54aa6d782ad1..29d44d9a9230 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -1028,10 +1028,12 @@ void KsMainWindow::loadDataFile(const QString& fileName)
  	}
  }
-void KsMainWindow::_error(const QString &text, const QString &errCode,
+void KsMainWindow::_error(const QString &mesg, const QString &errCode,
  			  bool resize, bool unloadPlugins)
  {
  	QErrorMessage *em = new QErrorMessage(this);
+	QString text = mesg;
+	QString html = mesg;
if (resize)
  		_resizeEmpty();
@@ -1039,8 +1041,11 @@ void KsMainWindow::_error(const QString &text, const QString &errCode,
  	if (unloadPlugins)
  		_plugins.unloadAll();
+ text.replace("<br>", "\n", Qt::CaseInsensitive);
+	html.replace("\n", "<br>", Qt::CaseInsensitive);
+
  	qCritical().noquote() << "ERROR: " << text;
-	em->showMessage(text, errCode);
+	em->showMessage(html, errCode);
  	em->exec();
  }

All patches look good to me.
Thanks!
Yordan

Reviewed-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx>





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux