From ffeb0149c0de5f5a93395d537d41fb47aa667632 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 2 Oct 2014 17:56:57 +1000 Subject: [PATCH 1/3] Windows build fixes, bump build number --- sleepyhead/Graphs/gFlagsLine.cpp | 2 +- sleepyhead/Graphs/gGraph.cpp | 14 ++++---- sleepyhead/Graphs/gGraphView.cpp | 6 ++-- sleepyhead/Graphs/gLineOverlay.cpp | 2 +- sleepyhead/Graphs/gSessionTimesChart.cpp | 14 ++++---- sleepyhead/Graphs/gSummaryChart.cpp | 2 +- sleepyhead/Graphs/gXAxis.cpp | 2 +- sleepyhead/SleepLib/common.h | 8 ++--- sleepyhead/SleepLib/day.cpp | 2 +- .../SleepLib/loader_plugins/cms50_loader.cpp | 2 ++ .../loader_plugins/intellipap_loader.cpp | 4 +-- sleepyhead/SleepLib/machine.cpp | 3 -- sleepyhead/SleepLib/session.cpp | 2 +- sleepyhead/build_number.h | 2 +- sleepyhead/docs/changelog.txt | 1 - sleepyhead/docs/release_notes.html | 35 +++++++++++++------ sleepyhead/scripts/build_number | 1 + 17 files changed, 57 insertions(+), 45 deletions(-) diff --git a/sleepyhead/Graphs/gFlagsLine.cpp b/sleepyhead/Graphs/gFlagsLine.cpp index a95867c4..5d212c86 100644 --- a/sleepyhead/Graphs/gFlagsLine.cpp +++ b/sleepyhead/Graphs/gFlagsLine.cpp @@ -176,7 +176,7 @@ void gFlagsGroup::paint(QPainter &painter, gGraph &g, const QRegion ®ion) QColor barcol; for (int i = 0; i < visflags.size(); i++) { - schema::Channel & chan = schema::channel[visflags.at(i)->code()]; + //schema::Channel & chan = schema::channel[visflags.at(i)->code()]; // Alternating box color if (i & 1) { barcol = COLOR_ALT_BG1; } diff --git a/sleepyhead/Graphs/gGraph.cpp b/sleepyhead/Graphs/gGraph.cpp index 08b381d6..408cbfa3 100644 --- a/sleepyhead/Graphs/gGraph.cpp +++ b/sleepyhead/Graphs/gGraph.cpp @@ -482,11 +482,11 @@ QPixmap gGraph::renderPixmap(int w, int h, bool printing) fa.setPixelSize(28); fb.setPixelSize(32); fc.setPixelSize(70); - graphView()->setPrintScaleX(2.5); - graphView()->setPrintScaleY(2.2); + graphView()->setPrintScaleX(2.5f); + graphView()->setPrintScaleY(2.2f); } else { - graphView()->setPrintScaleX(1); - graphView()->setPrintScaleY(1); + graphView()->setPrintScaleX(1.0f); + graphView()->setPrintScaleY(1.0f); } defaultfont = &fa; @@ -1415,9 +1415,9 @@ int gGraph::minHeight() { int minheight = m_min_height; - int top = 0; - int center = 0; - int bottom = 0; +// int top = 0; +// int center = 0; +// int bottom = 0; for (int i=0; iminimumHeight(); mh += m_margintop + m_marginbottom; diff --git a/sleepyhead/Graphs/gGraphView.cpp b/sleepyhead/Graphs/gGraphView.cpp index db403253..19a8f030 100644 --- a/sleepyhead/Graphs/gGraphView.cpp +++ b/sleepyhead/Graphs/gGraphView.cpp @@ -1712,7 +1712,7 @@ class MyWidgetAction : public QWidgetAction public: MyWidgetAction(ChannelID code, QObject * parent = nullptr) :QWidgetAction(parent), code(code) { chbox = nullptr; } protected: - virtual QWidget * createWidget(QWidget * parent) { + virtual QWidget * createWidget(QWidget * /*parent*/) { connect(chbox, SIGNAL(toggled(bool)), this, SLOT(setChecked(bool))); connect(chbox, SIGNAL(clicked()), this, SLOT(trigger())); @@ -2793,7 +2793,7 @@ void gGraphView::wheelEvent(QWheelEvent *event) gGraph *graph = nullptr; int group = 0; - int x = event->x(); + //int x = event->x(); int y = event->y(); float h, py = 0, pinned_height = 0; @@ -2982,7 +2982,7 @@ void gGraphView::keyPressEvent(QKeyEvent *event) } if ((m_metaselect) && (event->key() >= Qt::Key_0) && (event->key() <= Qt::Key_9)) { - int bk = (int)event->key()-Qt::Key_0; + //int bk = (int)event->key()-Qt::Key_0; m_metaselect = false; timedRedraw(0); diff --git a/sleepyhead/Graphs/gLineOverlay.cpp b/sleepyhead/Graphs/gLineOverlay.cpp index 91df3184..dedba2c7 100644 --- a/sleepyhead/Graphs/gLineOverlay.cpp +++ b/sleepyhead/Graphs/gLineOverlay.cpp @@ -41,7 +41,7 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) int start_py = topp; double xx = w.max_x - w.min_x; - double yy = w.max_y - w.min_y; + //double yy = w.max_y - w.min_y; double jj = double(width) / double(xx); diff --git a/sleepyhead/Graphs/gSessionTimesChart.cpp b/sleepyhead/Graphs/gSessionTimesChart.cpp index ce009e62..edf7a028 100644 --- a/sleepyhead/Graphs/gSessionTimesChart.cpp +++ b/sleepyhead/Graphs/gSessionTimesChart.cpp @@ -43,10 +43,10 @@ gSummaryChart::gSummaryChart(ChannelID code, MachineType machtype) tz_hours = tz_offset / 3600.0; expected_slices = 5; - addCalc(code, ST_MIN, brighten(schema::channel[code].defaultColor() ,0.60)); - addCalc(code, ST_MID, brighten(schema::channel[code].defaultColor() ,1.20)); - addCalc(code, ST_90P, brighten(schema::channel[code].defaultColor() ,1.70)); - addCalc(code, ST_MAX, brighten(schema::channel[code].defaultColor() ,2.30)); + addCalc(code, ST_MIN, brighten(schema::channel[code].defaultColor() ,0.60f)); + addCalc(code, ST_MID, brighten(schema::channel[code].defaultColor() ,1.20f)); + addCalc(code, ST_90P, brighten(schema::channel[code].defaultColor() ,1.70f)); + addCalc(code, ST_MAX, brighten(schema::channel[code].defaultColor() ,2.30f)); } gSummaryChart::~gSummaryChart() @@ -1284,7 +1284,7 @@ gPressureChart::gPressureChart() // Do not reorder these!!! :P addCalc(CPAP_Pressure, ST_SETMAX, schema::channel[CPAP_Pressure].defaultColor()); // 00 addCalc(CPAP_Pressure, ST_MID, schema::channel[CPAP_Pressure].defaultColor()); // 01 - addCalc(CPAP_Pressure, ST_90P, brighten(schema::channel[CPAP_Pressure].defaultColor(), 1.33)); // 02 + addCalc(CPAP_Pressure, ST_90P, brighten(schema::channel[CPAP_Pressure].defaultColor(), 1.33f)); // 02 addCalc(CPAP_PressureMin, ST_SETMIN, schema::channel[CPAP_PressureMin].defaultColor()); // 03 addCalc(CPAP_PressureMax, ST_SETMAX, schema::channel[CPAP_PressureMax].defaultColor()); // 04 @@ -1294,9 +1294,9 @@ gPressureChart::gPressureChart() addCalc(CPAP_IPAPHi, ST_SETMAX, schema::channel[CPAP_IPAPHi].defaultColor()); // 08 addCalc(CPAP_EPAP, ST_MID, schema::channel[CPAP_EPAP].defaultColor()); // 09 - addCalc(CPAP_EPAP, ST_90P, brighten(schema::channel[CPAP_EPAP].defaultColor(),1.33)); // 10 + addCalc(CPAP_EPAP, ST_90P, brighten(schema::channel[CPAP_EPAP].defaultColor(),1.33f)); // 10 addCalc(CPAP_IPAP, ST_MID, schema::channel[CPAP_IPAP].defaultColor()); // 11 - addCalc(CPAP_IPAP, ST_90P, brighten(schema::channel[CPAP_IPAP].defaultColor(),1.33)); // 12 + addCalc(CPAP_IPAP, ST_90P, brighten(schema::channel[CPAP_IPAP].defaultColor(),1.33f)); // 12 } void gPressureChart::afterDraw(QPainter &, gGraph &graph, QRect rect) diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index 2b7efadc..fc418cb5 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -627,7 +627,7 @@ void SummaryChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) } QColor col1 = col; - QColor col2 = brighten(col,2.37); + QColor col2 = brighten(col,2.37f); //outlines->setColor(Qt::black); int np = d.value().size(); diff --git a/sleepyhead/Graphs/gXAxis.cpp b/sleepyhead/Graphs/gXAxis.cpp index 08d832d2..d68af0e5 100644 --- a/sleepyhead/Graphs/gXAxis.cpp +++ b/sleepyhead/Graphs/gXAxis.cpp @@ -385,7 +385,7 @@ void gXAxisDay::paint(QPainter &painter, gGraph &graph, const QRegion ®ion) float left = region.boundingRect().left(); float top = region.boundingRect().top(); float width = region.boundingRect().width(); - float height = region.boundingRect().height(); + //float height = region.boundingRect().height(); QString months[] = { QObject::tr("Jan"), QObject::tr("Feb"), QObject::tr("Mar"), QObject::tr("Apr"), QObject::tr("May"), QObject::tr("Jun"), diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h index d0ed158d..30b351e4 100644 --- a/sleepyhead/SleepLib/common.h +++ b/sleepyhead/SleepLib/common.h @@ -73,12 +73,12 @@ class median_of_empty_list_exception:public std::exception{ /// ///The numbers must be convertible to double. template -double median(RandAccessIter begin, RandAccessIter end) - throw (median_of_empty_list_exception) +float median(RandAccessIter begin, RandAccessIter end) +// throw (median_of_empty_list_exception) { if (begin == end) { throw median_of_empty_list_exception(); } - std::size_t size = end - begin; - std::size_t middleIdx = size/2; + int size = end - begin; + int middleIdx = size/2; RandAccessIter target = begin + middleIdx; std::nth_element(begin, target, end); diff --git a/sleepyhead/SleepLib/day.cpp b/sleepyhead/SleepLib/day.cpp index 7effcf8f..186caa8c 100644 --- a/sleepyhead/SleepLib/day.cpp +++ b/sleepyhead/SleepLib/day.cpp @@ -136,7 +136,7 @@ EventDataType Day::calcMiddle(ChannelID code) } EventDataType Day::calcMax(ChannelID code) { - return p_profile->general->prefCalcMax() ? percentile(code, 0.995) : Max(code); + return p_profile->general->prefCalcMax() ? percentile(code, 0.995f) : Max(code); } EventDataType Day::calcPercentile(ChannelID code) { diff --git a/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp index 89f03315..a50e0d8c 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50_loader.cpp @@ -267,6 +267,8 @@ int CMS50Loader::doImportMode() info.serial = QString(); Machine * mach = CreateMachine(info); + Q_UNUSED(mach); + qDebug() << QString("Receiving Oximeter transmission %1:%2").arg(hour).arg(minute); // set importing to true or whatever.. diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp index 070d501f..cb691b16 100644 --- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp @@ -377,7 +377,7 @@ int IntellipapLoader::Open(QString path) sid = 0; SessionID lastsid = 0; - int last_minp=0, last_maxp=0, last_ps=0, last_pres = 0; + //int last_minp=0, last_maxp=0, last_ps=0, last_pres = 0; for (int i = 0; i < recs; i++) { // convert timestamp to real epoch @@ -543,7 +543,7 @@ int IntellipapLoader::Open(QString path) if (!sess) continue; // quint64 first = qint64(sid) * 1000L; - quint64 last = qint64(SessionEnd[i]) * 1000L; + //quint64 last = qint64(SessionEnd[i]) * 1000L; if (sess->last() > 0) { // sess->really_set_last(last); diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp index 270f5d69..9234d5fd 100644 --- a/sleepyhead/SleepLib/machine.cpp +++ b/sleepyhead/SleepLib/machine.cpp @@ -210,9 +210,6 @@ bool Machine::AddSession(Session *s) Q_ASSERT(p_profile); Q_ASSERT(p_profile->isOpen()); - if (s->type() == MT_OXIMETER) { - int i=5; - } updateChannels(s); if (p_profile->session->ignoreOlderSessions()) { diff --git a/sleepyhead/SleepLib/session.cpp b/sleepyhead/SleepLib/session.cpp index 54857ad8..0db0a817 100644 --- a/sleepyhead/SleepLib/session.cpp +++ b/sleepyhead/SleepLib/session.cpp @@ -41,7 +41,7 @@ Session::Session(Machine *m, SessionID session) s_events_loaded = false; s_summary_loaded = false; _first_session = true; - s_enabled = -1; + s_enabled = true; s_first = s_last = 0; s_evchecksum_checked = false; diff --git a/sleepyhead/build_number.h b/sleepyhead/build_number.h index aaaf5891..4efaa269 100644 --- a/sleepyhead/build_number.h +++ b/sleepyhead/build_number.h @@ -1 +1 @@ -const int build_number = 0; +const int build_number = 1; diff --git a/sleepyhead/docs/changelog.txt b/sleepyhead/docs/changelog.txt index 1f08b80f..e69de29b 100644 --- a/sleepyhead/docs/changelog.txt +++ b/sleepyhead/docs/changelog.txt @@ -1 +0,0 @@ -ghttp://mobile-phones.smh.com.au/MobilePhones?utm_source=Widget_Fairfax_SMH_CompareAndSave&utm_medium=Widget&utm_campaign=New_BYO_Phone_Prices diff --git a/sleepyhead/docs/release_notes.html b/sleepyhead/docs/release_notes.html index 59265720..30edc097 100644 --- a/sleepyhead/docs/release_notes.html +++ b/sleepyhead/docs/release_notes.html @@ -1,7 +1,7 @@ -

SleepyHead v0.9.8 Testing

+

SleepyHead v0.9.8-1 Testing

Release Notes

Greetings!

@@ -11,21 +11,34 @@

This is the first public test build in a while, so there is a lot of new stuff to take in.

-

First up, a warning: Some new stuff is going down that might break on you.. Overview overhead figures aren't completely finished yet. I know about these and am working on them. -You will likely have to Rebuild CPAP data to get this to behave properly.. If you have to do it more than once, somethings not right, and I need to know.

- -

Right clicky menu has tons of new stuff for you to play with... some of this you're hopefully going to love! :)

-

New Graph Clone ability allows you to make a temporary copy of a graph, and operate it completely independently... +Some highlights from the new series
+ +

  • Right click menu has tons of new stuff for you to play with... some of this you're hopefully going to love! :)
  • +
  • New Graph Clone ability allows you to make a temporary copy of a graph, and operate it completely independently... You can even take these graph clones with you to another day! They aren't saved though. they are gone when you close SleepyHead.
  • -

    Y-Axis menu allows for better control of Y-Axis scaling, all of this has been improved greatly... no more having to go into preferences -to set minimum/maximum values (that SleepyHead wasn't honouring properly anyway). Now you can adjust these settings live for each graph!

    -

    Line Cursor mode (F3 to toggles) is a very powerful new feature.. Play with it and see what it does. It's off by default because it takes a lot more CPU power to work.

    - +
  • Y-Axis menu allows for better control of Y-Axis scaling, all of this has been improved greatly... no more having to go into preferences +to set minimum/maximum values (that SleepyHead wasn't honouring properly anyway). Now you can adjust these settings live for each graph!
  • +
  • Line Cursor mode (F3 to toggles) is a very powerful new feature.. Play with it and see what it does. It's off by default because it takes a lot more CPU power to work.
  • + +

    There is loads more waiting for you in the 0.9.8 series!

    Sleep Well, and good luck!

    JediMark


    -New features & bug fixes in v0.9.8
    +Bug fixes in v0.9.8-1 + +
  • Windows build related fixes
  • +
  • Increase brightness steps between barchart segments
  • +
  • Put Export CSV back
  • +
  • Do not save over machine.xml if profiles has an machines section but machines.xml is present
  • +
  • Fix PRS1 model numbers not ending in 'P' refusing to import
  • +
  • Show Model number in rx changes list instead of loader name
  • +
  • Only Resmed CPAP/APAP modes have EPR
  • +
  • Fix PRS1 4x0P models accidentally being called Plus instead of Pro
  • +
  • Fix Profile delete not removing row properly
  • +
    +
    +New features & bug fixes in v0.9.8-0
  • Rework of Records box
  • Initial support for Philips Respironics System One Oximetery attachment
  • diff --git a/sleepyhead/scripts/build_number b/sleepyhead/scripts/build_number index 573541ac..0d66ea1a 100644 --- a/sleepyhead/scripts/build_number +++ b/sleepyhead/scripts/build_number @@ -1 +1,2 @@ 0 +1 From 1ade0e7b04465c206b54613fd18545c3ee4572b0 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 2 Oct 2014 20:02:33 +1000 Subject: [PATCH 2/3] Window 32bit build fixes, variable cleanups --- sleepyhead/Graphs/gFlagsLine.h | 2 +- sleepyhead/Graphs/gGraph.cpp | 15 ++++++++------- sleepyhead/Graphs/gLineOverlay.cpp | 18 +++++++++--------- sleepyhead/SleepLib/machine.cpp | 6 +++--- sleepyhead/daily.cpp | 12 ++++++------ sleepyhead/main.cpp | 12 ++++++------ sleepyhead/mainwindow.cpp | 9 +++------ sleepyhead/sleepyhead.pro | 2 +- 8 files changed, 37 insertions(+), 39 deletions(-) diff --git a/sleepyhead/Graphs/gFlagsLine.h b/sleepyhead/Graphs/gFlagsLine.h index b0ae4d14..f13b4c2b 100644 --- a/sleepyhead/Graphs/gFlagsLine.h +++ b/sleepyhead/Graphs/gFlagsLine.h @@ -68,7 +68,7 @@ class gFlagsLine: public Layer void setLineNum(int i) { line_num = i; } virtual Layer * Clone() { - gFlagsLine * layer = new gFlagsLine(nullptr); //ouchie.. + gFlagsLine * layer = new gFlagsLine(NoChannel); //ouchie.. Layer::CloneInto(layer); CloneInto(layer); return layer; diff --git a/sleepyhead/Graphs/gGraph.cpp b/sleepyhead/Graphs/gGraph.cpp index 408cbfa3..1836ed8f 100644 --- a/sleepyhead/Graphs/gGraph.cpp +++ b/sleepyhead/Graphs/gGraph.cpp @@ -298,7 +298,8 @@ void gGraph::paint(QPainter &painter, const QRegion ®ion) //m_marginbottom=5; left = marginLeft()*printScaleX(), right = marginRight()*printScaleX(), top = marginTop(), bottom = marginBottom() * printScaleY(); - int x = 0, y = 0; + //int x; + int y; if (m_showTitle) { int title_x, yh; @@ -309,7 +310,7 @@ void gGraph::paint(QPainter &painter, const QRegion ®ion) yh = fm.height(); //GetTextExtent("Wy@",x,yh,mediumfont); // This gets a better consistent height. should be cached. y = yh; - x = fm.width(title()); + //x = fm.width(title()); //GetTextExtent(title(),x,y,mediumfont); title_x = float(yh) ; @@ -716,7 +717,7 @@ void gGraph::mouseMoveEvent(QMouseEvent *event) int y = event->y(); int x = event->x(); - bool doredraw = false; + //bool doredraw = false; timedRedraw(0); @@ -796,7 +797,7 @@ void gGraph::mouseMoveEvent(QMouseEvent *event) int offset = (x >= x2) ? 20 : - 20; ToolTip(m_selDurString, m_rect.left() + x + offset, m_rect.top() + y + 20, align); - doredraw = true; + //doredraw = true; } else if (event->buttons() & Qt::RightButton) { // Right Mouse button dragging m_graphview->setPointClicked(event->pos()); x -= left; @@ -822,7 +823,7 @@ void gGraph::mouseMoveEvent(QMouseEvent *event) } m_graphview->SetXBounds(min_x, max_x, m_group, false); - doredraw = true; + // doredraw = true; } else { qint64 qq = rmax_x - rmin_x; xx = max_x - min_x; @@ -845,7 +846,7 @@ void gGraph::mouseMoveEvent(QMouseEvent *event) } m_graphview->SetXBounds(min_x, max_x, m_group, false); - doredraw = true; + //doredraw = true; } } } @@ -1180,7 +1181,7 @@ void gGraph::ZoomX(double mult, int origin_px) min = max - q; } - extern const int max_history; + //extern const int max_history; m_graphview->SetXBounds(min, max, m_group); //updateSelectionTime(max-min); diff --git a/sleepyhead/Graphs/gLineOverlay.cpp b/sleepyhead/Graphs/gLineOverlay.cpp index dedba2c7..57f483d5 100644 --- a/sleepyhead/Graphs/gLineOverlay.cpp +++ b/sleepyhead/Graphs/gLineOverlay.cpp @@ -81,7 +81,7 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) qint64 clockdrift = qint64(p_profile->cpap->clockDrift()) * 1000L; qint64 drift = 0; - bool hover = false; + //bool hover = false; // For each session, process it's eventlist for (QList::iterator s = m_day->begin(); s != m_day->end(); s++) { @@ -125,7 +125,7 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) // FT_Span //////////////////////////////////////////////////////////////////////////// for (; dptr < eptr; dptr++) { - hover = false; + //hover = false; X = stime + *tptr++; raw = *dptr; @@ -154,9 +154,9 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) QRect rect(x2, start_py, x1-x2, height); QColor col = m_flag_color; - if (rect.contains(mouse)) { - hover = true; - } +// if (rect.contains(mouse)) { +// hover = true; +// } painter.fillRect(rect, QBrush(col)); } @@ -195,7 +195,7 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) // FT_Bar //////////////////////////////////////////////////////////////////////////// for (; dptr < eptr; dptr++) { - hover = false; + // hover = false; X = stime + *tptr++; raw = *dptr; @@ -249,7 +249,7 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) // painter.drawLine(rect.x(), top, rect.x(), bottom); // col = COLOR_Gold; - hover = true; +// hover = true; painter.setPen(QPen(col,3)); } else { painter.setPen(QPen(col,1)); @@ -266,11 +266,11 @@ void gLineOverlayBar::paint(QPainter &painter, gGraph &w, const QRegion ®ion) ////////////////////////////////////////////////////////////////////////////////////// // Top and bottom markers ////////////////////////////////////////////////////////////////////////////////////// - bool b = false; + //bool b = false; if (!w.selectingArea() && !m_blockhover && QRect(x1-2, topp, 6, height).contains(mouse) && !m_hover) { // only want to draw the highlight/label once per frame m_hover = true; - b = true; + //b = true; // Draw text label QString lab = QString("%1 (%2)").arg(schema::channel[m_code].fullname()).arg(raw); diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp index 9234d5fd..afc5cea3 100644 --- a/sleepyhead/SleepLib/machine.cpp +++ b/sleepyhead/SleepLib/machine.cpp @@ -439,12 +439,12 @@ bool Machine::Purge(int secret) QList sessions = sessionlist.values(); // Clean up any loaded sessions from memory first.. - bool success = true; + //bool success = true; for (int i=0; i < sessions.size(); ++i) { Session * sess = sessions[i]; if (!sess->Destroy()) { qDebug() << "Could not destroy "+ info.loadername +" ("+info.serial+") session" << sess->session(); - success = false; + // success = false; } else { // sessionlist.remove(sess->session()); } @@ -482,7 +482,7 @@ bool Machine::Purge(int secret) qDebug() << "Deleting " << QDir::toNativeSeparators(fullpath); if (!dir.remove(fullpath)) { qDebug() << "Could not purge file" << fullpath; - success=false; + //success=false; could_not_kill++; } } else { diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index a4fe41ce..27316ae4 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -1156,9 +1156,9 @@ QString Daily::getStatisticsInfo(Day * day) { if (!day) return QString(); - Machine *cpap = day->machine(MT_CPAP), - *oxi = day->machine(MT_OXIMETER), - *pos = day->machine(MT_POSITION); + Machine *cpap = day->machine(MT_CPAP); +// *oxi = day->machine(MT_OXIMETER), +// *pos = day->machine(MT_POSITION); int mididx=p_profile->general->prefCalcMiddle(); @@ -1351,13 +1351,13 @@ void Daily::Load(QDate date) Day * day = p_profile->GetDay(date); Machine *cpap = nullptr, *oxi = nullptr, - *stage = nullptr, + //*stage = nullptr, *posit = nullptr; if (day) { cpap = day->machine(MT_CPAP); oxi = day->machine(MT_OXIMETER); - stage = day->machine(MT_SLEEPSTAGE); + // stage = day->machine(MT_SLEEPSTAGE); posit = day->machine(MT_POSITION); } @@ -2004,7 +2004,7 @@ void Daily::on_LineCursorUpdate(double time) } else dateDisplay->setText(QString(GraphView->emptyText())); } -void Daily::on_RangeUpdate(double minx, double maxx) +void Daily::on_RangeUpdate(double minx, double /*maxx*/) { if (minx > 1) { dateDisplay->setText(GraphView->getRangeString()); diff --git a/sleepyhead/main.cpp b/sleepyhead/main.cpp index ead45592..2f20b432 100644 --- a/sleepyhead/main.cpp +++ b/sleepyhead/main.cpp @@ -304,10 +304,10 @@ retry_directory: //////////////////////////////////////////////////////////////////////////////////////////// // Check when last checked for updates.. //////////////////////////////////////////////////////////////////////////////////////////// - bool check_updates = false; + //bool check_updates = false; if (PREF[STR_GEN_UpdatesAutoCheck].toBool()) { - int update_frequency = PREF[STR_GEN_UpdateCheckFrequency].toInt(); + //int update_frequency = PREF[STR_GEN_UpdateCheckFrequency].toInt(); int days = 1000; lastchecked = PREF[STR_GEN_UpdatesLastChecked].toDateTime(); @@ -316,9 +316,9 @@ retry_directory: days /= 86400; }; - if (days > update_frequency) { - check_updates = true; - } +// if (days > update_frequency) { +// check_updates = true; +// } } if (!Profiles::profiles.size()) { @@ -337,7 +337,7 @@ retry_directory: if (vc < 0) { release_notes(); - check_updates = false; + //check_updates = false; } else if (vc > 0) { if (QMessageBox::warning(nullptr, STR_MessageBox_Error, QObject::tr("The version of SleepyHead you just ran is OLDER than the one used to create this data (%1).").arg(PREF[STR_PREF_VersionString].toString()) +"\n\n"+ QObject::tr("It is likely that doing this will cause data corruption, are you sure you want to do this?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) { diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 8465bff0..5c5efa5a 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -6,7 +6,8 @@ * License. See the file COPYING in the main directory of the Linux * distribution for more details. */ -#include +#include + #include #include #include @@ -1563,7 +1564,7 @@ void MainWindow::DelayedScreenshot() #endif #if defined(Q_OS_WIN32) || defined(Q_OS_LINUX) - QRect rec = QApplication::desktop()->screenGeometry(); + //QRect rec = QApplication::desktop()->screenGeometry(); // grab the whole screen QPixmap desktop = QPixmap::grabWindow(QApplication::desktop()->winId()); @@ -2041,10 +2042,6 @@ void MainWindow::on_actionPurge_Current_Day_triggered() } day = p_profile->GetDay(date, MT_CPAP); - if (day != nullptr) { - int i = 5; - } - getDaily()->clearLastDay(); getDaily()->LoadDate(date); } diff --git a/sleepyhead/sleepyhead.pro b/sleepyhead/sleepyhead.pro index 512f9444..85c52a5f 100644 --- a/sleepyhead/sleepyhead.pro +++ b/sleepyhead/sleepyhead.pro @@ -20,8 +20,8 @@ contains(DEFINES, BrokenGL) { DEFINES += BROKEN_OPENGL_BUILD } else { message("Building with QGLWidget gGraphView") - QT += opengl } +QT += opengl #The following forces ResMed session locking.. it *may* not be necessary.. I'm still trying to assess this properly. DEFINES += LOCK_RESMED_SESSIONS From bc093829164293defbf681703cd1eb2a9d2bdadb Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 2 Oct 2014 21:22:30 +1000 Subject: [PATCH 3/3] Make Daily sidepanel and right side bar size changes persistent --- sleepyhead/Graphs/gLineChart.cpp | 6 ++--- sleepyhead/Graphs/gSessionTimesChart.cpp | 10 ++++---- sleepyhead/Graphs/gSummaryChart.cpp | 5 ++-- sleepyhead/SleepLib/profiles.h | 12 +++++++++ sleepyhead/daily.cpp | 9 ++++++- sleepyhead/daily.h | 2 ++ sleepyhead/daily.ui | 4 +-- sleepyhead/mainwindow.cpp | 14 +++++++++++ sleepyhead/mainwindow.h | 2 ++ sleepyhead/mainwindow.ui | 32 ++++++++---------------- sleepyhead/statistics.cpp | 4 +-- 11 files changed, 63 insertions(+), 37 deletions(-) diff --git a/sleepyhead/Graphs/gLineChart.cpp b/sleepyhead/Graphs/gLineChart.cpp index 5feed0cc..028c3100 100644 --- a/sleepyhead/Graphs/gLineChart.cpp +++ b/sleepyhead/Graphs/gLineChart.cpp @@ -462,9 +462,9 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) } } - bool mouseover = false; + //bool mouseover = false; if (rect.contains(w.graphView()->currentMousePos())) { - mouseover = true; + //mouseover = true; painter.fillRect(rect, QBrush(QColor(255,255,245,128))); } @@ -501,7 +501,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) int idx; bool done; double x0, xL; - double sr; + double sr = 0.0; int sam; int minz, maxz; diff --git a/sleepyhead/Graphs/gSessionTimesChart.cpp b/sleepyhead/Graphs/gSessionTimesChart.cpp index edf7a028..26a22919 100644 --- a/sleepyhead/Graphs/gSessionTimesChart.cpp +++ b/sleepyhead/Graphs/gSessionTimesChart.cpp @@ -434,7 +434,7 @@ void gSummaryChart::paint(QPainter &painter, gGraph &graph, const QRegion ®io if ((daylist.size() == 0) || (it == dayindex.end())) return; - Day * lastday = nullptr; + //Day * lastday = nullptr; // int dc = 0; // for (int i=idx; i<=idx_end; ++i) { @@ -527,11 +527,11 @@ void gSummaryChart::paint(QPainter &painter, gGraph &graph, const QRegion ®io lastx1 += barw; it++; nousedays++; - lastday = day; + //lastday = day; continue; } - lastday = day; + //lastday = day; float x1 = lastx1 + barw; @@ -986,13 +986,13 @@ void gSessionTimesChart::paint(QPainter &painter, gGraph &graph, const QRegion & float x1 = lastx1 + barw; - bool hl = false; + //bool hl = false; QRect rec2(lastx1, rect.top(), barw, rect.height()); if (rec2.contains(mouse)) { QColor col2(255,0,0,64); painter.fillRect(rec2, QBrush(col2)); - hl = true; + //hl = true; } if (cit != cache.end()) { diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index fc418cb5..dc71f14d 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -70,7 +70,8 @@ void SummaryChart::SetDay(Day * nullday) if (mididx == 0) { mid = ST_PERC; } else if (mididx == 1) { mid = ST_WAVG; } - else if (mididx == 2) { mid = ST_AVG; } + else mid = ST_AVG; + if (cpapmode >= MODE_ASV) { addSlice(CPAP_EPAP, QColor("green"), ST_SETMIN); @@ -94,7 +95,7 @@ void SummaryChart::SetDay(Day * nullday) addSlice(CPAP_IPAPHi, QColor("blue"), ST_SETMAX); } else if (cpapmode >= MODE_APAP) { addSlice(CPAP_PressureMin, QColor("orange"), ST_SETMIN); - addSlice(CPAP_Pressure, QColor("dark green"), mid, 0.5); + addSlice(CPAP_Pressure, QColor("dark green"), mid, 0.5f); addSlice(CPAP_Pressure, QColor("grey"), ST_PERC, perc); addSlice(CPAP_PressureMax, QColor("red"), ST_SETMAX); } else { diff --git a/sleepyhead/SleepLib/profiles.h b/sleepyhead/SleepLib/profiles.h index 618cfb3f..2b482907 100644 --- a/sleepyhead/SleepLib/profiles.h +++ b/sleepyhead/SleepLib/profiles.h @@ -320,6 +320,8 @@ const QString STR_IS_LockSummarySessions = "LockSummarySessions"; // AppearanceSettings Strings const QString STR_AS_GraphHeight = "GraphHeight"; +const QString STR_AS_DailyPanelWidth = "DailyPanelWidth"; +const QString STR_AS_RightPanelWidth = "RightPanelWidth"; const QString STR_AS_AntiAliasing = "UseAntiAliasing"; const QString STR_AS_GraphSnapshots = "EnableGraphSnapshots"; const QString STR_AS_Animations = "AnimationsAndTransitions"; @@ -696,6 +698,8 @@ class AppearanceSettings : public ProfileSettings : ProfileSettings(profile) { initPref(STR_AS_GraphHeight, 180.0); + initPref(STR_AS_DailyPanelWidth, 350.0); + initPref(STR_AS_RightPanelWidth, 230.0); initPref(STR_AS_AntiAliasing, true); initPref(STR_AS_GraphSnapshots, true); initPref(STR_AS_Animations, true); @@ -713,6 +717,10 @@ class AppearanceSettings : public ProfileSettings //! \brief Returns the normal (unscaled) height of a graph int graphHeight() const { return getPref(STR_AS_GraphHeight).toInt(); } + //! \brief Returns the normal (unscaled) height of a graph + int dailyPanelWidth() const { return getPref(STR_AS_DailyPanelWidth).toInt(); } + //! \brief Returns the normal (unscaled) height of a graph + int rightPanelWidth() const { return getPref(STR_AS_RightPanelWidth).toInt(); } //! \brief Returns true if AntiAliasing (the graphical smoothing method) is enabled bool antiAliasing() const { return getPref(STR_AS_AntiAliasing).toBool(); } //! \brief Returns true if renderPixmap function is in use, which takes snapshots of graphs @@ -748,6 +756,10 @@ class AppearanceSettings : public ProfileSettings //! \brief Set the normal (unscaled) height of a graph. void setGraphHeight(int height) { setPref(STR_AS_GraphHeight, height); } + //! \brief Set the normal (unscaled) height of a graph. + void setDailyPanelWidth(int width) { setPref(STR_AS_DailyPanelWidth, width); } + //! \brief Set the normal (unscaled) height of a graph. + void setRightPanelWidth(int width) { setPref(STR_AS_RightPanelWidth, width); } //! \brief Set to true to turn on AntiAliasing (the graphical smoothing method) void setAntiAliasing(bool aa) { setPref(STR_AS_AntiAliasing, aa); } //! \brief Set to true if renderPixmap functions are in use, which takes snapshots of graphs. diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index 27316ae4..69f7f7f9 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -59,7 +59,7 @@ void Daily::setSidebarVisible(bool visible) { QList a; - int panel_width = visible ? 370 : 0; + int panel_width = visible ? p_profile->appearance->dailyPanelWidth() : 0; a.push_back(panel_width); a.push_back(this->width() - panel_width); ui->splitter_2->setStretchFactor(1,1); @@ -2561,3 +2561,10 @@ void Daily::on_toggleEvents_clicked(bool checked) // // ui->sessionWidget->setCurrentItem(item); // } //} + +void Daily::on_splitter_2_splitterMoved(int, int) +{ + int size = ui->splitter_2->sizes()[0]; + if (size == 0) return; + p_profile->appearance->setDailyPanelWidth(size); +} diff --git a/sleepyhead/daily.h b/sleepyhead/daily.h index d2701354..927caf48 100644 --- a/sleepyhead/daily.h +++ b/sleepyhead/daily.h @@ -281,6 +281,8 @@ private slots: //void on_sessionWidget_itemSelectionChanged(); + void on_splitter_2_splitterMoved(int pos, int index); + protected: virtual void closeEvent(QCloseEvent *); virtual void showEvent(QShowEvent *); diff --git a/sleepyhead/daily.ui b/sleepyhead/daily.ui index 80315821..df287870 100644 --- a/sleepyhead/daily.ui +++ b/sleepyhead/daily.ui @@ -6,8 +6,8 @@ 0 0 - 1211 - 674 + 551 + 441 diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 5c5efa5a..5222df1a 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -331,6 +331,15 @@ MainWindow::MainWindow(QWidget *parent) : connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(on_aboutToQuit())); + QList a; + int panel_width = p_profile->appearance->rightPanelWidth(); + a.push_back(this->width() - panel_width); + a.push_back(panel_width); + ui->splitter_2->setStretchFactor(1,1); + ui->splitter_2->setSizes(a); + ui->splitter_2->setStretchFactor(1,1); + + } void MainWindow::on_changeWarningMessage() @@ -2714,3 +2723,8 @@ void MainWindow::on_actionExport_Review_triggered() { QMessageBox::information(nullptr, STR_MessageBox_Information, QObject::tr("Sorry, this feature is not implemented yet"), QMessageBox::Ok); } + +void MainWindow::on_splitter_2_splitterMoved(int, int) +{ + p_profile->appearance->setRightPanelWidth(ui->splitter_2->sizes()[1]); +} diff --git a/sleepyhead/mainwindow.h b/sleepyhead/mainwindow.h index fd6fa5f5..382d2104 100644 --- a/sleepyhead/mainwindow.h +++ b/sleepyhead/mainwindow.h @@ -332,6 +332,8 @@ class MainWindow : public QMainWindow void on_actionExport_Review_triggered(); + void on_splitter_2_splitterMoved(int pos, int index); + private: void importCPAPBackups(); void finishCPAPImport(); diff --git a/sleepyhead/mainwindow.ui b/sleepyhead/mainwindow.ui index 3869fd78..a05561e6 100644 --- a/sleepyhead/mainwindow.ui +++ b/sleepyhead/mainwindow.ui @@ -6,8 +6,8 @@ 0 0 - 1005 - 849 + 687 + 361 @@ -926,7 +926,7 @@ QTabWidget::Rounded - 1 + 0 false @@ -1332,18 +1332,6 @@ color: yellow; - - - 240 - 0 - - - - - 180 - 16777215 - - @@ -1494,8 +1482,8 @@ QToolBox::tab:selected { 0 0 - 240 - 724 + 223 + 582 @@ -1909,7 +1897,7 @@ border: 2px solid #56789a; border-radius: 30px; 0 0 240 - 724 + 237 @@ -3056,8 +3044,8 @@ border-radius: 10px; 0 0 - 240 - 724 + 69 + 237 @@ -3118,8 +3106,8 @@ border-radius: 10px; 0 0 - 1005 - 22 + 687 + 21 diff --git a/sleepyhead/statistics.cpp b/sleepyhead/statistics.cpp index 7ed6e588..abd86443 100644 --- a/sleepyhead/statistics.cpp +++ b/sleepyhead/statistics.cpp @@ -1124,12 +1124,12 @@ QString Statistics::GenerateHTML() periods.push_back(Period(last,last,tr("Last Session"))); - bool done=false; + //bool done=false; int j=0; do { s=QDate(l.year(), l.month(), 1); if (s < first) { - done = true; + //done = true; s = first; } if (p_profile->countDays(row.type, s, l) > 0) {