From 5a2e02271a795030468d314c0eeae627c9be9e67 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 7 Jan 2012 04:15:21 +1000 Subject: [PATCH] Details tab events cleanup, larger AHI display, Bookmark Search in side panel --- daily.cpp | 66 +++-- docs/channels.xml | 4 +- mainwindow.cpp | 30 ++- mainwindow.h | 5 + mainwindow.ui | 661 +++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 728 insertions(+), 38 deletions(-) diff --git a/daily.cpp b/daily.cpp index 1953a666..e516ab27 100644 --- a/daily.cpp +++ b/daily.cpp @@ -134,6 +134,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared) evseg->AddSlice(CPAP_Obstructive,QColor(0x40,0xaf,0xbf,0xff),tr("OA")); evseg->AddSlice(CPAP_ClearAirway,QColor(0xb2,0x54,0xcd,0xff),tr("CA")); evseg->AddSlice(CPAP_RERA,QColor(0xff,0xff,0x80,0xff),tr("RE")); + evseg->AddSlice(CPAP_NRI,QColor(0x00,0x80,0x40,0xff),tr("NR")); evseg->AddSlice(CPAP_FlowLimit,QColor(0x40,0x40,0x40,0xff),tr("FL")); GAHI->AddLayer(AddCPAP(evseg)); @@ -663,7 +664,7 @@ void Daily::Load(QDate date) "-->" "" "" - "\n"; + "
\n"; QString tmp; UpdateOXIGraphs(oxi); @@ -780,20 +781,29 @@ void Daily::Load(QDate date) .arg(QString().sprintf("%02i:%02i:%02i",h,m,s)); QString cs; + if (!isBrick) { + if (PROFILE.general->calculateRDI()) { + html+=QString("\n") + .arg("#F88017").arg("black").arg(tr("RDI")).arg(schema::channel[CPAP_RDI].description()).arg(ahi,0,'f',2); + } else { + html+=QString("\n") + .arg("#F88017").arg("black").arg(tr("AHI")).arg(schema::channel[CPAP_AHI].description()).arg(ahi,0,'f',2); + } + if (cpap->machine->GetClass()==STR_MACH_ResMed) { cs="4 width='70%' align=center>"; } else cs="2 width='50%'>"; - html+="\n") - .arg("#F88017").arg("black").arg(tr("RDI")).arg(schema::channel[CPAP_RDI].description()).arg(ahi,0,'f',2); - } else { - html+=QString("\n") - .arg("#F88017").arg("black").arg(tr("AHI")).arg(schema::channel[CPAP_AHI].description()).arg(ahi,0,'f',2); - //html+="\n"; - } +// if (PROFILE.general->calculateRDI()) { +// html+=QString("\n") +// .arg("#F88017").arg("black").arg(tr("RDI")).arg(schema::channel[CPAP_RDI].description()).arg(ahi,0,'f',2); +// } else { +// html+=QString("\n") +// .arg("#F88017").arg("black").arg(tr("AHI")).arg(schema::channel[CPAP_AHI].description()).arg(ahi,0,'f',2); +// //html+="\n"; +// } html+=QString("\n") .arg("#4040ff").arg("white").arg(tr("Hypopnea")).arg(schema::channel[CPAP_Hypopnea].description()).arg(hi,0,'f',2).arg(CPAP_Hypopnea); if (cpap->machine->GetClass()==STR_MACH_ResMed) { @@ -806,10 +816,20 @@ void Daily::Load(QDate date) html+=QString("\n") .arg("#b254cd").arg("black").arg(tr("Clear Airway")).arg(schema::channel[CPAP_ClearAirway].description()).arg(cai,0,'f',2).arg(CPAP_ClearAirway); + + if (cpap->machine->GetClass()==STR_MACH_Intellipap) { + html+=QString("\n") + .arg(schema::channel[CPAP_NRI].defaultColor().name()).arg("black").arg(tr("NRI")).arg(schema::channel[CPAP_NRI].description()).arg(nri,0,'f',2).arg(CPAP_NRI); + } + if (cpap->machine->GetClass()==STR_MACH_PRS1) { + html+=QString("\n") + .arg("#80ff80").arg("black").arg(tr("PB/CSR")).arg(schema::channel[CPAP_CSR].description()).arg(csr,0,'f',2).arg(CPAP_CSR); + } + html+="
%3%4 %5
%3%4 %5
"; + html+="
"; - if (PROFILE.general->calculateRDI()) { - html+=QString("
%3%4%5
%3%4%5
"+tr("AHI")+""+schema::channel[CPAP_AHI].description()+""+QString().sprintf("%.2f",ahi)+"
%3%4%5
%3%4%5
"+tr("AHI")+""+schema::channel[CPAP_AHI].description()+""+QString().sprintf("%.2f",ahi)+"
%3%4%5
%3%4%5
%3%4%5%
%3%4%5%
"; if (cpap->machine->GetClass()==STR_MACH_PRS1) { - html+=""; + html+=""; } else if (cpap->machine->GetClass()==STR_MACH_Intellipap) { - html+="
"; html+=QString("\n") .arg("#ffff80").arg("black").arg(tr("RERA")).arg(schema::channel[CPAP_RERA].description()).arg(rei,0,'f',2).arg(CPAP_RERA); if (mode>MODE_CPAP) { @@ -823,15 +843,20 @@ void Daily::Load(QDate date) html+=QString("\n") .arg("#ff4040").arg("black").arg(tr("VSnore2")).arg(schema::channel[CPAP_VSnore2].description()).arg(cpap->count(CPAP_VSnore2)/cpap->hours(),0,'f',2).arg(CPAP_VSnore2); } - html+=QString("\n") - .arg("#80ff80").arg("black").arg(tr("PB/CSR")).arg(schema::channel[CPAP_CSR].description()).arg(csr,0,'f',2).arg(CPAP_CSR); + if (PROFILE.cpap->userEventFlagging()) { + EventDataType uf1=cpap->count(CPAP_UserFlag1) / cpap->hours(); + if (uf1>0) + html+=QString("\n") + .arg("#e0e0e0").arg("black") + .arg(tr("User Flags")) + .arg(schema::channel[CPAP_UserFlag1].description()) + .arg(uf1,0,'f',2).arg(CPAP_UserFlag1); + } html+="
%3%4%5
%3%4%5
%3%4%5%
%3%4%5
"; + html+="
"; html+=QString("\n") - .arg("#ffff80").arg("black").arg(tr("NRI")).arg(schema::channel[CPAP_NRI].description()).arg(nri,0,'f',2).arg(CPAP_NRI); - html+=QString("\n") - .arg("#404040").arg("black").arg(tr("Leak")).arg(schema::channel[CPAP_LeakFlag].description()).arg(lki,0,'f',2).arg(CPAP_LeakFlag); + .arg("#40c0c0").arg("black").arg(tr("Leak")).arg(schema::channel[CPAP_LeakFlag].description()).arg(lki,0,'f',2).arg(CPAP_LeakFlag); html+=QString("\n") .arg("#ff4040").arg("black").arg(tr("VSnore")).arg(schema::channel[CPAP_VSnore].description()).arg(cpap->count(CPAP_VSnore)/cpap->hours(),0,'f',2).arg(CPAP_VSnore); @@ -843,13 +868,6 @@ void Daily::Load(QDate date) } html+=""; - if (PROFILE.cpap->userEventFlagging()) { - EventDataType uf=cpap->count(CPAP_UserFlag1) / cpap->hours(); - if (uf>0) - html+=QString("").arg(uf,0,'f',2); - } - - // Note, this may not be a problem since Qt bug 13622 was discovered // as it only relates to text drawing, which the Pie chart does not do // ^^ Scratch that.. pie now includes text.. diff --git a/docs/channels.xml b/docs/channels.xml index 85b89a2a..8668fa97 100644 --- a/docs/channels.xml +++ b/docs/channels.xml @@ -13,7 +13,7 @@ Important: One id code per item, DO NOT CHANGE ID NUMBERS!!! - + @@ -21,7 +21,7 @@ Important: One id code per item, DO NOT CHANGE ID NUMBERS!!! - + diff --git a/mainwindow.cpp b/mainwindow.cpp index 33b5842a..a0ee9de9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1224,22 +1224,31 @@ void MainWindow::updateFavourites() if (journal) { if (journal->size()>0) { Session *sess=(*journal)[0]; + QString tmp; + bool filtered=!bookmarkFilter.isEmpty(); + bool found=!filtered; if (sess->settings.contains(Bookmark_Start)) { //QVariantList start=sess->settings[Bookmark_Start].toList(); //QVariantList end=sess->settings[Bookmark_End].toList(); QStringList notes=sess->settings[Bookmark_Notes].toStringList(); if (notes.size()>0) { - html+=QString(""; + tmp+=""; } } + if (found) html+=tmp; } } @@ -2394,3 +2403,18 @@ void MainWindow::on_bookmarkView_linkClicked(const QUrl &arg1) { on_recordsBox_linkClicked(arg1); } + +void MainWindow::on_filterBookmarks_editingFinished() +{ + bookmarkFilter=ui->filterBookmarks->text(); + updateFavourites(); +} + +void MainWindow::on_filterBookmarksButton_clicked() +{ + if (!bookmarkFilter.isEmpty()) { + ui->filterBookmarks->setText(""); + bookmarkFilter=""; + updateFavourites(); + } +} diff --git a/mainwindow.h b/mainwindow.h index 01f9320d..69d3cf45 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -279,6 +279,10 @@ private slots: void on_bookmarkView_linkClicked(const QUrl &arg1); + void on_filterBookmarks_editingFinished(); + + void on_filterBookmarksButton_clicked(); + private: Ui::MainWindow *ui; @@ -293,6 +297,7 @@ private: QSystemTrayIcon *systray; QMenu *systraymenu; gGraphView *SnapshotGraph; + QString bookmarkFilter; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 50496ddc..1b15c621 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -311,8 +311,8 @@ - 255 - 255 + 170 + 170 255 @@ -340,8 +340,8 @@ - 255 - 255 + 170 + 170 255 @@ -410,12 +410,12 @@ 0 - + 0 0 - 143 + 163 524 @@ -738,7 +738,7 @@ - + 0 @@ -747,6 +747,70 @@ 313 + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + + + 0 + 31 + 237 + + + + + + + 170 + 170 + 255 + + + + + + true @@ -764,6 +828,585 @@ 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 170 + 170 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 212 + 212 + 255 + + + + + + + 85 + 85 + 127 + + + + + + + 113 + 113 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 212 + 212 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 170 + 170 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 212 + 212 + 255 + + + + + + + 85 + 85 + 127 + + + + + + + 113 + 113 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 212 + 212 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 85 + 85 + 127 + + + + + + + 170 + 170 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 212 + 212 + 255 + + + + + + + 85 + 85 + 127 + + + + + + + 113 + 113 + 170 + + + + + + + 85 + 85 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 85 + 85 + 127 + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 170 + 170 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + QFrame::Box + + + QFrame::Sunken + + + + 0 + + + 0 + + + + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + + + 0 + 31 + 237 + + + + + + + 170 + 170 + 255 + + + + + + + + + + + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + + + 170 + 170 + 255 + + + + + + + 170 + 170 + 255 + + + + + + + + + 0 + 31 + 237 + + + + + + + 170 + 170 + 255 + + + + + + + + ... + + + + :/icons/refresh.png:/icons/refresh.png + + + true + + + + + + @@ -812,12 +1455,12 @@ - + 0 0 - 158 + 178 313
%3%4%5%
%3%4%5%
%3%4%5
User flag index=%1
%2
") + tmp+=QString("
%2
") .arg(date.toString(Qt::ISODate)) .arg(date.toString()); + tmp+=""; + for (int i=0;i"; + QString note=notes[i]; + if (filtered && note.contains(bookmarkFilter,Qt::CaseInsensitive)) + found=true; + tmp+="
  • "+note+"
  • "; } - html+="