mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Populate a few useful Records in the new sidebar, plus make the links work
This commit is contained in:
parent
1146aa3692
commit
b140fe6b4b
@ -1120,7 +1120,8 @@ void Daily::Unload(QDate date)
|
||||
}
|
||||
}
|
||||
if (journal->IsChanged()) {
|
||||
mainwin->getOverview()->ReloadGraphs();
|
||||
|
||||
mainwin->getOverview()->ResetGraphs();
|
||||
}
|
||||
Machine *jm=PROFILE.GetMachine(MT_JOURNAL);
|
||||
if (jm) jm->SaveSession(journal);
|
||||
|
128
mainwindow.cpp
128
mainwindow.cpp
@ -140,7 +140,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
systray=NULL;
|
||||
systraymenu=NULL;
|
||||
}
|
||||
ui->toolBox->setCurrentIndex(0);
|
||||
daily->graphView()->redraw();
|
||||
|
||||
ui->recordsBox->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
|
||||
//connect(ui->recordsBox,SIGNAL(linkClicked(QUrl)),this,SLOT(Link_clicked(QUrl)));
|
||||
|
||||
}
|
||||
extern MainWindow *mainwin;
|
||||
MainWindow::~MainWindow()
|
||||
@ -712,6 +717,8 @@ void MainWindow::on_summaryButton_clicked()
|
||||
html+="</table>";
|
||||
html+="</div>";
|
||||
|
||||
QDate bestAHIdate, worstAHIdate;
|
||||
EventDataType bestAHI=999.0, worstAHI=0;
|
||||
if (cpapdays>0) {
|
||||
QDate first,last=lastcpap;
|
||||
CPAPMode mode,cmode=MODE_UNKNOWN;
|
||||
@ -723,8 +730,21 @@ void MainWindow::on_summaryButton_clicked()
|
||||
QVector<RXChange> rxchange;
|
||||
do {
|
||||
day=PROFILE.GetDay(date,MT_CPAP);
|
||||
|
||||
lastchanged=false;
|
||||
if (day) {
|
||||
EventDataType ahi=day->count(CPAP_Obstructive)+day->count(CPAP_Hypopnea)+day->count(CPAP_Apnea)+day->count(CPAP_ClearAirway);
|
||||
if (PROFILE.general->calculateRDI()) ahi+=day->count(CPAP_RERA);
|
||||
ahi/=day->hours();
|
||||
if (ahi > worstAHI) {
|
||||
worstAHI=ahi;
|
||||
worstAHIdate=date;
|
||||
}
|
||||
if (ahi < bestAHI) {
|
||||
bestAHI=ahi;
|
||||
bestAHIdate=date;
|
||||
}
|
||||
|
||||
mode=(CPAPMode)round(day->settings_wavg(CPAP_Mode));
|
||||
min=day->settings_min(CPAP_PressureMin);
|
||||
if (mode==MODE_CPAP) {
|
||||
@ -797,7 +817,92 @@ void MainWindow::on_summaryButton_clicked()
|
||||
RXsort=RX_ahi;
|
||||
qSort(tmpRX.begin(),tmpRX.end(),RXSort);
|
||||
tmpRX[0]->highlight=4; // worst
|
||||
tmpRX[tmpRX.size()-1]->highlight=1; //best
|
||||
int ls=tmpRX.size()-1;
|
||||
tmpRX[ls]->highlight=1; //best
|
||||
|
||||
QString recbox="<html><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; }"
|
||||
"a:link,a:visited { color: inherit; text-decoration: none; }" //font-weight: normal;
|
||||
"a:hover { background-color: inherit; color: white; text-decoration:none; font-weight: bold; }"
|
||||
"</style></head><body>";
|
||||
recbox+="<table width=100% cellpadding=2 cellspacing=0>";
|
||||
recbox+=QString("<tr><td><b><a href='daily=%1'>%2</b></td><td><b>%3</b></td></tr>").arg(bestAHIdate.toString(Qt::ISODate)).arg("Best AHI").arg(bestAHI,0,'f',2);
|
||||
recbox+=QString("<tr><td colspan=2>%1</td></tr>").arg(bestAHIdate.toString(Qt::SystemLocaleShortDate));
|
||||
recbox+=QString("<tr><td colspan=2> </td></tr>");
|
||||
recbox+=QString("<tr><td><b><a href='daily=%1'>%2</a></b></td><td><b>%3</b></td></tr>").arg(worstAHIdate.toString(Qt::ISODate)).arg("Worst AHI").arg(worstAHI,0,'f',2);
|
||||
recbox+=QString("<tr><td colspan=2>%1</td></tr>").arg(worstAHIdate.toString(Qt::SystemLocaleShortDate));
|
||||
recbox+=QString("<tr><td colspan=2> </td></tr>");
|
||||
QString minstr,maxstr,modestr;
|
||||
|
||||
|
||||
{
|
||||
CPAPMode mode=(CPAPMode)(int)PROFILE.calcSettingsMax(CPAP_Mode,MT_CPAP,tmpRX[ls]->first,tmpRX[ls]->first);
|
||||
|
||||
if (mode<MODE_APAP) { // is CPAP?
|
||||
minstr="Pressure";
|
||||
maxstr="";
|
||||
modestr=tr("CPAP");
|
||||
} else if (mode<MODE_BIPAP) { // is AUTO?
|
||||
minstr="Min";
|
||||
maxstr="Max";
|
||||
modestr=tr("APAP");
|
||||
} else { // BIPAP or greater
|
||||
minstr="EPAP";
|
||||
maxstr="IPAP";
|
||||
modestr=tr("Bi-Level/ASV");
|
||||
}
|
||||
|
||||
recbox+=QString("<tr><td colspan=2><b><a href='overview=%1,%2'>%3</a></b></td></tr>")
|
||||
.arg(tmpRX[ls]->first.toString(Qt::ISODate))
|
||||
.arg(tmpRX[ls]->last.toString(Qt::ISODate))
|
||||
.arg(tr("Best RX Setting"));
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("AHI")).arg(tmpRX[ls]->ahi,0,'f',2);
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("Mode")).arg(modestr);
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2").arg(minstr).arg(tmpRX[ls]->min,0,'f',1);
|
||||
if (!maxstr.isEmpty()) recbox+=QString(" %1: %2").arg(maxstr).arg(tmpRX[ls]->max,0,'f',1);
|
||||
recbox+="</td></tr>";
|
||||
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("Start")).arg(tmpRX[ls]->first.toString(Qt::SystemLocaleShortDate));
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("End")).arg(tmpRX[ls]->last.toString(Qt::SystemLocaleShortDate));
|
||||
recbox+=QString("<tr><td colspan=2> </td></tr>");
|
||||
|
||||
mode=(CPAPMode)(int)PROFILE.calcSettingsMax(CPAP_Mode,MT_CPAP,tmpRX[0]->first,tmpRX[0]->first);
|
||||
if (mode<MODE_APAP) { // is CPAP?
|
||||
minstr="Pressure";
|
||||
maxstr="";
|
||||
modestr=tr("CPAP");
|
||||
} else if (mode<MODE_BIPAP) { // is AUTO?
|
||||
minstr="Min";
|
||||
maxstr="Max";
|
||||
modestr=tr("APAP");
|
||||
} else { // BIPAP or greater
|
||||
minstr="EPAP";
|
||||
maxstr="IPAP";
|
||||
modestr=tr("Bi-Level/ASV");
|
||||
}
|
||||
|
||||
recbox+=QString("<tr><td colspan=2><b><a href='overview=%1,%2'>%3</a></b></td></tr>")
|
||||
.arg(tmpRX[0]->first.toString(Qt::ISODate))
|
||||
.arg(tmpRX[0]->last.toString(Qt::ISODate))
|
||||
.arg(tr("Worst RX Setting"));
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("AHI")).arg(tmpRX[0]->ahi,0,'f',2);
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("Mode")).arg(modestr);
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2").arg(minstr).arg(tmpRX[0]->min,0,'f',1);
|
||||
if (!maxstr.isEmpty()) recbox+=QString(" %1: %2").arg(maxstr).arg(tmpRX[0]->max,0,'f',1);
|
||||
recbox+="</td></tr>";
|
||||
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("Start")).arg(tmpRX[0]->first.toString(Qt::SystemLocaleShortDate));
|
||||
recbox+=QString("<tr><td colspan=2>%1: %2</td></tr>").arg(tr("End")).arg(tmpRX[0]->last.toString(Qt::SystemLocaleShortDate));
|
||||
}
|
||||
recbox+=QString("</table>");
|
||||
recbox+="</body></html>";
|
||||
ui->recordsBox->setHtml(recbox);
|
||||
|
||||
// ui->recordsBox->append("<a href='overview'><b>Best RX Setting</b></a>");
|
||||
// ui->recordsBox->append("Start: "+tmpRX[ls]->first.toString(Qt::SystemLocaleShortDate)+"<br/>End: "+tmpRX[ls]->last.toString(Qt::SystemLocaleShortDate)+"\n\n");
|
||||
// ui->recordsBox->append("<a href='overview'><b>Worst RX Setting</b></a>");
|
||||
// ui->recordsBox->append("Start: "+tmpRX[0]->first.toString(Qt::SystemLocaleShortDate)+"<br/>End: "+tmpRX[0]->last.toString(Qt::SystemLocaleShortDate)+"\n\n");
|
||||
|
||||
//show the second best and worst..
|
||||
//if (tmpRX.size()>4) {
|
||||
@ -1841,3 +1946,24 @@ void MainWindow::on_action_Sidebar_Toggle_toggled(bool visible)
|
||||
{
|
||||
ui->toolBox->setVisible(visible);
|
||||
}
|
||||
|
||||
void MainWindow::on_recordsBox_linkClicked(const QUrl &linkurl)
|
||||
{
|
||||
QString link=linkurl.toString().section("=",0,0).toLower();
|
||||
QString datestr=linkurl.toString().section("=",1).toLower();
|
||||
qDebug() << linkurl.toString() << link << datestr;
|
||||
if (link=="daily") {
|
||||
QDate date=QDate::fromString(datestr,Qt::ISODate);
|
||||
daily->LoadDate(date);
|
||||
ui->tabWidget->setCurrentWidget(daily);
|
||||
} else if (link=="overview") {
|
||||
QString date1=datestr.section(",",0,0);
|
||||
QString date2=datestr.section(",",1);
|
||||
|
||||
QDate d1=QDate::fromString(date1,Qt::ISODate);
|
||||
QDate d2=QDate::fromString(date2,Qt::ISODate);
|
||||
overview->setRange(d1,d2);
|
||||
ui->tabWidget->setCurrentWidget(overview);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -248,6 +248,8 @@ private slots:
|
||||
|
||||
void on_action_Sidebar_Toggle_toggled(bool arg1);
|
||||
|
||||
void on_recordsBox_linkClicked(const QUrl &arg1);
|
||||
|
||||
private:
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -271,13 +271,13 @@
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<width>160</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<width>160</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -385,7 +385,7 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>0</number>
|
||||
@ -395,7 +395,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>123</width>
|
||||
<width>143</width>
|
||||
<height>513</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -691,7 +691,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>138</width>
|
||||
<width>158</width>
|
||||
<height>319</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -713,7 +713,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<widget class="QListWidget" name="favouritesList">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
@ -774,28 +774,48 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
<widget class="QWebView" name="recordsBox">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>170</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>170</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>31</green>
|
||||
<blue>237</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Highest AHI</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="foo"><span style=" text-decoration: underline; color:#0000ff;">somedate</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Lowest AHI</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="foo"><span style=" text-decoration: underline; color:#0000ff;">somedate</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Most PB/CSR</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="foo"><span style=" text-decoration: underline; color:#0000ff;">somedate</span></a></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">etc..</p></body></html></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<property name="url">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
34
overview.cpp
34
overview.cpp
@ -283,13 +283,25 @@ gGraph * Overview::createGraph(QString name,QString units, YTickerType yttype)
|
||||
|
||||
void Overview::ReloadGraphs()
|
||||
{
|
||||
ui->dateStart->setDate(p_profile->FirstDay());
|
||||
ui->dateEnd->setDate(p_profile->LastDay());
|
||||
GraphView->setDay(NULL);
|
||||
|
||||
on_rangeCombo_activated(ui->rangeCombo->currentIndex());
|
||||
}
|
||||
|
||||
void Overview::ResetGraphs()
|
||||
{
|
||||
QDate start=ui->dateStart->date();
|
||||
QDate end=ui->dateEnd->date();
|
||||
//ui->dateStart->setDate(p_profile->FirstDay());
|
||||
//ui->dateEnd->setDate(p_profile->LastDay());
|
||||
GraphView->setDay(NULL);
|
||||
if (start.isValid() && end.isValid()) {
|
||||
setRange(start,end);
|
||||
}
|
||||
|
||||
//on_rangeCombo_activated(ui->rangeCombo->currentIndex());
|
||||
}
|
||||
|
||||
void Overview::RedrawGraphs()
|
||||
{
|
||||
GraphView->redraw();
|
||||
@ -369,10 +381,10 @@ void Overview::on_toolButton_clicked()
|
||||
GraphView->SetXBounds(d1,d2);
|
||||
}
|
||||
|
||||
void Overview::on_printButton_clicked()
|
||||
{
|
||||
mainwin->PrintReport(GraphView,STR_TR_Overview); // Must be translated the same as PrintReport checks.
|
||||
}
|
||||
//void Overview::on_printButton_clicked()
|
||||
//{
|
||||
// mainwin->PrintReport(GraphView,STR_TR_Overview); // Must be translated the same as PrintReport checks.
|
||||
//}
|
||||
|
||||
void Overview::ResetGraphLayout()
|
||||
{
|
||||
@ -416,7 +428,6 @@ void Overview::on_rangeCombo_activated(int index)
|
||||
{
|
||||
QDate end=PROFILE.LastDay();
|
||||
QDate start;
|
||||
ui->dateEnd->setDate(end);
|
||||
if (index==0) {
|
||||
start=end.addDays(-6);
|
||||
} else if (index==1) {
|
||||
@ -433,6 +444,15 @@ void Overview::on_rangeCombo_activated(int index)
|
||||
start=end.addYears(-1).addDays(1);
|
||||
}
|
||||
if (start<PROFILE.FirstDay()) start=PROFILE.FirstDay();
|
||||
setRange(start,end);
|
||||
}
|
||||
void Overview::setRange(QDate start, QDate end)
|
||||
{
|
||||
ui->dateEnd->blockSignals(true);
|
||||
ui->dateStart->blockSignals(true);
|
||||
ui->dateStart->setDate(start);
|
||||
ui->dateEnd->setDate(end);
|
||||
ui->dateEnd->blockSignals(false);
|
||||
ui->dateStart->blockSignals(false);
|
||||
this->on_toolButton_clicked();
|
||||
}
|
||||
|
10
overview.h
10
overview.h
@ -41,12 +41,18 @@ public:
|
||||
//! \brief Recalculates Overview chart info
|
||||
void ReloadGraphs();
|
||||
|
||||
//! \brief Recalculates Overview chart info, but keeps the date set
|
||||
void ResetGraphs();
|
||||
|
||||
//! \brief Reset graphs to uniform heights
|
||||
void ResetGraphLayout();
|
||||
|
||||
//! \brief Calls updateGL to redraw the overview charts
|
||||
void RedrawGraphs();
|
||||
|
||||
//! \brief Sets the currently selected date range of the overview display
|
||||
void setRange(QDate start, QDate end);
|
||||
|
||||
/*! \brief Create an overview graph, adding it to the overview gGraphView object
|
||||
\param QString name The title of the graph
|
||||
\param QString units The units of measurements to show in the popup */
|
||||
@ -59,8 +65,8 @@ public:
|
||||
QVector<SummaryChart *> OverviewCharts;
|
||||
|
||||
public slots:
|
||||
//! \brief Print button down the bottom, does the same as File->Print
|
||||
void on_printButton_clicked();
|
||||
// ! \brief Print button down the bottom, does the same as File->Print
|
||||
//void on_printButton_clicked();
|
||||
|
||||
private slots:
|
||||
/* void on_drStart_dateChanged(const QDate &date);
|
||||
|
14
overview.ui
14
overview.ui
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>668</width>
|
||||
<height>393</height>
|
||||
<width>611</width>
|
||||
<height>392</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -167,16 +167,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="printButton">
|
||||
<property name="toolTip">
|
||||
<string>Send a Report to your Printer</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Print Overview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user