Hide empty TAP graph, sort fields

This commit is contained in:
Mark Watkins 2014-08-12 04:36:02 +10:00
parent 4d2c0ede80
commit e5472fd414

View File

@ -45,16 +45,17 @@ void MinutesAtPressure::SetDay(Day *day)
{ {
Layer::SetDay(day); Layer::SetDay(day);
m_empty = false; m_empty = false;
m_recalculating = false; m_recalculating = false;
m_lastminx = 0; m_lastminx = 0;
m_lastmaxx = 0; m_lastmaxx = 0;
m_empty = !m_day || !(m_day->channelExists(CPAP_Pressure) || m_day->channelExists(CPAP_IPAP));
} }
bool MinutesAtPressure::isEmpty() bool MinutesAtPressure::isEmpty()
{ {
return m_empty; return m_empty;
} }
@ -127,10 +128,13 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r
QMap<EventStoreType, EventDataType>::iterator vit; QMap<EventStoreType, EventDataType>::iterator vit;
int row = 0; int row = 0;
for (eit = events.begin(); eit != ev_end; ++eit) { int numchans = chans.size();
ChannelID code = eit.key(); for (int i=0; i< numchans; ++i) {
ChannelID code = chans.at(i);
schema::Channel & chan = schema::channel[code]; schema::Channel & chan = schema::channel[code];
eit = events.find(code);
xpos = left; xpos = left;
QMap<EventStoreType, EventDataType>::iterator eit_end = eit.value().end(); QMap<EventStoreType, EventDataType>::iterator eit_end = eit.value().end();
@ -157,14 +161,12 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r
row++; row++;
} }
timelock.unlock(); timelock.unlock();
if (m_recalculating) { if (m_recalculating) {
painter.setFont(*defaultfont); // painter.setFont(*defaultfont);
painter.setPen(QColor(0,0,0,125)); // painter.setPen(QColor(0,0,0,125));
painter.drawText(region.boundingRect(), Qt::AlignCenter, QObject::tr("Recalculating...")); // painter.drawText(region.boundingRect(), Qt::AlignCenter, QObject::tr("Recalculating..."));
} }
// Draw the goodies... // Draw the goodies...