Merge branch 'master' into fix-backup

This commit is contained in:
Phil Olynyk 2020-08-09 17:20:11 -04:00
commit d68afd69c4
19 changed files with 71 additions and 32 deletions

View File

@ -23,6 +23,7 @@
<li>[new] Privacy feature allows suppressing profile info in Statistics page and printed reports.</li> <li>[new] Privacy feature allows suppressing profile info in Statistics page and printed reports.</li>
<li>[new] Add option to print reports in black and white (monochrome).</li> <li>[new] Add option to print reports in black and white (monochrome).</li>
<li>[new] Hold down the Shift key while selecting a range on a chart to measure the duration without zooming.</li> <li>[new] Hold down the Shift key while selecting a range on a chart to measure the duration without zooming.</li>
<li>[new] Allow second (or more) import on same day for ResMed data.</li>
<li>[fix] Improve support for rare events in 50-series Philips Respironics devices.</li> <li>[fix] Improve support for rare events in 50-series Philips Respironics devices.</li>
<li>[fix] Improve warning on Daily page when settings are missing.</li> <li>[fix] Improve warning on Daily page when settings are missing.</li>
<li>[fix] No longer zoom charts to maximum when clicking on chart with popup menu present.</li> <li>[fix] No longer zoom charts to maximum when clicking on chart with popup menu present.</li>
@ -35,6 +36,7 @@
<li>[fix] Hours used on Welcome and Daily page are now hours of CPAP machine use.</li> <li>[fix] Hours used on Welcome and Daily page are now hours of CPAP machine use.</li>
<li>[fix] Popout graphs now limited to desktop height and multiple popout graphs work better.</li> <li>[fix] Popout graphs now limited to desktop height and multiple popout graphs work better.</li>
<li>[fix] Overview tooltips now list chart components in same order as displayed in chart.</li> <li>[fix] Overview tooltips now list chart components in same order as displayed in chart.</li>
<li>[fix] Overview graphs now show last day on charts for timezones near GMT.</li>
</ul> </ul>
<p> <p>
<b>Changes and fixes in OSCAR v1.1.1</b> <b>Changes and fixes in OSCAR v1.1.1</b>

View File

@ -717,7 +717,7 @@ void gGraphView::dumpInfo()
Day * day = p_profile->GetGoodDay(date, MT_CPAP); Day * day = p_profile->GetGoodDay(date, MT_CPAP);
if (day) { if (day) {
QDateTime dt=QDateTime::fromMSecsSinceEpoch(day->first(), Qt::UTC); QDateTime dt=QDateTime::fromMSecsSinceEpoch(day->first(), Qt::LocalTime);
mainwin->log(QString("Available Channels for %1").arg(dt.toString("MMM dd yyyy"))); mainwin->log(QString("Available Channels for %1").arg(dt.toString("MMM dd yyyy")));
QHash<schema::ChanType, QList<schema::Channel *> > list; QHash<schema::ChanType, QList<schema::Channel *> > list;
@ -3189,7 +3189,7 @@ void gGraphView::keyPressEvent(QKeyEvent *event)
m_metaselect=false; m_metaselect=false;
qint64 start,end; qint64 start,end;
getSelectionTimes(start,end); getSelectionTimes(start,end);
QDateTime d1 = QDateTime::fromMSecsSinceEpoch(start, Qt::UTC); QDateTime d1 = QDateTime::fromMSecsSinceEpoch(start, Qt::LocalTime);
mainwin->getDaily()->addBookmark(start, end, QString("Bookmark at %1").arg(d1.time().toString("HH:mm:ss"))); mainwin->getDaily()->addBookmark(start, end, QString("Bookmark at %1").arg(d1.time().toString("HH:mm:ss")));
m_graphs[m_graph_index]->cancelSelection(); m_graphs[m_graph_index]->cancelSelection();

View File

@ -89,8 +89,8 @@ void gSummaryChart::SetDay(Day *unused_day)
date = date.addDays(1); date = date.addDays(1);
} while (date <= lastday); } while (date <= lastday);
m_minx = QDateTime(firstday, QTime(0,0,0), Qt::UTC).toMSecsSinceEpoch(); m_minx = QDateTime(firstday, QTime(0,0,0), Qt::LocalTime).toMSecsSinceEpoch();
m_maxx = QDateTime(lastday, QTime(23,59,59), Qt::UTC).toMSecsSinceEpoch(); m_maxx = QDateTime(lastday, QTime(23,59,59), Qt::LocalTime).toMSecsSinceEpoch();
m_miny = 0; m_miny = 0;
m_maxy = 20; m_maxy = 20;
@ -148,7 +148,7 @@ bool gSummaryChart::mouseReleaseEvent(QMouseEvent *event, gGraph *graph)
graph->roundY(miny, maxy); graph->roundY(miny, maxy);
QDate date = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::UTC).date(); QDate date = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::LocalTime).date();
int days = ceil(double(m_maxx - m_minx) / 86400000.0); int days = ceil(double(m_maxx - m_minx) / 86400000.0);
@ -415,8 +415,8 @@ void gSummaryChart::paint(QPainter &painter, gGraph &graph, const QRegion &regio
m_minx = graph.min_x; m_minx = graph.min_x;
m_maxx = graph.max_x; m_maxx = graph.max_x;
QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::UTC); QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::LocalTime);
QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::UTC); QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::LocalTime);
QDate date = date2.date(); QDate date = date2.date();
QDate enddate = enddate2.date(); QDate enddate = enddate2.date();
@ -839,8 +839,8 @@ void gSessionTimesChart::paint(QPainter &painter, gGraph &graph, const QRegion &
m_minx = graph.min_x; m_minx = graph.min_x;
m_maxx = graph.max_x; m_maxx = graph.max_x;
QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::UTC); QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::LocalTime);
QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::UTC); QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::LocalTime);
QDate date = date2.date(); QDate date = date2.date();
QDate enddate = enddate2.date(); QDate enddate = enddate2.date();

View File

@ -1084,6 +1084,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
int y = event->y() - m_rect.top() + rtop - 15; int y = event->y() - m_rect.top() + rtop - 15;
//QDateTime dt1=QDateTime::fromTime_t(hl_day*86400).toLocalTime(); //QDateTime dt1=QDateTime::fromTime_t(hl_day*86400).toLocalTime();
QDateTime dt2 = QDateTime::fromTime_t(hl_day * 86400).toUTC(); QDateTime dt2 = QDateTime::fromTime_t(hl_day * 86400).toUTC();
// QDateTime dt2 = QDateTime::fromTime_t(hl_day * 86400).toLocalTime();
//QTime t1=dt1.time(); //QTime t1=dt1.time();
//QTime t2=dt2.time(); //QTime t2=dt2.time();
@ -1281,6 +1282,7 @@ bool SummaryChart::mouseReleaseEvent(QMouseEvent *event, gGraph *graph)
if (hl_day > 0) { if (hl_day > 0) {
QDateTime d = QDateTime::fromTime_t(hl_day * 86400).toUTC(); QDateTime d = QDateTime::fromTime_t(hl_day * 86400).toUTC();
// QDateTime d = QDateTime::fromTime_t(hl_day * 86400).toLocalTime();
mainwin->getDaily()->LoadDate(d.date()); mainwin->getDaily()->LoadDate(d.date());
mainwin->JumpDaily(); mainwin->JumpDaily();
//qDebug() << "Jump to daily view?" << d; //qDebug() << "Jump to daily view?" << d;

View File

@ -298,7 +298,7 @@ void gXAxis::paint(QPainter &painter, gGraph &w, const QRegion &region)
if (fitmode == 0) { if (fitmode == 0) {
d = (j / 1000); d = (j / 1000);
QDateTime dt = QDateTime::fromTime_t(d).toUTC(); QDateTime dt = QDateTime::fromTime_t(d).toLocalTime();
QDate date = dt.date(); QDate date = dt.date();
// SLOW SLOW SLOW!!! On Mac especially, this function is pathetically slow. // SLOW SLOW SLOW!!! On Mac especially, this function is pathetically slow.
//dt.toString("MMM dd"); //dt.toString("MMM dd");
@ -403,7 +403,7 @@ void gXAxisDay::paint(QPainter &painter, gGraph &graph, const QRegion &region)
minx = graph.min_x; minx = graph.min_x;
maxx = graph.max_x; maxx = graph.max_x;
QDateTime date2 = QDateTime::fromMSecsSinceEpoch(minx, Qt::UTC); QDateTime date2 = QDateTime::fromMSecsSinceEpoch(minx, Qt::LocalTime);
// QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(maxx, Qt::UTC); // QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(maxx, Qt::UTC);
//qInfo() << "Drawing date axis from " << date2 << " to " << enddate2; //qInfo() << "Drawing date axis from " << date2 << " to " << enddate2;

View File

@ -418,7 +418,9 @@ void copyPath(QString src, QString dst)
QString destFile = dst + QDir::separator() + f; QString destFile = dst + QDir::separator() + f;
if (!QFile::exists(destFile)) { if (!QFile::exists(destFile)) {
QFile::copy(srcFile, destFile); if (!QFile::copy(srcFile, destFile)) {
qWarning() << "Could not copy" << srcFile << "to" << destFile;
}
// TODO: Since copyPath is only used by loaders, it should // TODO: Since copyPath is only used by loaders, it should
// build the list of files first, and then update the progress bar // build the list of files first, and then update the progress bar
// while copying. // while copying.

View File

@ -66,7 +66,7 @@ EventDataType EventList::data2(quint32 i)
static QString ts(qint64 msecs) static QString ts(qint64 msecs)
{ {
// TODO: make this UTC so that tests don't vary by where they're run // TODO: make this UTC so that tests don't vary by where they're run
return QDateTime::fromMSecsSinceEpoch(msecs).toString(Qt::ISODate); return QDateTime::fromMSecsSinceEpoch(msecs).toString(Qt::ISODate); //FIXME? LocalTime?
} }
void EventList::AddEvent(qint64 time, EventStoreType data) void EventList::AddEvent(qint64 time, EventStoreType data)

View File

@ -296,6 +296,7 @@ void BackupJournal(QString filename)
QFile file(filename); QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qWarning() << "Couldn't open journal file" << filename << "error code" << file.error() << file.errorString();
return; return;
} }

View File

@ -142,7 +142,8 @@ bool Machine::saveSessionInfo()
QString filename = getDataPath() + "Sessions.info"; QString filename = getDataPath() + "Sessions.info";
QFile file(filename); QFile file(filename);
if (!file.open(QFile::WriteOnly)) { if (!file.open(QFile::WriteOnly)) {
qDebug() << "Couldn't open" << filename << "for writing"; // qDebug() << "Couldn't open" << filename << "for writing";
qWarning() << "Couldn't open" << filename << "for writing, error code" << file.error() << file.errorString();
return false; return false;
} }
@ -898,7 +899,8 @@ bool Machine::LoadSummary(ProgressDialog * progress)
QApplication::processEvents(); QApplication::processEvents();
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Could not open" << filename; // qWarning() << "Could not open" << filename;
qWarning() << "Could not open" << filename << "for reading, error code" << file.error() << file.errorString();
return false; return false;
} }
@ -1113,7 +1115,9 @@ bool Machine::SaveSummaryCache()
QFile file(filename + ".gz"); QFile file(filename + ".gz");
file.open(QFile::WriteOnly); if (!file.open(QFile::WriteOnly)) {
qWarning() << "Couldn't open summary cache" << filename << "for writing, error code" << file.error() << file.errorString();
}
file.write(data); file.write(data);
return true; return true;

View File

@ -177,7 +177,8 @@ bool Preferences::Open(QString filename)
qDebug() << "Opening " << p_filename.toLocal8Bit().data(); qDebug() << "Opening " << p_filename.toLocal8Bit().data();
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Could not open" << p_filename.toLocal8Bit().data() << " Error: " << file.error(); // qWarning() << "Could not open" << p_filename.toLocal8Bit().data() << " Error: " << file.error();
qWarning() << "Could not open preferences file" << filename << "for reading, error code" << file.error() << file.errorString();
return false; return false;
} }
@ -315,9 +316,12 @@ bool Preferences::Open(QString filename)
// Don't do anything if machines.xml already exists.. the user ran the old version! // Don't do anything if machines.xml already exists.. the user ran the old version!
if (!file.exists()) { if (!file.exists()) {
file.open(QFile::WriteOnly); if (!file.open(QFile::WriteOnly)) {
file.write(doc.toByteArray()); qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
file.close(); } else {
file.write(doc.toByteArray());
file.close();
}
} }
} }
return true; return true;
@ -359,6 +363,7 @@ bool Preferences::Save(QString filename)
QFile file(p_filename); QFile file(p_filename);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qWarning() << "Could not open" << p_filename << "for writing, error code" << file.error() << file.errorString();
return false; return false;
} }

View File

@ -169,7 +169,8 @@ bool Profile::OpenMachines()
QString filename = p_path+"machines.xml"; QString filename = p_path+"machines.xml";
QFile file(filename); QFile file(filename);
if (!file.open(QFile::ReadOnly)) { if (!file.open(QFile::ReadOnly)) {
qWarning() << "Could not open" << filename.toLocal8Bit().data(); // qWarning() << "Could not open" << filename.toLocal8Bit().data();
qWarning() << "Could not open" << filename.toLocal8Bit().data() << "for reading, error code" << file.error() << file.errorString();
return false; return false;
} }
QDomDocument doc("machines.xml"); QDomDocument doc("machines.xml");
@ -318,6 +319,7 @@ bool Profile::StoreMachines()
QString filename = p_path+"machines.xml"; QString filename = p_path+"machines.xml";
QFile file(filename); QFile file(filename);
if (!file.open(QFile::WriteOnly)) { if (!file.open(QFile::WriteOnly)) {
qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
return false; return false;
} }
file.write(doc.toByteArray()); file.write(doc.toByteArray());
@ -1068,7 +1070,10 @@ void saveProfileList()
} }
QFile file(filename); QFile file(filename);
file.open(QFile::WriteOnly); if (!file.open(QFile::WriteOnly)) {
qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
return;
}
file.write(doc.toByteArray()); file.write(doc.toByteArray());

View File

@ -446,7 +446,8 @@ bool ChannelList::Load(QString filename)
qDebug() << "Opening " << filename; qDebug() << "Opening " << filename;
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Could not open" << filename; // qWarning() << "Could not open" << filename;
qWarning() << "Could not open" << filename << "for reading, error code" << file.error() << file.errorString();
return false; return false;
} }
@ -715,6 +716,7 @@ bool ChannelList::Save(QString filename)
QFile file(filename); QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
return false; return false;
} }

View File

@ -317,7 +317,8 @@ bool Session::StoreSummary()
dir.mkpath(s_machine->getSummariesPath()); dir.mkpath(s_machine->getSummariesPath());
if (!file.open(QIODevice::WriteOnly)) { if (!file.open(QIODevice::WriteOnly)) {
qDebug() << "Summary open for writing failed"; // qWarning() << "Summary open for writing failed" << "error code" << file.error() << file.errorString();
qWarning() << "Could not open summary" << filename << "for writing, error code" << file.error() << file.errorString();
return false; return false;
} }
} }
@ -395,7 +396,7 @@ bool Session::LoadSummary()
QFile file(filename); QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
qDebug() << "Couldn't open summary file" << filename; qWarning() << "Could not open summary file" << filename << "for reading, error code" << file.error() << file.errorString();
return false; return false;
} }
@ -669,7 +670,10 @@ bool Session::StoreEvents()
QString filename = path+QString().sprintf("%08lx.001", s_session); QString filename = path+QString().sprintf("%08lx.001", s_session);
QFile file(filename); QFile file(filename);
file.open(QIODevice::WriteOnly); if (!file.open(QIODevice::WriteOnly)) {
qWarning() << "Could not open events file" << filename << "for writing, error code" << file.error() << file.errorString();
return false;
}
QByteArray headerbytes; QByteArray headerbytes;
QDataStream header(&headerbytes, QIODevice::WriteOnly); QDataStream header(&headerbytes, QIODevice::WriteOnly);
@ -813,7 +817,8 @@ bool Session::LoadEvents(QString filename)
QFile file(filename); QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) { if (!file.open(QIODevice::ReadOnly)) {
qDebug() << "No Event/Waveform data available for" << s_session; // qDebug() << "No Event/Waveform data available for" << s_session;
qWarning() << "No Event/Waveform data available for" << s_session << "filename" << filename << "error code" << file.error() << file.errorString();
return false; return false;
} }

View File

@ -84,7 +84,8 @@ QString AboutDialog::getAbout()
if (clfile.open(QIODevice::ReadOnly)) { if (clfile.open(QIODevice::ReadOnly)) {
text = clfile.readAll(); text = clfile.readAll();
} else } else
qDebug() << "Failed to open About file"; qWarning() << "Could not open" << aboutFile << "for reading, error code" << clfile.error() << clfile.errorString();
// qDebug() << "Failed to open About file";
return text; return text;
} }
@ -96,6 +97,8 @@ QString AboutDialog::getCredits()
QString text = tr("Sorry, could not locate Credits file."); QString text = tr("Sorry, could not locate Credits file.");
if (clfile.open(QIODevice::ReadOnly)) { if (clfile.open(QIODevice::ReadOnly)) {
text = clfile.readAll(); text = clfile.readAll();
} else {
qWarning() << "Could not open" << creditsFile << "for reading, error code" << clfile.error() << clfile.errorString();
} }
return text; return text;
@ -111,6 +114,8 @@ QString AboutDialog::getRelnotes()
//QTextStream ts(&clfile); //QTextStream ts(&clfile);
changeLog = clfile.readAll(); changeLog = clfile.readAll();
} }
else
qWarning() << "Could not open" << relNotesFile << "for reading, error code" << clfile.error() << clfile.errorString();
QString text = "<html>" QString text = "<html>"
"<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head>" "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head>"

View File

@ -145,7 +145,10 @@ void ExportCSV::on_quickRangeCombo_activated(const QString &arg1)
void ExportCSV::on_exportButton_clicked() void ExportCSV::on_exportButton_clicked()
{ {
QFile file(ui->filenameEdit->text()); QFile file(ui->filenameEdit->text());
file.open(QFile::WriteOnly); if (!file.open(QFile::WriteOnly)) {
qWarning() << "Could not open" << ui->filenameEdit->text() << "for writing, error code" << file.error() << file.errorString();
return;
}
QString header; QString header;
const QString sep = ","; const QString sep = ",";
const QString newline = "\n"; const QString newline = "\n";

View File

@ -95,7 +95,7 @@ void LogThread::logToFile()
} }
QString debugLog = GetLogDir() + "/debug.txt"; QString debugLog = GetLogDir() + "/debug.txt";
rotateLogs(debugLog); // keep a limited set of previous logs rotateLogs(debugLog, 4); // keep a limited set of previous logs
strlock.lock(); strlock.lock();
m_logFile = new QFile(debugLog); m_logFile = new QFile(debugLog);

View File

@ -298,7 +298,7 @@ void Overview::on_LineCursorUpdate(double time)
// even though the generated string is displayed to the user // even though the generated string is displayed to the user
// no time zone conversion is neccessary, so pass UTC // no time zone conversion is neccessary, so pass UTC
// to prevent QT from automatically converting to local time // to prevent QT from automatically converting to local time
QDateTime dt = QDateTime::fromMSecsSinceEpoch(time/*, Qt::UTC*/); QDateTime dt = QDateTime::fromMSecsSinceEpoch(time, Qt::LocalTime/*, Qt::UTC*/);
QString txt = dt.toString("dd MMM yyyy (dddd)"); QString txt = dt.toString("dd MMM yyyy (dddd)");
dateLabel->setText(txt); dateLabel->setText(txt);
} else dateLabel->setText(QString(GraphView->emptyText())); } else dateLabel->setText(QString(GraphView->emptyText()));

View File

@ -118,6 +118,7 @@ void Statistics::loadRXChanges()
QString path = p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" ); QString path = p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" );
QFile file(path); QFile file(path);
if (!file.open(QFile::ReadOnly)) { if (!file.open(QFile::ReadOnly)) {
qWarning() << "Could not open" << path << "for reading, error code" << file.error() << file.errorString();
return; return;
} }
QDataStream in(&file); QDataStream in(&file);
@ -143,6 +144,7 @@ void Statistics::saveRXChanges()
QString path = p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" ); QString path = p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" );
QFile file(path); QFile file(path);
if (!file.open(QFile::WriteOnly)) { if (!file.open(QFile::WriteOnly)) {
qWarning() << "Could not open" << path << "for writing, error code" << file.error() << file.errorString();
return; return;
} }
QDataStream out(&file); QDataStream out(&file);

View File

@ -39,7 +39,8 @@ bool ZipFile::Open(const QString & filepath)
m_file.setFileName(filepath); m_file.setFileName(filepath);
bool ok = m_file.open(QIODevice::WriteOnly); bool ok = m_file.open(QIODevice::WriteOnly);
if (!ok) { if (!ok) {
qWarning() << "unable to open" << m_file.fileName(); qWarning() << "Could not open" << m_file.fileName() << "for writing, error code" << m_file.error() << m_file.errorString();
// qWarning() << "unable to open" << m_file.fileName();
return false; return false;
} }
ok = zip_open(m_ctx, m_file); ok = zip_open(m_ctx, m_file);