mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Stop weekends showing in red, plus added GraphView groups, also Pulse/SPO2/Plethy graphs
This commit is contained in:
parent
6b3bfe48fa
commit
07b2eb7481
@ -142,7 +142,7 @@ EventDataType LayerGroup::Maxy()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
gGraph::gGraph(gGraphView *graphview,QString title,int height) :
|
gGraph::gGraph(gGraphView *graphview,QString title,int height,short group) :
|
||||||
m_graphview(graphview),
|
m_graphview(graphview),
|
||||||
m_title(title),
|
m_title(title),
|
||||||
m_height(height),
|
m_height(height),
|
||||||
@ -150,8 +150,9 @@ gGraph::gGraph(gGraphView *graphview,QString title,int height) :
|
|||||||
{
|
{
|
||||||
m_min_height=50;
|
m_min_height=50;
|
||||||
m_layers.clear();
|
m_layers.clear();
|
||||||
|
|
||||||
if (graphview) {
|
if (graphview) {
|
||||||
graphview->AddGraph(this);
|
graphview->AddGraph(this,group);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "gGraph created without a gGraphView container.. Naughty programmer!! Bad!!!";
|
qWarning() << "gGraph created without a gGraphView container.. Naughty programmer!! Bad!!!";
|
||||||
}
|
}
|
||||||
@ -357,7 +358,7 @@ void gGraph::mouseMoveEvent(QMouseEvent * event)
|
|||||||
min_x=rmax_x-xx;
|
min_x=rmax_x-xx;
|
||||||
}
|
}
|
||||||
//if (a2>rmax_x) a2=rmax_x;
|
//if (a2>rmax_x) a2=rmax_x;
|
||||||
m_graphview->SetXBounds(min_x,max_x);
|
m_graphview->SetXBounds(min_x,max_x,m_group);
|
||||||
} else {
|
} else {
|
||||||
qint64 qq=rmax_x-rmin_x;
|
qint64 qq=rmax_x-rmin_x;
|
||||||
xx=max_x-min_x;
|
xx=max_x-min_x;
|
||||||
@ -374,7 +375,7 @@ void gGraph::mouseMoveEvent(QMouseEvent * event)
|
|||||||
max_x=rmax_x;
|
max_x=rmax_x;
|
||||||
min_x=rmax_x-xx;
|
min_x=rmax_x-xx;
|
||||||
}
|
}
|
||||||
m_graphview->SetXBounds(min_x,max_x);
|
m_graphview->SetXBounds(min_x,max_x,m_group);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +447,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event)
|
|||||||
qint64 a1=MIN(j1,j2)
|
qint64 a1=MIN(j1,j2)
|
||||||
qint64 a2=MAX(j1,j2)
|
qint64 a2=MAX(j1,j2)
|
||||||
if (a2>rmax_x) a2=rmax_x;
|
if (a2>rmax_x) a2=rmax_x;
|
||||||
m_graphview->SetXBounds(a1,a2);
|
m_graphview->SetXBounds(a1,a2,m_group);
|
||||||
} else {
|
} else {
|
||||||
double xx=rmax_x-rmin_x;
|
double xx=rmax_x-rmin_x;
|
||||||
double xmult=xx/double(w);
|
double xmult=xx/double(w);
|
||||||
@ -455,7 +456,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent * event)
|
|||||||
qint64 a1=MIN(j1,j2)
|
qint64 a1=MIN(j1,j2)
|
||||||
qint64 a2=MAX(j1,j2)
|
qint64 a2=MAX(j1,j2)
|
||||||
if (a2>rmax_x) a2=rmax_x;
|
if (a2>rmax_x) a2=rmax_x;
|
||||||
m_graphview->SetXBounds(a1,a2);
|
m_graphview->SetXBounds(a1,a2,m_group);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -528,7 +529,7 @@ void gGraph::ZoomX(double mult,int origin_px)
|
|||||||
max=rmax_x;
|
max=rmax_x;
|
||||||
min=max-q;
|
min=max-q;
|
||||||
}
|
}
|
||||||
m_graphview->SetXBounds(min,max);
|
m_graphview->SetXBounds(min,max,m_group);
|
||||||
//updateSelectionTime(max-min);
|
//updateSelectionTime(max-min);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,9 +698,11 @@ void gGraphView::DrawTextQue()
|
|||||||
painter.translate(-q.x, -q.y);
|
painter.translate(-q.x, -q.y);
|
||||||
}
|
}
|
||||||
q.text.clear();
|
q.text.clear();
|
||||||
|
//q.text.squeeze();
|
||||||
}
|
}
|
||||||
painter.end();
|
painter.end();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
qDebug() << "rendered" << m_textque_items << "text items";
|
||||||
m_textque_items=0;
|
m_textque_items=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -718,9 +721,10 @@ void gGraphView::AddTextQue(QString & text, short x, short y, float angle, QColo
|
|||||||
m_textque_items++;
|
m_textque_items++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraphView::AddGraph(gGraph *g)
|
void gGraphView::AddGraph(gGraph *g,short group)
|
||||||
{
|
{
|
||||||
if (!m_graphs.contains(g)) {
|
if (!m_graphs.contains(g)) {
|
||||||
|
g->setGroup(group);
|
||||||
m_graphs.push_back(g);
|
m_graphs.push_back(g);
|
||||||
|
|
||||||
updateScrollBar();
|
updateScrollBar();
|
||||||
@ -770,18 +774,20 @@ void gGraphView::scrollbarValueChanged(int val)
|
|||||||
m_offsetY=val;
|
m_offsetY=val;
|
||||||
updateGL(); // do this on a timer?
|
updateGL(); // do this on a timer?
|
||||||
}
|
}
|
||||||
void gGraphView::ResetBounds()
|
void gGraphView::ResetBounds(short group)
|
||||||
{
|
{
|
||||||
for (int i=0;i<m_graphs.size();i++) {
|
for (int i=0;i<m_graphs.size();i++) {
|
||||||
m_graphs[i]->ResetBounds();
|
if (m_graphs[i]->group()==group)
|
||||||
|
m_graphs[i]->ResetBounds();
|
||||||
}
|
}
|
||||||
updateScale();
|
updateScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gGraphView::SetXBounds(qint64 minx, qint64 maxx)
|
void gGraphView::SetXBounds(qint64 minx, qint64 maxx,short group)
|
||||||
{
|
{
|
||||||
for (int i=0;i<m_graphs.size();i++) {
|
for (int i=0;i<m_graphs.size();i++) {
|
||||||
m_graphs[i]->SetXBounds(minx,maxx);
|
if (m_graphs[i]->group()==group)
|
||||||
|
m_graphs[i]->SetXBounds(minx,maxx);
|
||||||
}
|
}
|
||||||
updateGL();
|
updateGL();
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ class gGraph
|
|||||||
{
|
{
|
||||||
friend class gGraphView;
|
friend class gGraphView;
|
||||||
public:
|
public:
|
||||||
gGraph(gGraphView * graphview=NULL, QString title="",int height=100);
|
gGraph(gGraphView * graphview=NULL, QString title="",int height=100,short group=0);
|
||||||
virtual ~gGraph();
|
virtual ~gGraph();
|
||||||
|
|
||||||
void setVisible(bool b) { m_visible=b; }
|
void setVisible(bool b) { m_visible=b; }
|
||||||
@ -160,6 +160,9 @@ public:
|
|||||||
void setBlockZoom(bool b) { m_blockzoom=b; }
|
void setBlockZoom(bool b) { m_blockzoom=b; }
|
||||||
int flipY(int y); // flip GL coordinates
|
int flipY(int y); // flip GL coordinates
|
||||||
|
|
||||||
|
short group() { return m_group; }
|
||||||
|
void setGroup(short group) { m_group=group; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paint(int originX, int originY, int width, int height);
|
virtual void paint(int originX, int originY, int width, int height);
|
||||||
void invalidate();
|
void invalidate();
|
||||||
@ -190,6 +193,7 @@ protected:
|
|||||||
QRect m_selection;
|
QRect m_selection;
|
||||||
bool m_selecting_area;
|
bool m_selecting_area;
|
||||||
QPoint m_current;
|
QPoint m_current;
|
||||||
|
short m_group;
|
||||||
};
|
};
|
||||||
|
|
||||||
class gGraphView : public QGLWidget
|
class gGraphView : public QGLWidget
|
||||||
@ -198,7 +202,7 @@ class gGraphView : public QGLWidget
|
|||||||
public:
|
public:
|
||||||
explicit gGraphView(QWidget *parent = 0);
|
explicit gGraphView(QWidget *parent = 0);
|
||||||
virtual ~gGraphView();
|
virtual ~gGraphView();
|
||||||
void AddGraph(gGraph *g);
|
void AddGraph(gGraph *g,short group=0);
|
||||||
|
|
||||||
void setScrollBar(MyScrollBar *sb);
|
void setScrollBar(MyScrollBar *sb);
|
||||||
MyScrollBar * scrollBar() { return m_scrollbar; }
|
MyScrollBar * scrollBar() { return m_scrollbar; }
|
||||||
@ -209,8 +213,8 @@ public:
|
|||||||
|
|
||||||
float scaleY() { return m_scaleY; }
|
float scaleY() { return m_scaleY; }
|
||||||
|
|
||||||
void ResetBounds();
|
void ResetBounds(short group=0);
|
||||||
void SetXBounds(qint64 minx, qint64 maxx);
|
void SetXBounds(qint64 minx, qint64 maxx, short group=0);
|
||||||
|
|
||||||
bool hasGraphs() { return m_graphs.size()>0; }
|
bool hasGraphs() { return m_graphs.size()>0; }
|
||||||
|
|
||||||
|
35
daily.cpp
35
daily.cpp
@ -76,6 +76,11 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
FLG=new gGraph(GraphView,"Flow Limitation",180);
|
FLG=new gGraph(GraphView,"Flow Limitation",180);
|
||||||
PTB=new gGraph(GraphView,"Patient Trig. Breath",180);
|
PTB=new gGraph(GraphView,"Patient Trig. Breath",180);
|
||||||
|
|
||||||
|
PULSE=new gGraph(GraphView,"Pulse",180,1);
|
||||||
|
SPO2=new gGraph(GraphView,"SPO2",180,1);
|
||||||
|
PLETHY=new gGraph(GraphView,"Plethy",180,1);
|
||||||
|
|
||||||
|
|
||||||
gFlagsGroup *fg=new gFlagsGroup();
|
gFlagsGroup *fg=new gFlagsGroup();
|
||||||
fg->AddLayer((new gFlagsLine(CPAP_CSR,QColor("light green"),"CSR",false,FT_Span)));
|
fg->AddLayer((new gFlagsLine(CPAP_CSR,QColor("light green"),"CSR",false,FT_Span)));
|
||||||
fg->AddLayer((new gFlagsLine(CPAP_ClearAirway,QColor("purple"),"CA",true)));
|
fg->AddLayer((new gFlagsLine(CPAP_ClearAirway,QColor("purple"),"CA",true)));
|
||||||
@ -163,6 +168,23 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
FLG->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
FLG->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||||
FLG->AddLayer(new gXAxis(),LayerBottom,0,20);
|
FLG->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||||
|
|
||||||
|
|
||||||
|
PULSE->AddLayer(new gXGrid());
|
||||||
|
PULSE->AddLayer(AddOXI(new gLineChart(OXI_Pulse,Qt::red,true)));
|
||||||
|
PULSE->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||||
|
PULSE->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||||
|
|
||||||
|
SPO2->AddLayer(new gXGrid());
|
||||||
|
SPO2->AddLayer(AddOXI(new gLineChart(OXI_SPO2,Qt::blue,true)));
|
||||||
|
SPO2->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||||
|
SPO2->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||||
|
|
||||||
|
PLETHY->AddLayer(new gXGrid());
|
||||||
|
PLETHY->AddLayer(AddOXI(new gLineChart(OXI_Plethysomogram,Qt::darkBlue,false)));
|
||||||
|
PLETHY->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||||
|
PLETHY->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||||
|
|
||||||
|
|
||||||
//AddGraph(SF);
|
//AddGraph(SF);
|
||||||
//AddGraph(FRW);
|
//AddGraph(FRW);
|
||||||
//AddGraph(PRD);
|
//AddGraph(PRD);
|
||||||
@ -177,6 +199,13 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
|
|
||||||
layout->layout();
|
layout->layout();
|
||||||
|
|
||||||
|
QTextCharFormat format = ui->calendar->weekdayTextFormat(Qt::Saturday);
|
||||||
|
format.setForeground(QBrush(Qt::black, Qt::SolidPattern));
|
||||||
|
ui->calendar->setWeekdayTextFormat(Qt::Saturday, format);
|
||||||
|
ui->calendar->setWeekdayTextFormat(Qt::Sunday, format);
|
||||||
|
|
||||||
|
ui->tabWidget->setCurrentWidget(ui->details);
|
||||||
|
|
||||||
|
|
||||||
/* scrollArea=new MyScrollArea(ui->graphMainArea,this);
|
/* scrollArea=new MyScrollArea(ui->graphMainArea,this);
|
||||||
=======
|
=======
|
||||||
@ -529,12 +558,6 @@ Daily::Daily(QWidget *parent,QGLWidget * shared, MainWindow *mw)
|
|||||||
//splitter->update();
|
//splitter->update();
|
||||||
|
|
||||||
|
|
||||||
QTextCharFormat format = ui->calendar->weekdayTextFormat(Qt::Saturday);
|
|
||||||
format.setForeground(QBrush(Qt::black, Qt::SolidPattern));
|
|
||||||
ui->calendar->setWeekdayTextFormat(Qt::Saturday, format);
|
|
||||||
ui->calendar->setWeekdayTextFormat(Qt::Sunday, format);
|
|
||||||
|
|
||||||
ui->tabWidget->setCurrentWidget(ui->details);
|
|
||||||
|
|
||||||
if (mainwin) {
|
if (mainwin) {
|
||||||
show_graph_menu=mainwin->CreateMenu("Graphs");
|
show_graph_menu=mainwin->CreateMenu("Graphs");
|
||||||
|
@ -566,7 +566,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>930</width>
|
<width>930</width>
|
||||||
<height>25</height>
|
<height>24</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
Loading…
Reference in New Issue
Block a user