diff --git a/oscar/Graphs/gFlagsLine.cpp b/oscar/Graphs/gFlagsLine.cpp index 1cd726dd..d35660c8 100644 --- a/oscar/Graphs/gFlagsLine.cpp +++ b/oscar/Graphs/gFlagsLine.cpp @@ -114,23 +114,6 @@ void gFlagsGroup::SetDay(Day *d) cnt = lvisible.size(); - -// for (int i = 0; i < layers.size(); i++) { -// gFlagsLine *f = dynamic_cast(layers[i]); - -// if (!f) { continue; } - -// bool e = f->isEmpty(); - -// if (!e || f->isAlwaysVisible()) { -// lvisible.push_back(f); - -// if (!e) { -// cnt++; -// } -// } -// } - m_empty = (cnt == 0); if (m_empty) { @@ -141,6 +124,7 @@ void gFlagsGroup::SetDay(Day *d) m_barh = 0; } + bool gFlagsGroup::isEmpty() { if (m_day) { @@ -164,16 +148,6 @@ void gFlagsGroup::paint(QPainter &painter, gGraph &g, const QRegion ®ion) if (!m_day) { return; } - qint64 minx,maxx,dur; - g.graphView()->GetXBounds(minx,maxx); - dur = maxx - minx; - QString text= QString("%1 -> %2 %3: %4 "). - arg(QDateTime::fromMSecsSinceEpoch(minx).time().toString()). - arg(QDateTime::fromMSecsSinceEpoch(maxx).time().toString()). - arg(QObject::tr("Selection Length")). - arg(QTime(0,0).addMSecs(dur).toString("H:mm:ss.zzz")) ; - g.renderText(text, left , top -5 ); - QVector visflags; for (const auto & flagsline : lvisible) { @@ -185,6 +159,29 @@ void gFlagsGroup::paint(QPainter &painter, gGraph &g, const QRegion ®ion) m_barh = float(height) / float(vis); float linetop = top; + qint64 minx,maxx,dur; + g.graphView()->GetXBounds(minx,maxx); + dur = maxx - minx; + #if 0 + // debug for minimum size for event flags. adding required height for enabled events , number eventTypes , height of an event bar + QString text= QString("%1 -> %2 %3: %4 H:%5 Vis:%6 barH:%7"). + arg(QDateTime::fromMSecsSinceEpoch(minx).time().toString()). + arg(QDateTime::fromMSecsSinceEpoch(maxx).time().toString()). + arg(QObject::tr("Selection Length")). + arg(QTime(0,0).addMSecs(dur).toString("H:mm:ss.zzz")) + .arg(height) + .arg(vis) + .arg(m_barh) + ; + #else + QString text= QString("%1 -> %2 %3: %4"). + arg(QDateTime::fromMSecsSinceEpoch(minx).time().toString()). + arg(QDateTime::fromMSecsSinceEpoch(maxx).time().toString()). + arg(QObject::tr("Selection Length")). + arg(QTime(0,0).addMSecs(dur).toString("H:mm:ss.zzz")) ; + #endif + g.renderText(text, left , top -5 ); + QColor barcol; for (int i=0, end=visflags.size(); i < end; i++) { @@ -289,7 +286,6 @@ void gFlagsLine::paint(QPainter &painter, gGraph &w, const QRegion ®ion) double xmult = width / xx; schema::Channel & chan = schema::channel[m_code]; - GetTextExtent(chan.label(), m_lx, m_ly); // Draw text label diff --git a/oscar/Graphs/gFlagsLine.h b/oscar/Graphs/gFlagsLine.h index 165c8057..ba926364 100644 --- a/oscar/Graphs/gFlagsLine.h +++ b/oscar/Graphs/gFlagsLine.h @@ -64,9 +64,6 @@ class gFlagsLine: public Layer //! \brief Drawing code to add the flags and span markers to the Vertex buffers. virtual void paint(QPainter &painter, gGraph &w, const QRegion ®ion); - void setTotalLines(int i) { total_lines = i; } - void setLineNum(int i) { line_num = i; } - virtual Layer * Clone() { gFlagsLine * layer = new gFlagsLine(NoChannel); //ouchie.. Layer::CloneInto(layer); @@ -76,8 +73,6 @@ class gFlagsLine: public Layer void CloneInto(gFlagsLine * layer ) { layer->m_always_visible = m_always_visible; - layer->total_lines = total_lines; - layer->line_num = line_num; layer->m_lx = m_lx; layer->m_ly = m_ly; } @@ -87,7 +82,6 @@ class gFlagsLine: public Layer virtual bool mouseMoveEvent(QMouseEvent *event, gGraph *graph); bool m_always_visible; - int total_lines, line_num; int m_lx, m_ly; }; @@ -117,12 +111,6 @@ class gFlagsGroup: public LayerGroup //! Returns true if none of the gFlagLine objects contain any data for this day virtual bool isEmpty(); - //! Returns the count of visible flag line entries - int count() { return lvisible.size(); } - - //! Returns the height in pixels of each bar - int barHeight() { return m_barh; } - //! Returns a list of Visible gFlagsLine layers to draw QVector &visibleLayers() { return lvisible; } diff --git a/oscar/Graphs/gGraph.cpp b/oscar/Graphs/gGraph.cpp index 6d0fbe23..2e79d789 100644 --- a/oscar/Graphs/gGraph.cpp +++ b/oscar/Graphs/gGraph.cpp @@ -1199,7 +1199,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent *event) void gGraph::wheelEvent(QWheelEvent *event) { - qDebug() << m_title << "Wheel" << wheelEventX(event) << wheelEventY(event) << wheelEventDelta(event); + //qDebug() << m_title << "Wheel" << wheelEventX(event) << wheelEventY(event) << wheelEventDelta(event); //int y=event->pos().y(); if ( isWheelEventHorizontal(event) ) { @@ -1535,10 +1535,16 @@ int gGraph::minHeight() { int minheight = m_min_height; -// int top = 0; -// int center = 0; -// int bottom = 0; for (const auto & layer : m_layers) { + // caution. + // The logical around this area of code does not work. + // This assumes that one layer has the total height for the graph. + // this is not the case. + // for exaple the xaxis layer contains part of the total height + // and so does the graph area. + // what about the top margin for text . + // There are some layers that do not contribute to the minimum height. + int mh = layer->minimumHeight(); mh += m_margintop + m_marginbottom; if (mh > minheight) minheight = mh; diff --git a/oscar/SleepLib/machine.cpp b/oscar/SleepLib/machine.cpp index e18b1299..e0f707b8 100644 --- a/oscar/SleepLib/machine.cpp +++ b/oscar/SleepLib/machine.cpp @@ -393,8 +393,7 @@ bool Machine::AddSession(Session *s, bool allowOldSessions) if (session_length < ignore_sessions) { // keep the session to save importing it again, but don't add it to the day record this time - qDebug() << s->session() << "Ignoring short session <" << ignore_sessions - << "["+QDateTime::fromMSecsSinceEpoch(s->first()).toString("MMM dd, yyyy hh:mm:ss")+"]"; + // qDebug() << s->session() << "Ignoring short session <" << ignore_sessions << "["+QDateTime::fromMSecsSinceEpoch(s->first()).toString("MMM dd, yyyy hh:mm:ss")+"]"; return true; }