Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml =================================================================== diff -u -r8f71000a841da5e8f18efccbb30a7655d3a211cd -r124c2e38e72a1a655d9d479c9c7a1cd8c5d5e6c4 --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml (.../TreatmentAdjustmentDuration.qml) (revision 8f71000a841da5e8f18efccbb30a7655d3a211cd) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentDuration.qml (.../TreatmentAdjustmentDuration.qml) (revision 124c2e38e72a1a655d9d479c9c7a1cd8c5d5e6c4) @@ -1,14 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. - * \copyright \n - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n - * IN PART OR IN WHOLE, \n - * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * Copyright (c) 2020-2025 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 TreatmentAdjustmentDuration.qml - * \date 2020/04/26 - * \author Behrouz NematiPour + * \author (last) Vy + * \date (last) 11-May-2023 + * \author (original) Behrouz NematiPour + * \date (original) 27-Apr-2020 * */ @@ -28,7 +29,7 @@ TreatmentAdjustmentBase { id: _root contentItem.objectName: "TreatmentAdjustmentDuration" //SquishQt testability - /* -- */ property alias durationValue : _durationSlider.value + readonly property real durationValue : _durationSlider.value readonly property alias durationMinimum : _durationSlider.minimum readonly property alias durationMaximum : _durationSlider.maximum readonly property alias durationStep : _durationSlider.step @@ -38,28 +39,45 @@ property int textWidth : 200 + // Due to how the slider is set up, a setter function is needed to set the slider value + function setDurationValue(value) { + _durationSlider.reset(value) + } + titleText: qsTr("TREATMENT DURATION") - Column { id : _column - spacing: 65 + 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 } Slider { id : _durationSlider - anchors.horizontalCenter: parent.horizontalCenter - width : 880 - height : 5 + // 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 + stepSnap : true + minText.visible : false + maxText.visible : false + ticks : true + + anchors.right : _durationSliderArrows.left + anchors.rightMargin : _durationSlider.sliderAndArrowSpacing + anchors.bottom : _container.bottom + TimeText { id: _durationText seconds: 60 * _durationSlider.value // in Minutes => to Seconds secondsVisible: false @@ -72,5 +90,15 @@ } } } + 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) + } } + }