Index: leahi.pro =================================================================== diff -u -r32a7b4d52315019d125c6c7b728bf0d215919c0f -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- leahi.pro (.../leahi.pro) (revision 32a7b4d52315019d125c6c7b728bf0d215919c0f) +++ leahi.pro (.../leahi.pro) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -60,6 +60,7 @@ sources/model/td \ sources/model/td/data \ sources/model/td/data/treatment \ + sources/model/td/data/treatmentlog \ sources/model/td/alarm \ sources/model/td/adjustment \ sources/model/td/adjustment/settings \ @@ -205,6 +206,9 @@ sources/device/DeviceModels.h \ \ # ---------- Models - TD - Data //// ----- @LEAHIZED sources/model/td/data/MTDOpModeData.h \ + \ # ---------- Models - TD - Data - Treatment Log + sources/model/td/data/treatmentlog/MTreatmentLogAlarmData.h \ + sources/model/td/data/treatmentlog/MTreatmentLogEventData.h \ \ # ---------- Models - TD - Adjustment - In-Treatment //// ----- @LEAHIZED sources/model/td/adjustment/treatment/MTreatmentAdjustBloodFlowRateResponse.h \ sources/model/td/adjustment/treatment/MTreatmentAdjustBolusVolumeResponse.h \ @@ -352,9 +356,7 @@ sources/model/hd/data/post/MHDRTCEpochData.h \ sources/model/hd/data/MHDUsageInfoResponse.h \ \ # ---------- Models - HD - Data - Treatment Log - sources/model/hd/data/treatmentlog/MTreatmentLogAlarmData.h \ sources/model/hd/data/treatmentlog/MTreatmentLogAvrgeData.h \ - sources/model/hd/data/treatmentlog/MTreatmentLogEventData.h \ \ # ---------- Models - DG - Adjustment sources/model/dg/adjustment/settings/MAdjustDGRequests.h \ sources/model/dg/adjustment/settings/MAdjustDGCleaningUsageResponse.h \ @@ -486,6 +488,7 @@ sources/view/td/data/treatment/VTreatmentPressureOcclusion.h \ sources/view/td/data/treatment/VTreatmentSalineData.h \ sources/view/td/data/treatment/VTreatmentTime.h \ + sources/view/td/data/treatment/VTreatmentTrends.h \ sources/view/td/data/treatment/VTreatmentUltrafiltrationData.h SOURCES += \ @@ -572,6 +575,9 @@ sources/device/DeviceModels.cpp \ \ # ---------- Models - TD - Data - States sources/model/td/data/MTDOpModeData.cpp \ + \ # ---------- Models - TD - Data - Treatment Log + sources/model/td/data/treatmentlog/MTreatmentLogAlarmData.cpp \ + sources/model/td/data/treatmentlog/MTreatmentLogEventData.cpp \ \ # ---------- Models - TD - Adjustment - In-Treatment sources/model/td/adjustment/treatment/MTreatmentAdjustBloodFlowRateResponse.cpp \ sources/model/td/adjustment/treatment/MTreatmentAdjustBolusVolumeResponse.cpp \ @@ -666,9 +672,7 @@ sources/model/hd/data/pretreatment/MPreTreatmentSelfTestNoCartridgeData.cpp \ sources/model/hd/data/pretreatment/MPreTreatmentSelfTestDryData.cpp \ \ # ---------- Models - HD - Data - Treatment Log - sources/model/hd/data/treatmentlog/MTreatmentLogAlarmData.cpp \ sources/model/hd/data/treatmentlog/MTreatmentLogAvrgeData.cpp \ - sources/model/hd/data/treatmentlog/MTreatmentLogEventData.cpp \ \ # ---------- Models - DG - Adjustment \ # ---------- Models - DG - Adjustment - Settings sources/model/dg/adjustment/settings/MAdjustDGCleaningUsageResponse.cpp \ @@ -824,6 +828,7 @@ sources/view/td/data/treatment/VTreatmentPressureOcclusion.cpp \ sources/view/td/data/treatment/VTreatmentSalineData.cpp \ sources/view/td/data/treatment/VTreatmentTime.cpp \ + sources/view/td/data/treatment/VTreatmentTrends.cpp \ sources/view/td/data/treatment/VTreatmentUltrafiltrationData.cpp RESOURCES += \ Index: leahi.qrc =================================================================== diff -u -r0dfba44fb7172b9458d161b3ed5f54527f93b698 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- leahi.qrc (.../leahi.qrc) (revision 0dfba44fb7172b9458d161b3ed5f54527f93b698) +++ leahi.qrc (.../leahi.qrc) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -157,6 +157,7 @@ sources/gui/qml/components/Footer.qml sources/gui/qml/components/TextEntry.qml sources/gui/qml/components/ScrollBar.qml + sources/gui/qml/components/ScrollBar2.qml sources/gui/qml/components/FooterStatic.qml sources/gui/qml/components/TimeEntry.qml sources/gui/qml/components/Label.qml @@ -266,6 +267,7 @@ sources/gui/qml/pages/treatment/TreatmentSection.qml sources/gui/qml/pages/treatment/TreatmentSectionHeader.qml sources/gui/qml/pages/treatment/TreatmentHeparin.qml + sources/gui/qml/pages/treatment/TreatmentTrends.qml sources/gui/qml/pages/treatment/sections/TreatmentFlows.qml Index: sources/gui/GuiGlobals.h =================================================================== diff -u -r32a7b4d52315019d125c6c7b728bf0d215919c0f -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision 32a7b4d52315019d125c6c7b728bf0d215919c0f) +++ sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -310,8 +310,8 @@ ID_AdjustTreatmentLogRsp = 0x760F, // 118 //// ----- @CRAPIZED: had to change to avoid duplication // Treatment Log Data ID_TreatmentLogAvrgeData = 0x940F, // 148 //// ----- @CRAPIZED: had to change to avoid duplication - ID_TreatmentLogAlarmData = 0x950F, // 149 //// ----- @CRAPIZED: had to change to avoid duplication - ID_TreatmentLogEventData = 0x960F, // 150 //// ----- @CRAPIZED: had to change to avoid duplication + ID_TreatmentLogAlarmData = 0x6A00, // 106 //// ----- @LEAHIZED + ID_TreatmentLogEventData = 0x6B00, // 107 //// ----- @LEAHIZED // Disinfect ID_AdjustDisinfectModeReq = 0x9A00, // 154 Index: sources/gui/qml/globals/Colors.qml =================================================================== diff -u -r232dc65ad1d642f750547db6c480da534704a2c4 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision 232dc65ad1d642f750547db6c480da534704a2c4) +++ sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -93,6 +93,9 @@ readonly property color panelBackgroundColor : "#12FFFFFF" readonly property color panelBorderColor : "#4DB5B5B5" readonly property color panelInvalidBorderColor : "#FFA500" + readonly property color panelBackground : "#2A3F53" + readonly property color panelBorder : "#324C65" + readonly property color heparinPanelBorderColor         : "#CC42556B" readonly property color heparinSectionHeader            : "#384B60" readonly property color heparinActive                   : "#429C4A" Index: sources/gui/qml/globals/Variables.qml =================================================================== diff -u -r0dfba44fb7172b9458d161b3ed5f54527f93b698 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision 0dfba44fb7172b9458d161b3ed5f54527f93b698) +++ sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -304,6 +304,8 @@ readonly property string unitTextDispensingRate : qsTr("mL/hr") readonly property string unitTextRate : qsTr("L/h") readonly property string unitTextDialCond : qsTr("mS/cm") + // - Pressures + readonly property string unitPressure : qsTr("mmHg") // - Vitals readonly property string unitTextBloodPressure : qsTr("mmHg") readonly property string unitTextHeartBeat : qsTr("BPM" ) Index: sources/gui/qml/main.qml =================================================================== diff -u -rc9764bd0ad823c5c1725d7c7f556290c2c459d4d -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/gui/qml/main.qml (.../main.qml) (revision c9764bd0ad823c5c1725d7c7f556290c2c459d4d) +++ sources/gui/qml/main.qml (.../main.qml) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -80,6 +80,7 @@ import VTreatmentStop 0.1 import VTreatmentRanges 0.1 import VTreatmentHeparin 0.1 +import VTreatmentTrends 0.1 // Pre-Treatment import VPreTreatmentAdjustmentInitTreatment 0.1 @@ -293,6 +294,8 @@ VTreatmentCreate { id: vTreatmentCreate } VTreatmentRanges { id: vTreatmentRanges } + VTreatmentTrends { id: vTreatmentTrends } + VTreatmentAdjustmentBolusVolume { id: vTreatmentAdjustmentBolusVolume } VTreatmentAdjustmentSaline { id: vTreatmentAdjustmentSaline } VTreatmentAdjustmentVitals { id: vTreatmentAdjustmentVitals } @@ -361,6 +364,23 @@ function onStandbyWaitDisinfectChanged ( vValue ) { _mainMenu.isTreatment() } } + Connections { target: vTreatmentVitals + function onDidTimeout() { + // interval set to OFF so just record without vitals + if ( ! vTreatmentVitals.interval ) { + vTreatmentTrends.onNoVitalsRecord() + } + // interval is set and BP cuff is available + else if ( vTreatmentVitals.enableBPCuff ) { + vTreatmentTrends.onIntervalRequestVitals() + } + } + } + + Connections { target: vTreatmentAdjustmentVitals + function onDidTimeout() { vTreatmentTrends.onIntervalTimeoutVitals() } + } + // 9 - Others HeaderBar { id: _headerBar anchors.top: parent.top Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -rc9764bd0ad823c5c1725d7c7f556290c2c459d4d -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision c9764bd0ad823c5c1725d7c7f556290c2c459d4d) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -97,7 +97,18 @@ } } - ScreenItem { id: _treatmentTrends } // TODO: make me! + TreatmentTrends { id: _treatmentTrends + objectName: "_treatmentTrends" + Connections { target: vTDOpMode + function onInTreatmentChanged() { + if (vTDOpMode.inTreatment) { + _treatmentTrends.isParamExpanded = true + vTreatmentTrends.doClearData() + } + } + } + } + TreatmentHeparin { id: _treatmentHeparin } Connections { target: _treatmentHeparin function onIdleTimeout ( ) { Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentVitals.qml =================================================================== diff -u -r77e7c1e746bba703ab3aee61f8e19f398fd9ac00 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentVitals.qml (.../TreatmentAdjustmentVitals.qml) (revision 77e7c1e746bba703ab3aee61f8e19f398fd9ac00) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentVitals.qml (.../TreatmentAdjustmentVitals.qml) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -57,26 +57,30 @@ _bphrEntry.heartRate = vHeartRate ? vHeartRate : "" } - function confirm() { + function confirm(isManual) { numPad.hide() _root.close() vTreatmentVitals.doConfirm( _bphrEntry.systolic , _bphrEntry.diastolic , _bphrEntry.heartRate - ) + ) + + if (isManual) { + vTreatmentTrends.onManualVitals( + _bphrEntry.systolic , + _bphrEntry.diastolic, + _bphrEntry.heartRate + ) + } + _headerBar.vitalsRecorded() } onOpened: { notificationText = notificationTextString - vTreatmentVitals.doTimerStop() } - onClosed: { - vTreatmentVitals.doTimerStart() - } - onCloseClicked: { numPad.hide() numPad.visible = false @@ -111,7 +115,7 @@ margins : 0 } - onClicked : _root.confirm() + onClicked : _root.confirm(true) } Item { id: _separator @@ -171,15 +175,14 @@ Connections { target: vTreatmentVitals // On Timeout - Vitals Request function onDidTimeout () { + // interval set to OFF but 15 min default timer still running if ( ! vTreatmentVitals.interval ) { - // TODO: interval set to OFF but 15 min default timer still running return } - // On Timeout request vitas if BP cuff is enabled or shjow popup for manual entry + // On Timeout request vitals if BP cuff is enabled or show popup for manual entry if ( vTreatmentVitals.enableBPCuff ) { vTreatmentAdjustmentVitals.doRequest() - vTreatmentVitals.doTimerStart() } else { _root.open () @@ -192,7 +195,7 @@ // Vitals Reading Ready function onAdjustmentTriggered ( vValue ) { _root.update ( vTreatmentVitals.systolic__rt, vTreatmentVitals.diastolic_rt, vTreatmentVitals.heartRate_rt ) - _root.confirm() + _root.confirm(false) } } Index: sources/model/MListModel.cpp =================================================================== diff -u -rf433eeefae34530e7cc3dc4e5576e43729b236f2 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/model/MListModel.cpp (.../MListModel.cpp) (revision f433eeefae34530e7cc3dc4e5576e43729b236f2) +++ sources/model/MListModel.cpp (.../MListModel.cpp) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -1,6 +1,17 @@ #include "MListModel.h" /*! + * \brief Constructor + * \param[in] parent - Parent of this object. + */ +View::MListModel::MListModel(QObject *parent) + : QAbstractListModel(parent) +{ + connect(this, &MListModel::rowsInserted, this, &MListModel::countChanged); + connect(this, &MListModel::rowsRemoved, this, &MListModel::countChanged); +} + +/*! * \brief Retrieve the role names set for this list model. * \return Role names used for this model. */ @@ -9,18 +20,6 @@ } /*! - * \brief Set the role names for the data in this list model. - * \param[in] roleNames New role names for this list model. - * \note This will clear the list model of any data. - */ -void View::MListModel::setRoleNames(const QHash& vRoleNames) { - if ( _roleNames != vRoleNames ) { - clear(); - _roleNames = vRoleNames; - } -} - -/*! * \brief Get the number of rows in this list model. * \return Number of rows in this list model. */ @@ -29,27 +28,6 @@ } /*! - * \brief Appends a row of data to the end of the model. - * \param[in] data The data to append. -*/ -void View::MListModel::appendRow(const QHash &vData) { - insertRow(rowCount(), vData); -} - -/*! - * \brief Inserts data into the model at a given row. - * \param[in] row The index where the data will be inserted. - * If row is less than 0, then data will be prepended to the model. - * If row is greater than or equal to rowCount(), then data will be appeneded to the model. - * \param[in] data The data to insert into the model. -*/ -void View::MListModel::insertRow(const int vRow, const QHash &vData) { - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - _data.insert(vRow, vData); - endInsertRows(); -} - -/*! * \brief Retrieve the data stored at the given index for the specified role. * \param[in] index Index of the data in the list model. * \param[in] role Role of the data to fetch. @@ -77,33 +55,24 @@ } /*! - * \brief Retrieve the data stored at the given index for the specified role and expose to QML - * \param[in] vRow Index of the data in the list model. + * \brief Sets the value of the data in this list model at the given index and for the given role. + * \param[in] index Location of data to update. + * \param[in] value Value to set. + * \param[in] role The role of the data at the given index to set. + * \return Return true if data was set properly, otherwise false. */ -QVariantMap View::MListModel::get(int vRow) const { - QVariantMap map; - QHash roles = roleNames(); +bool View::MListModel::setData(const QModelIndex &vIndex, const QVariant& vValue, int vRole) { + if ( ! vIndex.isValid() || vIndex.row() >= _data.count() ) { + return false; + } - // Row bounds check - if ( vRow < 0 || vRow >= rowCount() ) { goto lOut; } - - // Check if roles are defined - if ( roles.isEmpty() ) { goto lOut; } - - for ( auto it = roles.cbegin(); it != roles.cend(); ++it ) { - const int role = it.key(); - const QByteArray roleName = it.value(); - - if ( roleName.isEmpty() ) { goto lOut; } - - QVariant value = data(index(vRow, 0), role); - if ( ! value.isValid() ) { goto lOut; } - - map.insert( QString::fromUtf8(roleName), value ); + if ( _data[vIndex.row()][vRole] != vValue ) { + _data[vIndex.row()][vRole] = vValue; + // explicitly emit a dataChanged signal to notify anybody bound to this property (vRole) + emit dataChanged(vIndex, vIndex, QVector(1, vRole)); } -lOut: - return map; + return true; } /*! @@ -116,24 +85,38 @@ } /*! - * \brief Sets the value of the data in this list model at the given index and for the given role. - * \param[in] index Location of data to update. - * \param[in] value Value to set. - * \param[in] role The role of the data at the given index to set. - * \return Return true if data was set properly, otherwise false. + * \brief Set the role names for the data in this list model. + * \param[in] roleNames New role names for this list model. + * \note This will clear the list model of any data. */ -bool View::MListModel::setData(const QModelIndex &vIndex, const QVariant& vValue, int vRole) { - if ( ! vIndex.isValid() || vIndex.row() >= _data.count() ) { - return false; +void View::MListModel::setRoleNames(const QHash& vRoleNames) { + if ( _roleNames != vRoleNames ) { + clear(); + _roleNames = vRoleNames; } +} - if ( _data[vIndex.row()][vRole] != vValue ) { - _data[vIndex.row()][vRole] = vValue; - // explicitly emit a dataChanged signal to notify anybody bound to this property (vRole) - emit dataChanged(vIndex, vIndex, QVector(1, vRole)); - } +/*! + * \brief Appends a row of data to the end of the model. + * \param[in] data The data to append. +*/ +void View::MListModel::appendRow(const QHash &vData) { + insertRow(rowCount(), vData); +} - return true; +/*! + * \brief Inserts data into the model at a given position. + * \param[in] vRow - The index where the data will be inserted. + * If row is less than 0, then data will be prepended to the model. + * If row is greater than or equal to rowCount(), then data will be appeneded to the model. + * \param[in] data - The data to insert into the model. + */ +void View::MListModel::insertRow(const int vRow, const QHash &vData) +{ + const int index = std::clamp(vRow, 0, rowCount()); + beginInsertRows(QModelIndex(), index, index); + _data.insert(index, vData); + endInsertRows(); } /*! @@ -160,3 +143,33 @@ } return *this; } + +/*! + * \brief Retrieve the data stored at the given index for the specified role and expose to QML + * \param[in] vRow Index of the data in the list model. + */ +QVariantMap View::MListModel::get(int vRow) const { + QVariantMap map; + QHash roles = roleNames(); + + // Row bounds check + if ( vRow < 0 || vRow >= rowCount() ) { goto lOut; } + + // Check if roles are defined + if ( roles.isEmpty() ) { goto lOut; } + + for ( auto it = roles.cbegin(); it != roles.cend(); ++it ) { + const int role = it.key(); + const QByteArray roleName = it.value(); + + if ( roleName.isEmpty() ) { goto lOut; } + + QVariant value = data(index(vRow, 0), role); + if ( ! value.isValid() ) { goto lOut; } + + map.insert( QString::fromUtf8(roleName), value ); + } + +lOut: + return map; +} Index: sources/model/MListModel.h =================================================================== diff -u -rf433eeefae34530e7cc3dc4e5576e43729b236f2 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/model/MListModel.h (.../MListModel.h) (revision f433eeefae34530e7cc3dc4e5576e43729b236f2) +++ sources/model/MListModel.h (.../MListModel.h) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -17,26 +17,31 @@ { Q_OBJECT + Q_PROPERTY(int count READ rowCount NOTIFY countChanged STORED false) + public: - explicit MListModel(QObject *parent = nullptr) : QAbstractListModel (parent) { } + explicit MListModel(QObject *parent = nullptr); QHash roleNames ( ) const override; int rowCount (const QModelIndex & = QModelIndex() ) const override; QVariant data (const QModelIndex &vIndex, int vRole = Qt::DisplayRole ) const override; bool setData (const QModelIndex &vIndex, const QVariant& vValue, int vRole = Qt::EditRole) override; void clear ( ); void setRoleNames(const QHash& vRoleNames ); - MListModel &operator = (const QList> &src ); void appendRow (const QHash &vData ); void insertRow (const int vRow, const QHash &vData ); void updateData (const int vRow, const int vRole, const QVariant& vValue ); + MListModel &operator = (const QList> &src ); -public slots: +public Q_SLOTS: QVariantMap get (int vRow ) const; // Exposed to QML +Q_SIGNALS: + void countChanged(); + private: QList> _data; QHash _roleNames; - }; -} + +} // namespace View Index: sources/storage/Logger.cpp =================================================================== diff -u -rd862dfcd402206e33b314c458e41c13b684a4565 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/storage/Logger.cpp (.../Logger.cpp) (revision d862dfcd402206e33b314c458e41c13b684a4565) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -557,7 +557,6 @@ _logFileNameTime = QDateTime::currentDateTime().time().toString(_fileTimeFormat); } break; - case GuiTDOpModes::MODE_TPAR: case GuiTDOpModes::MODE_PRET: case GuiTDOpModes::MODE_TREA: case GuiTDOpModes::MODE_POST: Index: sources/view/td/data/VTDOpModeData.cpp =================================================================== diff -u -rf2e4eba6e85c5d36537be782926f23cc9dc01037 -rc1e50347c78096b626b2cd1ef32a33b439e88bdd --- sources/view/td/data/VTDOpModeData.cpp (.../VTDOpModeData.cpp) (revision f2e4eba6e85c5d36537be782926f23cc9dc01037) +++ sources/view/td/data/VTDOpModeData.cpp (.../VTDOpModeData.cpp) (revision c1e50347c78096b626b2cd1ef32a33b439e88bdd) @@ -28,7 +28,6 @@ service ( vData.mOpMode == GuiTDOpModes ::MODE_SERV ); init ( vData.mOpMode == GuiTDOpModes ::MODE_INIT ); standby ( vData.mOpMode == GuiTDOpModes ::MODE_STAN ); - validateParameters ( vData.mOpMode == GuiTDOpModes ::MODE_TPAR ); preTreatment ( vData.mOpMode == GuiTDOpModes ::MODE_PRET ); inTreatment ( vData.mOpMode == GuiTDOpModes ::MODE_TREA ); postTreatment ( vData.mOpMode == GuiTDOpModes ::MODE_POST );