From 0f2f8f85ba1a3764d89255d5b55eac059c6df21e Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sun, 2 Aug 2015 15:53:09 +1000 Subject: [PATCH] Fix French ResMed leak string, solve Q_FOREACH problem with Qt 5.4.2 --- .../SleepLib/loader_plugins/resmed_loader.cpp | 68 ++++++++++++++----- .../SleepLib/loader_plugins/resmed_loader.h | 2 +- sleepyhead/translation.cpp | 4 +- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp index 4912d134..02b1659f 100644 --- a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "resmed_loader.h" @@ -745,39 +746,61 @@ void ResmedImport::run() } loader->saveMutex.unlock(); - Q_FOREACH(QString file, files[EDF_PLD]) { - loader->LoadPLD(sess, file); + if (files.contains(EDF_PLD)) { + QStringList & sl = files[EDF_PLD]; + for (int i=0; iLoadPLD(sess, file); #ifdef SESSION_DEBUG - sess->session_files.append(file); + sess->session_files.append(file); #endif + } } - Q_FOREACH(QString file, files[EDF_BRP]) { - loader->LoadBRP(sess, file); + if (files.contains(EDF_BRP)) { + QStringList & sl = files[EDF_BRP]; + for (int i=0; iLoadBRP(sess, file); #ifdef SESSION_DEBUG - sess->session_files.append(file); + sess->session_files.append(file); #endif + } } - Q_FOREACH(QString file, files[EDF_SAD]) { - loader->LoadSAD(sess, file); + if (files.contains(EDF_SAD)) { + QStringList & sl = files[EDF_SAD]; + for (int i=0; iLoadSAD(sess, file); #ifdef SESSION_DEBUG - sess->session_files.append(file); + sess->session_files.append(file); #endif + } } - Q_FOREACH(QString file, files[EDF_CSL]) { - loader->LoadCSL(sess, file); + if (files.contains(EDF_CSL)) { + QStringList & sl = files[EDF_CSL]; + for (int i=0; iLoadCSL(sess, file); #ifdef SESSION_DEBUG - sess->session_files.append(file); + sess->session_files.append(file); #endif + } } bool haveeve = false; - Q_FOREACH(QString file, files[EDF_EVE]) { - loader->LoadEVE(sess, file); + if (files.contains(EDF_EVE)) { + QStringList & sl = files[EDF_EVE]; + for (int i=0; iLoadEVE(sess, file); #ifdef SESSION_DEBUG - sess->session_files.append(file); + sess->session_files.append(file); #endif - haveeve = true; + + haveeve = true; + } } if (!haveeve) { @@ -1524,6 +1547,7 @@ int ResmedLoader::scanFiles(Machine * mach, QString datalog_path) QMap newfiles; // used for duplicate checking, and session overlap testing to group sessions QHash > filesbytype; + // Scan through all folders looking for EDF files, skip any already imported and peek inside to get durations for (int d=0; d < dirs.size(); ++d) { dir.setPath(dirs.at(d)); @@ -1587,6 +1611,7 @@ int ResmedLoader::scanFiles(Machine * mach, QString datalog_path) EDForder.push_back(EDF_PLD); EDForder.push_back(EDF_BRP); EDForder.push_back(EDF_SAD); + QHash::iterator gi; for (int i=0; i<3; i++) { EDFType basetype = EDForder.takeFirst(); @@ -1602,6 +1627,14 @@ int ResmedLoader::scanFiles(Machine * mach, QString datalog_path) quint32 end = dur->end; QHash grp; + +// grp[EDF_PLD] = QStringList(); +// grp[EDF_SAD] = QStringList(); +// grp[EDF_BRP] = QStringList(); +// grp[EDF_EVE] = QStringList(); +// grp[EDF_CSL] = QStringList(); + + grp[basetype].append(create_backups ? backup(dur->path, backup_path) : dur->path); @@ -3026,6 +3059,7 @@ void ResInitModelMap() resmed_codes[CPAP_Leak].push_back("Leak"); // Leak Leck Lekk Läck Fuites resmed_codes[CPAP_Leak].push_back("Leck"); resmed_codes[CPAP_Leak].push_back("Fuites"); + resmed_codes[CPAP_Leak].push_back("Fuite"); resmed_codes[CPAP_Leak].push_back("\xE6\xBC\x8F\xE6\xB0\x94"); resmed_codes[CPAP_Leak].push_back("Lekk"); @@ -3102,7 +3136,7 @@ void ResInitModelMap() // PLD file resmed_codes[CPAP_MaskPressure].push_back("MaskPress.2s"); resmed_codes[CPAP_Pressure].push_back("Press.2s"); - //resmed_codes[RMS9_EPRPressure].push_back("EPRPress.2s"); + resmed_codes[CPAP_EPAP].push_back("EPRPress.2s"); resmed_codes[CPAP_Leak].push_back("Leak.2s"); resmed_codes[CPAP_RespRate].push_back("RespRate.2s"); resmed_codes[CPAP_TidalVolume].push_back("TidVol.2s"); diff --git a/sleepyhead/SleepLib/loader_plugins/resmed_loader.h b/sleepyhead/SleepLib/loader_plugins/resmed_loader.h index 3ea70972..1dc1d0bd 100644 --- a/sleepyhead/SleepLib/loader_plugins/resmed_loader.h +++ b/sleepyhead/SleepLib/loader_plugins/resmed_loader.h @@ -360,7 +360,7 @@ struct EDFGroup { class ResmedImport:public ImportTask { public: - ResmedImport(ResmedLoader * l, SessionID s, QHash f, Machine * m): loader(l), sessionid(s), files(f), mach(m) {} + ResmedImport(ResmedLoader * l, SessionID s, QHash grp, Machine * m): loader(l), sessionid(s), files(grp), mach(m) {} virtual ~ResmedImport() {} virtual void run(); diff --git a/sleepyhead/translation.cpp b/sleepyhead/translation.cpp index 615843f6..82d8392b 100644 --- a/sleepyhead/translation.cpp +++ b/sleepyhead/translation.cpp @@ -43,9 +43,7 @@ void initTranslations(QSettings & settings) { QHash langFiles; #ifdef Q_OS_MAC - QString transdir = QDir::cleanPath(QCoreApplication::applicationDirPath() + - "/../Resources/Translations/"); - + QString transdir = QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../Resources/Translations/"); #else const QString transdir = QCoreApplication::applicationDirPath() + "/Translations/"; #endif