Changing computers

This commit is contained in:
Mark Watkins 2011-07-04 21:37:26 +10:00
parent b15153917b
commit 26d472fc50
8 changed files with 125 additions and 37 deletions

View File

@ -250,9 +250,8 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
// 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();
int y1=1+(jy-miny)*ymult; int y1=1+(point[i].y()-miny)*ymult;
int z=floor(px); // Hmmm... round may screw this up. int z=floor(px); // Hmmm... round may screw this up.
if (z<minz) minz=z; // minz=First pixel if (z<minz) minz=z; // minz=First pixel

View File

@ -12,11 +12,14 @@
gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLWidget * shared,Qt::WindowFlags f) gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLWidget * shared,Qt::WindowFlags f)
: QGLWidget(parent,shared, f ) : QGLWidget(parent,shared, f )
{ {
splitter=NULL;
m_scrX = m_scrY = 100; m_scrX = m_scrY = 100;
m_title=title; m_title=title;
m_mouseRDown=m_mouseLDown=false; m_mouseRDown=m_mouseLDown=false;
m_block_zoom=false; m_block_zoom=false;
m_drag_foobar=false; m_drag_foobar=false;
m_dragGraph=false;
m_gradient_background=true; m_gradient_background=true;
m_foobar_pos=0; m_foobar_pos=0;
m_foobar_moved=0; m_foobar_moved=0;
@ -27,7 +30,8 @@ gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLWidget * s
if (!title.isEmpty()) { if (!title.isEmpty()) {
AddLayer(new gTitle(title)); AddLayer(new gTitle(title));
} }
//setAcceptDrops(true);
setMouseTracking(true);
} }
gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext * context,Qt::WindowFlags f) gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext * context,Qt::WindowFlags f)
@ -40,6 +44,7 @@ gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext *
SetMargins(10, 15, 0, 0); SetMargins(10, 15, 0, 0);
m_block_zoom=false; m_block_zoom=false;
m_drag_foobar=false; m_drag_foobar=false;
m_dragGraph=false;
m_gradient_background=false; m_gradient_background=false;
m_foobar_pos=0; m_foobar_pos=0;
m_foobar_moved=0; m_foobar_moved=0;
@ -50,6 +55,8 @@ gGraphWindow::gGraphWindow(QWidget *parent, const QString & title, QGLContext *
if (!title.isEmpty()) { if (!title.isEmpty()) {
AddLayer(new gTitle(title)); AddLayer(new gTitle(title));
} }
//setAcceptDrops(true);
setMouseTracking(true);
} }
gGraphWindow::~gGraphWindow() gGraphWindow::~gGraphWindow()
@ -227,13 +234,17 @@ void gGraphWindow::ZoomX(double mult,int origin_px)
} }
gGraphWindow *LastGraphLDown=NULL; gGraphWindow *LastGraphLDown=NULL;
gGraphWindow *LastGraphRDown=NULL; gGraphWindow *LastGraphRDown=NULL;
gGraphWindow *currentWidget=NULL;
void gGraphWindow::mouseMoveEvent(QMouseEvent * event) void gGraphWindow::mouseMoveEvent(QMouseEvent * event)
{ {
// static bool first=true; // static bool first=true;
static QRect last; static QRect last;
// grabbed // grabbed
if (m_dragGraph) {
if (LastGraphLDown!=this)
currentWidget=this;
return;
}
if (m_mouseLDown && LastGraphLDown && (LastGraphLDown!=this)) { if (m_mouseLDown && LastGraphLDown && (LastGraphLDown!=this)) {
LastGraphLDown->mouseMoveEvent(event); LastGraphLDown->mouseMoveEvent(event);
return; return;
@ -389,7 +400,6 @@ void gGraphWindow::OnMouseRightDown(QMouseEvent * event)
m_drag_foobar=true; m_drag_foobar=true;
LastGraphRDown=this; LastGraphRDown=this;
return; return;
// wxLogMessage("Foobar Area Pushed");
} else { } else {
m_drag_foobar=false; m_drag_foobar=false;
m_mouseRDown=false; m_mouseRDown=false;
@ -499,6 +509,18 @@ void gGraphWindow::OnMouseLeftDown(QMouseEvent * event)
{ {
int y=event->y(); int y=event->y();
int x=event->x(); int x=event->x();
if (x<GetLeftMargin()) {
LastGraphLDown=this;
m_dragGraph=true;
/* QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
mimeData->setText("BiteMe");
drag->setMimeData(mimeData);
Qt::DropAction dropAction = drag->exec(); */
return;
}
int width=m_scrX-GetRightMargin()-GetLeftMargin(); int width=m_scrX-GetRightMargin()-GetLeftMargin();
int height=m_scrY-GetBottomMargin()-GetTopMargin(); int height=m_scrY-GetBottomMargin()-GetTopMargin();
QRect hot1(GetLeftMargin(),GetTopMargin(),width,height); // Graph data area. QRect hot1(GetLeftMargin(),GetTopMargin(),width,height); // Graph data area.
@ -531,8 +553,28 @@ void gGraphWindow::OnMouseLeftDown(QMouseEvent * event)
LastGraphLDown=this; LastGraphLDown=this;
} }
} }
void gGraphWindow::dropEvent ( QDropEvent * event )
{
int frong=23;
assert(splitter!=NULL);
//m_dragGraph=false;
}
void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event) void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event)
{ {
if (m_dragGraph) {
if (splitter && currentWidget && LastGraphLDown) {
if (LastGraphLDown!=currentWidget) {
int newidx=splitter->indexOf(currentWidget);
int idx=splitter->indexOf(LastGraphLDown);
splitter->insertWidget(newidx,LastGraphLDown);
return;
}
}
m_dragGraph=false;
return;
}
if (LastGraphLDown && (LastGraphLDown!=this)) { // Same graph that initiated the click?? if (LastGraphLDown && (LastGraphLDown!=this)) { // Same graph that initiated the click??
LastGraphLDown->OnMouseLeftRelease(event); // Nope.. Give it the event. LastGraphLDown->OnMouseLeftRelease(event); // Nope.. Give it the event.
return; return;

View File

@ -9,6 +9,7 @@
#include <QGLContext> #include <QGLContext>
#include <QGLWidget> #include <QGLWidget>
#include <QSplitter>
#include <QDateTime> #include <QDateTime>
#include <list> #include <list>
using namespace std; using namespace std;
@ -31,7 +32,7 @@ public:
signals: signals:
public slots: public slots:
void dropEvent(QDropEvent * event);
public: public:
QBitmap * RenderBitmap(int width,int height); QBitmap * RenderBitmap(int width,int height);
@ -141,15 +142,20 @@ public:
void SetGradientBackground(bool b) { m_gradient_background=b; }; void SetGradientBackground(bool b) { m_gradient_background=b; };
bool GradientBackground() { return m_gradient_background; }; bool GradientBackground() { return m_gradient_background; };
void SetSplitter(QSplitter *s) { splitter=s; };
bool isDraggingGraph() { return m_dragGraph; };
protected: protected:
void initializeGL(); void initializeGL();
QSplitter *splitter;
list<gGraphWindow *>link_zoom; list<gGraphWindow *>link_zoom;
//list<gGraphWindow *>link_move; //list<gGraphWindow *>link_move;
//bool m_block_move; //bool m_block_move;
bool m_block_zoom; bool m_block_zoom;
bool m_drag_foobar; bool m_drag_foobar;
bool m_dragGraph;
double m_foobar_pos,m_foobar_moved; double m_foobar_pos,m_foobar_moved;
bool m_gradient_background; bool m_gradient_background;
std::list<gLayer *> layers; std::list<gLayer *> layers;
QString m_title; QString m_title;

View File

@ -66,7 +66,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(flags[8]=new FlagData(PRS1_Unknown0E,1)); AddCPAPData(flags[8]=new FlagData(PRS1_Unknown0E,1));
AddCPAPData(flags[9]=new FlagData(CPAP_Snore,1)); // Snore Index AddCPAPData(flags[9]=new FlagData(CPAP_Snore,1)); // Snore Index
AddGraph(SF=new gGraphWindow(gSplitter,tr("Event Flags"),(QGLWidget *)NULL)); SF=new gGraphWindow(gSplitter,tr("Event Flags"),(QGLWidget *)NULL);
SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin); SF->SetLeftMargin(SF->GetLeftMargin()+gYAxis::Margin);
SF->SetBlockZoom(true); SF->SetBlockZoom(true);
@ -93,7 +93,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(pressure_iap=new EventData(CPAP_IAP)); AddCPAPData(pressure_iap=new EventData(CPAP_IAP));
AddCPAPData(pressure_eap=new EventData(CPAP_EAP)); AddCPAPData(pressure_eap=new EventData(CPAP_EAP));
AddCPAPData(prd=new EventData(CPAP_Pressure)); AddCPAPData(prd=new EventData(CPAP_Pressure));
AddGraph(PRD=new gGraphWindow(gSplitter,tr("Pressure"),SF)); PRD=new gGraphWindow(gSplitter,tr("Pressure"),SF);
PRD->AddLayer(new gXAxis()); PRD->AddLayer(new gXAxis());
PRD->AddLayer(new gYAxis()); PRD->AddLayer(new gYAxis());
//PRD->AddLayer(new gFooBar()); //PRD->AddLayer(new gFooBar());
@ -106,7 +106,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(leakdata=new EventData(CPAP_Leak,0)); AddCPAPData(leakdata=new EventData(CPAP_Leak,0));
//leakdata->ForceMinY(0); //leakdata->ForceMinY(0);
//leakdata->ForceMaxY(120); //leakdata->ForceMaxY(120);
AddGraph(LEAK=new gGraphWindow(gSplitter,tr("Leaks"),SF)); LEAK=new gGraphWindow(gSplitter,tr("Leaks"),SF);
LEAK->AddLayer(new gXAxis()); LEAK->AddLayer(new gXAxis());
LEAK->AddLayer(new gYAxis()); LEAK->AddLayer(new gYAxis());
//LEAK->AddLayer(new gFooBar()); //LEAK->AddLayer(new gFooBar());
@ -118,7 +118,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(frw=new WaveData(CPAP_FlowRate,1000000)); //FlowRate AddCPAPData(frw=new WaveData(CPAP_FlowRate,1000000)); //FlowRate
// AddCPAPData(mpw=new WaveData(CPAP_MaskPressure,700000)); //FlowRate // AddCPAPData(mpw=new WaveData(CPAP_MaskPressure,700000)); //FlowRate
// Holy crap resmed stuff is huge.. // Holy crap resmed stuff is huge..
AddGraph(FRW=new gGraphWindow(gSplitter,tr("Flow Rate"),SF)); FRW=new gGraphWindow(gSplitter,tr("Flow Rate"),SF);
//FRW->AddLayer(new gFooBar()); //FRW->AddLayer(new gFooBar());
FRW->AddLayer(new gYAxis()); FRW->AddLayer(new gYAxis());
FRW->AddLayer(new gXAxis()); FRW->AddLayer(new gXAxis());
@ -139,14 +139,14 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
FRW->setMinimumHeight(190); FRW->setMinimumHeight(190);
AddCPAPData(snore=new EventData(CPAP_Snore,0)); AddCPAPData(snore=new EventData(CPAP_Snore,0));
AddGraph(SNORE=new gGraphWindow(gSplitter,tr("Snore"),SF)); SNORE=new gGraphWindow(gSplitter,tr("Snore"),SF);
SNORE->AddLayer(new gXAxis()); SNORE->AddLayer(new gXAxis());
SNORE->AddLayer(new gYAxis()); SNORE->AddLayer(new gYAxis());
SNORE->AddLayer(new gLineChart(snore,Qt::black,4096,false,false,true)); SNORE->AddLayer(new gLineChart(snore,Qt::black,4096,false,false,true));
SNORE->setMinimumHeight(150); SNORE->setMinimumHeight(150);
AddCPAPData(flg=new EventData(CPAP_FlowLimitGraph,0)); AddCPAPData(flg=new EventData(CPAP_FlowLimitGraph,0));
AddGraph(FLG=new gGraphWindow(gSplitter,tr("Flow Limitation"),SF)); FLG=new gGraphWindow(gSplitter,tr("Flow Limitation"),SF);
FLG->AddLayer(new gXAxis()); FLG->AddLayer(new gXAxis());
FLG->AddLayer(new gYAxis()); FLG->AddLayer(new gYAxis());
FLG->AddLayer(new gLineChart(flg,Qt::black,4096,false,false,true)); FLG->AddLayer(new gLineChart(flg,Qt::black,4096,false,false,true));
@ -154,21 +154,21 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddCPAPData(mv=new WaveData(CPAP_MinuteVentilation)); AddCPAPData(mv=new WaveData(CPAP_MinuteVentilation));
AddGraph(MV=new gGraphWindow(gSplitter,tr("Minute Ventilation"),SF)); MV=new gGraphWindow(gSplitter,tr("Minute Ventilation"),SF);
MV->AddLayer(new gXAxis()); MV->AddLayer(new gXAxis());
MV->AddLayer(new gYAxis()); MV->AddLayer(new gYAxis());
MV->AddLayer(new gLineChart(mv,QColor(0x20,0x20,0x7f),65536,false,false,false)); MV->AddLayer(new gLineChart(mv,QColor(0x20,0x20,0x7f),65536,false,false,false));
MV->setMinimumHeight(150); MV->setMinimumHeight(150);
AddCPAPData(tv=new WaveData(CPAP_TidalVolume)); AddCPAPData(tv=new WaveData(CPAP_TidalVolume));
AddGraph(TV=new gGraphWindow(gSplitter,tr("Tidal Volume"),SF)); TV=new gGraphWindow(gSplitter,tr("Tidal Volume"),SF);
TV->AddLayer(new gXAxis()); TV->AddLayer(new gXAxis());
TV->AddLayer(new gYAxis()); TV->AddLayer(new gYAxis());
TV->AddLayer(new gLineChart(tv,QColor(0x7f,0x20,0x20),65536,false,false,false)); TV->AddLayer(new gLineChart(tv,QColor(0x7f,0x20,0x20),65536,false,false,false));
TV->setMinimumHeight(150); TV->setMinimumHeight(150);
AddCPAPData(rr=new WaveData(CPAP_RespiratoryRate)); AddCPAPData(rr=new WaveData(CPAP_RespiratoryRate));
AddGraph(RR=new gGraphWindow(gSplitter,tr("Respiratory Rate"),SF)); RR=new gGraphWindow(gSplitter,tr("Respiratory Rate"),SF);
RR->AddLayer(new gXAxis()); RR->AddLayer(new gXAxis());
RR->AddLayer(new gYAxis()); RR->AddLayer(new gYAxis());
RR->AddLayer(new gLineChart(rr,Qt::gray,65536,false,false,false)); RR->AddLayer(new gLineChart(rr,Qt::gray,65536,false,false,false));
@ -178,7 +178,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddOXIData(pulse=new EventData(OXI_Pulse,0,65536,true)); AddOXIData(pulse=new EventData(OXI_Pulse,0,65536,true));
//pulse->ForceMinY(40); //pulse->ForceMinY(40);
//pulse->ForceMaxY(120); //pulse->ForceMaxY(120);
AddGraph(PULSE=new gGraphWindow(gSplitter,tr("Pulse & SpO2"),SF)); PULSE=new gGraphWindow(gSplitter,tr("Pulse & SpO2"),SF);
PULSE->AddLayer(new gXAxis()); PULSE->AddLayer(new gXAxis());
PULSE->AddLayer(new gYAxis()); PULSE->AddLayer(new gYAxis());
// PULSE->AddLayer(new gFooBar()); // PULSE->AddLayer(new gFooBar());
@ -189,7 +189,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
AddOXIData(spo2=new EventData(OXI_SPO2,0,65536,true)); AddOXIData(spo2=new EventData(OXI_SPO2,0,65536,true));
//spo2->ForceMinY(60); //spo2->ForceMinY(60);
//spo2->ForceMaxY(100); //spo2->ForceMaxY(100);
// AddGraph(SPO2=new gGraphWindow(gSplitter,tr("SpO2"),SF)); // SPO2=new gGraphWindow(gSplitter,tr("SpO2"),SF);
// SPO2->AddLayer(new gXAxis()); // SPO2->AddLayer(new gXAxis());
// SPO2->AddLayer(new gYAxis()); // SPO2->AddLayer(new gYAxis());
// SPO2->AddLayer(new gFooBar()); // SPO2->AddLayer(new gFooBar());
@ -333,18 +333,18 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
FLG->LinkZoom(RR); FLG->LinkZoom(RR);
gSplitter->addWidget(SF);
gSplitter->addWidget(FRW);
gSplitter->addWidget(MV);
gSplitter->addWidget(TV);
gSplitter->addWidget(RR);
gSplitter->addWidget(PRD);
gSplitter->addWidget(LEAK);
gSplitter->addWidget(FLG);
gSplitter->addWidget(SNORE);
gSplitter->addWidget(NoData); gSplitter->addWidget(NoData);
gSplitter->addWidget(PULSE); AddGraph(SF);
// gSplitter->addWidget(SPO2); AddGraph(FRW);
AddGraph(MV);
AddGraph(TV);
AddGraph(RR);
AddGraph(PRD);
AddGraph(LEAK);
AddGraph(FLG);
AddGraph(SNORE);
AddGraph(PULSE);
// AddGraph(SPO2);
gSplitter->refresh(); gSplitter->refresh();
@ -371,6 +371,14 @@ Daily::~Daily()
delete gSplitter; delete gSplitter;
delete ui; delete ui;
} }
void Daily::AddGraph(gGraphWindow *w)
{
Graphs.push_back(w);
gSplitter->addWidget(w);
w->SetSplitter(gSplitter);
}
void Daily::ReloadGraphs() void Daily::ReloadGraphs()
{ {
QDate d=profile->LastDay(); QDate d=profile->LastDay();

View File

@ -68,7 +68,7 @@ private:
void AddCPAPData(gPointData *d) { CPAPData.push_back(d); }; void AddCPAPData(gPointData *d) { CPAPData.push_back(d); };
void AddOXIData(gPointData *d) { OXIData.push_back(d); }; void AddOXIData(gPointData *d) { OXIData.push_back(d); };
void AddGraph(gGraphWindow *w) { Graphs.push_back(w); }; void AddGraph(gGraphWindow *w);
void UpdateCPAPGraphs(Day *day); void UpdateCPAPGraphs(Day *day);
void UpdateOXIGraphs(Day *day); void UpdateOXIGraphs(Day *day);

View File

@ -40,7 +40,7 @@
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>280</width> <width>265</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -62,7 +62,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>280</width> <width>265</width>
<height>180</height> <height>180</height>
</size> </size>
</property> </property>
@ -89,6 +89,12 @@
</property> </property>
</widget> </widget>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="maximumSize">
<size>
<width>265</width>
<height>16777215</height>
</size>
</property>
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
@ -96,7 +102,7 @@
</font> </font>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<property name="movable"> <property name="movable">
<bool>true</bool> <bool>true</bool>
@ -313,6 +319,25 @@
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_11"> <layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QLabel" name="label_6">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string>This tab is fake.. What to put here?</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
@ -465,7 +490,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>748</width> <width>763</width>
<height>620</height> <height>620</height>
</rect> </rect>
</property> </property>

View File

@ -28,9 +28,7 @@ p,a,td,body { font-size: 14px }
<hr> <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><b>It would very unwise to rely solely on this software when making medical decisions. Talk to your doctor.</b></p>
No guarantees are made to the accuracy or usefulness of any data displayed.</i></p>
<p><b>It would very unwise to rely soley on this software when making medical decisions. Talk to your doctor.</b></p>
</td></tr> </td></tr>
</table> </table>
</body> </body>

View File

@ -40,6 +40,16 @@
<string>Summary</string> <string>Summary</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>This whole page is still being figured out.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QWebView" name="webView"> <widget class="QWebView" name="webView">
<property name="minimumSize"> <property name="minimumSize">