mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Fix graph settings getting clobbered whenever language changes
This commit is contained in:
parent
462bd70b5e
commit
a4cbc5e22c
@ -12,6 +12,7 @@
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <cmath>
|
||||
#include <exception>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "Graphs/gGraphView.h"
|
||||
@ -111,13 +112,18 @@ void DestroyGraphGlobals()
|
||||
globalsInitialized = false;
|
||||
}
|
||||
|
||||
gGraph::gGraph(gGraphView *graphview, QString title, QString units, int height, short group)
|
||||
: m_graphview(graphview),
|
||||
gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units, int height, short group)
|
||||
: m_name(name),
|
||||
m_graphview(graphview),
|
||||
m_title(title),
|
||||
m_units(units),
|
||||
m_height(height),
|
||||
m_visible(true)
|
||||
{
|
||||
if (graphview->contains(name)) {
|
||||
qDebug() << "Trying to duplicate " << name << " when a graph with the same name already exists";
|
||||
name+="-1";
|
||||
}
|
||||
m_min_height = 60;
|
||||
m_width = 0;
|
||||
|
||||
|
@ -47,7 +47,7 @@ class gGraph : public QObject
|
||||
\param int height containing the opening height for this graph
|
||||
\param short group containing which graph-link group this graph belongs to
|
||||
*/
|
||||
gGraph(gGraphView *graphview = nullptr, QString title = "", QString units = "",
|
||||
gGraph(QString name, gGraphView *graphview = nullptr, QString title = "", QString units = "",
|
||||
int height = 100, short group = 0);
|
||||
virtual ~gGraph();
|
||||
|
||||
@ -124,6 +124,10 @@ class gGraph : public QObject
|
||||
//! \brief Returns the Graph's (vertical) title
|
||||
inline QString & title() { return m_title; }
|
||||
|
||||
//! \brief Returns the Graph's internal name
|
||||
inline QString & name() { return m_name; }
|
||||
|
||||
|
||||
//! \brief Sets the Graph's (vertical) title
|
||||
void setTitle(const QString title) { m_title = title; }
|
||||
|
||||
@ -306,6 +310,8 @@ class gGraph : public QObject
|
||||
|
||||
//! \brief The Main gGraphView object holding this graph
|
||||
// (this can be pinched temporarily by print code)
|
||||
QString m_name;
|
||||
|
||||
gGraphView *m_graphview;
|
||||
QString m_title;
|
||||
QString m_units;
|
||||
|
@ -210,7 +210,7 @@ void gGraphView::trashGraphs()
|
||||
{
|
||||
// Don't actually want to delete them here.. we are just borrowing the graphs
|
||||
m_graphs.clear();
|
||||
m_graphsbytitle.clear();
|
||||
m_graphsbyname.clear();
|
||||
}
|
||||
|
||||
// Take the next graph to render from the drawing list
|
||||
@ -516,8 +516,8 @@ void gGraphView::addGraph(gGraph *g, short group)
|
||||
g->setGroup(group);
|
||||
m_graphs.push_back(g);
|
||||
|
||||
if (!m_graphsbytitle.contains(g->title())) {
|
||||
m_graphsbytitle[g->title()] = g;
|
||||
if (!m_graphsbyname.contains(g->name())) {
|
||||
m_graphsbyname[g->name()] = g;
|
||||
} else {
|
||||
qDebug() << "Can't have to graphs with the same title in one GraphView!!";
|
||||
}
|
||||
@ -1915,7 +1915,7 @@ void gGraphView::deselect()
|
||||
}
|
||||
|
||||
const quint32 gvmagic = 0x41756728;
|
||||
const quint16 gvversion = 2;
|
||||
const quint16 gvversion = 3;
|
||||
|
||||
void gGraphView::SaveSettings(QString title)
|
||||
{
|
||||
@ -1932,7 +1932,7 @@ void gGraphView::SaveSettings(QString title)
|
||||
out << (qint16)size();
|
||||
|
||||
for (qint16 i = 0; i < size(); i++) {
|
||||
out << m_graphs[i]->title();
|
||||
out << m_graphs[i]->name();
|
||||
out << m_graphs[i]->height();
|
||||
out << m_graphs[i]->visible();
|
||||
out << m_graphs[i]->RecMinY();
|
||||
@ -1988,6 +1988,7 @@ bool gGraphView::LoadSettings(QString title)
|
||||
|
||||
for (int i = 0; i < siz; i++) {
|
||||
in >> name;
|
||||
|
||||
in >> hght;
|
||||
in >> vis;
|
||||
in >> recminy;
|
||||
@ -2001,12 +2002,26 @@ bool gGraphView::LoadSettings(QString title)
|
||||
in >> pinned;
|
||||
}
|
||||
|
||||
gi = m_graphsbytitle.find(name);
|
||||
gGraph *g = nullptr;
|
||||
|
||||
if (gi == m_graphsbytitle.end()) {
|
||||
qDebug() << "Graph" << name << "has been renamed or removed";
|
||||
if (t2 <= 2) {
|
||||
// Names were stored as translated strings, so look up title instead.
|
||||
g = nullptr;
|
||||
for (int z=0; z<m_graphs.size(); ++z) {
|
||||
if (m_graphs[z]->title() == name) {
|
||||
g=m_graphs[z];
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gGraph *g = gi.value();
|
||||
gi = m_graphsbyname.find(name);
|
||||
if (gi == m_graphsbyname.end()) {
|
||||
qDebug() << "Graph" << name << "has been renamed or removed";
|
||||
} else {
|
||||
g = gi.value();
|
||||
}
|
||||
}
|
||||
if (g) {
|
||||
neworder.push_back(g);
|
||||
g->setHeight(hght);
|
||||
g->setVisible(vis);
|
||||
@ -2028,12 +2043,21 @@ bool gGraphView::LoadSettings(QString title)
|
||||
|
||||
gGraph *gGraphView::findGraph(QString name)
|
||||
{
|
||||
QHash<QString, gGraph *>::iterator i = m_graphsbytitle.find(name);
|
||||
QHash<QString, gGraph *>::iterator i = m_graphsbyname.find(name);
|
||||
|
||||
if (i == m_graphsbytitle.end()) { return nullptr; }
|
||||
if (i == m_graphsbyname.end()) { return nullptr; }
|
||||
|
||||
return i.value();
|
||||
}
|
||||
|
||||
gGraph *gGraphView::findGraphTitle(QString title)
|
||||
{
|
||||
for (int i=0; i< m_graphs.size(); ++i) {
|
||||
if (m_graphs[i]->title() == title) return m_graphs[i];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int gGraphView::visibleGraphs()
|
||||
{
|
||||
int cnt = 0;
|
||||
|
@ -195,6 +195,19 @@ class gGraphView
|
||||
//! \brief The splitter is drawn inside this gap
|
||||
static const int graphSpacer = 4;
|
||||
|
||||
bool contains(QString name) {
|
||||
for (int i=0; i<m_graphs.size(); ++i) {
|
||||
if (m_graphs[i]->name() == name) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
gGraph *operator [](QString name) {
|
||||
for (int i=0; i<m_graphs.size(); ++i) {
|
||||
if (m_graphs[i]->name() == name) return m_graphs[i];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! \brief Finds the top pixel position of the supplied graph
|
||||
float findTop(gGraph *graph);
|
||||
|
||||
@ -225,6 +238,9 @@ class gGraphView
|
||||
//! \brief Returns the graph object matching the supplied name, nullptr if it does not exist.
|
||||
gGraph *findGraph(QString name);
|
||||
|
||||
//! \brief Returns the graph object matching the graph title, nullptr if it does not exist.
|
||||
gGraph *findGraphTitle(QString title);
|
||||
|
||||
inline float printScaleX() const { return print_scaleX; }
|
||||
inline float printScaleY() const { return print_scaleY; }
|
||||
inline void setPrintScaleX(float x) { print_scaleX = x; }
|
||||
@ -383,7 +399,7 @@ class gGraphView
|
||||
QVector<gGraph *> m_graphs;
|
||||
|
||||
//! \brief List of all graphs contained, indexed by title
|
||||
QHash<QString, gGraph *> m_graphsbytitle;
|
||||
QHash<QString, gGraph *> m_graphsbyname;
|
||||
|
||||
//! \variable Vertical scroll offset (adjusted when scrollbar gets moved)
|
||||
int m_offsetY;
|
||||
|
@ -415,7 +415,7 @@ bool gYAxis::mouseDoubleClickEvent(QMouseEvent *event, gGraph *graph)
|
||||
// int y=event->y();
|
||||
short z = (graph->zoomY() + 1) % gGraph::maxZoomY;
|
||||
graph->setZoomY(z);
|
||||
qDebug() << "Mouse double clicked for" << graph->title() << z;
|
||||
qDebug() << "Mouse double clicked for" << graph->name() << z;
|
||||
}
|
||||
|
||||
Q_UNUSED(event);
|
||||
|
@ -22,6 +22,16 @@ const QString CSTR_GFX_ANGLE = "ANGLE";
|
||||
const QString CSTR_GFX_OpenGL = "OpenGL";
|
||||
const QString CSTR_GFX_BrokenGL = "BrokenGL";
|
||||
|
||||
const QString STR_GRAPH_EventBreakdown = "EventBreakdown";
|
||||
const QString STR_GRAPH_SleepFlags = "SF";
|
||||
const QString STR_GRAPH_Weight = "Weight";
|
||||
const QString STR_GRAPH_BMI = "BMI";
|
||||
const QString STR_GRAPH_Zombie = "Zombie";
|
||||
const QString STR_GRAPH_Sessions = "Sessions";
|
||||
const QString STR_GRAPH_SessionTimes = "SessionTimes";
|
||||
const QString STR_GRAPH_Usage = "Usage";
|
||||
const QString STR_GRAPH_AHI = "AHI";
|
||||
const QString STR_GRAPH_PeakAHI = "PeakAHI";
|
||||
|
||||
//! \brief Returns a text string naming the current graphics engine
|
||||
QString getGraphicsEngine();
|
||||
|
@ -46,7 +46,6 @@
|
||||
//extern QProgressBar *qprogress;
|
||||
extern MainWindow * mainwin;
|
||||
|
||||
|
||||
// This was Sean Stangl's idea.. but I couldn't apply that patch.
|
||||
inline QString channelInfo(ChannelID code) {
|
||||
return schema::channel[code].fullname()+"\n"+schema::channel[code].description()+"\n("+schema::channel[code].units()+")";
|
||||
@ -136,7 +135,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
*SF = nullptr,
|
||||
*AHI = nullptr;
|
||||
|
||||
graphlist["SF"] = SF = new gGraph(GraphView,STR_TR_EventFlags,STR_TR_EventFlags,default_height);
|
||||
graphlist[STR_GRAPH_SleepFlags] = SF = new gGraph(STR_GRAPH_SleepFlags, GraphView, STR_TR_EventFlags, STR_TR_EventFlags, default_height);
|
||||
SF->setPinned(true);
|
||||
|
||||
ChannelID cpapcodes[] = {
|
||||
@ -155,25 +154,25 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
|
||||
for (int i=0; i < cpapsize; ++i) {
|
||||
ChannelID code = cpapcodes[i];
|
||||
graphlist[schema::channel[code].label()] = new gGraph(GraphView, schema::channel[code].label(), channelInfo(code), default_height);
|
||||
graphlist[schema::channel[code].label()] = new gGraph(schema::channel[code].code(), GraphView, schema::channel[code].label(), channelInfo(code), default_height);
|
||||
}
|
||||
|
||||
int oxigrp=p_profile->ExistsAndTrue("SyncOximetry") ? 0 : 1; // Contemplating killing this setting...
|
||||
for (int i=0; i < oxisize; ++i) {
|
||||
ChannelID code = oxicodes[i];
|
||||
graphlist[schema::channel[code].label()] = new gGraph(GraphView, schema::channel[code].label(), channelInfo(code), default_height, oxigrp);
|
||||
graphlist[schema::channel[code].label()] = new gGraph(schema::channel[code].code(), GraphView, schema::channel[code].label(), channelInfo(code), default_height, oxigrp);
|
||||
}
|
||||
|
||||
if (p_profile->general->calculateRDI()) {
|
||||
AHI=new gGraph(GraphView,STR_TR_RDI, channelInfo(CPAP_RDI), default_height);
|
||||
AHI=new gGraph("AHI", GraphView,STR_TR_RDI, channelInfo(CPAP_RDI), default_height);
|
||||
} else {
|
||||
AHI=new gGraph(GraphView,STR_TR_AHI, channelInfo(CPAP_AHI), default_height);
|
||||
AHI=new gGraph("AHI", GraphView,STR_TR_AHI, channelInfo(CPAP_AHI), default_height);
|
||||
}
|
||||
|
||||
graphlist["AHI"] = AHI;
|
||||
|
||||
graphlist["INTPULSE"] = new gGraph(GraphView,tr("Int. Pulse"), channelInfo(OXI_Pulse), default_height, oxigrp);
|
||||
graphlist["INTSPO2"] = new gGraph(GraphView,tr("Int. SpO2"), channelInfo(OXI_SPO2), default_height, oxigrp);
|
||||
graphlist["INTPULSE"] = new gGraph("INTPULSE", GraphView,tr("Int. Pulse"), channelInfo(OXI_Pulse), default_height, oxigrp);
|
||||
graphlist["INTSPO2"] = new gGraph("INTSPO2", GraphView,tr("Int. SpO2"), channelInfo(OXI_SPO2), default_height, oxigrp);
|
||||
|
||||
// Event Pie Chart (for snapshot purposes)
|
||||
// TODO: Convert snapGV to generic for snapshotting multiple graphs (like reports does)
|
||||
@ -183,7 +182,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
// TAP->AddLayer(AddCPAP(tap));
|
||||
//TAP->setMargins(0,0,0,0);
|
||||
|
||||
graphlist["EventBreakdown"] = GAHI = new gGraph(snapGV,tr("Breakdown"),tr("events"),172);
|
||||
graphlist[STR_GRAPH_EventBreakdown] = GAHI = new gGraph(STR_GRAPH_EventBreakdown, snapGV,tr("Breakdown"),tr("events"),172);
|
||||
gSegmentChart * evseg=new gSegmentChart(GST_Pie);
|
||||
evseg->AddSlice(CPAP_Hypopnea,QColor(0x40,0x40,0xff,0xff),STR_TR_H);
|
||||
evseg->AddSlice(CPAP_Apnea,QColor(0x20,0x80,0x20,0xff),STR_TR_UA);
|
||||
@ -1300,9 +1299,9 @@ void Daily::Load(QDate date)
|
||||
} else
|
||||
gr=0;
|
||||
|
||||
GraphView->findGraph(STR_TR_PulseRate)->setGroup(gr);
|
||||
GraphView->findGraph(STR_TR_SpO2)->setGroup(gr);
|
||||
GraphView->findGraph(STR_TR_Plethy)->setGroup(gr);
|
||||
(*GraphView)[schema::channel[OXI_Pulse].code()]->setGroup(gr);
|
||||
(*GraphView)[schema::channel[OXI_SPO2].code()]->setGroup(gr);
|
||||
(*GraphView)[schema::channel[OXI_Plethy].code()]->setGroup(gr);
|
||||
}
|
||||
lastcpapday=cpap;
|
||||
|
||||
@ -1880,8 +1879,7 @@ void Daily::on_treeWidget_itemClicked(QTreeWidgetItem *item, int column)
|
||||
double st=t-(winsize/2);
|
||||
double et=t+(winsize/2);
|
||||
|
||||
|
||||
gGraph *g=GraphView->findGraph(STR_TR_EventFlags);
|
||||
gGraph *g=(*GraphView)[STR_GRAPH_EventBreakdown];
|
||||
if (!g) return;
|
||||
if (st<g->rmin_x) {
|
||||
st=g->rmin_x;
|
||||
@ -1976,7 +1974,7 @@ void Daily::on_evViewSlider_valueChanged(int value)
|
||||
|
||||
int winsize=value*60;
|
||||
|
||||
gGraph *g=GraphView->findGraph(STR_TR_EventFlags);
|
||||
gGraph *g=GraphView->findGraph(STR_GRAPH_SleepFlags);
|
||||
if (!g) return;
|
||||
qint64 st=g->min_x;
|
||||
qint64 et=g->max_x;
|
||||
@ -2160,7 +2158,7 @@ void Daily::on_weightSpinBox_editingFinished()
|
||||
gGraphView *gv=mainwin->getOverview()->graphView();
|
||||
gGraph *g;
|
||||
if (gv) {
|
||||
g=gv->findGraph(STR_TR_Weight);
|
||||
g=gv->findGraph(STR_GRAPH_Weight);
|
||||
if (g) g->setDay(nullptr);
|
||||
}
|
||||
if ((height>0) && (kg>0)) {
|
||||
@ -2169,7 +2167,7 @@ void Daily::on_weightSpinBox_editingFinished()
|
||||
ui->BMI->setVisible(true);
|
||||
journal->settings[Journal_BMI]=bmi;
|
||||
if (gv) {
|
||||
g=gv->findGraph(STR_TR_BMI);
|
||||
g=gv->findGraph(STR_GRAPH_BMI);
|
||||
if (g) g->setDay(nullptr);
|
||||
}
|
||||
}
|
||||
@ -2201,7 +2199,7 @@ void Daily::on_ouncesSpinBox_editingFinished()
|
||||
|
||||
gGraph *g;
|
||||
if (mainwin->getOverview()) {
|
||||
g=mainwin->getOverview()->graphView()->findGraph(STR_TR_Weight);
|
||||
g=mainwin->getOverview()->graphView()->findGraph(STR_GRAPH_Weight);
|
||||
if (g) g->setDay(nullptr);
|
||||
}
|
||||
|
||||
@ -2212,12 +2210,12 @@ void Daily::on_ouncesSpinBox_editingFinished()
|
||||
|
||||
journal->settings[Journal_BMI]=bmi;
|
||||
if (mainwin->getOverview()) {
|
||||
g=mainwin->getOverview()->graphView()->findGraph(STR_TR_BMI);
|
||||
g=mainwin->getOverview()->graphView()->findGraph(STR_GRAPH_BMI);
|
||||
if (g) g->setDay(nullptr);
|
||||
}
|
||||
}
|
||||
journal->SetChanged(true);
|
||||
if (mainwin->getOverview()) mainwin->getOverview()->ResetGraph("Weight");
|
||||
if (mainwin->getOverview()) mainwin->getOverview()->ResetGraph(STR_GRAPH_Weight);
|
||||
}
|
||||
|
||||
QString Daily::GetDetailsText()
|
||||
@ -2244,7 +2242,7 @@ void Daily::on_graphCombo_activated(int index)
|
||||
} else {
|
||||
ui->graphCombo->setItemIcon(index,*icon_off);
|
||||
}
|
||||
g=GraphView->findGraph(s);
|
||||
g=GraphView->findGraphTitle(s);
|
||||
g->setVisible(b);
|
||||
|
||||
updateCube();
|
||||
|
@ -2182,6 +2182,7 @@ void MainWindow::on_actionChange_Language_triggered()
|
||||
delete settings;
|
||||
p_profile->Save();
|
||||
PREF.Save();
|
||||
p_profile->removeLock();
|
||||
|
||||
RestartApplication(true);
|
||||
}
|
||||
@ -2190,6 +2191,8 @@ void MainWindow::on_actionChange_Data_Folder_triggered()
|
||||
{
|
||||
p_profile->Save();
|
||||
PREF.Save();
|
||||
p_profile->removeLock();
|
||||
|
||||
RestartApplication(false, true);
|
||||
}
|
||||
|
||||
|
@ -109,15 +109,15 @@ Overview::Overview(QWidget *parent, gGraphView *shared) :
|
||||
ChannelID ahicode = p_profile->general->calculateRDI() ? CPAP_RDI : CPAP_AHI;
|
||||
|
||||
if (ahicode == CPAP_RDI) {
|
||||
AHI = createGraph(STR_TR_RDI, tr("Respiratory\nDisturbance\nIndex"));
|
||||
AHI = createGraph(STR_GRAPH_AHI, STR_TR_RDI, tr("Respiratory\nDisturbance\nIndex"));
|
||||
} else {
|
||||
AHI = createGraph(STR_TR_AHI, tr("Apnea\nHypopnea\nIndex"));
|
||||
AHI = createGraph(STR_GRAPH_AHI, STR_TR_AHI, tr("Apnea\nHypopnea\nIndex"));
|
||||
}
|
||||
|
||||
|
||||
UC = createGraph(tr("Usage"), tr("Usage\n(hours)"));
|
||||
UC = createGraph(STR_GRAPH_Usage, tr("Usage"), tr("Usage\n(hours)"));
|
||||
|
||||
FL = createGraph(STR_TR_FlowLimit, STR_TR_FlowLimit);
|
||||
FL = createGraph(schema::channel[CPAP_FlowLimit].code(), schema::channel[CPAP_FlowLimit].label(), STR_TR_FlowLimit);
|
||||
|
||||
float percentile = p_profile->general->prefCalcPercentile() / 100.0;
|
||||
int mididx = p_profile->general->prefCalcMiddle();
|
||||
@ -130,33 +130,32 @@ Overview::Overview(QWidget *parent, gGraphView *shared) :
|
||||
SummaryType ST_max = p_profile->general->prefCalcMax() ? ST_PERC : ST_MAX;
|
||||
const EventDataType maxperc = 0.995F;
|
||||
|
||||
|
||||
US = createGraph(tr("Session Times"), tr("Session Times\n(hours)"), YT_Time);
|
||||
PR = createGraph(STR_TR_Pressure, STR_TR_Pressure + "\n(" + STR_UNIT_CMH2O + ")");
|
||||
SET = createGraph(STR_TR_Settings, STR_TR_Settings);
|
||||
LK = createGraph(STR_TR_Leaks, STR_TR_UnintentionalLeaks + "\n(" + STR_UNIT_LPM + ")");
|
||||
TOTLK = createGraph(STR_TR_TotalLeaks, STR_TR_TotalLeaks + "\n(" + STR_UNIT_LPM + ")");
|
||||
NPB = createGraph(tr("% in PB"), tr("Periodic\nBreathing\n(% of night)"));
|
||||
US = createGraph(STR_GRAPH_SessionTimes, tr("Session Times"), tr("Session Times\n(hours)"), YT_Time);
|
||||
PR = createGraph("Pressure", STR_TR_Pressure, STR_TR_Pressure + "\n(" + STR_UNIT_CMH2O + ")");
|
||||
SET = createGraph("Settings", STR_TR_Settings, STR_TR_Settings);
|
||||
LK = createGraph("Leaks", STR_TR_Leaks, STR_TR_UnintentionalLeaks + "\n(" + STR_UNIT_LPM + ")");
|
||||
TOTLK = createGraph("TotalLeaks", STR_TR_TotalLeaks, STR_TR_TotalLeaks + "\n(" + STR_UNIT_LPM + ")");
|
||||
NPB = createGraph("TimeInPB", tr("% in PB"), tr("Periodic\nBreathing\n(% of night)"));
|
||||
|
||||
if (ahicode == CPAP_RDI) {
|
||||
AHIHR = createGraph(tr("Peak RDI"), tr("Peak RDI\nShows RDI Clusters\n(RDI/hr)"));
|
||||
AHIHR = createGraph(STR_GRAPH_PeakAHI, tr("Peak RDI"), tr("Peak RDI\nShows RDI Clusters\n(RDI/hr)"));
|
||||
} else {
|
||||
AHIHR = createGraph(tr("Peak AHI"), tr("Peak AHI\nShows AHI Clusters\n(AHI/hr)"));
|
||||
AHIHR = createGraph(STR_GRAPH_PeakAHI, tr("Peak AHI"), tr("Peak AHI\nShows AHI Clusters\n(AHI/hr)"));
|
||||
}
|
||||
|
||||
RR = createGraph(STR_TR_RespRate, tr("Respiratory\nRate\n(breaths/min)"));
|
||||
TV = createGraph(STR_TR_TidalVolume, tr("Tidal\nVolume\n(ml)"));
|
||||
MV = createGraph(STR_TR_MinuteVent, tr("Minute\nVentilation\n(L/min)"));
|
||||
TGMV = createGraph(STR_TR_TargetVent, tr("Target\nVentilation\n(L/min)"));
|
||||
PTB = createGraph(STR_TR_PatTrigBreath, tr("Patient\nTriggered\nBreaths\n(%)"));
|
||||
SES = createGraph(STR_TR_Sessions, STR_TR_Sessions + tr("\n(count)"));
|
||||
PULSE = createGraph(STR_TR_PulseRate, STR_TR_PulseRate + "\n(" + STR_UNIT_BPM + ")");
|
||||
SPO2 = createGraph(STR_TR_SpO2, tr("Oxygen Saturation\n(%)"));
|
||||
SA = createGraph(STR_TR_SensAwake, tr("SensAwake\n(count)"));
|
||||
RR = createGraph(schema::channel[CPAP_RespRate].code(), schema::channel[CPAP_RespRate].label(), schema::channel[CPAP_RespRate].fullname()+"\n"+schema::channel[CPAP_RespRate].units());
|
||||
TV = createGraph(schema::channel[CPAP_TidalVolume].code(),schema::channel[CPAP_TidalVolume].label(), tr("Tidal\nVolume\n(ml)"));
|
||||
MV = createGraph(schema::channel[CPAP_MinuteVent].code(), schema::channel[CPAP_MinuteVent].label(), tr("Minute\nVentilation\n(L/min)"));
|
||||
TGMV = createGraph(schema::channel[CPAP_TgMV].code(), schema::channel[CPAP_TgMV].label(), tr("Target\nVentilation\n(L/min)"));
|
||||
PTB = createGraph(schema::channel[CPAP_PTB].code(), schema::channel[CPAP_PTB].label(), tr("Patient\nTriggered\nBreaths\n(%)"));
|
||||
SES = createGraph(STR_GRAPH_Sessions, STR_TR_Sessions, STR_TR_Sessions + tr("\n(count)"));
|
||||
PULSE = createGraph(schema::channel[OXI_Pulse].code(), schema::channel[OXI_Pulse].label(), STR_TR_PulseRate + "\n(" + STR_UNIT_BPM + ")");
|
||||
SPO2 = createGraph(schema::channel[OXI_SPO2].code(), schema::channel[OXI_SPO2].label(), tr("Oxygen Saturation\n(%)"));
|
||||
SA = createGraph(schema::channel[CPAP_SensAwake].code(), schema::channel[CPAP_SensAwake].label(), tr("SensAwake\n(count)"));
|
||||
|
||||
WEIGHT = createGraph(STR_TR_Weight, STR_TR_Weight, YT_Weight);
|
||||
BMI = createGraph(STR_TR_BMI, tr("Body\nMass\nIndex"));
|
||||
ZOMBIE = createGraph(STR_TR_Zombie, tr("How you felt\n(0-10)"));
|
||||
WEIGHT = createGraph(STR_GRAPH_Weight, STR_TR_Weight, STR_TR_Weight, YT_Weight);
|
||||
BMI = createGraph(STR_GRAPH_BMI, STR_TR_BMI, tr("Body\nMass\nIndex"));
|
||||
ZOMBIE = createGraph(STR_GRAPH_Zombie, STR_TR_Zombie, tr("How you felt\n(0-10)"));
|
||||
|
||||
ahihr = new SummaryChart(STR_UNIT_EventsPerHour, GT_POINTS);
|
||||
ahihr->addSlice(ahicode, COLOR_Blue, ST_MAX);
|
||||
@ -323,10 +322,10 @@ void Overview::closeEvent(QCloseEvent *event)
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
gGraph *Overview::createGraph(QString name, QString units, YTickerType yttype)
|
||||
gGraph *Overview::createGraph(QString code, QString name, QString units, YTickerType yttype)
|
||||
{
|
||||
int default_height = p_profile->appearance->graphHeight();
|
||||
gGraph *g = new gGraph(GraphView, name, units, default_height, 0);
|
||||
gGraph *g = new gGraph(code, GraphView, name, units, default_height, 0);
|
||||
|
||||
gYAxis *yt;
|
||||
|
||||
@ -612,7 +611,7 @@ void Overview::on_graphCombo_activated(int index)
|
||||
ui->graphCombo->setItemIcon(index, *icon_off);
|
||||
}
|
||||
|
||||
g = GraphView->findGraph(s);
|
||||
g = GraphView->findGraphTitle(s);
|
||||
g->setVisible(b);
|
||||
|
||||
updateCube();
|
||||
@ -654,7 +653,7 @@ void Overview::on_toggleVisibility_clicked(bool checked)
|
||||
s = ui->graphCombo->itemText(i);
|
||||
ui->graphCombo->setItemIcon(i, *icon);
|
||||
ui->graphCombo->setItemData(i, !checked, Qt::UserRole);
|
||||
g = GraphView->findGraph(s);
|
||||
g = GraphView->findGraphTitle(s);
|
||||
g->setVisible(!checked);
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class Overview : public QWidget
|
||||
/*! \brief Create an overview graph, adding it to the overview gGraphView object
|
||||
\param QString name The title of the graph
|
||||
\param QString units The units of measurements to show in the popup */
|
||||
gGraph *createGraph(QString name, QString units = "", YTickerType yttype = YT_Number);
|
||||
gGraph *createGraph(QString code, QString name, QString units = "", YTickerType yttype = YT_Number);
|
||||
gGraph *AHI, *AHIHR, *UC, *FL, *SA, *US, *PR, *LK, *NPB, *SET, *SES, *RR, *MV, *TV, *PTB, *PULSE, *SPO2,
|
||||
// gGraph *AHI, *AHIHR, *UC, *FL, *US, *PR, *LK, *NPB, *SET, *SES, *RR, *MV, *TV, *PTB, *PULSE, *SPO2,
|
||||
*WEIGHT, *ZOMBIE, *BMI, *TGMV, *TOTLK;
|
||||
|
@ -40,7 +40,7 @@ OximeterImport::OximeterImport(QWidget *parent) :
|
||||
lvlayout->setMargin(0);
|
||||
ui->liveViewFrame->setLayout(lvlayout);
|
||||
lvlayout->addWidget(liveView);
|
||||
plethyGraph = new gGraph(liveView, STR_TR_Plethy, STR_UNIT_Hz);
|
||||
plethyGraph = new gGraph("Plethy", liveView, STR_TR_Plethy, STR_UNIT_Hz);
|
||||
|
||||
plethyGraph->AddLayer(new gYAxis(), LayerLeft, gYAxis::Margin);
|
||||
plethyGraph->AddLayer(new gXAxis(), LayerBottom, 0, 20);
|
||||
|
@ -444,19 +444,19 @@ bool PreferencesDialog::Save()
|
||||
profile->oxi->setSyncOximetry(ui->oximetrySync->isChecked());
|
||||
int oxigrp = ui->oximetrySync->isChecked() ? 0 : 1;
|
||||
gGraphView *gv = mainwin->getDaily()->graphView();
|
||||
gGraph *g = gv->findGraph(STR_TR_PulseRate);
|
||||
gGraph *g = gv->findGraph(schema::channel[OXI_Pulse].code());
|
||||
|
||||
if (g) {
|
||||
g->setGroup(oxigrp);
|
||||
}
|
||||
|
||||
g = gv->findGraph(STR_TR_SpO2);
|
||||
g = gv->findGraph(schema::channel[OXI_SPO2].code());
|
||||
|
||||
if (g) {
|
||||
g->setGroup(oxigrp);
|
||||
}
|
||||
|
||||
g = gv->findGraph(STR_TR_Plethy);
|
||||
g = gv->findGraph(schema::channel[OXI_Plethy].code());
|
||||
|
||||
if (g) {
|
||||
g->setGroup(oxigrp);
|
||||
|
@ -413,7 +413,7 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date)
|
||||
et = oxi->last();
|
||||
}
|
||||
|
||||
if (g->title() == STR_TR_FlowRate) {
|
||||
if (g->name() == schema::channel[CPAP_FlowRate].code()) {
|
||||
if (!((qAbs(savest - st) < 2000) && (qAbs(saveet - et) < 2000))) {
|
||||
start.push_back(st);
|
||||
end.push_back(et);
|
||||
@ -441,10 +441,9 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date)
|
||||
QVariantList st1 = journal->settings[Bookmark_Start].toList();
|
||||
QVariantList et1 = journal->settings[Bookmark_End].toList();
|
||||
QStringList notes = journal->settings[Bookmark_Notes].toStringList();
|
||||
gGraph *flow = gv->findGraph(STR_TR_FlowRate),
|
||||
*spo2 = gv->findGraph(STR_TR_SpO2),
|
||||
*pulse = gv->findGraph(STR_TR_PulseRate);
|
||||
|
||||
gGraph *flow = (*gv)[schema::channel[CPAP_FlowRate].code()],
|
||||
*spo2 = (*gv)[schema::channel[OXI_SPO2].code()],
|
||||
*pulse = (*gv)[schema::channel[OXI_Pulse].code()];
|
||||
|
||||
if (cpap && flow && !flow->isEmpty() && flow->visible()) {
|
||||
labels.push_back(EntireDay);
|
||||
@ -499,8 +498,8 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date)
|
||||
|
||||
if (!g->visible()) { continue; }
|
||||
|
||||
if ((g->title() != STR_TR_FlowRate) && (g->title() != STR_TR_SpO2)
|
||||
&& (g->title() != STR_TR_PulseRate)) {
|
||||
if ((g->name() != schema::channel[CPAP_FlowRate].code()) && (g->name() != schema::channel[OXI_SPO2].code())
|
||||
&& (g->name() != schema::channel[OXI_Pulse].code())) {
|
||||
start.push_back(st);
|
||||
end.push_back(et);
|
||||
graphs.push_back(g);
|
||||
|
Loading…
Reference in New Issue
Block a user