Index: sources/gui/qml/pages/treatment/TreatmentCreate.qml =================================================================== diff -u -rc64e61dd23a44d4b9d76c9e0b8f06bc359497665 -r20a67175350b1c20f078bade73a77d48c4647832 --- sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision c64e61dd23a44d4b9d76c9e0b8f06bc359497665) +++ sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision 20a67175350b1c20f078bade73a77d48c4647832) @@ -1,14 +1,16 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020 Diality Inc. - All Rights Reserved. * \copyright \n * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n * IN PART OR IN WHOLE, \n * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n * - * \file ManagerHome.qml - * \date 2019/10/21 - * \author Behrouz NematiPour + * \file TreatmentCreate.qml + * \author (last) Peter Lucia + * \date (last) 17-07-2020 + * \author (original) Behrouz NematiPour + * \date (original) 27-Jan-2020 * */ @@ -26,86 +28,317 @@ * which is the default screen in the "Manager" stack */ ScreenItem { id: _root - signal backPressed() + objectName: "TreatmentCreate"; // SquishQt testability + signal backClicked() + signal continueClicked() + 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 + onBackClicked: { + _root.backClicked(); - BackButton { id : _backButton - anchors.verticalCenter: parent.verticalCenter - onPressed: backPressed() } } - ScrollView { - anchors.top: _topMenuBar.bottom; - anchors.left: parent.left; - anchors.bottom: parent.bottom; - width: parent.width; - Rectangle { - color: "transparent"; + Flickable { id: _flickable + anchors.top: _topMenuBar.bottom + anchors.left: parent.left + anchors.bottom: parent.bottom + width: parent.width + contentWidth: parent.width + contentHeight: _column.implicitHeight + clip: true + + ScrollBar.vertical: ScrollBar { id: _scrollBar + anchors.right: _flickable.right + anchors.rightMargin: 3 + contentItem: Rectangle { + color: Colors.backgroundRangeRect + implicitWidth: 6 + radius: width / 2 + width: 3 + } + } + + Column { id: _column + spacing: Variables.treatmentSpacing + anchors.horizontalCenter: parent.horizontalCenter; anchors.fill: parent; - Column { - spacing: Variables.columnSpacing + + Text { id: _titleText anchors.horizontalCenter: parent.horizontalCenter; - anchors.fill: parent; + text: qsTr("Create a Custom Treatment") + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + } - Text { id: _titleText - anchors.horizontalCenter: parent.horizontalCenter; - text: qsTr("Create a Custom Treatment") - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTitle + Text { + anchors.horizontalCenter: parent.horizontalCenter; + text: qsTr("PRESCRIPTION"); + color: Colors.textMain; + font.pixelSize: Fonts.fontPixelButton + font.bold: true + + } + + SliderCreateTreatment { id: _bloodFlowRate + objectName: "_bloodFlowRate" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Blood Flow Rate") + units: qsTr("mL/min") + min: vCreateTreatment.bloodFlowRateMin + max: vCreateTreatment.bloodFlowRateMax + onSliderChanged: { + vCreateTreatment.bloodFlowRate = value; } + } - Text { - anchors.horizontalCenter: parent.horizontalCenter; - text: qsTr("PRESCRIPTION"); - color: Colors.textMain; - font.pixelSize: Fonts.fontPixelSection + SliderCreateTreatment { id: _dialysateFlowRate + objectName: "_dialysateFlowRate" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Dialysate Flow Rate") + units: qsTr("mL/min") + min: vCreateTreatment.dialysateFlowRateMin + max: vCreateTreatment.dialysateFlowRateMax + onSliderChanged: { + vCreateTreatment.dialysateFlowRate = value; + } + } + SliderCreateTreatment { id: _duration + objectName: "_duration" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Duration") + units: qsTr("min") + min: vCreateTreatment.durationMin + max: vCreateTreatment.durationMax + onSliderChanged: { + vCreateTreatment.duration = value; } + } - // TODO: make this a component. - Rectangle { - height: Variables.progressbarRectHeight - width: Variables.progressbarRectWidth - anchors.horizontalCenter: parent.horizontalCenter - color: "transparent"; + SliderCreateTreatment { id: _heparinDispensingRate + objectName: "_heparinDispensingRate" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Heparin Dispensing Rate") + units: qsTr("mL/hr") + min: vCreateTreatment.heparinDispensingRateMin + max: vCreateTreatment.heparinDispensingRateMax + onSliderChanged: { + vCreateTreatment.heparinDispensingRate = value; + } + } - Text { - text: "Blood Flow Rate" - anchors.top: parent.top - anchors.left: parent.left - font.pixelSize: Fonts.fontPixelFluidText - color: Colors.textMain; + SliderCreateTreatment { id: _heparinBolusVolume + objectName: "_heparinBolusVolume" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Heparin Bolus Volume") + units: qsTr("mL") + min: vCreateTreatment.heparinBolusVolumeMin + max: vCreateTreatment.heparinBolusVolumeMax + onSliderChanged: { + vCreateTreatment.heparinBolusVolume = value; + } + } - } + SliderCreateTreatment { id: _heparinStopTime + objectName: "_heparinStopTime" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Heparin Stop Time") + units: qsTr("min") + min: vCreateTreatment.heparinStopTimeMin + max: vCreateTreatment.heparinStopTimeMax + onSliderChanged: { + vCreateTreatment.heparinStopTime = value; + } + } - Text { - anchors.top: parent.top - anchors.right: parent.right - text: "-- mL/min" - font.pixelSize: Fonts.fontPixelFluidUnit - color: Colors.textMain; + RectSelectCreateTreatment { id: _salineBolus + objectName: "_salineBolusRect" + name: qsTr("Saline Bolus") + buttonNames: vCreateTreatment.salineBolusOptions + onButtonClicked: { + vCreateTreatment.salineBolusVolume = selectedIndex; + } + } + RectSelectCreateTreatment { id: _acidConcentrate + objectName: "_acidConcentrateRect" + name: qsTr("Acid Concentrate") + buttonNames: vCreateTreatment.acidConcentrateOptions; + onButtonClicked: { + vCreateTreatment.acidConcentrate = selectedIndex; + } + } + + RectSelectCreateTreatment { id: _bicarbonateConcentrate + objectName: "_bicarbonateConcentrateRect" + name: qsTr("Bicarbonate Concentrate") + numRows: 1 + numCols: 2 + buttonNames: vCreateTreatment.bicarbonateConcentrateOptions; + onButtonClicked: { + vCreateTreatment.bicarbonateConcentrate = selectedIndex; + } + } + + RectSelectCreateTreatment { id: _dialyzerType + objectName: "_dialyzerTypeRect" + name: qsTr("Dialyzer Type") + numRows: 3 + numCols: 2 + buttonNames: vCreateTreatment.dialyzerTypeOptions; + onButtonClicked: { + vCreateTreatment.dialyzerType = selectedIndex; + } + } + + SliderCreateTreatment { id: _dialysateTemperature + objectName: "_dialysateTemperature" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Dialysate Temperature") + units: qsTr("C") + step: 0.1 + min: vCreateTreatment.dialysateTempMin + max: vCreateTreatment.dialysateTempMax + onSliderChanged: { + vCreateTreatment.dialysateTemp = value; + } + } + + Text { id: _arterialPressureLimitsTitle + text: qsTr("Arterial Pressure Limits") + anchors.left: _arterialPressureLimits.left + font.pixelSize: Fonts.fontPixelFluidText + color: Colors.textMain; + + } + + SliderDoubleCreateTreatment { id: _arterialPressureLimits + objectName: "_arterialPressureLimits" + lowSliderObjectName: objectName + "LowSlider" + lowSelectedValueObjectName: objectName + "LowValue" + highSliderObjectName: objectName + "HighSlider" + highSelectedValueObjectName: objectName + "HighValue" + lowTitle: qsTr("Low") + lowUnits: qsTr("mmHg") + highTitle: qsTr("High") + highUnits: qsTr("mmHg") + lowMin: vCreateTreatment.arterialPressureLimitLowMin + lowMax: vCreateTreatment.arterialPressureLimitLowMax + highMin: vCreateTreatment.arterialPressureLimitHighMin + highMax: vCreateTreatment.arterialPressureLimitHighMax + lowValue: vCreateTreatment.arterialPressureLimitLowMin + highValue: vCreateTreatment.arterialPressureLimitHighMin + onLowSliderChanged: { + vCreateTreatment.arterialPressureLimitLow = lowValue + } + onHighSliderChanged: { + vCreateTreatment.arterialPressureLimitHigh = highValue + } + } + + + Text { id: _venousPressureLimitsTitle + text: qsTr("Venous Pressure Limits") + anchors.left: _venousPressureLimits.left + font.pixelSize: Fonts.fontPixelFluidText + color: Colors.textMain; + + } + + SliderDoubleCreateTreatment { id: _venousPressureLimits + objectName: "_venousPressureLimits" + lowSliderObjectName: objectName + "LowSlider" + lowSelectedValueObjectName: objectName + "LowValue" + highSliderObjectName: objectName + "HighSlider" + highSelectedValueObjectName: objectName + "HighValue" + lowTitle: qsTr("Low") + lowUnits: Variables.unitTextBloodPressure + highTitle: qsTr("High") + highUnits: Variables.unitTextBloodPressure + lowMin: vCreateTreatment.venousPressureLimitLowMin + lowMax: vCreateTreatment.venousPressureLimitLowMax + highMin: vCreateTreatment.venousPressureLimitHighMin + highMax: vCreateTreatment.venousPressureLimitHighMax + lowValue: vCreateTreatment.venousPressureLimitLowMin + highValue: vCreateTreatment.venousPressureLimitHighMin + onLowSliderChanged: { + vCreateTreatment.venousPressureLimitLow = lowValue + } + onHighSliderChanged: { + vCreateTreatment.venousPressureLimitHigh = highValue + } + } + + SliderCreateTreatment { id: _bloodPressureMeasurementInterval + objectName: "_bloodPressureMeasurementInterval" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Blood Pressure Measurement Interval") + units: Variables.unitTextBPMeasurementInterval + min: vCreateTreatment.bloodPressureMeasureIntervalMin + max: vCreateTreatment.bloodPressureMeasureIntervalMax + step: 1 + stepSnap: true + onSliderChanged: { + vCreateTreatment.bloodPressureMeasureInterval = value + } + } + + SliderCreateTreatment { id: _rinsebackFlowRate + objectName: "_rinsebackFlowRate" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: qsTr("Rinseback Flow Rate") + units: Variables.unitTextFlowRate + min: vCreateTreatment.rinsebackFlowRateMin + max: vCreateTreatment.rinsebackFlowRateMax + step: 1 + stepSnap: true + onSliderChanged: { + vCreateTreatment.rinsebackFlowRate = value + } + } + + TouchRect { id : _continueRect + objectName: "_continueButton" + anchors.horizontalCenter: parent.horizontalCenter + text.text: qsTr("CONTINUE") + backgroundColor: Colors.createTreatmentNotReady + borderColor: Colors.createTreatmentNotReady + textColor: Colors.createTreatmentTextNotReady + button.onClicked: { + vCreateTreatment.saveTreatmentProfile = false; + if (vCreateTreatment.continueEnabled) { + _root.continueClicked() } + } - ProgressBar { - anchors.horizontalCenter: parent.horizontalCenter; - anchors.bottom: parent.bottom; - width : Variables.progressbarSmallWidth - height : Variables.progressbarSmall + function toggleEnabled(enabled) { + if (enabled) { + backgroundColor = Colors.createTreatmentActive + borderColor = Colors.createTreatmentActive + textColor = Colors.createTreatmentTextReady + } else { + backgroundColor = Colors.createTreatmentNotReady + borderColor = Colors.createTreatmentNotReady + textColor = Colors.createTreatmentTextNotReady } } } } - - } onVisibleChanged: { @@ -114,5 +347,110 @@ } } + Connections { target: vCreateTreatment + onContinueEnabledChanged: { + if (vCreateTreatment.continueEnabled) { + _continueRect.toggleEnabled(true) + } else { + _continueRect.toggleEnabled(false) + } + } + + onResetCreateTreatment: { + _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); + _dialyzerType.setActive(false); + + _dialysateTemperature.isActive = false; + _arterialPressureLimits.isLowActive = false; + _arterialPressureLimits.isHighActive = false; + _venousPressureLimits.isLowActive = false; + _venousPressureLimits.isHighActive = false; + _bloodPressureMeasurementInterval.isActive = false; + _rinsebackFlowRate.isActive = false; + + } + + onFwValidationFailed: { + } + + onBloodFlowRate_ValidationFailed: { + _bloodFlowRate.setValid(false) + } + + onDialysateFlowRate_ValidationFailed: { + _dialysateFlowRate.setValid(false) + } + + + onDuration_ValidationFailed: { + _duration.setValid(false) + } + + onHeparinDispensingRate_ValidationFailed: { + _heparinDispensingRate.setValid(false) + } + + onHeparinBolusVolume_ValidationFailed: { + _heparinBolusVolume.setValid(false) + } + + onHeparinStopTime_ValidationFailed: { + _heparinStopTime.setValid(false) + } + + onSalineBolusVolume_ValidationFailed: { + _salineBolus.setValid(false) + } + + onAcidConcentrate_ValidationFailed: { + _acidConcentrate.setValid(false) + } + + onBicarbonateConcentrate_ValidationFailed: { + _bicarbonateConcentrate.setValid(false) + } + + onDialyzerType_ValidationFailed: { + _dialyzerType.setValid(false) + } + + onDialysateTemp_ValidationFailed: { + _dialysateTemperature.setValid(false) + } + + onArterialPressureLimitLow_ValidationFailed: { + _arterialPressureLimits.setLowValid(false) + } + + onArterialPressureLimitHigh_ValidationFailed: { + _arterialPressureLimits.setHighValid(false) + } + + onVenousPressureLimitLow_ValidationFailed: { + _venousPressureLimits.setLowValid(false) + } + + onVenousPressureLimitHigh_ValidationFailed: { + _venousPressureLimits.setHighValid(false) + } + + onBloodPressureMeasureInterval_ValidationFailed: { + _bloodPressureMeasurementInterval.setValid(false) + } + + onRinsebackFlowRate_ValidationFailed: { + _rinsebackFlowRate.setValid(false) + } + } }