Index: denali.qrc =================================================================== diff -u -re877264500f302b568157f772e465b0bfc1991c4 -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- denali.qrc (.../denali.qrc) (revision e877264500f302b568157f772e465b0bfc1991c4) +++ denali.qrc (.../denali.qrc) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -114,6 +114,7 @@ sources/gui/qml/components/TimeEntry.qml sources/gui/qml/components/Label.qml sources/gui/qml/components/EntryDialog.qml + sources/gui/qml/components/CircleButton.qml sources/gui/qml/compounds/PressureRangeSlider.qml Index: sources/gui/qml/components/CircleButton.qml =================================================================== diff -u --- sources/gui/qml/components/CircleButton.qml (revision 0) +++ sources/gui/qml/components/CircleButton.qml (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -0,0 +1,62 @@ +/*! + * + * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file CircleButton.qml + * \author (last) Vy Duong + * \date (last) 11-Mar-2023 + * \author (original) Vy Duong + * \date (original) 11-Mar-2023 + * + */ + +// Qt +import QtQuick 2.12 + +// Project +// Qml imports +import "qrc:/globals" + +Item{ id: _circleButtonRoot + property alias buttonDiameter : _buttonBody.height + property alias buttonSymbol : _buttonText.text + property int touchAreaMargin : 10 + property color pressedButtonColor : Colors.circleButtonDefaultPressed + property color unpressedButtonColor : Colors.transparent + + signal pressed(var vMouseEvent) + signal released(var vMouseEvent) + signal pressAndHold(var vMouseEvent) + + height: _buttonBody.height + (touchAreaMargin * 2) + width : height + + Rectangle{ id: _buttonBody + height : Variables.circleButtonDefaultDiameter + width : height + radius : height + color : _circleButtonMouseArea.pressed ? pressedButtonColor : unpressedButtonColor + border { + width: Variables.circleButtonDefaultBorderWidth + color: Colors.textMain + } + Text { id: _buttonText + text : "=" + color : Colors.textMain + font.pixelSize : Fonts.fontPixelCircleButtonLabel + font.bold : false + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom : parent.bottom + } + } + + MouseArea { id: _circleButtonMouseArea + anchors.fill: parent + onPressAndHold : _circleButtonRoot.pressAndHold(mouse) + onPressed : _circleButtonRoot.pressed(mouse) + onReleased : _circleButtonRoot.released(mouse) + } +} Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -raf8d98b36b427e2b5f4d6659fcf3b58ee79eab6a -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision af8d98b36b427e2b5f4d6659fcf3b58ee79eab6a) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -51,6 +51,39 @@ signal progressRectDragged() signal activeChanged() + function incrementValue (vInStepSegments) { + // in case the slider is not yet activated, activate + if (!isActive) { + setActive(true) + } + updateValue(vInStepSegments, true) + } + + function decrementValue (vInStepSegments) { + // in case the slider is not yet activated, activate + if (!isActive) { + setActive(true) + } + updateValue(vInStepSegments, false) + } + + function updateValue(vInStepSegments, vIsIncrement) { + let amountChanged = 1 + if (vInStepSegments) { + amountChanged = step + } + let newValue = Number.NaN + if(vIsIncrement) + newValue = _root.value + amountChanged + else + newValue = _root.value - amountChanged + + // Calculate the x position of the new value + let divisor = (maximum != minimum) ? (maximum - minimum) : 1 + let calculatedX = ((newValue - minimum) * _root.width) / divisor + setValue(calculatedX) + } + function setActive(active) { if (active) { color = Colors.createTreatmentActive Index: sources/gui/qml/components/SliderCreateTreatment.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/components/SliderCreateTreatment.qml (.../SliderCreateTreatment.qml) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -42,12 +42,15 @@ property bool active : false property bool valid : true + property bool showAdjustButtons : true + property real adjustButtonDiameter : Variables.sliderAdjustButtonDiameter + signal pressed () signal released() height : Variables.createTreatmentSliderHeight width : Variables.createTreatmentSliderWidth - color : "transparent" + color : Colors.transparent anchors.horizontalCenter: parent.horizontalCenter @@ -124,4 +127,50 @@ onProgressRectClicked : { ; ; setActiveValid( ) } onProgressRectDragged : { ; ; setActiveValid( ) } } + + Row { id: _adjustValueButtonsContainer + width : 200 + height : parent.height + anchors.verticalCenter : _slider.verticalCenter + anchors.left : _slider.right + anchors.leftMargin : Variables.sliderAdjustButtonSpacing + spacing : Variables.sliderAdjustButtonSpacing + CircleButton { id: _decrementValueButton + buttonSymbol: "<" + onPressed: _slider.decrementValue(true) + onPressAndHold: { + _sliderAdjustValueTimer.isIncrementing = false + _sliderAdjustValueTimer.restart() + } + onReleased: _sliderAdjustValueTimer.stop() + } + CircleButton { id: _incrementValueButton + buttonSymbol: ">" + onPressed: _slider.incrementValue(true) + onPressAndHold: { + _sliderAdjustValueTimer.isIncrementing = true + _sliderAdjustValueTimer.restart() + } + onReleased: _sliderAdjustValueTimer.stop() + } + } + Timer { id: _sliderAdjustValueTimer + property bool isIncrementing : true + interval: 250 //ms + running : false + repeat : true + onTriggered: { + if(isIncrementing) + _slider.incrementValue(true) + else + _slider.decrementValue(true) + + // for optimizing purposes, stop timer when max or min value reached + if ((_root.value == maximum) || (_root.value == minimum)) { + _sliderAdjustValueTimer.stop() + } + + //DEBUG console.log("timer triggered " + _root.value) + } + } } Index: sources/gui/qml/globals/Colors.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/globals/Colors.qml (.../Colors.qml) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -119,6 +119,8 @@ readonly property color createTreatmentTextReady : white readonly property color createTreatmentInvalidParam : red + readonly property color circleButtonDefaultPressed : "#3d8eef" + // ---------- < PRS > Related Section ---------- // Alarm priority colors function alarmPriorityColors(vPriority) { Index: sources/gui/qml/globals/Fonts.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/globals/Fonts.qml (.../Fonts.qml) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -81,4 +81,6 @@ readonly property int fontPixelCreateTreatment : 30 readonly property int fontPixelCreateTreatmentTable : 24 + + readonly property int fontPixelCircleButtonLabel: 50 } Index: sources/gui/qml/globals/Variables.qml =================================================================== diff -u -ra6586ea871f21a08e7d50552983360fb5e344b3a -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision a6586ea871f21a08e7d50552983360fb5e344b3a) +++ sources/gui/qml/globals/Variables.qml (.../Variables.qml) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -167,7 +167,14 @@ readonly property int screenGridRow1LineY : 275 readonly property int screenGridRow2LineY : 525 + readonly property int sliderAdjustButtonBorderWidth : 2 + readonly property int sliderAdjustButtonSpacing : 20 + readonly property int sliderAdjustButtonDiameter : 50 + readonly property int circleButtonDefaultDiameter : 50 + readonly property int circleButtonDefaultBorderWidth : 2 + + // ---------- < PRS > Related Section ---------- // blood flow rate readonly property int bloodFlowMin : 100 // PRS 30