diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h index e853ce01..6ad944bf 100644 --- a/sleepyhead/SleepLib/common.h +++ b/sleepyhead/SleepLib/common.h @@ -21,7 +21,7 @@ const QString CSTR_GFX_ANGLE = "ANGLE"; const QString CSTR_GFX_OpenGL = "OpenGL"; -const QString CSTR_GFX_BrokenGL = "QWidget"; +const QString CSTR_GFX_BrokenGL = "LegacyGFX"; //! \brief Gets the first day of week from the system locale, to show in the calendars. Qt::DayOfWeek firstDayOfWeekFromLocale(); diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index 9cc5d139..cbfdfbb9 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -421,13 +421,20 @@ Daily::Daily(QWidget *parent,gGraphView * shared) GraphView->setEmptyImage(QPixmap(":/docs/sheep.png")); } - Daily::~Daily() { - disconnect(sessionbar, SIGNAL(sessionClicked(Session*)), this, SLOT(doToggleSession(Session*))); -// disconnect(sessbar, SIGNAL(toggledSession(Session*)), this, SLOT(doToggleSession(Session*))); + disconnect(GraphView, SIGNAL(updateCurrentTime(double)), this, SLOT(on_LineCursorUpdate(double))); + disconnect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double))); + disconnect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo())); - // Save any last minute changes.. + disconnect(sessionbar, SIGNAL(sessionClicked(Session*)), this, SLOT(doToggleSession(Session*))); + disconnect(webView,SIGNAL(linkClicked(QUrl)),this,SLOT(Link_clicked(QUrl))); + + if (previous_date.isValid()) + Unload(previous_date); + + // Save graph orders and pin status, etc... + GraphView->SaveSettings("Daily"); delete ui; delete icon_on; @@ -439,20 +446,6 @@ void Daily::showEvent(QShowEvent *) RedrawGraphs(); } -void Daily::closeEvent(QCloseEvent *event) -{ - - disconnect(webView,SIGNAL(linkClicked(QUrl)),this,SLOT(Link_clicked(QUrl))); - - if (previous_date.isValid()) - Unload(previous_date); - - GraphView->SaveSettings("Daily"); - QWidget::closeEvent(event); - event->accept(); -} - - void Daily::doToggleSession(Session * sess) { sess->setEnabled(!sess->enabled()); diff --git a/sleepyhead/daily.h b/sleepyhead/daily.h index a192c41f..2ff47ba5 100644 --- a/sleepyhead/daily.h +++ b/sleepyhead/daily.h @@ -257,13 +257,9 @@ private slots: void updateGraphCombo(); - - //void on_sessionWidget_itemSelectionChanged(); - void on_splitter_2_splitterMoved(int pos, int index); protected: - virtual void closeEvent(QCloseEvent *); virtual void showEvent(QShowEvent *); private: diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 3a9a336a..62f449d0 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -217,7 +217,6 @@ void MainWindow::SetupGUI() QTimer::singleShot(50, this, SLOT(Startup())); - help = new Help(this); ui->tabWidget->addTab(help, tr("Help Browser")); diff --git a/sleepyhead/overview.cpp b/sleepyhead/overview.cpp index 7ec246b2..691bbbbe 100644 --- a/sleepyhead/overview.cpp +++ b/sleepyhead/overview.cpp @@ -60,10 +60,8 @@ Overview::Overview(QWidget *parent, gGraphView *shared) : ui->dateEnd->calendarWidget()->setWeekdayTextFormat(Qt::Sunday, format); // Connect the signals to update which days have CPAP data when the month is changed - connect(ui->dateStart->calendarWidget(), SIGNAL(currentPageChanged(int, int)), - SLOT(dateStart_currentPageChanged(int, int))); - connect(ui->dateEnd->calendarWidget(), SIGNAL(currentPageChanged(int, int)), - SLOT(dateEnd_currentPageChanged(int, int))); + connect(ui->dateStart->calendarWidget(), SIGNAL(currentPageChanged(int, int)), this, SLOT(dateStart_currentPageChanged(int, int))); + connect(ui->dateEnd->calendarWidget(), SIGNAL(currentPageChanged(int, int)), this, SLOT(dateEnd_currentPageChanged(int, int))); QVBoxLayout *framelayout = new QVBoxLayout; ui->graphArea->setLayout(framelayout); @@ -113,183 +111,6 @@ Overview::Overview(QWidget *parent, gGraphView *shared) : ui->dateLayout->addWidget(dateLabel,1); - - -// uc = new SummaryChart(STR_UNIT_Hours, GT_BAR); -// uc->addSlice(NoChannel, COLOR_Green, ST_HOURS); -// UC->AddLayer(uc); - - /* return; - - // TODO: Automate graph creation process - - - - - - float percentile = p_profile->general->prefCalcPercentile() / 100.0; - int mididx = p_profile->general->prefCalcMiddle(); - SummaryType ST_mid; - - if (mididx == 0) { ST_mid = ST_PERC; } - if (mididx == 1) { ST_mid = ST_WAVG; } - if (mididx == 2) { ST_mid = ST_AVG; } - - SummaryType ST_max = p_profile->general->prefCalcMax() ? ST_PERC : ST_MAX; - const EventDataType maxperc = 0.995F; - - US = createGraph(STR_GRAPH_SessionTimes, tr("Session Times"), tr("Session Times\n(hours)"), YT_Time); - SET = createGraph("Settings", STR_TR_Settings, STR_TR_Settings); - - - TGMV = createGraph(schema::channel[CPAP_TgMV].code(), schema::channel[CPAP_TgMV].label(), tr("Target\nVentilation\n(L/min)")); - PTB = createGraph(schema::channel[CPAP_PTB].code(), schema::channel[CPAP_PTB].label(), tr("Patient\nTriggered\nBreaths\n(%)")); - SES = createGraph(STR_GRAPH_Sessions, STR_TR_Sessions, STR_TR_Sessions + tr("\n(count)")); - - - ahihr = new SummaryChart(STR_UNIT_EventsPerHour, GT_POINTS); - ahihr->addSlice(ahicode, COLOR_Blue, ST_MAX); - ahihr->addSlice(ahicode, COLOR_Orange, ST_WAVG); - AHIHR->AddLayer(ahihr); - - weight = new SummaryChart(STR_TR_Weight, GT_POINTS); - weight->setMachineType(MT_JOURNAL); - weight->addSlice(Journal_Weight, COLOR_Black, ST_SETAVG); - WEIGHT->AddLayer(weight); - - bmi = new SummaryChart(STR_TR_BMI, GT_POINTS); - bmi->setMachineType(MT_JOURNAL); - bmi->addSlice(Journal_BMI, COLOR_DarkBlue, ST_SETAVG); - BMI->AddLayer(bmi); - - zombie = new SummaryChart(tr("Zombie Meter"), GT_POINTS); - zombie->setMachineType(MT_JOURNAL); - zombie->addSlice(Journal_ZombieMeter, COLOR_DarkRed, ST_SETAVG); - ZOMBIE->AddLayer(zombie); - - pulse = new SummaryChart(STR_TR_PulseRate, GT_POINTS); - pulse->setMachineType(MT_OXIMETER); - pulse->addSlice(OXI_Pulse, COLOR_Red, ST_mid, 0.5); - pulse->addSlice(OXI_Pulse, COLOR_Pink, ST_MIN); - pulse->addSlice(OXI_Pulse, COLOR_Orange, ST_MAX); - PULSE->AddLayer(pulse); - - spo2 = new SummaryChart(STR_TR_SpO2, GT_POINTS); - spo2->setMachineType(MT_OXIMETER); - spo2->addSlice(OXI_SPO2, COLOR_Cyan, ST_mid, 0.5); - spo2->addSlice(OXI_SPO2, COLOR_LightBlue, ST_PERC, percentile); - spo2->addSlice(OXI_SPO2, COLOR_Blue, ST_MIN); - SPO2->AddLayer(spo2); - - - fl = new SummaryChart(STR_TR_FL, GT_POINTS); - fl->addSlice(CPAP_FlowLimit, COLOR_Brown, ST_CPH); - FL->AddLayer(fl); - - sa = new SummaryChart(STR_TR_SA, GT_POINTS); - sa->addSlice(CPAP_SensAwake, COLOR_Brown, ST_CNT); - SA->AddLayer(sa); - - us = new SummaryChart(STR_UNIT_Hours, GT_SESSIONS); - us->addSlice(NoChannel, COLOR_DarkBlue, ST_HOURS); - us->addSlice(NoChannel, COLOR_Blue, ST_SESSIONS); - US->AddLayer(us); - - ses = new SummaryChart(STR_TR_Sessions, GT_POINTS); - ses->addSlice(NoChannel, COLOR_Blue, ST_SESSIONS); - SES->AddLayer(ses); - - if (ahicode == CPAP_RDI) { - bc = new SummaryChart(STR_TR_RDI, GT_BAR); - } else { - bc = new SummaryChart(STR_TR_AHI, GT_BAR); - } - - bc->addSlice(CPAP_ClearAirway, COLOR_ClearAirway, ST_CPH); - bc->addSlice(CPAP_Obstructive, COLOR_Obstructive, ST_CPH); - bc->addSlice(CPAP_Apnea, COLOR_Apnea, ST_CPH); - bc->addSlice(CPAP_Hypopnea, COLOR_Hypopnea, ST_CPH); - - if (p_profile->general->calculateRDI()) { - bc->addSlice(CPAP_RERA, COLOR_RERA, ST_CPH); - } -// bc->addSlice(CPAP_UserFlag1, COLOR_UserFlag1, ST_CPH); -// bc->addSlice(CPAP_UserFlag2, COLOR_UserFlag2, ST_CPH); - - - AHI->AddLayer(bc); - - set = new SummaryChart("", GT_POINTS); - //set->addSlice(PRS1_SysOneResistSet,COLOR_Gray,ST_SETAVG); - set->addSlice(CPAP_HumidSetting, COLOR_Blue, ST_SETWAVG); - set->addSlice(CPAP_PresReliefLevel, COLOR_Red, ST_SETWAVG); - set->addSlice(CPAP_PresReliefMode, COLOR_Red, ST_SETWAVG); -// set->addSlice(RMS9_EPRLevel,COLOR_Green,ST_SETWAVG); - //set->addSlice(INTP_SmartFlex,COLOR_Purple,ST_SETWAVG); - SET->AddLayer(set); - - rr = new SummaryChart(tr("breaths/min"), GT_POINTS); - rr->addSlice(CPAP_RespRate, COLOR_LightBlue, ST_MIN); - rr->addSlice(CPAP_RespRate, COLOR_Blue, ST_mid, 0.5); - rr->addSlice(CPAP_RespRate, COLOR_LightGreen, ST_PERC, percentile); - rr->addSlice(CPAP_RespRate, COLOR_Green, ST_max, maxperc); - // rr->addSlice(CPAP_RespRate,COLOR_Green,ST_MAX); - RR->AddLayer(rr); - - tv = new SummaryChart(tr("L/b"), GT_POINTS); - tv->addSlice(CPAP_TidalVolume, COLOR_LightBlue, ST_MIN); - tv->addSlice(CPAP_TidalVolume, COLOR_Blue, ST_mid, 0.5); - tv->addSlice(CPAP_TidalVolume, COLOR_LightGreen, ST_PERC, percentile); - tv->addSlice(CPAP_TidalVolume, COLOR_Green, ST_max, maxperc); - TV->AddLayer(tv); - - mv = new SummaryChart(STR_UNIT_LPM, GT_POINTS); - mv->addSlice(CPAP_MinuteVent, COLOR_LightBlue, ST_MIN); - mv->addSlice(CPAP_MinuteVent, COLOR_Blue, ST_mid, 0.5); - mv->addSlice(CPAP_MinuteVent, COLOR_LightGreen, ST_PERC, percentile); - mv->addSlice(CPAP_MinuteVent, COLOR_Green, ST_max, maxperc); - MV->AddLayer(mv); - - // should merge... - tgmv = new SummaryChart(STR_UNIT_LPM, GT_POINTS); - tgmv->addSlice(CPAP_TgMV, COLOR_LightBlue, ST_MIN); - tgmv->addSlice(CPAP_TgMV, COLOR_Blue, ST_mid, 0.5); - tgmv->addSlice(CPAP_TgMV, COLOR_LightGreen, ST_PERC, percentile); - tgmv->addSlice(CPAP_TgMV, COLOR_Green, ST_max, maxperc); - TGMV->AddLayer(tgmv); - - ptb = new SummaryChart(tr("%PTB"), GT_POINTS); - ptb->addSlice(CPAP_PTB, COLOR_Yellow, ST_MIN); - ptb->addSlice(CPAP_PTB, COLOR_Blue, ST_mid, 0.5); - ptb->addSlice(CPAP_PTB, COLOR_LightGray, ST_PERC, percentile); - ptb->addSlice(CPAP_PTB, COLOR_Orange, ST_WAVG); - PTB->AddLayer(ptb); - - pr = new SummaryChart(STR_TR_Pressure, GT_POINTS); - // Added in summarychart.. Slightly annoying.. - PR->AddLayer(pr); - - - totlk = new SummaryChart(STR_TR_TotalLeaks, GT_POINTS); - totlk->addSlice(CPAP_LeakTotal, COLOR_LightBlue, ST_mid, 0.5); - totlk->addSlice(CPAP_LeakTotal, COLOR_DarkGray, ST_PERC, percentile); - totlk->addSlice(CPAP_LeakTotal, COLOR_Gray, ST_max, maxperc); - //tot->addSlice(CPAP_Leak, COLOR_DarkBlue, ST_WAVG); - //tot->addSlice(CPAP_Leak, COLOR_DarkYellow); - TOTLK->AddLayer(totlk); - - - NLL->AddLayer(nll = new SummaryChart(tr("% %1").arg(schema::channel[CPAP_LargeLeak].fullname()), GT_POINTS)); - nll->addSlice(CPAP_LargeLeak, schema::channel[CPAP_LargeLeak].defaultColor(), ST_SPH); - // <--- The code to the previous marker is crap - - AHI->setPinned(false); - SES->setRecMinY(1); - SET->setRecMinY(0); - - //SET->setRecMaxY(5); - - */ RebuildGraphs(false); ui->rangeCombo->setCurrentIndex(p_profile->general->lastOverviewRange()); @@ -304,14 +125,21 @@ Overview::Overview(QWidget *parent, gGraphView *shared) : connect(GraphView, SIGNAL(updateCurrentTime(double)), this, SLOT(on_LineCursorUpdate(double))); connect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double))); - connect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo())); } + Overview::~Overview() { + disconnect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo())); + disconnect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double))); + disconnect(GraphView, SIGNAL(updateCurrentTime(double)), this, SLOT(on_LineCursorUpdate(double))); + disconnect(ui->dateEnd->calendarWidget(), SIGNAL(currentPageChanged(int, int)), this, SLOT(dateEnd_currentPageChanged(int, int))); + disconnect(ui->dateStart->calendarWidget(), SIGNAL(currentPageChanged(int, int)), this, SLOT(dateStart_currentPageChanged(int, int))); + + // Save graph orders and pin status, etc... + GraphView->SaveSettings("Overview");//no trans + delete ui; -// delete icon_on; -// delete icon_off; } void Overview::RebuildGraphs(bool reset) @@ -423,10 +251,8 @@ void Overview::RebuildGraphs(bool reset) ZOMBIE = createGraph(STR_GRAPH_Zombie, STR_TR_Zombie, tr("How you felt\n(0-10)")); if (reset) { -// GraphView->setDay(nullptr); GraphView->resetLayout(); GraphView->setDay(nullptr); -// GraphView->resetLayout(); GraphView->SetXBounds(minx, maxx, 0, false); GraphView->resetLayout(); updateGraphCombo(); @@ -435,14 +261,6 @@ void Overview::RebuildGraphs(bool reset) } -void Overview::closeEvent(QCloseEvent *event) -{ - GraphView->SaveSettings("Overview");//no trans - disconnect(this, SLOT(dateStart_currentPageChanged(int, int))); - disconnect(this, SLOT(dateEnd_currentPageChanged(int, int))); - QWidget::closeEvent(event); -} - gGraph *Overview::createGraph(QString code, QString name, QString units, YTickerType yttype) { int default_height = AppSetting->graphHeight(); diff --git a/sleepyhead/overview.h b/sleepyhead/overview.h index 5a8a0403..21a5a3a4 100644 --- a/sleepyhead/overview.h +++ b/sleepyhead/overview.h @@ -1,4 +1,4 @@ -/* Overview GUI Headers +/* Overview GUI Headers * * Copyright (C) 2011-2018 Mark Watkins * @@ -37,7 +37,6 @@ class Overview : public QWidget public: explicit Overview(QWidget *parent, gGraphView *shared = nullptr); ~Overview(); - void closeEvent(QCloseEvent *); //! \brief Returns Overview gGraphView object containing it's graphs gGraphView *graphView() { return GraphView; } @@ -77,17 +76,8 @@ class Overview : public QWidget public slots: void onRebuildGraphs() { RebuildGraphs(true); } - // ! \brief Print button down the bottom, does the same as File->Print - //void on_printButton_clicked(); private slots: - /* void on_drStart_dateChanged(const QDate &date); - void on_drEnd_dateChanged(const QDate &date); - void on_rbDateRange_toggled(bool checked); - void on_rbLastWeek_clicked(); - void on_rbLastMonth_clicked(); - void on_rbEverything_clicked(); - void on_rbDateRange_clicked(); */ void updateGraphCombo(); //! \brief Resets the graph view because the Start date has been changed @@ -116,6 +106,7 @@ class Overview : public QWidget void on_LineCursorUpdate(double time); void on_RangeUpdate(double minx, double maxx); + private: Ui::Overview *ui; gGraphView *GraphView; @@ -130,11 +121,6 @@ class Overview : public QWidget void UpdateCalendarDay(QDateEdit *calendar, QDate date); void updateCube(); - //SessionTimes *session_times; - //,*PRESSURE,*LEAK,*SESSTIMES; - - //Layer *prmax,*prmin,*iap,*eap,*pr,*sesstime; - Day *day; // dummy in this case }; diff --git a/sleepyhead/sleepyhead.pro b/sleepyhead/sleepyhead.pro index d903fffc..2747e16a 100644 --- a/sleepyhead/sleepyhead.pro +++ b/sleepyhead/sleepyhead.pro @@ -11,6 +11,8 @@ lessThan(QT_MAJOR_VERSION,5) { error("Sorry, need Qt 5 to build SleepyHead"); } +DEFINES += QT_DEPRECATED_WARNINGS + #SleepyHead requires OpenGL 2.0 support to run smoothly #On platforms where it's not available, it can still be built to work #provided the BrokenGL DEFINES flag is passed to qmake (eg, qmake [specs] /path/to/SleepyHeadQT.pro DEFINES+=BrokenGL) @@ -53,7 +55,7 @@ gitinfotarget.depends = FORCE win32 { system("$$_PRO_FILE_PWD_/update_gitinfo.bat"); - gitinfotarget.commands = $$_PRO_FILE_PWD_/update_gitinfo.bat + gitinfotarget.commands = "$$_PRO_FILE_PWD_/update_gitinfo.bat" } else { system("/bin/bash $$_PRO_FILE_PWD_/update_gitinfo.sh"); gitinfotarget.commands = "/bin/bash $$_PRO_FILE_PWD_/update_gitinfo.sh" @@ -104,6 +106,58 @@ win32 { } } +macx { + TransFiles.files = $$files(../Translations/*.qm) + TransFiles.path = Contents/Resources/Translations + HelpFiles.files = $$files(help/*.qch) + HelpFiles.files += $$files(help/help.qhc) + HelpFiles.path = Contents/Resources/Help + QMAKE_BUNDLE_DATA += TransFiles + QMAKE_BUNDLE_DATA += HelpFiles + message("Setting up Translations & Help Transfers") +} else { + CONFIG(debug, debug|release) { + DDIR = $$OUT_PWD/debug/Translations + HELPDIR = $$OUT_PWD/debug/Help + } + CONFIG(release, debug|release) { + DDIR = $$OUT_PWD/release/Translations + HELPDIR = $$OUT_PWD/release/Help + } + TRANS_FILES += $$PWD/../Translations/*.qm + HELP_FILES += $$PWD/help/*.qch + HELP_FILES += $$PWD/help/help.qhc + + win32 { + TRANS_FILES_WIN = $${TRANS_FILES} + HELP_FILES_WIN = $${HELP_FILES} + TRANS_FILES_WIN ~= s,/,\\,g + HELP_FILES_WIN ~= s,/,\\,g + DDIR ~= s,/,\\,g + HELPDIR ~= s,/,\\,g + + system(mkdir $$quote($$HELPDIR)) + system(mkdir $$quote($$DDIR)) + + for(FILE,TRANS_FILES_WIN) { + system(xcopy /y $$quote($$FILE) $$quote($$DDIR)) + } + for(FILE,HELP_FILES_WIN) { + system(xcopy /y $$quote($$FILE) $$quote($$HELPDIR)) + } + } else { + system(md $$quote($$HELPDIR)) + system(md $$quote($$DDIR)) + + for(FILE,TRANS_FILES_WIN) { + system(copy $$quote($$FILE) $$quote($$DDIR)) + } + for(FILE,HELP_FILES_WIN) { + system(copy $$quote($$FILE) $$quote($$HELPDIR)) + } + } +} + SOURCES += \ common_gui.cpp \ daily.cpp \ @@ -276,62 +330,9 @@ OTHER_FILES += \ ../update.xml \ docs/changelog.txt \ docs/intro.html \ - docs/statistics.xml - -win32 { - CONFIG(debug, debug|release) { - DDIR = $$OUT_PWD/debug/Translations - } - CONFIG(release, debug|release) { - DDIR = $$OUT_PWD/release/Translations - } - DDIR ~= s,/,\\,g - - TRANS_FILES += $$PWD/../Translations/*.qm - TRANS_FILES_WIN = $${TRANS_FILES} - TRANS_FILES_WIN ~= s,/,\\,g - - system(mkdir $$quote($$DDIR)) - - for(FILE,TRANS_FILES_WIN){ - system(xcopy /y $$quote($$FILE) $$quote($$DDIR)) - } - - CONFIG(debug, debug|release) { - HELPDIR = $$OUT_PWD/debug/Help - } - CONFIG(release, debug|release) { - HELPDIR = $$OUT_PWD/release/Help - } - HELPDIR ~= s,/,\\,g - - HELP_FILES += $$PWD/help/*.qch - HELP_FILES += $$PWD/help/help.qhc - HELP_FILES_WIN = $${HELP_FILES} - HELP_FILES_WIN ~= s,/,\\,g - - system(mkdir $$quote($$HELPDIR)) - - for(FILE,HELP_FILES_WIN){ - system(xcopy /y $$quote($$FILE) $$quote($$HELPDIR)) - } - -} - -macx { - TransFiles.files = $$files(../Translations/*.qm) - TransFiles.path = Contents/Resources/Translations - HelpFiles.files = $$files(help/*.qch) - HelpFiles.files += $$files(help/help.qhc) - HelpFiles.path = Contents/Resources/Help - QMAKE_BUNDLE_DATA += TransFiles - QMAKE_BUNDLE_DATA += HelpFiles - message("Setting up Translations & Help Transfers") -} - -#include(../3rdparty/quazip/quazip/quazip.pri) -#INCLUDEPATH += $$PWD/../3rdparty/quazip -#DEPENDPATH += $$PWD/../3rdparty/quazip + docs/statistics.xml \ + update_gitinfo.bat \ + update_gitinfo.sh DISTFILES += \ ../README \