diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h index 6bf2a256..17dcf9cd 100644 --- a/sleepyhead/SleepLib/common.h +++ b/sleepyhead/SleepLib/common.h @@ -123,6 +123,7 @@ const QString STR_GEN_UpdatesAutoCheck = "Updates_AutoCheck"; const QString STR_GEN_UpdateCheckFrequency = "Updates_CheckFrequency"; const QString STR_GEN_DataFolder = "DataFolder"; +const QString STR_PREF_AllowEventRenaming = "AllowEventRenaming"; const QString STR_PREF_AllowEarlyUpdates = "AllowEarlyUpdates"; const QString STR_PREF_ReimportBackup = "ReimportBackup"; const QString STR_PREF_LastCPAPPath = "LastCPAPPath"; diff --git a/sleepyhead/SleepLib/profiles.h b/sleepyhead/SleepLib/profiles.h index edc83631..b365a753 100644 --- a/sleepyhead/SleepLib/profiles.h +++ b/sleepyhead/SleepLib/profiles.h @@ -304,7 +304,6 @@ const QString STR_CS_AHIReset = "AHIReset"; const QString STR_CS_ClockDrift = "ClockDrift"; const QString STR_CS_LeakRedline = "LeakRedline"; const QString STR_CS_ShowLeakRedline = "ShowLeakRedline"; -const QString STR_CS_AllowEventRenaming = "AllowEventRenaming"; const QString STR_CS_CalculateUnintentionalLeaks = "CalculateUnintentionalLeaks"; const QString STR_CS_4cmH2OLeaks = "Custom4cmH2OLeaks"; @@ -575,8 +574,6 @@ class CPAPSettings : public ProfileSettings initPref(STR_CS_4cmH2OLeaks, 20.167); initPref(STR_CS_20cmH2OLeaks, 48.333); - initPref(STR_CS_AllowEventRenaming, false); - initPref(STR_CS_ClockDrift, (int)0); m_clock_drift = getPref(STR_CS_ClockDrift).toInt(); } @@ -609,7 +606,6 @@ class CPAPSettings : public ProfileSettings bool resyncFromUserFlagging() const { return getPref(STR_CS_ResyncFromUserFlagging).toBool(); } bool autoImport() const { return getPref(STR_CS_AutoImport).toBool(); } bool brickWarning() const { return getPref(STR_CS_BrickWarning).toBool(); } - bool allowEventRenaming() const { return getPref(STR_CS_AllowEventRenaming).toBool(); } bool calculateUnintentionalLeaks() const { return getPref(STR_CS_CalculateUnintentionalLeaks).toBool(); } double custom4cmH2OLeaks() const { return getPref(STR_CS_4cmH2OLeaks).toDouble(); } @@ -647,7 +643,6 @@ class CPAPSettings : public ProfileSettings void setResyncFromUserFlagging(bool b) { setPref(STR_CS_ResyncFromUserFlagging, b); } void setAutoImport(bool b) { setPref(STR_CS_AutoImport, b); } void setBrickWarning(bool b) { setPref(STR_CS_BrickWarning, b); } - void setAllowEventRenaming(bool b) { setPref(STR_CS_AllowEventRenaming, b); } void setCalculateUnintentionalLeaks(bool b) { setPref(STR_CS_CalculateUnintentionalLeaks, b); } void setCustom4cmH2OLeaks(double val) { setPref(STR_CS_4cmH2OLeaks, val); } diff --git a/sleepyhead/SleepLib/schema.cpp b/sleepyhead/SleepLib/schema.cpp index 239e3d36..4437d19e 100644 --- a/sleepyhead/SleepLib/schema.cpp +++ b/sleepyhead/SleepLib/schema.cpp @@ -752,14 +752,17 @@ bool ChannelList::Load(QString filename) } scope = Scopes[scopestr]; - name = e.attribute("name", ""); - details = e.attribute("details", ""); - label = e.attribute("label", ""); - if (name.isEmpty() || details.isEmpty() || label.isEmpty()) { - qWarning() << "Missing name,details or label attribute in" << filename << "line" << line; - continue; - } +// if (PREF[STR_PREF_AllowEventRenaming].toBool()) { + name = e.attribute("name", ""); + details = e.attribute("details", ""); + label = e.attribute("label", ""); + + if (name.isEmpty() || details.isEmpty() || label.isEmpty()) { + qWarning() << "Missing name,details or label attribute in" << filename << "line" << line; + continue; + } + // } unit = e.attribute("unit"); diff --git a/sleepyhead/main.cpp b/sleepyhead/main.cpp index 885dde77..31d5ce0d 100644 --- a/sleepyhead/main.cpp +++ b/sleepyhead/main.cpp @@ -363,6 +363,9 @@ retry_directory: //////////////////////////////////////////////////////////////////////////////////////////// // Register Importer Modules for autoscanner //////////////////////////////////////////////////////////////////////////////////////////// + p_pref = new Preferences("Preferences"); + PREF.Open(); + initialize(); PRS1Loader::Register(); ResmedLoader::Register(); @@ -376,10 +379,8 @@ retry_directory: schema::setOrders(); - p_pref = new Preferences("Preferences"); p_layout = new Preferences("Layout"); - PREF.Open(); LAYOUT.Open(); // Scan for user profiles @@ -401,6 +402,8 @@ retry_directory: PREF.init(STR_GEN_UpdateCheckFrequency, 7); // days PREF.init(STR_PREF_AllowEarlyUpdates, false); + PREF.init(STR_PREF_AllowEventRenaming, true); + //////////////////////////////////////////////////////////////////////////////////////////// // Check when last checked for updates.. //////////////////////////////////////////////////////////////////////////////////////////// diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index a1e89e82..881d3bf4 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -476,9 +476,13 @@ void loadChannels() } chan->setEnabled(enabled); chan->setDefaultColor(color); - chan->setFullname(fullname); - chan->setLabel(label); - chan->setDescription(description); + + if (PREF[STR_PREF_AllowEventRenaming].toBool()) { + chan->setFullname(fullname); + chan->setLabel(label); + chan->setDescription(description); + } + chan->setLowerThreshold(lowerThreshold); chan->setLowerThresholdColor(lowerThresholdColor); chan->setUpperThreshold(upperThreshold); diff --git a/sleepyhead/preferencesdialog.cpp b/sleepyhead/preferencesdialog.cpp index 7b2ed25d..50e7233c 100644 --- a/sleepyhead/preferencesdialog.cpp +++ b/sleepyhead/preferencesdialog.cpp @@ -196,10 +196,12 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) : ui->updateCheckEvery->setValue(PREF[STR_GEN_UpdateCheckFrequency].toInt()); + if (PREF.contains(STR_GEN_UpdatesLastChecked)) { RefreshLastChecked(); } else { ui->updateLastChecked->setText("Never"); } + ui->allowEventRenaming->setChecked(PREF[STR_PREF_AllowEventRenaming].toBool()); ui->overlayFlagsCombo->setCurrentIndex(profile->appearance->overlayType()); ui->overviewLinecharts->setCurrentIndex(profile->appearance->overviewLinechartMode()); @@ -218,7 +220,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) : ui->showUserFlagsInPie->setChecked(profile->cpap->userEventPieChart()); - bool b; ui->calculateUnintentionalLeaks->setChecked(b=profile->cpap->calculateUnintentionalLeaks()); @@ -788,6 +789,7 @@ bool PreferencesDialog::Save() profile->cpap->setUserEventDuplicates(ui->userEventDuplicates->isChecked()); + if ((ui->calculateUnintentionalLeaks->isChecked() != profile->cpap->calculateUnintentionalLeaks()) || (fabs((ui->maskLeaks4Slider->value()/10.0)-profile->cpap->custom4cmH2OLeaks())>.1) || (fabs((ui->maskLeaks20Slider->value()/10.0)-profile->cpap->custom20cmH2OLeaks())>.1)) { @@ -803,6 +805,8 @@ bool PreferencesDialog::Save() PREF[STR_GEN_UpdatesAutoCheck] = ui->automaticallyCheckUpdates->isChecked(); PREF[STR_GEN_UpdateCheckFrequency] = ui->updateCheckEvery->value(); PREF[STR_PREF_AllowEarlyUpdates] = ui->allowEarlyUpdates->isChecked(); + PREF[STR_PREF_AllowEventRenaming] = ui->allowEventRenaming->isChecked(); + PREF["Fonts_Application_Name"] = ui->applicationFont->currentText(); PREF["Fonts_Application_Size"] = ui->applicationFontSize->value();