Index: sources/gui/qml/components/GridSelection.qml =================================================================== diff -u -rcc8ee87091a1f5d69136f6e5508f57014c05d02d -r38d3c6a41726ec1a02abb4eb6f63524628511a50 --- sources/gui/qml/components/GridSelection.qml (.../GridSelection.qml) (revision cc8ee87091a1f5d69136f6e5508f57014c05d02d) +++ sources/gui/qml/components/GridSelection.qml (.../GridSelection.qml) (revision 38d3c6a41726ec1a02abb4eb6f63524628511a50) @@ -37,21 +37,22 @@ property alias titleColor : _title.color property var labels : [] property bool active : false + property bool valid : true readonly property int _itemCount: labels.length readonly property int _rowCount : Math.ceil( _itemCount / _colCount ) readonly property int _colCount : 2 anchors.horizontalCenter: parent.horizontalCenter color : Colors.transparent - height : _root.rowCount * _root.optionHeight + height : _root.rowCount * _root.optionHeight + _title.height + _grid.anchors.topMargin width : _root.colCount * _root.optionWidth signal clicked(int vIndex) Text { id : _title text : "" - color : Colors.textMain; + color : _root.valid ? Colors.textMain : Colors.createTreatmentInvalidParam font.pixelSize : Fonts.fontPixelFluidText } Index: sources/gui/qml/components/SliderCreateTreatment.qml =================================================================== diff -u -r5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e -r38d3c6a41726ec1a02abb4eb6f63524628511a50 --- sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 5d7dd96636bc7a647c61a43bb04ed25f5c2f6e7e) +++ sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision 38d3c6a41726ec1a02abb4eb6f63524628511a50) @@ -54,16 +54,10 @@ anchors.horizontalCenter: parent.horizontalCenter function setColor() { - let color = Colors.textDisableButton - if ( _root.active ) { - if ( _root.valid ) { - color = Colors.textMain - } - else { - color = Colors.createTreatmentInvalidParam - } - } - return color + let color = Colors.textMain + if ( ! _root.valid ) { color = Colors.createTreatmentInvalidParam ; return color } + if ( ! _root.active ) { color = Colors.textDisableButton ; return color } + return color } function setValue() { Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml =================================================================== diff -u -rba22b3cd3977f4d2f3aa980efe931f0372678cdf -r38d3c6a41726ec1a02abb4eb6f63524628511a50 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision ba22b3cd3977f4d2f3aa980efe931f0372678cdf) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreate.qml (.../PreTreatmentCreate.qml) (revision 38d3c6a41726ec1a02abb4eb6f63524628511a50) @@ -31,79 +31,67 @@ objectName: "_PreTreatmentCreate" // SquishQt testability header.confirmEnabled: - _bloodFlowRate .active && - _dialysateFlowRate .active && - _duration .active && - _heparinDispensingRate .active && - _heparinBolusVolume .active && - _heparinStopTime .active && - _salineBolus .active && - _heparinType .active && - _acidConcentrate .active && - _bicarbonateConcentrate .active && - _dialyzerType .active && - _dialysateTemperature .active && - _arterialPressureLimits .minAdjusted && - _arterialPressureLimits .maxAdjusted && - _venousPressureLimits .minAdjusted && - _venousPressureLimits .maxAdjusted && - _bloodPressureInterval .active && - _rinsebackFlowRate .active + _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 .active && + _acidConcentrate .active && + _bicarbonateConcentrate .active && + _dialyzerType .active && + _dialysateTemperature .active && _dialysateTemperature . valid && + _arterialPressureLimits .minAdjusted && _arterialPressureLimits .lowerBoundValid && + _arterialPressureLimits .maxAdjusted && _arterialPressureLimits .upperBoundValid && + _venousPressureLimits .minAdjusted && _venousPressureLimits .lowerBoundValid && + _venousPressureLimits .maxAdjusted && _venousPressureLimits .upperBoundValid && + _bloodPressureInterval .active && _bloodPressureInterval . valid && + _rinsebackFlowRate .active && _rinsebackFlowRate . valid - onConfirmClicked: _flickable.isUpdatingView = true - Connections{ target:vTreatmentCreate // Update flicker location to show the invalid parameter - function onBloodFlowRateRejectReasonChanged() { _flickable.setFlickableFocus(! _bloodFlowRate.valid, _bloodFlowRate.y )} - function onDialysateFlowRateRejectReasonChanged() { _flickable.setFlickableFocus(! _dialysateFlowRate.valid, _dialysateFlowRate.y )} - function onTreatmentDurationRejectReasonChanged() { _flickable.setFlickableFocus(! _duration.valid, _duration.y )} - function onHeparinDispensingRateRejectReasonChanged() { _flickable.setFlickableFocus(! _heparinDispensingRate.valid, _heparinDispensingRate.y )} - function onHeparinBolusVolumeRejectReasonChanged() { _flickable.setFlickableFocus(! _heparinBolusVolume.valid, _heparinBolusVolume.y )} - function onHeparinStopTimeRejectReasonChanged() { _flickable.setFlickableFocus(! _heparinStopTime.valid, _heparinStopTime.y )} - function onSalineBolusVolumeRejectReasonChanged() { _flickable.setFlickableFocus(! _salineBolus.valid, _salineBolus.y )} + 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 } - function onHeparinTypeRejectReasonChanged() { _flickable.setFlickableFocus(! _heparinType.valid, _heparinType.y )} - function onAcidConcentrateRejectReasonChanged() { _flickable.setFlickableFocus(! _acidConcentrate.valid, _acidConcentrate.y )} - function onBicarbonateConcentrateRejectReasonChanged() { _flickable.setFlickableFocus(! _bicarbonateConcentrate.valid, _bicarbonateConcentrate.y )} - function onDialyzerTypeRejectReasonChanged() { _flickable.setFlickableFocus(! _dialyzerType.valid, _dialyzerType.y )} + if ( vTreatmentCreate. heparinTypeRejectReason ) { scrollTo( _heparinType ); return } + if ( vTreatmentCreate. acidConcentrateRejectReason ) { scrollTo( _acidConcentrate ); return } + if ( vTreatmentCreate. bicarbonateConcentrateRejectReason ) { scrollTo( _bicarbonateConcentrate ); return } + if ( vTreatmentCreate. dialyzerTypeRejectReason ) { scrollTo( _dialyzerType ); return } - function onDialysateTempRejectReasonChanged() { _flickable.setFlickableFocus(! _dialysateTemperature.valid, _dialysateTemperature.y )} - function onVenousPressureLimitLowRejectReasonChanged() { _flickable.setFlickableFocus(! _venousPressureLimits.lowerBoundValid, _venousPressureLimits.y )} - function onVenousPressureLimitHighRejectReasonChanged() { _flickable.setFlickableFocus(! _venousPressureLimits.upperBoundValid, _venousPressureLimits.y )} - function onArterialPressureLimitLowRejectReasonChanged() { _flickable.setFlickableFocus(!_arterialPressureLimits.lowerBoundValid, _arterialPressureLimits.y )} - function onArterialPressureLimitHighRejectReasonChanged() { _flickable.setFlickableFocus(!_arterialPressureLimits.upperBoundValid, _arterialPressureLimits.y )} - function onBloodPressureMeasureIntervalRejectReasonChanged() { _flickable.setFlickableFocus(!_bloodPressureInterval.valid , _bloodPressureInterval.y )} - function onRinsebackFlowRateRejectReasonChanged() { _flickable.setFlickableFocus(!_rinsebackFlowRate.valid , _rinsebackFlowRate.y )} + if ( vTreatmentCreate. dialysateTempRejectReason ) { scrollTo( _dialysateTemperature ); return } + if ( vTreatmentCreate. arterialPressureLimitLowRejectReason ) { scrollTo( _venousColumn ); return } + if ( vTreatmentCreate. arterialPressureLimitHighRejectReason ) { scrollTo( _venousColumn ); return } + if ( vTreatmentCreate. venousPressureLimitLowRejectReason ) { scrollTo( _arterialColumn ); return } + if ( vTreatmentCreate. venousPressureLimitHighRejectReason ) { scrollTo( _venousColumn ); return } + if ( vTreatmentCreate.bloodPressureMeasureIntervalRejectReason ) { scrollTo( _bloodPressureInterval ); return } + if ( vTreatmentCreate. rinsebackFlowRateRejectReason ) { scrollTo( _rinsebackFlowRate ); return } + } } function setInteractive(vInteractive) { _flickable.interactive = vInteractive } + function scrollTo(vItem) { + _flickable.contentY = vItem.mapToItem(_flickable.contentItem, 0, 0).y + } + + ScrollBar { flickable : _flickable anchors.fill: _flickable anchors.rightMargin : Variables.minVGap } Flickable { id: _flickable - property bool isUpdatingView : true // To avoid moving view when adjusting the invalid param's slider - function setFlickableFocus(vIsMovingTo, vYPosition) { - if ( vIsMovingTo && isUpdatingView) { - _flickable.contentY = determineYPosition(vYPosition) - } else { - isUpdatingView = !vIsMovingTo - } - } - - function determineYPosition(vYPosition) { - let lastViewableSectionY = _flickable.contentHeight - _flickable.height - if(vYPosition > lastViewableSectionY) - return lastViewableSectionY - else - return vYPosition - } - objectName: "TreatmentCreateFlickable" clip: true anchors { @@ -424,33 +412,41 @@ GridSelection { id : _heparinType objectName : "_heparinTypeRect" title : qsTr("Heparin Type") - titleColor : !vTreatmentCreate.heparinTypeRejectReason ? Colors.textMain : Colors.createTreatmentInvalidParam labels : vTreatmentRanges.heparinTypeOptions onClicked :{vTreatmentCreate.heparinType = curIndex ; vTreatmentCreate.heparinTypeSet = true; } + + valid : ! vTreatmentCreate.heparinTypeRejectReason + onCurIndexChanged : vTreatmentCreate.heparinTypeRejectReason = Variables.noRejectReason } GridSelection { id : _acidConcentrate objectName : "_acidConcentrateRect" title : qsTr("Acid Concentrate") - titleColor : !vTreatmentCreate.acidConcentrateRejectReason ? Colors.textMain : Colors.createTreatmentInvalidParam 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") - titleColor : !vTreatmentCreate.bicarbonateConcentrateRejectReason ? Colors.textMain : Colors.createTreatmentInvalidParam 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") - titleColor : !vTreatmentCreate.dialyzerTypeRejectReason ? Colors.textMain : Colors.createTreatmentInvalidParam 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 */ } Index: sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateStack.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r38d3c6a41726ec1a02abb4eb6f63524628511a50 --- sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateStack.qml (.../PreTreatmentCreateStack.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/pages/pretreatment/create/PreTreatmentCreateStack.qml (.../PreTreatmentCreateStack.qml) (revision 38d3c6a41726ec1a02abb4eb6f63524628511a50) @@ -110,7 +110,7 @@ } Connections { target: vTreatmentCreate - function onFwValidationSuccess ( vValue ) { page( _pretreatmentConfirm )} + function onDidValidationPass ( vValue ) { page( _pretreatmentConfirm )} } Connections { target: _pretreatmentConfirm Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -rcc8ee87091a1f5d69136f6e5508f57014c05d02d -r38d3c6a41726ec1a02abb4eb6f63524628511a50 --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision cc8ee87091a1f5d69136f6e5508f57014c05d02d) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 38d3c6a41726ec1a02abb4eb6f63524628511a50) @@ -129,10 +129,10 @@ bloodPressureMeasureIntervalRejectReason (data.bloodPressureMeasureInterval); rinsebackFlowRateRejectReason (data.rinsebackFlowRate ); - emit fwValidationFailed(""); + emit didValidationFail(); } else { - emit fwValidationSuccess(); + emit didValidationPass(); } } Index: sources/view/VTreatmentCreate.h =================================================================== diff -u -rcc8ee87091a1f5d69136f6e5508f57014c05d02d -r38d3c6a41726ec1a02abb4eb6f63524628511a50 --- sources/view/VTreatmentCreate.h (.../VTreatmentCreate.h) (revision cc8ee87091a1f5d69136f6e5508f57014c05d02d) +++ sources/view/VTreatmentCreate.h (.../VTreatmentCreate.h) (revision 38d3c6a41726ec1a02abb4eb6f63524628511a50) @@ -106,10 +106,10 @@ TRIGGER (quint32 , heparinStopTimeRejectReason , 0 ) TRIGGER (quint32 , salineBolusVolumeRejectReason , 0 ) - TRIGGER(quint32 , heparinTypeRejectReason , 0 ) - TRIGGER(quint32 , acidConcentrateRejectReason , 0 ) - TRIGGER(quint32 , bicarbonateConcentrateRejectReason , 0 ) - TRIGGER(quint32 , dialyzerTypeRejectReason , 0 ) + TRIGGER(quint32 , heparinTypeRejectReason , 0 ) + TRIGGER(quint32 , acidConcentrateRejectReason , 0 ) + TRIGGER(quint32 , bicarbonateConcentrateRejectReason , 0 ) + TRIGGER(quint32 , dialyzerTypeRejectReason , 0 ) TRIGGER (quint32 , dialysateTempRejectReason , 0 ) TRIGGER (quint32 , arterialPressureLimitLowRejectReason , 0 ) @@ -130,9 +130,8 @@ void didAdjustment(const AdjustParametersValidationRequestData &data); void didAdjustment(const AdjustParametersConfirmRequestData &data); - void fwValidationFailed(QString reason); - void fwValidationSuccess(); - void scrollToParameter(QString parameter); + void didValidationFail(); + void didValidationPass(); public slots: void doValidation ();