mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
In Preferences, ask if ResMed when no machines; force ResMed prefs when yes. Also in ResMed loader
This commit is contained in:
parent
58a7f3f13d
commit
0afaec53b5
@ -360,6 +360,7 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
firstImportDay = lastDate.addDays(-1);
|
firstImportDay = lastDate.addDays(-1);
|
||||||
} else { // Starting from new beginnings - new or purged
|
} else { // Starting from new beginnings - new or purged
|
||||||
qDebug() << "New machine or just purged";
|
qDebug() << "New machine or just purged";
|
||||||
|
p_profile->forceResmedPrefs();
|
||||||
QDateTime ignoreBefore = p_profile->session->ignoreOlderSessionsDate();
|
QDateTime ignoreBefore = p_profile->session->ignoreOlderSessionsDate();
|
||||||
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
||||||
mach = p_profile->CreateMachine( info );
|
mach = p_profile->CreateMachine( info );
|
||||||
@ -949,7 +950,7 @@ void ResmedLoader::ProcessSTRfiles(Machine *mach, QMap<QDate, STRFile> & STRmap,
|
|||||||
// if (ignoreOldSessions) {
|
// if (ignoreOldSessions) {
|
||||||
if (date < firstImport) {
|
if (date < firstImport) {
|
||||||
#ifdef SESSION_DEBUG
|
#ifdef SESSION_DEBUG
|
||||||
qDebug() << "Skipping" << date.toString() << "Before" << ignoreBefore.date().toString();
|
qDebug() << "Skipping" << date.toString() << "Before" << firstImport.toString();
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,17 @@ qint64 Profile::diskSpace()
|
|||||||
return (diskSpaceSummaries()+diskSpaceEvents()+diskSpaceBackups());
|
return (diskSpaceSummaries()+diskSpaceEvents()+diskSpaceBackups());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Profile::forceResmedPrefs()
|
||||||
|
{
|
||||||
|
session->setBackupCardData(true);
|
||||||
|
session->setDaySplitTime(QTime(12,0,0));
|
||||||
|
session->setIgnoreShortSessions(0);
|
||||||
|
session->setCombineCloseSessions(0);
|
||||||
|
session->setLockSummarySessions(true);
|
||||||
|
general->setPrefCalcPercentile(95.0); // 95%
|
||||||
|
general->setPrefCalcMiddle(0); // Median (50%)
|
||||||
|
general->setPrefCalcMax(1); // 99.9th percentile max
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
class Environment
|
class Environment
|
||||||
|
@ -57,6 +57,9 @@ class Profile : public Preferences
|
|||||||
qint64 diskSpaceBackups();
|
qint64 diskSpaceBackups();
|
||||||
qint64 diskSpace();
|
qint64 diskSpace();
|
||||||
|
|
||||||
|
//! \brief Force some preferences for ResMed machines
|
||||||
|
virtual void forceResmedPrefs();
|
||||||
|
|
||||||
//! \brief Returns hostname that locked profile, or empty string if unlocked
|
//! \brief Returns hostname that locked profile, or empty string if unlocked
|
||||||
QString checkLock();
|
QString checkLock();
|
||||||
|
|
||||||
|
@ -52,12 +52,20 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
channeltype[schema::UNKNOWN] = tr("Always Minor");
|
channeltype[schema::UNKNOWN] = tr("Always Minor");
|
||||||
bool haveResMed = false;
|
bool haveResMed = false;
|
||||||
QList<Machine *> machines = profile->GetMachines(MT_CPAP);
|
QList<Machine *> machines = profile->GetMachines(MT_CPAP);
|
||||||
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
// qDebug() << "Machile list size is" << machines.size();
|
||||||
const QString & mclass=(*it)->loaderName();
|
if ( machines.size() > 0 ) {
|
||||||
if (mclass == STR_MACH_ResMed) {
|
for (QList<Machine *>::iterator it = machines.begin(); it != machines.end(); ++it) {
|
||||||
haveResMed = true;
|
const QString & mclass=(*it)->loaderName();
|
||||||
break;
|
if (mclass == STR_MACH_ResMed) {
|
||||||
|
haveResMed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (QMessageBox::question(this, tr("No CPAP machines detected"),
|
||||||
|
tr("Will you be using a ResMed brand machine?"),
|
||||||
|
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes )
|
||||||
|
haveResMed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOCK_RESMED_SESSIONS
|
#ifdef LOCK_RESMED_SESSIONS
|
||||||
@ -66,21 +74,21 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
ui->ResMedWarning->setVisible(haveResMed);
|
ui->ResMedWarning->setVisible(haveResMed);
|
||||||
|
|
||||||
if (haveResMed) {
|
if (haveResMed) {
|
||||||
|
profile->forceResmedPrefs();
|
||||||
|
// profile->session->setDaySplitTime(QTime(12,0,0));
|
||||||
|
// profile->session->setIgnoreShortSessions(0);
|
||||||
|
// profile->session->setCombineCloseSessions(0);
|
||||||
|
// profile->session->setLockSummarySessions(true);
|
||||||
|
// p_profile->general->setPrefCalcPercentile(95.0); // 95%
|
||||||
|
// p_profile->general->setPrefCalcMiddle(0); // Median (50%)
|
||||||
|
// p_profile->general->setPrefCalcMax(1); // 99.9th percentile max
|
||||||
|
// p_profile->session->setBackupCardData(true);
|
||||||
ui->sessionSplitWidget->setVisible(!haveResMed);
|
ui->sessionSplitWidget->setVisible(!haveResMed);
|
||||||
profile->session->setDaySplitTime(QTime(12,0,0));
|
|
||||||
profile->session->setIgnoreShortSessions(0);
|
|
||||||
profile->session->setCombineCloseSessions(0);
|
|
||||||
profile->session->setLockSummarySessions(true);
|
|
||||||
p_profile->general->setPrefCalcPercentile(95.0); // 95%
|
|
||||||
p_profile->general->setPrefCalcMiddle(0); // Median (50%)
|
|
||||||
p_profile->general->setPrefCalcMax(1); // 99.9th percentile max
|
|
||||||
ui->prefCalcMax->setEnabled(false);
|
ui->prefCalcMax->setEnabled(false);
|
||||||
ui->prefCalcMiddle->setEnabled(false);
|
ui->prefCalcMiddle->setEnabled(false);
|
||||||
ui->prefCalcPercentile->setEnabled(false);
|
ui->prefCalcPercentile->setEnabled(false);
|
||||||
ui->showUnknownFlags->setEnabled(false);
|
ui->showUnknownFlags->setEnabled(false);
|
||||||
ui->calculateUnintentionalLeaks->setEnabled(false);
|
ui->calculateUnintentionalLeaks->setEnabled(false);
|
||||||
|
|
||||||
p_profile->session->setBackupCardData(true);
|
|
||||||
ui->createSDBackups->setChecked(true);
|
ui->createSDBackups->setChecked(true);
|
||||||
ui->createSDBackups->setEnabled(false);
|
ui->createSDBackups->setEnabled(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user