Index: sources/gui/qml/compounds/CheckListView.qml =================================================================== diff -u -rc6cfb5043fc9c29cc039e36915368bcd3a63baa6 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/compounds/CheckListView.qml (.../CheckListView.qml) (revision c6cfb5043fc9c29cc039e36915368bcd3a63baa6) +++ sources/gui/qml/compounds/CheckListView.qml (.../CheckListView.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2024 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 CheckListView.qml * \author (last) Behrouz NematiPour - * \date (last) 15-Mar-2021 + * \date (last) 01-Aug-2023 * \author (original) Behrouz NematiPour - * \date (original) 15-Mar-2021 + * \date (original) 16-Mar-2021 * */ @@ -35,6 +35,9 @@ property int delegateWidth : Variables.checkListViewItemWidth property int delegateHeight : Variables.checkListViewItemHeight + property bool timeVisible : false + property int timeSeconds : 0 + function resetItems() { if ( visible ) { for (let i = 0; i < _listView.count; i++) { @@ -44,19 +47,86 @@ } } } - function setItem(vIndex, vEntered) { - let model = _listView.itemAt(vIndex) - if ( vEntered ) model.stepStart = true - else model.stepDone = true + + property int pIndex:-1 + function setClear (vModel) { vModel.stepStart = false ; vModel.stepDone = false } + function setWait (vModel) { vModel.stepStart = true ; vModel.stepDone = false } + function setDone (vModel) { vModel.stepStart = true ; vModel.stepDone = true } + function setItemExt (vIndex, vEntered) { + let goBak = pIndex > vIndex + let goTop = pIndex < vIndex + // if ( pIndex === vIndex && !vEntered ) return + + for ( let i = 0; i < _listView.count; i++ ) { + let model = _listView.itemAt(i) + //DEBUG console.log(i, pIndex, vEntered?"I":"O", vIndex/*, goBak?"B":" ", goTop?"T":" "*/) + if ( i < vIndex ) { + if ( goTop ) { + // Do nothing + } + else { + // setDone(model) + } + } + if ( i > vIndex ) { + setClear(model) + } + if ( i === vIndex ) { + if ( vEntered ) { + setWait(model) + } + else { + if ( goTop ) { + setClear(model) + } + else { + if ( goBak ) { + setClear(model) + } + else { + setDone(model) + } + } + } + } + } + pIndex = vIndex + //DEBUG console.log("-----") } + //DEBUG Test function for investigation + function setItemExt2 (vIndex, vValue, vMode) { + for ( let i = 0; i < _listView.count; i++ ) { + let model = _listView.itemAt(i) + if ( i < vIndex ) { + setDone(model) + continue + } + if ( i > vIndex ) { + setClear(model) + continue + } + if ( vMode === 0 ) // enter + setWait(model) + if ( vMode === 1 ) // in Progress + setWait(model) + if ( vMode === 2 ) // exit + setDone(model) + if ( vMode === 9 ){// depending on value + if ( vValue ) setWait(model) + else setDone(model) + } + + } + + } + width : _root.delegateWidth height : _root.delegateHeight * _root.stepNames.length Column { anchors.centerIn: _root Repeater { id: _listView - model : _root.stepNames delegate: Item { id: _delegate property bool stepStart : false @@ -72,7 +142,7 @@ color : Colors.textMain font.pixelSize: Fonts.fontPixelStateListText } - Line { + Line { id: _separatorLine length : _delegate.width + 2 * linePad thickness : 2 anchors { @@ -88,6 +158,15 @@ visible : _delegate.stepStart done : _delegate.stepDone } + TimeText { id: _timeText + anchors.verticalCenter : _stepText.verticalCenter + anchors.left : _separatorLine.right + anchors.leftMargin : Variables.minVGap + seconds : _root.timeSeconds * 60 + secondsVisible : false + textPixelSize : Fonts.fontPixelStateListText + visible : _root.timeVisible && _delegate.stepStart && ! _delegate.stepDone + } } } }