Index: leahi.pro =================================================================== diff -u -rd9993ef9458e1c25abc86a63d4d10b666ff8cd2c -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- leahi.pro (.../leahi.pro) (revision d9993ef9458e1c25abc86a63d4d10b666ff8cd2c) +++ leahi.pro (.../leahi.pro) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -228,6 +228,7 @@ sources/model/td/adjustment/treatment/MTreatmentAdjustUltrafiltrationConfirmResponse.h \ sources/model/td/adjustment/treatment/MTreatmentAdjustVitalsResponse.h \ \ # ---------- Views - TD - Data - States //// ----- @LEAHIZED + sources/view/VListModel.h \ sources/view/dd/data/VDDBloodLeakData.h \ sources/view/dd/data/VDDConcentratePumpData.h \ sources/view/dd/data/VDDConductivityData.h \ @@ -561,6 +562,7 @@ sources/model/ui/data/MUIBloodPressureData.cpp \ sources/storage/Settings.cpp \ sources/storage/TreatmentLog.cpp \ + sources/view/VListModel.cpp \ sources/view/dd/data/VDDBloodLeakData.cpp \ sources/view/dd/data/VDDConcentratePumpData.cpp \ sources/view/dd/data/VDDConductivityData.cpp \ Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -r5a505f86c26c8e1fd6d584cd53a3765c25120781 -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 5a505f86c26c8e1fd6d584cd53a3765c25120781) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -23,6 +23,7 @@ #include "GuiView.h" #include "VEventSpy.h" #include "VGeneralEvent.h" +#include "VListModel.h" // POST #include "VHDPOSTData.h" Index: sources/gui/qml/components/HeaderBar.qml =================================================================== diff -u -rdb77d641586bcf38af1b931296519307d5901281 -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision db77d641586bcf38af1b931296519307d5901281) +++ sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -9,7 +9,6 @@ property alias headerMenuIndex : _headerMenu.index property alias titleText : _title.text property alias loggedUser : _loggedInUser.text - property alias model : _model readonly property int currentScreen : _headerMenu.currentScreen property bool isCreateRx : false // set in slot in parent property bool isHeparinFeatured : vSettings.heparinSyringePump @@ -30,16 +29,9 @@ HDF = 3 } - onIsHeparinFeaturedChanged : _model.setProperty(HeaderBar.Heparin, "visible", _root.isHeparinFeatured) - Component.onCompleted : _model.setProperty(HeaderBar.Heparin, "visible", _root.isHeparinFeatured) + onIsHeparinFeaturedChanged : vListModel.setHeaderbarVisible(HeaderBar.Heparin, _root.isHeparinFeatured) + Component.onCompleted : vListModel.setHeaderbarVisible(HeaderBar.Heparin, _root.isHeparinFeatured) - ListModel { id: _model - ListElement { text: qsTr("Treatment"); visible: true; screen: 0; statusColor: "Transparent" } // HeaderBar.Treatment - ListElement { text: qsTr("Trends"); visible: true; screen: 1; statusColor: "Transparent" } // HeaderBar.Trends - ListElement { text: qsTr("Heparin"); visible: true; screen: 2; statusColor: "Transparent" } // HeaderBar.Heparin - ListElement { text: qsTr("HDF"); visible: true; screen: 3; statusColor: "Transparent" } // HeaderBar.HDF - } - function vitalsRecorded() { _vitalsButton.pulseAnimation.start() } MouseArea { id: _mouseArea @@ -155,7 +147,7 @@ titlePixelSize : 32 backgroundColor : Colors.transparent highlightHeight : 15 - model : _model + model : vListModel.headerbarModel onHiddenChanged : { if (hidden) { index = 0 } } } Index: sources/gui/qml/main.qml =================================================================== diff -u -rf0e262920199d1d5ebdbe3f1bf0c58c58a82d363 -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/gui/qml/main.qml (.../main.qml) (revision f0e262920199d1d5ebdbe3f1bf0c58c58a82d363) +++ sources/gui/qml/main.qml (.../main.qml) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -35,6 +35,8 @@ import VTDSwitches 0.1 import VTDEjector 0.1 import VTDTemperature 0.1 +import VListModel 0.1 + // POST import VHDPOSTData 0.1 import VDGPOSTData 0.1 @@ -234,6 +236,7 @@ VTDSwitches { id: vTDSwitches } VTDEjector { id: vTDEjector } VTDTemperature { id: vTDTemperature } + VListModel { id: vListModel } VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } VTreatmentIsolatedUF { id: vTreatmentIsolatedUF } Index: sources/gui/qml/pages/treatment/TreatmentHDF.qml =================================================================== diff -u -rdb77d641586bcf38af1b931296519307d5901281 -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/gui/qml/pages/treatment/TreatmentHDF.qml (.../TreatmentHDF.qml) (revision db77d641586bcf38af1b931296519307d5901281) +++ sources/gui/qml/pages/treatment/TreatmentHDF.qml (.../TreatmentHDF.qml) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -35,7 +35,7 @@ signal treatmentModeEditClicked() // onStatusColorChanged: TODO update to this - Component.onCompleted : { _headerBar.model.setProperty(HeaderBar.HDF, "statusColor", _root.statusColor.toString() ) } + Component.onCompleted : vListModel.setHeaderbarStatusColor(HeaderBar.HDF, _root.statusColor.toString()) Row { id: _row objectName: "_row" Index: sources/gui/qml/pages/treatment/TreatmentHeparin.qml =================================================================== diff -u -rdb77d641586bcf38af1b931296519307d5901281 -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/gui/qml/pages/treatment/TreatmentHeparin.qml (.../TreatmentHeparin.qml) (revision db77d641586bcf38af1b931296519307d5901281) +++ sources/gui/qml/pages/treatment/TreatmentHeparin.qml (.../TreatmentHeparin.qml) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -60,7 +60,7 @@ signal idleTimeout() - onHeparinColorChanged : _headerBar.model.setProperty(HeaderBar.Heparin, "statusColor", heparinColor.toString()) + onHeparinColorChanged : vListModel.setHeaderbarStatusColor(HeaderBar.Heparin, heparinColor.toString()) enum HeparinPrescription{ HeparinType, Index: sources/gui/qml/pages/treatment/sections/TreatmentHDFComponent.qml =================================================================== diff -u -re5576e4397ed640fec2a936dc5e42c773870b29a -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/gui/qml/pages/treatment/sections/TreatmentHDFComponent.qml (.../TreatmentHDFComponent.qml) (revision e5576e4397ed640fec2a936dc5e42c773870b29a) +++ sources/gui/qml/pages/treatment/sections/TreatmentHDFComponent.qml (.../TreatmentHDFComponent.qml) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -21,6 +21,25 @@ import "qrc:/pages/treatment" TreatmentSection { id: _root + readonly property int topTextFontSize : 25 + readonly property int bottomTextFontSize : 60 + readonly property real estimatedSubstitutionVal : 23.0 // TODO update later + readonly property int substitutionRate : 125 // TODO update later + + readonly property real minimum : vTreatmentRanges.substitutionVolumeMin + readonly property real maximum : vTreatmentRanges.substitutionVolumeMax + readonly property real resolution : vTreatmentRanges.substitutionVolumeRes + + readonly property real substitutionValue: 10.0 // TODO update later + + readonly property string statusText : qsTr("Active") + /*isDispensing ? qsTr("Active") : + isPaused ? qsTr("Pause") : + isCompleted ? qsTr("Complete") : qsTr("Active")*/ + + readonly property string buttonText : qsTr("Pause Substitution Flow") + property color statusColor : Colors.transparent + color : Colors.panelBackgroundColor header.color : Colors.heparinSectionHeader enableDropShadow: false @@ -45,25 +64,6 @@ color: Colors.heparinPanelBorderColor } - readonly property int topTextFontSize : 25 - readonly property int bottomTextFontSize : 60 - readonly property real estimatedSubstitutionVal : 23.0 // TODO update later - readonly property int substitutionRate : 125 // TODO update later - - readonly property real minimum : vTreatmentRanges.substitutionVolumeMin - readonly property real maximum : vTreatmentRanges.substitutionVolumeMax - readonly property real resolution : vTreatmentRanges.substitutionVolumeRes - - readonly property real substitutionValue: 10.0 // TODO update later - - readonly property string statusText : qsTr("Active") - /*isDispensing ? qsTr("Active") : - isPaused ? qsTr("Pause") : - isCompleted ? qsTr("Complete") : qsTr("Active")*/ - - readonly property string buttonText : qsTr("Pause Substitution Flow") - property color statusColor : Colors.transparent - signal substitutionFlowClicked() contentItem: Item { id: _content Index: sources/view/VListModel.cpp =================================================================== diff -u --- sources/view/VListModel.cpp (revision 0) +++ sources/view/VListModel.cpp (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -0,0 +1,31 @@ +#include "VListModel.h" + +View::VListModel::VListModel(QObject *parent) +{ + Q_UNUSED(parent) + + _headerbarModel.setRoleNames({ { eRole_Text , "text" }, + { eRole_Visible , "visible" }, + { eRole_Screen , "screen" }, + { eRole_StatusColor , "statusColor" }, + }); + initModel(); +} + +void View::VListModel::initModel() +{ + _headerbarModel.insertRow( Treatment,{{ eRole_Text, tr("Treatment")}, { eRole_Visible, true }, { eRole_Screen, Treatment}, { eRole_StatusColor, "Transparent" }}); + _headerbarModel.insertRow( Trends ,{{ eRole_Text, tr("Trends") }, { eRole_Visible, true }, { eRole_Screen, Trends }, { eRole_StatusColor, "Transparent" }}); + _headerbarModel.insertRow( Heparin ,{{ eRole_Text, tr("Heparin") }, { eRole_Visible, true }, { eRole_Screen, Heparin }, { eRole_StatusColor, "Transparent" }}); + _headerbarModel.insertRow( HDF ,{{ eRole_Text, tr("HDF") }, { eRole_Visible, true }, { eRole_Screen, HDF }, { eRole_StatusColor, "Transparent" }}); +} + +void View::VListModel::setHeaderbarStatusColor (int vRow, QString color) +{ + _headerbarModel.updateData(vRow, eRole_StatusColor, color); +} + +void View::VListModel::setHeaderbarVisible (int vRow, bool visible) +{ + _headerbarModel.updateData(vRow, eRole_Visible, visible); +} Index: sources/view/VListModel.h =================================================================== diff -u --- sources/view/VListModel.h (revision 0) +++ sources/view/VListModel.h (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -0,0 +1,59 @@ +#pragma once + +// Qt +#include + +// Project +#include "main.h" // Doxygen : do not remove +#include "VView.h" + +#include "MListModel.h" + +// namespace +namespace View { + +/*! + * \brief The VListModel class + * \details View for handling general models used for QML + * + * \sa View::VListModel + * + */ +class VListModel : public QObject +{ + Q_OBJECT + + enum { + Treatment = 0, + Trends = 1, + Heparin = 2, + HDF = 3 + } TreatmentScreen; + + enum { + eRole_Text = Qt::UserRole +1 , + eRole_Visible , + eRole_Screen , + eRole_StatusColor + } HeaderbarDataRole; + + Q_PROPERTY(MListModel* headerbarModel READ headerbarModel NOTIFY didHeaderbarModelChange) + +public: + explicit VListModel(QObject *parent = nullptr); + +public slots: + void setHeaderbarStatusColor (int vRow, QString color); + void setHeaderbarVisible (int vRow, bool visible); + +private: + MListModel* headerbarModel () { return &_headerbarModel; } + MListModel _headerbarModel; + + void initModel(); + +signals: + void didHeaderbarModelChange(); + +}; +} Index: sources/view/VView.h =================================================================== diff -u -r5a505f86c26c8e1fd6d584cd53a3765c25120781 -r3c543158a4f8165fe878b59e5d09ea82e06c53f5 --- sources/view/VView.h (.../VView.h) (revision 5a505f86c26c8e1fd6d584cd53a3765c25120781) +++ sources/view/VView.h (.../VView.h) (revision 3c543158a4f8165fe878b59e5d09ea82e06c53f5) @@ -121,6 +121,7 @@ #define REGISTER_VIEW_TYPES \ using namespace View; \ REGISTER_TYPE( VGeneralEvent ) \ + REGISTER_TYPE( VListModel ) \ /* CONFIRM */ \ REGISTER_TYPE( VConfirm ) \ /* POST */ \