Index: sources/gui/qml/pages/treatment/TreatmentCreate.qml =================================================================== diff -u -r305d411b4bc617d858075f5750dea487d707bebb -rc71deaab48699cffdf9db816dfac2778d79c2238 --- sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision 305d411b4bc617d858075f5750dea487d707bebb) +++ sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision c71deaab48699cffdf9db816dfac2778d79c2238) @@ -1,5 +1,4 @@ /*! -<<<<<<< HEAD * * Copyright (c) 2020 Diality Inc. - All Rights Reserved. * \copyright \n @@ -8,29 +7,16 @@ * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n * * \file TreatmentCreate.qml - * \date 2020/07/07 - * \author Peter Lucia - * -======= - * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. - * \copyright - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN - * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. - * - * \file TreatmentCreate.qml - * \author (last) Behrouz NematiPour - * \date (last) 12-May-2020 + * \author (last) Peter Lucia + * \date (last) 17-07-2020 * \author (original) Behrouz NematiPour * \date (original) 27-Jan-2020 - * ->>>>>>> master + * */ // Qt import QtQuick 2.12 import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 // Project // Qml imports @@ -44,23 +30,19 @@ ScreenItem { id: _root signal clickedBack() signal clickedContinue() + backgroundRect.color: Colors.backgroundMainMenu - Rectangle { id: _topMenuBar + TopMenuBarCreateTreatment { id: _topMenuBar anchors.top: parent.top anchors.left: parent.left - height: Variables.mainMenuHeight; - width: parent.width; - color: Colors.backgroundMainMenu + width: parent.width + onClickedBack: { + _root.clickedBack(); - BackButton { id : _backButton - anchors.verticalCenter: parent.verticalCenter - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: _topMenuBar.height / 6 - onClicked: clickedBack() } } + Flickable { id: _flickable anchors.top: _topMenuBar.bottom @@ -97,127 +79,239 @@ id: _bloodFlowRate text: "Blood Flow Rate" units: qsTr(" mL/min") - min: 100 - max: 500 + min: vCreateTreatment.bloodFlowRateMin + max: vCreateTreatment.bloodFlowRateMax + value: vCreateTreatment.bloodFlowRate + onSliderChanged: { + vCreateTreatment.bloodFlowRate = value; + } } SliderCreateTreatment { id: _dialysateFlowRate text: "Dialysate Flow Rate" units: qsTr(" mL/min") - min: 100 - max: 600 + min: vCreateTreatment.dialysateFlowRateMin + max: vCreateTreatment.dialysateFlowRateMax + onSliderChanged: { + vCreateTreatment.dialysateFlowRate = value; + } } SliderCreateTreatment { id: _duration text: "Duration" units: qsTr(" min") - min: 60 - max: 480 + min: vCreateTreatment.durationMin + max: vCreateTreatment.durationMax + onSliderChanged: { + vCreateTreatment.duration = value; + } } SliderCreateTreatment { id: _heparinDispensingRate text: "Heparin Dispensing Rate" - units: qsTr(" IU/hr") - min: 0 - max: 1000 + units: qsTr(" mL/hr") + min: vCreateTreatment.heparinDispensingRateMin + max: vCreateTreatment.heparinDispensingRateMax + onSliderChanged: { + vCreateTreatment.heparinDispensingRate = value; + } } SliderCreateTreatment { id: _heparinBolusVolume text: "Heparin Bolus Volume" - units: qsTr(" IU") - min: 100 - max: 2000 + units: qsTr(" mL") + min: vCreateTreatment.heparinBolusVolumeMin + max: vCreateTreatment.heparinBolusVolumeMax + onSliderChanged: { + vCreateTreatment.heparinBolusVolume = value; + } } - // TODO: if possible, make this a component - Rectangle { - id: _rectInfusionSolBolus - anchors.horizontalCenter: parent.horizontalCenter - color: "transparent" - property int numRows: 1 - property int numCols: 3 - property int buttonHeight: 96 - property int buttonWidth: 214 - height: numRows * buttonHeight - width: numCols * buttonWidth + SliderCreateTreatment { + id: _heparinStopTime + text: "Heparin Stop Time" + units: qsTr(" min") + min: vCreateTreatment.heparinStopTimeMin + max: vCreateTreatment.heparinStopTimeMax + onSliderChanged: { + vCreateTreatment.heparinStopTime = value; + } + } - Text { - id: _infusionSolutionBolus - text: "Infusion Solution Bolus" - font.pixelSize: Fonts.fontPixelFluidText - color: Colors.textMain; + RectSelectCreateTreatment { + id: _salineBolus + name: "Saline Bolus" + buttonNames: vCreateTreatment.salineBolusOptions + onButtonClicked: { + vCreateTreatment.salineBolusVolume = selectedIndex; } + } - GridLayout { - id: _grid - anchors.top: _infusionSolutionBolus.bottom - anchors.topMargin: Variables.sliderTextMargin - rows: parent.numRows - columns: parent.numCols + RectSelectCreateTreatment { + id: _acidConcentrate + name: "Acid Concentrate" + buttonNames: vCreateTreatment.acidConcentrateOptions; + onButtonClicked: { + vCreateTreatment.acidConcentrate = selectedIndex; + } + } - TouchRect { - id: _100mL - text.text: "100 mL"; - selectable: true - height: _rectInfusionSolBolus.buttonHeight - width: _rectInfusionSolBolus.buttonWidth - radius: 0 - onClicked: { - _200mL.setSelected(false) - _300mL.setSelected(false) - } - } + RectSelectCreateTreatment { + id: _bicarbonateConcentrate + name: "Bicarbonate Concentrate" + numRows: 1 + numCols: 2 + buttonNames: vCreateTreatment.bicarbonateConcentrateOptions; + onButtonClicked: { + vCreateTreatment.bicarbonateConcentrate = selectedIndex; + } + } - TouchRect { - id: _200mL - text.text: "200 mL"; - selectable: true - height: _rectInfusionSolBolus.buttonHeight - width: _rectInfusionSolBolus.buttonWidth - radius: 0 - onClicked: { - _300mL.setSelected(false) - _100mL.setSelected(false) - } - } + RectSelectCreateTreatment { + id: _dialyserType + name: "Dialyzer Type" + numRows: 3 + numCols: 2 + buttonNames: vCreateTreatment.dialyzerTypeOptions; + onButtonClicked: { + vCreateTreatment.dialyzerType = selectedIndex; + } + } - TouchRect { - id: _300mL - text.text: "300 mL"; - selectable: true - height: _rectInfusionSolBolus.buttonHeight - width: _rectInfusionSolBolus.buttonWidth - radius: 0 - animated: true - duration: 50 - onClicked: { - _100mL.setSelected(false) - _200mL.setSelected(false) - } - } + SliderCreateTreatment { + id: _dialysateTemperature + text: "Dialysate Temperature" + units: qsTr(" C") + step: 0.1 + min: vCreateTreatment.dialysateTempMin + max: vCreateTreatment.dialysateTempMax + onSliderChanged: { + vCreateTreatment.dialysateTemp = value; } + } + Text { + id: _arterialPressureLimitsTitle + text: "Arterial Pressure Limits" + anchors.left: _arterialPressureLimits.left + font.pixelSize: Fonts.fontPixelFluidText + color: Colors.textMain; + } + SliderDoubleCreateTreatment { + id: _arterialPressureLimits + lowTitle: "Low" + lowUnits: " mmHg" + highTitle: "High" + highUnits: " mmHg" + lowMin: vCreateTreatment.arterialPressureLimitLowMin + lowMax: vCreateTreatment.arterialPressureLimitLowMax + highMin: vCreateTreatment.arterialPressureLimitHighMin + highMax: vCreateTreatment.arterialPressureLimitHighMax + onLowSliderChanged: { + vCreateTreatment.arterialPressureLimitLow = lowValue + } + onHighSliderChanged: { + vCreateTreatment.arterialPressureLimitHigh = highValue + } + } + + + Text { + id: _venousPressureLimitsTitle + text: "Venous Pressure Limits" + anchors.left: _venousPressureLimits.left + font.pixelSize: Fonts.fontPixelFluidText + color: Colors.textMain; + + } + + SliderDoubleCreateTreatment { + id: _venousPressureLimits + lowTitle: "Low" + lowUnits: " mmHg" + highTitle: "High" + highUnits: " mmHg" + lowMin: vCreateTreatment.venousPressureLimitLowMin + lowMax: vCreateTreatment.venousPressureLimitLowMax + highMin: vCreateTreatment.venousPressureLimitHighMin + highMax: vCreateTreatment.venousPressureLimitHighMax + onLowSliderChanged: { + vCreateTreatment.venousPressureLimitLow = lowValue + } + onHighSliderChanged: { + vCreateTreatment.venousPressureLimitHigh = highValue + } + } + + SliderCreateTreatment { + id: _bloodPressureMeasurementInterval + text: "Blood Pressure Measurement Interval" + units: qsTr(" min") + min: vCreateTreatment.bloodPressureMeasureIntervalMin + max: vCreateTreatment.bloodPressureMeasureIntervalMax + step: 1 + stepSnap: true + onSliderChanged: { + vCreateTreatment.bloodPressureMeasureInterval = value + } + } + + SliderCreateTreatment { + id: _rinsebackFlowRate + text: "Rinseback Flow Rate" + units: qsTr(" mL/min") + min: vCreateTreatment.rinsebackFlowRateMin + max: vCreateTreatment.rinsebackFlowRateMax + step: 1 + stepSnap: true + onSliderChanged: { + vCreateTreatment.rinsebackFlowRate = value + } + } + TouchRect { id : _continueRect anchors.horizontalCenter: parent.horizontalCenter text.text: qsTr("CONTINUE") - button.onClicked: _root.clickedContinue() + backgroundColor: Colors.createTreatmentNotReady + borderColor: Colors.createTreatmentNotReady + textColor: Colors.createTrTextNotReady + button.onClicked: { + console.log("continue enabled: " + vCreateTreatment.continueEnabled); + if (vCreateTreatment.continueEnabled) { + _root.clickedContinue() + } + } + + function toggleEnabled(enabled) { + if (enabled) { + backgroundColor = Colors.createTreatmentActive + borderColor = Colors.createTreatmentActive + textColor = Colors.createTrTextReady + } else { + backgroundColor = Colors.createTreatmentNotReady + borderColor = Colors.createTreatmentNotReady + textColor = Colors.createTrTextNotReady + } + } } } } - states: State { - when: _flickable.movingVertically - PropertyChanges { - target: _verticalScrollBar - opacity: 0.8 + states: [ + State { + when: _flickable.movingVertically + PropertyChanges { + target: _verticalScrollBar + opacity: 0.8 + } } - } + ] ScrollBar { anchors.top: _flickable.top @@ -246,5 +340,50 @@ } } + Connections { target: vCreateTreatment + onContinueEnabledChanged: { + if (vCreateTreatment.continueEnabled) { + _continueRect.toggleEnabled(true) + } else { + _continueRect.toggleEnabled(false) + } + } + + onResetCreateTreatment: { + console.log("resetting create treatment"); + _bloodFlowRate.isActive = false; + _dialysateFlowRate.isActive = false; + _duration.isActive = false; + _heparinDispensingRate.isActive = false; + + _heparinBolusVolume.isActive = false; + _heparinStopTime.isActive = false; + + _salineBolus.setActive(false); + _acidConcentrate.setActive(false); + _bicarbonateConcentrate.setActive(false); + _dialyserType.setActive(false); + + _dialysateTemperature.isActive = false; + _arterialPressureLimits.isLowActive = false; + _arterialPressureLimits.isHighActive = false; + _venousPressureLimits.isLowActive = false; + _venousPressureLimits.isHighActive = false; + _bloodPressureMeasurementInterval.isActive = false; + _rinsebackFlowRate.isActive = false; + + } + + onFwValidationFailed: { + console.debug("Fw validation failed: " + reason); + } + + onBloodFlowRate_ValidationFailed: { + console.debug("Blood flow validation failed: " + reason); + } + } + + + }