From b83582744d3897b454c7e3316fc03c91525b90d5 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 7 Aug 2014 00:06:44 +1000 Subject: [PATCH] Channel editor in preferences, and flag persistence --- .../loader_plugins/intellipap_loader.cpp | 22 +- .../loader_plugins/intellipap_loader.h | 2 + .../SleepLib/loader_plugins/prs1_loader.cpp | 30 ++- .../SleepLib/loader_plugins/prs1_loader.h | 2 + .../SleepLib/loader_plugins/resmed_loader.cpp | 36 ++- .../SleepLib/loader_plugins/resmed_loader.h | 2 + .../loader_plugins/weinmann_loader.cpp | 21 +- .../SleepLib/loader_plugins/weinmann_loader.h | 2 + sleepyhead/SleepLib/machine_loader.cpp | 1 + sleepyhead/SleepLib/machine_loader.h | 4 +- sleepyhead/SleepLib/schema.cpp | 28 ++- sleepyhead/SleepLib/schema.h | 2 + sleepyhead/docs/channels.xml | 5 - sleepyhead/mainwindow.cpp | 129 +++++++++++ sleepyhead/preferencesdialog.cpp | 217 +++++++++++++----- sleepyhead/preferencesdialog.h | 15 +- sleepyhead/preferencesdialog.ui | 102 ++++---- 17 files changed, 442 insertions(+), 178 deletions(-) diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp index e540899c..9adc6285 100644 --- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp @@ -581,16 +581,8 @@ int IntellipapLoader::Open(QString path) return c; } -bool intellipap_initialized = false; -void IntellipapLoader::Register() +void IntellipapLoader::initChannels() { - if (intellipap_initialized) { return; } - - qDebug() << "Registering IntellipapLoader"; - RegisterLoader(new IntellipapLoader()); - //InitModelMap(); - intellipap_initialized = true; - using namespace schema; Channel * chan = nullptr; channel.add(GRP_CPAP, chan = new Channel(INTP_SmartFlexMode = 0x1165, SETTING, SESSION, @@ -610,3 +602,15 @@ void IntellipapLoader::Register() QObject::tr("SmartFlex Level"), "", DEFAULT, Qt::green)); } + +bool intellipap_initialized = false; +void IntellipapLoader::Register() +{ + if (intellipap_initialized) { return; } + + qDebug() << "Registering IntellipapLoader"; + RegisterLoader(new IntellipapLoader()); + //InitModelMap(); + intellipap_initialized = true; + +} diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.h b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.h index 45adc508..4e3eb8e2 100644 --- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.h @@ -75,6 +75,8 @@ class IntellipapLoader : public CPAPLoader virtual MachineInfo newInfo() { return MachineInfo(MT_CPAP, 0, intellipap_class_name, QObject::tr("DeVilbiss"), QString(), QString(), QString(), QObject::tr("Intellipap"), QDateTime::currentDateTime(), intellipap_data_version); } + virtual void initChannels(); + //////////////////////////////////////////////////////////////////////////////////////////////////////////// // Now for some CPAPLoader overrides diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index 74bfd5df..92828a59 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -1447,7 +1447,7 @@ bool PRS1Import::ParseSummaryF5() session->settings[CPAP_RampPressure] = ramp_pressure; - int duration=data[0x1B] | data[0x1C] << 8; + int duration=data[0x18] | data[0x19] << 8; session->set_last(qint64(summary->timestamp+duration) * 1000L); return true; @@ -1985,14 +1985,9 @@ using namespace schema; Channel PRS1Channels; -void PRS1Loader::Register() +void PRS1Loader::initChannels() { - if (initialized) { return; } - - qDebug() << "Registering PRS1Loader"; - RegisterLoader(new PRS1Loader()); - InitModelMap(); - initialized = true; + Channel * chan = nullptr; channel.add(GRP_CPAP, new Channel(CPAP_PressurePulse = 0x1009, MINOR_FLAG, SESSION, "PressurePulse", @@ -2001,9 +1996,6 @@ void PRS1Loader::Register() QObject::tr("PP"), STR_UNIT_EventsPerHour, DEFAULT, QColor("dark red"))); - - - Channel * chan = nullptr; channel.add(GRP_CPAP, chan = new Channel(PRS1_FlexMode = 0xe105, SETTING, SESSION, "PRS1FlexMode", QObject::tr("Flex Mode"), QObject::tr("PRS1 pressure relief mode."), @@ -2137,8 +2129,6 @@ void PRS1Loader::Register() //