From 376d04803a518542cf03e6f3b2ef628a2f7a5ca1 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Wed, 24 Jul 2019 01:47:15 -0700 Subject: [PATCH 01/11] Show commit id in title bar for all except Release versions. --- oscar/SleepLib/common.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp index ce3b3be2..380ec5f3 100644 --- a/oscar/SleepLib/common.cpp +++ b/oscar/SleepLib/common.cpp @@ -177,6 +177,11 @@ QString getGraphicsEngine() QString getBranchVersion() { QString version = STR_TR_AppVersion; + + if (!((ReleaseStatus.compare("r", Qt::CaseInsensitive)==0) || + (ReleaseStatus.compare("release", Qt::CaseInsensitive)==0))) + version += " ("+GIT_REVISION + ")"; + if (GIT_BRANCH != "master") { version += " [Branch: " + GIT_BRANCH + "]"; } From 166ffa4970474efbef60a25919dbb6a8ca2bb654 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Wed, 24 Jul 2019 01:48:18 -0700 Subject: [PATCH 02/11] Show BMI label and calculated value only when both weight and height are non-zero --- oscar/daily.cpp | 21 +++++++++++++++++++++ oscar/daily.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/oscar/daily.cpp b/oscar/daily.cpp index 7aad0aac..62fd407d 100644 --- a/oscar/daily.cpp +++ b/oscar/daily.cpp @@ -588,6 +588,11 @@ void Daily::ReloadGraphs() // sleep(3); } +void Daily::updateLeftSidebar() { + if (webView && !htmlLeftHeader.isEmpty()) + webView->setHtml(getLeftSidebar(true)); +} + void Daily::hideSpaceHogs() { if (AppSetting->calendarVisible()) { @@ -2276,6 +2281,10 @@ void Daily::on_weightSpinBox_valueChanged(double arg1) double bmi=kg/(height * height); ui->BMI->display(bmi); ui->BMI->setVisible(true); + ui->BMIlabel->setVisible(true); + } else { + ui->BMI->setVisible(false); + ui->BMIlabel->setVisible(false); } } @@ -2306,11 +2315,15 @@ void Daily::on_weightSpinBox_editingFinished() double bmi=kg/(height * height); ui->BMI->display(bmi); ui->BMI->setVisible(true); + ui->BMIlabel->setVisible(true); journal->settings[Journal_BMI]=bmi; if (gv) { g=gv->findGraph(STR_GRAPH_BMI); if (g) g->setDay(nullptr); } + } else { + ui->BMI->setVisible(false); + ui->BMIlabel->setVisible(false); } journal->SetChanged(true); } @@ -2324,6 +2337,10 @@ void Daily::on_ouncesSpinBox_valueChanged(int arg1) double bmi=kg/(height * height); ui->BMI->display(bmi); ui->BMI->setVisible(true); + ui->BMIlabel->setVisible(true); + } else { + ui->BMI->setVisible(false); + ui->BMIlabel->setVisible(false); } } @@ -2348,12 +2365,16 @@ void Daily::on_ouncesSpinBox_editingFinished() double bmi=kg/(height * height); ui->BMI->display(bmi); ui->BMI->setVisible(true); + ui->BMIlabel->setVisible(true); journal->settings[Journal_BMI]=bmi; if (mainwin->getOverview()) { g=mainwin->getOverview()->graphView()->findGraph(STR_GRAPH_BMI); if (g) g->setDay(nullptr); } + } else { + ui->BMI->setVisible(false); + ui->BMIlabel->setVisible(false); } journal->SetChanged(true); } diff --git a/oscar/daily.h b/oscar/daily.h index 787a322a..97f662c3 100644 --- a/oscar/daily.h +++ b/oscar/daily.h @@ -66,6 +66,11 @@ public: */ void ResetGraphLayout(); + /*! \fn updateLeftSidebar() + /brief Updtes left sidebar to reflect changes in pie chart visibility + */ + void updateLeftSidebar(); + /*! \fn graphView() \returns the main graphView area for the Daily View */ From 844b33a4c3500571f0b95ace1f0af05f9587c7f8 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Wed, 24 Jul 2019 09:12:05 -0700 Subject: [PATCH 03/11] Show indices for all events even if flags for an event is disabled --- oscar/daily.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oscar/daily.cpp b/oscar/daily.cpp index 62fd407d..6863609a 100644 --- a/oscar/daily.cpp +++ b/oscar/daily.cpp @@ -1550,7 +1550,7 @@ void Daily::Load(QDate date) for (int i=0; i < available.size(); ++i) { ChannelID code = available.at(i); schema::Channel & chan = schema::channel[code]; - if (!chan.enabled()) continue; +// if (!chan.enabled()) continue; QString data; if (chan.type() == schema::SPAN) { val = (100.0 / hours)*(day->sum(code)/3600.0); From 16200b46cac8f4149c31f8d86168bd95d624fcd4 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Wed, 24 Jul 2019 09:14:13 -0700 Subject: [PATCH 04/11] Change metric height in profile dialog to show it is measured in cm, not in meters. --- oscar/newprofile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oscar/newprofile.cpp b/oscar/newprofile.cpp index fa3e7d77..e2a1a8cb 100644 --- a/oscar/newprofile.cpp +++ b/oscar/newprofile.cpp @@ -398,7 +398,7 @@ void NewProfile::edit(const QString name) ui->heightEdit->setValue(v); ui->heightEdit2->setVisible(false); ui->heightEdit->setDecimals(2); - ui->heightEdit->setSuffix(STR_UNIT_M); + ui->heightEdit->setSuffix(STR_UNIT_CM); } } From 4ffb621d0904672981bac45e969fee7b480e97d4 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Wed, 24 Jul 2019 09:17:59 -0700 Subject: [PATCH 05/11] Make decimal point more visible in BMI display on Daily/Notes tab --- oscar/daily.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oscar/daily.ui b/oscar/daily.ui index 91785593..2090fe11 100644 --- a/oscar/daily.ui +++ b/oscar/daily.ui @@ -1314,7 +1314,7 @@ QSlider::handle:horizontal { <enum>QFrame::NoFrame</enum> </property> <property name="smallDecimalPoint"> - <bool>true</bool> + <bool>false</bool> </property> <property name="digitCount"> <number>5</number> From d04c2ae8ba826a3451114249587c3ace82155895 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Wed, 24 Jul 2019 23:18:09 -0700 Subject: [PATCH 06/11] Add tooltip to Weight field to explain BMI calculation --- oscar/daily.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oscar/daily.ui b/oscar/daily.ui index 2090fe11..fa96e948 100644 --- a/oscar/daily.ui +++ b/oscar/daily.ui @@ -1227,6 +1227,9 @@ QToolButton:pressed { </item> <item row="2" column="1" colspan="2"> <widget class="QDoubleSpinBox" name="weightSpinBox"> + <property name="toolTip"> + <string>If height is greater than zero in Preferences Dialog, setting weight here will show Body Mass Index (BMI) value</string> + </property> <property name="maximum"> <double>1499.000000000000000</double> </property> From acd078cc8264923f5c3b8df84c160b50453931d4 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Thu, 25 Jul 2019 06:21:30 -0700 Subject: [PATCH 07/11] OSCAR 1.1.0-testing-2 release notes and build number --- oscar/build_number.h | 2 +- oscar/docs/release_notes.html | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/oscar/build_number.h b/oscar/build_number.h index 4efaa269..6025edac 100644 --- a/oscar/build_number.h +++ b/oscar/build_number.h @@ -1 +1 @@ -const int build_number = 1; +const int build_number = 2; diff --git a/oscar/docs/release_notes.html b/oscar/docs/release_notes.html index 2c20c306..c30ae90e 100644 --- a/oscar/docs/release_notes.html +++ b/oscar/docs/release_notes.html @@ -6,13 +6,27 @@ Which was written and copyright 2011-2018 © Mark Watkins </p> +<p> +<b>Changes and fixes in OSCAR v1.1.0-testing-2</b> +<br/><b>NOTE: Translations have NOT yet been updated for these changes</b> +<ul> +<li>Portions of OSCAR are © 2019 by The OSCAR Team</li> +<li>[new] Show progress bar when Statistics page has to refresh cache with more than 180 days in it</li> +<li>[new] Romanian language is supported</li> +<li>[fix] Show commit id in title bar for testing and beta builds</li> +<li>[fix] Show BMI label and calculated value only when both weight and height are non-zero</li> +<li>[fix] Improve BMI display in Daily/Notes</li> +<li>[fix] Correct profile dialog to show height is measured in cm, not meters, when units system is metric</li> +</ul> +</p> + <p> <b>Changes and fixes in OSCAR v1.1.0-testing-1</b> <br/><b>NOTE: Translations have NOT yet been updated for these changes</b> <ul> <li>Portions of OSCAR are © 2019 by The OSCAR Team</li> <li>[new] Offer migration if non-default directory is selected on first use</li> -<li>[new] Press SHIFT key when starting OSCAR to use Software Graphics Engine</li> +<li>[new] Hold SHIFT key down when starting OSCAR to use Software Graphics Engine</li> <li>[new] Support for DreamStation BiPAP autoSV (900X) should now be complete</li> <li>[new] Improved Dreamstation support</li> <li>[new] Improve oximeter import for CM550D+</li> From 7785d7fc9c107973e3aac1dfdc033fe256886b42 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Thu, 25 Jul 2019 06:23:24 -0700 Subject: [PATCH 08/11] Change height and weight decimals displayed, BMI digits displayed --- oscar/daily.cpp | 8 ++++---- oscar/daily.ui | 2 +- oscar/newprofile.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/oscar/daily.cpp b/oscar/daily.cpp index 6863609a..ee2181d8 100644 --- a/oscar/daily.cpp +++ b/oscar/daily.cpp @@ -432,7 +432,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared) ui->ouncesSpinBox->setSuffix(STR_UNIT_OUNCE); } else { ui->ouncesSpinBox->setVisible(false); - ui->weightSpinBox->setDecimals(3); + ui->weightSpinBox->setDecimals(1); ui->weightSpinBox->setSuffix(STR_UNIT_KG); } @@ -835,7 +835,7 @@ void Daily::on_ReloadDay() ui->ouncesSpinBox->setSuffix(STR_UNIT_OUNCE); } else { ui->ouncesSpinBox->setVisible(false); - ui->weightSpinBox->setDecimals(3); + ui->weightSpinBox->setDecimals(1); ui->weightSpinBox->setSuffix(STR_UNIT_KG); } this->setCursor(Qt::ArrowCursor); @@ -1693,7 +1693,7 @@ void Daily::Load(QDate date) double kg=journal->settings[Journal_Weight].toDouble(&ok); if (p_profile->general->unitSystem()==US_Metric) { - ui->weightSpinBox->setDecimals(3); + ui->weightSpinBox->setDecimals(1); ui->weightSpinBox->blockSignals(true); ui->weightSpinBox->setValue(kg); ui->weightSpinBox->blockSignals(false); @@ -1783,7 +1783,7 @@ void Daily::UnitsChanged() } else { kg=(ui->weightSpinBox->value()*(ounce_convert*16.0))+(ui->ouncesSpinBox->value()*ounce_convert); kg/=1000.0; - ui->weightSpinBox->setDecimals(3); + ui->weightSpinBox->setDecimals(1); ui->weightSpinBox->setValue(kg); ui->ouncesSpinBox->setVisible(false); ui->weightSpinBox->setSuffix(STR_UNIT_KG); diff --git a/oscar/daily.ui b/oscar/daily.ui index fa96e948..1fc521e5 100644 --- a/oscar/daily.ui +++ b/oscar/daily.ui @@ -1320,7 +1320,7 @@ QSlider::handle:horizontal { <bool>false</bool> </property> <property name="digitCount"> - <number>5</number> + <number>4</number> </property> <property name="segmentStyle"> <enum>QLCDNumber::Flat</enum> diff --git a/oscar/newprofile.cpp b/oscar/newprofile.cpp index e2a1a8cb..392ae76a 100644 --- a/oscar/newprofile.cpp +++ b/oscar/newprofile.cpp @@ -48,7 +48,7 @@ NewProfile::NewProfile(QWidget *parent, const QString *user) : on_cpapModeCombo_activated(0); m_passwordHashed = false; ui->heightEdit2->setVisible(false); - ui->heightEdit->setDecimals(2); + ui->heightEdit->setDecimals(0); ui->heightEdit->setSuffix(STR_UNIT_CM); { @@ -397,7 +397,7 @@ void NewProfile::edit(const QString name) } else { // good wholesome metric ui->heightEdit->setValue(v); ui->heightEdit2->setVisible(false); - ui->heightEdit->setDecimals(2); + ui->heightEdit->setDecimals(0); ui->heightEdit->setSuffix(STR_UNIT_CM); } } @@ -417,7 +417,7 @@ void NewProfile::on_heightCombo_currentIndexChanged(int index) if (index == 0) { //metric ui->heightEdit2->setVisible(false); - ui->heightEdit->setDecimals(2); + ui->heightEdit->setDecimals(0); ui->heightEdit->setSuffix(STR_UNIT_CM); double v = ui->heightEdit->value() * 30.48; v += ui->heightEdit2->value() * 2.54; From 751df7652ab982b85f4fff3c36f3237efdc32db5 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Thu, 25 Jul 2019 06:25:03 -0700 Subject: [PATCH 09/11] Diagnostic changes for a future feature --- oscar/SleepLib/session.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/oscar/SleepLib/session.cpp b/oscar/SleepLib/session.cpp index b9f83b02..a7f099b1 100644 --- a/oscar/SleepLib/session.cpp +++ b/oscar/SleepLib/session.cpp @@ -379,12 +379,11 @@ bool Session::StoreSummary() bool Session::LoadSummary() { - //static int sumcnt = 0; +// static int sumcnt = 0; if (s_summary_loaded) return true; QString filename = s_machine->getSummariesPath() + QString().sprintf("%08lx.000", s_session); - if (filename.isEmpty()) { qDebug() << "Empty summary filename"; return false; @@ -398,7 +397,7 @@ bool Session::LoadSummary() } - // qDebug() << "Loading" << s_machine->loaderName() << "Summary" << filename << sumcnt++; +// qDebug() << "Loading" << s_machine->loaderName() << "Summary" << filename << sumcnt++; QDataStream in(&file); in.setVersion(QDataStream::Qt_4_6); From f63530205840868d242105a70ad8bb028a8fb35c Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Thu, 25 Jul 2019 06:26:19 -0700 Subject: [PATCH 10/11] Improve performance of enabling or disabling pie chart option --- oscar/mainwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp index 7f2da0ca..f803b77c 100644 --- a/oscar/mainwindow.cpp +++ b/oscar/mainwindow.cpp @@ -111,8 +111,11 @@ MainWindow::MainWindow(QWidget *parent) : } +bool setupRunning = false; + void MainWindow::SetupGUI() { + setupRunning = true; QString version = getBranchVersion(); setWindowTitle(STR_TR_OSCAR + QString(" %1").arg(version)); @@ -241,6 +244,7 @@ void MainWindow::SetupGUI() help = new Help(this); ui->tabWidget->addTab(help, tr("Help Browser")); #endif + setupRunning = false; } void MainWindow::logMessage(QString msg) @@ -2469,8 +2473,9 @@ void MainWindow::on_actionLine_Cursor_toggled(bool b) void MainWindow::on_actionPie_Chart_toggled(bool visible) { AppSetting->setShowPieChart(visible); - if (daily && ui->tabWidget->currentWidget() == daily) { - daily->ReloadGraphs(); + if (!setupRunning && daily) { + daily->updateLeftSidebar(); +// daily->ReloadGraphs(); } } From 96ba68359963ba9d596dc771213dbe58c6465b15 Mon Sep 17 00:00:00 2001 From: Seeker4 <guy.oscar@moxis.com> Date: Thu, 25 Jul 2019 06:27:02 -0700 Subject: [PATCH 11/11] Show progress bar if recomputing rxchanges cache and looking at more than 180 days of data --- oscar/statistics.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/oscar/statistics.cpp b/oscar/statistics.cpp index a830c667..c6b238f5 100644 --- a/oscar/statistics.cpp +++ b/oscar/statistics.cpp @@ -16,6 +16,7 @@ #include <QPrintDialog> #include <QPainter> #include <QMainWindow> +#include <QProgressDialog> #include "mainwindow.h" #include "statistics.h" @@ -158,6 +159,7 @@ bool rxAHILessThan(const RXItem * rx1, const RXItem * rx2) void Statistics::updateRXChanges() { +// qDebug() << "updateRXChanges called"; rxitems.clear(); // Read the cache from disk @@ -173,6 +175,23 @@ void Statistics::updateRXChanges() quint64 tmp; + int numDays = p_profile->daylist.count(); + int daysProcessed = 0; + int lastPctDone = 0; + bool showProgress = (numDays > 180); // Show progress dialog if more than about 6 months of data + + QProgressDialog * progress = nullptr; + + if (showProgress) { // arbitrary guess about when we should bother with a progress dialog + progress = new QProgressDialog(QObject::tr("Updating Statistics cache"), + QString(), 0, numDays, 0, + Qt::WindowSystemMenuHint | Qt::WindowTitleHint); + progress->setValue(0); + progress->setMinimumWidth(250); + progress->show(); +// qDebug() << "Updating statistics rx cache dialog shown"; + } + // Scan through each daylist in ascending date order for (it = p_profile->daylist.begin(); it != it_end; ++it) { const QDate & date = it.key(); @@ -480,11 +499,25 @@ void Statistics::updateRXChanges() rxitems.insert(date, rx); } + // Update progress bar every percent change + if (showProgress) { + daysProcessed++; + int pctDone = (100 * daysProcessed) / numDays; + if (pctDone != lastPctDone) { + lastPctDone = pctDone; + progress->setValue(daysProcessed); + QCoreApplication::processEvents(); + } + } + } // Store RX cache to disk saveRXChanges(); + if (showProgress) + progress->setValue(numDays); // Force progress bar to stop + // Now do the setup for the best worst highlighting QList<RXItem *> list; ri_end = rxitems.end(); @@ -641,7 +674,7 @@ QString Statistics::generateHeader(bool onScreen) html += "p,a,td,body { font-family: 'Helvetica'; }"; // "p,a,td,body { font-size: 10px; }"; } - qDebug() << "generateHeader font" << html; +// qDebug() << "generateHeader font" << html; html += "table.curved {" // Borders not supported without webkit // "border: 1px solid gray;" // "border-radius:10px;"