diff --git a/docs/channels.xml b/docs/channels.xml index b833ca12..f215c4fb 100644 --- a/docs/channels.xml +++ b/docs/channels.xml @@ -44,7 +44,7 @@ One id code per item <channel id="0x1111" class="data" name="IPAPHi" details="Inspiratory Pressure Hi" label="IPAP Hi" unit="cmH20" color="grey"/> <channel id="0x1112" class="data" name="RespEvent" details="Respiratory Events" label="Resp Events" unit="" color="black"/> <channel id="0x1113" class="data" name="FLG" details="Flow Limit Graph" label="Flow Limit" unit="" color="dark grey"/> - <channel id="0x1114" class="data" name="TgMV" details="TgMV" label="TgMV" unit="" color="dark cyan"/> + <channel id="0x1114" class="data" name="TgMV" details="Target Minute Ventilation" label="Trgt Min Vent." unit="" color="dark cyan"/> <channel id="0x1150" class="data" name="PRS1_00" details="Unknown 00" label="U00" unit="" color="black"/> <channel id="0x1151" class="data" name="PRS1_01" details="Unknown 01" label="U01" unit="" color="black"/> diff --git a/docs/release_notes.html b/docs/release_notes.html index 67f10553..6d523106 100644 --- a/docs/release_notes.html +++ b/docs/release_notes.html @@ -6,22 +6,21 @@ <p><h2><b>Release Notes</b></h2></p> -<p>This test build probably isn't as cool as the last ones, it mostly just fixes some annoying bugs.</p> -<p>I would have liked to have had more to share with you this time around, but I spent the last few -weeks functioning less than usual (fog, appendicitus, etc.. bleh).</p> -<p>Still, I have managed to make a few nice improvements...</p> +<p>I've been a little less functional that usual since last time (fog, headaches, appendicitus, etc.. bleh), +however, I have still managed to cook up a few nice improvements...</p> <p><b>What's New?</b><br/> <li>You can now Shift+Left Click on a day in an overview graph, and it will jump to that day in Daily tab.</li> <li>New calendar navigation bar allows easy hiding the calendar to get more room.</li> <li>(Relative) AHI is displayed above the flow rate waveform for selected area.</li> -<li>A new preference option to switch some daily graphs between square plots and normal line plots.</li> <li>Improved support for ResMed S9 ASV/VPAP Machines.</li> +<li>Added some basic CSV export capabilities.</li> +<li>A new preference option to switch some daily graphs between square plots and normal line plots.</li> <li>Some graphing optimizations to improve performance.</li> <li>Quite a few other little bugfixes I've forgotten about.</li> <br/> <b>What's still missing/broken?</b><br/> -<li>Oximetry.. still. I know it sucks..</li> +<li>Oximetry.. still mostly broken. I will eventually get around to it...</li> <li>Daily report printing still needs doing.</li> <li>Plenty more I'm sure of it..</li> </p> diff --git a/exportcsv.cpp b/exportcsv.cpp index 799ca5a6..fbe32b6d 100644 --- a/exportcsv.cpp +++ b/exportcsv.cpp @@ -1,6 +1,7 @@ #include <QFileDialog> #include <QLocale> #include <QMessageBox> +#include <QCalendarWidget> #include "SleepLib/profiles.h" #include "SleepLib/day.h" #include "exportcsv.h" @@ -22,6 +23,17 @@ ExportCSV::ExportCSV(QWidget *parent) : } ui->startDate->setDisplayFormat(shortformat); ui->endDate->setDisplayFormat(shortformat); + // Stop both calendar drop downs highlighting weekends in red + QTextCharFormat format = ui->startDate->calendarWidget()->weekdayTextFormat(Qt::Saturday); + format.setForeground(QBrush(Qt::black, Qt::SolidPattern)); + ui->startDate->calendarWidget()->setWeekdayTextFormat(Qt::Saturday, format); + ui->startDate->calendarWidget()->setWeekdayTextFormat(Qt::Sunday, format); + ui->endDate->calendarWidget()->setWeekdayTextFormat(Qt::Saturday, format); + ui->endDate->calendarWidget()->setWeekdayTextFormat(Qt::Sunday, format); + + // Connect the signals to update which days have CPAP data when the month is changed + connect(ui->startDate->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(startDate_currentPageChanged(int,int))); + connect(ui->endDate->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(endDate_currentPageChanged(int,int))); on_quickRangeCombo_activated("Most Recent Day"); ui->rb1_details->clearFocus(); @@ -61,6 +73,8 @@ void ExportCSV::on_filenameBrowseButton_clicked() void ExportCSV::on_quickRangeCombo_activated(const QString &arg1) { + QDate first=PROFILE.FirstDay(); + QDate last=PROFILE.LastDay(); if (arg1=="Custom") { ui->startDate->setEnabled(true); ui->endDate->setEnabled(true); @@ -71,27 +85,28 @@ void ExportCSV::on_quickRangeCombo_activated(const QString &arg1) ui->endDate->setEnabled(false); ui->startLabel->setEnabled(false); ui->endLabel->setEnabled(false); + if (arg1=="Everything") { - ui->startDate->setDate(PROFILE.FirstDay()); - ui->endDate->setDate(PROFILE.LastDay()); + ui->startDate->setDate(first); + ui->endDate->setDate(last); } else if (arg1=="Most Recent Day") { - ui->startDate->setDate(PROFILE.LastDay()); - ui->endDate->setDate(PROFILE.LastDay()); + ui->startDate->setDate(last); + ui->endDate->setDate(last); } else if (arg1=="Last Week") { - ui->startDate->setDate(QDate::currentDate().addDays(-7)); - ui->endDate->setDate(QDate::currentDate()); + ui->startDate->setDate(last.addDays(-7)); + ui->endDate->setDate(last); } else if (arg1=="Last Fortnight") { - ui->startDate->setDate(QDate::currentDate().addDays(-14)); - ui->endDate->setDate(QDate::currentDate()); + ui->startDate->setDate(last.addDays(-14)); + ui->endDate->setDate(last); } else if (arg1=="Last Month") { - ui->startDate->setDate(QDate::currentDate().addMonths(-1)); - ui->endDate->setDate(QDate::currentDate()); + ui->startDate->setDate(last.addMonths(-1)); + ui->endDate->setDate(last); } else if (arg1=="Last 6 Months") { - ui->startDate->setDate(QDate::currentDate().addMonths(-6)); - ui->endDate->setDate(QDate::currentDate()); + ui->startDate->setDate(last.addMonths(-6)); + ui->endDate->setDate(last); } else if (arg1=="Last Year") { - ui->startDate->setDate(QDate::currentDate().addYears(-1)); - ui->endDate->setDate(QDate::currentDate()); + ui->startDate->setDate(last.addYears(-1)); + ui->endDate->setDate(last); } } } @@ -222,3 +237,54 @@ void ExportCSV::on_exportButton_clicked() file.close(); ExportCSV::accept(); } + + +void ExportCSV::UpdateCalendarDay(QDateEdit * dateedit,QDate date) +{ + QCalendarWidget *calendar=dateedit->calendarWidget(); + QTextCharFormat bold; + QTextCharFormat cpapcol; + QTextCharFormat normal; + QTextCharFormat oxiday; + bold.setFontWeight(QFont::Bold); + cpapcol.setForeground(QBrush(Qt::blue, Qt::SolidPattern)); + cpapcol.setFontWeight(QFont::Bold); + oxiday.setForeground(QBrush(Qt::red, Qt::SolidPattern)); + oxiday.setFontWeight(QFont::Bold); + bool hascpap=p_profile->GetDay(date,MT_CPAP)!=NULL; + bool hasoxi=p_profile->GetDay(date,MT_OXIMETER)!=NULL; + //bool hasjournal=p_profile->GetDay(date,MT_JOURNAL)!=NULL; + + if (hascpap) { + if (hasoxi) { + calendar->setDateTextFormat(date,oxiday); + } else { + calendar->setDateTextFormat(date,cpapcol); + } + } else if (p_profile->GetDay(date)) { + calendar->setDateTextFormat(date,bold); + } else { + calendar->setDateTextFormat(date,normal); + } + calendar->setHorizontalHeaderFormat(QCalendarWidget::ShortDayNames); +} +void ExportCSV::startDate_currentPageChanged(int year, int month) +{ + QDate d(year,month,1); + int dom=d.daysInMonth(); + + for (int i=1;i<=dom;i++) { + d=QDate(year,month,i); + UpdateCalendarDay(ui->startDate,d); + } +} +void ExportCSV::endDate_currentPageChanged(int year, int month) +{ + QDate d(year,month,1); + int dom=d.daysInMonth(); + + for (int i=1;i<=dom;i++) { + d=QDate(year,month,i); + UpdateCalendarDay(ui->endDate,d); + } +} diff --git a/exportcsv.h b/exportcsv.h index a9371584..7a2beede 100644 --- a/exportcsv.h +++ b/exportcsv.h @@ -1,6 +1,7 @@ #ifndef EXPORTCSV_H #define EXPORTCSV_H +#include <QDateEdit> #include <QDialog> namespace Ui { @@ -22,7 +23,13 @@ private slots: void on_exportButton_clicked(); + void startDate_currentPageChanged(int year, int month); + void endDate_currentPageChanged(int year, int month); + + private: + void UpdateCalendarDay(QDateEdit * dateedit,QDate date); + Ui::ExportCSV *ui; };