diff --git a/sleepyhead/Graphs/MinutesAtPressure.cpp b/sleepyhead/Graphs/MinutesAtPressure.cpp index fe63e6a0..e1a3b980 100644 --- a/sleepyhead/Graphs/MinutesAtPressure.cpp +++ b/sleepyhead/Graphs/MinutesAtPressure.cpp @@ -221,7 +221,7 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r double ystep = double(height) / peak; - double p0, p1, p2, p3; + EventDataType p0, p1, p2, p3; QString label; double s2; int widest_YAxis = 0; @@ -345,25 +345,25 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); xp+=xstep; lastyp = yp; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8f), 0.0f); if (s2 < 0) s2=0; yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); @@ -437,25 +437,25 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2f), 0.0f); yp = qMax(double(bottom-height), double(bottom - (s2 * estep))); painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4f), 0.0f); yp = qMax(double(bottom-height), double(bottom - (s2 * estep))); painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6f), 0.0f); yp = qMax(double(bottom-height), double(bottom - (s2 * estep))); painter.drawLine(xp, lastyp, xp+xstep, yp); xp+=xstep; lastyp = yp; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8f), 0.0f); yp = qMax(double(bottom-height), double(bottom - (s2 * estep))); painter.drawLine(xp, lastyp, xp+xstep, yp); xp+=xstep; @@ -549,25 +549,25 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.2f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.4f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); lastyp = yp; xp += xstep; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.6f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); xp+=xstep; lastyp = yp; - s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8), 0.0f); + s2 = qMax(CatmullRomSpline(p0, p1, p2, p3, 0.8f), 0.0f); yp = qMax(double(bottom-height), (bottom - (s2 * ystep))); painter.drawLine(xp, lastyp, xp+xstep, yp); xp+=xstep; diff --git a/sleepyhead/SleepLib/common.cpp b/sleepyhead/SleepLib/common.cpp index f5132b37..8ce3879c 100644 --- a/sleepyhead/SleepLib/common.cpp +++ b/sleepyhead/SleepLib/common.cpp @@ -9,7 +9,11 @@ #include #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #include "version.h" #include "profiles.h" @@ -603,7 +607,7 @@ QByteArray gUncompress(const QByteArray & data) int ret; z_stream strm; static const int CHUNK_SIZE = 1048576; - char out[CHUNK_SIZE]; + char *out = new char [CHUNK_SIZE]; /* allocate inflate state */ strm.zalloc = Z_NULL; @@ -613,8 +617,10 @@ QByteArray gUncompress(const QByteArray & data) strm.next_in = (Bytef*)(data.data()); ret = inflateInit2(&strm, 15 + 32); // gzip decoding - if (ret != Z_OK) + if (ret != Z_OK) { + delete [] out; return QByteArray(); + } // run inflate() do { @@ -624,6 +630,7 @@ QByteArray gUncompress(const QByteArray & data) ret = inflate(&strm, Z_NO_FLUSH); if (ret == Z_STREAM_ERROR) { qWarning() << "ret == Z_STREAM_ERROR in gzUncompress in common.cpp"; + delete [] out; return QByteArray(); } @@ -634,6 +641,7 @@ QByteArray gUncompress(const QByteArray & data) case Z_MEM_ERROR: Q_UNUSED(ret) (void)inflateEnd(&strm); + delete [] out; return QByteArray(); } @@ -642,5 +650,6 @@ QByteArray gUncompress(const QByteArray & data) // clean up and return inflateEnd(&strm); + delete [] out; return result; } diff --git a/sleepyhead/SleepLib/event.cpp b/sleepyhead/SleepLib/event.cpp index 3d94463f..a90bdbb1 100644 --- a/sleepyhead/SleepLib/event.cpp +++ b/sleepyhead/SleepLib/event.cpp @@ -161,7 +161,7 @@ void EventList::AddWaveform(qint64 start, qint16 *data, int recs, qint64 duratio // EventStoreType *edata = m_data.data(); - EventStoreType raw; + //EventStoreType raw; const qint16 *sp = data; const qint16 *ep = data + recs; EventStoreType *dp = (EventStoreType *)m_data.data()+r; diff --git a/sleepyhead/SleepLib/loader_plugins/edfparser.cpp b/sleepyhead/SleepLib/loader_plugins/edfparser.cpp index d41ccd2a..2e9df0cb 100644 --- a/sleepyhead/SleepLib/loader_plugins/edfparser.cpp +++ b/sleepyhead/SleepLib/loader_plugins/edfparser.cpp @@ -10,8 +10,11 @@ #include #include #include -#include "zlib.h" - +#ifdef _MSC_VER +#include +#else +#include +#endif #include "edfparser.h" diff --git a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp index 3817acf1..9d0872e6 100644 --- a/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/intellipap_loader.cpp @@ -947,8 +947,8 @@ int IntellipapLoader::OpenDV6(const QString & path) if (ts1 >= R->start_time) { if (!flow && R->sess) { - flow = R->sess->AddEventList(CPAP_FlowRate, EVL_Waveform, 1.0/60.0, 0.0, 0.0, 0.0, double(2000) / double(50)); - pressure = R->sess->AddEventList(CPAP_Pressure, EVL_Waveform, 0.1, 0.0, 0.0, 0.0, double(2000) / double(2)); + flow = R->sess->AddEventList(CPAP_FlowRate, EVL_Waveform, 1.0f/60.0f, 0.0f, 0.0f, 0.0f, double(2000) / double(50)); + pressure = R->sess->AddEventList(CPAP_Pressure, EVL_Waveform, 0.1f, 0.0f, 0.0f, 0.0f, double(2000) / double(2)); //leak = R->sess->AddEventList(CPAP_Leak, EVL_Waveform, 1.0, 0.0, 0.0, 0.0, double(2000) / double(1)); OA = R->sess->AddEventList(CPAP_Obstructive, EVL_Event); NOA = R->sess->AddEventList(CPAP_NRI, EVL_Event); diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index be87b650..827eac60 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -1444,12 +1444,12 @@ bool PRS1Import::ParseF3EventsV3() EventList *PTB = session->AddEventList(CPAP_PTB, EVL_Event); EventList *RR = session->AddEventList(CPAP_RespRate, EVL_Event); - EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event, 10.0); + EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event, 10.0f); EventList *MV = session->AddEventList(CPAP_MinuteVent, EVL_Event); EventList *TMV = session->AddEventList(CPAP_Test1, EVL_Event); - EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1); - EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1); + EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event, 0.1f); + EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event, 0.1f); EventList *FLOW = session->AddEventList(CPAP_Test2, EVL_Event); qint64 t = qint64(event->timestamp) * 1000L; //, tt; @@ -1462,7 +1462,7 @@ bool PRS1Import::ParseF3EventsV3() unsigned short delta; bool failed = false; - unsigned char val, val1, val2; + unsigned char val, val2; QString dump; do { @@ -1601,11 +1601,11 @@ bool PRS1Import::ParseF3Events() EventList *ULK = session->AddEventList(CPAP_Leak, EVL_Event); EventList *MV = session->AddEventList(CPAP_MinuteVent, EVL_Event); //EventList *TMV = session->AddEventList(CPAP_TgMV, EVL_Event); - EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event,10.0); + EventList *TV = session->AddEventList(CPAP_TidalVolume, EVL_Event,10.0f); EventList *RR = session->AddEventList(CPAP_RespRate, EVL_Event); EventList *PTB = session->AddEventList(CPAP_PTB, EVL_Event); - EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event,0.1); - EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event,0.1); + EventList *EPAP = session->AddEventList(CPAP_EPAP, EVL_Event,0.1f); + EventList *IPAP = session->AddEventList(CPAP_IPAP, EVL_Event,0.1f); EventList *FLOW = session->AddEventList(CPAP_FlowRate, EVL_Event); int size = event->m_data.size()/0x10; @@ -3089,18 +3089,18 @@ bool PRS1Import::ParseWaveforms() s2 = data[1].size(); if (s1 > 0) { - EventList * flow = session->AddEventList(CPAP_FlowRate, EVL_Waveform, 1.0, 0.0, 0.0, 0.0, double(dur) / double(s1)); + EventList * flow = session->AddEventList(CPAP_FlowRate, EVL_Waveform, 1.0f, 0.0f, 0.0f, 0.0f, double(dur) / double(s1)); flow->AddWaveform(ti, (char *)data[0].data(), data[0].size(), dur); } if (s2 > 0) { - EventList * pres = session->AddEventList(CPAP_MaskPressureHi, EVL_Waveform, 0.1, 0.0, 0.0, 0.0, double(dur) / double(s2)); + EventList * pres = session->AddEventList(CPAP_MaskPressureHi, EVL_Waveform, 0.1f, 0.0f, 0.0f, 0.0f, double(dur) / double(s2)); pres->AddWaveform(ti, (unsigned char *)data[1].data(), data[1].size(), dur); } } else { // Non interleaved, so can process it much faster - EventList * flow = session->AddEventList(CPAP_FlowRate, EVL_Waveform, 1.0, 0.0, 0.0, 0.0, double(dur) / double(waveform->m_data.size())); + EventList * flow = session->AddEventList(CPAP_FlowRate, EVL_Waveform, 1.0f, 0.0f, 0.0f, 0.0f, double(dur) / double(waveform->m_data.size())); flow->AddWaveform(ti, (char *)waveform->m_data.data(), waveform->m_data.size(), dur); } lastti = dur+ti; diff --git a/sleepyhead/SleepLib/machine.cpp b/sleepyhead/SleepLib/machine.cpp index 6dcbeec6..84f316f6 100644 --- a/sleepyhead/SleepLib/machine.cpp +++ b/sleepyhead/SleepLib/machine.cpp @@ -966,7 +966,6 @@ bool Machine::LoadSummary(ProgressDialog * progress) } QByteArray data = file.readAll(); - QByteArray uncompressed = gUncompress(data); QString errorMsg; diff --git a/sleepyhead/SleepLib/machine_loader.h b/sleepyhead/SleepLib/machine_loader.h index 5c4625f2..ad4a8bc1 100644 --- a/sleepyhead/SleepLib/machine_loader.h +++ b/sleepyhead/SleepLib/machine_loader.h @@ -16,7 +16,11 @@ #include "profiles.h" #include "machine.h" +#ifdef _MSC_VER +#include "QtZlib/zlib.h" +#else #include "zlib.h" +#endif class MachineLoader; diff --git a/sleepyhead/help.cpp b/sleepyhead/help.cpp index bee7a2de..0cf07bba 100644 --- a/sleepyhead/help.cpp +++ b/sleepyhead/help.cpp @@ -7,11 +7,7 @@ * for more details. */ -#include -#include -#include -#include -#include +#include #include #include @@ -79,6 +75,7 @@ Help::Help(QWidget *parent) : searchReady = false; helpEngine->searchEngine()->reindexDocumentation(); + helpEngine->setCurrentFilter("SleepyHead 1.1"); } @@ -140,7 +137,7 @@ void Help::on_homeButton_clicked() QByteArray index = helpEngine->fileData(QUrl("qthelp://jedimark.net.sleepyhead.1.1/doc/help_en/index.html")); helpBrowser->setHtml(index); } -void Help::on_searchComplete(int count) +void Help::on_searchComplete(int) { if (!searchReady) { QString html = "

Please wait a bit.. Indexing still in progress

"; diff --git a/sleepyhead/help.h b/sleepyhead/help.h index 862754b2..30e26099 100644 --- a/sleepyhead/help.h +++ b/sleepyhead/help.h @@ -9,6 +9,7 @@ #ifndef HELP_H #define HELP_H +#include #include #include #include @@ -35,6 +36,7 @@ public: explicit Help(QWidget *parent = 0); ~Help(); + void print(QPrinter * printer) { helpBrowser->print(printer); } private slots: void on_backButton_clicked(); diff --git a/sleepyhead/help/help_en.qhp b/sleepyhead/help/help_en.qhp index f168c7d6..f26f9c06 100644 --- a/sleepyhead/help/help_en.qhp +++ b/sleepyhead/help/help_en.qhp @@ -2,7 +2,13 @@ jedimark.net.SleepyHead.1.1 doc + + myapp + 1.0 + + myapp + 1.0
diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index c1b3f714..a9b2b05f 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -556,6 +556,8 @@ int MainWindow::importCPAP(ImportPath import, const QString &message) return 0; } + ui->tabWidget->setCurrentWidget(welcome); + QApplication::processEvents(); ProgressDialog * progdlg = new ProgressDialog(this); QPixmap image = import.loader->getPixmap(import.loader->PeekInfo(import.path).series); @@ -568,6 +570,7 @@ int MainWindow::importCPAP(ImportPath import, const QString &message) progdlg->open(); progdlg->setMessage(message); + connect(import.loader, SIGNAL(updateMessage(QString)), progdlg, SLOT(setMessage(QString))); connect(import.loader, SIGNAL(setProgressMax(int)), progdlg, SLOT(setProgressMax(int))); connect(import.loader, SIGNAL(setProgressValue(int)), progdlg, SLOT(setProgressValue(int))); @@ -813,6 +816,9 @@ void MainWindow::on_action_Import_Data_triggered() } in_import=true; + ui->tabWidget->setCurrentWidget(welcome); + QApplication::processEvents(); + QList datacards = detectCPAPCards(); if (importScanCancelled) { @@ -1391,7 +1397,7 @@ void MainWindow::on_actionPrint_Report_triggered() painter.end(); } else if (ui->tabWidget->currentWidget() == help) { - // help->print(&printer); + help->print(&printer); } } diff --git a/sleepyhead/oximeterimport.cpp b/sleepyhead/oximeterimport.cpp index a9d68114..95035d9a 100644 --- a/sleepyhead/oximeterimport.cpp +++ b/sleepyhead/oximeterimport.cpp @@ -936,7 +936,7 @@ void OximeterImport::on_saveButton_clicked() // Perfusion Index if (rec->perf > 0) { if (lastperf == 0) { - ELperf = session->AddEventList(OXI_Perf, EVL_Event, 0.01); + ELperf = session->AddEventList(OXI_Perf, EVL_Event, 0.01f); } if (lastperf != rec->perf) { if (lastperf > 0) { diff --git a/sleepyhead/sleepyhead.pro b/sleepyhead/sleepyhead.pro index 3c0aafc2..4cb7768c 100644 --- a/sleepyhead/sleepyhead.pro +++ b/sleepyhead/sleepyhead.pro @@ -49,13 +49,19 @@ TEMPLATE = app # GIT_VERSION = $$system(git describe --tags --long --abbrev=6 --dirty="*") + exists(../.git):{ - - GIT_BRANCH=$$system(git rev-parse --abbrev-ref HEAD) + GIT_COMMAND = git -C \"$$_PRO_FILE_PWD_\" + GIT_BRANCH=$$system($$GIT_COMMAND rev-parse --abbrev-ref HEAD) + GIT_REVISION=$$system($$GIT_COMMAND rev-parse --short HEAD) DEFINES += GIT_BRANCH=\\\"$$GIT_BRANCH\\\" - DEFINES += GIT_REVISION="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --short HEAD)\\\"" + DEFINES += GIT_REVISION=\\\"$$GIT_REVISION\\\" -# contains(GIT_BRANCH,"testing"): + message ("Building $$GIT_BRANCH branch $$GIT_REVISION") + +# DEFINES += GIT_BRANC=\\\"$(shell git -C \"$$_PRO_FILE_PWD_\" rev-parse --abbrev-ref HEAD)\\\" +# DEFINES += GIT_REVISION="$(shell git -C "$$_PRO_FILE_PWD_\" rev-parse --short HEAD)" +# message($$GIT_BRANC) } else { DEFINES += GIT_BRANCH=\\\"UNKNOWN\\\" @@ -95,7 +101,7 @@ win32 { if (*-msvc*):!equals(TEMPLATE_PREFIX, "vc") { LIBS += -ladvapi32 - DEFINES += BUILD_WITH_MSVC=1 + DEFINES += "BUILD_WITH_MSVC=1" } else { # MingW needs this LIBS += -lz diff --git a/sleepyhead/translation.cpp b/sleepyhead/translation.cpp index 629f07b8..601b8b90 100644 --- a/sleepyhead/translation.cpp +++ b/sleepyhead/translation.cpp @@ -33,10 +33,10 @@ void initTranslations(QSettings & settings) { // change it, but Qt4 support is still going to die sooner or later) // Add any languages with special character set needs to this list QHash langNames; - langNames["zh"] = "漢語繁體字"; - langNames["es"] = "Español"; - langNames["bg"] = "български"; - langNames["fr"] = "Français"; + langNames["zh"] = "\xe6\xbc\xa2\xe8\xaa\x9e\xe7\xb9\x81\xe9\xab\x94\xe5\xad\x97"; + langNames["es"] = "Espa\xc3\xb1ol"; + langNames["bg"] = "\xd0\xb1\xd1\x8a\xd0\xbb\xd0\xb3\xd0\xb0\xd1\x80\xd1\x81\xd0\xba\xd0\xb8"; + langNames["fr"] = "\x46\x72\x61\x6e\xc3\xa7\x61\x69\x73"; langNames["en_UK"] = "English UK"; // CHECK: Will the above break with MS VisualC++ compiler? @@ -85,7 +85,7 @@ void initTranslations(QSettings & settings) { QFont font; font.setPointSize(20); langsel.setFont(font); - langsel.setWindowTitle("Language / Taal / Sprache / Langue / 语言 / ... "); + langsel.setWindowTitle("Language / Taal / Sprache / Langue / \xe8\xaf\xad\xe8\xa8\x80 / ... "); QHBoxLayout lang_layout(&langsel); QLabel img;