mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 19:20:45 +00:00
Fix Viatom loader glitch that prevented saving older sessions in a folder.
This commit is contained in:
parent
f75d5fab9d
commit
75bfdf2142
@ -25,6 +25,7 @@
|
|||||||
<li>[fix] Fix the pressure waveform scale for the BiPAP autoSV Advanced 30 (960T)</li>
|
<li>[fix] Fix the pressure waveform scale for the BiPAP autoSV Advanced 30 (960T)</li>
|
||||||
<li>[fix] Add support for rise time mode on DreamStation BiPAP devices (600X-700X).</li>
|
<li>[fix] Add support for rise time mode on DreamStation BiPAP devices (600X-700X).</li>
|
||||||
<li>[fix] Remove the ramp time and pressure settings when the ramp is disabled on pre-DreamStation devices.</li>
|
<li>[fix] Remove the ramp time and pressure settings when the ramp is disabled on pre-DreamStation devices.</li>
|
||||||
|
<li>[fix] Fix occasional failure to save imported Viatom data.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
<b>Changes and fixes in OSCAR v1.1.0</b>
|
<b>Changes and fixes in OSCAR v1.1.0</b>
|
||||||
|
@ -35,7 +35,7 @@ int
|
|||||||
ViatomLoader::Open(const QString & dirpath)
|
ViatomLoader::Open(const QString & dirpath)
|
||||||
{
|
{
|
||||||
qDebug() << "ViatomLoader::Open(" << dirpath << ")";
|
qDebug() << "ViatomLoader::Open(" << dirpath << ")";
|
||||||
Machine* mach = nullptr;
|
m_mach = nullptr;
|
||||||
int imported = 0;
|
int imported = 0;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
s_unexpectedMessages.clear();
|
s_unexpectedMessages.clear();
|
||||||
@ -47,21 +47,26 @@ ViatomLoader::Open(const QString & dirpath)
|
|||||||
dir.setSorting(QDir::Name);
|
dir.setSorting(QDir::Name);
|
||||||
|
|
||||||
for (auto & fi : dir.entryInfoList()) {
|
for (auto & fi : dir.entryInfoList()) {
|
||||||
mach = OpenFile(fi.canonicalFilePath());
|
if (OpenFile(fi.canonicalFilePath())) {
|
||||||
if (mach) imported++;
|
imported++;
|
||||||
|
}
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This filename has already been filtered by QFileDialog.
|
// This filename has already been filtered by QFileDialog.
|
||||||
mach = OpenFile(dirpath);
|
if (OpenFile(dirpath)) {
|
||||||
if (mach) imported++;
|
imported++;
|
||||||
|
}
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Machine* mach = m_mach;
|
||||||
|
if (imported && mach == nullptr) qWarning() << "No machine record created?";
|
||||||
if (mach) {
|
if (mach) {
|
||||||
qDebug() << "Imported" << imported << "sessions";
|
qDebug() << "Imported" << imported << "sessions";
|
||||||
mach->Save();
|
mach->Save();
|
||||||
@ -87,7 +92,7 @@ ViatomLoader::Open(const QString & dirpath)
|
|||||||
return imported;
|
return imported;
|
||||||
}
|
}
|
||||||
|
|
||||||
Machine* ViatomLoader::OpenFile(const QString & filename)
|
bool ViatomLoader::OpenFile(const QString & filename)
|
||||||
{
|
{
|
||||||
Machine* mach = nullptr;
|
Machine* mach = nullptr;
|
||||||
|
|
||||||
@ -95,9 +100,10 @@ Machine* ViatomLoader::OpenFile(const QString & filename)
|
|||||||
if (sess) {
|
if (sess) {
|
||||||
SaveSessionToDatabase(sess);
|
SaveSessionToDatabase(sess);
|
||||||
mach = sess->machine();
|
mach = sess->machine();
|
||||||
|
m_mach = mach;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mach;
|
return mach != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Session* ViatomLoader::ParseFile(const QString & filename)
|
Session* ViatomLoader::ParseFile(const QString & filename)
|
||||||
|
@ -44,12 +44,13 @@ class ViatomLoader : public MachineLoader
|
|||||||
//Machine *CreateMachine();
|
//Machine *CreateMachine();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Machine* OpenFile(const QString & filename);
|
bool OpenFile(const QString & filename);
|
||||||
void SaveSessionToDatabase(Session* session);
|
void SaveSessionToDatabase(Session* session);
|
||||||
|
|
||||||
void AddEvent(ChannelID channel, qint64 t, EventDataType value);
|
void AddEvent(ChannelID channel, qint64 t, EventDataType value);
|
||||||
void EndEventList(ChannelID channel, qint64 t);
|
void EndEventList(ChannelID channel, qint64 t);
|
||||||
|
|
||||||
|
Machine* m_mach;
|
||||||
Session* m_session;
|
Session* m_session;
|
||||||
qint64 m_step;
|
qint64 m_step;
|
||||||
QHash<ChannelID, EventList*> m_importChannels;
|
QHash<ChannelID, EventList*> m_importChannels;
|
||||||
|
Loading…
Reference in New Issue
Block a user