diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html
index 8729dc4f..81f1be2b 100644
--- a/Htmldocs/release_notes.html
+++ b/Htmldocs/release_notes.html
@@ -23,6 +23,7 @@
[new] Privacy feature allows suppressing profile info in Statistics page and printed reports.
[new] Add option to print reports in black and white (monochrome).
[new] Hold down the Shift key while selecting a range on a chart to measure the duration without zooming.
+ [new] Allow second (or more) import on same day for ResMed data.
[fix] Improve support for rare events in 50-series Philips Respironics devices.
[fix] Improve warning on Daily page when settings are missing.
[fix] No longer zoom charts to maximum when clicking on chart with popup menu present.
@@ -35,6 +36,7 @@
[fix] Hours used on Welcome and Daily page are now hours of CPAP machine use.
[fix] Popout graphs now limited to desktop height and multiple popout graphs work better.
[fix] Overview tooltips now list chart components in same order as displayed in chart.
+ [fix] Overview graphs now show last day on charts for timezones near GMT.
Changes and fixes in OSCAR v1.1.1
diff --git a/oscar/Graphs/gGraphView.cpp b/oscar/Graphs/gGraphView.cpp
index 54274008..5f6b99ec 100644
--- a/oscar/Graphs/gGraphView.cpp
+++ b/oscar/Graphs/gGraphView.cpp
@@ -717,7 +717,7 @@ void gGraphView::dumpInfo()
Day * day = p_profile->GetGoodDay(date, MT_CPAP);
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")));
QHash > list;
@@ -3189,7 +3189,7 @@ void gGraphView::keyPressEvent(QKeyEvent *event)
m_metaselect=false;
qint64 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")));
m_graphs[m_graph_index]->cancelSelection();
diff --git a/oscar/Graphs/gSessionTimesChart.cpp b/oscar/Graphs/gSessionTimesChart.cpp
index 766340d2..b2d314f0 100644
--- a/oscar/Graphs/gSessionTimesChart.cpp
+++ b/oscar/Graphs/gSessionTimesChart.cpp
@@ -89,8 +89,8 @@ void gSummaryChart::SetDay(Day *unused_day)
date = date.addDays(1);
} while (date <= lastday);
- m_minx = QDateTime(firstday, QTime(0,0,0), Qt::UTC).toMSecsSinceEpoch();
- m_maxx = QDateTime(lastday, QTime(23,59,59), Qt::UTC).toMSecsSinceEpoch();
+ m_minx = QDateTime(firstday, QTime(0,0,0), Qt::LocalTime).toMSecsSinceEpoch();
+ m_maxx = QDateTime(lastday, QTime(23,59,59), Qt::LocalTime).toMSecsSinceEpoch();
m_miny = 0;
m_maxy = 20;
@@ -148,7 +148,7 @@ bool gSummaryChart::mouseReleaseEvent(QMouseEvent *event, gGraph *graph)
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);
@@ -415,8 +415,8 @@ void gSummaryChart::paint(QPainter &painter, gGraph &graph, const QRegion ®io
m_minx = graph.min_x;
m_maxx = graph.max_x;
- QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::UTC);
- QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::UTC);
+ QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::LocalTime);
+ QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::LocalTime);
QDate date = date2.date();
QDate enddate = enddate2.date();
@@ -839,8 +839,8 @@ void gSessionTimesChart::paint(QPainter &painter, gGraph &graph, const QRegion &
m_minx = graph.min_x;
m_maxx = graph.max_x;
- QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::UTC);
- QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::UTC);
+ QDateTime date2 = QDateTime::fromMSecsSinceEpoch(m_minx, Qt::LocalTime);
+ QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(m_maxx, Qt::LocalTime);
QDate date = date2.date();
QDate enddate = enddate2.date();
diff --git a/oscar/Graphs/gSummaryChart.cpp b/oscar/Graphs/gSummaryChart.cpp
index d245ee5c..64f6c254 100644
--- a/oscar/Graphs/gSummaryChart.cpp
+++ b/oscar/Graphs/gSummaryChart.cpp
@@ -1084,6 +1084,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
int y = event->y() - m_rect.top() + rtop - 15;
//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).toLocalTime();
//QTime t1=dt1.time();
//QTime t2=dt2.time();
@@ -1281,6 +1282,7 @@ bool SummaryChart::mouseReleaseEvent(QMouseEvent *event, gGraph *graph)
if (hl_day > 0) {
QDateTime d = QDateTime::fromTime_t(hl_day * 86400).toUTC();
+// QDateTime d = QDateTime::fromTime_t(hl_day * 86400).toLocalTime();
mainwin->getDaily()->LoadDate(d.date());
mainwin->JumpDaily();
//qDebug() << "Jump to daily view?" << d;
diff --git a/oscar/Graphs/gXAxis.cpp b/oscar/Graphs/gXAxis.cpp
index 7239da73..bd3e6b60 100644
--- a/oscar/Graphs/gXAxis.cpp
+++ b/oscar/Graphs/gXAxis.cpp
@@ -298,7 +298,7 @@ void gXAxis::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
if (fitmode == 0) {
d = (j / 1000);
- QDateTime dt = QDateTime::fromTime_t(d).toUTC();
+ QDateTime dt = QDateTime::fromTime_t(d).toLocalTime();
QDate date = dt.date();
// SLOW SLOW SLOW!!! On Mac especially, this function is pathetically slow.
//dt.toString("MMM dd");
@@ -403,7 +403,7 @@ void gXAxisDay::paint(QPainter &painter, gGraph &graph, const QRegion ®ion)
minx = graph.min_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);
//qInfo() << "Drawing date axis from " << date2 << " to " << enddate2;
diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp
index ec91ce42..1f69325e 100644
--- a/oscar/SleepLib/common.cpp
+++ b/oscar/SleepLib/common.cpp
@@ -418,7 +418,9 @@ void copyPath(QString src, QString dst)
QString destFile = dst + QDir::separator() + f;
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
// build the list of files first, and then update the progress bar
// while copying.
diff --git a/oscar/SleepLib/event.cpp b/oscar/SleepLib/event.cpp
index b41d2577..59895915 100644
--- a/oscar/SleepLib/event.cpp
+++ b/oscar/SleepLib/event.cpp
@@ -66,7 +66,7 @@ EventDataType EventList::data2(quint32 i)
static QString ts(qint64 msecs)
{
// 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)
diff --git a/oscar/SleepLib/journal.cpp b/oscar/SleepLib/journal.cpp
index e3546427..56ddff0d 100644
--- a/oscar/SleepLib/journal.cpp
+++ b/oscar/SleepLib/journal.cpp
@@ -296,6 +296,7 @@ void BackupJournal(QString filename)
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
+ qWarning() << "Couldn't open journal file" << filename << "error code" << file.error() << file.errorString();
return;
}
diff --git a/oscar/SleepLib/machine.cpp b/oscar/SleepLib/machine.cpp
index 20a4888f..6aa183cc 100644
--- a/oscar/SleepLib/machine.cpp
+++ b/oscar/SleepLib/machine.cpp
@@ -142,7 +142,8 @@ bool Machine::saveSessionInfo()
QString filename = getDataPath() + "Sessions.info";
QFile file(filename);
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;
}
@@ -898,7 +899,8 @@ bool Machine::LoadSummary(ProgressDialog * progress)
QApplication::processEvents();
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;
}
@@ -1113,7 +1115,9 @@ bool Machine::SaveSummaryCache()
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);
return true;
diff --git a/oscar/SleepLib/preferences.cpp b/oscar/SleepLib/preferences.cpp
index d1c3bd91..3e187094 100644
--- a/oscar/SleepLib/preferences.cpp
+++ b/oscar/SleepLib/preferences.cpp
@@ -177,7 +177,8 @@ bool Preferences::Open(QString filename)
qDebug() << "Opening " << p_filename.toLocal8Bit().data();
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;
}
@@ -315,9 +316,12 @@ bool Preferences::Open(QString filename)
// Don't do anything if machines.xml already exists.. the user ran the old version!
if (!file.exists()) {
- file.open(QFile::WriteOnly);
- file.write(doc.toByteArray());
- file.close();
+ if (!file.open(QFile::WriteOnly)) {
+ qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
+ } else {
+ file.write(doc.toByteArray());
+ file.close();
+ }
}
}
return true;
@@ -359,6 +363,7 @@ bool Preferences::Save(QString filename)
QFile file(p_filename);
if (!file.open(QIODevice::WriteOnly)) {
+ qWarning() << "Could not open" << p_filename << "for writing, error code" << file.error() << file.errorString();
return false;
}
diff --git a/oscar/SleepLib/profiles.cpp b/oscar/SleepLib/profiles.cpp
index e9b58a21..eac6e6f1 100644
--- a/oscar/SleepLib/profiles.cpp
+++ b/oscar/SleepLib/profiles.cpp
@@ -169,7 +169,8 @@ bool Profile::OpenMachines()
QString filename = p_path+"machines.xml";
QFile file(filename);
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;
}
QDomDocument doc("machines.xml");
@@ -318,6 +319,7 @@ bool Profile::StoreMachines()
QString filename = p_path+"machines.xml";
QFile file(filename);
if (!file.open(QFile::WriteOnly)) {
+ qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
return false;
}
file.write(doc.toByteArray());
@@ -1068,7 +1070,10 @@ void saveProfileList()
}
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());
diff --git a/oscar/SleepLib/schema.cpp b/oscar/SleepLib/schema.cpp
index 6faf5859..fda3bb1e 100644
--- a/oscar/SleepLib/schema.cpp
+++ b/oscar/SleepLib/schema.cpp
@@ -446,7 +446,8 @@ bool ChannelList::Load(QString filename)
qDebug() << "Opening " << filename;
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;
}
@@ -715,6 +716,7 @@ bool ChannelList::Save(QString filename)
QFile file(filename);
if (!file.open(QIODevice::WriteOnly)) {
+ qWarning() << "Could not open" << filename << "for writing, error code" << file.error() << file.errorString();
return false;
}
diff --git a/oscar/SleepLib/session.cpp b/oscar/SleepLib/session.cpp
index 218cb9c1..d5427d8f 100644
--- a/oscar/SleepLib/session.cpp
+++ b/oscar/SleepLib/session.cpp
@@ -317,7 +317,8 @@ bool Session::StoreSummary()
dir.mkpath(s_machine->getSummariesPath());
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;
}
}
@@ -395,7 +396,7 @@ bool Session::LoadSummary()
QFile file(filename);
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;
}
@@ -669,7 +670,10 @@ bool Session::StoreEvents()
QString filename = path+QString().sprintf("%08lx.001", s_session);
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;
QDataStream header(&headerbytes, QIODevice::WriteOnly);
@@ -813,7 +817,8 @@ bool Session::LoadEvents(QString filename)
QFile file(filename);
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;
}
diff --git a/oscar/aboutdialog.cpp b/oscar/aboutdialog.cpp
index dc713610..4f382f88 100644
--- a/oscar/aboutdialog.cpp
+++ b/oscar/aboutdialog.cpp
@@ -84,7 +84,8 @@ QString AboutDialog::getAbout()
if (clfile.open(QIODevice::ReadOnly)) {
text = clfile.readAll();
} 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;
}
@@ -96,6 +97,8 @@ QString AboutDialog::getCredits()
QString text = tr("Sorry, could not locate Credits file.");
if (clfile.open(QIODevice::ReadOnly)) {
text = clfile.readAll();
+ } else {
+ qWarning() << "Could not open" << creditsFile << "for reading, error code" << clfile.error() << clfile.errorString();
}
return text;
@@ -111,6 +114,8 @@ QString AboutDialog::getRelnotes()
//QTextStream ts(&clfile);
changeLog = clfile.readAll();
}
+ else
+ qWarning() << "Could not open" << relNotesFile << "for reading, error code" << clfile.error() << clfile.errorString();
QString text = ""
""
diff --git a/oscar/exportcsv.cpp b/oscar/exportcsv.cpp
index 25f3fbbb..a5a21e80 100644
--- a/oscar/exportcsv.cpp
+++ b/oscar/exportcsv.cpp
@@ -145,7 +145,10 @@ void ExportCSV::on_quickRangeCombo_activated(const QString &arg1)
void ExportCSV::on_exportButton_clicked()
{
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;
const QString sep = ",";
const QString newline = "\n";
diff --git a/oscar/logger.cpp b/oscar/logger.cpp
index 8c1ade84..0d06d0ba 100644
--- a/oscar/logger.cpp
+++ b/oscar/logger.cpp
@@ -95,7 +95,7 @@ void LogThread::logToFile()
}
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();
m_logFile = new QFile(debugLog);
diff --git a/oscar/overview.cpp b/oscar/overview.cpp
index af59d931..de2b930b 100644
--- a/oscar/overview.cpp
+++ b/oscar/overview.cpp
@@ -298,7 +298,7 @@ void Overview::on_LineCursorUpdate(double time)
// even though the generated string is displayed to the user
// no time zone conversion is neccessary, so pass UTC
// 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)");
dateLabel->setText(txt);
} else dateLabel->setText(QString(GraphView->emptyText()));
diff --git a/oscar/statistics.cpp b/oscar/statistics.cpp
index df4b00a3..69a3072c 100644
--- a/oscar/statistics.cpp
+++ b/oscar/statistics.cpp
@@ -118,6 +118,7 @@ void Statistics::loadRXChanges()
QString path = p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" );
QFile file(path);
if (!file.open(QFile::ReadOnly)) {
+ qWarning() << "Could not open" << path << "for reading, error code" << file.error() << file.errorString();
return;
}
QDataStream in(&file);
@@ -143,6 +144,7 @@ void Statistics::saveRXChanges()
QString path = p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" );
QFile file(path);
if (!file.open(QFile::WriteOnly)) {
+ qWarning() << "Could not open" << path << "for writing, error code" << file.error() << file.errorString();
return;
}
QDataStream out(&file);
diff --git a/oscar/zip.cpp b/oscar/zip.cpp
index 48c51fa8..def2b80a 100644
--- a/oscar/zip.cpp
+++ b/oscar/zip.cpp
@@ -39,7 +39,8 @@ bool ZipFile::Open(const QString & filepath)
m_file.setFileName(filepath);
bool ok = m_file.open(QIODevice::WriteOnly);
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;
}
ok = zip_open(m_ctx, m_file);