diff --git a/sleepyhead/daily.h b/sleepyhead/daily.h index 43aa3d71..82610ea2 100644 --- a/sleepyhead/daily.h +++ b/sleepyhead/daily.h @@ -28,6 +28,7 @@ #include "Graphs/gGraphView.h" #include "Graphs/gLineChart.h" #include "sessionbar.h" +#include "mytextbrowser.h" namespace Ui { class Daily; @@ -36,15 +37,6 @@ namespace Ui { class MainWindow; -class MyTextBrowser:public QTextBrowser -{ - Q_OBJECT -public: - MyTextBrowser(QWidget * parent):QTextBrowser(parent) {} - virtual ~MyTextBrowser() {} - virtual QVariant loadResource(int type, const QUrl &url) Q_DECL_OVERRIDE; -}; - /*! \class Daily \brief SleepyHead's Daily view which displays the calendar and all the graphs relative to a selected Day */ diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 15c91a89..ff64b909 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -431,7 +431,7 @@ void MainWindow::OpenProfile(QString profileName) for (QList::iterator it = machines.begin(); it != machines.end(); ++it) { QString mclass=(*it)->loaderName(); if (mclass == STR_MACH_ResMed) { - qDebug() << "ResMed machine found.. dumbing down SleepyHead to suit it's dodgy summary system"; + qDebug() << "ResMed machine found.. locking SleepyHead preferences to suit it's summary system"; // Have to sacrifice these features to get access to summary data. p_profile->session->setCombineCloseSessions(0); @@ -1383,16 +1383,43 @@ void MainWindow::on_actionPrint_Report_triggered() printer.setOutputFileName(filename); #endif printer.setPrintRange(QPrinter::AllPages); - printer.setOrientation(QPrinter::Portrait); +// if (ui->tabWidget->currentWidget() == ui->statisticsTab) { +// printer.setOrientation(QPrinter::Landscape); +// } else { + printer.setOrientation(QPrinter::Portrait); + //} printer.setFullPage(false); // This has nothing to do with scaling printer.setNumCopies(1); + printer.setResolution(1200); + //printer.setPaperSize(QPrinter::A4); + //printer.setOutputFormat(QPrinter::PdfFormat); printer.setPageMargins(5, 5, 5, 5, QPrinter::Millimeter); QPrintDialog pdlg(&printer, this); if (pdlg.exec() == QPrintDialog::Accepted) { if (ui->tabWidget->currentWidget() == ui->statisticsTab) { - ui->statisticsView->print(&printer); + + QTextBrowser b; + QPainter painter; + painter.begin(&printer); + + QRect rect = printer.pageRect(); + b.setHtml(ui->statisticsView->toHtml()); + b.resize(rect.width()/4, rect.height()/4); + + double xscale = printer.pageRect().width()/double(b.width()); + double yscale = printer.pageRect().height()/double(b.height()); + double scale = qMin(xscale, yscale); + painter.translate(printer.paperRect().x() + printer.pageRect().width()/2, printer.paperRect().y() + printer.pageRect().height()/2); + painter.scale(scale, scale); + painter.translate(-b.width()/2, -b.height()/2); + //painter.translate(-printer.pageRect().width()/2, -printer.pageRect().height()/2); + + b.render(&painter, QPoint(0,0)); + painter.end(); + + } else if (ui->tabWidget->currentWidget() == ui->helpTab) { ui->helpBrowser->print(&printer); } diff --git a/sleepyhead/mainwindow.ui b/sleepyhead/mainwindow.ui index 03845ce2..87350c36 100644 --- a/sleepyhead/mainwindow.ui +++ b/sleepyhead/mainwindow.ui @@ -958,7 +958,7 @@ 0 - + @@ -3403,6 +3403,13 @@ p, li { white-space: pre-wrap; } + + + MyTextBrowser + QTextBrowser +
mytextbrowser.h
+
+
diff --git a/sleepyhead/mytextbrowser.h b/sleepyhead/mytextbrowser.h new file mode 100644 index 00000000..296e67a2 --- /dev/null +++ b/sleepyhead/mytextbrowser.h @@ -0,0 +1,16 @@ +#ifndef MYTEXTBROWSER_H +#define MYTEXTBROWSER_H + +#include + +class MyTextBrowser:public QTextBrowser +{ + Q_OBJECT +public: + MyTextBrowser(QWidget * parent):QTextBrowser(parent) {} + virtual ~MyTextBrowser() {} + virtual QVariant loadResource(int type, const QUrl &url) Q_DECL_OVERRIDE; +}; + + +#endif // MYTEXTBROWSER_H diff --git a/sleepyhead/sleepyhead.pro b/sleepyhead/sleepyhead.pro index da8e584e..b6190339 100644 --- a/sleepyhead/sleepyhead.pro +++ b/sleepyhead/sleepyhead.pro @@ -230,7 +230,8 @@ HEADERS += \ SleepLib/appsettings.h \ SleepLib/loader_plugins/edfparser.h \ aboutdialog.h \ - welcome.h + welcome.h \ + mytextbrowser.h FORMS += \ daily.ui \ diff --git a/sleepyhead/statistics.cpp b/sleepyhead/statistics.cpp index 45145d6e..0f1222ee 100644 --- a/sleepyhead/statistics.cpp +++ b/sleepyhead/statistics.cpp @@ -639,7 +639,7 @@ QString htmlHeader(bool showheader) +resizeHTMLPixmap(bobPixmap,64,64)+"
" "" + STR_TR_SleepyHead + "
" "" + QObject::tr("Usage Statistics") + "
" - "" + QObject::tr("(NOT approved for compliance reporting purposes)")+"
"; + "" + QObject::tr("(NOT approved for compliance or medical reporting purposes)")+"
"; if (!userinfo.isEmpty()) html += "
"+userinfo+"
"; html += "
"; @@ -756,190 +756,6 @@ struct RXChange { short highlight; }; -//enum RXSortMode { RX_first, RX_last, RX_days, RX_ahi, RX_mode, RX_min, RX_max, RX_ps, RX_pshi, RX_maxipap, RX_per1, RX_per2, RX_weighted }; -//RXSortMode RXsort = RX_first; -//bool RXorder = false; - -/*bool operator<(const RXChange &c1, const RXChange &c2) -{ - const RXChange *comp1 = &c1; - const RXChange *comp2 = &c2; - - if (RXorder) { - switch (RXsort) { - case RX_ahi: - return comp1->ahi < comp2->ahi; - - case RX_days: - return comp1->days < comp2->days; - - case RX_first: - return comp1->first < comp2->first; - - case RX_last: - return comp1->last < comp2->last; - - case RX_mode: - return comp1->mode < comp2->mode; - - case RX_min: - return comp1->min < comp2->min; - - case RX_max: - return comp1->max < comp2->max; - - case RX_ps: - return comp1->ps < comp2->ps; - - case RX_pshi: - return comp1->pshi < comp2->pshi; - - case RX_maxipap: - return comp1->maxipap < comp2->maxipap; - - case RX_per1: - return comp1->per1 < comp2->per1; - - case RX_per2: - return comp1->per2 < comp2->per2; - - case RX_weighted: - return comp1->weighted < comp2->weighted; - }; - } else { - switch (RXsort) { - case RX_ahi: - return comp1->ahi > comp2->ahi; - - case RX_days: - return comp1->days > comp2->days; - - case RX_first: - return comp1->first > comp2->first; - - case RX_last: - return comp1->last > comp2->last; - - case RX_mode: - return comp1->mode > comp2->mode; - - case RX_min: - return comp1->min > comp2->min; - - case RX_max: - return comp1->max > comp2->max; - - case RX_ps: - return comp1->ps > comp2->ps; - - case RX_pshi: - return comp1->pshi > comp2->pshi; - - case RX_maxipap: - return comp1->maxipap > comp2->maxipap; - - case RX_per1: - return comp1->per1 > comp2->per1; - - case RX_per2: - return comp1->per2 > comp2->per2; - - case RX_weighted: - return comp1->weighted > comp2->weighted; - }; - } - - return true; -} - -bool RXSort(const RXChange *comp1, const RXChange *comp2) -{ - if (RXorder) { - switch (RXsort) { - case RX_ahi: - return comp1->ahi < comp2->ahi; - - case RX_days: - return comp1->days < comp2->days; - - case RX_first: - return comp1->first < comp2->first; - - case RX_last: - return comp1->last < comp2->last; - - case RX_mode: - return comp1->mode < comp2->mode; - - case RX_min: - return comp1->min < comp2->min; - - case RX_max: - return comp1->max < comp2->max; - - case RX_ps: - return comp1->ps < comp2->ps; - - case RX_pshi: - return comp1->pshi < comp2->pshi; - - case RX_maxipap: - return comp1->maxipap < comp2->maxipap; - - case RX_per1: - return comp1->per1 < comp2->per1; - - case RX_per2: - return comp1->per2 < comp2->per2; - - case RX_weighted: - return comp1->weighted < comp2->weighted; - }; - } else { - switch (RXsort) { - case RX_ahi: - return comp1->ahi > comp2->ahi; - - case RX_days: - return comp1->days > comp2->days; - - case RX_first: - return comp1->first > comp2->first; - - case RX_last: - return comp1->last > comp2->last; - - case RX_mode: - return comp1->mode > comp2->mode; - - case RX_min: - return comp1->min > comp2->min; - - case RX_max: - return comp1->max > comp2->max; - - case RX_ps: - return comp1->ps > comp2->ps; - - case RX_pshi: - return comp1->pshi > comp2->pshi; - - case RX_maxipap: - return comp1->maxipap > comp2->maxipap; - - case RX_per1: - return comp1->per1 > comp2->per1; - - case RX_per2: - return comp1->per2 > comp2->per2; - - case RX_weighted: - return comp1->weighted > comp2->weighted; - }; - } - - return true; -} */ struct UsageData { UsageData() { ahi = 0; hours = 0; } UsageData(QDate d, EventDataType v, EventDataType h) { date = d; ahi = v; hours = h; } @@ -957,7 +773,6 @@ bool operator <(const UsageData &c1, const UsageData &c2) if ((c1.ahi == c2.ahi) && (c1.date > c2.date)) { return true; } return false; - //return c1.value < c2.value; } struct Period { @@ -1052,9 +867,9 @@ QString Statistics::GenerateRXChanges() QString html = "

"; - html += QString(""); + html += QString("
"); html += ""; - html += ""; + html += ""; // QString extratxt; @@ -1359,507 +1174,7 @@ QString Statistics::GenerateHTML() html += "
" + tr("Changes to Prescription Settings") + "
" + tr("Changes to Prescription Settings") + "
"; html += "
"; - /* - QList AHI; - if (cpapdays > 0) { - QDate first, last = lastcpap; - CPAPMode mode = MODE_UNKNOWN, cmode = MODE_UNKNOWN; - EventDataType cmin = 0, cmax = 0, cps = 0, cpshi = 0, cmaxipap = 0, min = 0, max = 0, maxipap = 0, - ps = 0, pshi = 0; - Machine *mach = nullptr, *lastmach = nullptr; - QString last_prel_str, last_pressure_str, prel_str, pressure_str; - QDate date = lastcpap; - Day *day; - bool lastchanged = false; - QVector rxchange; - EventDataType hours; - - int compliant = 0; - - do { - day = p_profile->GetGoodDay(date, MT_CPAP); - - - CPAPLoader * loader = nullptr; - - if (day) loader = dynamic_cast(day->machine(MT_CPAP)->loader()); - - if (day && loader) { - lastchanged = false; - - hours = day->hours(MT_CPAP); - - if (hours > p_profile->cpap->complianceHours()) { - compliant++; - } - - EventDataType ahi = day->count(CPAP_Obstructive) + day->count(CPAP_Hypopnea) + day->count(CPAP_Apnea) + day->count(CPAP_ClearAirway); - - if (p_profile->general->calculateRDI()) { ahi += day->count(CPAP_RERA); } - - ahi /= hours; - AHI.push_back(UsageData(date, ahi, hours)); - - prel_str = day->getPressureRelief(); - pressure_str = day->getPressureSettings(); - - mode = (CPAPMode)(int)round(day->settings_wavg(CPAP_Mode)); - if (mode ==0) { - mode = (CPAPMode)(int)round(day->settings_wavg(CPAP_Mode)); - } - mach = day->machine(MT_CPAP); - - min = max = ps = pshi = maxipap = 0; - - if (mode == MODE_CPAP) { - min = day->settings_min(CPAP_Pressure); - } else if (mode == MODE_APAP) { - min = day->settings_min(CPAP_PressureMin); - max = day->settings_max(CPAP_PressureMax); - } else if (mode == MODE_BILEVEL_FIXED) { - min = day->settings_min(CPAP_EPAP); - max = day->settings_max(CPAP_IPAP); - ps = max-min; - } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { - min = day->settings_min(CPAP_EPAPLo); - maxipap = max = day->settings_max(CPAP_IPAPHi); - ps = day->settings_min(CPAP_PS); - } else if (mode == MODE_BILEVEL_AUTO_VARIABLE_PS) { // Similar pressure control as ASV Variable EPAP - min = day->settings_min(CPAP_EPAPLo); - max = day->settings_min(CPAP_EPAPHi); - ps = day->settings_min(CPAP_PSMin); - pshi = day->settings_max(CPAP_PSMax); - maxipap = max = day->settings_max(CPAP_IPAPHi); - } else if (mode == MODE_ASV) { - min = day->settings_min(CPAP_EPAP); - ps = day->settings_min(CPAP_PSMin); - pshi = day->settings_max(CPAP_PSMax); - maxipap = min+pshi; - } else if (mode == MODE_ASV_VARIABLE_EPAP) { - min = day->settings_min(CPAP_EPAPLo); - max = day->settings_max(CPAP_EPAPHi); - ps = day->settings_min(CPAP_PSMin); - pshi = day->settings_max(CPAP_PSMax); - maxipap = max + pshi; - - } - - if (lastmach == nullptr) { - lastmach = mach; - cmode = mode; - last_pressure_str = pressure_str; - last_prel_str = prel_str; - - } - - if ((mode != cmode) || (pressure_str != last_pressure_str) || (prel_str != last_prel_str) || (mach != lastmach)) { - first = date.addDays(1); - int days = p_profile->countDays(MT_CPAP, first, last); - RXChange rx; - rx.first = first; - rx.last = last; - rx.days = days; - rx.ahi = calcAHI(first, last); - rx.fl = calcFL(first, last); - rx.mode = cmode; - rx.pressure_string = last_pressure_str; - rx.pr_relief_string = last_prel_str; - rx.min = cmin; - rx.max = cmax; - rx.ps = cps; - rx.pshi = cpshi; - rx.maxipap = cmaxipap; - rx.machine = lastmach; - rx.per1 = 0; - rx.per2 = 0; - - if (mode == MODE_APAP) { - rx.per1 = p_profile->calcPercentile(CPAP_Pressure, percentile, MT_CPAP, first, last); - rx.per2 = 0; - } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { - rx.per1 = p_profile->calcPercentile(CPAP_EPAP, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_IPAP, percentile, MT_CPAP, first, last); - } else if (mode == MODE_BILEVEL_AUTO_VARIABLE_PS) { - rx.per1 = p_profile->calcPercentile(CPAP_EPAP, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - } else if (mode == MODE_ASV) { - rx.per1 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - } else if (mode == MODE_ASV_VARIABLE_EPAP) { - rx.per1 = p_profile->calcPercentile(CPAP_EPAP, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - } - - rx.weighted = float(rx.days) / float(cpapdays) * rx.ahi; - rxchange.push_back(rx); - - cmode = mode; - cmin = min; - cmax = max; - cps = ps; - cpshi = pshi; - cmaxipap = maxipap; - last_prel_str = prel_str; - last_pressure_str = pressure_str; - last = date; - lastmach = mach; - lastchanged = true; - } - - } - - date = date.addDays(-1); - } while (date >= firstcpap); - - // Sort list by AHI - qSort(AHI); - - lastchanged = false; - - // Add the final entry - if (!lastchanged && (mach != nullptr)) { - // last=date.addDays(1); - first = firstcpap; - int days = p_profile->countDays(MT_CPAP, first, last); - RXChange rx; - rx.first = first; - rx.last = last; - rx.days = days; - rx.ahi = calcAHI(first, last); - rx.fl = calcFL(first, last); - rx.mode = mode; - rx.min = min; - rx.max = max; - rx.ps = ps; - rx.pshi = pshi; - rx.maxipap = maxipap; - rx.machine = mach; - rx.pressure_string = pressure_str; - rx.pr_relief_string = prel_str; - - // Todo: Clean up by Calculating this crap later.. - if (mode == MODE_APAP) { - rx.per1 = p_profile->calcPercentile(CPAP_Pressure, percentile, MT_CPAP, first, last); - rx.per2 = 0; - } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { - rx.per1 = p_profile->calcPercentile(CPAP_EPAP, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_IPAP, percentile, MT_CPAP, first, last); - } else if (mode == MODE_BILEVEL_AUTO_VARIABLE_PS) { - rx.per1 = p_profile->calcPercentile(CPAP_EPAP, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - } else if (mode == MODE_ASV) { - rx.per1 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - } else if (mode == MODE_ASV_VARIABLE_EPAP) { - rx.per1 = p_profile->calcPercentile(CPAP_EPAP, percentile, MT_CPAP, first, last); - rx.per2 = p_profile->calcPercentile(CPAP_PS, percentile, MT_CPAP, first, last); - } - - rx.weighted = float(rx.days) / float(cpapdays); - //rx.weighted=float(days)*rx.ahi; - rxchange.push_back(rx); - } - - int rxthresh = 5; - QVector tmpRX; - - for (int i = 0; i < rxchange.size(); i++) { - RXChange &rx = rxchange[i]; - - if (rx.days >= rxthresh) { - tmpRX.push_back(&rx); - } - } - - QString recbox = ""; - recbox += ""; - int numdays = AHI.size(); - - if (numdays > 1) { - int z = numdays / 2; - - if (z > 4) { z = 4; } - - recbox += QString("").arg( - tr("Usage Information")); - recbox += QString("").arg(tr("Total Days")).arg( - numdays); - - if (p_profile->cpap->showComplianceInfo()) { - recbox += QString("").arg(tr("Compliant Days")).arg( - compliant); - } - - int highahi = 0; - - for (int i = 0; i < numdays; i++) { - if (AHI.at(i).ahi > 5.0) { - highahi++; - } - } - - recbox += QString("").arg(tr("Days AHI >5.0")).arg( - highahi); - - - recbox += QString(""); - recbox += QString("").arg(tr("Best %1").arg( - ahitxt)); - - for (int i = 0; i < z; i++) { - const UsageData &a = AHI.at(i); - recbox += QString("") - .arg(a.date.toString(Qt::ISODate)) - .arg(a.date.toString(Qt::SystemLocaleShortDate)) - .arg(a.ahi, 0, 'f', decimals); - } - - recbox += QString(""); - recbox += QString("").arg( - tr("Worst %1").arg(ahitxt)); - - for (int i = 0; i < z; i++) { - const UsageData &a = AHI.at((numdays - 1) - i); - recbox += QString("") - .arg(a.date.toString(Qt::ISODate)) - .arg(a.date.toString(Qt::SystemLocaleShortDate)) - .arg(a.ahi, 0, 'f', decimals); - } - - recbox += QString(""); - } - - - if (tmpRX.size() > 0) { - RXsort = RX_ahi; - qSort(tmpRX.begin(), tmpRX.end(), RXSort); - tmpRX[0]->highlight = 4; // worst - int ls = tmpRX.size() - 1; - tmpRX[ls]->highlight = 1; //best - QString modestr; - - QString idxstr[2]; - int idx[2]; - idx[0]=ls; - idx[1]=0; - idxstr[0]=tr("Best RX Setting"); - idxstr[1]=tr("Worst RX Setting"); - - for (int i=0; i<2; ++i ) { - int i2 = idx[i]; - if ((i==1) && (ls == 0)) break; - CPAPMode mode = (CPAPMode)(int)p_profile->calcSettingsMax(CPAP_Mode, MT_CPAP, tmpRX[i2]->first, tmpRX[i2]->last); - - if (mode == MODE_CPAP) { - modestr = STR_TR_CPAP; - } else if (mode == MODE_APAP) { // is AUTO? - modestr = STR_TR_APAP; - } else if (mode == MODE_BILEVEL_FIXED) { - modestr = STR_TR_BiLevel; - } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { - modestr = QObject::tr("Auto Bi-Level"); - } else if (mode == MODE_BILEVEL_AUTO_VARIABLE_PS) { - modestr = QObject::tr("Auto Bi-Level"); - } else if (mode == MODE_ASV) { - modestr = QObject::tr("ASV Fixed EPAP"); - } else if (mode == MODE_ASV_VARIABLE_EPAP) { - modestr = QObject::tr("ASV Auto EPAP"); - } else modestr = STR_TR_Unknown; - - - recbox += QString(""; - } - } - - recbox += "
%1
%1%2
%1%2
%1%2
 
%1
%2%3
 
%1
%2%3
 
") - .arg(idxstr[i]); - recbox += QString("") - .arg(tmpRX[i2]->first.toString(Qt::ISODate)) - .arg(tmpRX[i2]->last.toString(Qt::ISODate)) - .arg(tmpRX[i2]->first.toString(Qt::SystemLocaleShortDate)) - .arg(tmpRX[i2]->last.toString(Qt::SystemLocaleShortDate)); - recbox += QString("").arg(ahitxt).arg(tmpRX[i2]->ahi, 0, 'f', decimals); - recbox += QString("").arg(STR_TR_Mode).arg(modestr); - if (mode == MODE_CPAP) { - recbox += QString("").arg(tmpRX[i2]->min, 0, 'f', 1).arg(STR_UNIT_CMH2O); - } else if (mode == MODE_APAP) { - recbox += QString("").arg(tmpRX[i2]->min, 0, 'f', 1).arg(STR_UNIT_CMH2O); - recbox += QString("").arg(tmpRX[i2]->max, 0, 'f', 1).arg(STR_UNIT_CMH2O); - } else if (mode == MODE_BILEVEL_FIXED) { - recbox += QString("").arg(tmpRX[i2]->min, 0, 'f', 1).arg(STR_UNIT_CMH2O); - recbox += QString("").arg(tmpRX[i2]->max, 0, 'f', 1).arg(STR_UNIT_CMH2O); - } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { - recbox += QString("").arg(tmpRX[i2]->min, 0, 'f', 1).arg(STR_UNIT_CMH2O); - recbox += QString("").arg(tmpRX[i2]->max, 0, 'f', 1).arg(STR_UNIT_CMH2O); - recbox += QString("").arg(tmpRX[i2]->ps, 0, 'f', 1).arg(STR_UNIT_CMH2O); - } else if (mode == MODE_ASV) { - recbox += QString("").arg(tmpRX[i2]->min, 0, 'f', 1).arg(STR_UNIT_CMH2O); - recbox += QString("").arg(tmpRX[i2]->ps, 0, 'f', 1).arg(tmpRX[i2]->pshi, 0, 'f', 1).arg(STR_UNIT_CMH2O); -// recbox += QString("").arg(tmpRX[i2]->maxipap, 0, 'f', 1).arg(STR_UNIT_CMH2O); - } else if (mode == MODE_ASV_VARIABLE_EPAP) { - recbox += QString("").arg(tmpRX[i2]->min, 0, 'f', 1).arg(tmpRX[i2]->max, 0, 'f', 1).arg(STR_UNIT_CMH2O); - recbox += QString("").arg(tmpRX[i2]->ps, 0, 'f', 1).arg(tmpRX[i2]->pshi, 0, 'f', 1).arg(STR_UNIT_CMH2O); -// recbox += QString("").arg(tmpRX[i2]->maxipap, 0, 'f', 1).arg(STR_UNIT_CMH2O); - } - recbox += "
%3
") + STR_TR_Start + "
" + STR_TR_End + - QString("
%3
%4
%1%2
%1%2
")+QObject::tr("Fixed")+QString("%1%2
")+QObject::tr("Min")+QString("%1%2
")+QObject::tr("Max")+QString("%1%2
")+QObject::tr("EPAP")+QString("%1%2
")+QObject::tr("IPAP")+QString("%1%2
")+QObject::tr("Min EPAP")+QString("%1%2
")+QObject::tr("Max IPAP")+QString("%1%2
")+QObject::tr("PS")+QString("%1%2
")+QObject::tr("EPAP")+QString("%1%2
")+QObject::tr("PS")+QString("%1-%2%3
")+QObject::tr("Max IPAP")+QString("%1%2
")+QObject::tr("EPAP")+QString("%1-%2%3
")+QObject::tr("PS")+QString("%1-%2%3
")+QObject::tr("Max IPAP")+QString("%1%2

"; - recbox += ""; - mainwin->setRecBoxHTML(recbox); */ - - /*RXsort=RX_min; - RXorder=true; - qSort(rxchange.begin(),rxchange.end());*/ - - /* html += "

"; - html += QString(""); - html += ""; - html += ""; - - QString extratxt; - - QString tooltip; - QStringList hdrlist; - hdrlist.push_back(STR_TR_First); - hdrlist.push_back(STR_TR_Last); - hdrlist.push_back(tr("Days")); - hdrlist.push_back(ahitxt); - hdrlist.push_back(STR_TR_FL); - if (p_profile->hasChannel(CPAP_SensAwake)) { - hdrlist.push_back(STR_TR_SA); - } - hdrlist.push_back(STR_TR_Machine); - hdrlist.push_back(tr("Pressure Relief")); - hdrlist.push_back(STR_TR_Mode); - hdrlist.push_back(tr("Pressure Settings")); - - html+="\n"; - for (int i=0; i < hdrlist.size(); ++i) { - html+=QString(" \n").arg(hdrlist.at(i)); - } - html+="\n"; - html += ""; - html += ""; - html += ""; - html += ""; - - - for (int i = 0; i < rxchange.size(); i++) { - RXChange rx = rxchange.at(i); - QString color; - - if (rx.highlight == 1) { - color = "#c0ffc0"; - } else if (rx.highlight == 2) { - color = "#e0ffe0"; - } else if (rx.highlight == 3) { - color = "#ffe0e0"; - } else if (rx.highlight == 4) { - color = "#ffc0c0"; - } else { color = ""; } - - QString machstr; - - if (!rx.machine->brand().isEmpty()) { - machstr += rx.machine->brand(); - } - - if (!rx.machine->model().isEmpty()) { - machstr += " " + rx.machine->model(); - } - - if (!rx.machine->serial().isEmpty()) { - machstr += " (" + rx.machine->serial() + ")
"; - } - - mode = rx.mode; - extratxt = "
" + tr("Changes to Prescription Settings") + "
%1
"; - html += QString("") + - tr("Efficacy highlighting ignores prescription settings with less than %1 days of recorded data."). - arg(rxthresh) + QString("
"); - - html += "
"; //cellpadding=0 cellspacing=0 - - // tooltip=QString("%1 %2% ").arg(machstr).arg(percentile*100.0)+STR_TR_EPAP+ - // QString("=%1
%2% ").arg(rx.per1,0,'f',decimals).arg(percentile*100.0)+ - // STR_TR_IPAP+QString("=%1").arg(rx.per2,0,'f',decimals); - tooltip = QString("%1").arg(machstr); - - extratxt += ""; -// if (mode == MODE_CPAP) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()); -// } else if (mode == MODE_APAP) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(rx.max, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()); -// } else if (mode == MODE_BILEVEL_FIXED) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(rx.max, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()); -// } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(rx.max, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()).arg(rx.ps, 4, 'f', 1); -// } else if (mode == MODE_BILEVEL_AUTO_VARIABLE_PS) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(rx.max, 4, 'f', 1).arg(rx.ps, 4, 'f', 1).arg(rx.pshi, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()); -// } else if (mode == MODE_ASV) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(rx.ps, 4, 'f', 1).arg(rx.pshi, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()); -// tooltip = QString("%1 %2% ").arg(machstr).arg(percentile * 100.0) + -// STR_TR_EPAP + -// QString("=%1
%2% ").arg(rx.per1, 0, 'f', decimals) -// .arg(percentile * 100.0) -// + STR_TR_IPAP + QString("=%1").arg(rx.per2, 0, 'f', decimals); -// } else if (mode == MODE_ASV_VARIABLE_EPAP) { -// extratxt += "").arg(rx.min, 4, 'f', 1).arg(rx.max, 4, 'f', 1).arg(rx.ps, 4, 'f', 1).arg(rx.pshi, 4, 'f', 1).arg(schema::channel[CPAP_Pressure].units()); -// tooltip = QString("%1 %2% ").arg(machstr).arg(percentile * 100.0) + -// STR_TR_EPAP + -// QString("=%1
%2% ").arg(rx.per1, 0, 'f', decimals) -// .arg(percentile * 100.0) -// + STR_TR_IPAP + QString("=%1").arg(rx.per2, 0, 'f', decimals); -// } else { -// extratxt += ""; -// tooltip = ""; -// } - - extratxt += "
"+rx.pressure_string+""+QString(tr("Fixed %1 %2")+""+QString(tr("%1 - %2 %3")+""+QString(tr("EPAP %1 %3 IPAP %2 %3")+""+QString(tr("PS %4 over %1 - %2 %3")+""+QString(tr("EPAP %1-%2, PS %3-%4 %5")+""+QString(tr("EPAP %1, PS %2-%3 %4")+""+QString(tr("EPAP %1-%2, PS %3-%4 %5")+"
"; - - QString tooltipshow, tooltiphide; - - if (!tooltip.isEmpty()) { - tooltipshow = QString("tooltip.show(\"%1\");").arg(tooltip); - tooltiphide = "tooltip.hide();"; - } - - QString datarowclass; - if (rx.highlight == 0) datarowclass="class=datarow"; - html += QString("") - .arg(color) - .arg(tooltipshow) - .arg(tooltiphide) - .arg(rx.first.toString(Qt::ISODate)) - .arg(rx.last.toString(Qt::ISODate)) - .arg(datarowclass); - - - html += QString("%1").arg(rx.first.toString(Qt::SystemLocaleShortDate)); - html += QString("%1").arg(rx.last.toString(Qt::SystemLocaleShortDate)); - html += QString("%1").arg(rx.days); - html += QString("%1").arg(rx.ahi, 0, 'f', decimals); - html += QString("%1").arg(rx.fl, 0, 'f', decimals); // Not the best way to do this.. Todo: Add an extra field for data.. - - if (p_profile->hasChannel(CPAP_SensAwake)) { - html += QString("%1").arg(calcSA(rx.first, rx.last), 0, 'f', decimals); - } - html += QString("%1").arg(rx.machine->loaderName()); - html += QString("%1").arg(rx.pr_relief_string); - html += QString("%1").arg(schema::channel[CPAP_Mode].option(int(rx.mode))); - html += QString("%1").arg(extratxt); - html += ""; - } - - html += ""; - html += "
"; - - } */ html += GenerateRXChanges(); html += GenerateMachineList(); diff --git a/sleepyhead/welcome.cpp b/sleepyhead/welcome.cpp index 6116185a..f8ecadff 100644 --- a/sleepyhead/welcome.cpp +++ b/sleepyhead/welcome.cpp @@ -178,7 +178,7 @@ QString Welcome::GenerateCPAPHTML() comp = equal; } - html += tr("You had an AHI of %1, which is %2 your %3 day average of %4.").arg(ahi,0,'f',2).arg(comp).arg(averagedays).arg(ahidays,0,'f',2); + html += tr("You had an AHI of %1, which is %2 your %3 day average of %4.").arg(ahi,0,'f',2).arg(comp).arg(averagedays).arg(ahidays,0,'f',2); html += "
"; @@ -230,7 +230,7 @@ QString Welcome::GenerateCPAPHTML() comp = equal; } - html += tr("Your average leaks were %1 %2, which is %3 your %4 day average of %5.").arg(leak,0,'f',2).arg(schema::channel[CPAP_Leak].units()).arg(comp).arg(averagedays).arg(leakdays,0,'f',2); + html += tr("Your average leaks were %1 %2, which is %3 your %4 day average of %5.").arg(leak,0,'f',2).arg(schema::channel[CPAP_Leak].units()).arg(comp).arg(averagedays).arg(leakdays,0,'f',2); html += "
";