Clinical Mode: Automatic reload of profile when Clinical mode changes

This commit is contained in:
LoudSnorer 2023-12-05 12:28:34 -05:00
parent edeb699841
commit 291b131d11
2 changed files with 12 additions and 6 deletions

View File

@ -367,8 +367,6 @@ class MainWindow : public QMainWindow
void on_profilesButton_clicked(); void on_profilesButton_clicked();
void reloadProfile();
void on_bookmarkView_anchorClicked(const QUrl &arg1); void on_bookmarkView_anchorClicked(const QUrl &arg1);
void on_recordsBox_anchorClicked(const QUrl &linkurl); void on_recordsBox_anchorClicked(const QUrl &linkurl);
@ -377,6 +375,8 @@ class MainWindow : public QMainWindow
void on_actionShowPersonalData_toggled(bool visible); void on_actionShowPersonalData_toggled(bool visible);
public slots:
void reloadProfile();
private: private:
QString getMainWindowTitle(); QString getMainWindowTitle();

View File

@ -55,9 +55,6 @@ QString PreferencesDialog::clinicalHelp() {
<<tr("Permissive Mode:") <<tr("Permissive Mode:")
<<tr("Allows user to select which data sets/ sessions to be used for calculations and display.") <<tr("Allows user to select which data sets/ sessions to be used for calculations and display.")
<<tr("Additional charts and calculations may be available that are not available from the vendor data.") <<tr("Additional charts and calculations may be available that are not available from the vendor data.")
<<""
<<tr("Changing the Oscar Operating Mode:")
<<tr("Requires a reload of the user's profile. Data will be saved and restored.")
<<""; <<"";
return str.join("\n"); return str.join("\n");
} }
@ -861,7 +858,10 @@ bool PreferencesDialog::Save()
AppSetting->setIncludeSerial(ui->includeSerial->isChecked()); AppSetting->setIncludeSerial(ui->includeSerial->isChecked());
AppSetting->setMonochromePrinting(ui->monochromePrinting->isChecked()); AppSetting->setMonochromePrinting(ui->monochromePrinting->isChecked());
p_profile->appearance->setEventFlagSessionBar(ui->eventFlagSessionBar->isChecked()); p_profile->appearance->setEventFlagSessionBar(ui->eventFlagSessionBar->isChecked());
bool clicicalModeChanged = profile->cpap->clinicalMode() != ui->clinicalMode->isChecked() ;
p_profile->cpap->setClinicalMode(ui->clinicalMode->isChecked()); p_profile->cpap->setClinicalMode(ui->clinicalMode->isChecked());
HighResolution::checkBox(true,ui->highResolution); HighResolution::checkBox(true,ui->highResolution);
AppSetting->setGraphTooltips(ui->graphTooltips->isChecked()); AppSetting->setGraphTooltips(ui->graphTooltips->isChecked());
@ -1014,6 +1014,12 @@ bool PreferencesDialog::Save()
profile->Save(); profile->Save();
profile->resetOxiChannelPref(); profile->resetOxiChannelPref();
if (clicicalModeChanged) {
// this fails - causing duplicate reload.
//QTimer::singleShot(0, mainwin, SLOT(reloadProfile()));
// while this one works.
mainwin->reloadProfile();
} else
if (recompress_events) { if (recompress_events) {
mainwin->recompressEvents(); mainwin->recompressEvents();
} else if (recalc_events) { } else if (recalc_events) {
@ -1022,7 +1028,7 @@ bool PreferencesDialog::Save()
} else if (needs_reload) { } else if (needs_reload) {
QTimer::singleShot(0, mainwin, SLOT(reloadProfile())); QTimer::singleShot(0, mainwin, SLOT(reloadProfile()));
} else if (needs_restart) { } else if (needs_restart) {
mainwin->RestartApplication(); mainwin->RestartApplication(true,"-l");
} else { } else {
mainwin->getDaily()->LoadDate(mainwin->getDaily()->getDate()); mainwin->getDaily()->LoadDate(mainwin->getDaily()->getDate());
// Save early.. just in case.. // Save early.. just in case..