mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Dump some line cursor data as a debug test
This commit is contained in:
parent
3666391553
commit
eb42baf9de
@ -1394,3 +1394,21 @@ int GetXHeight(QFont *font)
|
|||||||
QFontMetrics fm(*font);
|
QFontMetrics fm(*font);
|
||||||
return fm.xHeight();
|
return fm.xHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gGraph::dumpInfo() {
|
||||||
|
for (int i = 0; i < m_layers.size(); i++) {
|
||||||
|
Layer *ll = m_layers[i];
|
||||||
|
|
||||||
|
if (!ll->visible()) { continue; }
|
||||||
|
|
||||||
|
if (ll->position() == LayerCenter) {
|
||||||
|
gLineChart *lc = dynamic_cast<gLineChart *>(ll);
|
||||||
|
if (lc != nullptr) {
|
||||||
|
QString text = lc->getMetaString(currentTime());
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
mainwin->log(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -314,6 +314,8 @@ class gGraph : public QObject
|
|||||||
//! \brief Key Pressed event
|
//! \brief Key Pressed event
|
||||||
virtual void keyReleaseEvent(QKeyEvent *event);
|
virtual void keyReleaseEvent(QKeyEvent *event);
|
||||||
|
|
||||||
|
void dumpInfo();
|
||||||
|
|
||||||
//! \brief Change the current selected time boundaries by mult, from origin position origin_px
|
//! \brief Change the current selected time boundaries by mult, from origin position origin_px
|
||||||
void ZoomX(double mult, int origin_px);
|
void ZoomX(double mult, int origin_px);
|
||||||
|
|
||||||
|
@ -347,6 +347,16 @@ gGraphView::~gGraphView()
|
|||||||
m_graphs.clear();
|
m_graphs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gGraphView::dumpInfo()
|
||||||
|
{
|
||||||
|
QDateTime dt=QDateTime::fromMSecsSinceEpoch(currentTime());
|
||||||
|
QString text = "==================== Line Cursor Dump ====================\n"+dt.toString("MMM dd - HH:mm:ss:zzz");
|
||||||
|
mainwin->log(text);
|
||||||
|
for (int i=0;i<m_graphs.size();i++) {
|
||||||
|
m_graphs[i]->dumpInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool gGraphView::usePixmapCache()
|
bool gGraphView::usePixmapCache()
|
||||||
{
|
{
|
||||||
//use_pixmap_cache is an overide setting
|
//use_pixmap_cache is an overide setting
|
||||||
@ -1845,6 +1855,9 @@ void gGraphView::keyPressEvent(QKeyEvent *event)
|
|||||||
p_profile->appearance->setLineCursorMode(!p_profile->appearance->lineCursorMode());
|
p_profile->appearance->setLineCursorMode(!p_profile->appearance->lineCursorMode());
|
||||||
timedRedraw(0);
|
timedRedraw(0);
|
||||||
}
|
}
|
||||||
|
if (event->key() == Qt::Key_F10) {
|
||||||
|
dumpInfo();
|
||||||
|
}
|
||||||
|
|
||||||
if (event->key() == Qt::Key_Tab) {
|
if (event->key() == Qt::Key_Tab) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
|
@ -381,6 +381,8 @@ class gGraphView
|
|||||||
|
|
||||||
inline QPoint currentMousePos() const { return m_mouse; }
|
inline QPoint currentMousePos() const { return m_mouse; }
|
||||||
|
|
||||||
|
void dumpInfo();
|
||||||
|
|
||||||
// for profiling purposes, a count of lines drawn in a single frame
|
// for profiling purposes, a count of lines drawn in a single frame
|
||||||
int lines_drawn_this_frame;
|
int lines_drawn_this_frame;
|
||||||
int quads_drawn_this_frame;
|
int quads_drawn_this_frame;
|
||||||
|
@ -29,6 +29,7 @@ gLineChart::gLineChart(ChannelID code, QColor col, bool square_plot, bool disabl
|
|||||||
m_line_color = col;
|
m_line_color = col;
|
||||||
m_report_empty = false;
|
m_report_empty = false;
|
||||||
lines.reserve(50000);
|
lines.reserve(50000);
|
||||||
|
lasttime = 0;
|
||||||
}
|
}
|
||||||
gLineChart::~gLineChart()
|
gLineChart::~gLineChart()
|
||||||
{
|
{
|
||||||
@ -164,41 +165,40 @@ bool gLineChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString gLineChart::getMetaString(ChannelID code, qint64 xpos)
|
QString gLineChart::getMetaString(qint64 time)
|
||||||
{
|
{
|
||||||
static qint64 lasttime = 0;
|
lasttext = QString();
|
||||||
static ChannelID lastcode = NoChannel;
|
if (!m_day) return lasttext;
|
||||||
static QString lasttext;
|
|
||||||
|
|
||||||
QString text;
|
|
||||||
if (!((lasttime == xpos) && (lastcode == code))) {
|
EventDataType val;
|
||||||
EventDataType val = 0, val2 = 0, val3 = 0;
|
|
||||||
if (m_day) {
|
EventDataType ipap = 0, epap = 0;
|
||||||
if (code == CPAP_Pressure) {
|
bool addPS = false;
|
||||||
CPAPMode mode = (CPAPMode)round(m_day->settings_wavg(CPAP_Mode));
|
|
||||||
if (mode >= MODE_BIPAP) {
|
for (int i=0; i<m_codes.size(); ++i) {
|
||||||
val = m_day->lookupValue(CPAP_EPAP, xpos);
|
ChannelID code = m_codes[i];
|
||||||
val2 = m_day->lookupValue(CPAP_IPAP, xpos);
|
if (m_day->channelHasData(code)) {
|
||||||
val3 = val2 - val;
|
val = m_day->lookupValue(code, time);
|
||||||
text=QString("%1: %2 %3 %4:%5 %3 %6:%7 %3").arg(STR_TR_EPAP).arg(val,0,'f',1).arg(STR_UNIT_CMH2O).arg(STR_TR_IPAP).arg(val2,0,'f',1).arg(STR_TR_PS).arg(val3,0,'f',1);
|
lasttext += " "+QString("%1: %2 %3").arg(schema::channel[code].label()).arg(val,0,'f',2).arg(schema::channel[code].units());
|
||||||
} else {
|
|
||||||
val = m_day->lookupValue(code, xpos);
|
if (code == CPAP_IPAP) {
|
||||||
text = QString("%1: %2 %3").arg(schema::channel[code].label()).arg(val).arg(schema::channel[code].units());
|
ipap = val;
|
||||||
}
|
addPS = true;
|
||||||
} else {
|
}
|
||||||
val = m_day->lookupValue(code, xpos);
|
if (code == CPAP_EPAP) {
|
||||||
text = QString("%1: %2 %3").arg(schema::channel[code].label()).arg(val).arg(schema::channel[code].units());
|
epap = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastcode = code;
|
}
|
||||||
lasttime = xpos;
|
if (addPS) {
|
||||||
lasttext = text;
|
val = ipap - epap;
|
||||||
} else {
|
lasttext += " "+QString("%1: %2 %3").arg(schema::channel[CPAP_PS].label()).arg(val,0,'f',2).arg(schema::channel[CPAP_PS].units());
|
||||||
text = lasttext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
lasttime = time;
|
||||||
|
return lasttext;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time Domain Line Chart
|
// Time Domain Line Chart
|
||||||
@ -274,26 +274,19 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
qint64 time = w.currentTime();
|
qint64 time = w.currentTime();
|
||||||
|
|
||||||
|
|
||||||
QDateTime dt=QDateTime::fromMSecsSinceEpoch(time);
|
|
||||||
|
|
||||||
QString text = dt.toString("MMM dd - HH:mm:ss:zzz");
|
|
||||||
|
|
||||||
|
|
||||||
if ((time > minx) && (time < maxx)) {
|
if ((time > minx) && (time < maxx)) {
|
||||||
double xpos = (time - minx) * xmult;
|
double xpos = (time - minx) * xmult;
|
||||||
painter.setPen(QPen(QBrush(QColor(0,255,0,255)),1));
|
painter.setPen(QPen(QBrush(QColor(0,255,0,255)),1));
|
||||||
painter.drawLine(left+xpos, top-w.marginTop()-3, left+xpos, top+height+w.bottom-1);
|
painter.drawLine(left+xpos, top-w.marginTop()-3, left+xpos, top+height+w.bottom-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//QString text = getMetaString(m_codes[0], time);
|
if ((time != lasttime) || lasttext.isEmpty()) {
|
||||||
for (int i=0; i<m_codes.size(); ++i) {
|
getMetaString(time);
|
||||||
ChannelID code = m_codes[i];
|
|
||||||
if (m_day->channelHasData(code)) {
|
|
||||||
EventDataType val = m_day->lookupValue(code, time);
|
|
||||||
text += " "+QString("%1: %2 %3").arg(schema::channel[code].label()).arg(val).arg(schema::channel[code].units());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDateTime dt=QDateTime::fromMSecsSinceEpoch(time);
|
||||||
|
QString text = dt.toString("MMM dd - HH:mm:ss:zzz") + lasttext;
|
||||||
|
|
||||||
int wid, h;
|
int wid, h;
|
||||||
GetTextExtent(text, wid, h);
|
GetTextExtent(text, wid, h);
|
||||||
w.renderText(text, left + width/2 - wid/2, top-h+5);
|
w.renderText(text, left + width/2 - wid/2, top-h+5);
|
||||||
|
@ -78,11 +78,12 @@ class gLineChart: public Layer
|
|||||||
//! \brief Enable or Disable the subplot identified by code.
|
//! \brief Enable or Disable the subplot identified by code.
|
||||||
void setPlotEnabled(ChannelID code, bool b) { m_enabled[code] = b; }
|
void setPlotEnabled(ChannelID code, bool b) { m_enabled[code] = b; }
|
||||||
|
|
||||||
|
QString getMetaString(qint64 time);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \brief Mouse moved over this layers area (shows the hover-over tooltips here)
|
//! \brief Mouse moved over this layers area (shows the hover-over tooltips here)
|
||||||
virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph);
|
virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph);
|
||||||
|
|
||||||
QString getMetaString(ChannelID code, qint64 time);
|
|
||||||
|
|
||||||
bool m_report_empty;
|
bool m_report_empty;
|
||||||
bool m_square_plot;
|
bool m_square_plot;
|
||||||
@ -103,6 +104,9 @@ class gLineChart: public Layer
|
|||||||
QHash<ChannelID, bool> m_enabled;
|
QHash<ChannelID, bool> m_enabled;
|
||||||
|
|
||||||
QVector<QLine> lines;
|
QVector<QLine> lines;
|
||||||
|
|
||||||
|
QString lasttext;
|
||||||
|
qint64 lasttime;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLINECHART_H
|
#endif // GLINECHART_H
|
||||||
|
@ -123,7 +123,7 @@ QString STR_UNIT_BreathsPerMinute;
|
|||||||
QString STR_UNIT_Percentage;
|
QString STR_UNIT_Percentage;
|
||||||
QString STR_UNIT_Unknown;
|
QString STR_UNIT_Unknown;
|
||||||
QString STR_UNIT_Ratio;
|
QString STR_UNIT_Ratio;
|
||||||
QString STR_UNIT_Severety;
|
QString STR_UNIT_Severity;
|
||||||
QString STR_UNIT_Degrees;
|
QString STR_UNIT_Degrees;
|
||||||
|
|
||||||
QString STR_MessageBox_Question;
|
QString STR_MessageBox_Question;
|
||||||
@ -305,9 +305,9 @@ void initializeStrings()
|
|||||||
STR_UNIT_Litres = QObject::tr("Litres");
|
STR_UNIT_Litres = QObject::tr("Litres");
|
||||||
STR_UNIT_ml = QObject::tr("ml"); // millilitres
|
STR_UNIT_ml = QObject::tr("ml"); // millilitres
|
||||||
STR_UNIT_BreathsPerMinute = QObject::tr("Breaths/min"); // Breaths per minute
|
STR_UNIT_BreathsPerMinute = QObject::tr("Breaths/min"); // Breaths per minute
|
||||||
STR_UNIT_Unknown = QObject::tr("??");
|
STR_UNIT_Unknown = QObject::tr("?");
|
||||||
STR_UNIT_Ratio = QObject::tr("ratio");
|
STR_UNIT_Ratio = QObject::tr("ratio");
|
||||||
STR_UNIT_Severety = QObject::tr("Severety (0-1)");
|
STR_UNIT_Severity = QObject::tr("Severity (0-1)");
|
||||||
STR_UNIT_Degrees = QObject::tr("Degrees");
|
STR_UNIT_Degrees = QObject::tr("Degrees");
|
||||||
|
|
||||||
STR_MessageBox_Question = QObject::tr("Question");
|
STR_MessageBox_Question = QObject::tr("Question");
|
||||||
|
@ -139,7 +139,7 @@ extern QString STR_UNIT_Percentage;
|
|||||||
extern QString STR_UNIT_BreathsPerMinute;
|
extern QString STR_UNIT_BreathsPerMinute;
|
||||||
extern QString STR_UNIT_Unknown;
|
extern QString STR_UNIT_Unknown;
|
||||||
extern QString STR_UNIT_Ratio;
|
extern QString STR_UNIT_Ratio;
|
||||||
extern QString STR_UNIT_Severety;
|
extern QString STR_UNIT_Severity;
|
||||||
extern QString STR_UNIT_Degrees;
|
extern QString STR_UNIT_Degrees;
|
||||||
|
|
||||||
extern QString STR_MessageBox_Question;
|
extern QString STR_MessageBox_Question;
|
||||||
|
@ -1301,10 +1301,12 @@ int ResmedLoader::Open(QString path)
|
|||||||
|
|
||||||
backup_path += RMS9_STR_datalog + "/";
|
backup_path += RMS9_STR_datalog + "/";
|
||||||
|
|
||||||
|
#ifdef LOCK_RESMED_SESSIONS
|
||||||
// Have to sacrifice these features to get access to summary data.
|
// Have to sacrifice these features to get access to summary data.
|
||||||
p_profile->session->setCombineCloseSessions(0);
|
p_profile->session->setCombineCloseSessions(0);
|
||||||
p_profile->session->setDaySplitTime(QTime(12,0,0));
|
p_profile->session->setDaySplitTime(QTime(12,0,0));
|
||||||
p_profile->session->setIgnoreShortSessions(false);
|
p_profile->session->setIgnoreShortSessions(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Scan through new file list and import sessions
|
// Scan through new file list and import sessions
|
||||||
|
@ -337,7 +337,7 @@ void init()
|
|||||||
schema::channel.add(GRP_CPAP, new Channel(CPAP_FLG = 0x1113, WAVEFORM, SESSION, "FLG",
|
schema::channel.add(GRP_CPAP, new Channel(CPAP_FLG = 0x1113, WAVEFORM, SESSION, "FLG",
|
||||||
QObject::tr("Flow Limitation"),
|
QObject::tr("Flow Limitation"),
|
||||||
QObject::tr("Graph showing severity of flow limitations"), QObject::tr("Flow Limit."),
|
QObject::tr("Graph showing severity of flow limitations"), QObject::tr("Flow Limit."),
|
||||||
STR_UNIT_Severety, DEFAULT, QColor("dark gray")));
|
STR_UNIT_Severity, DEFAULT, QColor("dark gray")));
|
||||||
|
|
||||||
schema::channel.add(GRP_CPAP, new Channel(CPAP_TgMV = 0x1114, WAVEFORM, SESSION,
|
schema::channel.add(GRP_CPAP, new Channel(CPAP_TgMV = 0x1114, WAVEFORM, SESSION,
|
||||||
"TgMV", QObject::tr("Target Minute Ventilation"),
|
"TgMV", QObject::tr("Target Minute Ventilation"),
|
||||||
|
@ -99,6 +99,14 @@ void LogThread::append(QString msg)
|
|||||||
strlock.unlock();
|
strlock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LogThread::appendClean(QString msg)
|
||||||
|
{
|
||||||
|
strlock.lock();
|
||||||
|
buffer.append(msg);
|
||||||
|
strlock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LogThread::quit() {
|
void LogThread::quit() {
|
||||||
qDebug() << "Shutting down logging thread";
|
qDebug() << "Shutting down logging thread";
|
||||||
running = false;
|
running = false;
|
||||||
|
@ -25,6 +25,7 @@ public:
|
|||||||
|
|
||||||
void run();
|
void run();
|
||||||
void append(QString msg);
|
void append(QString msg);
|
||||||
|
void appendClean(QString msg);
|
||||||
bool isRunning() { return running; }
|
bool isRunning() { return running; }
|
||||||
|
|
||||||
void quit();
|
void quit();
|
||||||
|
@ -169,8 +169,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LOCK_RESMED_SESSIONS
|
||||||
|
|
||||||
QList<Machine *> machines = p_profile->GetMachines(MT_CPAP);
|
QList<Machine *> machines = p_profile->GetMachines(MT_CPAP);
|
||||||
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
||||||
QString mclass=(*it)->GetClass();
|
QString mclass=(*it)->GetClass();
|
||||||
@ -184,6 +183,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ui->actionToggle_Line_Cursor->setChecked(p_profile->appearance->lineCursorMode());
|
ui->actionToggle_Line_Cursor->setChecked(p_profile->appearance->lineCursorMode());
|
||||||
|
|
||||||
@ -374,6 +374,11 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::log(QString text)
|
||||||
|
{
|
||||||
|
logger->appendClean(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::Notify(QString s, QString title, int ms)
|
void MainWindow::Notify(QString s, QString title, int ms)
|
||||||
{
|
{
|
||||||
|
@ -136,6 +136,8 @@ class MainWindow : public QMainWindow
|
|||||||
|
|
||||||
void startImportDialog() { on_action_Import_Data_triggered(); }
|
void startImportDialog() { on_action_Import_Data_triggered(); }
|
||||||
|
|
||||||
|
void log(QString text);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! \brief Recalculate all event summaries and flags
|
//! \brief Recalculate all event summaries and flags
|
||||||
void doReprocessEvents();
|
void doReprocessEvents();
|
||||||
|
@ -71,6 +71,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LOCK_RESMED_SESSIONS
|
||||||
QList<Machine *> machines = p_profile->GetMachines(MT_CPAP);
|
QList<Machine *> machines = p_profile->GetMachines(MT_CPAP);
|
||||||
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
||||||
QString mclass=(*it)->GetClass();
|
QString mclass=(*it)->GetClass();
|
||||||
@ -81,7 +82,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QLocale locale = QLocale::system();
|
QLocale locale = QLocale::system();
|
||||||
QString shortformat = locale.dateFormat(QLocale::ShortFormat);
|
QString shortformat = locale.dateFormat(QLocale::ShortFormat);
|
||||||
|
@ -23,6 +23,9 @@ exists($$PWD/../BrokenGL) {
|
|||||||
QT += opengl
|
QT += opengl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#The following forces ResMed session locking.. it *may* not be necessary.. I'm still trying to assess this properly.
|
||||||
|
DEFINES += LOCK_RESMED_SESSIONS
|
||||||
|
|
||||||
#CONFIG += c++11
|
#CONFIG += c++11
|
||||||
CONFIG += rtti
|
CONFIG += rtti
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user