diff --git a/sleepyhead/SleepLib/day.cpp b/sleepyhead/SleepLib/day.cpp index df294704..56a6549b 100644 --- a/sleepyhead/SleepLib/day.cpp +++ b/sleepyhead/SleepLib/day.cpp @@ -421,7 +421,8 @@ qint64 Day::total_time() } if (total != d_totaltime) { - qDebug() << "Sessions Times overlaps!" << total << d_totaltime; + // They can overlap.. tough. +// qDebug() << "Sessions Times overlaps!" << total << d_totaltime; } return total; //d_totaltime; diff --git a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp index 55ea1b57..7373c879 100644 --- a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp @@ -1267,6 +1267,12 @@ int ResmedLoader::Open(QString &path, Profile *profile) QString backupfile, backfile, crcfile, yearstr, bkuppath; + // Have to sacrifice these features to get access to summary data. + p_profile->session->setCombineCloseSessions(0); + p_profile->session->setDaySplitTime(QTime(12,0,0)); + p_profile->session->setIgnoreShortSessions(false); + + ///////////////////////////////////////////////////////////////////////////// // Scan through new file list and import sessions ///////////////////////////////////////////////////////////////////////////// diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp index ff5ecc1a..87c6f1c6 100644 --- a/sleepyhead/SleepLib/machine.cpp +++ b/sleepyhead/SleepLib/machine.cpp @@ -118,6 +118,8 @@ QDate Machine::AddSession(Session *s, Profile *p) int combine_sessions = PROFILE.session->combineCloseSessions(); int ignore_sessions = PROFILE.session->ignoreShortSessions(); + // ResMed machines can't do this.. but don't really want to do a slow string compare here + int session_length = s->last() - s->first(); session_length /= 60000; diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 2edb1ac5..f6af9cd0 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -114,6 +114,20 @@ MainWindow::MainWindow(QWidget *parent) : ui->action_Screenshot->setEnabled(false); #endif #endif + auto machines = p_profile->GetMachines(MT_CPAP); + for (auto it = machines.begin(); it != machines.end(); ++it) { + QString mclass=(*it)->GetClass(); + if (mclass == STR_MACH_ResMed) { + qDebug() << "ResMed machine found.. locking Session splitting capabilities"; + + // Have to sacrifice these features to get access to summary data. + p_profile->session->setCombineCloseSessions(0); + p_profile->session->setDaySplitTime(QTime(12,0,0)); + p_profile->session->setIgnoreShortSessions(false); + break; + } + } + overview = nullptr; daily = nullptr; diff --git a/sleepyhead/preferencesdialog.cpp b/sleepyhead/preferencesdialog.cpp index 56672ceb..956a1db6 100644 --- a/sleepyhead/preferencesdialog.cpp +++ b/sleepyhead/preferencesdialog.cpp @@ -70,6 +70,18 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) : }*/ } + auto machines = p_profile->GetMachines(MT_CPAP); + for (auto it = machines.begin(); it != machines.end(); ++it) { + QString mclass=(*it)->GetClass(); + if (mclass == STR_MACH_ResMed) { + ui->combineSlider->setEnabled(false); + ui->IgnoreSlider->setEnabled(false); + ui->timeEdit->setEnabled(false); + break; + } + } + + QLocale locale = QLocale::system(); QString shortformat = locale.dateFormat(QLocale::ShortFormat);