Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml =================================================================== diff -u -r036d378b4b89db03c812584c1d0f682494d81568 -rb38a0f4cf86482bb66ee69e1f809fb28b33edb4a --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 036d378b4b89db03c812584c1d0f682494d81568) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision b38a0f4cf86482bb66ee69e1f809fb28b33edb4a) @@ -15,7 +15,6 @@ // Qt import QtQuick 2.12 -import QtQuick.Controls 2.12 // ScrollBar // Project // Qml imports @@ -30,847 +29,29 @@ PreTreatmentBase { id: _root objectName: "_PreTreatmentCreate" // SquishQt testability - header.confirmEnabled: - _bloodFlowRate .active && _bloodFlowRate . valid && - _dialysateFlowRate .active && _dialysateFlowRate . valid && - _duration .active && _duration . valid && - _heparinDispensingRate .active && _heparinDispensingRate . valid && - _heparinBolusVolume .active && _heparinBolusVolume . valid && - _heparinStopTime .active && _heparinStopTime . valid && - _salineBolus .active && _salineBolus . valid && - _heparinType._heparinTypeActive && - _acidConcentrate .active && - _bicarbonateConcentrate .active && - _dialyzerType .active && - _dialysateTemperature .active && _dialysateTemperature . valid && - _bloodPressureInterval .active && _bloodPressureInterval . valid + header.backVisible : true + header.confirmVisible : true + title.visible : false + header.confirmEnabled : _preTreatmentCreateContent.confirmReady() + header.confirmText.text : vTreatmentCreate.parametersValidated ? qsTr("CONFIRM") : qsTr("VALIDATE") - Connections{ target:vTreatmentCreate - // Update flicker location to show the invalid parameter - function onDidValidationFail() { - if ( vTreatmentCreate. bloodFlowRateRejectReason ) { scrollTo( _bloodFlowRate ); return } - if ( vTreatmentCreate. dialysateFlowRateRejectReason ) { scrollTo( _dialysateFlowRate ); return } - if ( vTreatmentCreate. treatmentDurationRejectReason ) { scrollTo( _duration ); return } - if ( vTreatmentCreate. heparinDispensingRateRejectReason ) { scrollTo( _heparinDispensingRate ); return } - if ( vTreatmentCreate. heparinBolusVolumeRejectReason ) { scrollTo( _heparinBolusVolume ); return } - if ( vTreatmentCreate. heparinStopTimeRejectReason ) { scrollTo( _heparinStopTime ); return } - if ( vTreatmentCreate. salineBolusVolumeRejectReason ) { scrollTo( _salineBolus ); return } + onConfirmClicked : vTreatmentCreate.parametersValidated ? _preTreatmentCreateContent.confirm() : _preTreatmentCreateContent.validate() + onBackClicked : vTreatmentCreate.parametersValidated ? vTreatmentCreate.doCancel() : vPreTreatmentAdjustmentInitTreatment.doCancel() - if ( vTreatmentCreate. heparinTypeRejectReason ) { scrollTo( _heparinType ); return } - if ( vTreatmentCreate. acidConcentrateRejectReason ) { scrollTo( _acidConcentrate ); return } - if ( vTreatmentCreate. bicarbonateConcentrateRejectReason ) { scrollTo( _bicarbonateConcentrate ); return } - if ( vTreatmentCreate. dialyzerTypeRejectReason ) { scrollTo( _dialyzerType ); return } - - if ( vTreatmentCreate. dialysateTempRejectReason ) { scrollTo( _dialysateTemperature ); return } - if ( vTreatmentCreate.bloodPressureMeasureIntervalRejectReason ) { scrollTo( _bloodPressureInterval ); return } - } + function clear( vValue ) { + if ( ! vValue ) return + _preTreatmentCreateContent.clear() } - function setInteractive(vInteractive) { - _flickable.interactive = vInteractive - } - - function scrollTo(vItem) { - _flickable.contentY = vItem.mapToItem(_flickable.contentItem, 0, 0).y - } - - function clear() { - _flickable.contentY = 0 - _bloodFlowRate .clear() - _dialysateFlowRate .clear() - _duration .clear() - _heparinDispensingRate .clear() - _heparinBolusVolume .clear() - _heparinStopTime .clear() - _salineBolus .clear() - _heparinType .clear() - _acidConcentrate .clear() - _bicarbonateConcentrate .clear() - _dialyzerType .clear() - _dialysateTemperature .clear() - _bloodPressureInterval .clear() - } - - property bool prepopulated: false - function prepopulate() { - // not complete yet and not part of the current DNBUG - // the issue is the On/Off switches whcih has not been stored in the view to restore/prepopulate it, - // which is needed for three sliders to be set properly. - _bloodFlowRate .reset(vTreatmentCreate.bloodFlowRate ) - _dialysateFlowRate .reset(vTreatmentCreate.dialysateFlowRate ) - _duration .reset(vTreatmentCreate.treatmentDuration ) - _heparinDispensingRate .reset(vTreatmentCreate.heparinDispensingRate ) - _heparinBolusVolume .reset(vTreatmentCreate.heparinBolusVolume ) - _heparinStopTime .reset(vTreatmentCreate.heparinStopTime ) - _salineBolus .reset(vTreatmentCreate.salineBolusVolume ) - _heparinType .reset(vTreatmentCreate.heparinType ) - _acidConcentrate .reset(vTreatmentCreate.acidConcentrate ) - _bicarbonateConcentrate .reset(vTreatmentCreate.bicarbonateConcentrate ) - _dialyzerType .reset(vTreatmentCreate.heparinType ) - _dialysateTemperature .reset(vTreatmentCreate.dialysateTemp ) - _bloodPressureInterval .reset(vTreatmentCreate.bloodPressureMeasureInterval ) - } - - ConfirmButton { id : _prepopulateButton - objectName : "_prepopulateButton" - text.text : prepopulated ? qsTr("RESET") : qsTr("PREPOPULATE") - anchors.top : title.top - anchors.topMargin : 0 - visible : false // true // not readu yet and has been hidded. - onClicked : { - if ( prepopulated ) { - clear() - } - else { - prepopulate() - } - prepopulated = ! prepopulated - } - } - - ScrollBar { - flickable : _flickable - anchors.fill: _flickable - anchors.rightMargin : Variables.minVGap - } - - Flickable { id: _flickable - objectName: "TreatmentCreateFlickable" - clip: true + PreTreatmentCreateContent { id: _preTreatmentCreateContent anchors { - top : _root.title.bottom - topMargin : Variables.minVGap - bottom : _root.bottom - bottomMargin : Variables.notificationHeight + Variables.minVGap - horizontalCenter: parent.horizontalCenter + top : _root.header.bottom + left : parent.left + leftMargin : Variables.defaultMargin * 8 + right : parent.right + rightMargin : anchors.leftMargin + bottom : parent.bottom + bottomMargin: Variables.notificationHeight + Variables.defaultMargin } - width: parent.width - contentWidth: parent.width - contentHeight: _column.implicitHeight - flickDeceleration: Variables.createTreatmentFlickableDeceleration - - Column { id: _column - spacing: Variables.treatmentSpacing - anchors.horizontalCenter: parent.horizontalCenter - anchors.fill: parent - - Text { id: _titleTextPrescription - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("PRESCRIPTION") - color: Colors.textMain - font.pixelSize: Fonts.fontPixelButton - font.bold: true - } - - SliderCreateTreatment { id: _bloodFlowRate - objectName : "_bloodFlowRate" - label : qsTr("Blood Flow Rate") - flickable : _flickable - unit : Variables.unitTextFlowRate - minimum : vTreatmentRanges.bloodFlowRateMin - maximum : vTreatmentRanges.bloodFlowRateMax - step : vTreatmentRanges.bloodFlowRateRes - defaultValue: vTreatmentRanges.bloodFlowRateDef - valid : ! vTreatmentCreate.bloodFlowRateRejectReason - onValueChanged : { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.bloodFlowRateRejectReason = Variables.noRejectReason - } - vTreatmentCreate.bloodFlowRate = value - } - } - - SliderCreateTreatment { id: _dialysateFlowRate - objectName : "_dialysateFlowRate" - label : qsTr("Dialysate Flow Rate") - flickable : _flickable - unit : Variables.unitTextFlowRate - minimum : vTreatmentRanges.dialysateFlowRateMin - maximum : vTreatmentRanges.dialysateFlowRateMax - step : vTreatmentRanges.dialysateFlowRateRes - defaultValue: vTreatmentRanges.dialysateFlowRateDef - valid : ! vTreatmentCreate.dialysateFlowRateRejectReason - onValueChanged : { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.dialysateFlowRateRejectReason = Variables.noRejectReason - } - vTreatmentCreate.dialysateFlowRate = value - } - } - - SliderCreateTreatment { id: _duration - objectName : "_duration" - label : qsTr("Duration") - flickable : _flickable - unit : Variables.unitTextDuration - minimum : vTreatmentRanges.treatmentDurationMin - maximum : vTreatmentRanges.treatmentDurationMax - step : vTreatmentRanges.treatmentDurationRes - defaultValue: vTreatmentRanges.treatmentDurationDef - valid : !vTreatmentCreate.treatmentDurationRejectReason - onValueChanged: { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.treatmentDurationRejectReason = Variables.noRejectReason - } - vTreatmentCreate.treatmentDuration = value - } - } - Connections { target: _duration - function onValueChanged ( ) { - if ( _heparinDispensingRateSwitch.checked ) { - _heparinStopTime.active = false - _heparinStopTime.reset( _duration.value ) - } - } - } - - Connections { target : _heparinDispensingRateSwitch - function onActiveChanged ( ) { - let mActive = _heparinDispensingRateSwitch.active - let mObject = _heparinStopTime - - if ( ! mActive ) { - mObject.enabled = false - mObject.active = false - mObject.adjustable = false - } - } - - function onCheckedChanged ( ) { - let mActive = _heparinDispensingRateSwitch.active - let mChecked = _heparinDispensingRateSwitch.checked - let mObject = _heparinStopTime - - mObject.enabled = mActive && mChecked - mObject.active = false - mObject.adjustable = mChecked - - mObject.reset ( _duration.value ) - } - } - - SliderCreateTreatment { id: _heparinDispensingRate - objectName : "_heparinDispensingRate" - label : qsTr("Heparin Dispensing Rate") - zeroLabel : qsTr("OFF") - flickable : _flickable - unit : Variables.unitTextDispensingRate - decimal : Variables.heparinPrecision - minimum : vTreatmentRanges.heparinDispensingRateMin - maximum : vTreatmentRanges.heparinDispensingRateMax - step : vTreatmentRanges.heparinDispensingRateRes - defaultValue: vTreatmentRanges.heparinDispensingRateDef - valid : !vTreatmentCreate.heparinDispensingRateRejectReason - adjustable : _heparinDispensingRateSwitch.checked - inActiveZero : true - enableAdjustButtons: _heparinDispensingRateSwitch.checked - onValueChanged: { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.heparinDispensingRateRejectReason = Variables.noRejectReason - } - vTreatmentCreate.heparinDispensingRate = _heparinDispensingRateSwitch.checked ? value : 0 - } - // ToDo: create a component for Switch, - // ToDo: Consider putting the new CheckBox component into the SliderCreateTreatment component and set via boolean property - // This is a full implementation of a Switch - toggleSwich: _heparinDispensingRateSwitch - Switch { id: _heparinDispensingRateSwitch - property bool active: false - onCheckedChanged: { - if ( ! active ) { - active = true - checked = ! checked - } - vTreatmentCreate.heparinDispensingRate = 0 - vTreatmentCreate.heparinDispensingRateOff = ! checked - _heparinDispensingRate.reset ( 0 ) - _heparinDispensingRate.active = ! checked - } - - x : width * -1.5 - y : Variables.createTreatmentSwitchYDisplacement // these values are set to align the switch with slider - width : 75 // these values are set to align the switch with slider - height : 85 // these values are set to align the switch with slider - // DEBUG: background : Rectangle { color : "white" } - - indicator: Rectangle { - implicitWidth : Variables.sliderCircleDiameter * 1.7 - implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) - radius : implicitHeight - anchors.centerIn: parent - color : _heparinDispensingRateSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive - border.color : _heparinDispensingRateSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive - Rectangle { - property real diameter : Variables.sliderCircleDiameter - - x: _heparinDispensingRateSwitch.checked ? parent.width - width : 0 - anchors.verticalCenter: parent.verticalCenter - width : diameter - height : diameter - radius : diameter - color : _heparinDispensingRateSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive - border { - width: Variables.progressbarHandlerBorderWidth - color: Colors.textMain - } - } - } - - contentItem: Text { - text : _heparinDispensingRateSwitch.checked ? qsTr("ON") : qsTr("OFF") - font : _heparinDispensingRateSwitch.font - color : _heparinDispensingRateSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment: Text.AlignTop - horizontalAlignment: Text.AlignHCenter - anchors.centerIn: parent - } - } - } - - SliderCreateTreatment { id: _heparinBolusVolume - objectName : "_heparinBolusVolume" - label : qsTr("Heparin Bolus Volume") - zeroLabel : qsTr("OFF") - flickable : _flickable - unit : Variables.unitTextFluid - decimal : Variables.heparinPrecision - minimum : vTreatmentRanges.heparinBolusVolumeMin - maximum : vTreatmentRanges.heparinBolusVolumeMax - step : vTreatmentRanges.heparinBolusVolumeRes - defaultValue: vTreatmentRanges.heparinBolusVolumeDef - valid : !vTreatmentCreate.heparinBolusVolumeRejectReason - adjustable : _heparinBolusVolumeSwitch.checked - inActiveZero : true - enableAdjustButtons: _heparinBolusVolumeSwitch.checked - onValueChanged : { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.heparinBolusVolumeRejectReason = Variables.noRejectReason - } - vTreatmentCreate.heparinBolusVolume = _heparinBolusVolumeSwitch.checked ? value : 0 - } - - // ToDo: create a component for this, - // ToDo: Consider putting the new CheckBox component into the SliderCreateTreatment component and set via boolean property - // This is a full implementation of a CheckBox - toggleSwich: _heparinBolusVolumeSwitch - Switch { id: _heparinBolusVolumeSwitch - property bool active: false - onCheckedChanged: { - if ( ! active ) { - active = true - checked = ! checked - } - vTreatmentCreate.heparinBolusVolume = 0 - vTreatmentCreate.heparinBolusVolumeOff = ! checked - _heparinBolusVolume.reset ( 0 ) - _heparinBolusVolume.active = ! checked - } - - x : width * -1.5 - y : Variables.createTreatmentSwitchYDisplacement // these values are set to align the switch with slider - width : 75 // these values are set to align the switch with slider - height : 85 // these values are set to align the switch with slider - // DEBUG: background : Rectangle { color : "white" } - - indicator: Rectangle { - implicitWidth : Variables.sliderCircleDiameter * 1.7 - implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) - radius : implicitHeight - anchors.centerIn: parent - color : _heparinBolusVolumeSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive - border.color : _heparinBolusVolumeSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive - Rectangle { - property real diameter : Variables.sliderCircleDiameter - - x: _heparinBolusVolumeSwitch.checked ? parent.width - width : 0 - anchors.verticalCenter: parent.verticalCenter - width : diameter - height : diameter - radius : diameter - color : _heparinBolusVolumeSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive - border { - width: Variables.progressbarHandlerBorderWidth - color: Colors.textMain - } - } - } - - contentItem: Text { - text : _heparinBolusVolumeSwitch.checked ? qsTr("ON") : qsTr("OFF") - font : _heparinBolusVolumeSwitch.font - color : _heparinBolusVolumeSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment: Text.AlignTop - horizontalAlignment: Text.AlignHCenter - anchors.centerIn: parent - } - } - } - - SliderCreateTreatment { id: _heparinStopTime - objectName : "_heparinStopTime" - label : qsTr("Heparin Stop Time") - flickable : _flickable - unit : Variables.unitTextDuration - minimum : vTreatmentRanges.heparinStopTimeMin - maximum : _duration.value // LEAHI-SRS-300 - step : _duration.step // LEAHI-SRS-300 - defaultValue: _duration.value // LEAHI-SRS-300 - inActiveZero: false - valid : !vTreatmentCreate.heparinStopTimeRejectReason - enabled : false // this switch depends on the heparin dispencing - adjustable : false // this switch depends on the heparin dispencing - enableAdjustButtons: _heparinDispensingRateSwitch.checked - onValueChanged: { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.heparinStopTimeRejectReason = Variables.noRejectReason - } - vTreatmentCreate.heparinStopTime = value - } - } - - SliderCreateTreatment { id: _salineBolus - objectName : "_salineBolus" - label : qsTr("Saline Bolus") - flickable : _flickable - unit : Variables.unitTextFluid - minimum : vTreatmentRanges.salineBolusVolumeMin - maximum : vTreatmentRanges.salineBolusVolumeMax - step : vTreatmentRanges.salineBolusVolumeRes - defaultValue: vTreatmentRanges.salineBolusVolumeDef - valid : !vTreatmentCreate.salineBolusVolumeRejectReason - onValueChanged: { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.salineBolusVolumeRejectReason = Variables.noRejectReason - } - vTreatmentCreate.salineBolusVolume = value - } - } - - Text { id: _titleTextOperation - anchors.horizontalCenter: parent.horizontalCenter - text : qsTr("OPERATING PARAMETERS") - color : Colors.textMain - font.pixelSize: Fonts.fontPixelButton - font.bold : true - } - - GridSelection { id : _heparinType - readonly property bool _heparinTypeActive : (enabled && active) || (!enabled) - - objectName : "_heparinTypeRect" - title : qsTr("Heparin Type") - labels : vTreatmentRanges.heparinTypeOptions - onClicked :{vTreatmentCreate.heparinType = curIndex ; vTreatmentCreate.heparinTypeSet = true; } - enabled : _heparinDispensingRateSwitch.checked || _heparinBolusVolumeSwitch.checked - onEnabledChanged: { - if ( ! enabled ) { - vTreatmentCreate.heparinTypeSet = false - clear() - } - } - - valid : ! vTreatmentCreate.heparinTypeRejectReason - onCurIndexChanged : vTreatmentCreate.heparinTypeRejectReason = Variables.noRejectReason - } - - GridSelection { id : _acidConcentrate - objectName : "_acidConcentrateRect" - title : qsTr("Acid Concentrate") - labels : vTreatmentRanges.acidConcentrateOptions - onClicked :{vTreatmentCreate.acidConcentrate = curIndex ; vTreatmentCreate.acidConcentrateSet = true; } - - valid : ! vTreatmentCreate.acidConcentrateRejectReason - onCurIndexChanged : vTreatmentCreate.acidConcentrateRejectReason = Variables.noRejectReason - } - - GridSelection { id : _bicarbonateConcentrate - objectName : "_bicarbonateConcentrateRect" - title : qsTr("Bicarbonate Concentrate") - labels : vTreatmentRanges.bicarbonateConcentrateOptions - onClicked :{vTreatmentCreate.bicarbonateConcentrate = curIndex ; vTreatmentCreate.bicarbonateConcentrateSet = true; } - - valid : ! vTreatmentCreate.bicarbonateConcentrateRejectReason - onCurIndexChanged : vTreatmentCreate.bicarbonateConcentrateRejectReason = Variables.noRejectReason - } - - GridSelection { id : _dialyzerType - objectName : "_dialyzerTypeRect" - title : qsTr("Dialyzer Type") - labels : vTreatmentRanges.dialyzerTypeOptions - onClicked :{vTreatmentCreate.dialyzerType = curIndex ; vTreatmentCreate.dialyzerTypeSet = true; } - - valid : ! vTreatmentCreate.dialyzerTypeRejectReason - onCurIndexChanged : vTreatmentCreate.dialyzerTypeRejectReason = Variables.noRejectReason - } - - Item { height: 1; width: 1 /* TODO : there is a design flaw in here, this is a workaround */ } - - SliderCreateTreatment { id: _dialysateTemperature - objectName : "_dialysateTemperature" - label : qsTr("Dialysate Temperature") - flickable : _flickable - unit : Variables.unitTextTemperature - decimal : Variables.dialysateTempPrecision - minimum : vTreatmentRanges.dialysateTempMin - maximum : vTreatmentRanges.dialysateTempMax - step : vTreatmentRanges.dialysateTempRes - defaultValue: vTreatmentRanges.dialysateTempDef - valid : !vTreatmentCreate.dialysateTempRejectReason - - onValueChanged: { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.dialysateTempRejectReason = Variables.noRejectReason - } - vTreatmentCreate.dialysateTemp = value - } - } - -/* [DEN-15359] Arterial and Venous Pressure has been removed, it has been kept here since it supposed to become a component and don't watnt to loose the coce. - - // TODO : This has to be a Component - Column { id: _arterialColumn - spacing: 45 - anchors.horizontalCenter: parent.horizontalCenter - Row { id: _arterialTitleRow - function setColor() { - let slider = _arterialPressureLimits - let color = Colors.textDisableButton - if ( slider.minAdjusted && slider.maxAdjusted ) { - color = Colors.textMain - } - - // if it's invalid upper or lower bound, set invalid color - if (!_arterialPressureLimits.lowerBoundValid || !_arterialPressureLimits.upperBoundValid) { - color = Colors.createTreatmentInvalidParam - } - return color - } - width : parent.width - height : _arterialLabel.height - anchors.left: parent.left - Text { id: _arterialLabel - visible : true - width : parent.width/2 - color : _arterialTitleRow.setColor() - text : qsTr("Arterial Pressure Limits") - font.pixelSize : Fonts.fontPixelFluidText - } - Text { id: _arterialUnit - visible : true - width : parent.width/2 - color : _arterialLabel.color - text : Variables.unitTextBloodPressure - font.pixelSize : Fonts.fontPixelFluidText - horizontalAlignment: Text.AlignRight - } - } - RangeSlider { id: _arterialPressureLimits - objectName : "_arterialPressureLimitsSlider" - // dimension - height : Variables.sliderDefaultBodyHeight - width : Variables.createTreatmentSliderWidth - anchors.horizontalCenter: parent.horizontalCenter - ticks : true - stepSnap : true - hasAdjust : true - - // Texts - lowerText.visible : true - lowerText.font.pixelSize : Fonts.fontPixelFluidText - lowerText.font.bold : false - lowerText.anchors.topMargin : -60 - lowerTextHorizontalCenter : true - - upperText.visible : true - upperText.font.pixelSize : Fonts.fontPixelFluidText - upperText.font.bold : false - upperText.anchors.topMargin : -60 - upperTextHorizontalCenter : true - - lowerBoundValid: !vTreatmentCreate.arterialPressureLimitLowRejectReason - upperBoundValid: !vTreatmentCreate.arterialPressureLimitHighRejectReason - - minText.visible : true - minText.font.bold : false - minVerticalEdgeVisible : false - - maxText.visible : true - maxText.font.bold : false - maxVerticalEdgeVisible : false - - // Ranges - step : vTreatmentRanges.arterialPressureLimitLowRes // currently min & max are on the same slider/scale so used min as the main res - gapValue : vTreatmentRanges.arterialPressureLimitLowGap // currently min & max are on the same slider/scale so used min as the main res - minimum : vTreatmentRanges.arterialPressureLimitLowMin - maximum : vTreatmentRanges.arterialPressureLimitHighMax - minValue : vTreatmentRanges.arterialPressureLimitLowDef - maxValue : vTreatmentRanges.arterialPressureLimitHighDef - minValueLowerBound : vTreatmentRanges.arterialPressureLimitLowMin - minValueUpperBound : vTreatmentRanges.arterialPressureLimitLowMax - maxValueLowerBound : vTreatmentRanges.arterialPressureLimitHighMin - maxValueUpperBound : vTreatmentRanges.arterialPressureLimitHighMax - // scroll handling and value updates - onPressed : { setInteractive(false) } - onDragged : { setInteractive(false) } - onReleased : { setInteractive(true ) } - onMinValueChanged : { - if ( minAdjusted ) { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!lowerBoundValid) { - vTreatmentCreate.arterialPressureLimitLowRejectReason = Variables.noRejectReason - } - vTreatmentCreate.arterialPressureLimitLow = minValue - } - } - onMaxValueChanged : { - if ( maxAdjusted ) { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!upperBoundValid) { - vTreatmentCreate.arterialPressureLimitHighRejectReason = Variables.noRejectReason - } - vTreatmentCreate.arterialPressureLimitHigh = maxValue - } - } - - SliderArrows{ id:_arterialPressureLimitsMaxArrows - anchors.verticalCenter : _arterialPressureLimits.verticalCenter - anchors.left : _arterialPressureLimits.right - anchors.leftMargin : Variables.sliderAdjustButtonLeftMargin - onIncrementValue : _arterialPressureLimits.incrementMax(true) - onDecrementValue : _arterialPressureLimits.decrementMax(true) - } - - SliderArrows{ id:_arterialPressureLimitsMinArrows - anchors.verticalCenter : _arterialPressureLimits.verticalCenter - anchors.right : _arterialPressureLimits.left - anchors.rightMargin : Variables.sliderAdjustButtonRightMargin - onIncrementValue : _arterialPressureLimits.incrementMin(true) - onDecrementValue : _arterialPressureLimits.decrementMin(true) - } - } - } - - // TODO : This has to be a Component - Column { id: _venousColumn - spacing: 45 - anchors.horizontalCenter: parent.horizontalCenter - Row { id: _venousTitleRow - function setColor() { - let slider = _venousPressureLimits - let color = Colors.textDisableButton - if ( slider.minAdjusted && slider.maxAdjusted ) { - color = Colors.textMain - } - - // if it's invalid upper or lower bound, set invalid color - if (!_venousPressureLimits.lowerBoundValid || !_venousPressureLimits.upperBoundValid) { - color = Colors.createTreatmentInvalidParam - } - return color - } - width : parent.width - height : _venousLabel.height - anchors.left: parent.left - Text { id: _venousLabel - visible : true - width : parent.width/2 - color : _venousTitleRow.setColor() - text : qsTr("Venous Pressure Limits") - font.pixelSize : Fonts.fontPixelFluidText - } - Text { id: _venousUnit - visible : true - width : parent.width/2 - color : _venousTitleRow.setColor() - text : Variables.unitTextBloodPressure - font.pixelSize : Fonts.fontPixelFluidText - horizontalAlignment: Text.AlignRight - } - } - RangeSlider { id: _venousPressureLimits - objectName: "_venousPressureLimitsSlider" - // dimension - height : Variables.sliderDefaultBodyHeight - width : Variables.createTreatmentSliderWidth - anchors.horizontalCenter: parent.horizontalCenter - ticks : true - stepSnap : true - hasAdjust : true - - // slider visuals - showTickmarks : true - isRoundedEnds : true - isTickMarksRound: true - - // Texts - lowerText.visible : true - lowerText.font.pixelSize : Fonts.fontPixelFluidText - lowerText.font.bold : false - lowerText.anchors.topMargin : -60 - lowerTextHorizontalCenter : true - - upperText.visible : true - upperText.font.pixelSize : Fonts.fontPixelFluidText - upperText.font.bold : false - upperText.anchors.topMargin : -60 - upperTextHorizontalCenter : true - - lowerBoundValid : !vTreatmentCreate.venousPressureLimitLowRejectReason - upperBoundValid : !vTreatmentCreate.venousPressureLimitHighRejectReason - - minText.visible : true - minText.font.bold : false - minVerticalEdgeVisible : false - - maxText.visible : true - maxText.font.bold : false - maxVerticalEdgeVisible : false - - // Ranges - step : vTreatmentRanges.venousPressureLimitLowRes // currently min & max are on the same slider/scale so used min as the main res - gapValue : vTreatmentRanges.venousPressureLimitLowGap // currently min & max are on the same slider/scale so used min as the main res - minimum : vTreatmentRanges.venousPressureLimitLowMin - maximum : vTreatmentRanges.venousPressureLimitHighMax - minValue : vTreatmentRanges.venousPressureLimitLowDef - maxValue : vTreatmentRanges.venousPressureLimitHighDef - minValueLowerBound : vTreatmentRanges.venousPressureLimitLowMin - minValueUpperBound : vTreatmentRanges.venousPressureLimitLowMax - maxValueLowerBound : vTreatmentRanges.venousPressureLimitHighMin - maxValueUpperBound : vTreatmentRanges.venousPressureLimitHighMax - // scroll handling and value updates - onPressed : { setInteractive(false) } - onDragged : { setInteractive(false) } - onReleased : { setInteractive(true ) } - onMinValueChanged : { - if ( minAdjusted ) { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!lowerBoundValid) { - vTreatmentCreate.venousPressureLimitLowRejectReason = Variables.noRejectReason - } - vTreatmentCreate.venousPressureLimitLow = minValue - } - } - onMaxValueChanged : { - if ( maxAdjusted ) { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!upperBoundValid) { - vTreatmentCreate.venousPressureLimitHighRejectReason = Variables.noRejectReason - } - vTreatmentCreate.venousPressureLimitHigh = maxValue - } - } - - SliderArrows{ id:_venousPressureLimitsMaxArrows - anchors.verticalCenter : _venousPressureLimits.verticalCenter - anchors.left : _venousPressureLimits.right - anchors.leftMargin : Variables.sliderAdjustButtonLeftMargin - onIncrementValue : _venousPressureLimits.incrementMax(true) - onDecrementValue : _venousPressureLimits.decrementMax(true) - } - - SliderArrows{ id:_venousPressureLimitsMinArrows - anchors.verticalCenter : _venousPressureLimits.verticalCenter - anchors.right : _venousPressureLimits.left - anchors.rightMargin : Variables.sliderAdjustButtonRightMargin - onIncrementValue : _venousPressureLimits.incrementMin(true) - onDecrementValue : _venousPressureLimits.decrementMin(true) - } - } - } - -*/ - - SliderCreateTreatment { id: _bloodPressureInterval - objectName : "_bloodPressureMeasurementInterval" - label : qsTr("Blood Pressure Measurement Interval") - zeroLabel : qsTr("OFF") - flickable : _flickable - unit : Variables.unitTextDuration - minimum : vTreatmentRanges.bloodPressureMeasureIntervalMin - maximum : vTreatmentRanges.bloodPressureMeasureIntervalMax - step : vTreatmentRanges.bloodPressureMeasureIntervalRes - defaultValue: vTreatmentRanges.bloodPressureMeasureIntervalDef - valid : !vTreatmentCreate.bloodPressureMeasureIntervalRejectReason - adjustable : _bloodPressureIntervalSwitch.checked - inActiveZero: true - enableAdjustButtons: _bloodPressureIntervalSwitch.checked - onValueChanged: { - // Reset the valid state to allow repositioning to the next invalid parameter - if(!valid) { - vTreatmentCreate.bloodPressureMeasureIntervalRejectReason = Variables.noRejectReason - } - vTreatmentCreate.bloodPressureMeasureInterval = _bloodPressureIntervalSwitch.checked ? value : 0 - } - - // ToDo: create a component for this, - // ToDo: Consider putting the new CheckBox component into the SliderCreateTreatment component and set via boolean property - // This is a full implementation of a CheckBox - toggleSwich: _bloodPressureIntervalSwitch - Switch { id: _bloodPressureIntervalSwitch - property bool active: false - onCheckedChanged: { - if ( ! active ) { - active = true - checked = ! checked - } - vTreatmentCreate.bloodPressureMeasureInterval = 0 - _bloodPressureInterval.reset ( 0 ) - _bloodPressureInterval.active = ! checked - - } - - x : width * -1.5 - y : Variables.createTreatmentSwitchYDisplacement // these values are set to align the switch with slider - width : 75 // these values are set to align the switch with slider - height : 85 // these values are set to align the switch with slider - // DEBUG: background : Rectangle { color : "white" } - - indicator: Rectangle { - implicitWidth : Variables.sliderCircleDiameter * 1.7 - implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) - radius : implicitHeight - anchors.centerIn: parent - color : _bloodPressureIntervalSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive - border.color : _bloodPressureIntervalSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive - Rectangle { - property real diameter : Variables.sliderCircleDiameter - - x: _bloodPressureIntervalSwitch.checked ? parent.width - width : 0 - anchors.verticalCenter: parent.verticalCenter - width : diameter - height : diameter - radius : diameter - color : _bloodPressureIntervalSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive - border { - width: Variables.progressbarHandlerBorderWidth - color: Colors.textMain - } - } - } - - contentItem: Text { - text : _bloodPressureIntervalSwitch.checked ? qsTr("ON") : qsTr("OFF") - font : _bloodPressureIntervalSwitch.font - color : _bloodPressureIntervalSwitch.active ? Colors.textMain : Colors.textDisableButton - verticalAlignment: Text.AlignTop - horizontalAlignment: Text.AlignHCenter - anchors.centerIn: parent - } - } - } - - Item { - width : 50 - height : 50 - } - } } }