Index: sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml =================================================================== diff -u -r627b97843f87f5ca8fbd731c6c4a6d9fae4352ce -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml (.../SettingsVolumeBrightness.qml) (revision 627b97843f87f5ca8fbd731c6c4a6d9fae4352ce) +++ sources/gui/qml/pages/settings/SettingsVolumeBrightness.qml (.../SettingsVolumeBrightness.qml) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2021-2022 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-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 SettingsVolumeBrightness.qml - * \author (last) Behrouz NematiPour - * \date (last) 07-Jun-2021 + * \author (last) Vy + * \date (last) 13-Apr-2023 * \author (original) Behrouz NematiPour * \date (original) 06-Jun-2021 * @@ -27,7 +27,9 @@ * \brief SettingsVolumeBrightness is used to adjust the * volume (alarm/system), brightness on the device */ -SettingsBase { id: _root +SettingsBase { id: _root + itemIndex : SettingsStack.VolumeBrightness + readonly property int spacing: 50 confirmVisible : false @@ -49,18 +51,17 @@ Slider { id : _brightness anchors.verticalCenter: parent.verticalCenter width : 500 - step : 20 // no zero - minimum : 20 // 1 - maximum : 100 // 10 - height : 5 + step : 1 // no zero + minimum : 1 + maximum : 5 ticks : true - unit : qsTr("%") + unit : "" onReleased : vDevice.brightness = _brightness.value Connections { target: vDevice // in case the value is rejecte it will be set to the previous value // also the init value shall be set when navigate to the screen - onBrightnessChanged : _brightness.value = vbrightness - onStatusChanged : _root.notificationText = vstatus + function onBrightnessChanged ( vValue ) { _brightness.reset(vValue) } + function onStatusChanged ( vValue ) { _root.notificationText = vValue } } } Label { @@ -79,44 +80,28 @@ text: qsTr("Alarm Volume") } Slider { id : _alarmVolume - property bool postInit: true anchors.verticalCenter: parent.verticalCenter width : 500 - step : 20 // no zero - minimum : 20 // 1 - maximum : 100 // 5 - height : 5 + step : 1 // no zero + minimum : 1 + maximum : 5 ticks : true - unit : qsTr("%") + unit : "" onReleased : { vAdjustmentAlarmVolume.doAdjustment( _alarmVolume.value ) } - Connections { target: vSettings - onAlarmVolumeChanged: { - if ( _alarmVolume.postInit ) { - vAdjustmentAlarmVolume.doAdjustment( vSettings.alarmVolume ) - } - _alarmVolume.postInit = false - _alarmVolume.value = vSettings.alarmVolume - } - } Connections { target: vAdjustmentAlarmVolume - // in case the value is rejecte it will be set to the previous value - // also the init value shall be set when navigate to the screen - onAdjustmentTriggered : { - _alarmVolume.postInit = false + function onAdjustmentTriggered ( vValue ) { if ( vAdjustmentAlarmVolume.adjustment_Accepted ) { - vSettings.alarmVolume = vAdjustmentAlarmVolume.hdAlarmVolume + vSettings .alarmVolume = vAdjustmentAlarmVolume.hdAlarmVolume _root.notificationText = "" } else { _root.notificationText = vAdjustmentAlarmVolume.adjustment_ReasonText } + // regardless of the rejection or acceptance the value will be sent from C++ to be adjusted. + _alarmVolume.reset ( vAdjustmentAlarmVolume.hdAlarmVolume ) } - onHdAlarmVolumeChanged : { - _alarmVolume.postInit = false - _alarmVolume.value = vAdjustmentAlarmVolume.hdAlarmVolume - } } } Label { @@ -141,7 +126,6 @@ step : 20 // no zero minimum : 20 // 1 maximum : 100 // 5 - height : 5 ticks : true unit : qsTr("%") }