Revise Statistics page heading to use less space. Reformat and correct errors in HTML strings.

This commit is contained in:
Seeker4 2019-05-22 13:49:28 -07:00
parent a433b29af1
commit 4697f84ea9
2 changed files with 50 additions and 39 deletions

View File

@ -575,10 +575,7 @@ Statistics::Statistics(QObject *parent) :
} }
const QString table_width = "width=99%"; QString Statistics::getUserInfo () {
QString Statistics::htmlHeader(bool showheader)
{
QString address = p_profile->user->address(); QString address = p_profile->user->address();
address.replace("\n", "<br/>"); address.replace("\n", "<br/>");
@ -600,53 +597,66 @@ QString Statistics::htmlHeader(bool showheader)
} }
} }
return userinfo;
}
const QString table_width = "width=99%";
QString Statistics::htmlHeader(bool showheader)
{
QString html = QString("<html><head>")+ QString html = QString("<html><head>")+
"</head>"
"<style type='text/css'>" "<style type='text/css'>"
"p,a,td,body { font-family: '"+QApplication::font().family()+"'; }" "p,a,td,body { font-family: '"+QApplication::font().family()+"'; }"
"p,a,td,body { font-size: "+QString::number(QApplication::font().pointSize() + 2)+"px; }" "p,a,td,body { font-size: "+QString::number(QApplication::font().pointSize() + 2)+"px; }"
"table.curved {" "table.curved {"
"border: 1px solid gray;" "border: 1px solid gray;"
"border-radius:10px;" "border-radius:10px;"
"-moz-border-radius:10px;" "-moz-border-radius:10px;"
"-webkit-border-radius:10px;" "-webkit-border-radius:10px;"
"page-break-after:auto;" "page-break-after:auto;"
"-fs-table-paginate: paginate;" "-fs-table-paginate: paginate;"
"}" "}"
"tr.datarow:nth-child(even) {"
"background-color: #f8f8f8;"
"}"
"table { page-break-after:auto; -fs-table-paginate: paginate; }"
"tr { page-break-inside:avoid; page-break-after:auto }"
"td { page-break-inside:avoid; page-break-after:auto }"
"thead { display:table-header-group; }"
"tfoot { display:table-footer-group; }"
"tr.datarow:nth-child(even) {"
"background-color: #f8f8f8;"
"}"
"table { page-break-after:auto; -fs-table-paginate: paginate; }"
"tr { page-break-inside:avoid; page-break-after:auto; }"
"td { page-break-inside:avoid; page-break-after:auto; }"
"thead { display:table-header-group; }"
"tfoot { display:table-footer-group; }"
"</style>" "</style>"
"<link rel='stylesheet' type='text/css' href='qrc:/docs/tooltips.css' />" "<link rel='stylesheet' type='text/css' href='qrc:/docs/tooltips.css' />"
"<script type='text/javascript'>" "<script type='text/javascript'>"
"function ChangeColor(tableRow, highLight)" "function ChangeColor(tableRow, highLight)"
"{ tableRow.style.backgroundColor = highLight; }" "{ tableRow.style.backgroundColor = highLight; }"
"function Go(url) { throw(url); }" "function Go(url) { throw(url); }"
"</script>" "</script>"
"</head>" "</head>"
"<body leftmargin=0 topmargin=5 rightmargin=0>"; "<body leftmargin=0 topmargin=5 rightmargin=0>";
QPixmap logoPixmap(":/icons/logo-md.png"); QPixmap logoPixmap(":/icons/logo-lg.png");
if (showheader) { if (showheader) {
html += "<div align=center>" html += "<div align=center><table class=curved width='99%'>"
+resizeHTMLPixmap(logoPixmap,64,64)+"<br/>" "<tr>"
"<font size='+3'>" + STR_TR_OSCAR + "</font><br/>" "<td align='left' valign='middle'>" + getUserInfo() + "</td>"
"<font size='+2'>" + tr("Usage Statistics") + "</font><br/>"; "<td align='right' valign='middle' width='150'>"
// "<font size='+1' title=\"" + "<font size='+2'>" + STR_TR_OSCAR + "&nbsp;&nbsp;&nbsp;</font><br/>"
// tr("For legal reasons without manufacturer documentation, OSCAR is unsuitable as a compliance/medical reporting tool.") + "<font size='+1'>" + QObject::tr("Usage Statistics") + "&nbsp;&nbsp;&nbsp;</font>"
// "\">" + tr("(NOT approved for compliance or medical reporting purposes)")+"</font><br/>"; "</td>"
if (!userinfo.isEmpty()) "<td align='right' valign='middle' width='150'>" + resizeHTMLPixmap(logoPixmap,120,120)+"&nbsp;&nbsp;&nbsp;<br/>"
html += "<br/>"+userinfo; "</td>"
html += "</div><br/>"; "</tr>"
} "</table>"
"</div><br/>";
}
return html; return html;
} }
QString Statistics::htmlFooter(bool showinfo) QString Statistics::htmlFooter(bool showinfo)
@ -654,7 +664,7 @@ QString Statistics::htmlFooter(bool showinfo)
QString html; QString html;
if (showinfo) { if (showinfo) {
html += "<hr/><div align=center><font size='-1'><i>"; html += "<hr><div align=center><font size='-1'><i>";
html += tr("This report was generated by OSCAR v%1").arg(ShortVersionString) + "<br/>" html += tr("This report was generated by OSCAR v%1").arg(ShortVersionString) + "<br/>"
+tr("OSCAR is free open-source CPAP report software"); +tr("OSCAR is free open-source CPAP report software");
html += "</i></font></div>"; html += "</i></font></div>";

View File

@ -156,6 +156,7 @@ class Statistics : public QObject
void saveRXChanges(); void saveRXChanges();
void updateRXChanges(); void updateRXChanges();
QString getUserInfo();
QString GenerateHTML(); QString GenerateHTML();
QString GenerateMachineList(); QString GenerateMachineList();
QString GenerateRXChanges(); QString GenerateRXChanges();