mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
YAxis ticker rounding fixes, Temporary graph on/off switch area below daily grapharea
This commit is contained in:
parent
4d3fc5b4ca
commit
56b663c99f
@ -1602,6 +1602,9 @@ void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
||||
if (rec_miny!=rec_maxy) {
|
||||
if (miny>rec_miny) miny=rec_miny;
|
||||
if (maxy<rec_maxy) maxy=rec_maxy;
|
||||
|
||||
if (miny==rec_miny) return;
|
||||
if (maxy==rec_maxy) return;
|
||||
}
|
||||
if (maxy==miny) {
|
||||
m=ceil(maxy/2.0);
|
||||
@ -1612,32 +1615,11 @@ void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
||||
m=floor(miny/2.0);
|
||||
t=m*2;
|
||||
if (miny==t) t-=2;
|
||||
if (miny>=0 && t<0) t=0;
|
||||
miny=t;
|
||||
return;
|
||||
} else
|
||||
/*if (maxy>500) {
|
||||
m=ceil(maxy/100.0);
|
||||
maxy=m*100;
|
||||
//m=floor(miny/100.0);
|
||||
//miny=m*100;
|
||||
} else if (maxy>150) {
|
||||
m=ceil(maxy/50.0);
|
||||
maxy=m*50;
|
||||
//m=floor(miny/50.0);
|
||||
//miny=m*50;
|
||||
} else if (maxy>100) {
|
||||
m=ceil(maxy/20.0);
|
||||
maxy=m*20;
|
||||
//m=floor(miny/20.0);
|
||||
//miny=m*20;
|
||||
} else if (maxy>40) {
|
||||
m=ceil(maxy/10.0);
|
||||
m++;
|
||||
maxy=m*10;
|
||||
//m=floor(miny/10.0);
|
||||
//if(m<0) m--;
|
||||
//miny=m*10;
|
||||
} else */
|
||||
}
|
||||
|
||||
if (maxy>=5) {
|
||||
m=ceil(maxy/5.0);
|
||||
t=m*5;
|
||||
@ -1648,12 +1630,12 @@ void gGraph::roundY(EventDataType &miny, EventDataType &maxy)
|
||||
if (maxy==miny && maxy==0) {
|
||||
maxy=0.5;
|
||||
} else {
|
||||
maxy*=4.0;
|
||||
miny*=4.0;
|
||||
//maxy*=4.0;
|
||||
//miny*=4.0;
|
||||
maxy=ceil(maxy);
|
||||
miny=floor(miny);
|
||||
maxy/=4.0;
|
||||
miny/=4.0;
|
||||
//maxy/=4.0;
|
||||
//miny/=4.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,6 +330,7 @@ public:
|
||||
void setGroup(short group) { m_group=group; }
|
||||
void DrawTextQue();
|
||||
void setDay(Day * day);
|
||||
Day * day() { return m_day; }
|
||||
virtual void paint(int originX, int originY, int width, int height);
|
||||
void ToolTip(QString text, int x, int y, int timeout=2000);
|
||||
void redraw();
|
||||
|
@ -133,7 +133,7 @@ gYAxis::~gYAxis()
|
||||
void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
|
||||
{
|
||||
if (height<0) return;
|
||||
|
||||
if (height>2000) return;
|
||||
int x,y;
|
||||
int labelW=0;
|
||||
|
||||
|
29
daily.cpp
29
daily.cpp
@ -14,6 +14,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QSpacerItem>
|
||||
|
||||
#include "daily.h"
|
||||
#include "ui_daily.h"
|
||||
@ -263,6 +264,19 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
|
||||
|
||||
GraphView->LoadSettings("Daily");
|
||||
|
||||
for (int i=0;i<GraphView->size();i++) {
|
||||
QString title=(*GraphView)[i]->title();
|
||||
QPushButton *btn=new QPushButton(title,this);
|
||||
btn->setCheckable(true);
|
||||
btn->setChecked(true);
|
||||
GraphToggles[title]=btn;
|
||||
btn->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum);
|
||||
ui->graphToggleArea->addWidget(btn);
|
||||
connect(btn,SIGNAL(toggled(bool)),this,SLOT(on_graphtogglebutton_toggled(bool)));
|
||||
}
|
||||
ui->graphToggleArea->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));
|
||||
|
||||
|
||||
// TODO: Add preference to hide do this for Widget Haters..
|
||||
//ui->calNavWidget->hide();
|
||||
}
|
||||
@ -405,6 +419,7 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day)
|
||||
tree->sortByColumn(0,Qt::AscendingOrder);
|
||||
//tree->expandAll();
|
||||
}
|
||||
|
||||
void Daily::UpdateCalendarDay(QDate date)
|
||||
{
|
||||
QTextCharFormat bold;
|
||||
@ -478,6 +493,15 @@ void Daily::ShowHideGraphs()
|
||||
//splitter->update();
|
||||
RedrawGraphs(); */
|
||||
}
|
||||
void Daily::on_graphtogglebutton_toggled(bool b)
|
||||
{
|
||||
for (int i=0;i<GraphView->size();i++) {
|
||||
QString title=(*GraphView)[i]->title();
|
||||
(*GraphView)[i]->setVisible(GraphToggles[title]->isChecked());
|
||||
}
|
||||
GraphView->updateScale();
|
||||
GraphView->updateGL();
|
||||
}
|
||||
void Daily::Load(QDate date)
|
||||
{
|
||||
static Day * lastcpapday=NULL;
|
||||
@ -531,6 +555,11 @@ void Daily::Load(QDate date)
|
||||
|
||||
//RedrawGraphs();
|
||||
|
||||
for (int i=0;i<GraphView->size();i++) {
|
||||
QString title=(*GraphView)[i]->title();
|
||||
GraphToggles[title]->setVisible(!(*GraphView)[i]->isEmpty());
|
||||
}
|
||||
|
||||
QString epr,modestr;
|
||||
//float iap90,eap90;
|
||||
CPAPMode mode=MODE_UNKNOWN;
|
||||
|
4
daily.h
4
daily.h
@ -13,6 +13,7 @@
|
||||
#include <QWidget>
|
||||
#include <QTreeWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QtOpenGL/QGLContext>
|
||||
#include <QScrollBar>
|
||||
@ -70,6 +71,7 @@ private slots:
|
||||
|
||||
void on_treeWidget_itemClicked(QTreeWidgetItem *item, int column);
|
||||
|
||||
void on_graphtogglebutton_toggled(bool);
|
||||
protected:
|
||||
|
||||
private:
|
||||
@ -86,7 +88,7 @@ private:
|
||||
|
||||
QList<Layer *> OXIData;
|
||||
QList<Layer *> CPAPData;
|
||||
|
||||
QHash<QString,QPushButton *> GraphToggles;
|
||||
QVector<QAction *> GraphAction;
|
||||
QGLContext *offscreen_context;
|
||||
|
||||
|
73
daily.ui
73
daily.ui
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>589</width>
|
||||
<height>530</height>
|
||||
<width>671</width>
|
||||
<height>315</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,7 +19,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -670,13 +670,66 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="graphMainArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="graphMainArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>82</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="graphToggleArea">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -616,7 +616,7 @@ EventList *packEventList(EventList *ev)
|
||||
lasttime=ev->time(0);
|
||||
nev->AddEvent(lasttime,lastval);
|
||||
|
||||
for (int i=1;i<ev->count();i++) {
|
||||
for (unsigned i=1;i<ev->count();i++) {
|
||||
val=ev->data(i);
|
||||
time=ev->time(i);
|
||||
if (val!=lastval) {
|
||||
|
54
oximetry.cpp
54
oximetry.cpp
@ -268,8 +268,8 @@ void SerialOximeter::compactToEvent(EventList *el)
|
||||
|
||||
void SerialOximeter::compactAll()
|
||||
{
|
||||
if (!session) return;
|
||||
QHash<ChannelID,QVector<EventList *> >::iterator i;
|
||||
|
||||
for (i=session->eventlist.begin();i!=session->eventlist.end();i++) {
|
||||
for (int j=0;j<i.value().size();j++) {
|
||||
if (i.key()==OXI_SPO2) {
|
||||
@ -329,10 +329,11 @@ bool SerialOximeter::startLive()
|
||||
void SerialOximeter::stopLive()
|
||||
{
|
||||
Close();
|
||||
compactAll();
|
||||
calcSPO2Drop(session);
|
||||
calcPulseChange(session);
|
||||
|
||||
if (session) {
|
||||
compactAll();
|
||||
calcSPO2Drop(session);
|
||||
calcPulseChange(session);
|
||||
}
|
||||
emit(liveStopped(session));
|
||||
}
|
||||
|
||||
@ -779,6 +780,9 @@ void Oximetry::on_RunButton_toggled(bool checked)
|
||||
return;
|
||||
}
|
||||
} // else it's already saved.
|
||||
GraphView->setEmptyText("Please Wait");
|
||||
GraphView->updateGL();
|
||||
|
||||
PLETHY->setRecMinY(0);
|
||||
PLETHY->setRecMaxY(128);
|
||||
PULSE->setRecMinY(60);
|
||||
@ -786,13 +790,13 @@ void Oximetry::on_RunButton_toggled(bool checked)
|
||||
SPO2->setRecMinY(90);
|
||||
SPO2->setRecMaxY(100);
|
||||
|
||||
QTimer::singleShot(1000,this,SLOT(oximeter_running_check()));
|
||||
day->getSessions().clear();
|
||||
if (!oximeter->startLive()) {
|
||||
mainwin->Notify("Oximetry Error!\n\nSomething is wrong with the device connection.");
|
||||
return;
|
||||
}
|
||||
QTimer::singleShot(100,this,SLOT(oximeter_running_check()));
|
||||
ui->saveButton->setEnabled(false);
|
||||
day->getSessions().clear();
|
||||
day->AddSession(oximeter->getSession());
|
||||
|
||||
firstPulseUpdate=true;
|
||||
@ -810,6 +814,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
|
||||
PULSE->SetMinX(f);
|
||||
SPO2->SetMinX(f);
|
||||
|
||||
//graphView()->updateScale();
|
||||
/*PLETHY->setForceMinY(0);
|
||||
PLETHY->setForceMaxY(128);
|
||||
PULSE->setForceMinY(30);
|
||||
@ -834,19 +839,21 @@ void Oximetry::onDataChanged()
|
||||
qint64 first=last-30000L;
|
||||
day->setLast(last);
|
||||
|
||||
//plethy->setMinX(first);
|
||||
//plethy->setMaxX(last);
|
||||
plethy->setMinX(first);
|
||||
plethy->setMaxX(last);
|
||||
pulse->setMinX(first);
|
||||
pulse->setMaxX(last);
|
||||
spo2->setMinX(first);
|
||||
spo2->setMaxX(last);
|
||||
|
||||
plethy->setMinY(0);
|
||||
plethy->setMaxY(128);
|
||||
pulse->setMinY(0);
|
||||
pulse->setMaxY(120);
|
||||
spo2->setMinY(0);
|
||||
spo2->setMaxY(100);
|
||||
|
||||
|
||||
plethy->setMinY((oximeter->Plethy())->min());
|
||||
plethy->setMaxY((oximeter->Plethy())->max());
|
||||
pulse->setMinY((oximeter->Pulse())->min());
|
||||
pulse->setMaxY((oximeter->Pulse())->max());
|
||||
spo2->setMinY((oximeter->Spo2())->min());
|
||||
spo2->setMaxY((oximeter->Spo2())->max());
|
||||
|
||||
PLETHY->MinY();
|
||||
PLETHY->MaxY();
|
||||
@ -897,6 +904,19 @@ void Oximetry::oximeter_running_check()
|
||||
}
|
||||
if (oximeter->callbacks()==0) {
|
||||
mainwin->Notify("Oximeter Error\n\nThe device has not responded.. Make sure it's switched on.");
|
||||
if (oximeter->mode()==SO_IMPORT) oximeter->stopImport();
|
||||
if (oximeter->mode()==SO_LIVE) oximeter->stopLive();
|
||||
|
||||
oximeter->destroySession();
|
||||
day->getSessions().clear();
|
||||
ui->SerialPortsCombo->setEnabled(true);
|
||||
qstatus->setText("Ready");
|
||||
ui->ImportButton->setEnabled(true);
|
||||
ui->RunButton->setChecked(false);
|
||||
ui->saveButton->setEnabled(false);
|
||||
GraphView->setEmptyText("Check Oximeter is Ready");
|
||||
GraphView->updateGL();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -908,12 +928,12 @@ void Oximetry::on_ImportButton_clicked()
|
||||
connect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(on_updateProgress(float)));
|
||||
//connect(oximeter,SIGNAL(dataChanged()),this,SLOT(onDataChanged()));
|
||||
|
||||
QTimer::singleShot(1000,this,SLOT(oximeter_running_check()));
|
||||
if (!oximeter->startImport()) {
|
||||
mainwin->Notify("Oximeter Error\n\nThe device did not respond.. Make sure it's switched on.");
|
||||
//qDebug() << "Error starting oximetry serial import process";
|
||||
return;
|
||||
}
|
||||
QTimer::singleShot(100,this,SLOT(oximeter_running_check()));
|
||||
|
||||
day->getSessions().clear();
|
||||
day->AddSession(oximeter->getSession());
|
||||
@ -1058,6 +1078,8 @@ void Oximetry::on_saveButton_clicked()
|
||||
day->getSessions().clear();
|
||||
mainwin->getDaily()->ReloadGraphs();
|
||||
mainwin->getOverview()->ReloadGraphs();
|
||||
GraphView->setEmptyText("No Oximetry Data");
|
||||
GraphView->updateGL();
|
||||
}
|
||||
}
|
||||
void Oximetry::on_updateProgress(float f)
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
virtual void stopLive();
|
||||
|
||||
SerialOxMode mode() { return m_mode; }
|
||||
void destroySession() { delete session; session=NULL; }
|
||||
|
||||
bool isOpen() { return m_opened; }
|
||||
int callbacks() { return m_callbacks; }
|
||||
@ -66,6 +67,10 @@ public:
|
||||
DataBitsType dataBits() { return m_databits; }
|
||||
StopBitsType stopBits() { return m_stopbits; }
|
||||
|
||||
EventList * Pulse() { return pulse; }
|
||||
EventList * Spo2() { return spo2; }
|
||||
EventList * Plethy() { return plethy; }
|
||||
|
||||
signals:
|
||||
void sessionCreated(Session *);
|
||||
void dataChanged();
|
||||
|
@ -570,12 +570,12 @@ void PreferencesDialog::on_graphModel_changed(QStandardItem * item)
|
||||
graphModel->setData(index,QString::number(graph->rec_miny,'f',1));
|
||||
ui->graphView->update();
|
||||
} else {
|
||||
if ((val < graph->rec_maxy) || (val==0)) {
|
||||
//if ((val < graph->rec_maxy) || (val==0)) {
|
||||
graph->setRecMinY(val);
|
||||
} else {
|
||||
/*} else {
|
||||
graphModel->setData(index,QString::number(graph->rec_miny,'f',1));
|
||||
ui->graphView->update();
|
||||
}
|
||||
} */
|
||||
}
|
||||
} else if (index.column()==2) {
|
||||
val=index.data().toDouble(&ok);
|
||||
@ -583,12 +583,12 @@ void PreferencesDialog::on_graphModel_changed(QStandardItem * item)
|
||||
graphModel->setData(index,QString::number(graph->rec_maxy,'f',1));
|
||||
ui->graphView->update();
|
||||
} else {
|
||||
if ((val > graph->rec_miny) || (val==0)) {
|
||||
//if ((val > graph->rec_miny) || (val==0)) {
|
||||
graph->setRecMaxY(val);
|
||||
} else {
|
||||
/*} else {
|
||||
graphModel->setData(index,QString::number(graph->rec_maxy,'f',1));
|
||||
ui->graphView->update();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user