diff --git a/sleepyhead/SleepLib/common.cpp b/sleepyhead/SleepLib/common.cpp
index f10be2c4..39b642fe 100644
--- a/sleepyhead/SleepLib/common.cpp
+++ b/sleepyhead/SleepLib/common.cpp
@@ -267,6 +267,7 @@ QString STR_TR_PrRelief; // Pressure Relief
QString STR_TR_Bookmarks;
QString STR_TR_SleepyHead;
+QString STR_TR_AppVersion;
QString STR_TR_Default;
@@ -461,6 +462,7 @@ void initializeStrings()
STR_TR_Bookmarks = QObject::tr("Bookmarks");
STR_TR_SleepyHead = QObject::tr("SleepyHead");
+ STR_TR_AppVersion = QObject::tr("v%1").arg(VersionString);
STR_TR_Mode = QObject::tr("Mode");
STR_TR_Model = QObject::tr("Model");
diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h
index 098cbf7e..6bf2a256 100644
--- a/sleepyhead/SleepLib/common.h
+++ b/sleepyhead/SleepLib/common.h
@@ -297,6 +297,7 @@ extern QString STR_TR_SensAwake;
extern QString STR_TR_Bookmarks;
extern QString STR_TR_SleepyHead;
+extern QString STR_TR_AppVersion;
extern QString STR_TR_Mode;
extern QString STR_TR_Model;
diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp
index 47ca33ae..a65e2014 100644
--- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp
+++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp
@@ -43,7 +43,12 @@ IntellipapLoader::~IntellipapLoader()
bool IntellipapLoader::Detect(const QString & givenpath)
{
- QDir dir(givenpath);
+ QString path = givenpath;
+ if (path.endsWith("/SL")) {
+ path.chop(3);
+ }
+
+ QDir dir(path);
if (!dir.exists()) {
return false;
@@ -51,6 +56,7 @@ bool IntellipapLoader::Detect(const QString & givenpath)
// Intellipap has a folder called SL in the root directory
if (!dir.cd("SL")) {
+
return false;
}
@@ -66,9 +72,12 @@ int IntellipapLoader::Open(QString path)
{
// Check for SL directory
// Check for DV5MFirm.bin?
- QString newpath;
-
path = path.replace("\\", "/");
+ if (path.endsWith("/SL")) {
+ path.chop(3);
+ }
+ QString newpath = path;
+
QString dirtag = "SL";
@@ -87,7 +96,9 @@ int IntellipapLoader::Open(QString path)
filename = newpath + "/SET1";
QFile f(filename);
- if (!f.exists()) { return -1; }
+ if (!f.exists()) {
+ return -1;
+ }
f.open(QFile::ReadOnly);
QTextStream tstream(&f);
diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp
index 226e84dd..3ca4a2c7 100644
--- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp
+++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp
@@ -1394,14 +1394,14 @@ bool PRS1Import::ParseF0Events()
}
// data1 = buffer[pos++];
- tt = t + qint64((data0+data1)*2) * 1000L;
+ //tt = t - qint64((data0+data1)*2) * 1000L;
if (!Code[12]) {
Code[12] = session->AddEventList(PRS1_0B, EVL_Event);
}
// FIXME
- Code[12]->AddEvent(tt, data0);
+ Code[12]->AddEvent(t, data0);
break;
case 0x0d: // Vibratory Snore
@@ -2937,7 +2937,7 @@ void PRS1Loader::initChannels()
QString(unknownshort).arg(0xa,2,16,QChar('0')),
STR_UNIT_Unknown,
DEFAULT, QColor("black")));
- channel.add(GRP_CPAP, new Channel(PRS1_0B = 0x1155, SPAN, MT_CPAP, SESSION,
+ channel.add(GRP_CPAP, new Channel(PRS1_0B = 0x1155, UNKNOWN, MT_CPAP, SESSION,
"PRS1_0B",
QString(unknownname).arg(0xb,2,16,QChar('0')),
QString(unknowndesc).arg(0xb,2,16,QChar('0')),
diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h
index 0c34abe9..3dc0324b 100644
--- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.h
+++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.h
@@ -20,7 +20,7 @@
//********************************************************************************************
// Please INCREMENT the following value when making changes to this loaders implementation.
//
-const int prs1_data_version = 13;
+const int prs1_data_version = 14;
//
//********************************************************************************************
diff --git a/sleepyhead/SleepLib/loader_plugins/resmed_loader.h b/sleepyhead/SleepLib/loader_plugins/resmed_loader.h
index e569d27d..84beae23 100644
--- a/sleepyhead/SleepLib/loader_plugins/resmed_loader.h
+++ b/sleepyhead/SleepLib/loader_plugins/resmed_loader.h
@@ -20,7 +20,7 @@
//********************************************************************************************
// Please INCREMENT the following value when making changes to this loaders implementation.
//
-const int resmed_data_version = 9;
+const int resmed_data_version = 10;
//
//********************************************************************************************
diff --git a/sleepyhead/SleepLib/profiles.cpp b/sleepyhead/SleepLib/profiles.cpp
index d7f1e13b..5b9b9afa 100644
--- a/sleepyhead/SleepLib/profiles.cpp
+++ b/sleepyhead/SleepLib/profiles.cpp
@@ -490,7 +490,7 @@ void Profile::DataFormatError(Machine *m)
QString msg;
msg = ""+QObject::tr("SleepyHead (%1) needs to upgrade its database for %2 %3 %4").
- arg(FullVersionString).
+ arg(VersionString).
arg(m->brand()).arg(m->model()).arg(m->serial())
+ "
";
diff --git a/sleepyhead/UpdaterWindow.cpp b/sleepyhead/UpdaterWindow.cpp
index 253208ad..a893306b 100644
--- a/sleepyhead/UpdaterWindow.cpp
+++ b/sleepyhead/UpdaterWindow.cpp
@@ -187,10 +187,65 @@ void UpdaterWindow::requestFile()
qint64)));
}
+int checkVersionStatus(QString statusstr)
+{
+ if (statusstr.compare("testing", Qt::CaseInsensitive) == 0) return 0;
+ else if (statusstr.compare("beta", Qt::CaseInsensitive) == 0) return 1;
+ else if (statusstr.compare("rc", Qt::CaseInsensitive) == 0) return 2;
+ else if (statusstr.compare("r", Qt::CaseInsensitive) == 0) return 3;
+
+ return 0;
+}
+struct VersionStruct {
+ short major;
+ short minor;
+ short revision;
+ short status;
+ short build;
+};
+
+VersionStruct parseVersion(QString versionstring)
+{
+ static VersionStruct version;
+
+ QStringList parts = versionstring.split(".");
+ bool ok, dodgy = false;
+
+ if (parts.size() < 3) dodgy = true;
+
+ short major = parts[0].toInt(&ok);
+ if (!ok) dodgy = true;
+
+ short minor = parts[1].toInt(&ok);
+ if (!ok) dodgy = true;
+
+ QStringList patchver = parts[2].split("-");
+ if (patchver.size() < 3) dodgy = true;
+
+ short rev = patchver[0].toInt(&ok);
+ if (!ok) dodgy = true;
+
+ short build = patchver[2].toInt(&ok);
+ if (!ok) dodgy = true;
+
+ int status = checkVersionStatus(patchver[1]);
+
+ if (!dodgy) {
+ version.major = major;
+ version.minor = minor;
+ version.revision = rev;
+ version.status = status;
+ version.build = build;
+ }
+ return version;
+}
+
+
// Compare supplied version string with current version
// < 0 = this one is newer or version supplied is dodgy, 0 = same, and > 0 there is a newer version
int compareVersion(QString version)
{
+ // v1.0.0-beta-2
QStringList parts = version.split(".");
bool ok;
@@ -218,8 +273,30 @@ int compareVersion(QString version)
}
QStringList patchver = parts[2].split("-");
- short build = patchver[0].toInt(&ok);
+ if (patchver.size() < 3) {
+ // dodgy version string supplied.
+ return -1;
+ }
+
+ short rev = patchver[0].toInt(&ok);
if (!ok) return -1;
+ if (rev > revision_number) {
+ return 1;
+ } else if (rev < revision_number) {
+ return -1;
+ }
+
+ short build = patchver[2].toInt(&ok);
+ if (!ok) return -1;
+
+ int status = checkVersionStatus(patchver[1]);
+ int rstatus = checkVersionStatus(ReleaseStatus);
+
+ if (status > rstatus) {
+ return 1;
+ } else if (status < rstatus) {
+ return -1;
+ }
if (build > build_number) {
return 1;
@@ -227,26 +304,6 @@ int compareVersion(QString version)
return -1;
}
- if ((patchver[1]=="beta") && (ReleaseStatus!="beta")) {
- return 1;
- } else if (patchver[1] == ReleaseStatus) {
- return 0;
- } else {
- return -1;
- }
-
-// short revision = patchver[0].toInt(&ok);
-// if (!ok) return -1;
-
-// if (revision > revision_number) {
-// return 1;
-// } else if (revision < revision_number) {
-// return -1;
-// }
-
-
- // patchver[1] = tag..
-
// Versions match
return 0;
}
@@ -337,7 +394,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice *dev)
updates.push_back(upq);
}
- if (upd && upd->version > FullVersionString) {
+ if (upd && upd->version > VersionString) {
updates.push_back(upd);
}
@@ -353,12 +410,12 @@ void UpdaterWindow::ParseUpdateXML(QIODevice *dev)
if (compareVersion(release->version)) {
ui->Title->setText("" + tr("A new version of SleepyHead is available!") + "");
info = tr("Shiny new v%1 is available. You're running old and busted v%2").
- arg(latestapp).arg(FullVersionString);
+ arg(latestapp).arg(VersionString);
ui->notesTabWidget->setCurrentIndex(0);
} else {
ui->Title->setText("" + tr("An update for SleepyHead is available.") + "");
info = tr("Version %1 is available. You're currently running v%1").
- arg(latestapp).arg(FullVersionString);
+ arg(latestapp).arg(VersionString);
ui->notesTabWidget->setCurrentIndex(1);
}
@@ -369,7 +426,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice *dev)
for (int i = 0; i < release->updates[platform].size(); i++) {
update = &release->updates[platform][i];
- if ((update->type == "application") && (update->version > FullVersionString)) {
+ if ((update->type == "application") && (update->version > VersionString)) {
notes += "" + tr("SleepyHead v%1 build notes").arg(update->version) + "
" +
update->notes.trimmed() + "
";
} else if ((update->type == "qtlibs") && (update->version > QT_VERSION_STR)) {
diff --git a/sleepyhead/docs/release_notes.html b/sleepyhead/docs/release_notes.html
index 1530e92b..c4196fde 100644
--- a/sleepyhead/docs/release_notes.html
+++ b/sleepyhead/docs/release_notes.html
@@ -1,22 +1,12 @@
-
-
Greetings!
-Sleep Well, and good luck!
-JediMark
- -After four years in the making, this build brings SleepyHead into the final beta phase.
")+ + QObject::tr("Things are not perfect yet, but the focus from now is putting on the finishing touches. ")+ + QObject::tr("This version brings support for the new Philips Respironics DreamStation, and older PRS1 1060P models.
")+ + ""; + + QFile clfile(":/docs/release_notes.html"); + QString changeLog = QObject::tr("Sorry, could not locate changelog."); + if (clfile.open(QIODevice::ReadOnly)) { + QTextStream ts(&clfile); + changeLog = ts.readAll(); + } + + QString html = "" + "" + "" + ""+QObject::tr("Greetings!")+"
"; + + html += welcomeMessage; + + + if (ReleaseStatus != "r") { + html += ""+QObject::tr("Important:")+" " + ""+QObject::tr("As this is a pre-release version, it is recommended that you back up your data folder manually before proceding, because attempting to roll back later may break things.")+"
"; + } + + html += ""+QObject::tr("Sleep Well, and good luck!")+"
" + ""+"JediMark"+"
"
"" + STR_TR_SleepyHead + - QString(" v%1 (%2)").arg(VersionString).arg(ReleaseStatus) + + QString(" %1 ").arg(STR_TR_AppVersion) +
tr("Build Date: %1 %2").arg(__DATE__).arg(__TIME__) +
QString(" " ""+tr("Important Notes:")+" " - +tr("For SleepyHead to be able to locate and read directly from your Oximeter device, you need to ensure the correct device drivers (eg. USB to Serial UART) have been installed on your computer. For more information about this, %1click here%2.").arg("").arg("")+" " + +tr("For SleepyHead to be able to locate and read directly from your Oximeter device, you need to ensure the correct device drivers (eg. USB to Serial UART) have been installed on your computer. For more information about this, %1click here%2.").arg("").arg("")+"" "" +tr("Contec CMS50D+ devices do not have an internal clock, and do not record a starting time. If you do not have a CPAP session to link a recording to, you will have to enter the start time manually after the import process is completed.")+" " "" +tr("Even for devices with an internal clock, it is still recommended to get into the habit of starting oximeter records at the same time as CPAP sessions, because CPAP internal clocks tend to drift over time, and not all can be reset easily.")+" |