Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml =================================================================== diff -u -ra5760947d3ed0d2748ba023a1c25e3c6aa0b1de1 -rd5e9940fa96373f6cc118dfa9761d95f361689a5 --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml (.../TreatmentAdjustmentDuration.qml) (revision a5760947d3ed0d2748ba023a1c25e3c6aa0b1de1) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml (.../TreatmentAdjustmentDuration.qml) (revision d5e9940fa96373f6cc118dfa9761d95f361689a5) @@ -15,6 +15,7 @@ // Qt import QtQuick 2.12 +import QtQuick.Controls 2.12 // StackView // Project @@ -27,78 +28,57 @@ * To adjust the treatment duration */ TreatmentAdjustmentBase { id: _root - contentItem.objectName: "TreatmentAdjustmentDuration" //SquishQt testability + objectName: "_TreatmentAdjustmentDuration" // SquishQt testability - readonly property real durationValue : _durationSlider.value - readonly property alias durationMinimum : _durationSlider.minimum - readonly property alias durationMaximum : _durationSlider.maximum - readonly property alias durationStep : _durationSlider.step + closeVisible : true + confirmVisible : false + backVisible : _treatmentDurationStack.stackView.depth > 1 - readonly property alias currentTime : _currentTimeText.seconds - readonly property alias durationTime : _durationText.seconds + onAboutToShow : { _treatmentDurationStack.reset() } + onClosed : { _treatmentDurationStack.reset() } + onBackClicked : { _treatmentDurationStack.pop() } - property int textWidth : 200 + StackItem { id: _treatmentDurationStack + objectName : "_treatmentDurationStack" + anchors { + top: parent.top + bottom: notification.top + left: parent.left + right: parent.right + } + visible : true + stackView { + initialItem : _treatmentAdjustmentDurationEdit + popEnter : null + popExit : null + pushEnter : null + pushExit : null + } - // Due to how the slider is set up, a setter function is needed to set the slider value - function setDurationValue(value) { - _durationSlider.reset(value) - } + TreatmentAdjustmentDurationEdit { id: _treatmentAdjustmentDurationEdit + objectName: "_treatmentAdjustmentDurationEdit" + visible: false - titleText: qsTr("TREATMENT DURATION") + StackView.onActivating : { + _root.titleText = qsTr("Edit Treatment Duration") + _root.notificationText = "" + } - Item { id : _container - readonly property int sideMarginSize: Variables.headerButtonsMargin + Variables.confirmButtonWidth/2 - _durationSliderArrows.width/2 // Centers on the confirmButton - width : _root.width - height : 200 - anchors.centerIn: parent - - TimeText { id: _currentTimeText - seconds: vTreatmentTime.time_Elapsed - secondsVisible: true - textPixelSize: Fonts.fontPixelDurationCurTime - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: _container.top - anchors.bottom: _durationSlider.top - anchors.bottomMargin: 65 + onContinueClicked : function(vDuration) { + // send duration to TD and wait. + // if accepted moves to confirm screen, otherwise show error in notification + // vTreatmentAdjustmentDurationEdit.doAdjustment(vDuration) + } } - Slider { id : _durationSlider - // The distance from parent's right side to the rightmost of slider - with slider arrows and spacings considered - readonly property int sliderAndArrowSpacing : Variables.sliderAdjustButtonSpacing + _durationSlider.handler.width/2 - readonly property int distanceFromSide : _durationSlider.sliderAndArrowSpacing + _durationSliderArrows.width + _container.sideMarginSize - width : _container.width - (distanceFromSide * 2) // determine the size of slider to center - minimum : vTreatmentRanges.treatmentRanges_Duration_Min // in Minutes - maximum : vTreatmentRanges.treatmentRanges_Duration_Max // in Minutes - step : Variables.durationResolution - stepSnap : true - minText.visible : false - maxText.visible : false - ticks : true - anchors.right : _durationSliderArrows.left - anchors.rightMargin : _durationSlider.sliderAndArrowSpacing - anchors.bottom : _container.bottom + TreatmentAdjustmentDurationConfirm { id: _treatmentAdjustmentDurationConfirm + objectName: "_treatmentAdjustmentDurationConfirm" + visible: false - TimeText { id: _durationText - seconds: 60 * _durationSlider.value // in Minutes => to Seconds - secondsVisible: false - textPixelSize: Fonts.fontPixelDurationAdjTime - textWeight: Font.Medium - anchors { - top : _durationSlider.handler.bottom - topMargin : 10 - horizontalCenter: _durationSlider.handler.horizontalCenter - } + StackView.onActivating : { + _root.titleText = qsTr("Confirm Treatment Duration") + _root.notificationText = "" } } - SliderArrows{ id: _durationSliderArrows - visible : true - anchors.verticalCenter : _durationSlider.verticalCenter - anchors.right : _container.right - anchors.rightMargin : _container.sideMarginSize - - onIncrementValue : _durationSlider.incrementValue(true) - onDecrementValue : _durationSlider.decrementValue(true) - } } - }