Catch some exceptions

This commit is contained in:
Mark Watkins 2011-07-03 21:49:47 +10:00
parent f7db127257
commit 687eb0aaa2
9 changed files with 73 additions and 56 deletions

View File

@ -593,8 +593,8 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,qint64
break; break;
default: default:
// ERROR!!! // ERROR!!!
throw exception(); // UnknownCode(); qWarning() << "Some new fandangled PRS1 code detected:" << code;
break; return false;
} }
} }
return true; return true;

View File

@ -401,6 +401,8 @@ bool Machine::Load()
if (qprogress) qprogress->setValue((float(cnt)/float(size)*100.0)); if (qprogress) qprogress->setValue((float(cnt)/float(size)*100.0));
Session *sess=new Session(this,s->first); Session *sess=new Session(this,s->first);
try {
if (sess->LoadSummary(s->second[0])) { if (sess->LoadSummary(s->second[0])) {
sess->SetEventFile(s->second[1]); sess->SetEventFile(s->second[1]);
sess->SetWaveFile(s->second[2]); sess->SetWaveFile(s->second[2]);
@ -409,6 +411,10 @@ bool Machine::Load()
} else { } else {
delete sess; delete sess;
} }
} catch(UnpackError e) {
qWarning() << "Error unpacking summary data";
delete sess;
}
} }
if (qprogress) qprogress->setValue(100); if (qprogress) qprogress->setValue(100);
return true; return true;

View File

@ -244,6 +244,36 @@ void Session::TrashWaveforms()
//const int max_pack_size=128; //const int max_pack_size=128;
bool Session::OpenEvents() {
if(s_events_loaded)
return true;
bool b;
try {
b=LoadEvents(s_eventfile);
} catch (UnpackError e) {
qWarning() << "Error Unkpacking Events" << s_eventfile;
b=false;
}
s_events_loaded=b;
return b;
};
bool Session::OpenWaveforms() {
if (s_waves_loaded)
return true;
bool b;
try {
b=LoadWaveforms(s_wavefile);
} catch (UnpackError e) {
qWarning() << "Error Unkpacking Wavefile" << s_wavefile;
b=false;
}
s_waves_loaded=b;
return b;
};
bool Session::Store(QString path) bool Session::Store(QString path)
// Storing Session Data in our format // Storing Session Data in our format

View File

@ -29,21 +29,8 @@ public:
bool LoadEvents(QString filename); bool LoadEvents(QString filename);
bool LoadWaveforms(QString filename); bool LoadWaveforms(QString filename);
bool OpenEvents() { bool OpenEvents();
if(s_events_loaded) bool OpenWaveforms();
return true;
bool b=LoadEvents(s_eventfile);
s_events_loaded=b;
return b;
};
bool OpenWaveforms() {
if (s_waves_loaded)
return true;
bool b=LoadWaveforms(s_wavefile);
s_waves_loaded=b;
return b;
};
void TrashEvents(); void TrashEvents();
void TrashWaveforms(); void TrashWaveforms();

View File

@ -505,7 +505,7 @@ void Daily::Load(QDate date)
html+="<table cellspacing=0 cellpadding=2 border=0 width='100%'>\n"; html+="<table cellspacing=0 cellpadding=2 border=0 width='100%'>\n";
QString tmp; QString tmp;
const int gwwidth=270; const int gwwidth=240;
const int gwheight=25; const int gwheight=25;
UpdateCPAPGraphs(cpap); UpdateCPAPGraphs(cpap);
UpdateOXIGraphs(oxi); UpdateOXIGraphs(oxi);

View File

@ -38,6 +38,12 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="maximumSize">
<size>
<width>280</width>
<height>16777215</height>
</size>
</property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -56,7 +62,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>300</width> <width>280</width>
<height>180</height> <height>180</height>
</size> </size>
</property> </property>
@ -459,7 +465,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>728</width> <width>748</width>
<height>620</height> <height>620</height>
</rect> </rect>
</property> </property>

View File

@ -1,16 +1,15 @@
<html> <html>
<head> <head>
<style type='text/css'> <style type='text/css'>
h1,p,a,td,body { font-family: 'FreeSans', 'Sans Serif' } <!--h1,p,a,td,body { font-family: 'FreeSans', 'Sans Serif' } --/>
p,a,td,body { font-size: 14px } p,a,td,body { font-size: 14px }
</style> </style>
</head> </head>
<body leftmargin=0 topmargin=0 rightmargin=0> <body leftmargin=0 topmargin=0 rightmargin=0>
<table width="100%" cellspacing=0 cellpadding=0 border=0 > <table width="100%" cellspacing=0 cellpadding=4 border=0 >
<tr><td bgcolor="#d0d0d0" colspan=2 cellpadding=12 valign=center align=center><font color="black"><h1>Welcome to SleepyHead</h1></font></td></tr> <tr><td bgcolor="#d0d0d0" colspan=2 cellpadding=0 valign=center align=center><font color="black" size=+1><b>Welcome to SleepyHead</b></font></td></tr>
<tr> <tr>
<td valign="top" cellpadding=6> <td valign="top" leftmargin=0 cellpadding=6>
&nbsp;<br>
<p>This software is designed to assist you in reviewing data for your CPAP Machine, Oximeter, and Sleep Stage monitors, as well as help you track general issues related to sleep health.</p> <p>This software is designed to assist you in reviewing data for your CPAP Machine, Oximeter, and Sleep Stage monitors, as well as help you track general issues related to sleep health.</p>
<p>Currenly supports the following machines:</p> <p>Currenly supports the following machines:</p>
<li>Philips Respironics System One (BIPAP and lower)</li> <li>Philips Respironics System One (BIPAP and lower)</li>
@ -22,11 +21,11 @@ p,a,td,body { font-size: 14px }
</td> </td>
<td><image src='qrc:/docs/sheep.png' width=220 height=220><br/> <td><image src='qrc:/docs/sheep.png' width=220 height=220><br/>
<div align=center>This is a temporary logo</div> <div align=center>This is a temporary logo</div>
</td> </td>
</tr> </tr>
</table> <tr>
<hr/> <td colspan=2>
<hr>
<p><b>Copyright:</b> &copy;2011 Mark Watkins (jedimark)</p> <p><b>Copyright:</b> &copy;2011 Mark Watkins (jedimark)</p>
<p><b>License:</b> This software is released freely under the GNU Public License.</p> <p><b>License:</b> This software is released freely under the GNU Public License.</p>
<p><i>This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose. <p><i>This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose.

View File

@ -36,15 +36,6 @@ int main(int argc, char *argv[])
ZEOLoader::Register(); ZEOLoader::Register();
ResmedLoader::Register(); ResmedLoader::Register();
/*Machine *m=new Machine(profile,0);
m->SetClass("Journal");
m->SetType(MT_JOURNAL);
m->properties["Brand"]="Virtual";
profile->AddMachine(m); */
MainWindow w; MainWindow w;
w.show(); w.show();

View File

@ -98,6 +98,12 @@
<string>&amp;Welcome</string> <string>&amp;Welcome</string>
</attribute> </attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item> <item>
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="sizePolicy"> <property name="sizePolicy">
@ -111,6 +117,9 @@
</property> </property>
<widget class="QWidget" name="layoutWidget"> <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<item> <item>
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="sizePolicy"> <property name="sizePolicy">
@ -132,14 +141,14 @@
</size> </size>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::NoFrame</enum>
</property> </property>
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Plain</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>0</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>6</number> <number>6</number>
@ -576,17 +585,6 @@
<addaction name="menu_Help"/> <addaction name="menu_Help"/>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/> <widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="action_Import_Data"> <action name="action_Import_Data">
<property name="text"> <property name="text">
<string>&amp;Import Data</string> <string>&amp;Import Data</string>