Handle conversion to text in Sysinfo::getInfo().
When saving the system info from the progresslogger it shouldn't have knowledge
about the format of the data provided by getInfo(). Instead of relying on the
output being HTML formatted make getInfo() accept a parameter that indicates if
the data is to be formatted as HTML or text.
Change-Id: I733fe1a148e51b70ea1361d8feccffd7cbccd3d7
diff --git a/rbutil/rbutilqt/progressloggergui.cpp b/rbutil/rbutilqt/progressloggergui.cpp
index 41df060..71485b0 100644
--- a/rbutil/rbutilqt/progressloggergui.cpp
+++ b/rbutil/rbutilqt/progressloggergui.cpp
@@ -175,8 +175,7 @@
"*********************************************\n";
file.write(info.toUtf8(), info.size());
- info = Sysinfo::getInfo();
- info.replace(QRegExp("(<[^>]+>)+"),"\n");
+ info = Sysinfo::getInfo(Sysinfo::InfoText);
file.write(info.toUtf8(), info.size());
// trace
diff --git a/rbutil/rbutilqt/sysinfo.cpp b/rbutil/rbutilqt/sysinfo.cpp
index 3de3877..0bb5465 100644
--- a/rbutil/rbutilqt/sysinfo.cpp
+++ b/rbutil/rbutilqt/sysinfo.cpp
@@ -39,7 +39,7 @@
ui.textBrowser->setHtml(getInfo());
}
-QString Sysinfo::getInfo()
+QString Sysinfo::getInfo(Sysinfo::InfoType type)
{
QString info;
info += tr("<b>OS</b><br/>") + System::osVersionString() + "<hr/>";
@@ -76,6 +76,9 @@
}
info += "</table>";
info += "<hr/>";
+ if(type == InfoText) {
+ info.replace(QRegExp("(<[^>]+>)+"),"\n");
+ }
return info;
}
diff --git a/rbutil/rbutilqt/sysinfo.h b/rbutil/rbutilqt/sysinfo.h
index 45928a8..e2b3675 100644
--- a/rbutil/rbutilqt/sysinfo.h
+++ b/rbutil/rbutilqt/sysinfo.h
@@ -30,9 +30,13 @@
Q_OBJECT
public:
+ enum InfoType {
+ InfoHtml,
+ InfoText,
+ };
Sysinfo(QWidget *parent = 0);
- static QString getInfo();
+ static QString getInfo(InfoType type = InfoHtml);
private:
void changeEvent(QEvent *event);
Ui::SysinfoFrm ui;