Index: sources/gui/qml/dialogs/watersample/WaterSamplePage.qml =================================================================== diff -u -rd00eeb4a8b354eade40a0853c022eb03ea4ae233 -rfb1185f1c17778a9f8b300170d8d635a1532f6b4 --- sources/gui/qml/dialogs/watersample/WaterSamplePage.qml (.../WaterSamplePage.qml) (revision d00eeb4a8b354eade40a0853c022eb03ea4ae233) +++ sources/gui/qml/dialogs/watersample/WaterSamplePage.qml (.../WaterSamplePage.qml) (revision fb1185f1c17778a9f8b300170d8d635a1532f6b4) @@ -6,68 +6,30 @@ // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" WaterSampleBase { id: _root anchors.fill: parent - property int attempt: 1 - readonly property var instructionsGroup : vSettings.instructions[qsTr("Water Sample")] + readonly property bool isPrimary : vWaterSample.Valve === WaterSamplePage.PRIMARY - component WaterSampleRadioButton: RadioButton { id: _waterSampleRadioButton - property alias imageSource : _resultImage.source - - indicator: Rectangle { id: _indicator - width : 35 - height : 35 - radius : 35 - border.width: 2 - border.color: Colors.backgroundMainMenu - anchors.verticalCenter: parent.verticalCenter - - Rectangle { - anchors.centerIn: parent - width : 25 - height : 25 - radius : 25 - color : _waterSampleRadioButton.checked ? Colors.highlightProgressBar: Colors.backgroundMainMenu - visible : _waterSampleRadioButton.checked - } - } - - contentItem: Row { id: _row - spacing : _waterSampleRadioButton.spacing - leftPadding : 70 - anchors.verticalCenter: parent.verticalCenter - - Image { id: _resultImage } - - Text { id: _text - text : _waterSampleRadioButton.text - font.pixelSize : Fonts.fontPixelInstructionStep - color : Colors.modeTextColor - verticalAlignment : Text.AlignVCenter - height : _row.height - width : _text.implicitWidth - } - } + enum Valve { + PRIMARY , + SECONDARY } - contentItem : Rectangle { id: _content - color : Colors.modeBackgroundColor - radius : Variables.alarmDialogRadius - clip : true - + contentItem : Item { id: _content Text { id: _title anchors { left : parent.left leftMargin : Variables.defaultMargin * 3 // with current resolution this makes the screen look nice top : parent.top - topMargin : Variables.defaultMargin * 2 // with current resolution this makes the screen look nice + topMargin : Variables.defaultMargin // with current resolution this makes the screen look nice } - text : _root.instructionsGroup ? _root.instructionsGroup.title : "" + text : qsTr("Test %1 Carbon Filter").arg(_root.isPrimary ? qsTr("Primary") : qsTr("Secondary") ) height : Variables.contentHeight - color : Colors.modeTextColor - font.pixelSize : Fonts.fontPixelInstructionTitle + color : Colors.offWhite + font.pixelSize : Fonts.fontPixelTextRectLabel font.weight : Font.Medium } @@ -77,126 +39,131 @@ right : undefined left : _title.left top : _title.bottom - topMargin : Variables.defaultMargin * 2 + topMargin : Variables.defaultMargin } width : parent.width / 3 height : Variables.contentHeight color : "transparent" imageSource : "qrc:/images/iHelp" imageVisible : true text : qsTr("Test the carbon filters per your clinic's instructions") - textColor : Colors.modeTextColor + textfontWeight : Font.Medium + textColor : Colors.statusTextPaused imageDiameter : 25 imageTopMargin : 3 } - Item { id: _instructionContainer + Text { id: _message anchors { - right : _content.right - left : _title.left - top : _infoNotificationBar.bottom - bottom : _content.bottom + top : _infoNotificationBar.bottom + topMargin : Variables.defaultMargin * 3 + left : _title.left } - Item { id: _instruction - width : _instructionContainer.width - height : Variables.instructionHeight + text : qsTr("Test the %1 carbon filter and enter the result below").arg( _root.isPrimary ? qsTr("primary") : qsTr("secondary") ) + font.weight : Font.Medium + color : Colors.offWhite + font.pixelSize : Fonts.fontPixelInstructionStep + } - Rectangle { id: _attemptRect - anchors.left : parent.left - anchors.verticalCenter : parent.verticalCenter + LabelUnitValueAdjuster { id: _chlorineLevel + anchors { + top : _message.bottom + topMargin : Variables.defaultMargin * 4 + left : _title.left + } - height : 50 - width : height - radius : height - color : Colors.modeButtonColor + text : qsTr("Chlorine Level") + unitText : Variables.unitTextChlorine + minimum : vTreatmentRanges.chlorineWaterSampleMin + maximum : vTreatmentRanges.chlorineWaterSampleMax + step : vTreatmentRanges.chlorineWaterSampleRes + defaultValue : vTreatmentRanges.chlorineWaterSampleDef + value : vTreatmentRanges.chlorineWaterSampleDef + decimal : Variables.chlorinePrecision + isActive : true - Text { id: _attemptNumberRect - anchors.centerIn: parent - text : _root.attempt - color : Colors.white - font.pixelSize : 28 - font.weight : Font.Medium - } - } + onDidChange : { + value = vValue + } + } - Text { id: _message - anchors { - left : _attemptRect.right - leftMargin : Variables.defaultMargin * 2 // with current resolution this makes the screen look nice - right : parent.right - verticalCenter : parent.verticalCenter - } - text : _root.instructionsGroup ? _root.instructionsGroup.keys[0] : "" //qsTr("Test the primary carbon filter and select the result below") - font.weight : Font.Medium - color : Colors.modeTextColor - wrapMode : Text.WordWrap - font.pixelSize : Fonts.fontPixelInstructionStep - } + Text { id: _lastRecorded + anchors { + top : _chlorineLevel.bottom + topMargin : Variables.defaultMargin * 4 + left : _title.left } + height : 30 + width : _content.width + font.pixelSize : Fonts.fontPixelNotification + font.weight : Font.Normal + verticalAlignment : Text.AlignBottom + color : Colors.offWhite + text : ("%1 %2") .arg(qsTr("Last Tested:")) + .arg(vPreTreatmentAdjustmentWaterSample.resultTime) + visible : _lastValue.visible + } - Column { - anchors { - left : parent.left - leftMargin : Variables.defaultMargin * 6 - top : _instruction.bottom - topMargin : Variables.defaultMargin - } - spacing: Variables.defaultMargin * 3 - - ButtonGroup { id: _radioGroup } - - WaterSampleRadioButton { id: _failContainer - text: ("%1 > %2 %3") .arg(qsTr("Chlorine level")) - .arg(Variables.chlorineLevel) - .arg(Variables.unitTextChlorine) - ButtonGroup.group : _radioGroup - spacing : Variables.defaultMargin - imageSource : "qrc:/images/iWaterSampleFail" - } - - WaterSampleRadioButton { id: _passContainer - text: ("%1 ≤ %2 %3").arg(qsTr("Chlorine level")) - .arg(Variables.chlorineLevel) - .arg(Variables.unitTextChlorine) - ButtonGroup.group: _radioGroup - spacing : Variables.defaultMargin - imageSource : "qrc:/images/iWaterSamplePass" - } + Text { id: _lastValue + anchors { + top : _lastRecorded.bottom + topMargin : Variables.defaultMargin + left : _title.left } + + height : 30 + width : _content.width + font.pixelSize : Fonts.fontPixelNotification + font.weight : Font.Normal + verticalAlignment : Text.AlignBottom + color : Colors.offWhite + text : ("%1 %2 %3") .arg(qsTr("Last Result:")) + .arg(vPreTreatmentAdjustmentWaterSample.resultValue.toFixed(Variables.chlorinePrecision)) + .arg(Variables.unitTextChlorine) + visible : vPreTreatmentAdjustmentWaterSample.resultValue } + Image { id: _image anchors.right : parent.right anchors.top : parent.top - anchors.bottom : parent.bottom - source : _root.instructionsGroup ? _root.instructionsGroup.values[0] : "" //"qrc:/images/iRedCrossWCircle" // TODO get actual image + source : _root.isPrimary ? "qrc:/images/iCarbonFilter1" : + "qrc:/images/iCarbonFilter2" } ConfirmButton { id : _confirmButton objectName : "_confirmButton" anchors { - top : undefined - right : undefined - bottom : parent.bottom + top : undefined + right : undefined + bottom : parent.bottom + bottomMargin : notification.height + Variables.defaultMargin horizontalCenter: parent.horizontalCenter } - enabled : _failContainer.checked || _passContainer.checked + height : Variables.defaultButtonHeight + width : Variables.defaultButtonWidth - onClicked : vPreTreatmentAdjustmentWaterSample.doResult( _passContainer.checked ) + onClicked : vPreTreatmentAdjustmentWaterSample.doResult( _chlorineLevel.value ) } } - // TODO water sample -// Connections { target: vPreTreatmentAdjustmentWaterSample -// function onAdjustmentTriggered ( vValue ) { -// if ( vPreTreatmentAdjustmentWaterSample.adjustment_Accepted ) { -// _pretreatmentWaterSample.reasonText = "" -// page ( _pretreatmentCreate ) -// } else { -// _pretreatmentWaterSample.reasonText = vPreTreatmentAdjustmentWaterSample.text() -// } -// } -// } + // this notification shall not be confused with the _notification in the parent ModalDailog + // this meant to be used specifically as current state notification like paused/off in UF + // it is also available in TreatmentAdjustmentFlow and TreatmentAdjustmentDuration but not used. + NotificationBarSmall { id: _information + anchors.bottom : parent.bottom + imageSource : "" + text : "" + } + Connections { target: vPreTreatmentAdjustmentWaterSample + function onAdjustmentTriggered ( vValue ) { + if ( vPreTreatmentAdjustmentWaterSample.adjustment_Accepted ) { + _information.text = "" + } else { + _information.text = vPreTreatmentAdjustmentWaterSample.text() + } + } + } }