diff --git a/sleepyhead/SleepLib/day.cpp b/sleepyhead/SleepLib/day.cpp index 700a3279..cc6e29b2 100644 --- a/sleepyhead/SleepLib/day.cpp +++ b/sleepyhead/SleepLib/day.cpp @@ -1424,8 +1424,21 @@ qint64 Day::last(MachineType type) bool Day::removeSession(Session *sess) { - return sessions.removeAll(sess) > 0; + MachineType mt = sess->type(); + bool b = sessions.removeAll(sess) > 0; + if (!searchMachine(mt)) { + machines.remove(mt); + } + return b; } +bool Day::searchMachine(MachineType mt) { + for (int i=0; i < sessions.size(); ++i) { + if (sessions.at(i)->type() == mt) + return true; + } + return false; +} + QString Day::getCPAPMode() { diff --git a/sleepyhead/SleepLib/day.h b/sleepyhead/SleepLib/day.h index 7ec6530f..5e3e2a5f 100644 --- a/sleepyhead/SleepLib/day.h +++ b/sleepyhead/SleepLib/day.h @@ -93,6 +93,8 @@ class Day inline bool hasMachine(MachineType mt) const { return machines.contains(mt); } + bool searchMachine(MachineType mt); + //! \brief Returns the Average of all Sessions setting 'code' for this day EventDataType settings_avg(ChannelID code); diff --git a/sleepyhead/SleepLib/loader_plugins/md300w1_loader.h b/sleepyhead/SleepLib/loader_plugins/md300w1_loader.h index 91b82408..a974eb7c 100644 --- a/sleepyhead/SleepLib/loader_plugins/md300w1_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/md300w1_loader.h @@ -22,8 +22,6 @@ class MD300W1Loader : public SerialOximeter { Q_OBJECT public: - - MD300W1Loader(); virtual ~MD300W1Loader(); diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h index ea8f1d36..3571433e 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h @@ -102,6 +102,7 @@ public: delete event; for (int i=0;i < waveforms.size(); ++i) {delete waveforms.at(i); } } + virtual void run(); PRS1DataChunk * compliance; diff --git a/sleepyhead/SleepLib/loader_plugins/somnopose_loader.h b/sleepyhead/SleepLib/loader_plugins/somnopose_loader.h index ae5f74b0..a04e4437 100644 --- a/sleepyhead/SleepLib/loader_plugins/somnopose_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/somnopose_loader.h @@ -23,6 +23,7 @@ class SomnoposeLoader : public MachineLoader public: SomnoposeLoader(); virtual ~SomnoposeLoader(); + virtual bool Detect(const QString &path) { Q_UNUSED(path); return false; } // bypass autoscanner virtual int Open(QString path); diff --git a/sleepyhead/SleepLib/loader_plugins/zeo_loader.h b/sleepyhead/SleepLib/loader_plugins/zeo_loader.h index 6f6cfb94..c8de86ab 100644 --- a/sleepyhead/SleepLib/loader_plugins/zeo_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/zeo_loader.h @@ -23,6 +23,7 @@ class ZEOLoader : public MachineLoader public: ZEOLoader(); virtual ~ZEOLoader(); + virtual bool Detect(const QString &path) { Q_UNUSED(path); return false; } // bypass autoscanner virtual int Open(QString path); diff --git a/sleepyhead/SleepLib/machine_loader.cpp b/sleepyhead/SleepLib/machine_loader.cpp index cdd0214d..df80de8a 100644 --- a/sleepyhead/SleepLib/machine_loader.cpp +++ b/sleepyhead/SleepLib/machine_loader.cpp @@ -84,7 +84,6 @@ Machine * MachineLoader::lookupMachine(QString serial) return nullptr; } - Machine * MachineLoader::CreateMachine(MachineInfo info, MachineID id) { Q_ASSERT(p_profile != nullptr); diff --git a/sleepyhead/SleepLib/machine_loader.h b/sleepyhead/SleepLib/machine_loader.h index 61c4ef10..29762a35 100644 --- a/sleepyhead/SleepLib/machine_loader.h +++ b/sleepyhead/SleepLib/machine_loader.h @@ -14,10 +14,9 @@ #include "profiles.h" #include "machine.h" - - #include "zlib.h" + class MachineLoader; enum DeviceStatus { NEUTRAL, IMPORTING, LIVE, DETECTING }; diff --git a/sleepyhead/main.cpp b/sleepyhead/main.cpp index 0ce2d30d..202f62a8 100644 --- a/sleepyhead/main.cpp +++ b/sleepyhead/main.cpp @@ -32,6 +32,7 @@ #include "newprofile.h" #include "translation.h" #include "common_gui.h" +#include "SleepLib/machine_loader.h" // Gah! I must add the real darn plugin system one day. @@ -46,6 +47,7 @@ #include "SleepLib/loader_plugins/icon_loader.h" #include "SleepLib/loader_plugins/weinmann_loader.h" + #ifdef Q_WS_X11 #include #endif diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 3c93f0f6..1d581f8e 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -2142,18 +2142,22 @@ void MainWindow::purgeMachine(Machine * mach) daily->clearLastDay(); // otherwise Daily will crash daily->ReloadGraphs(); } - GenerateStatistics(); + //GenerateStatistics(); return; } if (overview) overview->ReloadGraphs(); + QFile rxcache(p_profile->Get("{" + STR_GEN_DataFolder + "}/RXChanges.cache" )); + rxcache.remove(); if (daily) { daily->clearLastDay(); // otherwise Daily will crash daily->ReloadGraphs(); } - GenerateStatistics(); QApplication::processEvents(); + + +// GenerateStatistics(); } void MainWindow::keyPressEvent(QKeyEvent *event)