Fix Machine::m_availableChannels glitch breaking oximetry statistics

This commit is contained in:
Mark Watkins 2014-09-30 21:02:35 +10:00
parent 358d1969e0
commit 740e4cb2ba
11 changed files with 35 additions and 32 deletions

View File

@ -26,8 +26,6 @@
<file>icons/smileyface.png</file> <file>icons/smileyface.png</file>
<file>icons/sadface.png</file> <file>icons/sadface.png</file>
<file>icons/mask.png</file> <file>icons/mask.png</file>
<file>icons/brick.png</file>
<file>icons/nodata.png</file>
<file>icons/cubeoximeter.png</file> <file>icons/cubeoximeter.png</file>
<file>icons/trophy.png</file> <file>icons/trophy.png</file>
<file>icons/bookmark.png</file> <file>icons/bookmark.png</file>
@ -37,10 +35,7 @@
<file>icons/session-on.png</file> <file>icons/session-on.png</file>
<file>icons/bob-v3.0.png</file> <file>icons/bob-v3.0.png</file>
<file>docs/script.js</file> <file>docs/script.js</file>
<file>icons/nographs.png</file>
<file>icons/sheep.png</file>
<file>docs/sheep.png</file> <file>docs/sheep.png</file>
<file>icons/Bob Strikes Back.png</file>
<file>icons/Jedimark.png</file> <file>icons/Jedimark.png</file>
<file>COPYING</file> <file>COPYING</file>
<file>icons/sdcard-lock.png</file> <file>icons/sdcard-lock.png</file>

View File

@ -520,8 +520,7 @@ bool EDFParser::Parse()
serialnumber += recordingident[i]; serialnumber += recordingident[i];
} }
QDateTime startDate = QDateTime::fromString(QString::fromLatin1(header.datetime, 16), QDateTime startDate = QDateTime::fromString(QString::fromLatin1(header.datetime, 16), "dd.MM.yyHH.mm.ss");
"dd.MM.yyHH.mm.ss");
//startDate.toTimeSpec(Qt::UTC); //startDate.toTimeSpec(Qt::UTC);
QDate d2 = startDate.date(); QDate d2 = startDate.date();
@ -930,7 +929,7 @@ void ResmedImport::run()
ResmedLoader::ResmedLoader() ResmedLoader::ResmedLoader()
{ {
const QString RMS9_ICON = ":/icons/rms9.png"; const QString RMS9_ICON = ":/icons/rms9.png";
const QString RM10_ICON = ":/icons/sheep.png"; const QString RM10_ICON = ":/icons/rms9.png";
m_pixmaps[STR_ResMed_S9] = QPixmap(RMS9_ICON); m_pixmaps[STR_ResMed_S9] = QPixmap(RMS9_ICON);
m_pixmaps[STR_ResMed_AirSense10] = QPixmap(RM10_ICON); m_pixmaps[STR_ResMed_AirSense10] = QPixmap(RM10_ICON);

View File

@ -76,7 +76,7 @@ Session *Machine::SessionExists(SessionID session)
} }
} }
const quint16 sessinfo_version = 1; const quint16 sessinfo_version = 2;
bool Machine::saveSessionInfo() bool Machine::saveSessionInfo()
{ {
@ -98,8 +98,6 @@ bool Machine::saveSessionInfo()
out << filetype_sessenabled; out << filetype_sessenabled;
out << sessinfo_version; out << sessinfo_version;
out << m_availableChannels;
QHash<SessionID, Session *>::iterator s; QHash<SessionID, Session *>::iterator s;
out << (int)sessionlist.size(); out << (int)sessionlist.size();
@ -148,8 +146,10 @@ bool Machine::loadSessionInfo()
in >> ft16; in >> ft16;
in >> version; in >> version;
if (version >= 1) { if (version == 1) {
in >> m_availableChannels; // was available channels
QHash<ChannelID, bool> crap;
in >> crap;
} }
int size; int size;
@ -161,10 +161,6 @@ bool Machine::loadSessionInfo()
for (int i=0; i< size; ++i) { for (int i=0; i< size; ++i) {
in >> sid; in >> sid;
in >> b; in >> b;
// QList<ChannelID> avail_channels;
// if (version >= 2) {
// in >> avail_channels;
// }
s = sessionlist.find(sid); s = sessionlist.find(sid);
@ -172,9 +168,6 @@ bool Machine::loadSessionInfo()
Session * sess = s.value(); Session * sess = s.value();
sess->setEnabled(b); sess->setEnabled(b);
// if (version >= 2) {
// sess->m_availableChannels = avail_channels;
// }
} }
} }
return true; return true;
@ -217,6 +210,11 @@ bool Machine::AddSession(Session *s)
Q_ASSERT(p_profile); Q_ASSERT(p_profile);
Q_ASSERT(p_profile->isOpen()); Q_ASSERT(p_profile->isOpen());
if (s->type() == MT_OXIMETER) {
int i=5;
}
updateChannels(s);
if (p_profile->session->ignoreOlderSessions()) { if (p_profile->session->ignoreOlderSessions()) {
qint64 ignorebefore = p_profile->session->ignoreOlderSessionsDate().toMSecsSinceEpoch(); qint64 ignorebefore = p_profile->session->ignoreOlderSessionsDate().toMSecsSinceEpoch();
if (s->last() < ignorebefore) { if (s->last() < ignorebefore) {
@ -1114,6 +1112,12 @@ void Machine::updateChannels(Session * sess)
ChannelID code = sess->m_availableChannels.at(i); ChannelID code = sess->m_availableChannels.at(i);
m_availableChannels[code] = true; m_availableChannels[code] = true;
} }
size = sess->m_availableSettings.size();
for (int i=0; i < size; ++i) {
ChannelID code = sess->m_availableSettings.at(i);
m_availableSettings[code] = true;
}
} }
QList<ChannelID> Machine::availableChannels(quint32 chantype) QList<ChannelID> Machine::availableChannels(quint32 chantype)

View File

@ -109,6 +109,10 @@ class Machine
return m_availableChannels.contains(code); return m_availableChannels.contains(code);
} }
inline bool hasSetting(ChannelID code) {
return m_availableSettings.contains(code);
}
//! \brief Contains a secondary index of day data, containing just this machines sessions //! \brief Contains a secondary index of day data, containing just this machines sessions
QMap<QDate, Day *> day; QMap<QDate, Day *> day;
@ -253,6 +257,7 @@ class Machine
QList<ImportTask *> m_tasklist; QList<ImportTask *> m_tasklist;
QHash<ChannelID, bool> m_availableChannels; QHash<ChannelID, bool> m_availableChannels;
QHash<ChannelID, bool> m_availableSettings;
QString m_summaryPath; QString m_summaryPath;
QString m_eventsPath; QString m_eventsPath;

View File

@ -696,17 +696,17 @@ class AppearanceSettings : public ProfileSettings
: ProfileSettings(profile) : ProfileSettings(profile)
{ {
initPref(STR_AS_GraphHeight, 180.0); initPref(STR_AS_GraphHeight, 180.0);
initPref(STR_AS_AntiAliasing, false); // I think it's ugly. initPref(STR_AS_AntiAliasing, true);
initPref(STR_AS_GraphSnapshots, true); initPref(STR_AS_GraphSnapshots, true);
initPref(STR_AS_Animations, true); initPref(STR_AS_Animations, true);
initPref(STR_AS_SquareWave, false); initPref(STR_AS_SquareWave, false);
initPref(STR_AS_AllowYAxisScaling, true); initPref(STR_AS_AllowYAxisScaling, true);
initPref(STR_AS_GraphTooltips, true); initPref(STR_AS_GraphTooltips, true);
initPref(STR_AS_UsePixmapCaching, true); initPref(STR_AS_UsePixmapCaching, false);
initPref(STR_AS_OverlayType, ODT_Bars); initPref(STR_AS_OverlayType, ODT_Bars);
initPref(STR_AS_OverviewLinechartMode, OLC_Bartop); initPref(STR_AS_OverviewLinechartMode, OLC_Bartop);
initPref(STR_AS_LineThickness, 1.0); initPref(STR_AS_LineThickness, 1.0);
initPref(STR_AS_LineCursorMode, false); initPref(STR_AS_LineCursorMode, true);
initPref(STR_AS_CalendarVisible, true); initPref(STR_AS_CalendarVisible, true);
initPref(STR_AS_RightSidebarVisible, true); initPref(STR_AS_RightSidebarVisible, true);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

View File

@ -641,11 +641,11 @@ struct RXChange {
short highlight; 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 }; //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; //RXSortMode RXsort = RX_first;
bool RXorder = false; //bool RXorder = false;
bool operator<(const RXChange &c1, const RXChange &c2) /*bool operator<(const RXChange &c1, const RXChange &c2)
{ {
const RXChange *comp1 = &c1; const RXChange *comp1 = &c1;
const RXChange *comp2 = &c2; const RXChange *comp2 = &c2;
@ -824,7 +824,7 @@ bool RXSort(const RXChange *comp1, const RXChange *comp2)
} }
return true; return true;
} } */
struct UsageData { struct UsageData {
UsageData() { ahi = 0; hours = 0; } UsageData() { ahi = 0; hours = 0; }
UsageData(QDate d, EventDataType v, EventDataType h) { date = d; ahi = v; hours = h; } UsageData(QDate d, EventDataType v, EventDataType h) { date = d; ahi = v; hours = h; }
@ -865,7 +865,7 @@ struct Period {
const QString heading_color="#ffffff"; const QString heading_color="#ffffff";
const QString subheading_color="#e0e0e0"; const QString subheading_color="#e0e0e0";
const int rxthresh = 5; //const int rxthresh = 5;
QString Statistics::GenerateMachineList() QString Statistics::GenerateMachineList()
{ {
@ -1066,11 +1066,11 @@ QString Statistics::GenerateHTML()
} }
int cpapdays = p_profile->countDays(MT_CPAP, firstcpap, lastcpap); // int cpapdays = p_profile->countDays(MT_CPAP, firstcpap, lastcpap);
// CPAPMode cpapmode = (CPAPMode)(int)p_profile->calcSettingsMax(CPAP_Mode, MT_CPAP, firstcpap, lastcpap); // CPAPMode cpapmode = (CPAPMode)(int)p_profile->calcSettingsMax(CPAP_Mode, MT_CPAP, firstcpap, lastcpap);
float percentile = p_profile->general->prefCalcPercentile() / 100.0; // float percentile = p_profile->general->prefCalcPercentile() / 100.0;
// int mididx=p_profile->general->prefCalcMiddle(); // int mididx=p_profile->general->prefCalcMiddle();
// SummaryType ST_mid; // SummaryType ST_mid;
@ -1086,7 +1086,7 @@ QString Statistics::GenerateHTML()
ahitxt = STR_TR_AHI; ahitxt = STR_TR_AHI;
} }
int decimals = 2; // int decimals = 2;
html += "<div align=center>"; html += "<div align=center>";
html += QString("<table class=curved "+table_width+">"); html += QString("<table class=curved "+table_width+">");