From e5472fd4147ae26d837e102d79ee3fba77c1f2f5 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Tue, 12 Aug 2014 04:36:02 +1000 Subject: [PATCH] Hide empty TAP graph, sort fields --- sleepyhead/Graphs/MinutesAtPressure.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sleepyhead/Graphs/MinutesAtPressure.cpp b/sleepyhead/Graphs/MinutesAtPressure.cpp index cc8890c3..544e0270 100644 --- a/sleepyhead/Graphs/MinutesAtPressure.cpp +++ b/sleepyhead/Graphs/MinutesAtPressure.cpp @@ -45,16 +45,17 @@ void MinutesAtPressure::SetDay(Day *day) { Layer::SetDay(day); - m_empty = false; m_recalculating = false; m_lastminx = 0; m_lastmaxx = 0; + m_empty = !m_day || !(m_day->channelExists(CPAP_Pressure) || m_day->channelExists(CPAP_IPAP)); } bool MinutesAtPressure::isEmpty() { + return m_empty; } @@ -127,10 +128,13 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r QMap::iterator vit; int row = 0; - for (eit = events.begin(); eit != ev_end; ++eit) { - ChannelID code = eit.key(); + int numchans = chans.size(); + for (int i=0; i< numchans; ++i) { + ChannelID code = chans.at(i); schema::Channel & chan = schema::channel[code]; + eit = events.find(code); + xpos = left; QMap::iterator eit_end = eit.value().end(); @@ -157,14 +161,12 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r row++; } - - timelock.unlock(); if (m_recalculating) { - painter.setFont(*defaultfont); - painter.setPen(QColor(0,0,0,125)); - painter.drawText(region.boundingRect(), Qt::AlignCenter, QObject::tr("Recalculating...")); +// painter.setFont(*defaultfont); +// painter.setPen(QColor(0,0,0,125)); +// painter.drawText(region.boundingRect(), Qt::AlignCenter, QObject::tr("Recalculating...")); } // Draw the goodies...