Index: leahi.qrc =================================================================== diff -u -r50d6907ed1bef8273ad246a823073153016997e1 -r969fb65fb9857c0a6a84cb9f7d591d16de40e898 --- leahi.qrc (.../leahi.qrc) (revision 50d6907ed1bef8273ad246a823073153016997e1) +++ leahi.qrc (.../leahi.qrc) (revision 969fb65fb9857c0a6a84cb9f7d591d16de40e898) @@ -47,6 +47,7 @@ sources/gui/qml/dialogs/PatientIdEntry.qml sources/gui/qml/dialogs/DryDemoDialog.qml sources/gui/qml/dialogs/ConfirmPasswordDialog.qml + sources/gui/qml/dialogs/CalibrationDialog.qml sources/gui/qml/dialogs/diagnostics/DiagnosticsDialog.qml Index: sources/gui/qml/compounds/NumPad.qml =================================================================== diff -u -rfd09b0ee6e41d75755e0572008d4f932b0bddf2b -r969fb65fb9857c0a6a84cb9f7d591d16de40e898 --- sources/gui/qml/compounds/NumPad.qml (.../NumPad.qml) (revision fd09b0ee6e41d75755e0572008d4f932b0bddf2b) +++ sources/gui/qml/compounds/NumPad.qml (.../NumPad.qml) (revision 969fb65fb9857c0a6a84cb9f7d591d16de40e898) @@ -13,7 +13,7 @@ * */ -import QtQuick 2.12 +import QtQuick 2.15 import QtQuick.Controls 2.12 import QtGraphicalEffects 1.12 @@ -24,17 +24,21 @@ property var settingValue : undefined property alias unit : _unitText.text property alias range : _range.text + property alias showRange : _range.visible property alias title : _title.text property alias displayValue : _valueLabel.text property int precision : 0 property var getter : null property var setter : null - property var validator : null - readonly property bool isValueValid : validator ? validator(valueInt) : true - readonly property var valueInt : isNaN(parseInt(_valueLabel.text)) ? undefined : parseInt(_valueLabel.text) + property real validatorMin : 0 + property real validatorMax : 99999 readonly property string backSpace : "qrc:/images/iBackspace" property bool isOpened : false + property bool allowDecimal : false + property bool showSliderButton : true + property int numCharacters : 3 + property bool isFloat : false width : Variables.numPadWidth height : Variables.numPadHeight @@ -67,9 +71,24 @@ .arg(max) _root.getter = entry.text _root.setter = function (value) { entry.text = value } - _root.validator = function (value) { return value >= min && value <= max } + _root.validatorMin = min + _root.validatorMax = max } +// function openNoRange(entry, title) { +// reset() +// setupOpenInput(entry, title) +// _keyboard.setVisible(false) +// show() +// } + +// function setupOpenInput(entry, title) { +//// _root.settingValue = Qt.binding(function () { return entry.text }) +// _root.title = title +// _root.getter = entry.text +// _root.setter = function (value) { entry.text = value } +// } + function show() { if ( ! isOpened ) { x = x + _root.width @@ -103,6 +122,7 @@ radius : height border.color : Colors.transparent backgroundColor : Colors.backgroundButtonSelect + visible : _root.showSliderButton onPressed : isOpened ? hide() : show() Image { id : _iconImage @@ -156,14 +176,19 @@ radius : 10 color : "#324867" - Text { id: _valueLabel + TextInput { id: _valueLabel anchors.centerIn: parent font { pixelSize : 65 weight : Font.DemiBold } - color : isValueValid ? Colors.offWhite : Colors.red - text : "" + color : _valueLabel.acceptableInput ? Colors.offWhite : Colors.red + + validator: DoubleValidator { id: _validator + bottom : _root.validatorMin + top : _root.validatorMax + decimals: _root.isFloat ? 3 : 0 + } } } @@ -218,7 +243,7 @@ icon.source : modelData === backSpace ? modelData : "" icon.height : 45 icon.width : 45 - enabled : modelData === "." ? precision > 0 : true + enabled : _root.allowDecimal ? true : modelData === "." ? precision > 0 : true contentItem: Rectangle { anchors.fill : parent @@ -250,7 +275,7 @@ _valueLabel.text = _keyButton.text _numPadGrid.replaceValueText = false } - else if (_valueLabel.text.length < 3) { + else if (_valueLabel.text.length < _root.numCharacters) { _valueLabel.text += _keyButton.text } } Index: sources/gui/qml/dialogs/CalibrationDialog.qml =================================================================== diff -u --- sources/gui/qml/dialogs/CalibrationDialog.qml (revision 0) +++ sources/gui/qml/dialogs/CalibrationDialog.qml (revision 969fb65fb9857c0a6a84cb9f7d591d16de40e898) @@ -0,0 +1,215 @@ +// Qt +import QtQuick 2.15 + +// Project + +// Qml imports +import "qrc:/globals" +import "qrc:/components" +import "qrc:/compounds" + +ModalDialog { id: _root + property int index : -1 + property int sensorIndex : -1 + property string titleText : "" + property string componentName : "" + property var entries : [] + property var rejections : vCalibrationSettings.rejectionReasons + property var entryNames : vCalibrationSettings.columnTitle + property var model : null + property alias numPad : _numPad + + height : Variables.smallDialogHeight + width : Variables.smallDialogWidth + y : Math.round((Variables.applicationHeight - height) / 2) - Variables.headerHeight + x : Math.round((Variables.applicationWidth - width) / 2) - 200 + radius : Variables.adjustmentDialogRadius + + backgroundItem : [ NumPad { id: _numPad + x : _root.width + y : 0 + isOpened : true + allowDecimal : true + showSliderButton: false + showRange : false + numCharacters : 6 + isFloat : true + } ] + + onOpened: { + Qt.callLater(function() { + if (_repeater.count > 0) { + _repeater.itemAt(0).textEntry.clicked(0) + } + }) + } + + onClosed: { + _root.entries = [] + } + + function confirmClicked() { + let payload = [] + for (let i = 0; i < _repeater.count; ++i) { + payload[i] = _repeater.itemAt(i).textEntry.text + } + vCalibrationSettings.doAdjustment(_root.index, + _root.sensorIndex, + payload) + + // REMOVE LATER TO THE ACCEPT OF THE RESPONSE MESSAGE ***** + close() + } + + function confirmEnabled() { + for (let i = 0; i < _repeater.count - 1; ++i) { + const item = _repeater.itemAt(i) + if (!item || !item.textEntry.textInput.acceptableInput) return false + } + + return true + } + + function openDialog (vIndex, vSensorIndex, vRecord){ + _root.model = vRecord + _root.index = vIndex + _root.sensorIndex = vSensorIndex + _root.titleText = vRecord.title + _root.componentName = vRecord.component + _root.entries = vRecord.payload + open() + } + + header: Item { id : _headerRect + implicitHeight: Variables.adjustmentHeaderHeight + + TitleText { id : _titleText + text: qsTr("Edit %1 (%2)").arg(titleText).arg(componentName) + font { + pixelSize : Fonts.fontPixelSection + weight : Font.Medium + } + color : Colors.offWhite + width : _root.width - Variables.defaultMargin * 2 + height : parent.height + anchors { + bottom : parent.bottom + horizontalCenter : parent.horizontalCenter + margins : Variables.defaultMargin + } + } + + CloseButton { id : _closeButton + anchors { + right : parent.right + top : parent.top + margins : Variables.adjustmentButtonMargin + } + + onClicked : { + close() + } + } + } + + Grid { id: entryColumn + anchors.horizontalCenter: parent.horizontalCenter + columns : 2 + rowSpacing : Variables.defaultMargin * 5 + columnSpacing : Variables.defaultMargin * 5 + + Repeater { id: _repeater + model: _root.entries + + delegate: Item { id: _delegate + readonly property bool isCalTime: index === _repeater.count - 1 + property alias textEntry : _textEntry + + height : Variables.contentHeight + width : Variables.treatmentFlowsComponentWidth + + Text { id : _label + anchors { + top : parent.top + horizontalCenter: parent.horizontalCenter + } + + height : Variables.contentHeight + width : parent.width + + color : Colors.textMain + font.pixelSize : Fonts.fontPixelTextRectExtra + font.weight : Font.Medium + text : _root.entryNames[index] ?? "" + horizontalAlignment: Text.AlignHCenter + } + + Rectangle { id: _rect + anchors { + top : _label.bottom + horizontalCenter: parent.horizontalCenter + + } + height : 75 + width : parent.width + radius : 8.5 + color : isCalTime ? Colors.transparent : Colors.panelBackgroundColor + + border { + width : isCalTime ? 0 : 2 + color : _root.rejections[index] === Variables.noRejectReason ? _root.entryNames[index] === _root.numPad.title ? Colors.borderButton : + Colors.panelBorderColor : + Colors.red + } + + TextEntry { id : _textEntry + anchors.centerIn : parent + text : Number(modelData).toFixed(3) ?? Variables.emptyEntry + textInput.font.pixelSize: Fonts.fontPixelValueControl + line.visible : false + textInput.color : _textEntry.textInput.acceptableInput ? Colors.offWhite : Colors.red + useQtNumPad : false + showPlaceHolderText : true + visible : ! isCalTime + + validator: DoubleValidator { + bottom : numPad.validatorMin + top : numPad.validatorMax + decimals: 3 + } + + onClicked: _root.numPad.open( _textEntry, + _root.entryNames[index], + _root.numPad.validatorMin, + _root.numPad.validatorMax, + "") + } + + Text { id : _textEntryCalTime + anchors.centerIn : parent + text : modelData ?? Variables.emptyEntry + font.pixelSize : Fonts.fontPixelTextRectExtra + color : Colors.offWhite + visible : isCalTime + } + } + } + } + } + + ConfirmButton { id : _confirmButton + width : Variables.defaultButtonWidth + height : Variables.defaultButtonHeight + enabled : _root.confirmEnabled() + anchors { + top : undefined + right : undefined + margins : 0 + bottom : _root.contentItem.bottom + bottomMargin : Variables.defaultMargin * 2 + horizontalCenter: _root.contentItem.horizontalCenter + } + onClicked : _root.confirmClicked() + } +} + Index: sources/gui/qml/pages/settings/SettingsCalibrationSettings.qml =================================================================== diff -u -r50d6907ed1bef8273ad246a823073153016997e1 -r969fb65fb9857c0a6a84cb9f7d591d16de40e898 --- sources/gui/qml/pages/settings/SettingsCalibrationSettings.qml (.../SettingsCalibrationSettings.qml) (revision 50d6907ed1bef8273ad246a823073153016997e1) +++ sources/gui/qml/pages/settings/SettingsCalibrationSettings.qml (.../SettingsCalibrationSettings.qml) (revision 969fb65fb9857c0a6a84cb9f7d591d16de40e898) @@ -6,61 +6,44 @@ import "qrc:/globals" import "qrc:/components" import "qrc:/compounds" +import "qrc:/dialogs" SettingsBase { id: _root - property var fieldList : [] - itemIndex : SettingsStack.CalibrationSettings - confirmVisible : false - Component.onCompleted: _root.updateList (SettingsCalibrationSettings.Pressure) + Component.onCompleted: vCalibrationSettings.refreshList(SettingsCalibrationSettings.Pressure) - enum CalibrationSensor { - Pressure = 0, - Temperature = 1 + function openDialog( vIndex ) { + _calibrationDialog.openDialog( _componentComboBox.currentIndex, + vIndex, + _listView.model.get(vIndex)) } + CalibrationDialog { id: _calibrationDialog } + BaseComboBox { id: _componentComboBox anchors.top : _root.top anchors.topMargin : Variables.headerButtonsMargin anchors.horizontalCenter : parent.horizontalCenter height : Variables.contentHeight currentIndex : 0 model : [ - "Pressure Sensors" , - "Temperature" , - "Filters" + qsTr("Pressure Sensors" ) , + qsTr("Temperature" ) , + qsTr("Concentrate Pump" ) , + qsTr("Dialysate Pump (D48)" ) , + qsTr("Dialysate Pump (D1)" ) , + qsTr("Acid Types" ) , + qsTr("Bicarb Types" ) , + qsTr("Accelerometer" ) , + qsTr("Blood Leak" ) ] - onActivated: _root.updateList(currentIndex) + onActivated: vCalibrationSettings.refreshList(currentIndex) } - function updateList(vCurrentIndex) { - fieldList = [] - - switch(vCurrentIndex) { - case SettingsCalibrationSettings.Pressure: - fieldList.push("Gain") - fieldList.push("Offset") - fieldList.push("Offset") - fieldList.push("Offset") - - break - case SettingsCalibrationSettings.Temperature: - fieldList.push("3f34") - fieldList.push("34f43") - break - - default: - break - } - - // Notify QML that the array changed - fieldList = fieldList - } - component HeaderText: Text { id: _headerText property string title : "" anchors.verticalCenter : parent.verticalCenter @@ -73,7 +56,7 @@ contentItem: Item { id: _contentItem anchors.fill : parent - readonly property int contentWith: _listView.width - Variables.defaultMargin * 2 // added margin to have scroll bar show on right + readonly property int contentWith: _listView.width - Variables.defaultMargin //* 2 // added margin to have scroll bar show on right Rectangle { id: _header color : Colors.treatmentSectionHeader @@ -85,20 +68,23 @@ width : _contentItem.width height : Variables.institutionaltContainerHeight - HeaderText { id: _parameters; title: qsTr("Description"); width: _contentItem.width * 0.2 } - HeaderText { id: _minimum; title: qsTr("Component"); width: _contentItem.width * 0.2 } + HeaderText { title: qsTr("Description"); width: _contentItem.width * 0.3 } + HeaderText { title: qsTr("Component"); width: _contentItem.width * 0.1; leftPadding: 0 } Row { id: _headerComponentRow width : _contentItem.width * 0.6 height : Variables.institutionaltContainerHeight Repeater { id: _repeater - model : _root.fieldList + model : vCalibrationSettings.columnTitle delegate: HeaderText { - title : modelData + readonly property bool isCalTime: index === _repeater.count - 1 + + title : modelData height : Variables.institutionaltContainerHeight - width : _headerComponentRow.width / _root.fieldList.length + leftPadding : isCalTime ? Variables.defaultMargin : Variables.defaultMargin * 2 + width : _headerComponentRow.width / vCalibrationSettings.columnTitle.length verticalAlignment : Text.AlignVCenter } } @@ -128,11 +114,69 @@ } boundsBehavior : Flickable.StopAtBounds clip : true -// model : vInstitutionalRecord.model + model : vCalibrationSettings.model spacing : anchors.topMargin flickableDirection : Flickable.VerticalFlick - } + delegate: Rectangle { + height : Variables.institutionaltContainerHeight + width : _contentItem.contentWith + radius : 8.5 + color : Colors.panelBackgroundColor + border { + width: 1 + color: _mouseArea.pressed || _editButton.isPressed ? Colors.borderButton : Colors.panelBorderColor + } + MouseArea { id: _mouseArea + anchors.fill : parent + anchors.rightMargin: _contentItem.width / 2 + onClicked : _root.openDialog(index) + } + + IconButton { id : _editButton + anchors { + left : parent.left + leftMargin : Variables.defaultMargin / 2 + verticalCenter : parent.verticalCenter + } + iconImageSource : "qrc:/images/iEdit" + iconSize : Variables.iconsDiameter + onPressed : _root.openDialog( index ) + } + + Row { id: _delegateRow + width : _contentItem.width + height : Variables.institutionaltContainerHeight + + HeaderText { title: model.title; width: _contentItem.width * 0.3; font.weight: Font.Normal; leftPadding: Variables.defaultMargin * 3 } + HeaderText { title: model.component; width: _contentItem.width * 0.1 } + + Row { id: _delegateComponentRow + width : _contentItem.width * 0.6 + height : Variables.institutionaltContainerHeight + + Repeater { id: _delegateRepeater + model : payload + + delegate: HeaderText { + readonly property bool isCalTime: index === _delegateRepeater.count - 1 + + title : isCalTime ? modelData : Number(modelData).toFixed(3) + height : Variables.institutionaltContainerHeight + leftPadding : isCalTime ? 0 : Variables.defaultMargin * 2 + width : _delegateComponentRow.width / vCalibrationSettings.columnTitle.length + verticalAlignment : Text.AlignVCenter + font.pixelSize : isCalTime ? Fonts.fontPixelDefaultButton : Fonts.fontPixelTextRectTitle + + + } + } + } + } + } + + ScrollBar { flickable: _listView } + } } } Index: sources/view/settings/VCalibrationSettings.cpp =================================================================== diff -u -r50d6907ed1bef8273ad246a823073153016997e1 -r969fb65fb9857c0a6a84cb9f7d591d16de40e898 --- sources/view/settings/VCalibrationSettings.cpp (.../VCalibrationSettings.cpp) (revision 50d6907ed1bef8273ad246a823073153016997e1) +++ sources/view/settings/VCalibrationSettings.cpp (.../VCalibrationSettings.cpp) (revision 969fb65fb9857c0a6a84cb9f7d591d16de40e898) @@ -1,85 +1,129 @@ -#include "VCalibrationSettings.h" // Project #include "GuiController.h" #include "format.h" +#include "VCalibrationSettings.h" +#include + VIEW_DEF_CLASS_ADJUSTMENT(VCalibrationSettings) void View::VCalibrationSettings::initConnections() { -// ADJUST_VIEW_CONNECTION(InstitutionalRequestData) -// ACTION_VIEW_CONNECTION(InstitutionalRecordResponseData) -// ACTION_VIEW_CONNECTION(SettingsData); -// ACTION_VIEW_CONNECTION(AdjustInstitutionalRecordResponseData) - _calibrationList.setRoleNames({ - { eRole_Title , "title" }, - + { eRole_Title , "title" }, + { eRole_Component , "component" }, + { eRole_Payload , "payload" }, }); +} - initModel(); +QVariantList View::VCalibrationSettings::createInitPayload(int vCount) +{ + QVariantList list; + list.reserve(vCount); + + for (int i = 0; i < vCount; ++i) { + list.append(0); + } + + rejectionReasons(list); + + return list; } -void View::VCalibrationSettings::initModel() +quint32 View::VCalibrationSettings::getEpochUTC() { - _calibrationList.insertRow( eBloodFlowRate, {{ eRole_Title, tr("Blood Flow Rate") }}); - _calibrationList.insertRow( eDialysateFlowRate, {{ eRole_Title, tr("Dialysate Flow Rate") }}); - _calibrationList.insertRow( eTreatmentDuration, {{ eRole_Title, tr("Treatment Duration") }}); - _calibrationList.insertRow( eHeparinBolusVolume, {{ eRole_Title, tr("Heparin Bolus Volume") }}); - _calibrationList.insertRow( eHeparinDispenseRate, {{ eRole_Title, tr("Heparin Dispense Rate") }}); - _calibrationList.insertRow( eHeparinStopTime, {{ eRole_Title, tr("Heparin Stop Time") }}); - _calibrationList.insertRow( eDialysateTemperature, {{ eRole_Title, tr("Dialysate Temperature") }}); - _calibrationList.insertRow( eAcidCompositionPotassium, {{ eRole_Title, tr("Acid Composition ([K+])") }}); - _calibrationList.insertRow( eAcidCompositionCalcium, {{ eRole_Title, tr("Acid Composition ([Ca2+])") }}); - _calibrationList.insertRow( eBicarbFinalDialysateComposition, {{ eRole_Title, tr("Bicarb. Final Dialysate Composition") }}); - _calibrationList.insertRow( eSodiumFinalDialysateComposition, {{ eRole_Title, tr("Sodium Final Dialysate Composition") }}); - _calibrationList.insertRow( eFluidBolusVolume, {{ eRole_Title, tr("Fluid Bolus Volume") }}); - _calibrationList.insertRow( eArterialPressureLimit, {{ eRole_Title, tr("Arterial Pressure Limit") }}); - _calibrationList.insertRow( eVenousPressureLimit, {{ eRole_Title, tr("Venous Pressure Limit") }}); - _calibrationList.insertRow( eVenousAsymPressureLimit, {{ eRole_Title, tr("Venous Asym Pressure Limit") }}); - _calibrationList.insertRow( eTMPWindowLimit, {{ eRole_Title, tr("TMP Window Limit") }}); - _calibrationList.insertRow( eUFVolume, {{ eRole_Title, tr("UF Volume") }}); - _calibrationList.insertRow( eVitalsInterval, {{ eRole_Title, tr("Vitals Interval") }}); - _calibrationList.insertRow( eRinsebackVolume, {{ eRole_Title, tr("Rinseback Volume") }}); - _calibrationList.insertRow( eRinsebackFlowRate, {{ eRole_Title, tr("Rinseback Flow Rate") }}); - _calibrationList.insertRow( eSubstitutionVolume, {{ eRole_Title, tr("Substitution Volume") }}); + const QDateTime currentDateTimeUTC = QDateTime::currentDateTime(); + return currentDateTimeUTC.toSecsSinceEpoch(); } -//void View::VInstitutionalRecord::onActionReceive(const InstitutionalRecordResponseData &vData) -//{ -// adjustment_Accepted ( vData.mAccepted ); -// adjustment_Reason ( vData.mReason ); +void View::VCalibrationSettings::refreshList (int vIndex) +{ + _columnTitle.clear(); + _calibrationList.clear(); -// _institutionalList.updateData( eBloodFlowRate, eRole_MinVal, vData.mBloodFlowMin ); -// _institutionalList.updateData( eBloodFlowRate, eRole_MaxVal, vData.mBloodFlowMax ); -// _institutionalList.updateData( eBloodFlowRate, eRole_DefVal, vData.mBloodFlowDef ); + switch (vIndex) { + case ePressure : + { + columnTitle ( { tr("4th order"), tr("3rd order"), tr("2nd order"), tr("Gain"), tr("Offset"), tr("Cal Time") } ) ; + QVariantList initPayloadValues = createInitPayload(_columnTitle.count()); // may remove alter when we add getter message from FW + // DD Pressure sensors + _calibrationList.appendRow( {{ eRole_Title, tr("Hydraulics Outlet Pressure")}, { eRole_Component, tr("D9" )}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Dry Bicarb Pressure")}, { eRole_Component, tr("D66")}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Spent Dialysate Pressure")}, { eRole_Component, tr("D51")}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Fresh Dialysate Pressure")}, { eRole_Component, tr("D15")}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Transmembrane Pressure")}, { eRole_Component, tr("D41")}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("D87 Pressure Sensor")}, { eRole_Component, tr("D87")}, {eRole_Payload, initPayloadValues }}); +// // FP Pressure sensors + _calibrationList.appendRow( {{ eRole_Title, tr("Water inlet pressure before regulator")}, { eRole_Component, tr("M3") }, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Water inlet pressure after regulator")}, { eRole_Component, tr("P8") }, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Water inlet pressure before the cond. sensor")}, { eRole_Component, tr("P13")}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Pressure before the RO filter")}, { eRole_Component, tr("P17")}, {eRole_Payload, initPayloadValues }}); + _calibrationList.appendRow( {{ eRole_Title, tr("Pressure after the RO filter")}, { eRole_Component, tr("P46")}, {eRole_Payload, initPayloadValues }}); + break; + } + case eTemperature : + columnTitle ( { tr("4th order"), tr("3rd order"), tr("2nd order"), tr("Gain"), tr("Offset"), tr("Cal Time") } ) ; + break; + case eConcentratePump : + columnTitle ( { tr("4th order"), tr("3rd order"), tr("2nd order"), tr("Gain"), tr("Offset"), tr("Cal Time") } ) ; + break; + case eDialysatePumpD48 : + columnTitle ( { tr("4th order"), tr("3rd order"), tr("2nd order"), tr("Gain"), tr("Offset"), tr("Cal Time") } ) ; + break; + case eDialysatePumpD1 : + columnTitle ( { tr("Target Speed"), tr("Cal Time") } ) ; -// // *** has to be the last to let the information to be set and then emit the signal *** -// // *** otherwise will use the Previous values before being set. *** -// adjustment ( true ); -//} + break; + case eAcidTypes : + break; + case eBicarbTypes : + break; + case eAccelerometer : + break; + case eBloodLeak : + break; + } +} +void View::VCalibrationSettings::doAdjustment(int vIndex, int vSensorIndex, QVariantList vPayload) +{ + // to test rejeciton reason - works -- REMOIVE later +// static int test = 0; +// rejectionReasons ({0,0,0,0,test = ! test,0}); -//void View::VInstitutionalRecord::onActionReceive(const AdjustInstitutionalRecordResponseData &vData) -//{ -// _institutionalList.updateData(eBloodFlowRate, eRole_RejectionMin, vData.mBloodFlowRateMinRejectionReason ); -// _institutionalList.updateData(eBloodFlowRate, eRole_RejectionMax, vData.mBloodFlowRateMaxRejectionReason ); -// _institutionalList.updateData(eBloodFlowRate, eRole_RejectionDef, vData.mBloodFlowRateDefRejectionReason ); -// _institutionalList.updateData(eDialysateFlowRate, eRole_RejectionMin, vData.mDialysateFlowRateMinRejectionReason ); -// _institutionalList.updateData(eDialysateFlowRate, eRole_RejectionMax, vData.mDialysateFlowRateMaxRejectionReason ); -// _institutionalList.updateData(eDialysateFlowRate, eRole_RejectionDef, vData.mDialysateFlowRateDefRejectionReason ); -// _institutionalList.updateData(eTreatmentDuration, eRole_RejectionMin, vData.mTreatmentDurationMinRejectionReason ); -// _institutionalList.updateData(eTreatmentDuration, eRole_RejectionMax, vData.mTreatmentDurationMaxRejectionReason ); -// _institutionalList.updateData(eTreatmentDuration, eRole_RejectionDef, vData.mTreatmentDurationDefRejectionReason ); -// _institutionalList.updateData(eHeparinBolusVolume, eRole_RejectionMin, vData.mHeparinBolusVolumeMinRejectionReason ); -// _institutionalList.updateData(eHeparinBolusVolume, eRole_RejectionMax, vData.mHeparinBolusVolumeMaxRejectionReason ); -// _institutionalList.updateData(eHeparinBolusVolume, eRole_RejectionDef, vData.mHeparinBolusVolumeDefRejectionReason ); -// _institutionalList.updateData(eHeparinDispenseRate, eRole_RejectionMin, vData.mHeparinDispensingRateMinRejectionReason ); -// _institutionalList.updateData(eHeparinDispenseRate, eRole_RejectionMax, vData.mHeparinDispensingRateMaxRejectionReason ); -// _institutionalList.updateData(eHeparinDispenseRate, eRole_RejectionDef, vData.mHeparinDispensingRateDefRejectionReason ); -// _institutionalList.updateData(eHeparinStopTime, eRole_RejectionMin, vData.mHeparinStopTimeMinRejectionReason ); + quint32 calTime = getEpochUTC(); -//} + // set cal time to payload. + if ( ! vPayload.isEmpty()) + { + vPayload.last() = Format::fromEpoch( calTime, "yyyy/MM/dd, HH:mm" ); + } + _calibrationList.updateData(vSensorIndex, eRole_Payload, vPayload); + + qDebug() << "Cal Time: " << vPayload.last() << " -- Epoch:" << calTime; + + + switch (vIndex) { + case ePressure : + break; + case eTemperature : + break; + case eConcentratePump : + break; + case eDialysatePumpD48 : + break; + case eDialysatePumpD1 : + break; + case eAcidTypes : + break; + case eBicarbTypes : + break; + case eAccelerometer : + break; + case eBloodLeak : + break; + } +} Index: sources/view/settings/VCalibrationSettings.h =================================================================== diff -u -r50d6907ed1bef8273ad246a823073153016997e1 -r969fb65fb9857c0a6a84cb9f7d591d16de40e898 --- sources/view/settings/VCalibrationSettings.h (.../VCalibrationSettings.h) (revision 50d6907ed1bef8273ad246a823073153016997e1) +++ sources/view/settings/VCalibrationSettings.h (.../VCalibrationSettings.h) (revision 969fb65fb9857c0a6a84cb9f7d591d16de40e898) @@ -6,10 +6,8 @@ // Project #include "main.h" // Doxygen : do not remove #include "VAdjustmentResponseBase.h" -//#include "MAdjustTDInstitutionalRecordResponse.h" #include "MListModel.h" #include "MSettings.h" -//#include "MTDInstitutionalRecordResponse.h" namespace View { @@ -26,95 +24,48 @@ // friends friend class ::tst_views; - - enum { eRole_Title = Qt::UserRole + 1 , - eRole_Units , - eRole_Min , - eRole_Max , - eRole_Step , - eRole_Decimal , - eRole_MinVal , - eRole_MaxVal , - eRole_DefVal , - eRole_RejectionMin , - eRole_RejectionMax , - eRole_RejectionDef , - eRole_CanOff , + eRole_Component , + eRole_Payload , } DataRole; enum { - eBloodFlowRate , - eDialysateFlowRate , - eTreatmentDuration , - eHeparinBolusVolume , - eHeparinDispenseRate , - eHeparinStopTime , - eDialysateTemperature , - eAcidCompositionPotassium , - eAcidCompositionCalcium , - eBicarbFinalDialysateComposition , - eSodiumFinalDialysateComposition , - eFluidBolusVolume , - eArterialPressureLimit , - eVenousPressureLimit , - eVenousAsymPressureLimit , - eTMPWindowLimit , - eUFVolume , - eVitalsInterval , - eRinsebackVolume , - eRinsebackFlowRate , - eSubstitutionVolume + ePressure , + eTemperature , + eConcentratePump , + eDialysatePumpD48 , + eDialysatePumpD1 , + eAcidTypes , + eBicarbTypes , + eAccelerometer , + eBloodLeak } Records; // The property adjustment_Triggered has to be always true // and to always trigger the change event to work as a notifier for GUI - TRIGGER( bool , adjustment , 0) + TRIGGER( bool , adjustment , 0 ) -// RANGESET( quint32 , bloodFlowRate , 0) -// RANGESET( quint32 , dialysateFlowRate , 0) -// RANGESET( quint32 , treatmentDuration , 0) -// RANGESET( float , heparinBolusVolume , 0) -// RANGESET( float , heparinDispensingRate , 0) -// RANGESET( quint32 , heparinStopTime , 0) -// RANGESET( float , dialysateTemp , 0) -// RANGESET( float , acidConcentratePotassium , 0) -// RANGESET( float , acidConcentrateCalcium , 0) -// RANGESET( quint32 , fluidBolusVolume , 0) -// RANGESET( quint32 , bicarbFinalDialysateComposition , 0) -// RANGESET( quint32 , sodiumFinalDialysateComposition , 0) -// RANGESET( qint32 , arterialPressureLimitWindow , 0) -// RANGESET( qint32 , venousPressureLimitWindow , 0) -// RANGESET( qint32 , venousPressureLimitAsymtrc , 0) -// RANGESET( qint32 , trancembrncPressureLimitWindow , 0) -// RANGESET( float , ultrafiltrationVolume , 0) -// RANGESET( quint32 , rinsebackVolume , 0) -// RANGESET( quint32 , rinsebackFlowRate , 0) -// RANGESET( float , substitutionVolume , 0) + PROPERTY(QStringList , columnTitle , {}) + PROPERTY(QVariantList , rejectionReasons , {}) Q_PROPERTY(MListModel* model READ model NOTIFY didModelChange) - VIEW_DEC_CLASS(VCalibrationSettings); + VIEW_DEC_CLASS(VCalibrationSettings); /// REMOVE ONCE RESPONSE INPOMEPLEENTED // VIEW_DEC_CLASS_ADJUSTMENT(VCalibrationSettings, InstitutionalRecordResponseData ) -// VIEW_DEC_SLOT(SettingsData ) -// VIEW_DEC_SLOT(AdjustInstitutionalRecordResponseData ) private: MListModel* model () { return &_calibrationList; } MListModel _calibrationList; - void initModel(); + QVariantList createInitPayload(int vCount); + quint32 getEpochUTC(); public slots: -// void doAdjustment() { -// InstitutionalRequestData data; -// emit didAdjustment(data); -// } + void refreshList (int vIndex); + void doAdjustment(int vIndex, int vSensorIndex, QVariantList vPayload); -// void clearRejectionReason(const int &vRow, const int &vRange); signals: -// void didAdjustment(const InstitutionalRequestData &vData); void didModelChange(); }; }