Make Overview weight use profile's UnitSystem. Remove the last of the String channelID references.

This commit is contained in:
Mark Watkins 2011-12-21 15:47:33 +10:00
parent 8198c5b811
commit c96837d5b5
14 changed files with 185 additions and 147 deletions

View File

@ -133,9 +133,6 @@ void SummaryChart::SetDay(Day * nullday)
type==ST_SESSIONS || type==ST_SESSIONS ||
day->settingExists(code) || day->settingExists(code) ||
day->hasData(code,type); day->hasData(code,type);
if (code==PRS1_FlexSet) {
int i=5;
}
if (hascode) { if (hascode) {
m_days[dn]=day; m_days[dn]=day;
@ -620,6 +617,9 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
mx=mx+l_offset;//-86400000L; mx=mx+l_offset;//-86400000L;
int zd=mx/86400000L; int zd=mx/86400000L;
UnitSystem us;
PROFILE["Units"]=="metric" ? us=US_Metric : US_Archiac;
Day * day; Day * day;
//if (hl_day!=zd) // This line is an optimization //if (hl_day!=zd) // This line is an optimization
@ -705,7 +705,10 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
} else { } else {
//if (day && (day->channelExists(m_codes[i]) || day->settingExists(m_codes[i]))) { //if (day && (day->channelExists(m_codes[i]) || day->settingExists(m_codes[i]))) {
schema::Channel & chan=schema::channel[m_codes[i]]; schema::Channel & chan=schema::channel[m_codes[i]];
val=QString::number(d.value()[i+1],'f',2); if (m_codes[i]==Journal_Weight) {
val=weightString(d.value()[i+1],us);
} else
val=QString::number(d.value()[i+1],'f',2);
z+="\r\n"+chan.label()+" "+a+"="+val; z+="\r\n"+chan.label()+" "+a+"="+val;
//} //}
} }

View File

@ -271,12 +271,5 @@ const QString gYAxisTime::Format(EventDataType v, int dp)
const QString gYAxisWeight::Format(EventDataType v, int dp) const QString gYAxisWeight::Format(EventDataType v, int dp)
{ {
if (m_unitsystem==US_Metric) { return weightString(v,m_unitsystem);
return QString("%1kg").arg(v,0,'f',2);
} else if (m_unitsystem==US_Archiac) {
int oz=v / (float)ounce_convert;
int lb=oz / 16;
oz = oz % 16;
return QString("%1lb %2oz").arg(lb).arg(oz);
}
} }

View File

@ -493,9 +493,6 @@ int calcLeaks(Session *session)
if (idx>=med.size()) idx--; if (idx>=med.size()) idx--;
median=tmp-med[idx]; median=tmp-med[idx];
if (median<0) median=0; if (median<0) median=0;
if (median>9999) {
int i=5;
}
leak->AddEvent(ti,median); leak->AddEvent(ti,median);
rpos=rpos % rbsize; rpos=rpos % rbsize;
@ -606,10 +603,10 @@ int calcSPO2Drop(Session *session)
int li=0; int li=0;
// Fix me.. Time scale varies. // Fix me.. Time scale varies.
const unsigned ringsize=30; //const unsigned ringsize=30;
EventDataType ring[ringsize]={0}; //EventDataType ring[ringsize]={0};
qint64 rtime[ringsize]={0}; //qint64 rtime[ringsize]={0};
int rp=0; //int rp=0;
int min; int min;
int cnt=0; int cnt=0;
tmp=0; tmp=0;

37
SleepLib/common.cpp Normal file
View File

@ -0,0 +1,37 @@
/*
SleepLib Common Functions
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL
*/
#include <QDateTime>
#include <QString>
#include "machine_common.h"
qint64 timezoneOffset() {
static bool ok=false;
static qint64 _TZ_offset=0;
if (ok) return _TZ_offset;
QDateTime d1=QDateTime::currentDateTime();
QDateTime d2=d1;
d1.setTimeSpec(Qt::UTC);
_TZ_offset=d2.secsTo(d1);
_TZ_offset*=1000L;
return _TZ_offset;
}
QString weightString(float kg, UnitSystem us)
{
if (us==US_Metric) {
return QString("%1kg").arg(kg,0,'f',2);
} else if (us==US_Archiac) {
int oz=(kg*1000.0) / (float)ounce_convert;
int lb=oz / 16.0;
oz = oz % 16;
return QString("%1lb %2oz").arg(lb,0,10).arg(oz);
}
return("Bad UnitSystem");
}

View File

@ -482,13 +482,13 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp,
session->settings[PRS1_FlexSet]=(int)(data[offset+0x08] & 3); session->settings[PRS1_FlexSet]=(int)(data[offset+0x08] & 3);
session->settings[PRS1_HumidSetting]=(int)data[offset+0x09]&0x0f; session->settings[PRS1_HumidSetting]=(int)data[offset+0x09]&0x0f;
session->settings[PRS1_HumidStatus]=(data[offset+0x09]&0x80)==0x80; session->settings[PRS1_HumidStatus]=(data[offset+0x09]&0x80)==0x80;
session->settings["SysLock"]=(data[offset+0x0a]&0x80)==0x80; session->settings[PRS1_SysLock]=(data[offset+0x0a]&0x80)==0x80;
session->settings["SysOneResistStat"]=(data[offset+0x0a]&0x40)==0x40; session->settings[PRS1_SysOneResistStat]=(data[offset+0x0a]&0x40)==0x40;
session->settings["SysOneResistSet"]=(int)data[offset+0x0a]&7; session->settings[PRS1_SysOneResistSet]=(int)data[offset+0x0a]&7;
session->settings["HoseDiam"]=((data[offset+0x0a]&0x08)?"15mm":"22mm"); session->settings[PRS1_HoseDiam]=((data[offset+0x0a]&0x08)?"15mm":"22mm");
session->settings["AutoOff"]=(data[offset+0x0c]&0x10)==0x10; session->settings[PRS1_AutoOff]=(data[offset+0x0c]&0x10)==0x10;
session->settings["MaskAlert"]=(data[offset+0x0c]&0x08)==0x08; session->settings[PRS1_MaskAlert]=(data[offset+0x0c]&0x08)==0x08;
session->settings["ShowAHI"]=(data[offset+0x0c]&0x04)==0x04; session->settings[PRS1_ShowAHI]=(data[offset+0x0c]&0x04)==0x04;
unsigned duration; unsigned duration;

View File

@ -426,12 +426,12 @@ int ResmedLoader::Open(QString & path,Profile *profile)
// AutoSV machines don't have both fields // AutoSV machines don't have both fields
sig=stredf.lookupSignal("EPR"); sig=stredf.lookupSignal("EPR");
if (sig) { if (sig) {
sess->settings["EPR"]=sig->data[dn]; sess->settings[RMS9_EPR]=sig->data[dn];
} }
sig=stredf.lookupSignal("EPRLevel"); sig=stredf.lookupSignal("EPRLevel");
if (sig) { if (sig) {
sess->settings["EPRSet"]=sig->data[dn]; sess->settings[RMS9_EPRSet]=sig->data[dn];
} }
if (mode==0) { if (mode==0) {

View File

@ -20,21 +20,6 @@
extern QProgressBar * qprogress; extern QProgressBar * qprogress;
qint64 timezoneOffset() {
static bool ok=false;
static qint64 _TZ_offset=0;
if (ok) return _TZ_offset;
QDateTime d1=QDateTime::currentDateTime();
QDateTime d2=d1;
d1.setTimeSpec(Qt::UTC);
_TZ_offset=d2.secsTo(d1);
_TZ_offset*=1000L;
return _TZ_offset;
}
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Machine Base-Class implmementation // Machine Base-Class implmementation
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////

View File

@ -182,10 +182,6 @@ public:
protected: protected:
}; };
// This should probably move somewhere else
//! \fn timezoneOffset();
//! \brief Calculate the timezone Offset in milliseconds between system timezone and UTC
qint64 timezoneOffset();
#endif // MACHINE_H #endif // MACHINE_H

View File

@ -30,6 +30,10 @@ class OldDBVersion {};
const quint32 magic=0xC73216AB; // Magic number for Sleepyhead Data Files.. Don't touch! const quint32 magic=0xC73216AB; // Magic number for Sleepyhead Data Files.. Don't touch!
//const int max_number_event_fields=10; //const int max_number_event_fields=10;
// This should probably move somewhere else
//! \fn timezoneOffset();
//! \brief Calculate the timezone Offset in milliseconds between system timezone and UTC
qint64 timezoneOffset();
/*! \enum SummaryType /*! \enum SummaryType
@ -47,6 +51,7 @@ enum UnitSystem { US_Metric, US_Archiac };
const float ounce_convert=28.3495231; const float ounce_convert=28.3495231;
const float pound_convert=ounce_convert*16; const float pound_convert=ounce_convert*16;
QString weightString(EventDataType kg, UnitSystem us);
/*! \enum CPAPMode /*! \enum CPAPMode
\brief CPAP Machines mode of operation \brief CPAP Machines mode of operation
@ -77,74 +82,90 @@ enum MCDataType
{ MC_bool=0, MC_int, MC_long, MC_float, MC_double, MC_string, MC_datetime }; { MC_bool=0, MC_int, MC_long, MC_float, MC_double, MC_string, MC_datetime };
// This all needs replacing with actual integer codes.. There will likely be a big speedup when this happens again. // This all needs replacing with actual integer codes.. There will likely be a big speedup when this happens again.
const QString CPAP_IPAP="IPAP"; const ChannelID CPAP_IPAP="IPAP";
const QString CPAP_IPAPLo="IPAPLo"; const ChannelID CPAP_IPAPLo="IPAPLo";
const QString CPAP_IPAPHi="IPAPHi"; const ChannelID CPAP_IPAPHi="IPAPHi";
const QString CPAP_EPAP="EPAP"; const ChannelID CPAP_EPAP="EPAP";
const QString CPAP_Pressure="Pressure"; const ChannelID CPAP_Pressure="Pressure";
const QString CPAP_PS="PS"; const ChannelID CPAP_PS="PS";
const QString CPAP_Mode="PAPMode"; const ChannelID CPAP_Mode="PAPMode";
const QString CPAP_BrokenSummary="BrokenSummary"; const ChannelID CPAP_BrokenSummary="BrokenSummary";
const QString CPAP_PressureMin="PressureMin"; const ChannelID CPAP_PressureMin="PressureMin";
const QString CPAP_PressureMax="PressureMax"; const ChannelID CPAP_PressureMax="PressureMax";
const QString CPAP_RampTime="RampTime"; const ChannelID CPAP_RampTime="RampTime";
const QString CPAP_RampPressure="RampPressure"; const ChannelID CPAP_RampPressure="RampPressure";
const QString CPAP_Obstructive="Obstructive"; const ChannelID CPAP_Obstructive="Obstructive";
const QString CPAP_Hypopnea="Hypopnea"; const ChannelID CPAP_Hypopnea="Hypopnea";
const QString CPAP_ClearAirway="ClearAirway"; const ChannelID CPAP_ClearAirway="ClearAirway";
const QString CPAP_Apnea="Apnea"; const ChannelID CPAP_Apnea="Apnea";
const QString CPAP_CSR="CSR"; const ChannelID CPAP_CSR="CSR";
const QString CPAP_LeakFlag="LeakFlag"; const ChannelID CPAP_LeakFlag="LeakFlag";
const QString CPAP_ExP="ExP"; const ChannelID CPAP_ExP="ExP";
const QString CPAP_NRI="NRI"; const ChannelID CPAP_NRI="NRI";
const QString CPAP_VSnore="VSnore"; const ChannelID CPAP_VSnore="VSnore";
const QString CPAP_VSnore2="VSnore2"; const ChannelID CPAP_VSnore2="VSnore2";
const QString CPAP_RERA="RERA"; const ChannelID CPAP_RERA="RERA";
const QString CPAP_PressurePulse="PressurePulse"; const ChannelID CPAP_PressurePulse="PressurePulse";
const QString CPAP_FlowLimit="FlowLimit"; const ChannelID CPAP_FlowLimit="FlowLimit";
const QString CPAP_FlowRate="FlowRate"; const ChannelID CPAP_FlowRate="FlowRate";
const QString CPAP_MaskPressure="MaskPressure"; const ChannelID CPAP_MaskPressure="MaskPressure";
const QString CPAP_MaskPressureHi="MaskPressureHi"; const ChannelID CPAP_MaskPressureHi="MaskPressureHi";
const QString CPAP_RespEvent="RespEvent"; const ChannelID CPAP_RespEvent="RespEvent";
const QString CPAP_Snore="Snore"; const ChannelID CPAP_Snore="Snore";
const QString CPAP_MinuteVent="MinuteVent"; const ChannelID CPAP_MinuteVent="MinuteVent";
const QString CPAP_RespRate="RespRate"; const ChannelID CPAP_RespRate="RespRate";
const QString CPAP_TidalVolume="TidalVolume"; const ChannelID CPAP_TidalVolume="TidalVolume";
const QString CPAP_PTB="PTB"; const ChannelID CPAP_PTB="PTB";
const QString CPAP_Leak="Leak"; const ChannelID CPAP_Leak="Leak";
const QString CPAP_LeakMedian="LeakMedian"; const ChannelID CPAP_LeakMedian="LeakMedian";
const QString CPAP_LeakTotal="LeakTotal"; const ChannelID CPAP_LeakTotal="LeakTotal";
const QString CPAP_MaxLeak="MaxLeak"; const ChannelID CPAP_MaxLeak="MaxLeak";
const QString CPAP_FLG="FLG"; const ChannelID CPAP_FLG="FLG";
const QString CPAP_IE="IE"; const ChannelID CPAP_IE="IE";
const QString CPAP_Te="Te"; const ChannelID CPAP_Te="Te";
const QString CPAP_Ti="Ti"; const ChannelID CPAP_Ti="Ti";
const QString CPAP_TgMV="TgMV"; const ChannelID CPAP_TgMV="TgMV";
const QString RMS9_E01="RMS9_E01"; const ChannelID RMS9_E01="RMS9_E01";
const QString RMS9_E02="RMS9_E02"; const ChannelID RMS9_E02="RMS9_E02";
const QString PRS1_00="PRS1_00"; const ChannelID RMS9_EPR="EPR";
const QString PRS1_01="PRS1_01"; const ChannelID RMS9_EPRSet="EPRSet";
const QString PRS1_08="PRS1_08"; const ChannelID PRS1_00="PRS1_00";
const QString PRS1_0A="PRS1_0A"; const ChannelID PRS1_01="PRS1_01";
const QString PRS1_0B="PRS1_0B"; const ChannelID PRS1_08="PRS1_08";
const QString PRS1_0C="PRS1_0C"; const ChannelID PRS1_0A="PRS1_0A";
const QString PRS1_0E="PRS1_0E"; const ChannelID PRS1_0B="PRS1_0B";
const QString PRS1_0F="PRS1_0F"; const ChannelID PRS1_0C="PRS1_0C";
const QString PRS1_10="PRS1_10"; const ChannelID PRS1_0E="PRS1_0E";
const QString PRS1_12="PRS1_12"; const ChannelID PRS1_0F="PRS1_0F";
const QString PRS1_FlexMode="FlexMode"; const ChannelID PRS1_10="PRS1_10";
const QString PRS1_FlexSet="FlexSet"; const ChannelID PRS1_12="PRS1_12";
const QString PRS1_HumidStatus="HumidStat"; const ChannelID PRS1_FlexMode="FlexMode";
const QString PRS1_HumidSetting="HumidSet"; const ChannelID PRS1_FlexSet="FlexSet";
const ChannelID PRS1_HumidStatus="HumidStat";
const ChannelID PRS1_HumidSetting="HumidSet";
const ChannelID PRS1_SysLock="SysLock";
const ChannelID PRS1_SysOneResistStat="SysOneResistStat";
const ChannelID PRS1_SysOneResistSet="SysOneResistSet";
const ChannelID PRS1_HoseDiam="HoseDiam";
const ChannelID PRS1_AutoOn="AutoOn";
const ChannelID PRS1_AutoOff="AutoOff";
const ChannelID PRS1_MaskAlert="MaskAlert";
const ChannelID PRS1_ShowAHI="ShowAHI";
const QString OXI_Pulse="Pulse";
const QString OXI_SPO2="SPO2";
const QString OXI_PulseChange="PulseChange";
const QString OXI_SPO2Drop="SPO2Drop";
const QString OXI_Plethy="Plethy";
const QString CPAP_AHI="AHI"; const ChannelID OXI_Pulse="Pulse";
const QString Journal_Notes="Journal"; const ChannelID OXI_SPO2="SPO2";
const ChannelID OXI_PulseChange="PulseChange";
const ChannelID OXI_SPO2Drop="SPO2Drop";
const ChannelID OXI_Plethy="Plethy";
const ChannelID CPAP_AHI="AHI";
const ChannelID Journal_Notes="Journal";
const ChannelID Journal_Weight="Weight";
const ChannelID Journal_BMI="BMI";
const ChannelID Journal_ZombieMeter="ZombieMeter";
const ChannelID Bookmark_Start="BookmarkStart";
const ChannelID Bookmark_End="BookmarkEnd";
const ChannelID Bookmark_Notes="BookmarkNotes";
#endif // MACHINE_COMMON_H #endif // MACHINE_COMMON_H

View File

@ -78,7 +78,8 @@ SOURCES += main.cpp\
quazip/quaadler32.cpp \ quazip/quaadler32.cpp \
quazip/qioapi.cpp \ quazip/qioapi.cpp \
quazip/JlCompress.cpp \ quazip/JlCompress.cpp \
UpdaterWindow.cpp UpdaterWindow.cpp \
SleepLib/common.cpp
unix:SOURCES += qextserialport/posix_qextserialport.cpp unix:SOURCES += qextserialport/posix_qextserialport.cpp
unix:!macx:SOURCES += qextserialport/qextserialenumerator_unix.cpp unix:!macx:SOURCES += qextserialport/qextserialenumerator_unix.cpp

View File

@ -957,8 +957,8 @@ void Daily::Load(QDate date)
if (journal->settings.contains(Journal_Notes)) if (journal->settings.contains(Journal_Notes))
ui->JournalNotes->setHtml(journal->settings[Journal_Notes].toString()); ui->JournalNotes->setHtml(journal->settings[Journal_Notes].toString());
if (journal->settings.contains("Weight")) { if (journal->settings.contains(Journal_Weight)) {
double kg=journal->settings["Weight"].toDouble(&ok); double kg=journal->settings[Journal_Weight].toDouble(&ok);
if (PROFILE["Units"].toString()=="metric") { if (PROFILE["Units"].toString()=="metric") {
ui->weightSpinBox->setDecimals(3); ui->weightSpinBox->setDecimals(3);
ui->weightSpinBox->blockSignals(true); ui->weightSpinBox->blockSignals(true);
@ -993,16 +993,16 @@ void Daily::Load(QDate date)
} }
} }
if (journal->settings.contains("ZombieMeter")) { if (journal->settings.contains(Journal_ZombieMeter)) {
ui->ZombieMeter->blockSignals(true); ui->ZombieMeter->blockSignals(true);
ui->ZombieMeter->setValue(journal->settings["ZombieMeter"].toDouble(&ok)); ui->ZombieMeter->setValue(journal->settings[Journal_ZombieMeter].toDouble(&ok));
ui->ZombieMeter->blockSignals(false); ui->ZombieMeter->blockSignals(false);
} }
if (journal->settings.contains("BookmarkStart")) { if (journal->settings.contains(Bookmark_Start)) {
QVariantList start=journal->settings["BookmarkStart"].toList(); QVariantList start=journal->settings[Bookmark_Start].toList();
QVariantList end=journal->settings["BookmarkEnd"].toList(); QVariantList end=journal->settings[Bookmark_End].toList();
QStringList notes=journal->settings["BookmarkNotes"].toStringList(); QStringList notes=journal->settings[Bookmark_Notes].toStringList();
ui->bookmarkTable->blockSignals(true); ui->bookmarkTable->blockSignals(true);
@ -1402,9 +1402,9 @@ void Daily::update_Bookmarks()
journal=CreateJournalSession(previous_date); journal=CreateJournalSession(previous_date);
} }
journal->settings["BookmarkStart"]=start; journal->settings[Bookmark_Start]=start;
journal->settings["BookmarkEnd"]=end; journal->settings[Bookmark_End]=end;
journal->settings["BookmarkNotes"]=notes; journal->settings[Bookmark_Notes]=notes;
journal->SetChanged(true); journal->SetChanged(true);
BookmarksChanged=true; BookmarksChanged=true;
} }
@ -1427,7 +1427,7 @@ void Daily::on_ZombieMeter_valueChanged(int action)
if (!journal) { if (!journal) {
journal=CreateJournalSession(previous_date); journal=CreateJournalSession(previous_date);
} }
journal->settings["ZombieMeter"]=ui->ZombieMeter->value(); journal->settings[Journal_ZombieMeter]=ui->ZombieMeter->value();
journal->SetChanged(true); journal->SetChanged(true);
gGraph *g; gGraph *g;
@ -1458,20 +1458,20 @@ void Daily::on_weightSpinBox_valueChanged(double arg1)
else { else {
kg=(arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert); kg=(arg1*pound_convert) + (ui->ouncesSpinBox->value()*ounce_convert);
} }
journal->settings["Weight"]=kg; journal->settings[Journal_Weight]=kg;
gGraphView *gv=mainwin->getOverview()->graphView(); gGraphView *gv=mainwin->getOverview()->graphView();
gGraph *g; gGraph *g;
if (gv) { if (gv) {
g=gv->findGraph("Weight"); g=gv->findGraph(tr("Weight"));
if (g) g->setDay(NULL); if (g) g->setDay(NULL);
} }
if ((height>0) && (kg>0)) { if ((height>0) && (kg>0)) {
double bmi=kg/(height * height); double bmi=kg/(height * height);
ui->BMI->display(bmi); ui->BMI->display(bmi);
ui->BMI->setVisible(true); ui->BMI->setVisible(true);
journal->settings["BMI"]=bmi; journal->settings[Journal_BMI]=bmi;
if (gv) { if (gv) {
g=gv->findGraph("BMI"); g=gv->findGraph(tr("BMI"));
if (g) g->setDay(NULL); if (g) g->setDay(NULL);
} }
} }
@ -1486,12 +1486,12 @@ void Daily::on_ouncesSpinBox_valueChanged(int arg1)
} }
double height=PROFILE["Height"].toDouble(&ok)/100.0; double height=PROFILE["Height"].toDouble(&ok)/100.0;
double kg=(ui->weightSpinBox->value()*pound_convert) + (arg1*ounce_convert); double kg=(ui->weightSpinBox->value()*pound_convert) + (arg1*ounce_convert);
journal->settings["Weight"]=kg; journal->settings[Journal_Weight]=kg;
gGraph *g; gGraph *g;
if (mainwin->getOverview()) { if (mainwin->getOverview()) {
g=mainwin->getOverview()->graphView()->findGraph("Weight"); g=mainwin->getOverview()->graphView()->findGraph(tr("Weight"));
if (g) g->setDay(NULL); if (g) g->setDay(NULL);
} }
@ -1500,9 +1500,9 @@ void Daily::on_ouncesSpinBox_valueChanged(int arg1)
ui->BMI->display(bmi); ui->BMI->display(bmi);
ui->BMI->setVisible(true); ui->BMI->setVisible(true);
journal->settings["BMI"]=bmi; journal->settings[Journal_BMI]=bmi;
if (mainwin->getOverview()) { if (mainwin->getOverview()) {
g=mainwin->getOverview()->graphView()->findGraph("BMI"); g=mainwin->getOverview()->graphView()->findGraph(tr("BMI"));
if (g) g->setDay(NULL); if (g) g->setDay(NULL);
} }
} }

View File

@ -90,9 +90,11 @@ One id code per item
<channel id="0x0802" class="data" name="Glucose" details="Blood Glucose" label="BGL" unit="mmol/L" color="black"/> <channel id="0x0802" class="data" name="Glucose" details="Blood Glucose" label="BGL" unit="mmol/L" color="black"/>
<channel id="0x0803" class="data" scope="!day" name="Weight" details="Weight" label="Weight" unit="Kg" color="black"/> <channel id="0x0803" class="data" scope="!day" name="Weight" details="Weight" label="Weight" unit="Kg" color="black"/>
<channel id="0x0804" class="data" scope="!day" name="Height" details="Height" label="Height" unit="cm" color="blue"/> <channel id="0x0804" class="data" scope="!day" name="Height" details="Height" label="Height" unit="cm" color="blue"/>
<channel id="0x0805" class="data" name="Bookmark" details="Session Bookmark" label="Bookmark" unit="duration" color="orange"/> <channel id="0x0805" class="data" name="BookmarkNotes" details="Session Bookmark Notes" label="Bookmark Notes" unit="text" color="orange"/>
<channel id="0x0806" class="data" name="BMI" details="Body Mass Index" label="BMI" unit="kg/m2" color="orange"/> <channel id="0x0806" class="data" name="BMI" details="Body Mass Index" label="BMI" unit="kg/m2" color="orange"/>
<channel id="0x0807" class="data" name="ZombieMeter" details="How good you feel." label="Alive" unit="0-10" color="orange"/> <channel id="0x0807" class="data" name="ZombieMeter" details="How good you feel." label="Alive" unit="0-10" color="orange"/>
<channel id="0x0808" class="data" name="BookmarkStart" details="Session Bookmark Start" label="Bookmark Start" unit="duration" color="orange"/>
<channel id="0x0809" class="data" name="BookmarkEnd" details="Session Bookmark End" label="Bookmark End" unit="duration" color="orange"/>
<channel id="0xd000" class="data" scope="!day" unique="true" name="Journal" details="Journal Notes" label="Journal" type="richtext"/> <channel id="0xd000" class="data" scope="!day" unique="true" name="Journal" details="Journal Notes" label="Journal" type="richtext"/>
</group> </group>
<group name="PRS1"> <group name="PRS1">

View File

@ -665,7 +665,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
int visgraphs=gv->visibleGraphs(); int visgraphs=gv->visibleGraphs();
if (visgraphs==0) { if (visgraphs==0) {
Notify("There are no graphs visible to print"); Notify(tr("There are no graphs visible to print"));
return; return;
} }
@ -675,10 +675,10 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
if (name=="Daily") { if (name=="Daily") {
QVariantList book_start; QVariantList book_start;
journal=getDaily()->GetJournalSession(getDaily()->getDate()); journal=getDaily()->GetJournalSession(getDaily()->getDate());
if (journal && journal->settings.contains("BookmarkStart")) { if (journal && journal->settings.contains(Bookmark_Start)) {
book_start=journal->settings["BookmarkStart"].toList(); book_start=journal->settings[Bookmark_Start].toList();
if (book_start.size()>0) { if (book_start.size()>0) {
if (QMessageBox::question(this,"Bookmarks","Would you like to show bookmarked areas in this report?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { if (QMessageBox::question(this,tr("Bookmarks"),tr("Would you like to show bookmarked areas in this report?"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) {
print_bookmarks=true; print_bookmarks=true;
} }
} }
@ -913,10 +913,10 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
graphs.push_back(g); graphs.push_back(g);
labels.push_back(tr("Current Selection")); labels.push_back(tr("Current Selection"));
if (journal) { if (journal) {
if (journal->settings.contains("BookmarkStart")) { if (journal->settings.contains(Bookmark_Start)) {
QVariantList st1=journal->settings["BookmarkStart"].toList(); QVariantList st1=journal->settings[Bookmark_Start].toList();
QVariantList et1=journal->settings["BookmarkEnd"].toList(); QVariantList et1=journal->settings[Bookmark_End].toList();
QStringList notes=journal->settings["BookmarkNotes"].toStringList(); QStringList notes=journal->settings[Bookmark_Notes].toStringList();
for (int i=0;i<notes.size();i++) { for (int i=0;i<notes.size();i++) {
labels.push_back(notes.at(i)); labels.push_back(notes.at(i));
start.push_back(st1.at(i).toLongLong()); start.push_back(st1.at(i).toLongLong());

View File

@ -107,6 +107,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
SES=createGraph(tr("Sessions"),tr("Sessions\n(count)")); SES=createGraph(tr("Sessions"),tr("Sessions\n(count)"));
PULSE=createGraph(tr("Pulse Rate"),tr("Pulse Rate\n(bpm)")); PULSE=createGraph(tr("Pulse Rate"),tr("Pulse Rate\n(bpm)"));
SPO2=createGraph(tr("SpO2"),tr("Oxygen Saturation\n(%)")); SPO2=createGraph(tr("SpO2"),tr("Oxygen Saturation\n(%)"));
WEIGHT=createGraph(tr("Weight"),tr("Weight\n(kg)"),YT_Weight); WEIGHT=createGraph(tr("Weight"),tr("Weight\n(kg)"),YT_Weight);
BMI=createGraph(tr("BMI"),tr("Body\nMass\nIndex")); BMI=createGraph(tr("BMI"),tr("Body\nMass\nIndex"));
ZOMBIE=createGraph(tr("Zombie"),tr("How you felt\n(0-10)")); ZOMBIE=createGraph(tr("Zombie"),tr("How you felt\n(0-10)"));
@ -118,17 +119,17 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
weight=new SummaryChart(tr("Weight"),GT_LINE); weight=new SummaryChart(tr("Weight"),GT_LINE);
weight->setMachineType(MT_JOURNAL); weight->setMachineType(MT_JOURNAL);
weight->addSlice("Weight",QColor("black"),ST_SETAVG,true); weight->addSlice(Journal_Weight,QColor("black"),ST_SETAVG,true);
WEIGHT->AddLayer(weight); WEIGHT->AddLayer(weight);
bmi=new SummaryChart(tr("BMI"),GT_LINE); bmi=new SummaryChart(tr("BMI"),GT_LINE);
bmi->setMachineType(MT_JOURNAL); bmi->setMachineType(MT_JOURNAL);
bmi->addSlice("BMI",QColor("dark blue"),ST_SETAVG,true); bmi->addSlice(Journal_BMI,QColor("dark blue"),ST_SETAVG,true);
BMI->AddLayer(bmi); BMI->AddLayer(bmi);
zombie=new SummaryChart(tr("Zombie Meter"),GT_LINE); zombie=new SummaryChart(tr("Zombie Meter"),GT_LINE);
zombie->setMachineType(MT_JOURNAL); zombie->setMachineType(MT_JOURNAL);
zombie->addSlice("ZombieMeter",QColor("dark red"),ST_SETAVG,true); zombie->addSlice(Journal_ZombieMeter,QColor("dark red"),ST_SETAVG,true);
ZOMBIE->AddLayer(zombie); ZOMBIE->AddLayer(zombie);
pulse=new SummaryChart(tr("Pulse Rate"),GT_LINE); pulse=new SummaryChart(tr("Pulse Rate"),GT_LINE);
@ -242,7 +243,9 @@ gGraph * Overview::createGraph(QString name,QString units, YTickerType yttype)
yt=new gYAxisTime(true); // Time scale yt=new gYAxisTime(true); // Time scale
break; break;
case YT_Weight: case YT_Weight:
yt=new gYAxisWeight(US_Archiac); // Weight scale, which adjusts for UnitSystem if (PROFILE["Units"].toString()=="metric") {
yt=new gYAxisWeight(US_Metric);
} else yt=new gYAxisWeight(US_Archiac);
break; break;
default: default:
yt=new gYAxis(); // Plain numeric scale yt=new gYAxis(); // Plain numeric scale