Index: sources/gui/qml/pages/treatment/TreatmentCreate.qml =================================================================== diff -u -r4fab8841b1040c8eaa406713ff9bdc8c65b7b6ac -r0401b9a1fb6f89f0ec83571f2f868956c7500a0f --- sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision 4fab8841b1040c8eaa406713ff9bdc8c65b7b6ac) +++ sources/gui/qml/pages/treatment/TreatmentCreate.qml (.../TreatmentCreate.qml) (revision 0401b9a1fb6f89f0ec83571f2f868956c7500a0f) @@ -28,30 +28,35 @@ */ ScreenItem { id: _root objectName: "TreatmentCreate"; // SquishQt testability - signal backClicked() - signal continueClicked() + signal clickedBack() + signal clickedContinue() backgroundRect.color: Colors.backgroundMainMenu TopMenuBarCreateTreatment { id: _topMenuBar anchors.top: parent.top anchors.left: parent.left width: parent.width - onBackClicked: { - _root.backClicked(); - + onClickedBack: { + _root.clickedBack(); } } Flickable { id: _flickable + objectName: "TreatmentCreateFlickable" anchors.top: _topMenuBar.bottom anchors.left: parent.left anchors.bottom: parent.bottom width: parent.width contentWidth: parent.width contentHeight: _column.implicitHeight clip: true + flickDeceleration: Variables.createTreatmentFlickableDeceleration + function setInteractive(isInteractive) { + _flickable.interactive = isInteractive + } + ScrollBar.vertical: ScrollBar { id: _scrollBar anchors.right: _flickable.right anchors.rightMargin: 3 @@ -88,132 +93,186 @@ objectName: "_bloodFlowRate" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.bloodFlowRateMin + max: vTreatmentCreate.bloodFlowRateMax + step: vTreatmentCreate.bloodFlowRateRes text: qsTr("Blood Flow Rate") units: qsTr("mL/min") - min: vCreateTreatment.bloodFlowRateMin - max: vCreateTreatment.bloodFlowRateMax - onSliderChanged: { - vCreateTreatment.bloodFlowRate = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.bloodFlowRate = value } + onReleased: { + vTreatmentCreate.bloodFlowRate = value + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _dialysateFlowRate objectName: "_dialysateFlowRate" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.dialysateFlowRateMin + max: vTreatmentCreate.dialysateFlowRateMax + step: vTreatmentCreate.dialysateFlowRateRes text: qsTr("Dialysate Flow Rate") units: qsTr("mL/min") - min: vCreateTreatment.dialysateFlowRateMin - max: vCreateTreatment.dialysateFlowRateMax - onSliderChanged: { - vCreateTreatment.dialysateFlowRate = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.dialysateFlowRate = value; } + onReleased: { + vTreatmentCreate.dialysateFlowRate = value; + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _duration objectName: "_duration" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.durationMin + max: vTreatmentCreate.durationMax + step: vTreatmentCreate.durationRes text: qsTr("Duration") units: qsTr("min") - min: vCreateTreatment.durationMin - max: vCreateTreatment.durationMax - onSliderChanged: { - vCreateTreatment.duration = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.duration = value; } + onReleased: { + vTreatmentCreate.duration = value; + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _heparinDispensingRate objectName: "_heparinDispensingRate" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.heparinDispensingRateMin + max: vTreatmentCreate.heparinDispensingRateMax + step: vTreatmentCreate.heparinDispensingRateRes text: qsTr("Heparin Dispensing Rate") units: qsTr("mL/hr") - min: vCreateTreatment.heparinDispensingRateMin - max: vCreateTreatment.heparinDispensingRateMax - onSliderChanged: { - vCreateTreatment.heparinDispensingRate = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.heparinDispensingRate = value } + onReleased: { + vTreatmentCreate.heparinDispensingRate = value + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _heparinBolusVolume objectName: "_heparinBolusVolume" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.heparinBolusVolumeMin + max: vTreatmentCreate.heparinBolusVolumeMax + step: vTreatmentCreate.heparinBolusVolumeRes + text: qsTr("Heparin Bolus Volume") units: qsTr("mL") - min: vCreateTreatment.heparinBolusVolumeMin - max: vCreateTreatment.heparinBolusVolumeMax - onSliderChanged: { - vCreateTreatment.heparinBolusVolume = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.heparinBolusVolume = value } + onReleased: { + vTreatmentCreate.heparinBolusVolume = value + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _heparinStopTime objectName: "_heparinStopTime" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.heparinStopTimeMin + max: vTreatmentCreate.heparinStopTimeMax + step: vTreatmentCreate.heparinStopTimeRes text: qsTr("Heparin Stop Time") units: qsTr("min") - min: vCreateTreatment.heparinStopTimeMin - max: vCreateTreatment.heparinStopTimeMax - onSliderChanged: { - vCreateTreatment.heparinStopTime = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.heparinStopTime = value } + onReleased: { + vTreatmentCreate.heparinStopTime = value + _flickable.setInteractive(true) + } } - RectSelectCreateTreatment { id: _salineBolus - objectName: "_salineBolusRect" - name: qsTr("Saline Bolus") - buttonNames: vCreateTreatment.salineBolusOptions - onButtonClicked: { - vCreateTreatment.salineBolusVolume = selectedIndex; + SliderCreateTreatment { + id: _salineBolus + objectName: "_salineBolus" + sliderObjectName: objectName + "Slider" + selectedValueObjectName: objectName + "Value" + text: "Saline Bolus" + units: qsTr("mL") + min: vTreatmentCreate.salineBolusVolumeMin + max: vTreatmentCreate.salineBolusVolumeMax + step: vTreatmentCreate.salineBolusVolumeRes + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.salineBolusVolume = value } + onReleased: { + vTreatmentCreate.salineBolusVolume = value + _flickable.setInteractive(true) + } } - RectSelectCreateTreatment { id: _acidConcentrate + GridSelection { + id: _acidConcentrate objectName: "_acidConcentrateRect" name: qsTr("Acid Concentrate") - buttonNames: vCreateTreatment.acidConcentrateOptions; + buttonNames: vTreatmentCreate.acidConcentrateOptions onButtonClicked: { - vCreateTreatment.acidConcentrate = selectedIndex; + vTreatmentCreate.acidConcentrate = selectedIndex } } - RectSelectCreateTreatment { id: _bicarbonateConcentrate + GridSelection { id: _bicarbonateConcentrate objectName: "_bicarbonateConcentrateRect" name: qsTr("Bicarbonate Concentrate") numRows: 1 numCols: 2 - buttonNames: vCreateTreatment.bicarbonateConcentrateOptions; + buttonNames: vTreatmentCreate.bicarbonateConcentrateOptions; onButtonClicked: { - vCreateTreatment.bicarbonateConcentrate = selectedIndex; + vTreatmentCreate.bicarbonateConcentrate = selectedIndex; } } - RectSelectCreateTreatment { id: _dialyzerType + GridSelection { id: _dialyzerType objectName: "_dialyzerTypeRect" name: qsTr("Dialyzer Type") numRows: 3 numCols: 2 - buttonNames: vCreateTreatment.dialyzerTypeOptions; + buttonNames: vTreatmentCreate.dialyzerTypeOptions; onButtonClicked: { - vCreateTreatment.dialyzerType = selectedIndex; + vTreatmentCreate.dialyzerType = selectedIndex; } } SliderCreateTreatment { id: _dialysateTemperature objectName: "_dialysateTemperature" sliderObjectName: objectName + "Slider" selectedValueObjectName: objectName + "Value" + min: vTreatmentCreate.dialysateTempMin + max: vTreatmentCreate.dialysateTempMax + step: vTreatmentCreate.dialysateTempRes text: qsTr("Dialysate Temperature") units: qsTr("C") - step: 0.1 - min: vCreateTreatment.dialysateTempMin - max: vCreateTreatment.dialysateTempMax - onSliderChanged: { - vCreateTreatment.dialysateTemp = value; + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.dialysateTemp = value } + onReleased: { + vTreatmentCreate.dialysateTemp = value + _flickable.setInteractive(true) + } } Text { id: _arterialPressureLimitsTitle @@ -234,18 +293,30 @@ 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 + lowMin: vTreatmentCreate.arterialPressureLimitLowMin + lowMax: vTreatmentCreate.arterialPressureLimitLowMax + highMin: vTreatmentCreate.arterialPressureLimitHighMin + highMax: vTreatmentCreate.arterialPressureLimitHighMax + lowValue: vTreatmentCreate.arterialPressureLimitLowMin + highValue: vTreatmentCreate.arterialPressureLimitHighMin + lowStep: vTreatmentCreate.arterialPressureLimitLowRes + highStep: vTreatmentCreate.arterialPressureLimitHighRes + onLowSliderPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.arterialPressureLimitLow = lowValue } - onHighSliderChanged: { - vCreateTreatment.arterialPressureLimitHigh = highValue + onLowSliderReleased: { + vTreatmentCreate.arterialPressureLimitLow = lowValue + _flickable.setInteractive(true) } + onHighSliderPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.arterialPressureLimitHigh = highValue + } + onHighSliderReleased: { + vTreatmentCreate.arterialPressureLimitHigh = highValue + _flickable.setInteractive(true) + } } @@ -267,18 +338,30 @@ 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 + lowMin: vTreatmentCreate.venousPressureLimitLowMin + lowMax: vTreatmentCreate.venousPressureLimitLowMax + highMin: vTreatmentCreate.venousPressureLimitHighMin + highMax: vTreatmentCreate.venousPressureLimitHighMax + lowValue: vTreatmentCreate.venousPressureLimitLowMin + highValue: vTreatmentCreate.venousPressureLimitHighMin + lowStep: vTreatmentCreate.venousPressureLimitLowRes + highStep: vTreatmentCreate.venousPressureLimitHighRes + onLowSliderPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.venousPressureLimitLow = lowValue } - onHighSliderChanged: { - vCreateTreatment.venousPressureLimitHigh = highValue + onLowSliderReleased: { + vTreatmentCreate.venousPressureLimitLow = lowValue + _flickable.setInteractive(true) } + onHighSliderPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.venousPressureLimitHigh = highValue + } + onHighSliderReleased: { + vTreatmentCreate.venousPressureLimitHigh = highValue + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _bloodPressureMeasurementInterval @@ -287,13 +370,18 @@ selectedValueObjectName: objectName + "Value" text: qsTr("Blood Pressure Measurement Interval") units: Variables.unitTextBPMeasurementInterval - min: vCreateTreatment.bloodPressureMeasureIntervalMin - max: vCreateTreatment.bloodPressureMeasureIntervalMax - step: 1 + min: vTreatmentCreate.bloodPressureMeasureIntervalMin + max: vTreatmentCreate.bloodPressureMeasureIntervalMax + step: vTreatmentCreate.bloodPressureMeasureIntervalRes stepSnap: true - onSliderChanged: { - vCreateTreatment.bloodPressureMeasureInterval = value + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.bloodPressureMeasureInterval = value } + onReleased: { + vTreatmentCreate.bloodPressureMeasureInterval = value + _flickable.setInteractive(true) + } } SliderCreateTreatment { id: _rinsebackFlowRate @@ -302,13 +390,18 @@ selectedValueObjectName: objectName + "Value" text: qsTr("Rinseback Flow Rate") units: Variables.unitTextFlowRate - min: vCreateTreatment.rinsebackFlowRateMin - max: vCreateTreatment.rinsebackFlowRateMax - step: 1 + min: vTreatmentCreate.rinsebackFlowRateMin + max: vTreatmentCreate.rinsebackFlowRateMax + step: vTreatmentCreate.rinsebackFlowRateRes stepSnap: true - onSliderChanged: { - vCreateTreatment.rinsebackFlowRate = value + onPressed: { + _flickable.setInteractive(false) + vTreatmentCreate.rinsebackFlowRate = value } + onReleased: { + vTreatmentCreate.rinsebackFlowRate = value + _flickable.setInteractive(true) + } } TouchRect { id : _continueRect @@ -319,9 +412,9 @@ borderColor: Colors.createTreatmentNotReady textColor: Colors.createTreatmentTextNotReady button.onClicked: { - vCreateTreatment.saveTreatmentProfile = false; - if (vCreateTreatment.continueEnabled) { - _root.continueClicked() + vTreatmentCreate.saveTreatmentProfile = false; + if (vTreatmentCreate.continueEnabled) { + _root.clickedContinue() } } @@ -337,6 +430,13 @@ } } } + + Rectangle { + id: _spacer + height: 75 + width: parent.width + color: "transparent" + } } } @@ -346,9 +446,9 @@ } } - Connections { target: vCreateTreatment + Connections { target: vTreatmentCreate onContinueEnabledChanged: { - if (vCreateTreatment.continueEnabled) { + if (vTreatmentCreate.continueEnabled) { _continueRect.toggleEnabled(true) } else { _continueRect.toggleEnabled(false) @@ -365,7 +465,7 @@ _heparinBolusVolume.isActive = false; _heparinStopTime.isActive = false; - _salineBolus.setActive(false); + _salineBolus.isActive = false; _acidConcentrate.setActive(false); _bicarbonateConcentrate.setActive(false); _dialyzerType.setActive(false); @@ -380,6 +480,29 @@ } + onFwValidationSuccess: { + _bloodFlowRate .setValid (true) + _dialysateFlowRate .setValid (true) + _duration .setValid (true) + _heparinDispensingRate .setValid (true) + + _heparinBolusVolume .setValid (true) + _heparinStopTime .setValid (true) + + _salineBolus .setValid (true) + _acidConcentrate .setValid (true) + _bicarbonateConcentrate .setValid (true) + _dialyzerType .setValid (true) + + _dialysateTemperature .setValid (true) + _arterialPressureLimits .setLowValid (true) + _arterialPressureLimits .setHighValid(true) + _venousPressureLimits .setLowValid (true) + _venousPressureLimits .setHighValid(true) + _bloodPressureMeasurementInterval .setValid (true) + _rinsebackFlowRate .setValid (true) + } + onFwValidationFailed: { } @@ -391,7 +514,6 @@ _dialysateFlowRate.setValid(false) } - onDuration_ValidationFailed: { _duration.setValid(false) } @@ -451,5 +573,63 @@ onRinsebackFlowRate_ValidationFailed: { _rinsebackFlowRate.setValid(false) } + + onScrollToParameter: { + let prefix = "data."; + let contentYMargin = 80; + let newContentY = 0; + + if (parameter === prefix+"bloodFlowRate") { + newContentY = _bloodFlowRate.mapToItem(_bloodFlowRate.parent, 0, 0).y; + } + else if (parameter === prefix+"dialysateFlowRate") { + newContentY = _dialysateFlowRate.mapToItem(_dialysateFlowRate.parent, 0, 0).y; + } + else if (parameter === prefix+"duration") { + newContentY = _duration.mapToItem(_duration.parent, 0, 0).y; + } + else if (parameter === prefix+"heparinDispensingRate") { + newContentY = _heparinDispensingRate.mapToItem(_heparinDispensingRate.parent, 0, 0).y; + } + else if (parameter === prefix+"heparinBolusVolume") { + newContentY = _heparinBolusVolume.mapToItem(_heparinBolusVolume.parent, 0, 0).y; + } + else if (parameter === prefix+"heparinStopTime") { + newContentY = _heparinStopTime.mapToItem(_heparinStopTime.parent, 0, 0).y; + } + else if (parameter === prefix+"salineBolus") { + newContentY = _salineBolus.mapToItem(_salineBolus.parent, 0, 0).y; + } + else if (parameter === prefix+"acidConcentrate") { + newContentY = _acidConcentrate.mapToItem(_acidConcentrate.parent, 0, 0).y; + } + else if (parameter === prefix+"bicarbonateConcentrate") { + newContentY = _bicarbonateConcentrate.mapToItem(_bicarbonateConcentrate.parent, 0, 0).y; + } + else if (parameter === prefix+"dialyzerType") { + newContentY = _dialyzerType.mapToItem(_dialyzerType.parent, 0, 0).y; + } + else if (parameter === prefix+"dialysateTemp") { + newContentY = _dialysateTemperature.mapToItem(_dialysateTemperature.parent, 0, 0).y; + } + else if (parameter === prefix+"arterialPressureLimitLow" || + parameter === prefix+"arterialPressureLimitHigh") { + newContentY = _arterialPressureLimits.mapToItem(_arterialPressureLimits.parent, 0, 0).y; + } + else if (parameter === prefix+"venousPressureLimitLow" || + parameter === prefix+"venousPressureLimitHigh") { + newContentY = _venousPressureLimits.mapToItem(_venousPressureLimits.parent, 0, 0).y; + } + else if (parameter === prefix+"bloodPressureMeasureInterval") { + newContentY = _bloodPressureMeasurementInterval.mapToItem(_bloodPressureMeasurementInterval.parent, 0, 0).y; + } + else if (parameter === prefix+"rinsebackFlowRate") { + newContentY = _rinsebackFlowRate.mapToItem(_rinsebackFlowRate.parent, 0, 0).y; + } + else { + return; + } + _flickable.contentY = newContentY - contentYMargin; + } } }