Compiler warning cleanup

This commit is contained in:
Mark Watkins 2011-07-01 20:10:44 +10:00
parent ed686a7f2c
commit 28b6171f60
22 changed files with 223 additions and 226 deletions

View File

@ -1,8 +1,8 @@
/******************************************************************** /*
gBarChart Implementation gBarChart Implementation
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net> Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL License: GPL
*********************************************************************/ */
#include <math.h> #include <math.h>
#include <SleepLib/profiles.h> #include <SleepLib/profiles.h>

View File

@ -6,6 +6,7 @@
#include <math.h> #include <math.h>
#include <QString> #include <QString>
#include <QDebug>
#include <SleepLib/profiles.h> #include <SleepLib/profiles.h>
#include "gLineChart.h" #include "gLineChart.h"
@ -78,7 +79,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
} }
bool accel=m_accelerate; bool accel=m_accelerate;
double sfit,sr; double sr;
int dp,sam; int dp,sam;
QColor & col=color[0]; QColor & col=color[0];
@ -116,7 +117,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
point[siz-1]=t; point[siz-1]=t;
x0=point[0].x(); x0=point[0].x();
} else { } else {
qDebug("Reversed order sample fed to gLineChart - ignored."); qDebug() << "Reversed order sample fed to gLineChart - ignored.";
continue; continue;
//assert(x1<x2); //assert(x1<x2);
} }
@ -129,9 +130,9 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
// if (accel) { // if (accel) {
sr=x1-x0; // Time distance between samples sr=x1-x0; // Time distance between samples
assert(sr>0); assert(sr>0);
double qx=xL-x0; // Full time range of this segment // double qx=xL-x0; // Full time range of this segment
double gx=xx/qx; // ratio of how much of the whole data set this represents //double gx=xx/qx; // ratio of how much of the whole data set this represents
double segwidth=width*gx; //double segwidth=width*gx;
double XR=xx/sr; double XR=xx/sr;
double Z1=MAX(x0,minx); double Z1=MAX(x0,minx);
double Z2=MIN(xL,maxx); double Z2=MIN(xL,maxx);
@ -248,7 +249,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
// In accel mode, each pixel has a min/max Y value. // In accel mode, each pixel has a min/max Y value.
// m_drawlist's index is the pixel index for the X pixel axis. // m_drawlist's index is the pixel index for the X pixel axis.
float zz=(maxy-miny)/2.0; // centreline //float zz=(maxy-miny)/2.0; // centreline
float jy=point[i].y(); float jy=point[i].y();
int y1=1+(jy-miny)*ymult; int y1=1+(jy-miny)*ymult;

View File

@ -75,8 +75,8 @@ void gLineOverlayBar::Plot(gGraphWindow & w,float scrx,float scry)
// bool done=false; // bool done=false;
for (int i=0;i<data->np[n];i++) { for (int i=0;i<data->np[n];i++) {
QPointD & rp=data->point[n][i]; QPointD & rp=data->point[n][i];
float X=rp.x(); //float X=rp.x();
float Y=rp.y(); //float Y=rp.y();
if (rp.y() < w.min_x) continue; if (rp.y() < w.min_x) continue;
if (rp.x() > w.max_x) break; if (rp.x() > w.max_x) break;

View File

@ -6,6 +6,7 @@
#include <QApplication> #include <QApplication>
#include <QFontMetrics> #include <QFontMetrics>
#include <QDebug>
#include <math.h> #include <math.h>
#include "glcommon.h" #include "glcommon.h"
#include "SleepLib/profiles.h" #include "SleepLib/profiles.h"
@ -62,7 +63,7 @@ void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QCol
//int a=fm.overlinePos(); //ascent(); //int a=fm.overlinePos(); //ascent();
//LinedRoundedRectangle(x,wid.GetScrY()-y,w,h,0,1,QColor("black")); //LinedRoundedRectangle(x,wid.GetScrY()-y,w,h,0,1,QColor("black"));
if (!font) { if (!font) {
qDebug("Font Problem. Forgot to call GraphInit() ?"); qDebug() << "Font Problem. Forgot to call GraphInit() ?";
abort(); abort();
return; return;
} }
@ -72,7 +73,7 @@ void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QCol
glFlush(); glFlush();
QPainter painter(&wid); QPainter painter(&wid);
painter.setFont(*font); painter.setFont(*font);
painter.setPen(Qt::black); painter.setPen(color);
painter.setOpacity(1); painter.setOpacity(1);
// painter.setCompositionMode(QPainter::CompositionMode_); // painter.setCompositionMode(QPainter::CompositionMode_);
if (angle==0) { if (angle==0) {

View File

@ -31,9 +31,9 @@ void WaveData::Reload(Day *day)
} }
max_y=0; max_y=0;
bool first=true; bool first=true;
int chunk=0; // int chunk=0;
for (vector<Session *>::iterator s=day->begin();s!=day->end(); s++) { for (vector<Session *>::iterator s=day->begin();s!=day->end(); s++) {
//qDebug("Processing waveform chunk %i",chunk++); //qDebug() << "Processing waveform chunk " << chunk++;
if ((*s)->waveforms.find(code)==(*s)->waveforms.end()) continue; if ((*s)->waveforms.find(code)==(*s)->waveforms.end()) continue;
for (vector<Waveform *>::iterator l=(*s)->waveforms[code].begin();l!=(*s)->waveforms[code].end();l++) { for (vector<Waveform *>::iterator l=(*s)->waveforms[code].begin();l!=(*s)->waveforms[code].end();l++) {
int ps=point.size(); int ps=point.size();
@ -45,7 +45,7 @@ void WaveData::Reload(Day *day)
Waveform *w=(*l); Waveform *w=(*l);
double st=w->start().toMSecsSinceEpoch()/86400000.0; double st=w->start().toMSecsSinceEpoch()/86400000.0;
double rate=(w->duration()/w->samples())/86400.0; double rate=(w->duration()/w->samples())/86400.0;
//qDebug("Waveform Chunk contains %i samples",w->samples()); //qDebug() << "Waveform Chunk contains " << w->samples() << " samples";
for (int i=0;i<w->samples();i++) { for (int i=0;i<w->samples();i++) {
QPointD r(st,(*w)[i]); QPointD r(st,(*w)[i]);
st+=rate; st+=rate;
@ -117,8 +117,8 @@ void EventData::Reload(Day *day)
min_x=day->first().toMSecsSinceEpoch()/86400000.0; min_x=day->first().toMSecsSinceEpoch()/86400000.0;
max_x=day->last().toMSecsSinceEpoch()/86400000.0; max_x=day->last().toMSecsSinceEpoch()/86400000.0;
if (min_x>max_x) { if (min_x>max_x) {
int a=5; //int a=5;
//assert(min_x<max_x); assert(min_x<max_x);
} }
min_y=max_y=0; min_y=max_y=0;
int tt=0; int tt=0;
@ -227,10 +227,6 @@ void TAPData::Reload(Day *day)
double d=last.msecsTo(ev.time())/1000.0; double d=last.msecsTo(ev.time())/1000.0;
assert(lastval<max_slots); assert(lastval<max_slots);
if (lastval>max_slots) {
int i=0;
// throw BoundsError();
}
pTime[lastval]+=d; pTime[lastval]+=d;
} }
cnt++; cnt++;
@ -382,6 +378,7 @@ double HistoryData::Calc(Day *day)
void HistoryData::Reload(Day *day) void HistoryData::Reload(Day *day)
{ {
day=day; //shuttup warnings..
QDateTime date; QDateTime date;
vc=0; vc=0;
int i=0; int i=0;

View File

@ -23,9 +23,9 @@ gLayer::~gLayer()
} }
void gLayer::Plot(gGraphWindow & w,float scrx,float scry) //void gLayer::Plot(gGraphWindow & w,float scrx,float scry)
{ //{
} //}
void gLayer::DataChanged(gGraphData *src) void gLayer::DataChanged(gGraphData *src)
{ {

View File

@ -20,7 +20,7 @@ class gLayer
public: public:
gLayer(gPointData *g=NULL,QString title=""); gLayer(gPointData *g=NULL,QString title="");
virtual ~gLayer(); virtual ~gLayer();
virtual void Plot(gGraphWindow & w,float scrx,float scry); virtual void Plot(gGraphWindow & w,float scrx,float scry)=0;
vector<QColor> color; vector<QColor> color;
virtual void SetData(gPointData * gd);; virtual void SetData(gPointData * gd);;

View File

@ -17,6 +17,7 @@ License: GPL
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QDebug>
#include <list> #include <list>
using namespace std; using namespace std;
@ -169,7 +170,7 @@ bool CMS50Loader::OpenSPORFile(QString path,Machine *mach,Profile *profile)
date.setDate(d2); date.setDate(d2);
} }
if (!date.isValid()) { if (!date.isValid()) {
qDebug("Invalid date time retreieved in CMS50::OpenSPORFile"); qDebug() << "Invalid date time retreieved in CMS50::OpenSPORFile";
return false; return false;
} }
@ -178,7 +179,7 @@ bool CMS50Loader::OpenSPORFile(QString path,Machine *mach,Profile *profile)
buffer=new char [num_records]; buffer=new char [num_records];
br=f.read(buffer,num_records); br=f.read(buffer,num_records);
if (br!=num_records) { if (br!=num_records) {
qDebug(("Short .spoR File: "+path).toLatin1()); qDebug() << "Short .spoR File: " << path;
delete [] buffer; delete [] buffer;
return false; return false;
} }
@ -280,7 +281,7 @@ Machine *CMS50Loader::CreateMachine(Profile *profile)
} }
} }
qDebug("Create CMS50 Machine Record"); qDebug() << "Create CMS50 Machine Record";
Machine *m=new Oximeter(profile,0); Machine *m=new Oximeter(profile,0);
m->SetClass(cms50_class_name); m->SetClass(cms50_class_name);
@ -301,7 +302,7 @@ static bool cms50_initialized=false;
void CMS50Loader::Register() void CMS50Loader::Register()
{ {
if (cms50_initialized) return; if (cms50_initialized) return;
qDebug("Registering CMS50Loader"); qDebug() << "Registering CMS50Loader";
RegisterLoader(new CMS50Loader()); RegisterLoader(new CMS50Loader());
//InitModelMap(); //InitModelMap();
cms50_initialized=true; cms50_initialized=true;

View File

@ -12,6 +12,7 @@ License: GPL
#include <QFile> #include <QFile>
#include <QMessageBox> #include <QMessageBox>
#include <QProgressBar> #include <QProgressBar>
#include <QDebug>
#include "prs1_loader.h" #include "prs1_loader.h"
#include "SleepLib/session.h" #include "SleepLib/session.h"
@ -56,7 +57,7 @@ PRS1Loader::~PRS1Loader()
} }
Machine *PRS1Loader::CreateMachine(QString serial,Profile *profile) Machine *PRS1Loader::CreateMachine(QString serial,Profile *profile)
{ {
qDebug(("Create Machine "+serial).toLatin1()); qDebug() << "Create Machine " << serial;
assert(profile!=NULL); assert(profile!=NULL);
vector<Machine *> ml=profile->GetMachines(MT_CPAP); vector<Machine *> ml=profile->GetMachines(MT_CPAP);
@ -102,7 +103,7 @@ bool PRS1Loader::Open(QString & path,Profile *profile)
if ((!dir.exists() || !dir.isReadable())) if ((!dir.exists() || !dir.isReadable()))
return 0; return 0;
qDebug(("PRS1Loader::Open newpath="+newpath).toLatin1()); qDebug() << "PRS1Loader::Open newpath=" << newpath;
dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks); dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name); dir.setSorting(QDir::Name);
QFileInfoList flist=dir.entryInfoList(); QFileInfoList flist=dir.entryInfoList();
@ -121,11 +122,11 @@ bool PRS1Loader::Open(QString & path,Profile *profile)
QString file=fi.canonicalFilePath(); QString file=fi.canonicalFilePath();
QFile f(file); QFile f(file);
if (!fi.isReadable()) { if (!fi.isReadable()) {
qDebug("PRS1Loader: last.txt exists but I couldn't read it!"); qDebug() << "PRS1Loader: last.txt exists but I couldn't read it!";
continue; continue;
} }
if (!f.open(QIODevice::ReadOnly)) { if (!f.open(QIODevice::ReadOnly)) {
qDebug("PRS1Loader: last.txt exists but I couldn't open it!"); qDebug() << "PRS1Loader: last.txt exists but I couldn't open it!";
continue; continue;
} }
last=f.readLine(64); last=f.readLine(64);
@ -183,7 +184,7 @@ bool PRS1Loader::ParseProperties(Machine *m,QString filename)
} }
} }
if (prop["SerialNumber"]!=m->properties["Serial"]) { if (prop["SerialNumber"]!=m->properties["Serial"]) {
qDebug("Serial Number in PRS1 properties.txt doesn't match directory structure"); qDebug() << "Serial Number in PRS1 properties.txt doesn't match directory structure";
} else prop.erase("SerialNumber"); // already got it stored. } else prop.erase("SerialNumber"); // already got it stored.
for (map<QString,QString>::iterator i=prop.begin(); i!=prop.end(); i++) { for (map<QString,QString>::iterator i=prop.begin(); i!=prop.end(); i++) {
@ -197,7 +198,7 @@ bool PRS1Loader::ParseProperties(Machine *m,QString filename)
int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile) int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
{ {
qDebug(("Opening PRS1 "+path).toLatin1()); qDebug() << "Opening PRS1 " << path;
QDir dir(path); QDir dir(path);
if (!dir.exists() || (!dir.isReadable())) if (!dir.exists() || (!dir.isReadable()))
return false; return false;
@ -277,22 +278,20 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
Session *sess=new Session(m,session); Session *sess=new Session(m,session);
if (!OpenSummary(sess,s->second[0])) { if (!OpenSummary(sess,s->second[0])) {
qWarning(("PRS1Loader: Could'nt open summary file "+s->second[0]).toLatin1()); qWarning() << "PRS1Loader: Could'nt open summary file " << s->second[0];
delete sess; delete sess;
continue; continue;
} }
//wxLogMessage(sess->first().Format(wxT("%Y-%m-%d %H:%M:%S"))+wxT(" ")+sess->last().Format(wxT("%Y-%m-%d %H:%M:%S")));
//sess->SetSessionID(sess->start().GetTicks()); //sess->SetSessionID(sess->start().GetTicks());
if (!s->second[1].isEmpty()) { if (!s->second[1].isEmpty()) {
if (!OpenEvents(sess,s->second[1])) { if (!OpenEvents(sess,s->second[1])) {
qWarning(("PRS1Loader: Couldn't open event file "+s->second[1]).toLatin1()); qWarning() << "PRS1Loader: Couldn't open event file " << s->second[1];
} }
} }
if (!s->second[2].isEmpty()) { if (!s->second[2].isEmpty()) {
if (!OpenWaveforms(sess,s->second[2])) { if (!OpenWaveforms(sess,s->second[2])) {
qWarning(("PRS1Loader: Couldn't open event file "+s->second[2]).toLatin1()); qWarning() << "PRS1Loader: Couldn't open event file " << s->second[2];
} }
} }
const double ignore_thresh=300.0/3600.0;// Ignore useless sessions under 5 minute const double ignore_thresh=300.0/3600.0;// Ignore useless sessions under 5 minute
@ -383,7 +382,7 @@ bool PRS1Loader::OpenSummary(Session *session,QString filename)
unsigned char header[24]; unsigned char header[24];
unsigned char ext,sum; unsigned char ext,sum;
//qDebug("Opening PRS1 Summary %s",filename); //qDebug() << "Opening PRS1 Summary " << filename;
QFile f(filename); QFile f(filename);
//,wxT("rb")); //,wxT("rb"));
if (!f.open(QIODevice::ReadOnly)) if (!f.open(QIODevice::ReadOnly))
@ -417,13 +416,12 @@ bool PRS1Loader::OpenSummary(Session *session,QString filename)
return false; return false;
if (size<=19) { if (size<=19) {
qDebug(("Ignoring short session file "+filename).toLatin1()); qDebug() << "Ignoring short session file " << filename;
return false; return false;
} }
QDateTime date=QDateTime::fromTime_t(timestamp); QDateTime date=QDateTime::fromTime_t(timestamp);
//QDateTime tmpdate=date; //QDateTime tmpdate=date;
//qDebug(date.Format()+wxT(" UTC=")+tmpdate.Format());
//int ticks=date.GetTicks(); //int ticks=date.GetTicks();
if (!date.isValid()) if (!date.isValid())
@ -473,7 +471,7 @@ bool PRS1Loader::OpenSummary(Session *session,QString filename)
quint16 bb=*(quint16*)b; quint16 bb=*(quint16*)b;
unsigned duration=bb;// | (buffer[0x15] << 8); unsigned duration=bb;// | (buffer[0x15] << 8);
session->summary[CPAP_Duration]=(int)duration; session->summary[CPAP_Duration]=(int)duration;
//qDebug("ID: %i %i",session->session(),duration)); //qDebug() << "ID: " << session->session() << " " << duration;
float hours=float(duration)/3600.0; float hours=float(duration)/3600.0;
session->set_hours(hours); session->set_hours(hours);
@ -767,13 +765,10 @@ bool PRS1Loader::OpenWaveforms(Session *session,QString filename)
if (min>c) min=c; if (min>c) min=c;
if (max<c) max=c; if (max<c) max=c;
} }
//wxLogMessage(wxT("Samples Per Breath: ")+QString::Format(wxT("%.2f"),double(breath_total)/double(breaths)));
QDateTime dt=QDateTime::fromTime_t(start); QDateTime dt=QDateTime::fromTime_t(start);
Waveform *w=new Waveform(dt,CPAP_FlowRate,data,samples,duration,min,max); Waveform *w=new Waveform(dt,CPAP_FlowRate,data,samples,duration,min,max);
//wxLogMessage(QString::Format(wxT("%i %i %i %i %i"),start,samples,duration,min,max));
session->AddWaveform(w); session->AddWaveform(w);
//wxLogMessage(wxT("Done PRS1 Waveforms ")+filename);
return true; return true;
} }
@ -789,7 +784,7 @@ bool initialized=false;
void PRS1Loader::Register() void PRS1Loader::Register()
{ {
if (initialized) return; if (initialized) return;
qDebug("Registering PRS1Loader"); qDebug() << "Registering PRS1Loader";
RegisterLoader(new PRS1Loader()); RegisterLoader(new PRS1Loader());
InitModelMap(); InitModelMap();
initialized=true; initialized=true;

View File

@ -12,6 +12,7 @@ License: GPL
#include <QFile> #include <QFile>
#include <QMessageBox> #include <QMessageBox>
#include <QProgressBar> #include <QProgressBar>
#include <QDebug>
#include <math.h> #include <math.h>
#include "resmed_loader.h" #include "resmed_loader.h"
@ -77,11 +78,11 @@ bool EDFParser::Parse()
startdate.setDate(d2); startdate.setDate(d2);
} }
if (!startdate.isValid()) { if (!startdate.isValid()) {
qDebug(("Invalid date time retreieved parsing EDF File"+filename).toLatin1()); qDebug() << "Invalid date time retreieved parsing EDF File " << filename;
return false; return false;
} }
//qDebug(startdate.toString("yyyy-MM-dd HH:mm:ss").toLatin1()); //qDebug() << startdate.toString("yyyy-MM-dd HH:mm:ss");
num_header_bytes=Read(8).toLong(&ok); num_header_bytes=Read(8).toLong(&ok);
if (!ok) if (!ok)
@ -150,7 +151,7 @@ bool EDFParser::Open(QString name)
if (!f.isReadable()) return false; if (!f.isReadable()) return false;
filename=name; filename=name;
filesize=f.size(); filesize=f.size();
//qDebug(("Opening "+name).toLatin1()); //qDebug() << "Opening " << name;
buffer=new char [filesize]; buffer=new char [filesize];
f.read(buffer,filesize); f.read(buffer,filesize);
f.close(); f.close();
@ -179,7 +180,7 @@ Machine *ResmedLoader::CreateMachine(QString serial,Profile *profile)
} }
if (found) return ResmedList[serial]; if (found) return ResmedList[serial];
qDebug(("Create ResMed Machine"+serial).toLatin1()); qDebug() << "Create ResMed Machine" << serial;
Machine *m=new CPAP(profile,0); Machine *m=new CPAP(profile,0);
m->SetClass(resmed_class_name); m->SetClass(resmed_class_name);
@ -228,7 +229,7 @@ bool ResmedLoader::Open(QString & path,Profile *profile)
if ((!dir.exists() || !dir.isReadable())) if ((!dir.exists() || !dir.isReadable()))
return 0; return 0;
qDebug(("ResmedLoader::Open newpath="+newpath).toLatin1()); qDebug() << "ResmedLoader::Open newpath=" << newpath;
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name); dir.setSorting(QDir::Name);
QFileInfoList flist=dir.entryInfoList(); QFileInfoList flist=dir.entryInfoList();
@ -267,13 +268,13 @@ bool ResmedLoader::Open(QString & path,Profile *profile)
size=sessfiles.size(); size=sessfiles.size();
for (map<SessionID,vector<QString> >::iterator si=sessfiles.begin();si!=sessfiles.end();si++) { for (map<SessionID,vector<QString> >::iterator si=sessfiles.begin();si!=sessfiles.end();si++) {
sessionid=si->first; sessionid=si->first;
//qDebug("Parsing Session %li",sessionid); //qDebug() << "Parsing Session " << sessionid;
bool done=false; bool done=false;
bool first=true; bool first=true;
for (int i=0;i<si->second.size();i++) { for (size_t i=0;i<si->second.size();i++) {
fn=si->second[i].section("_",-1).toLower(); fn=si->second[i].section("_",-1).toLower();
EDFParser edf(si->second[i]); EDFParser edf(si->second[i]);
//qDebug("Parsing File %i %i",i,edf.filesize); //qDebug() << "Parsing File " << i << " " << edf.filesize;
if (!edf.Parse()) if (!edf.Parse())
continue; continue;
@ -283,7 +284,7 @@ bool ResmedLoader::Open(QString & path,Profile *profile)
for (map<QString,QString>::iterator i=idmap.begin();i!=idmap.end();i++) { for (map<QString,QString>::iterator i=idmap.begin();i!=idmap.end();i++) {
if (i->first=="SRN") { if (i->first=="SRN") {
if (edf.serialnumber!=i->second) { if (edf.serialnumber!=i->second) {
qDebug("edf Serial number doesn't match Identification.tgt"); qDebug() << "edf Serial number doesn't match Identification.tgt";
} }
} else if (i->first=="PNA") { } else if (i->first=="PNA") {
m->properties["Model"]=i->second; m->properties["Model"]=i->second;
@ -298,10 +299,10 @@ bool ResmedLoader::Open(QString & path,Profile *profile)
sess=new Session(m,sessionid); sess=new Session(m,sessionid);
} }
if (!done) { if (!done) {
if (fn=="eve.edf") LoadEVE(m,sess,edf); if (fn=="eve.edf") LoadEVE(sess,edf);
else if (fn=="pld.edf") LoadPLD(m,sess,edf); else if (fn=="pld.edf") LoadPLD(sess,edf);
else if (fn=="brp.edf") LoadBRP(m,sess,edf); else if (fn=="brp.edf") LoadBRP(sess,edf);
else if (fn=="sad.edf") LoadSAD(m,sess,edf); else if (fn=="sad.edf") LoadSAD(sess,edf);
} }
if (first) { if (first) {
sess->SetChanged(true); sess->SetChanged(true);
@ -340,7 +341,7 @@ bool ResmedLoader::Open(QString & path,Profile *profile)
return 0; return 0;
} }
bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf) bool ResmedLoader::LoadEVE(Session *sess,EDFParser &edf)
{ {
QString t; QString t;
long recs; long recs;
@ -353,13 +354,13 @@ bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf)
QDateTime tt; QDateTime tt;
EventDataType fields[3]; EventDataType fields[3];
MachineCode code; MachineCode code;
Event *e; //Event *e;
for (int s=0;s<edf.GetNumSignals();s++) { for (int s=0;s<edf.GetNumSignals();s++) {
recs=edf.edfsignals[s]->nr*edf.GetNumDataRecords()*2; recs=edf.edfsignals[s]->nr*edf.GetNumDataRecords()*2;
totaldur=edf.GetNumDataRecords()*edf.GetDuration(); totaldur=edf.GetNumDataRecords()*edf.GetDuration();
totaldur/=3600.0; totaldur/=3600.0;
//t.sprintf("EVE: %li %.2f",recs,totaldur); //t.sprintf("EVE: %li %.2f",recs,totaldur);
//qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); //qDebug() << edf.edfsignals[s]->label << " " << t;
data=(char *)edf.edfsignals[s]->data; data=(char *)edf.edfsignals[s]->data;
pos=0; pos=0;
tt=edf.startdate; tt=edf.startdate;
@ -378,7 +379,7 @@ bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf)
} while ((c!=20) && (c!=21)); // start code } while ((c!=20) && (c!=21)); // start code
d=t.toDouble(&ok); d=t.toDouble(&ok);
if (!ok) { if (!ok) {
qDebug(("Faulty EDF EVE file"+edf.filename).toLatin1()); qDebug() << "Faulty EDF EVE file " << edf.filename;
break; break;
} }
if (!sign) d=-d; if (!sign) d=-d;
@ -397,7 +398,7 @@ bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf)
} while ((data[pos]!=20) && (pos<recs)); // start code } while ((data[pos]!=20) && (pos<recs)); // start code
duration=t.toDouble(&ok); duration=t.toDouble(&ok);
if (!ok) { if (!ok) {
qDebug(("Faulty EDF EVE file (at %li) "+edf.filename).toLatin1(),pos); qDebug() << "Faulty EDF EVE file (at %" << pos << ") " << edf.filename;
break; break;
} }
} }
@ -424,13 +425,13 @@ bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf)
sess->AddEvent(new Event(tt,code,fields,1)); sess->AddEvent(new Event(tt,code,fields,1));
} else { } else {
if (t!="recording starts") { if (t!="recording starts") {
qDebug(("Unknown ResMed annotation field: "+t).toLatin1()); qDebug() << "Unknown ResMed annotation field: " << t;
} }
} }
// qDebug((tt.toString("yyyy-MM-dd HH:mm:ss")+t).toLatin1()); // qDebug((tt.toString("yyyy-MM-dd HH:mm:ss")+t).toLatin1());
} }
if (pos>=recs) { if (pos>=recs) {
qDebug(("Short EDF EVE file"+edf.filename).toLatin1()); qDebug() << "Short EDF EVE file" << edf.filename;
break; break;
} }
// pos++; // pos++;
@ -440,8 +441,9 @@ bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf)
} }
// qDebug(data); // qDebug(data);
} }
return true;
} }
bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf) bool ResmedLoader::LoadBRP(Session *sess,EDFParser &edf)
{ {
QString t; QString t;
for (int s=0;s<edf.GetNumSignals();s++) { for (int s=0;s<edf.GetNumSignals();s++) {
@ -451,7 +453,7 @@ bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf)
if (edf.edfsignals[s]->label=="Flow") code=CPAP_FlowRate; if (edf.edfsignals[s]->label=="Flow") code=CPAP_FlowRate;
else if (edf.edfsignals[s]->label=="Mask Pres") code=CPAP_MaskPressure; else if (edf.edfsignals[s]->label=="Mask Pres") code=CPAP_MaskPressure;
else { else {
qDebug(("Unknown Signal "+edf.edfsignals[s]->label).toLatin1()); qDebug() << "Unknown Signal " << edf.edfsignals[s]->label;
continue; continue;
} }
sess->set_first(edf.startdate); sess->set_first(edf.startdate);
@ -465,8 +467,9 @@ bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf)
//t.sprintf("BRP: %li %.2f",recs,duration); //t.sprintf("BRP: %li %.2f",recs,duration);
//qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); //qDebug((edf.edfsignals[s]->label+" "+t).toLatin1());
} }
return true;
} }
void ResmedLoader::ToTimeDelta(Machine *mach,Session *sess,EDFParser &edf, qint16 *data, MachineCode code, long recs, double duration,EventDataType divisor) void ResmedLoader::ToTimeDelta(Session *sess,EDFParser &edf, qint16 *data, MachineCode code, long recs, double duration,EventDataType divisor)
{ {
bool first=true; bool first=true;
double rate=(duration/recs)*1000.0; double rate=(duration/recs)*1000.0;
@ -490,13 +493,15 @@ void ResmedLoader::ToTimeDelta(Machine *mach,Session *sess,EDFParser &edf, qint1
} }
sess->AddEvent(new Event(tt,code,&c,1)); // add one at the end.. sess->AddEvent(new Event(tt,code,&c,1)); // add one at the end..
} }
bool ResmedLoader::LoadSAD(Machine *mach,Session *sess,EDFParser &edf) bool ResmedLoader::LoadSAD(Session *sess,EDFParser &edf)
{ {
// Oximeter bull crap.. // Oximeter bull crap.. this oximeter is not reported of highly..
// nonetheless, the data is easy to access.
return true;
} }
bool ResmedLoader::LoadPLD(Machine *mach,Session *sess,EDFParser &edf) bool ResmedLoader::LoadPLD(Session *sess,EDFParser &edf)
{ {
// Is it save to assume the order does not change here? // Is it save to assume the order does not change here?
enum PLDType { MaskPres=0, TherapyPres, ExpPress, Leak, RR, Vt, Mv, SnoreIndex, FFLIndex, U1, U2 }; enum PLDType { MaskPres=0, TherapyPres, ExpPress, Leak, RR, Vt, Mv, SnoreIndex, FFLIndex, U1, U2 };
@ -518,10 +523,10 @@ bool ResmedLoader::LoadPLD(Machine *mach,Session *sess,EDFParser &edf)
// } else // } else
if (edf.edfsignals[s]->label=="Snore Index") { if (edf.edfsignals[s]->label=="Snore Index") {
code=CPAP_Snore; code=CPAP_Snore;
ToTimeDelta(mach,sess,edf,edf.edfsignals[s]->data, code,recs,duration); ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration);
} else if (edf.edfsignals[s]->label=="Therapy Pres") { } else if (edf.edfsignals[s]->label=="Therapy Pres") {
code=CPAP_Pressure; code=CPAP_Pressure;
ToTimeDelta(mach,sess,edf,edf.edfsignals[s]->data, code,recs,duration,50.0); //50.0 ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration,50.0); //50.0
} else if (edf.edfsignals[s]->label=="MV") { } else if (edf.edfsignals[s]->label=="MV") {
code=CPAP_MinuteVentilation; code=CPAP_MinuteVentilation;
//ToTimeDelta(mach,sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0); //ToTimeDelta(mach,sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0);
@ -542,15 +547,15 @@ bool ResmedLoader::LoadPLD(Machine *mach,Session *sess,EDFParser &edf)
sess->AddWaveform(w); sess->AddWaveform(w);
} else if (edf.edfsignals[s]->label=="Leak") { } else if (edf.edfsignals[s]->label=="Leak") {
code=CPAP_Leak; code=CPAP_Leak;
ToTimeDelta(mach,sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0); ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0);
} else if (edf.edfsignals[s]->label=="FFL Index") { } else if (edf.edfsignals[s]->label=="FFL Index") {
code=CPAP_FlowLimitGraph; code=CPAP_FlowLimitGraph;
ToTimeDelta(mach,sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0); ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0);
} else { } else {
qDebug(("Unknown Signal "+edf.edfsignals[s]->label).toLatin1()); qDebug() << "Unknown Signal " << edf.edfsignals[s]->label;
} }
} }
return true;
} }
void ResInitModelMap() void ResInitModelMap()
@ -563,7 +568,7 @@ bool resmed_initialized=false;
void ResmedLoader::Register() void ResmedLoader::Register()
{ {
if (resmed_initialized) return; if (resmed_initialized) return;
qDebug("Registering ResmedLoader"); qDebug() << "Registering ResmedLoader";
RegisterLoader(new ResmedLoader()); RegisterLoader(new ResmedLoader());
ResInitModelMap(); ResInitModelMap();
resmed_initialized=true; resmed_initialized=true;

View File

@ -86,17 +86,17 @@ public:
virtual int Version() { return resmed_data_version; }; virtual int Version() { return resmed_data_version; };
virtual const QString & ClassName() { return resmed_class_name; }; virtual const QString & ClassName() { return resmed_class_name; };
void ToTimeDelta(Machine *mach,Session *sess,EDFParser &edf, qint16 *data, MachineCode code, long recs,double duration,EventDataType divisor=1); void ToTimeDelta(Session *sess,EDFParser &edf, qint16 *data, MachineCode code, long recs,double duration,EventDataType divisor=1);
Machine *CreateMachine(QString serial,Profile *profile); Machine *CreateMachine(QString serial,Profile *profile);
static void Register(); static void Register();
protected: protected:
map<QString,Machine *> ResmedList; map<QString,Machine *> ResmedList;
bool LoadEVE(Machine *mach,Session *sess,EDFParser &edf); bool LoadEVE(Session *sess,EDFParser &edf);
bool LoadBRP(Machine *mach,Session *sess,EDFParser &edf); bool LoadBRP(Session *sess,EDFParser &edf);
bool LoadSAD(Machine *mach,Session *sess,EDFParser &edf); bool LoadSAD(Session *sess,EDFParser &edf);
bool LoadPLD(Machine *mach,Session *sess,EDFParser &edf); bool LoadPLD(Session *sess,EDFParser &edf);
}; };

View File

@ -1,17 +1,20 @@
/******************************************************************** /*
SleepLib Machine Class Implementation SleepLib Machine Class Implementation
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net> Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL License: GPL
*********************************************************************/ */
#include <QDir>
#include <QProgressBar>
#include <QDebug>
#include <QString>
#include <QObject>
#include <tr1/random> #include <tr1/random>
#include <sys/time.h> #include <sys/time.h>
#include "binary_file.h" #include "binary_file.h"
#include "machine.h" #include "machine.h"
#include "profiles.h" #include "profiles.h"
#include <algorithm> #include <algorithm>
#include <QDir>
#include <QProgressBar>
extern QProgressBar * qprogress; extern QProgressBar * qprogress;
@ -98,58 +101,57 @@ map<MachineCode,QString> DefaultMCLongNames;
{PRS1_VSnore2, wxT("Vibratory Snore")}, {PRS1_VSnore2, wxT("Vibratory Snore")},
{PRS1_PressurePulse,wxT("Pressue Pulse")} {PRS1_PressurePulse,wxT("Pressue Pulse")}
}; */ }; */
inline const QString & _(const QString q) { return q; };
void InitMapsWithoutAwesomeInitializerLists() void InitMapsWithoutAwesomeInitializerLists()
{ {
CPAPModeNames[MODE_UNKNOWN]=_("Undetermined"); CPAPModeNames[MODE_UNKNOWN]=QObject::tr("Undetermined");
CPAPModeNames[MODE_CPAP]=_("CPAP"); CPAPModeNames[MODE_CPAP]=QObject::tr("CPAP");
CPAPModeNames[MODE_APAP]=_("Auto"); CPAPModeNames[MODE_APAP]=QObject::tr("Auto");
CPAPModeNames[MODE_BIPAP]=_("BIPAP"); CPAPModeNames[MODE_BIPAP]=QObject::tr("BIPAP");
CPAPModeNames[MODE_ASV]=_("ASV"); CPAPModeNames[MODE_ASV]=QObject::tr("ASV");
PressureReliefNames[PR_UNKNOWN]=_("Undetermined"); PressureReliefNames[PR_UNKNOWN]=QObject::tr("Undetermined");
PressureReliefNames[PR_NONE]=_("None"); PressureReliefNames[PR_NONE]=QObject::tr("None");
PressureReliefNames[PR_CFLEX]=_("C-Flex"); PressureReliefNames[PR_CFLEX]=QObject::tr("C-Flex");
PressureReliefNames[PR_CFLEXPLUS]=_("C-Flex+"); PressureReliefNames[PR_CFLEXPLUS]=QObject::tr("C-Flex+");
PressureReliefNames[PR_AFLEX]=_("A-Flex"); PressureReliefNames[PR_AFLEX]=QObject::tr("A-Flex");
PressureReliefNames[PR_BIFLEX]=_("Bi-Flex"); PressureReliefNames[PR_BIFLEX]=QObject::tr("Bi-Flex");
PressureReliefNames[PR_EPR]=_("Exhalation Pressure Relief (EPR)"); PressureReliefNames[PR_EPR]=QObject::tr("Exhalation Pressure Relief (EPR)");
PressureReliefNames[PR_SMARTFLEX]=_("SmartFlex"); PressureReliefNames[PR_SMARTFLEX]=QObject::tr("SmartFlex");
DefaultMCShortNames[CPAP_Obstructive]=_("OA"); DefaultMCShortNames[CPAP_Obstructive]=QObject::tr("OA");
DefaultMCShortNames[CPAP_Hypopnea]=_("H"); DefaultMCShortNames[CPAP_Hypopnea]=QObject::tr("H");
DefaultMCShortNames[CPAP_RERA]=_("RE"); DefaultMCShortNames[CPAP_RERA]=QObject::tr("RE");
DefaultMCShortNames[CPAP_ClearAirway]=_("CA"); DefaultMCShortNames[CPAP_ClearAirway]=QObject::tr("CA");
DefaultMCShortNames[CPAP_CSR]=_("CSR/PB"); DefaultMCShortNames[CPAP_CSR]=QObject::tr("CSR/PB");
DefaultMCShortNames[CPAP_VSnore]=_("VS"); DefaultMCShortNames[CPAP_VSnore]=QObject::tr("VS");
DefaultMCShortNames[PRS1_VSnore2]=_("VS2"); DefaultMCShortNames[PRS1_VSnore2]=QObject::tr("VS2");
DefaultMCShortNames[CPAP_FlowLimit]=_("FL"); DefaultMCShortNames[CPAP_FlowLimit]=QObject::tr("FL");
DefaultMCShortNames[CPAP_Pressure]=_("P"); DefaultMCShortNames[CPAP_Pressure]=QObject::tr("P");
DefaultMCShortNames[CPAP_Leak]=_("LR"); DefaultMCShortNames[CPAP_Leak]=QObject::tr("LR");
DefaultMCShortNames[CPAP_EAP]=_("EPAP"); DefaultMCShortNames[CPAP_EAP]=QObject::tr("EPAP");
DefaultMCShortNames[CPAP_IAP]=_("IPAP"); DefaultMCShortNames[CPAP_IAP]=QObject::tr("IPAP");
DefaultMCShortNames[PRS1_PressurePulse]=_("PP"); DefaultMCShortNames[PRS1_PressurePulse]=QObject::tr("PP");
DefaultMCLongNames[CPAP_Obstructive]=_("Obstructive Apnea"); DefaultMCLongNames[CPAP_Obstructive]=QObject::tr("Obstructive Apnea");
DefaultMCLongNames[CPAP_Hypopnea]=_("Hypopnea"); DefaultMCLongNames[CPAP_Hypopnea]=QObject::tr("Hypopnea");
DefaultMCLongNames[CPAP_RERA]=_("RERA"); DefaultMCLongNames[CPAP_RERA]=QObject::tr("RERA");
DefaultMCLongNames[CPAP_ClearAirway]=_("Clear Airway Apnea"); DefaultMCLongNames[CPAP_ClearAirway]=QObject::tr("Clear Airway Apnea");
DefaultMCLongNames[CPAP_CSR]=_("Periodic Breathing"); DefaultMCLongNames[CPAP_CSR]=QObject::tr("Periodic Breathing");
DefaultMCLongNames[CPAP_VSnore]=_("Vibratory Snore"); // flags type DefaultMCLongNames[CPAP_VSnore]=QObject::tr("Vibratory Snore"); // flags type
DefaultMCLongNames[CPAP_FlowLimit]=_("Flow Limitation"); DefaultMCLongNames[CPAP_FlowLimit]=QObject::tr("Flow Limitation");
DefaultMCLongNames[CPAP_Pressure]=_("Pressure"); DefaultMCLongNames[CPAP_Pressure]=QObject::tr("Pressure");
DefaultMCLongNames[CPAP_Leak]=_("Leak Rate"); DefaultMCLongNames[CPAP_Leak]=QObject::tr("Leak Rate");
DefaultMCLongNames[CPAP_EAP]=_("BIPAP EPAP"); DefaultMCLongNames[CPAP_EAP]=QObject::tr("BIPAP EPAP");
DefaultMCLongNames[CPAP_IAP]=_("BIPAP IPAP"); DefaultMCLongNames[CPAP_IAP]=QObject::tr("BIPAP IPAP");
DefaultMCLongNames[CPAP_Snore]=_("Vibratory Snore"); // Graph data DefaultMCLongNames[CPAP_Snore]=QObject::tr("Vibratory Snore"); // Graph data
DefaultMCLongNames[PRS1_VSnore2]=_("Vibratory Snore (Graph)"); DefaultMCLongNames[PRS1_VSnore2]=QObject::tr("Vibratory Snore (Graph)");
DefaultMCLongNames[PRS1_PressurePulse]=_("Pressure Pulse"); DefaultMCLongNames[PRS1_PressurePulse]=QObject::tr("Pressure Pulse");
DefaultMCLongNames[PRS1_Unknown0E]=_("Unknown 0E"); DefaultMCLongNames[PRS1_Unknown0E]=QObject::tr("Unknown 0E");
DefaultMCLongNames[PRS1_Unknown00]=_("Unknown 00"); DefaultMCLongNames[PRS1_Unknown00]=QObject::tr("Unknown 00");
DefaultMCLongNames[PRS1_Unknown01]=_("Unknown 01"); DefaultMCLongNames[PRS1_Unknown01]=QObject::tr("Unknown 01");
DefaultMCLongNames[PRS1_Unknown0B]=_("Unknown 0B"); DefaultMCLongNames[PRS1_Unknown0B]=QObject::tr("Unknown 0B");
DefaultMCLongNames[PRS1_Unknown10]=_("Unknown 10"); DefaultMCLongNames[PRS1_Unknown10]=QObject::tr("Unknown 10");
} }
@ -202,13 +204,13 @@ Machine::Machine(Profile *p,MachineID id)
m_id=temp; m_id=temp;
} else m_id=id; } else m_id=id;
qDebug("Create Machine: %lx",m_id); qDebug() << "Create Machine: " << hex << m_id; //%lx",m_id);
m_type=MT_UNKNOWN; m_type=MT_UNKNOWN;
firstsession=true; firstsession=true;
} }
Machine::~Machine() Machine::~Machine()
{ {
qDebug("Destroy Machine"); qDebug() << "Destroy Machine";
map<QDateTime,Day *>::iterator d; map<QDateTime,Day *>::iterator d;
for (d=day.begin();d!=day.end();d++) { for (d=day.begin();d!=day.end();d++) {
delete d->second; delete d->second;
@ -308,8 +310,7 @@ bool Machine::Purge(int secret)
return false; return false;
QString native="Purging "+QDir::toNativeSeparators(path); qDebug() << "Purging " << QDir::toNativeSeparators(path);
qDebug(native.toLatin1());
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name); dir.setSorting(QDir::Name);
@ -323,15 +324,15 @@ bool Machine::Purge(int secret)
int j=fullpath.lastIndexOf("."); int j=fullpath.lastIndexOf(".");
QString ext_s=*(fullpath.rightRef(j+1).string()); QString ext_s=*(fullpath.rightRef(j+1).string());
bool ok; bool ok;
int ext=ext_s.toInt(&ok,10); ext_s.toInt(&ok,10);
if (ok) { if (ok) {
qDebug(("TestMe: Deleting "+fullpath).toLatin1()); qDebug() << "TestMe: Deleting " << fullpath;
dir.remove(fullpath); dir.remove(fullpath);
} else could_not_kill++; } else could_not_kill++;
} }
if (could_not_kill>0) { if (could_not_kill>0) {
qWarning(("Could not purge path\n"+path+"\n\n%i file(s) remain.. Suggest manually deleting this path\n").toLatin1(),could_not_kill); qWarning() << "Could not purge path\n" << path << "\n\n" << could_not_kill << " file(s) remain.. Suggest manually deleting this path\n";
return false; return false;
} }
@ -341,7 +342,7 @@ bool Machine::Load()
{ {
QString path=profile->Get("DataFolder")+"/"+hexid(); QString path=profile->Get("DataFolder")+"/"+hexid();
QDir dir(path); QDir dir(path);
qDebug(("Loading "+path).toLatin1()); qDebug() << "Loading " << path;
if (!dir.exists() || !dir.isReadable()) if (!dir.exists() || !dir.isReadable())
return false; return false;
@ -397,6 +398,7 @@ bool Machine::SaveSession(Session *sess)
{ {
QString path=profile->Get("DataFolder")+"/"+hexid(); QString path=profile->Get("DataFolder")+"/"+hexid();
if (sess->IsChanged()) sess->Store(path); if (sess->IsChanged()) sess->Store(path);
return true;
} }
bool Machine::Save() bool Machine::Save()
{ {

View File

@ -16,6 +16,7 @@ License: GPL
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include <QDesktopServices> #include <QDesktopServices>
#include <QDebug>
#include "preferences.h" #include "preferences.h"
@ -163,7 +164,7 @@ bool Preferences::Open(QString filename)
{ {
if (!filename.isEmpty()) p_filename=filename; if (!filename.isEmpty()) p_filename=filename;
qDebug(("Opening "+p_filename).toLatin1()); qDebug() << "Opening " << p_filename;
TiXmlDocument xml(p_filename.toLatin1()); TiXmlDocument xml(p_filename.toLatin1());
if (!xml.LoadFile()) { if (!xml.LoadFile()) {
return false; return false;
@ -194,13 +195,13 @@ bool Preferences::Open(QString filename)
if (type=="double") { if (type=="double") {
double d=pText.toDouble(&ok); double d=pText.toDouble(&ok);
if (!ok) if (!ok)
qDebug("String to number conversion error in Preferences::Open()"); qDebug() << "String to number conversion error in Preferences::Open()";
else else
p_preferences[pKey]=d; p_preferences[pKey]=d;
} else if (type=="qlonglong") { } else if (type=="qlonglong") {
qlonglong d=pText.toLongLong(&ok); qlonglong d=pText.toLongLong(&ok);
if (!ok) if (!ok)
qDebug("String to number conversion error in Preferences::Open()"); qDebug() << "String to number conversion error in Preferences::Open()";
else else
p_preferences[pKey]=d; p_preferences[pKey]=d;
} else if (type=="bool") { } else if (type=="bool") {
@ -211,7 +212,7 @@ bool Preferences::Open(QString filename)
else if (pText.toLower()=="false") else if (pText.toLower()=="false")
p_preferences[pKey]=false; p_preferences[pKey]=false;
else else
qDebug("String to number conversion error in Preferences::Open()"); qDebug() << "String to number conversion error in Preferences::Open()";
} else } else
p_preferences[pKey]=(bool)d; p_preferences[pKey]=(bool)d;
} else if (type=="qdatetime") { } else if (type=="qdatetime") {
@ -220,7 +221,7 @@ bool Preferences::Open(QString filename)
if (d.isValid()) if (d.isValid())
p_preferences[pKey]=d; p_preferences[pKey]=d;
else else
qWarning(("Invalid DateTime record in "+filename).toLatin1()); qWarning() << "Invalid DateTime record in " << filename;
} else { // Assume string } else { // Assume string
p_preferences[pKey]=pText; p_preferences[pKey]=pText;
@ -258,7 +259,7 @@ bool Preferences::Save(QString filename)
if (type==QVariant::Invalid) continue; if (type==QVariant::Invalid) continue;
msg=new TiXmlElement(i->first.toLatin1()); msg=new TiXmlElement(i->first.toLatin1());
//qDebug(i->first.toLatin1()); //qDebug() << i->first;
msg->SetAttribute("type",i->second.typeName()); msg->SetAttribute("type",i->second.typeName());
QString t; QString t;

View File

@ -6,17 +6,12 @@ Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL License: GPL
*/ */
//#include <wx/filefn.h>
//#include <wx/filename.h>
//#include <wx/utils.h>
//#include <wx/dir.h>
//#include <wx/log.h>
//#include <wx/msgdlg.h>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include <QMessageBox> #include <QMessageBox>
#include <QDebug>
#include "preferences.h" #include "preferences.h"
#include "profiles.h" #include "profiles.h"
@ -211,7 +206,7 @@ Day * Profile::GetDay(QDate date,MachineType type)
void Profile::Import(QString path) void Profile::Import(QString path)
{ {
int c=0; int c=0;
qDebug(("Importing "+path).toLatin1()); qDebug() << "Importing " << path;
list<MachineLoader *>loaders=GetLoaders(); list<MachineLoader *>loaders=GetLoaders();
for (list<MachineLoader *>::iterator i=loaders.begin(); i!=loaders.end(); i++) { for (list<MachineLoader *>::iterator i=loaders.begin(); i!=loaders.end(); i++) {
if (c+=(*i)->Open(path,this)) break; if (c+=(*i)->Open(path,this)) break;
@ -344,7 +339,7 @@ void Scan()
return; return;
} }
if (!dir.isReadable()) { if (!dir.isReadable()) {
qWarning(("Can't open "+path).toLatin1()); qWarning() << "Can't open " << path;
return; return;
} }

View File

@ -8,6 +8,7 @@
#include "session.h" #include "session.h"
#include "math.h" #include "math.h"
#include <QDir> #include <QDir>
#include <QDebug>
#include <SleepLib/binary_file.h> #include <SleepLib/binary_file.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
@ -113,7 +114,7 @@ double Session::percentile(MachineCode mc,int field,double percent)
for (e=events[mc].begin(); e!=events[mc].end(); e++) { for (e=events[mc].begin(); e!=events[mc].end(); e++) {
Event & ev = *(*e); Event & ev = *(*e);
array.push_back(ev[0]); array.push_back(ev[field]);
} }
std::sort(array.begin(),array.end(),sortfunction); std::sort(array.begin(),array.end(),sortfunction);
int size=array.size(); int size=array.size();
@ -327,7 +328,7 @@ bool Session::StoreSummary(QString filename)
mctype[mc]=MC_datetime; mctype[mc]=MC_datetime;
} else { } else {
QString t=i->second.typeToName(type); QString t=i->second.typeToName(type);
qWarning(("Error in Session->StoreSummary: Can't pack variant type "+t).toLatin1()); qWarning() << "Error in Session->StoreSummary: Can't pack variant type " << t;
exit(1); exit(1);
} }
f.Pack((qint16)mc); f.Pack((qint16)mc);
@ -360,7 +361,7 @@ bool Session::LoadSummary(QString filename)
//qDebug(("Loading Summary "+filename).toLatin1()); //qDebug(("Loading Summary "+filename).toLatin1());
BinaryFile f; BinaryFile f;
if (!f.Open(filename,BF_READ)) { if (!f.Open(filename,BF_READ)) {
qDebug(("Couldn't open file"+filename).toLatin1()); qDebug() << "Couldn't open file" << filename;
return false; return false;
} }
@ -496,14 +497,14 @@ bool Session::LoadEvents(QString filename)
if (filename.isEmpty()) return false; if (filename.isEmpty()) return false;
BinaryFile f; BinaryFile f;
if (!f.Open(filename,BF_READ)) { if (!f.Open(filename,BF_READ)) {
qDebug(("Couldn't open events file"+filename).toLatin1()); qDebug() << "Couldn't open events file" << filename;
return false; return false;
} }
quint32 t32; quint32 t32;
quint16 t16; quint16 t16;
quint8 t8; quint8 t8;
qint16 i16; //qint16 i16;
// qint16 sumsize; // qint16 sumsize;
@ -561,7 +562,7 @@ bool Session::LoadEvents(QString filename)
} }
EventDataType ED[max_number_event_fields]; EventDataType ED[max_number_event_fields];
for (int c=0; c<mcfields[mc]; c++) { for (int c=0; c<mcfields[mc]; c++) {
if (!f.Unpack(fl)); //throw UnpackError(); // Data Fields in float format if (!f.Unpack(fl)) {}; //throw UnpackError(); // Data Fields in float format
ED[c]=fl; ED[c]=fl;
} }
Event *ev=new Event(d,mc,ED,mcfields[mc]); Event *ev=new Event(d,mc,ED,mcfields[mc]);
@ -635,7 +636,7 @@ bool Session::LoadWaveforms(QString filename)
BinaryFile f; BinaryFile f;
if (!f.Open(filename,BF_READ)) { if (!f.Open(filename,BF_READ)) {
qDebug(("Couldn't open waveform file "+filename).toLatin1()); qDebug() << "Couldn't open waveform file " << filename;
return false; return false;
} }

View File

@ -407,7 +407,7 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day)
map<MachineCode,vector<Event *> >::iterator m; map<MachineCode,vector<Event *> >::iterator m;
QTreeWidgetItem * ti,sroot; //QTreeWidgetItem * sroot;
for (m=(*s)->events.begin();m!=(*s)->events.end();m++) { for (m=(*s)->events.begin();m!=(*s)->events.end();m++) {
MachineCode code=m->first; MachineCode code=m->first;
@ -496,7 +496,7 @@ void Daily::Load(QDate date)
previous_date=date; previous_date=date;
Day *cpap=profile->GetDay(date,MT_CPAP); Day *cpap=profile->GetDay(date,MT_CPAP);
Day *oxi=profile->GetDay(date,MT_OXIMETER); Day *oxi=profile->GetDay(date,MT_OXIMETER);
Day *sleepstage=profile->GetDay(date,MT_SLEEPSTAGE); // Day *sleepstage=profile->GetDay(date,MT_SLEEPSTAGE);
QString html="<html><head><style type='text/css'>p,a,td,body { font-family: 'FreeSans', 'Sans Serif'; } p,a,td,body { font-size: 12px; } </style>"; QString html="<html><head><style type='text/css'>p,a,td,body { font-family: 'FreeSans', 'Sans Serif'; } p,a,td,body { font-size: 12px; } </style>";
html+="</head>"; html+="</head>";
@ -933,7 +933,7 @@ void Daily::on_JournalNotesUnderline_clicked()
AHIGraph::AHIGraph(QObject * parent) /*AHIGraph::AHIGraph(QObject * parent)
{ {
} }
AHIGraph::~AHIGraph() AHIGraph::~AHIGraph()
@ -977,3 +977,4 @@ QList<QWebPluginFactory::Plugin> AHIGraph::plugins() const
return QList<QWebPluginFactory::Plugin>() << plugin; return QList<QWebPluginFactory::Plugin>() << plugin;
} }
*/

View File

@ -83,7 +83,7 @@ private:
QLabel *NoData; QLabel *NoData;
}; };
class AHIGraph:public QWebPluginFactory /*class AHIGraph:public QWebPluginFactory
{ {
public: public:
AHIGraph(QObject * parent = 0); AHIGraph(QObject * parent = 0);
@ -91,6 +91,6 @@ public:
virtual QObject * create ( const QString & mimeType, const QUrl & url, const QStringList & argumentNames, const QStringList & argumentValues) const; virtual QObject * create ( const QString & mimeType, const QUrl & url, const QStringList & argumentNames, const QStringList & argumentValues) const;
virtual QList<Plugin> plugins () const; virtual QList<Plugin> plugins () const;
//virtual void refreshPlugins (); //virtual void refreshPlugins ();
}; }; */
#endif // DAILY_H #endif // DAILY_H

View File

@ -8,6 +8,7 @@
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QFontDatabase> #include <QFontDatabase>
#include <QStringList> #include <QStringList>
#include <QDebug>
#include "mainwindow.h" #include "mainwindow.h"
#include "SleepLib/profiles.h" #include "SleepLib/profiles.h"
@ -25,7 +26,7 @@ int main(int argc, char *argv[])
int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf"); int id=QFontDatabase::addApplicationFont(":/fonts/FreeSans.ttf");
QStringList ffam=QFontDatabase::applicationFontFamilies(id); QStringList ffam=QFontDatabase::applicationFontFamilies(id);
for (QStringList::iterator i=ffam.begin();i!=ffam.end();i++) { for (QStringList::iterator i=ffam.begin();i!=ffam.end();i++) {
qDebug(("Loaded Font: "+*i).toLatin1()); qDebug() << "Loaded Font: " << (*i);
} }
a.setFont(QFont("FreeSans",10)); a.setFont(QFont("FreeSans",10));

View File

@ -77,11 +77,6 @@ MainWindow::~MainWindow()
delete ui; delete ui;
Profiles::Done(); Profiles::Done();
} }
void MainWindow::showEvent(QShowEvent * event)
{
if (daily)
daily->RedrawGraphs();
}
void MainWindow::Startup() void MainWindow::Startup()
{ {
@ -184,6 +179,7 @@ void MainWindow::on_overviewButton_clicked()
void MainWindow::on_webView_loadFinished(bool arg1) void MainWindow::on_webView_loadFinished(bool arg1)
{ {
arg1=arg1;
qprogress->hide(); qprogress->hide();
if (first_load) { if (first_load) {
QTimer::singleShot(0,this,SLOT(Startup())); QTimer::singleShot(0,this,SLOT(Startup()));

View File

@ -59,7 +59,6 @@ private slots:
void on_action_Link_Graphs_triggered(bool checked); void on_action_Link_Graphs_triggered(bool checked);
void on_actionUse_AntiAliasing_triggered(bool checked); void on_actionUse_AntiAliasing_triggered(bool checked);
void showEvent(QShowEvent * event);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;

View File

@ -122,7 +122,7 @@ void Overview::ReloadGraphs()
(*h)->ResetDateRange(); (*h)->ResetDateRange();
(*h)->Reload(NULL); (*h)->Reload(NULL);
} }
on_rbLastWeek_clicked(true); on_rbLastWeek_clicked();
} }
void Overview::UpdateGraphs() void Overview::UpdateGraphs()
{ {
@ -136,46 +136,6 @@ void Overview::UpdateGraphs()
} }
void Overview::on_rbLastWeek_clicked(bool checked)
{
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
QDate d=profile->LastDay();
ui->drEnd->setDate(d);
d=d.addDays(-7);
if (d<profile->FirstDay()) d=profile->FirstDay();
ui->drStart->setDate(d);
UpdateGraphs();
}
void Overview::on_rbLastMonth_clicked(bool checked)
{
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
QDate d=profile->LastDay();
ui->drEnd->setDate(d);
d=d.addDays(-30);
if (d<profile->FirstDay()) d=profile->FirstDay();
ui->drStart->setDate(d);
UpdateGraphs();
}
void Overview::on_rbEverything_clicked(bool checked)
{
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDate(profile->LastDay());
ui->drStart->setDate(profile->FirstDay());
UpdateGraphs();
}
void Overview::on_rbDateRange_clicked(bool checked)
{
UpdateGraphs();
}
void UpdateCal(QCalendarWidget *cal) void UpdateCal(QCalendarWidget *cal)
{ {
QDate d1=cal->minimumDate(); QDate d1=cal->minimumDate();
@ -217,3 +177,44 @@ void Overview::on_rbDateRange_toggled(bool checked)
ui->drStartLabel->setEnabled(checked); ui->drStartLabel->setEnabled(checked);
ui->drEndLabel->setEnabled(checked); ui->drEndLabel->setEnabled(checked);
} }
void Overview::on_rbLastWeek_clicked()
{
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
QDate d=profile->LastDay();
ui->drEnd->setDate(d);
d=d.addDays(-7);
if (d<profile->FirstDay()) d=profile->FirstDay();
ui->drStart->setDate(d);
UpdateGraphs();
}
void Overview::on_rbLastMonth_clicked()
{
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
QDate d=profile->LastDay();
ui->drEnd->setDate(d);
d=d.addDays(-30);
if (d<profile->FirstDay()) d=profile->FirstDay();
ui->drStart->setDate(d);
UpdateGraphs();
}
void Overview::on_rbEverything_clicked()
{
ui->drStart->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDateRange(profile->FirstDay(),profile->LastDay());
ui->drEnd->setDate(profile->LastDay());
ui->drStart->setDate(profile->FirstDay());
UpdateGraphs();
}
void Overview::on_rbDateRange_clicked()
{
UpdateGraphs();
}

View File

@ -31,20 +31,20 @@ public:
private slots: private slots:
void on_rbLastWeek_clicked(bool checked);
void on_rbLastMonth_clicked(bool checked);
void on_rbEverything_clicked(bool checked);
void on_rbDateRange_clicked(bool checked);
void on_drStart_dateChanged(const QDate &date); void on_drStart_dateChanged(const QDate &date);
void on_drEnd_dateChanged(const QDate &date); void on_drEnd_dateChanged(const QDate &date);
void on_rbDateRange_toggled(bool checked); void on_rbDateRange_toggled(bool checked);
void on_rbLastWeek_clicked();
void on_rbLastMonth_clicked();
void on_rbEverything_clicked();
void on_rbDateRange_clicked();
private: private:
Ui::Overview *ui; Ui::Overview *ui;
Profile *profile; Profile *profile;