Index: sources/gui/qml/pages/rxmanager/RxProfileContainer.qml =================================================================== diff -u -rb4d8fe6f11b7cdf0c631b3ab35ba36f18e0d7bc4 -readfcc99876849e52370db5dde4c4c42d4dbc76f --- sources/gui/qml/pages/rxmanager/RxProfileContainer.qml (.../RxProfileContainer.qml) (revision b4d8fe6f11b7cdf0c631b3ab35ba36f18e0d7bc4) +++ sources/gui/qml/pages/rxmanager/RxProfileContainer.qml (.../RxProfileContainer.qml) (revision eadfcc99876849e52370db5dde4c4c42d4dbc76f) @@ -22,76 +22,153 @@ import "qrc:/components" import "qrc:/pages/rxmanager" -Component { - id: _root Rectangle { - id: _rxItem + id: _root + property bool onShow: true + signal loadRxProfile() + width: ListView.view.width height: 345 color: Colors.mainTreatmentLighterBlue radius: 10 - Column { - id: _componentColumn - spacing: 5 + Item{ + id: _containerHeader anchors { + top : parent.top left : parent.left right : parent.right - leftMargin: Variables.defaultMargin * 2 - rightMargin: Variables.defaultMargin * 2 - topMargin : Variables.defaultMargin * 2 + topMargin : Variables.defaultMargin + rightMargin : Variables.defaultMargin + leftMargin : Variables.defaultMargin * 2 } + height: 50 Text { id: _profileName - text: profileName + anchors.left : _containerHeader.left + text : profileName font.pointSize : Fonts.fontPixelButton * 1.4 - width: parent.width - horizontalAlignment: Text.AlignLeft - color : Colors.pressuresText + horizontalAlignment : Text.AlignHCenter + color : Colors.pressuresText } + Row{ + id: _rxContainerRow + anchors.right : parent.right + spacing : 20 + property int rxProfileCount : vRxProfiles.rxProfiles.rowCount() + readonly property string editRx : qsTr( "Edit" ) + readonly property string duplicateRx : qsTr( "Duplicate" ) + readonly property string exportRx : qsTr( "Export" ) + readonly property string deleteRx : qsTr( "Delete" ) + + TouchRect { id : _rxSelectButton + text.text : qsTr("Select") + height : Variables.defaultButtonHeight + width : Variables.defaultButtonWidth + visible : ! _root.onShow + + onClicked :{ + vTreatmentCreate.doLoadRxProfile(vRxProfiles.rxProfiles.get(index), false) + _root.loadRxProfile() + } + } + + IconButton { id: _favoriteButton + property bool isFavorite: false // Add a property connected to this button that will; affect the model that has the list View of Rx profiles + iconSize : Variables.iconButtonSize + iconImageSource :_favoriteButton.isFavorite ? "qrc:/images/iFullHeartFavorite" : "qrc:/images/iEmptyHeartFavorite" + + onClicked:{ + isFavorite = !isFavorite + // Add signal to change model backend to be favorite or not, eventually connet property to model + } + } + BaseComboBox { id: _rxProfileMenu + model : _rxContainerRow.rxProfileCount === 10 + ? [ _rxContainerRow.editRx, _rxContainerRow.exportRx, _rxContainerRow.deleteRx ] + : [ _rxContainerRow.editRx, _rxContainerRow.duplicateRx, _rxContainerRow.exportRx, _rxContainerRow.deleteRx ] + height : 50 + width : 50 + dropDownWidth : 250 + delegateHeight : 65 + popupX : -250 + displayText : "" + iconSource : "qrc:/images/iMenuDot" + backgroundColor : Colors.transparent + visible : _root.onShow + + onActivated: { + const selectedItem = model[currentIndex] + + // only send AdjustParametersConfirmRequestData::eCancel when validated + // Telling FW user is canceling confirm treatment parameters + if ( vTreatmentCreate.parametersValidated ) { vTreatmentCreate.doCancel() } + + if ( selectedItem === _rxContainerRow.editRx ) { print("TODO: Open and edit current model") + vTreatmentCreate.doLoadRxProfile(vRxProfiles.rxProfiles.get(index), true) + _root.loadRxProfile()} + else if ( selectedItem === _rxContainerRow.duplicateRx ) { print("TODO: Open and edit copy of model") + vTreatmentCreate.doLoadRxProfile(vRxProfiles.rxProfiles.get(index), false) + _root.loadRxProfile()} + else if ( selectedItem === _rxContainerRow.exportRx ) { print("TODO: export copy of model") } + else if ( selectedItem === _rxContainerRow.deleteRx ) { vRxProfiles.doDeleteRxProfile(profileName) } + else { /*Unknown state */ } + + } + } + } + + } + Column { + id: _componentColumn + anchors { + top : _containerHeader.bottom + left : parent.left + right : parent.right + leftMargin : Variables.defaultMargin + rightMargin : Variables.defaultMargin * 2 + } + Row { id: _componentRow spacing: 5 width: parent.width - anchors { - left : _componentColumn.left - } property int componentWidth: parent.width / 8 - 5 RxProfileComponent{ id: _bloodflowComp title : "Blood Flow" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : bloodFlow unitText : Variables.unitTextFlowRate } RxProfileComponent{ id: _diaflowComp title : "Dialysate Flow" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : dialysateFlow unitText : Variables.unitTextFlowRate } RxProfileComponent{ id: _txDurComp title : "Duration" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : treatmentDuration unitText : Variables.unitTextDuration } RxProfileComponent{ id: _HeparinComp title : "Heparin" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth - value : (heparinVolume === "NONE") ? "- -" : heparinVolume + value : (heparinVolume === "NONE" || Number(heparinVolume).toFixed(3) === "0.000" ) ? Variables.emptyEntry : Number(heparinVolume).toFixed(3) unitText : Variables.unitTextFluid } RxProfileComponent{ id: _ACComp title : "Acid" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : acidConcentrate.replace(", ", "\n") topTextFont : Fonts.fontPixelRxProfileComponentSmall @@ -100,7 +177,7 @@ RxProfileComponent{ id: _BcComp title : "Bicarbonate" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : bicarbConcentrate.replace(" ", "\n") topTextFont : Fonts.fontPixelRxProfileComponentSmall @@ -109,7 +186,7 @@ RxProfileComponent{ id: _DialyzerComp title : "Dialyzer" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : dialyzerType.replace(/((?:[^ ]+ ){1}[^ ]+)\s/, "$1\n") topTextFont : Fonts.fontPixelRxProfileComponentSmall @@ -118,21 +195,26 @@ RxProfileComponent{ id: _TempComp title : "Dialysate Temp" - height : _rxItem.height - (100 + Variables.defaultMargin * 2) + height : _root.height - (100 + Variables.defaultMargin * 2) width : _componentRow.componentWidth value : dialysateTemperature unitText : Variables.unitTextTemperature } } - Text { -// anchors.topMargin: Variables.defaultMargin*2 - text : 'Last Modified: ' + lastModifiedDate - width : parent.width - horizontalAlignment : Text.AlignRight -// verticalAlignment : Text.AlignBottom - font.pointSize : Fonts.fontPixelButton - 4 - color : Colors.pressuresText + } + Text { + anchors { + bottom : parent.bottom + right : parent.right + rightMargin : Variables.defaultMargin * 2 + bottomMargin : Variables.defaultMargin } + text : 'Last Modified: ' + lastModifiedDate + width : parent.width + horizontalAlignment : Text.AlignRight + verticalAlignment : Text.AlignBottom + font.pointSize : Fonts.fontPixelButton - 4 + color : Colors.pressuresText } } -} +