From 6f8c56074ee9a585f558edfd10aed8c4ed8676d0 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 5 May 2018 17:14:44 +1000 Subject: [PATCH] PR 1030X100 support, trash legacy mutex.lock(); + m_quit = true; map->mutex.unlock(); } @@ -148,6 +148,8 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r m_maxx = graph.max_x; if (graph.printing() || ((m_lastminx != m_minx) || (m_lastmaxx != m_maxx))) { + // note: this doesn't run on popout graphs that aren't linked with scrolling... + // it's a pretty useless graph to popout, probably should just block it's popout instead. recalculate(&graph); } @@ -157,17 +159,21 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r QMap::iterator it; if (graph.printing()) { - // lock the other mutex... -// while (recalculating()) {}; -// recalculate(&graph); - while (recalculating()) {}; + // Could just lock the mutex QMutex instead + mutex.lock(); + // do nothing between, it should hang until complete. + mutex.unlock(); + //while (recalculating()) { QThread::yieldCurrentThread(); } // yield or whatever } if (!painter.isActive()) return; - // Lock the stuff we need to draw - timelock.lock(); + // Recalculating in the background... So we just draw an old copy until then the new data is ready + // (it will refresh itself when complete) + // The only time we can't draw when at the end of the recalc when the map variables are being updated + // So use a mutex to lock + QMutexLocker TimeLock(&timelock); painter.setFont(*defaultfont); painter.setPen(Qt::black); @@ -201,8 +207,12 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r peakstep = 20.0; peakmult = double(height+2) / (peak/peakstep); if (peakmult < h+4) { - peakstep = 40.0; - //peakmult = double(height+2) / (peak/peakstep); + peakstep = 50.0; + peakmult = double(height+2) / (peak/peakstep); + if (peakmult < h+4) { + peakstep = 100.0; + peakmult = double(height+2) / (peak/peakstep); + } } } } @@ -317,11 +327,15 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r // Plot IPAP Time at Pressure //////////////////////////////////////////////////////////////////// xp=left; - s2 = double(ipap.times[qMax(0, min-1)]/60.0); - if (s2 < 0) s2=0; + if ( ipap.times.size()>qMax(0, min-1)) { + s2 = double(ipap.times[qMax(0, min-1)]/60.0); + + if (s2 < 0) s2=0; + } else s2 =0; double lastyp = bottom - (s2 * ystep); - for (int i=min; iqMax(min-1,0)) { + s2 = ipap.events[ch][qMax(min-1,0)]; + } else s2 = 0; lastyp = bottom - (s2 * estep); - for (int i=min; i qMax(min,0)) { + s2 = double(epap.times[qMax(min,0)]/60.0); + } else { + s2 = 0; + } xp=left, lastyp = bottom - (s2 * ystep); - for (int i=min; itimelock); + map->timelock.lock(); + // map->times = times; // map->events = events; map->epap = EPAP; map->ipap = IPAP; // map->chans = chans; // map->m_presChannel = ipapcode; - timelock.unlock(); + map->timelock.unlock(); map->recalcFinished(); m_done = true; @@ -1276,21 +1298,27 @@ void MinutesAtPressure::recalculate(gGraph * graph) m_remap->run(); } else { while(!tp->tryStart(m_remap)); + + m_lastmaxx = m_maxx; + m_lastminx = m_minx; + } // Start recalculating in another thread, organize a callback to redraw when done.. + } void MinutesAtPressure::recalcFinished() { - if (m_graph) { - m_graph->timedRedraw(0); + if (m_graph && !m_graph->printing()) { + // Can't call this using standard timedRedraw function, we are in another thread, so have to use a throwaway timer + QTimer::singleShot(0, m_graph->graphView(), SLOT(refreshTimeout())); } - m_recalculating = false; m_remap = nullptr; + m_recalculating = false; // QThreadPool * tp = QThreadPool::globalInstance(); // tp->releaseThread(); @@ -1316,7 +1344,7 @@ bool MinutesAtPressure::mouseMoveEvent(QMouseEvent *, gGraph *graph) // graph->graphView()->setCurrentTime(c); - graph->timedRedraw(0); + if (graph) graph->timedRedraw(0); return false; } diff --git a/sleepyhead/Graphs/MinutesAtPressure.h b/sleepyhead/Graphs/MinutesAtPressure.h index 26e22e64..0b3e87a0 100644 --- a/sleepyhead/Graphs/MinutesAtPressure.h +++ b/sleepyhead/Graphs/MinutesAtPressure.h @@ -1,4 +1,4 @@ -/* Minutes At Pressure Graph Header +/* Minutes At Pressure Graph Header * * Copyright (C) 2011-2018 Mark Watkins * @@ -126,8 +126,8 @@ public: layer->ahis = ahis; - mutex.unlock(); timelock.unlock(); + mutex.unlock(); } protected: QMutex timelock; diff --git a/sleepyhead/Graphs/gGraphView.cpp b/sleepyhead/Graphs/gGraphView.cpp index 1d6f929f..d49f4c43 100644 --- a/sleepyhead/Graphs/gGraphView.cpp +++ b/sleepyhead/Graphs/gGraphView.cpp @@ -19,13 +19,10 @@ #include #include #include - -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) # include -#endif + #ifdef DEBUG_EFFICIENCY -// Only works in 4.8 # include #endif @@ -364,10 +361,8 @@ gGraphView::gGraphView(QWidget *parent, gGraphView *shared) popout_graph = nullptr; // pixmapcache.setCacheLimit(10240*2); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) m_dpr = devicePixelRatio(); - m_dpr = 1; -#endif + m_dpr = 1; // meh??? #ifndef BROKEN_OPENGL_BUILD setAutoFillBackground(false); @@ -1127,7 +1122,7 @@ void gGraphView::updateScale() void gGraphView::resizeEvent(QResizeEvent *e) { -#if QT_VERSION >= QT_VERSION_CHECK(5,4,0) && !defined(BROKEN_OPENGL_BUILD) +#if (QT_VERSION >= QT_VERSION_CHECK(5,4,0)) && !defined(BROKEN_OPENGL_BUILD) // This ques a needed redraw event.. QOpenGLWidget::resizeEvent(e); #endif diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index 793cd6aa..5c62ac59 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -847,15 +847,6 @@ jumpnext: } painter.setClipping(false); -//#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) -// quads->scissor(left * dpr, w.flipY(top + height + 2)*dpr, (width)*dpr, (height + 1)*dpr); -// lines->scissor(left * dpr, w.flipY(top + height + 2)*dpr, (width + 1)*dpr, (height + 1)*dpr); -// outlines->scissor(left * dpr, w.flipY(top + height + 2)*dpr, (width)*dpr, (height + 1)*dpr); -//#else -// lines->scissor(left, w.flipY(top + height + 2), width + 1, height + 2); -// outlines->scissor(left, w.flipY(top + height + 2), width, height + 2); -// quads->scissor(left, w.flipY(top + height + 2), width, height + 2); -//#endif // Draw Ledgend px = left + width - 3; py = top - 5; @@ -870,10 +861,6 @@ jumpnext: bool ishours = false; int good = 0; -// if (w.title().compare("Resp. Rate")==0) { -// int i=5; -// } - for (int j = 0; j < m_codes.size(); j++) { if (!goodcodes[j]) { continue; } diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h index 16661d52..caccdd07 100644 --- a/sleepyhead/SleepLib/common.h +++ b/sleepyhead/SleepLib/common.h @@ -14,12 +14,8 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(4,8,0) - #define DEBUG_EFFICIENCY 1 -#endif - QByteArray gCompress(const QByteArray& data); QByteArray gUncompress(const QByteArray &data); diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index f8dd5c9e..dc15da4d 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -22,6 +22,9 @@ #include "SleepLib/calcs.h" +// Disable this to cut excess debug messages +#define DEBUG_IMPORTER + //const int PRS1_MAGIC_NUMBER = 2; //const int PRS1_SUMMARY_FILE=1; //const int PRS1_EVENT_FILE=2; @@ -575,7 +578,8 @@ int PRS1Loader::OpenMachine(const QString & path) } // A bit of protection against future annoyances.. - if (((series != 5) && (series != 6) && (series != 0))) { // || (type >= 10)) { + if (((series != 5) && (series != 6) && (series != 0) && (series != 3))) { // || (type >= 10)) { + qDebug() << model << type << series << info.modelnumber << "unsupported"; QMessageBox::information(QApplication::activeWindow(), QObject::tr("Machine Unsupported"), QObject::tr("Sorry, your Philips Respironics CPAP machine (Model %1) is not supported yet.").arg(info.modelnumber) +"\n\n"+ @@ -710,7 +714,7 @@ int PRS1Loader::OpenMachine(const QString & path) } switch (ext) { case 0: - if (task->compliance) continue; + if (task->compliance) continue; // (skipping to avoid duplicates) task->compliance = chunk; break; case 1: @@ -730,9 +734,22 @@ int PRS1Loader::OpenMachine(const QString & path) int tasks = countTasks(); + unknownCodes.clear(); + runTasks(AppSetting->multithreading()); finishAddingSessions(); + if (unknownCodes.size() > 0) { + QMap::iterator it; + for (it = unknownCodes.begin(); it != unknownCodes.end(); ++it) { + qDebug() << QString("Unknown CPAP Codes '0x%1' was detected during import").arg((short)it.key(), 2, 16, QChar(0)); + QStringList & strlist = it.value(); + for (int i=0;iunsupported() ? -1 : tasks; } @@ -743,11 +760,11 @@ bool PRS1Import::ParseF5EventsFV3() EventDataType currentPressure=0, leak; //, p; bool calcLeaks = p_profile->cpap->calculateUnintentionalLeaks(); - float lpm4 = p_profile->cpap->custom4cmH2OLeaks(); - float lpm20 = p_profile->cpap->custom20cmH2OLeaks(); + EventDataType lpm4 = p_profile->cpap->custom4cmH2OLeaks(); + EventDataType lpm20 = p_profile->cpap->custom20cmH2OLeaks(); - float lpm = lpm20 - lpm4; - float ppm = lpm / 16.0; + EventDataType lpm = lpm20 - lpm4; + EventDataType ppm = lpm / 16.0; //qint64 start=timestamp; @@ -993,11 +1010,11 @@ bool PRS1Import::ParseF5Events() EventDataType currentPressure=0, leak; //, p; bool calcLeaks = p_profile->cpap->calculateUnintentionalLeaks(); - float lpm4 = p_profile->cpap->custom4cmH2OLeaks(); - float lpm20 = p_profile->cpap->custom20cmH2OLeaks(); + EventDataType lpm4 = p_profile->cpap->custom4cmH2OLeaks(); + EventDataType lpm20 = p_profile->cpap->custom20cmH2OLeaks(); - float lpm = lpm20 - lpm4; - float ppm = lpm / 16.0; + EventDataType lpm = lpm20 - lpm4; + EventDataType ppm = lpm / 16.0; //qint64 start=timestamp; @@ -1379,6 +1396,169 @@ bool PRS1Import::ParseF5Events() } +bool PRS1Import::ParseF3EventsV3() +{ + // AVAPS machine... it's delta packed, unlike the older ones?? (double check that! :/) + + EventList *PP = session->AddEventList(PRS1_TimedBreath, EVL_Event); + EventList *OA = session->AddEventList(CPAP_Obstructive, EVL_Event); + EventList *HY = session->AddEventList(CPAP_Hypopnea, EVL_Event); + EventList *ZZ = session->AddEventList(CPAP_NRI, EVL_Event); + EventList *Z2 = session->AddEventList(CPAP_ExP, EVL_Event); + EventList *CA = session->AddEventList(CPAP_ClearAirway, EVL_Event); + EventList *PB = session->AddEventList(CPAP_PB, EVL_Event); + EventList *LL = session->AddEventList(CPAP_LargeLeak, EVL_Event); + EventList *RE = session->AddEventList(CPAP_RERA, EVL_Event); + EventList *LEAK = session->AddEventList(CPAP_Leak, EVL_Event); +// EventList *ULK = session->AddEventList(CPAP_Leak, EVL_Event); + + EventList *PTB = session->AddEventList(CPAP_PTB, EVL_Event); + EventList *RR = session->AddEventList(CPAP_RespRate, EVL_Event); + EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event, 10.0); + + EventList *MV = session->AddEventList(CPAP_MinuteVent, EVL_Event); + EventList *TMV = session->AddEventList(CPAP_Test1, EVL_Event); + EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1); + EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1); + EventList *FLOW = session->AddEventList(CPAP_Test2, EVL_Event); + + qint64 t = qint64(event->timestamp) * 1000L, tt; + + int pos = 0; + int datasize = event->m_data.size(); + + unsigned char * data = (unsigned char *)event->m_data.data(); + unsigned char code; + unsigned short delta; + bool failed = false; + + unsigned char val, val1, val2; + QString dump; + + do { + code = data[pos++]; + delta = (data[pos+1] < 8) | data[pos]; + pos += 2; +#ifdef DEBUG_IMPORTER + if (code == 0x02) { + if (!loader->unknownCodes.contains(code)) { + loader->unknownCodes.insert(code, QStringList()); + } + QStringList & str = loader->unknownCodes[code]; + + dump = QString("%1@0x%5: [%2] [%3 %4]") + .arg(session->session(), 8, 16, QChar('0')) + .arg(data[pos-3], 2, 16, QChar('0')) + .arg(data[pos-2], 2, 16, QChar('0')) + .arg(data[pos-1], 2, 16, QChar('0')) + .arg(pos-3, 5, 16, QChar('0')); + + for (int i=0; i<15; i++) { + if ((pos+i) > datasize) break; + dump += QString(" %1").arg(data[pos+i], 2, 16, QChar('0')); + } + str.append(dump.trimmed()); + + } +#endif + unsigned short epap; + + switch(code) { + case 0x01: // Who knows + val = data[pos++]; + PP->AddEvent(t, val); + break; + case 0x02: + LEAK->AddEvent(t, data[pos+3]); + PTB->AddEvent(t, data[pos+5]); + MV->AddEvent(t, data[pos+6]); + TV->AddEvent(t, data[pos+7]); + + + EPAP->AddEvent(t, epap=data[pos+0]); + IPAP->AddEvent(t, data[pos+1]); + FLOW->AddEvent(t, data[pos+4]); + TMV->AddEvent(t, data[pos+8]); + RR->AddEvent(t, data[pos+9]); + pos += 12; + + break; + case 0x04: // ??? + val = data[pos++]; + PP->AddEvent(t, val); + break; + case 0x05: // ??? + val = data[pos++]; + CA->AddEvent(t, val); + break; + case 0x06: // Obstructive Apnea + val = data[pos++]; + val2 = data[pos++]; + OA->AddEvent(t + (qint64(val2)*1000L), val); + break; + case 0x07: // PB + val = data[pos+1] << 8 | data[pos]; + pos += 2; + val2 = data[pos++]; + PB->AddEvent(t - (qint64(val2)*1000L), val); + break; + case 0x08: // RERA + val = data[pos++]; + RE->AddEvent(t, val); + break; + case 0x09: // ??? + val = data[pos+1] << 8 | data[pos]; + pos += 2; + val2 = data[pos++]; + LL->AddEvent(t - (qint64(val)*1000L), val2); + break; + + case 0x0a: // ??? + val = data[pos++]; + ZZ->AddEvent(t, val); + break; + case 0x0b: // Hypopnea + val = data[pos++]; + if (session->session() == 239) { + if (HY->count() == 0) { + qDebug() << t << delta << val << "hypopnea"; + } + } + HY->AddEvent(t, val); + break; + + default: + if (!loader->unknownCodes.contains(code)) { + loader->unknownCodes.insert(code, QStringList()); + } + QStringList & str = loader->unknownCodes[code]; + + dump = QString("%1@0x%5: [%2] [%3 %4]") + .arg(session->session(), 8, 16, QChar('0')) + .arg(data[pos-3], 2, 16, QChar('0')) + .arg(data[pos-2], 2, 16, QChar('0')) + .arg(data[pos-1], 2, 16, QChar('0')) + .arg(pos-3, 5, 16, QChar('0')); + + for (int i=0; i<15; i++) { + if ((pos+i) > datasize) break; + dump += QString(" %1").arg(data[pos+i], 2, 16, QChar('0')); + } + str.append(dump.trimmed()); + + failed = true; + break; + }; + t += qint64(delta) * 1000L; + + } while ((pos < datasize) && !failed); + + if (failed) { + // Clean up this shit... + return false; + } + return true; +} bool PRS1Import::ParseF3Events() { qint64 t = qint64(event->timestamp) * 1000L, tt; @@ -1458,7 +1638,7 @@ bool PRS1Import::ParseF3Events() return true; } -extern float CatmullRomSpline(float p0, float p1, float p2, float p3, float t = 0.5); +extern EventDataType CatmullRomSpline(EventDataType p0, EventDataType p1, EventDataType p2, EventDataType p3, EventDataType t = 0.5); void SmoothEventList(Session * session, EventList * ev, ChannelID code) { @@ -1470,7 +1650,7 @@ void SmoothEventList(Session * session, EventList * ev, ChannelID code) smooth->setFirst(ev->first()); smooth->AddEvent(ev->time(0), ev->raw(0)); - float p0, p1, p2, p3, v; + EventDataType p0, p1, p2, p3, v; for (int i=1; itime(i); qint64 time2 = ev->time(i+1); @@ -1570,11 +1750,11 @@ bool PRS1Import::ParseF0Events() EventDataType currentPressure=0, leak; //, p; bool calcLeaks = p_profile->cpap->calculateUnintentionalLeaks(); - float lpm4 = p_profile->cpap->custom4cmH2OLeaks(); - float lpm20 = p_profile->cpap->custom20cmH2OLeaks(); + EventDataType lpm4 = p_profile->cpap->custom4cmH2OLeaks(); + EventDataType lpm20 = p_profile->cpap->custom20cmH2OLeaks(); - float lpm = lpm20 - lpm4; - float ppm = lpm / 16.0; + EventDataType lpm = lpm20 - lpm4; + EventDataType ppm = lpm / 16.0; CPAPMode mode = (CPAPMode) session->settings[CPAP_Mode].toInt(); @@ -1889,14 +2069,14 @@ bool PRS1Import::ParseCompliance() session->settings[CPAP_Mode] = (int)MODE_CPAP; - EventDataType min_pressure = float(data[0x03]) / 10.0; - // EventDataType max_pressure = float(data[0x04]) / 10.0; + EventDataType min_pressure = EventDataType(data[0x03]) / 10.0; + // EventDataType max_pressure = EventDataType(data[0x04]) / 10.0; session->settings[CPAP_Pressure] = min_pressure; int ramp_time = data[0x06]; - EventDataType ramp_pressure = float(data[0x07]) / 10.0; + EventDataType ramp_pressure = EventDataType(data[0x07]) / 10.0; session->settings[CPAP_RampTime] = (int)ramp_time; session->settings[CPAP_RampPressure] = ramp_pressure; @@ -1994,9 +2174,9 @@ bool PRS1Import::ParseSummaryF0() cpapmode = MODE_BILEVEL_AUTO_VARIABLE_PS; } - EventDataType min_pressure = float(data[0x03]) / 10.0; - EventDataType max_pressure = float(data[0x04]) / 10.0; - EventDataType ps = float(data[0x05]) / 10.0; // pressure support + EventDataType min_pressure = EventDataType(data[0x03]) / 10.0; + EventDataType max_pressure = EventDataType(data[0x04]) / 10.0; + EventDataType ps = EventDataType(data[0x05]) / 10.0; // pressure support if (cpapmode == MODE_CPAP) { session->settings[CPAP_Pressure] = min_pressure; @@ -2020,7 +2200,7 @@ bool PRS1Import::ParseSummaryF0() int ramp_time = data[0x06]; - EventDataType ramp_pressure = float(data[0x07]) / 10.0; + EventDataType ramp_pressure = EventDataType(data[0x07]) / 10.0; session->settings[CPAP_RampTime] = (int)ramp_time; session->settings[CPAP_RampPressure] = ramp_pressure; @@ -2108,10 +2288,10 @@ bool PRS1Import::ParseSummaryF0V4() } - EventDataType min_pressure = float(data[0x03]) / 10.0; - EventDataType max_pressure = float(data[0x04]) / 10.0; - EventDataType min_ps = float(data[0x05]) / 10.0; // pressure support - EventDataType max_ps = float(data[0x06]) / 10.0; // pressure support + EventDataType min_pressure = EventDataType(data[0x03]) / 10.0; + EventDataType max_pressure = EventDataType(data[0x04]) / 10.0; + EventDataType min_ps = EventDataType(data[0x05]) / 10.0; // pressure support + EventDataType max_ps = EventDataType(data[0x06]) / 10.0; // pressure support if (cpapmode == MODE_CPAP) { session->settings[CPAP_Pressure] = min_pressure; @@ -2159,7 +2339,7 @@ bool PRS1Import::ParseSummaryF0V4() } else flexmode = FLEX_None; int ramp_time = data[0x08]; - EventDataType ramp_pressure = float(data[0x09]) / 10.0; + EventDataType ramp_pressure = EventDataType(data[0x09]) / 10.0; session->settings[CPAP_RampTime] = (int)ramp_time; session->settings[CPAP_RampPressure] = ramp_pressure; @@ -2180,25 +2360,153 @@ bool PRS1Import::ParseSummaryF0V4() bool PRS1Import::ParseSummaryF3() { + const unsigned char * data = (unsigned char *)summary->m_data.constData(); - if (data[0x00] > 0) { + int size = summary->m_data.size(); + if (session->session() > 0xae) { + +// event->m_headerblock. + + qDebug() << "Dumping session" << (int)session->session() << "summary file"; + QString hexstr = QString("%1@0000: ").arg(session->session(),8,16,QChar('0')); + + for (int i=0; isession(),8,16,QChar('0')).arg(i+1, 4, 16, QChar('0')); + } + } + + } + + int pos = 0; + if (data[pos++] != 0) { + qDebug() << "Non zero hblock[0] indicator"; return false; } + pos += summary->hblock[0]; + + QString str; + + unsigned char code; + unsigned char length; + qint64 duration = 0; + + if (!summary->hblock.contains(1) || (data[pos++] != 1)) { + qDebug() << session->session() << "Missing hblock 1 data"; + return false; + } + int hBlockSize = summary->hblock[1]; + + EventDataType min_pressure, max_pressure, imin_epap, imin_ps, imax_ps; + CPAPMode cpapmode = MODE_UNKNOWN; + + do { + code = data[pos++]; + length = data[pos++]; + switch(code) { + case 10: // 0x0a + cpapmode = MODE_CPAP; + if (length != 1) qDebug() << "PRS1Loader::ParseSummaryF3" << "Bad CPAP value"; + imin_epap = data[pos]; + break; + case 13: // 0x0d + cpapmode = MODE_APAP; + if (length != 2) qDebug() << "PRS1Loader::ParseSummaryF3" << "Bad APAP value"; + min_pressure = data[pos]; + max_pressure = data[pos+1]; + break; + case 14: // 0x0e // <--- this is a total guess.. might be 3 and have a pressure support value + cpapmode = MODE_BILEVEL_FIXED; + if (length != 2) qDebug() << "PRS1Loader::ParseSummaryF3" << "Bad APAP value"; + min_pressure = data[pos]; + max_pressure = data[pos+1]; + imin_ps = max_pressure - min_pressure; + break; + case 15: // 0x0f + cpapmode = MODE_BILEVEL_AUTO_VARIABLE_PS; //might be C_CHECK? + if (length != 4) qDebug() << "PRS1Loader::ParseSummaryF3" << "Bad APAP value"; + min_pressure = data[pos+0]; + max_pressure = data[pos+1]; + imin_ps = data[pos+2]; + imax_ps = data[pos+3]; + break; + case 0x10: // Auto Trial mode + cpapmode = MODE_APAP; + if (length != 3) qDebug() << "PRS1Loader::ParseSummaryF3" << "Bad APAP value"; + min_pressure = data[pos+0]; + max_pressure = data[pos+1]; + break; + + /*case 0x35: + duration = ( data[pos+1] << 8 ) + data[pos+0]; + break;*/ + + default: + str = QString("%1: [%2] [%3]") + .arg(session->session(), 8, 16, QChar('0')) + .arg(code, 2, 16, QChar('0')) + .arg(length, 2, 16, QChar('0')); + + for (int i=0;ihblock.contains(2) || (data[pos++] != 2)) { + qDebug() << session->session() << "Missing hblock 2 data"; + return false; + } + pos += summary->hblock[2]; + + if (!summary->hblock.contains(3)) { + qDebug() << session->session() << "Missing hblock 3 data"; + return false; + } + hBlockSize = summary->hblock[3]; + + int len = data[pos++]; + pos+=len; + if (data[pos++] != 5) { + qDebug() << "Expected length after 0x05" << session->session(); + return false; + } + + duration = ( data[pos+1] << 8 ) + data[pos+0]; + session->set_first(qint64(summary->timestamp) * 1000L); - summary_duration = data[0x23] | data[0x24] << 8; + //session->set_last(session->first() + (duration * 1000L)); - EventDataType epap = data[0x04] | (data[0x05] << 8); - EventDataType ipap = data[0x06] | (data[0x07] << 8); - // why is there another high setting? + summary_duration = duration; + session->settings[CPAP_Mode] = (int)cpapmode; + if (cpapmode == MODE_CPAP) { + session->settings[CPAP_Pressure] = imin_epap/10.0f; - session->settings[CPAP_EPAP] = epap/10.0; - session->settings[CPAP_IPAP] = ipap/10.0; - session->settings[CPAP_Mode] = (CPAPMode)MODE_AVAPS; + } else if (cpapmode == MODE_APAP) { + session->settings[CPAP_PressureMin] = min_pressure/10.0f; + session->settings[CPAP_PressureMax] = max_pressure/10.0f; + } else if (cpapmode == MODE_BILEVEL_FIXED) { + // Guessing here.. haven't seen BIPAP data. + session->settings[CPAP_EPAP] = min_pressure/10.0f; + session->settings[CPAP_IPAP] = max_pressure/10.0f; + session->settings[CPAP_PS] = imin_ps/10.0f; + } else if (cpapmode == MODE_BILEVEL_AUTO_VARIABLE_PS) { + session->settings[CPAP_EPAPLo] = min_pressure/10.0f; + session->settings[CPAP_IPAPHi] = max_pressure/10.0f; + session->settings[CPAP_PSMin] = imin_ps/10.0f; + session->settings[CPAP_PSMax] = imax_ps/10.0f; - -// EventDataType f1 = data[0x08] | (data[0x09] << 8); + } return true; } @@ -2275,7 +2583,7 @@ bool PRS1Import::ParseSummaryF5V0() int ramp_time = data[0x0a]; - EventDataType ramp_pressure = float(data[0x0b]) / 10.0; + EventDataType ramp_pressure = EventDataType(data[0x0b]) / 10.0; session->settings[CPAP_RampTime] = (int)ramp_time; session->settings[CPAP_RampPressure] = ramp_pressure; @@ -2361,7 +2669,7 @@ bool PRS1Import::ParseSummaryF5V1() int ramp_time = data[0x0a]; - EventDataType ramp_pressure = float(data[0x0b]) / 10.0; + EventDataType ramp_pressure = EventDataType(data[0x0b]) / 10.0; session->settings[CPAP_RampTime] = (int)ramp_time; session->settings[CPAP_RampPressure] = ramp_pressure; @@ -2439,7 +2747,6 @@ bool PRS1Import::ParseSummaryF0V6() // first, verify that this dataSize is where we expect // each var pair in headerblock should be (indexByte, valueByte) - // MW: sorry Bob, that LValue/RValue inversion thing while an effective way to force type conversion gave me an anuerism ;) if ((int)summary->m_headerblock[(1 * 2)] != 0x01) { return false; //nope, not here qDebug() << "PRS1Loader::ParseSummaryF0V6=" << "Bad datablock length"; @@ -2668,7 +2975,11 @@ bool PRS1Import::ParseEvents() res = ParseF0Events(); break; case 3: - res = ParseF3Events(); + if (event->fileVersion == 3) { + res = ParseF3EventsV3(); + } else { + res = ParseF3Events(); + } break; case 5: if (event->fileVersion==3) { @@ -2849,9 +3160,18 @@ void PRS1Import::run() if ((compliance && ParseCompliance()) || (summary && ParseSummary())) { if (event && !ParseEvents()) { } + + // Parse .005 Waveform file waveforms = loader->ParseFile(wavefile); + if (session->eventlist.contains(CPAP_FlowRate)) { + if (waveforms.size() > 0) { + // Delete anything called "Flow rate" picked up in the events file if real data is present + session->destroyEvent(CPAP_FlowRate); + } + } ParseWaveforms(); + // Parse .006 Waveform file oximetery = loader->ParseFile(oxifile); ParseOximetery(); @@ -2958,10 +3278,10 @@ QList PRS1Loader::ParseFile(const QString & path) waveformInfo.clear(); + bool hasHeaderDataBlock = (fileVersion == 3); if (ext < 5) { // Not a waveform chunk // Check if this is a newer machine with a header data block - bool hasHeaderDataBlock = (fileVersion == 3); if (hasHeaderDataBlock) { // This is a new machine, byte 15 is header data block length @@ -2975,6 +3295,7 @@ QList PRS1Loader::ParseFile(const QString & path) if (headerB2.size() != hdb_size+1) { break; } + headerBA.append(headerB2); header = (unsigned char *)headerBA.data(); // important because it's memory location could move @@ -3073,6 +3394,15 @@ QList PRS1Loader::ParseFile(const QString & path) chunk->familyVersion = familyVersion; chunk->ext = ext; chunk->timestamp = timestamp; + if (hasHeaderDataBlock) { + const unsigned char * hd = (unsigned char *)headerB2.constData(); + int pos = 0; + int recs = header[15]; + for (int i=0; ihblock[hd[pos]] = hd[pos+1]; + pos += 2; + } + } chunk->m_headerblock = headerB2; lastblocksize = blocksize; @@ -3139,31 +3469,6 @@ QList PRS1Loader::ParseFile(const QString & path) lastchunk = chunk; cnt++; - // FamilyVersion, Family - - // FV2,F0 .001 16 byte header (550P) - // FV2,F0 .002 16 byte header (550P) - - // FV4,F0 .001 16 byte header (560) - // FV4,F0 .002 16 byte header (560) - - // FV0,F5 .001 16 byte header (950) - // FV0,F5 .002 16 byte header (950) - - // FV2,F5 .001 16 byte header (960) - // FV2,F5 .002 16 byte header (960) - - // FV3,F3 .001 16 byte header (1160) - // FV3,F3 .002 62 byte header (1160) - - // FV3,F5 .001 have a 24 byte header (ASV) - // FV3,F5 .002 have a 48 byte header (ASV) - - - - - - } while (!f.atEnd()); return CHUNKS; diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h index 66ac3b9d..9acec3bb 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h @@ -85,6 +85,7 @@ public: quint16 duration; QList waveformInfo; + QHash hblock; }; class PRS1Loader; @@ -157,6 +158,8 @@ public: bool ParseF0Events(); //! \brief Parse a single data chunk from a .002 file containing event data for a AVAPS 1060P machine bool ParseF3Events(); + //! \brief Parse a single data chunk from a .002 file containing event data for a AVAPS 1060P machine file version 3 + bool ParseF3EventsV3(); //! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV machine (which has a different format) bool ParseF5Events(); //! \brief Parse a single data chunk from a .002 file containing event data for a family 5 ASV file version 3 machine (which has a different format again) @@ -230,6 +233,7 @@ class PRS1Loader : public CPAPLoader QHash sesstasks; + QMap unknownCodes; protected: QString last; diff --git a/sleepyhead/SleepLib/preferences.cpp b/sleepyhead/SleepLib/preferences.cpp index 574cbaed..24486b29 100644 --- a/sleepyhead/SleepLib/preferences.cpp +++ b/sleepyhead/SleepLib/preferences.cpp @@ -16,7 +16,8 @@ #include #include #include -#ifdef Q_OS_WIN32 + +#ifdef Q_OS_WIN #include "windows.h" #include "lmcons.h" #endif @@ -32,7 +33,7 @@ const QString &getUserName() if (userName.isEmpty()) { userName = QObject::tr("Windows User"); -#if defined (Q_OS_WIN32) +#if defined (Q_OS_WIN) #if defined(UNICODE) if (QSysInfo::WindowsVersion >= QSysInfo::WV_NT) { @@ -62,12 +63,7 @@ QString GetAppRoot() QString HomeAppRoot = settings.value("Settings/AppRoot").toString(); -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - const QString desktopFolder = QDesktopServices::storageLocation( - QDesktopServices::DocumentsLocation); -#else const QString desktopFolder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); -#endif if (HomeAppRoot.isEmpty()) { HomeAppRoot = desktopFolder + "/" + getDefaultAppRoot(); diff --git a/sleepyhead/UpdaterWindow.cpp b/sleepyhead/UpdaterWindow.cpp index c7b77709..becf0bd1 100644 --- a/sleepyhead/UpdaterWindow.cpp +++ b/sleepyhead/UpdaterWindow.cpp @@ -92,7 +92,7 @@ void UpdaterWindow::checkForUpdates() { QString platform=platformStr(); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QString filename = QApplication::applicationDirPath() + "/Updates.xml"; #else QString filename = QApplication::applicationDirPath() + QString("/LatestVersion-%1").arg(platform); @@ -106,7 +106,7 @@ void UpdaterWindow::checkForUpdates() if (age < 900) { QFile file(filename); file.open(QFile::ReadOnly); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN ParseUpdatesXML(&file); #else ParseLatestVersion(&file); @@ -118,7 +118,7 @@ void UpdaterWindow::checkForUpdates() mainwin->Notify(tr("Checking for SleepyHead Updates")); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN update_url = QUrl(QString("http://sleepyhead.jedimark.net/packages/%1/Updates.xml").arg(platform)); #else update_url = QUrl(QString("http://sleepyhead.jedimark.net/releases/LatestVersion-%1").arg(platform)); @@ -160,7 +160,7 @@ void UpdaterWindow::updateFinished(QNetworkReply *reply) ui->plainTextEdit->appendPlainText(tr("%1 bytes received").arg(reply->size())); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QString filename = QApplication::applicationDirPath() + "/Updates.xml"; #else QString filename = QApplication::applicationDirPath() + QString("/LatestVersion-%1").arg(platformStr()); @@ -173,7 +173,7 @@ void UpdaterWindow::updateFinished(QNetworkReply *reply) file.close(); file.open(QFile::ReadOnly); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN ParseUpdatesXML(&file); #else ParseLatestVersion(&file); @@ -427,7 +427,7 @@ void StartMaintenanceTool() { QString mt_path = QApplication::applicationDirPath()+"/MaintenanceTool.exe"; SpawnApp(mt_path); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN #endif } diff --git a/sleepyhead/common_gui.cpp b/sleepyhead/common_gui.cpp index de2b698d..ee63a03d 100644 --- a/sleepyhead/common_gui.cpp +++ b/sleepyhead/common_gui.cpp @@ -87,53 +87,10 @@ QString getBranchVersion() } -#if (QT_VERSION >= QT_VERSION_CHECK(4,8,0)) -// Qt 4.8 makes this a whole lot easier Qt::DayOfWeek firstDayOfWeekFromLocale() { return QLocale::system().firstDayOfWeek(); } -#elif defined(__GLIBC__) -# include -Qt::DayOfWeek firstDayOfWeekFromLocale() -{ - const unsigned char *const s = nl_langinfo(_NL_TIME_FIRST_WEEKDAY); - - if (s && *s >= 1 && *s <= 7) { - // Map between nl_langinfo and Qt: - // Sun Mon Tue Wed Thu Fri Sat - // nl_langinfo: 1 2 3 4 5 6 7 - // DayOfWeek: 7 1 2 3 4 5 6 - return (Qt::DayOfWeek)((*s + 5) % 7 + 1); - } - - return Qt::Monday; -} -#elif defined(Q_OS_WIN) -# include "windows.h" -Qt::DayOfWeek firstDayOfWeekFromLocale() -{ - Qt::DayOfWeek firstDay = Qt::Monday; // Fallback, acknowledging the awesome concept of weekends. - WCHAR wsDay[4]; -# if defined(_WIN32_WINNT_VISTA) && WINVER >= _WIN32_WINNT_VISTA && defined(LOCALE_NAME_USER_DEFAULT) - - if (GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, wsDay, 4)) { -# else - - if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, wsDay, 4)) { -# endif - bool ok; - int wfd = QString::fromWCharArray(wsDay).toInt(&ok) + 1; - - if (ok) { - return (Qt::DayOfWeek)(unsigned char)wfd; - } - } - - return firstDay; -} - -#endif // QT_VERSION // Flag Colors QColor COLOR_Hypopnea = Qt::blue; diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index 5c8e5425..01e910c5 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -1,4 +1,4 @@ -/* Daily Panel +/* Daily Panel * * Copyright (c) 2011-2018 Mark Watkins * @@ -300,20 +300,21 @@ Daily::Daily(QWidget *parent,gGraphView * shared) graphlist[schema::channel[CPAP_Snore].code()]->AddLayer(new gLineChart(CPAP_Snore, true)); graphlist[schema::channel[CPAP_PTB].code()]->AddLayer(new gLineChart(CPAP_PTB, square)); - graphlist[schema::channel[CPAP_Test1].code()]->AddLayer(new gLineChart(CPAP_Test1, false)); + graphlist[schema::channel[CPAP_Test1].code()]->AddLayer(new gLineChart(CPAP_Test1, square)); + //graphlist[schema::channel[CPAP_Test2].code()]->AddLayer(new gLineChart(CPAP_Test2, square)); gLineChart *lc = nullptr; graphlist[schema::channel[CPAP_MaskPressure].code()]->AddLayer(new gLineChart(CPAP_MaskPressure, false)); - graphlist[schema::channel[CPAP_RespRate].code()]->AddLayer(lc=new gLineChart(CPAP_RespRate, false)); + graphlist[schema::channel[CPAP_RespRate].code()]->AddLayer(lc=new gLineChart(CPAP_RespRate, square)); graphlist[schema::channel[POS_Inclination].code()]->AddLayer(new gLineChart(POS_Inclination)); graphlist[schema::channel[POS_Orientation].code()]->AddLayer(new gLineChart(POS_Orientation)); - graphlist[schema::channel[CPAP_MinuteVent].code()]->AddLayer(lc=new gLineChart(CPAP_MinuteVent, false)); + graphlist[schema::channel[CPAP_MinuteVent].code()]->AddLayer(lc=new gLineChart(CPAP_MinuteVent, square)); lc->addPlot(CPAP_TgMV, square); - graphlist[schema::channel[CPAP_TidalVolume].code()]->AddLayer(lc=new gLineChart(CPAP_TidalVolume, false)); + graphlist[schema::channel[CPAP_TidalVolume].code()]->AddLayer(lc=new gLineChart(CPAP_TidalVolume, square)); //lc->addPlot(CPAP_Test2,COLOR_DarkYellow,square); //graphlist[schema::channel[CPAP_TidalVolume].code()]->AddLayer(AddCPAP(new gLineChart("TidalVolume2", square))); diff --git a/sleepyhead/logger.cpp b/sleepyhead/logger.cpp index 73375b18..990d18be 100644 --- a/sleepyhead/logger.cpp +++ b/sleepyhead/logger.cpp @@ -8,6 +8,8 @@ #include "logger.h" +#define ASSERTS_SUCK + QThreadPool * otherThreadPool = NULL; void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msgtxt) @@ -45,9 +47,11 @@ void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QS if (logger && logger->isRunning()) { logger->append(msg); } - else { +#ifdef ASSERTS_SUCK +// else { fprintf(stderr, "%s\n", msg.toLocal8Bit().data()); - } +// } +#endif if (type == QtFatalMsg) { abort(); @@ -60,11 +64,7 @@ void initializeLogger() logger = new LogThread(); otherThreadPool = new QThreadPool(); bool b = otherThreadPool->tryStart(logger); -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) qInstallMessageHandler(MyOutputHandler); -#else - qInstallMsgHandler(MyOutputHandler); -#endif if (b) { qWarning() << "Started logging thread"; } else { diff --git a/sleepyhead/logger.h b/sleepyhead/logger.h index 0ae287b6..20cbd609 100644 --- a/sleepyhead/logger.h +++ b/sleepyhead/logger.h @@ -1,4 +1,4 @@ -#ifndef LOGGER_H +#ifndef LOGGER_H #define LOGGER_H #include @@ -10,11 +10,7 @@ void initializeLogger(); void shutdownLogger(); -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) -void MyOutputHandler(QtMsgType type, const char *msgtxt); -#else void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QString &msgtxt); -#endif class LogThread:public QObject, public QRunnable { diff --git a/sleepyhead/main.cpp b/sleepyhead/main.cpp index eb5ee953..a13a40f1 100644 --- a/sleepyhead/main.cpp +++ b/sleepyhead/main.cpp @@ -139,7 +139,7 @@ void release_notes() void sDelay(int s) { // QThread::msleep() is exposed in Qt5 -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN Sleep(s * 1000); #else sleep(s); @@ -179,10 +179,6 @@ int main(int argc, char *argv[]) XInitThreads(); #endif -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - QGL::setPreferredPaintEngine(QPaintEngine::OpenGL); -#endif - bool dont_load_profile = false; bool force_data_dir = false; bool changing_language = false; diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 3065f99e..78724d3d 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -92,10 +92,6 @@ MainWindow::MainWindow(QWidget *parent) : ui->action_About->setMenuRole(QAction::ApplicationSpecificRole); ui->action_Preferences->setMenuRole(QAction::ApplicationSpecificRole); ui->action_Exit->setMenuRole(QAction::ApplicationSpecificRole); -#if(QT_VERSIONaction_Screenshot->setEnabled(false); -#endif #endif ui->actionToggle_Line_Cursor->setChecked(AppSetting->lineCursorMode()); @@ -891,11 +887,7 @@ void MainWindow::on_action_Import_Data_triggered() if (p_profile->contains(STR_PREF_LastCPAPPath)) { folder = (*p_profile)[STR_PREF_LastCPAPPath].toString(); } else { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - folder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); -#else folder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); -#endif } w.setDirectory(folder); @@ -905,12 +897,7 @@ void MainWindow::on_action_Import_Data_triggered() // This doesn't work on WinXP #if defined(Q_OS_MAC) -#if (QT_VERSION < QT_VERSION_CHECK(4,8,0)) - // Fix for tetragon, 10.6 barfs up Qt's custom dialog - w.setOption(QFileDialog::DontUseNativeDialog, true); -#else w.setOption(QFileDialog::DontUseNativeDialog,false); -#endif // version check #elif defined(Q_OS_UNIX) w.setOption(QFileDialog::DontUseNativeDialog,false); @@ -1487,7 +1474,7 @@ void MainWindow::DelayedScreenshot() h /= pr; #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_HAIKU) +#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_HAIKU) Q_UNUSED(w) Q_UNUSED(h) //QRect rec = QApplication::desktop()->screenGeometry(); @@ -1533,14 +1520,6 @@ void MainWindow::updatestatusBarMessage(const QString &text) void MainWindow::on_actionPrint_Report_triggered() { -#ifdef Q_WS_MAC -#if ((QT_VERSION <= QT_VERSION_CHECK(4, 8, 4))) - QMessageBox::information(this, tr("Printing Disabled"), - tr("Please rebuild SleepyHead with Qt 4.8.5 or greater, as printing causes a crash with this version of Qt"), - QMessageBox::Ok); - return; -#endif -#endif Report report; if (ui->tabWidget->currentWidget() == overview) { @@ -1583,8 +1562,6 @@ void MainWindow::on_actionPrint_Report_triggered() } } - - //QMessageBox::information(this,tr("Not supported Yet"),tr("Sorry, printing from this page is not supported yet"),QMessageBox::Ok); } } @@ -2689,11 +2666,9 @@ void MainWindow::on_actionDaily_Calendar_toggled(bool visible) void MainWindow::on_actionExport_Journal_triggered() { QString folder; -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - folder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); -#else + folder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); -#endif + folder += QDir::separator() + tr("%1's Journal").arg(p_profile->user->userName()) + ".xml"; QString filename = QFileDialog::getSaveFileName(this, tr("Choose where to save journal"), folder, tr("XML Files (*.xml)")); diff --git a/sleepyhead/oximeterimport.cpp b/sleepyhead/oximeterimport.cpp index 51721d98..5a0dd79f 100644 --- a/sleepyhead/oximeterimport.cpp +++ b/sleepyhead/oximeterimport.cpp @@ -400,11 +400,7 @@ void OximeterImport::doUpdateProgress(int v, int t) void OximeterImport::on_fileImportButton_clicked() { -#if QT_VERSION < QT_VERSION_CHECK(5,0,0) - const QString documentsFolder = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); -#else - const QString documentsFolder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); -#endif + const QString documentsFolder = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); qDebug() << "File Import button clicked"; @@ -413,8 +409,6 @@ void OximeterImport::on_fileImportButton_clicked() if (filename.isEmpty()) return; - - // Make sure filename dialog had time to close properly.. QApplication::processEvents(); diff --git a/sleepyhead/reports.cpp b/sleepyhead/reports.cpp index 935722e0..9ca0c783 100644 --- a/sleepyhead/reports.cpp +++ b/sleepyhead/reports.cpp @@ -1,4 +1,4 @@ -/* Reports/Printing Module +/* Reports/Printing Module * * Copyright (c) 2011-2018 Mark Watkins * @@ -605,11 +605,7 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date) if (!pm.isNull()) { -#if QT_VERSION >= QT_VERSION_CHECK(5,0,0) painter.drawImage(QRect(0, top, pm.width(), pm.height()), pm); -#else - painter.drawImage(0, top, pm); -#endif //painter.drawImage(0,top,virt_width,full_graph_height-normal_height,pm); } diff --git a/sleepyhead/version.h b/sleepyhead/version.h index 6ff8fc65..74fb8bd9 100644 --- a/sleepyhead/version.h +++ b/sleepyhead/version.h @@ -1,4 +1,4 @@ -/* Version.h +/* Version.h * * Copyright (c) 2011-2018 Mark Watkins * @@ -23,6 +23,8 @@ const QString VersionString = QString("%1.%2.%3-%4-%5").arg(major_version).arg(m const QString PlatformString = "MacOSX"; #elif defined(Q_OS_WIN32) const QString PlatformString = "Win32"; +#elif defined(Q_OS_WIN64) +const QString PlatformString = "Win64"; #elif defined(Q_OS_LINUX) const QString PlatformString = "Linux"; #elif defined(Q_OS_HAIKU)