diff --git a/Graphs/gLineChart.cpp b/Graphs/gLineChart.cpp index 2085ef37..4b766031 100644 --- a/Graphs/gLineChart.cpp +++ b/Graphs/gLineChart.cpp @@ -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. //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. if (zmouseMoveEvent(event); return; @@ -389,7 +400,6 @@ void gGraphWindow::OnMouseRightDown(QMouseEvent * event) m_drag_foobar=true; LastGraphRDown=this; return; - // wxLogMessage("Foobar Area Pushed"); } else { m_drag_foobar=false; m_mouseRDown=false; @@ -499,6 +509,18 @@ void gGraphWindow::OnMouseLeftDown(QMouseEvent * event) { int y=event->y(); int x=event->x(); + + if (xsetText("BiteMe"); + drag->setMimeData(mimeData); + + Qt::DropAction dropAction = drag->exec(); */ + return; + } int width=m_scrX-GetRightMargin()-GetLeftMargin(); int height=m_scrY-GetBottomMargin()-GetTopMargin(); QRect hot1(GetLeftMargin(),GetTopMargin(),width,height); // Graph data area. @@ -531,8 +553,28 @@ void gGraphWindow::OnMouseLeftDown(QMouseEvent * event) LastGraphLDown=this; } } +void gGraphWindow::dropEvent ( QDropEvent * event ) +{ + int frong=23; + assert(splitter!=NULL); + //m_dragGraph=false; +} + 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?? LastGraphLDown->OnMouseLeftRelease(event); // Nope.. Give it the event. return; diff --git a/Graphs/graphwindow.h b/Graphs/graphwindow.h index 6682adfa..f6288c8b 100644 --- a/Graphs/graphwindow.h +++ b/Graphs/graphwindow.h @@ -9,6 +9,7 @@ #include #include +#include #include #include using namespace std; @@ -31,7 +32,7 @@ public: signals: public slots: - + void dropEvent(QDropEvent * event); public: QBitmap * RenderBitmap(int width,int height); @@ -141,15 +142,20 @@ public: void SetGradientBackground(bool b) { m_gradient_background=b; }; bool GradientBackground() { return m_gradient_background; }; + void SetSplitter(QSplitter *s) { splitter=s; }; + bool isDraggingGraph() { return m_dragGraph; }; protected: void initializeGL(); + QSplitter *splitter; listlink_zoom; //listlink_move; //bool m_block_move; bool m_block_zoom; bool m_drag_foobar; + bool m_dragGraph; double m_foobar_pos,m_foobar_moved; + bool m_gradient_background; std::list layers; QString m_title; diff --git a/daily.cpp b/daily.cpp index ed55ca16..6eba2abc 100644 --- a/daily.cpp +++ b/daily.cpp @@ -66,7 +66,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) : AddCPAPData(flags[8]=new FlagData(PRS1_Unknown0E,1)); 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->SetBlockZoom(true); @@ -93,7 +93,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) : AddCPAPData(pressure_iap=new EventData(CPAP_IAP)); AddCPAPData(pressure_eap=new EventData(CPAP_EAP)); 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 gYAxis()); //PRD->AddLayer(new gFooBar()); @@ -106,7 +106,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) : AddCPAPData(leakdata=new EventData(CPAP_Leak,0)); //leakdata->ForceMinY(0); //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 gYAxis()); //LEAK->AddLayer(new gFooBar()); @@ -118,7 +118,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) : AddCPAPData(frw=new WaveData(CPAP_FlowRate,1000000)); //FlowRate // AddCPAPData(mpw=new WaveData(CPAP_MaskPressure,700000)); //FlowRate // 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 gYAxis()); FRW->AddLayer(new gXAxis()); @@ -139,14 +139,14 @@ Daily::Daily(QWidget *parent,QGLContext *context) : FRW->setMinimumHeight(190); 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 gYAxis()); SNORE->AddLayer(new gLineChart(snore,Qt::black,4096,false,false,true)); SNORE->setMinimumHeight(150); 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 gYAxis()); 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)); - AddGraph(MV=new gGraphWindow(gSplitter,tr("Minute Ventilation"),SF)); + MV=new gGraphWindow(gSplitter,tr("Minute Ventilation"),SF); MV->AddLayer(new gXAxis()); MV->AddLayer(new gYAxis()); MV->AddLayer(new gLineChart(mv,QColor(0x20,0x20,0x7f),65536,false,false,false)); MV->setMinimumHeight(150); 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 gYAxis()); TV->AddLayer(new gLineChart(tv,QColor(0x7f,0x20,0x20),65536,false,false,false)); TV->setMinimumHeight(150); 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 gYAxis()); 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)); //pulse->ForceMinY(40); //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 gYAxis()); // PULSE->AddLayer(new gFooBar()); @@ -189,7 +189,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) : AddOXIData(spo2=new EventData(OXI_SPO2,0,65536,true)); //spo2->ForceMinY(60); //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 gYAxis()); // SPO2->AddLayer(new gFooBar()); @@ -333,18 +333,18 @@ Daily::Daily(QWidget *parent,QGLContext *context) : 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(PULSE); - // gSplitter->addWidget(SPO2); + AddGraph(SF); + AddGraph(FRW); + AddGraph(MV); + AddGraph(TV); + AddGraph(RR); + AddGraph(PRD); + AddGraph(LEAK); + AddGraph(FLG); + AddGraph(SNORE); + AddGraph(PULSE); + // AddGraph(SPO2); gSplitter->refresh(); @@ -371,6 +371,14 @@ Daily::~Daily() delete gSplitter; delete ui; } +void Daily::AddGraph(gGraphWindow *w) +{ + Graphs.push_back(w); + + gSplitter->addWidget(w); + w->SetSplitter(gSplitter); +} + void Daily::ReloadGraphs() { QDate d=profile->LastDay(); diff --git a/daily.h b/daily.h index 06b76a7e..c7b4fcd4 100644 --- a/daily.h +++ b/daily.h @@ -68,7 +68,7 @@ private: void AddCPAPData(gPointData *d) { CPAPData.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 UpdateOXIGraphs(Day *day); diff --git a/daily.ui b/daily.ui index b096de1e..efffd290 100644 --- a/daily.ui +++ b/daily.ui @@ -40,7 +40,7 @@ - 280 + 265 16777215 @@ -62,7 +62,7 @@ - 280 + 265 180 @@ -89,6 +89,12 @@ + + + 265 + 16777215 + + Sans Serif @@ -96,7 +102,7 @@ - 0 + 2 true @@ -313,6 +319,25 @@ + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + This tab is fake.. What to put here? + + + false + + + Qt::AlignCenter + + + @@ -465,7 +490,7 @@ 0 0 - 748 + 763 620 diff --git a/docs/index.html b/docs/index.html index 170bce6c..f5227107 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,9 +28,7 @@ p,a,td,body { font-size: 14px }

Copyright: ©2011 Mark Watkins (jedimark)

License: This software is released freely under the GNU Public License.

-

This software comes with absolutely no warranty, either express of implied. It comes with no guarantee of fitness for any particular purpose. -No guarantees are made to the accuracy or usefulness of any data displayed.

-

It would very unwise to rely soley on this software when making medical decisions. Talk to your doctor.

+

It would very unwise to rely solely on this software when making medical decisions. Talk to your doctor.

diff --git a/overview.ui b/overview.ui index 7e7836fd..9844d29a 100644 --- a/overview.ui +++ b/overview.ui @@ -40,6 +40,16 @@ Summary + + + + This whole page is still being figured out. + + + true + + +