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::htmlHeader(bool showheader)
{
QString Statistics::getUserInfo () {
QString address = p_profile->user->address();
address.replace("\n", "<br/>");
@ -600,9 +597,14 @@ QString Statistics::htmlHeader(bool showheader)
}
}
return userinfo;
}
const QString table_width = "width=99%";
QString Statistics::htmlHeader(bool showheader)
{
QString html = QString("<html><head>")+
"</head>"
"<style type='text/css'>"
"p,a,td,body { font-family: '"+QApplication::font().family()+"'; }"
"p,a,td,body { font-size: "+QString::number(QApplication::font().pointSize() + 2)+"px; }"
@ -615,37 +617,45 @@ QString Statistics::htmlHeader(bool showheader)
"page-break-after:auto;"
"-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 }"
"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>"
"<link rel='stylesheet' type='text/css' href='qrc:/docs/tooltips.css' />"
"<script type='text/javascript'>"
"function ChangeColor(tableRow, highLight)"
"{ tableRow.style.backgroundColor = highLight; }"
"function Go(url) { throw(url); }"
"</script>"
"</head>"
"<body leftmargin=0 topmargin=5 rightmargin=0>";
QPixmap logoPixmap(":/icons/logo-md.png");
QPixmap logoPixmap(":/icons/logo-lg.png");
if (showheader) {
html += "<div align=center>"
+resizeHTMLPixmap(logoPixmap,64,64)+"<br/>"
"<font size='+3'>" + STR_TR_OSCAR + "</font><br/>"
"<font size='+2'>" + tr("Usage Statistics") + "</font><br/>";
// "<font size='+1' title=\"" +
// tr("For legal reasons without manufacturer documentation, OSCAR is unsuitable as a compliance/medical reporting tool.") +
// "\">" + tr("(NOT approved for compliance or medical reporting purposes)")+"</font><br/>";
if (!userinfo.isEmpty())
html += "<br/>"+userinfo;
html += "</div><br/>";
html += "<div align=center><table class=curved width='99%'>"
"<tr>"
"<td align='left' valign='middle'>" + getUserInfo() + "</td>"
"<td align='right' valign='middle' width='150'>"
"<font size='+2'>" + STR_TR_OSCAR + "&nbsp;&nbsp;&nbsp;</font><br/>"
"<font size='+1'>" + QObject::tr("Usage Statistics") + "&nbsp;&nbsp;&nbsp;</font>"
"</td>"
"<td align='right' valign='middle' width='150'>" + resizeHTMLPixmap(logoPixmap,120,120)+"&nbsp;&nbsp;&nbsp;<br/>"
"</td>"
"</tr>"
"</table>"
"</div><br/>";
}
return html;
}
@ -654,7 +664,7 @@ QString Statistics::htmlFooter(bool showinfo)
QString html;
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/>"
+tr("OSCAR is free open-source CPAP report software");
html += "</i></font></div>";

View File

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