diff --git a/Htmldocs/release_notes.html b/Htmldocs/release_notes.html index eccb1c1b..50d8d281 100644 --- a/Htmldocs/release_notes.html +++ b/Htmldocs/release_notes.html @@ -25,6 +25,7 @@
  • [fix] Fix the pressure waveform scale for the BiPAP autoSV Advanced 30 (960T)
  • [fix] Add support for rise time mode on DreamStation BiPAP devices (600X-700X).
  • [fix] Remove the ramp time and pressure settings when the ramp is disabled on pre-DreamStation devices.
  • +
  • [fix] Fix occasional failure to save imported Viatom data.
  • Changes and fixes in OSCAR v1.1.0 diff --git a/oscar/SleepLib/loader_plugins/viatom_loader.cpp b/oscar/SleepLib/loader_plugins/viatom_loader.cpp index d6570c10..c784a779 100644 --- a/oscar/SleepLib/loader_plugins/viatom_loader.cpp +++ b/oscar/SleepLib/loader_plugins/viatom_loader.cpp @@ -35,7 +35,7 @@ int ViatomLoader::Open(const QString & dirpath) { qDebug() << "ViatomLoader::Open(" << dirpath << ")"; - Machine* mach = nullptr; + m_mach = nullptr; int imported = 0; int found = 0; s_unexpectedMessages.clear(); @@ -47,21 +47,26 @@ ViatomLoader::Open(const QString & dirpath) dir.setSorting(QDir::Name); for (auto & fi : dir.entryInfoList()) { - mach = OpenFile(fi.canonicalFilePath()); - if (mach) imported++; + if (OpenFile(fi.canonicalFilePath())) { + imported++; + } found++; } } else { // This filename has already been filtered by QFileDialog. - mach = OpenFile(dirpath); - if (mach) imported++; + if (OpenFile(dirpath)) { + imported++; + } found++; } if (!found) { return -1; } + + Machine* mach = m_mach; + if (imported && mach == nullptr) qWarning() << "No machine record created?"; if (mach) { qDebug() << "Imported" << imported << "sessions"; mach->Save(); @@ -87,7 +92,7 @@ ViatomLoader::Open(const QString & dirpath) return imported; } -Machine* ViatomLoader::OpenFile(const QString & filename) +bool ViatomLoader::OpenFile(const QString & filename) { Machine* mach = nullptr; @@ -95,9 +100,10 @@ Machine* ViatomLoader::OpenFile(const QString & filename) if (sess) { SaveSessionToDatabase(sess); mach = sess->machine(); + m_mach = mach; } - return mach; + return mach != nullptr; } Session* ViatomLoader::ParseFile(const QString & filename) diff --git a/oscar/SleepLib/loader_plugins/viatom_loader.h b/oscar/SleepLib/loader_plugins/viatom_loader.h index 55fe88f3..9e2dfc9b 100644 --- a/oscar/SleepLib/loader_plugins/viatom_loader.h +++ b/oscar/SleepLib/loader_plugins/viatom_loader.h @@ -44,12 +44,13 @@ class ViatomLoader : public MachineLoader //Machine *CreateMachine(); protected: - Machine* OpenFile(const QString & filename); + bool OpenFile(const QString & filename); void SaveSessionToDatabase(Session* session); void AddEvent(ChannelID channel, qint64 t, EventDataType value); void EndEventList(ChannelID channel, qint64 t); + Machine* m_mach; Session* m_session; qint64 m_step; QHash m_importChannels;