diff --git a/sleepyhead/Graphs/MinutesAtPressure.cpp b/sleepyhead/Graphs/MinutesAtPressure.cpp index ad33ac85..42a62e4e 100644 --- a/sleepyhead/Graphs/MinutesAtPressure.cpp +++ b/sleepyhead/Graphs/MinutesAtPressure.cpp @@ -202,7 +202,7 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r peakmult = double(height+2) / (peak/peakstep); if (peakmult < h+4) { peakstep = 40.0; - peakmult = double(height+2) / (peak/peakstep); + //peakmult = double(height+2) / (peak/peakstep); } } } @@ -380,7 +380,7 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r r = double(height+3) / (evpeak/g); if (r < h+4) { g = 20.0; - r = double(height+3) / (evpeak/g); + //r = double(height+3) / (evpeak/g); } } } diff --git a/sleepyhead/Graphs/gGraph.cpp b/sleepyhead/Graphs/gGraph.cpp index d481a9db..91717635 100644 --- a/sleepyhead/Graphs/gGraph.cpp +++ b/sleepyhead/Graphs/gGraph.cpp @@ -132,7 +132,9 @@ gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units { if (height == 0) { height = p_profile->appearance->graphHeight(); + Q_UNUSED(height) } + if (graphview && graphview->contains(name)) { qDebug() << "Trying to duplicate " << name << " when a graph with the same name already exists"; name+="-1"; @@ -753,8 +755,8 @@ void gGraph::mouseMoveEvent(QMouseEvent *event) int w = m_rect.width() - left - right; - double xx = max_x - min_x; - double xmult = xx / double(w); + double xx; //= max_x - min_x; + double xmult;// = xx / double(w); { xmult = (m_blockzoom ? double(rmax_x - rmin_x) : double(max_x - min_x)) / double(w); @@ -927,7 +929,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent *event) int h = m_rect.height() - bottom; //+m_marginbottom); int x2 = m_graphview->pointClicked().x() - m_rect.left(); - int y2 = m_graphview->pointClicked().y() - m_rect.top(); + //int y2 = m_graphview->pointClicked().y() - m_rect.top(); m_selDurString = QString(); @@ -939,9 +941,9 @@ void gGraph::mouseReleaseEvent(QMouseEvent *event) if (m_graphview->horizTravel() > mouse_movement_threshold) { x -= left; //+m_marginleft; - y -= top; //+m_margintop; + //y -= top; //+m_margintop; x2 -= left; //+m_marginleft; - y2 -= top; //+m_margintop; + //y2 -= top; //+m_margintop; if (x < 0) { x = 0; } @@ -1018,7 +1020,7 @@ void gGraph::mouseReleaseEvent(QMouseEvent *event) } } else { x -= left; - y -= top; + //y -= top; //w-=m_marginleft+left; double qq = rmax_x - rmin_x; double xmult; diff --git a/sleepyhead/Graphs/gGraphView.cpp b/sleepyhead/Graphs/gGraphView.cpp index f3a02b15..896acaed 100644 --- a/sleepyhead/Graphs/gGraphView.cpp +++ b/sleepyhead/Graphs/gGraphView.cpp @@ -515,6 +515,8 @@ bool gGraphView::pinchTriggered(QPinchGesture * gesture) if (!graph) { return true; } + Q_UNUSED(group) + //qDebug() << gesture << gesture->scaleFactor(); if (gesture->state() == Qt::GestureStarted) { pinch_min = m_minx; @@ -1051,9 +1053,10 @@ void gGraphView::GetRXBounds(qint64 &st, qint64 &et) break; } } - - st = g->rmin_x; - et = g->rmax_x; + if (g) { + st = g->rmin_x; + et = g->rmax_x; + } } void gGraphView::ResetBounds(bool refresh) //short group) @@ -2524,14 +2527,14 @@ void gGraphView::mousePressEvent(QMouseEvent *event) m_sizer_point.setX(x); m_sizer_point.setY(py); // point at top of graph.. this->setCursor(Qt::ClosedHandCursor); - done=true; + //done=true; } else if ((event->button() == Qt::RightButton) && (x < (titleWidth + gYAxis::Margin))) { this->setCursor(Qt::ArrowCursor); pin_action->setText(QObject::tr("Unpin %1 Graph").arg(g->title())); pin_graph = g; populateMenu(g); context_menu->popup(event->globalPos()); - done=true; + //done=true; } else if (!g->blockSelect()) { if (m_metaselect) { if (m_selected_graph) { @@ -2587,7 +2590,7 @@ void gGraphView::mousePressEvent(QMouseEvent *event) m_sizer_point.setX(x); m_sizer_point.setY(y); //qDebug() << "Sizer clicked" << i; - done=true; + //done=true; } else if ((y >= py) && (y < py + h)) { //qDebug() << "Clicked" << i; @@ -2599,7 +2602,7 @@ void gGraphView::mousePressEvent(QMouseEvent *event) m_sizer_point.setX(x); m_sizer_point.setY(py); // point at top of graph.. this->setCursor(Qt::ClosedHandCursor); - done=true; + //done=true; } else if ((event->button() == Qt::RightButton) && (x < (titleWidth + gYAxis::Margin))) { this->setCursor(Qt::ArrowCursor); pin_action->setText(QObject::tr("Pin %1 Graph").arg(g->title())); @@ -2607,7 +2610,7 @@ void gGraphView::mousePressEvent(QMouseEvent *event) populateMenu(g); context_menu->popup(event->globalPos()); - done=true; + //done=true; } else if (!g->blockSelect()) { if (m_metaselect) { if (m_selected_graph) { diff --git a/sleepyhead/Graphs/gLineChart.cpp b/sleepyhead/Graphs/gLineChart.cpp index 31238123..36cc69c1 100644 --- a/sleepyhead/Graphs/gLineChart.cpp +++ b/sleepyhead/Graphs/gLineChart.cpp @@ -700,9 +700,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) double ZW = ZR / (width * ZQ); visible_points += ZR * ZQ; - if (accel && n > 0) { - sam = 1; - } +// if (accel && n > 0) { +// sam = 1; +// } if (ZW < num_averages) { sam = 1; @@ -921,11 +921,11 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) siz -= idx; - int gs = siz << 1; +// int gs = siz << 1; - if (square_plot) { - gs <<= 1; - } +// if (square_plot) { +// gs <<= 1; +// } // Unrolling square plot outside of loop to gain a minor speed improvement. EventStoreType *eptr = dptr + siz; diff --git a/sleepyhead/Graphs/gSessionTimesChart.cpp b/sleepyhead/Graphs/gSessionTimesChart.cpp index a44a7302..f28068e6 100644 --- a/sleepyhead/Graphs/gSessionTimesChart.cpp +++ b/sleepyhead/Graphs/gSessionTimesChart.cpp @@ -355,7 +355,7 @@ void gSummaryChart::populate(Day * day, int idx) value = hours; name = QObject::tr("Hours"); color = COLOR_LightBlue; - slices.append(SummaryChartSlice(&item, hours, hours, name, color)); + slices.append(SummaryChartSlice(&item, value, hours, name, color)); break; case ST_MIN: value = day->Min(code); diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index 29ca5716..ca7924a3 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -160,11 +160,11 @@ void SummaryChart::SetDay(Day * nullday) // skip any empty or irrelevant day records if (!day || (day->machine(m_machinetype) == nullptr)) { continue; } - int ft = qint64(day->first()) / 1000L; - ft += tz_offset; // convert to local time + //int ft = qint64(day->first()) / 1000L; + //ft += tz_offset; // convert to local time - int dz2 = ft / 86400; - dz2 *= 86400; + //int dz2 = ft / 86400; + //dz2 *= 86400; // ft = first sessions time, rounded back to midnight.. // For each session in this day record @@ -451,7 +451,7 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) barw = (float(width) / float(days)); // graph = &w; - float px = left; + float px;// = left; l_left = w.marginLeft() + gYAxis::Margin; l_top = w.marginTop(); l_width = width; @@ -1069,6 +1069,8 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph) x -= m_rect.left(); y -= m_rect.top(); + Q_UNUSED(y) + double xx = l_maxx - l_minx; double xmult = xx / double(l_width + barw); diff --git a/sleepyhead/Graphs/gYAxis.cpp b/sleepyhead/Graphs/gYAxis.cpp index c022f281..807d2b46 100644 --- a/sleepyhead/Graphs/gYAxis.cpp +++ b/sleepyhead/Graphs/gYAxis.cpp @@ -187,7 +187,7 @@ void gYAxis::paint(QPainter &painter, gGraph &w, const QRegion ®ion) // GetTextExtent(fd, x, y); y=fm.height(); - x=0; + //x=0; #ifdef DEBUG_LAYOUT painter.setPen(Qt::green); diff --git a/sleepyhead/Graphs/gdailysummary.cpp b/sleepyhead/Graphs/gdailysummary.cpp index 8c1670f4..e27ac4e9 100644 --- a/sleepyhead/Graphs/gdailysummary.cpp +++ b/sleepyhead/Graphs/gdailysummary.cpp @@ -230,7 +230,7 @@ void gDailySummary::paint(QPainter &painter, gGraph &w, const QRegion ®ion) float ypos = top + 10; double maxwidth = 0 ; - for (int i=0; i< info.size(); ++i) { + for (int i=0; i< size; ++i) { rect1 = QRectF(xpos, ypos, 0, 0); QString txt = info.at(i); diff --git a/sleepyhead/SleepLib/calcs.cpp b/sleepyhead/SleepLib/calcs.cpp index 738a3957..213049c0 100644 --- a/sleepyhead/SleepLib/calcs.cpp +++ b/sleepyhead/SleepLib/calcs.cpp @@ -298,6 +298,8 @@ void FlowParser::openFlow(Session *session, EventList *flow) // Apply the rest of the filters chain buf = applyFilters(m_filtered, m_samples); + Q_UNUSED(buf) + // Scan for and create an index of each breath calcPeaks(m_filtered, m_samples); @@ -317,12 +319,13 @@ void FlowParser::calcPeaks(EventDataType *input, int samples) double rate = m_flow->rate(); double flowstart = m_flow->first(); - double lasttime, time; + double time; //, lasttime; //double peakmax = flowstart, //double peakmin = flowstart; - time = lasttime = flowstart; + // lasttime = + time = flowstart; breaths.clear(); // Estimate storage space needed using typical average breaths per minute. @@ -397,7 +400,7 @@ void FlowParser::calcPeaks(EventDataType *input, int samples) } - lasttime = time; + //lasttime = time; time += rate; lastc = c; //lastk = k; @@ -618,7 +621,7 @@ void FlowParser::calc(bool calcResp, bool calcTv, bool calcTi, bool calcTe, bool stmin = start; } - len = et - stmin; + //len = et - stmin; rr = 0; len2 = 0; @@ -1763,8 +1766,6 @@ int calcLeaks(Session *session) quint32 *tptr = el.rawTime(); qint64 start = el.first(), ti; EventStoreType pressure; - tptr = el.rawTime(); - start = el.first(); bool found; diff --git a/sleepyhead/SleepLib/common.cpp b/sleepyhead/SleepLib/common.cpp index 0e226c65..73002a1c 100644 --- a/sleepyhead/SleepLib/common.cpp +++ b/sleepyhead/SleepLib/common.cpp @@ -617,6 +617,7 @@ QByteArray gUncompress(const QByteArray &data) ret = Z_DATA_ERROR; // and fall through case Z_DATA_ERROR: case Z_MEM_ERROR: + Q_UNUSED(ret) (void)inflateEnd(&strm); return QByteArray(); } diff --git a/sleepyhead/SleepLib/journal.cpp b/sleepyhead/SleepLib/journal.cpp index d7a9051f..839ad2c5 100644 --- a/sleepyhead/SleepLib/journal.cpp +++ b/sleepyhead/SleepLib/journal.cpp @@ -21,7 +21,7 @@ const int journal_data_version = 1; JournalEntry::JournalEntry(QDate date) { Machine * jmach = p_profile->GetMachine(MT_JOURNAL); - if (!jmach) { + if (jmach == nullptr) { // Create Journal machine record if it doesn't already exist MachineInfo info(MT_JOURNAL,0, "Journal", QObject::tr("Journal Data"), QString(), QString(), QString(), QObject::tr("SleepyHead"), QDateTime::currentDateTime(), journal_data_version); // Using machine ID 1 rather than a random number, so in future, if profile.xml gets screwed up they'll get their data back.. @@ -63,7 +63,7 @@ JournalEntry::JournalEntry(QDate date) m_date = date; session = nullptr; day = p_profile->GetDay(date, MT_JOURNAL); - if (!day) { + if (day != nullptr) { session = day->firstSession(MT_JOURNAL); } else { // Doesn't exist.. create a new one.. @@ -77,6 +77,9 @@ JournalEntry::JournalEntry(QDate date) // Let it live in memory...but not on disk unless data is changed... jmach->AddSession(session); + + // and where does day get set??? does day actually need to be set?? + day = p_profile->GetDay(date, MT_JOURNAL); } } JournalEntry::~JournalEntry() diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp index 4ccb44d4..5d1a1836 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp @@ -403,7 +403,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes) break; case 0x6: // 6,80,80,87 - data = buffer.at(idx+3) ^ 0x80; + // data = buffer.at(idx+3) ^ 0x80; break; // COMMAND_GET_SESSION_TIME @@ -441,12 +441,12 @@ void CMS50F37Loader::processBytes(QByteArray bytes) // COMMAND_CMS50_HELLO1 && COMMAND_CMS50_HELLO2 case 0xc: // a7 & a2 // responds with: c,80 - data = buffer.at(idx+1); + //data = buffer.at(idx+1); break; case 0x0e: // e,80,81 break; case 0x10: // 10,80,81 - data = buffer.at(idx+2); + //data = buffer.at(idx+2); break; // COMMAND_GET_OXIMETER_INFO diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp index 047e1d0a..f5452c88 100644 --- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp @@ -645,10 +645,11 @@ int IntellipapLoader::OpenDV6(QString path) // Prime the machine database's info field with stuff relevant to this machine MachineInfo info = newInfo(); info.series = "DV6"; + info.serial = "Unknown"; int vmin=0, vmaj=0; - EventDataType max_pressure, min_pressure; //, starting_pressure; + EventDataType max_pressure=0, min_pressure=0; //, starting_pressure; QByteArray str, dataBA; unsigned char *data = NULL; @@ -781,7 +782,7 @@ int IntellipapLoader::OpenDV6(QString path) // Creates Machine database record if it doesn't exist already //////////////////////////////////////////////////////////////////////////////////////// Machine *mach = CreateMachine(info); - if (!mach) { + if (mach == nullptr) { return -1; } qDebug() << "Opening DV6 (" << info.serial << ")" << "v" << vmaj << "." << vmin << "Min:" << min_pressure << "Max:" << max_pressure; diff --git a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp index b5fabce5..4c4a06fd 100644 --- a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp @@ -2598,7 +2598,7 @@ bool ResmedLoader::LoadEVE(Session *sess, const QString & path) QString t; long recs; - double duration; + double duration=0; char *data; char c; long pos; @@ -2626,7 +2626,7 @@ bool ResmedLoader::LoadEVE(Session *sess, const QString & path) pos = 0; tt = edf.startdate; // sess->updateFirst(tt); - duration = 0; + //duration = 0; while (pos < recs) { c = data[pos]; @@ -2818,7 +2818,7 @@ void ResmedLoader::ToTimeDelta(Session *sess, EDFParser &edf, EDFSignal &es, Cha double rate = (duration / recs); // milliseconds per record double tt = edf.startdate; - EventStoreType c, last; + EventStoreType c=0, last; int startpos = 0; diff --git a/sleepyhead/SleepLib/loader_plugins/somnopose_loader.cpp b/sleepyhead/SleepLib/loader_plugins/somnopose_loader.cpp index 9b9fd1bb..cfb3f9e9 100644 --- a/sleepyhead/SleepLib/loader_plugins/somnopose_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/somnopose_loader.cpp @@ -152,17 +152,21 @@ int SomnoposeLoader::OpenFile(QString filename) ev_inclination->AddEvent(time, inclination); } - sess->setMin(POS_Orientation, ev_orientation->Min()); - sess->setMax(POS_Orientation, ev_orientation->Max()); - sess->setMin(POS_Inclination, ev_inclination->Min()); - sess->setMax(POS_Inclination, ev_inclination->Max()); + if (sess) { + if (ev_orientation && ev_inclination) { + sess->setMin(POS_Orientation, ev_orientation->Min()); + sess->setMax(POS_Orientation, ev_orientation->Max()); + sess->setMin(POS_Inclination, ev_inclination->Min()); + sess->setMax(POS_Inclination, ev_inclination->Max()); + } - sess->really_set_last(time); - sess->SetChanged(true); + sess->really_set_last(time); + sess->SetChanged(true); - mach->AddSession(sess); + mach->AddSession(sess); - mach->Save(); + mach->Save(); + } return true; } diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp index 824e1508..f2f27f0e 100644 --- a/sleepyhead/SleepLib/machine.cpp +++ b/sleepyhead/SleepLib/machine.cpp @@ -821,7 +821,8 @@ void SaveTask::run() void Machine::queTask(ImportTask * task) { - if (0) { //p_profile->session->multithreading()) { + // Okay... what was this turned off??? + if (p_profile->session->multithreading()) { m_tasklist.push_back(task); return; } diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index 61ce19ce..5d2d5c96 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -1158,15 +1158,15 @@ QString Daily::getCPAPInformation(Day * day) QString Daily::getStatisticsInfo(Day * day) { - if (!day) return QString(); + if (day == nullptr) return QString(); Machine *cpap = day->machine(MT_CPAP); // *oxi = day->machine(MT_OXIMETER), // *pos = day->machine(MT_POSITION); - int mididx=p_profile->general->prefCalcMiddle(); - SummaryType ST_mid; + SummaryType ST_mid = ST_AVG; + if (mididx==0) ST_mid=ST_PERC; if (mididx==1) ST_mid=ST_WAVG; if (mididx==2) ST_mid=ST_AVG; diff --git a/sleepyhead/daily.ui b/sleepyhead/daily.ui index df287870..9bce124e 100644 --- a/sleepyhead/daily.ui +++ b/sleepyhead/daily.ui @@ -6,8 +6,8 @@ 0 0 - 551 - 441 + 561 + 444 diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 15578fb6..31796be9 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -1620,6 +1620,8 @@ void MainWindow::DelayedScreenshot() #endif #if defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_HAIKU) + Q_UNUSED(w) + Q_UNUSED(h) //QRect rec = QApplication::desktop()->screenGeometry(); // grab the whole screen @@ -1804,7 +1806,6 @@ void packEventList(EventList *el, EventDataType minval = 0) if (!f) { if (t > minval) { nel.AddEvent(ti, t); - lasttime = ti; } } @@ -2107,6 +2108,7 @@ void MainWindow::on_actionPurge_Current_Day_triggered() } day = p_profile->GetDay(date, MT_CPAP); + Q_UNUSED(day); getDaily()->clearLastDay(); getDaily()->LoadDate(date); diff --git a/sleepyhead/statistics.cpp b/sleepyhead/statistics.cpp index 34b65c7d..cc2f2678 100644 --- a/sleepyhead/statistics.cpp +++ b/sleepyhead/statistics.cpp @@ -21,7 +21,7 @@ QString formatTime(float time) int hours = time; int seconds = time * 3600.0; int minutes = (seconds / 60) % 60; - seconds %= 60; + //seconds %= 60; return QString().sprintf("%02i:%02i", hours, minutes); //,seconds); }