From dbabc4cd58fbb51ea8d819f669337531eacab1cb Mon Sep 17 00:00:00 2001 From: Seeker4 Date: Fri, 5 Jul 2019 10:29:57 -0700 Subject: [PATCH] Suppress duration on tooltip and event list if duration is zero (which usually means unknown duration as CPAP machine did not report it) --- oscar/Graphs/gFlagsLine.cpp | 5 ++++- oscar/daily.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/oscar/Graphs/gFlagsLine.cpp b/oscar/Graphs/gFlagsLine.cpp index 0b986345..e921400e 100644 --- a/oscar/Graphs/gFlagsLine.cpp +++ b/oscar/Graphs/gFlagsLine.cpp @@ -400,7 +400,10 @@ void gFlagsLine::paint(QPainter &painter, gGraph &w, const QRegion ®ion) painter.drawRect(x1-2, bartop-2, 4, bottom-bartop+4); int x,y; - QString lab = QString("%1 (%2)").arg(schema::channel[m_code].fullname()).arg(*dptr); +// QString lab = QString("%1 (%2)").arg(schema::channel[m_code].fullname()).arg(*dptr); + QString lab = QString("%1").arg(schema::channel[m_code].fullname()); + if (*dptr != 0) + lab += QString(" (%2)").arg(*dptr); GetTextExtent(lab, x, y); w.ToolTip(lab, x1 - 10, bartop + (3 * w.printScaleY()), TT_AlignRight, tooltipTimeout); diff --git a/oscar/daily.cpp b/oscar/daily.cpp index 847c4e3c..5e171d33 100644 --- a/oscar/daily.cpp +++ b/oscar/daily.cpp @@ -45,6 +45,8 @@ 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()+")"; +// return schema::channel[code].fullname()+"\n"+schema::channel[code].description() +// + (schema::channel[code].units() != "0" ? "\n("+schema::channel[code].units()+")" : ""); } void Daily::setCalendarVisible(bool visible) @@ -658,7 +660,10 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day) } QStringList a; QDateTime d=QDateTime::fromMSecsSinceEpoch(t); // Localtime - QString s=QString("#%1: %2 (%3)").arg((int)(++mccnt[code]),(int)3,(int)10,QChar('0')).arg(d.toString("HH:mm:ss")).arg(m.value()[z]->raw(o)); + QString s=QString("#%1: %2").arg((int)(++mccnt[code]),(int)3,(int)10,QChar('0')).arg(d.toString("HH:mm:ss")); + if (m.value()[z]->raw(o) > 0) + s += QString(" (%3)").arg(m.value()[z]->raw(o)); + a.append(s); QTreeWidgetItem *item=new QTreeWidgetItem(a); item->setData(0,Qt::UserRole,t); @@ -1166,6 +1171,8 @@ QString Daily::getStatisticsInfo(Day * day) QString tooltip=schema::channel[code].description(); if (!schema::channel[code].units().isEmpty()) tooltip+=" ("+schema::channel[code].units()+")"; +// if (!schema::channel[code].units().isEmpty() && schema::channel[code].units() != "0") +// tooltip+=" ("+schema::channel[code].units()+")"; if (ST_max == ST_MAX) { mx=day->Max(code);