Index: denali.pro =================================================================== diff -u -r84c5373209a1a488c00917995f5553d442d159a4 -race4047d1007962c136fa32d0531102e22073f32 --- denali.pro (.../denali.pro) (revision 84c5373209a1a488c00917995f5553d442d159a4) +++ denali.pro (.../denali.pro) (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -264,11 +264,8 @@ VER_MINOR="\\\"${minorVersion}\\\"" \ VER_MICRO="\\\"${microVersion}\\\"" \ VER_REVIS="\\\"${buildNumber}\\\"" \ - VER_MAJOR_DEV=\\\"0\\\" \ - VER_MINOR_DEV=\\\"0\\\" \ - VER_MICRO_DEV=\\\"0\\\" \ VER_REVIS_DEV=\\\"$$system( date "+%m%d%H%M" )\\\" \ - VER_APPLY=\\\"$$system( touch -m main.cpp )\\\" \ + VER_APPLY=\\\"$$system( touch -m main.cpp )\\\" \ VER_BRANCH=\\\"$$system( git rev-parse --abbrev-ref HEAD )\\\" CodeCoverage { Index: denali.pro.user =================================================================== diff -u -r84c5373209a1a488c00917995f5553d442d159a4 -race4047d1007962c136fa32d0531102e22073f32 --- denali.pro.user (.../denali.pro.user) (revision 84c5373209a1a488c00917995f5553d442d159a4) +++ denali.pro.user (.../denali.pro.user) (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -1,6 +1,6 @@ - + EnvironmentId @@ -89,7 +89,7 @@ Desktop Qt 5.12.5 GCC 64bit Desktop Qt 5.12.5 GCC 64bit qt.qt5.5125.gcc_64_kit - 1 + 0 0 0 @@ -1176,7 +1176,7 @@ false true - /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Release + /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug 1 @@ -1187,7 +1187,7 @@ Qt 5.12.5 (iMX8) Qt 5.12.5 (iMX8) {5d6458ef-f917-4aef-a092-c77bbe106149} - 1 + 0 0 0 Index: denali.qrc =================================================================== diff -u -r4df19fe88c454bd54abcdaf983be59464c5ef5bc -race4047d1007962c136fa32d0531102e22073f32 --- denali.qrc (.../denali.qrc) (revision 4df19fe88c454bd54abcdaf983be59464c5ef5bc) +++ denali.qrc (.../denali.qrc) (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -70,6 +70,7 @@ sources/gui/qml/components/ImageClock.qml sources/gui/qml/components/ImageLogoDDarkTransparent.qml sources/gui/qml/components/DebugDataColumn.qml + sources/gui/qml/components/RangeSlider.qml qtquickcontrols2.conf Index: main.cpp =================================================================== diff -u -r84c5373209a1a488c00917995f5553d442d159a4 -race4047d1007962c136fa32d0531102e22073f32 --- main.cpp (.../main.cpp) (revision 84c5373209a1a488c00917995f5553d442d159a4) +++ main.cpp (.../main.cpp) (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -193,42 +193,45 @@ } } } + /*! * \brief setApplicationVersion * \details sets up the application version regarding the environment variables * which are set by bamboo and if those are not set value of 0 will be used * and revision(build) version will be set to current date/time. */ void setApplicationVersion() { + bool ver_revis_empty = false; QString ver_major = QString("%1").arg(VER_MAJOR ); QString ver_minor = QString("%1").arg(VER_MINOR ); QString ver_micro = QString("%1").arg(VER_MICRO ); QString ver_revis = QString("%1").arg(VER_REVIS ); QString ver_branch = QString("%1").arg(VER_BRANCH ); - bool isOnMaster = !ver_branch.compare("master"); + if (ver_revis.isEmpty()) { ver_revis = VER_REVIS_DEV; + ver_revis_empty = true; + } + + const char * masterbranch = "master"; + bool isOnMaster = !ver_branch.compare(masterbranch); if (isOnMaster) { - ver_branch = ""; + ver_branch = ver_revis_empty ? masterbranch : ""; ver_major += '.'; ver_minor += '.'; ver_micro += '.'; - ver_revis += '.'; } else { ver_branch = VER_BRANCH ; - ver_branch += '.'; - ver_major = VER_MAJOR_DEV ; - ver_minor = VER_MINOR_DEV ; - ver_micro = VER_MICRO_DEV ; ver_revis = VER_REVIS_DEV ; } + if ( ! ver_branch.isEmpty()) ver_branch += '.'; QCoreApplication::setApplicationVersion( - QString("%1%2.%3.%4.%5") - .arg(ver_branch) - .arg(ver_major) - .arg(ver_minor) - .arg(ver_micro) - .arg(ver_revis)); + QString("%1%2%3%4%5") + .arg(ver_branch) + .arg(ver_major) + .arg(ver_minor) + .arg(ver_micro) + .arg(ver_revis)); } #ifdef UNIT_TEST Index: sources/gui/qml/components/RangeBar.qml =================================================================== diff -u -r56e378f7504701b9e9a9dccaf205aef2fd52c58e -race4047d1007962c136fa32d0531102e22073f32 --- sources/gui/qml/components/RangeBar.qml (.../RangeBar.qml) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) +++ sources/gui/qml/components/RangeBar.qml (.../RangeBar.qml) (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -35,13 +35,15 @@ property int markerHeight: Variables.rangeMarkerHeightMidle property color markerColor : Colors.rangeMarker + property bool markerVisible : true property int markerBoundHeight : Variables.rangeMarkerHeightShort property color markerBoundColor : Colors.rangeMarkerShort property bool minTextHorizontalCenter: true property bool maxTextHorizontalCenter: true RangeRect { id: _rangeRect + color: "red" x : ((parent.width * (lowerBound - parent.minimum)) / (parent.maximum - parent.minimum)) height : parent.height width : ((parent.width * (upperBound - lowerBound)) / (parent.maximum - parent.minimum)) @@ -74,6 +76,7 @@ } RangeMarker { id: _rangeMarkerValue + visible: _root.markerVisible decimal: _root.decimal value : parent.value x : ((parent.width * (parent.value - minimum)) / (maximum - minimum)) Index: sources/gui/qml/components/RangeSlider.qml =================================================================== diff -u --- sources/gui/qml/components/RangeSlider.qml (revision 0) +++ sources/gui/qml/components/RangeSlider.qml (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -0,0 +1,251 @@ +/*! + * + * Copyright (c) 2019-2020 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 Slider.qml + * \author (last) Behrouz NemaiPour + * \date (last) 04-Jun-2020 + * \author (original) Behrouz NematiPour + * \date (original) 18-Mar-2020 + * + */ + +// Qt +import QtQuick 2.12 + +// Project +// Qml imports +import "qrc:/globals" + +/*! + * \brief Denali project ProgressBar + */ +RangeRect { id: _root + enum HandlerOption { + None , + Min , + Max + } + + property alias minValue : _rangeRect.lowerBound + property alias maxValue : _rangeRect.upperBound + property int curValue : RangeSlider.HandlerOption.None + + property real step : 1 + property bool stepSnap : false + + property bool ticks : false + + property alias color : _rangeRect.color + property alias bgColor : _root.color + + property alias handler : _handlerRight + + + clip: false + height : Variables.progressbarHeight + touchMargin : 25 + + minimum : 0 + maximum : 0 + + // real-time bound change should effect the current set value + onMinimumChanged: { + if (minValue < minimum ) + minValue = minimum + if (maxValue < minimum ) + maxValue = minimum + } + onMaximumChanged: { + if (minValue < maximum ) + minValue = maximum + if (maxValue < maximum ) + maxValue = maximum + } + + minText { + visible : true + anchors.topMargin: Variables.sliderTextMargin + font.pixelSize : Fonts.fontPixelSliderMarker + font.bold : false + } + + maxText { + visible : true + anchors.topMargin: Variables.sliderTextMargin + font.pixelSize : Fonts.fontPixelSliderMarker + font.bold : false + } + + function getValueOfX(x) { + return ( x * ( maximum - minimum ) ) / width + minimum + } + + function _setValue_(x) { + if ( x < 0 ) { value = minimum; return; } + if ( x > width ) { value = maximum; return; } + + value = getValueOfX(x) + + if ( step === 1 ) { /* keep the value and return */ return; } + + var start = 0 + if ( ! stepSnap ) start = minimum + + value = Math.round((value - start) / step) * step + start + + if ( value < minimum ) { value = minimum; return; } + if ( value > maximum ) { value = maximum; return; } + } + + function setValue(x) { + var value = 0 + if ( x < 0 ) { value = minimum; return value; } + if ( x > width ) { value = maximum; return value; } + + value = getValueOfX(x) + + if ( step === 1 ) { return value; } + + var start = 0 + if ( ! stepSnap ) start = minimum + + value = Math.round((value - start) / step) * step + start + + if ( value < minimum ) { value = minimum; return value; } + if ( value > maximum ) { value = maximum; return value; } + return value; + } + + function setBound(x) { + var value = setValue(x) + + var minDiff = Math.abs(minValue - value) + var maxDiff = Math.abs(maxValue - value) + console.log(minDiff , minValue , value , maxValue , maxDiff , curValue) + if (minDiff === maxDiff) { + if (curValue === RangeSlider.HandlerOption.Max) { + maxValue = value + } + else { + curValue = RangeSlider.HandlerOption.Min + minValue = value + } + } + else { + if (minDiff < maxDiff) { + curValue = RangeSlider.HandlerOption.Min + minValue = value + } + else { + curValue = RangeSlider.HandlerOption.Max + maxValue = value + } + } + } + + RangeRect { id: _rangeRect + property int lowerBound : 0 + property int upperBound : 0 + + x : ((parent.width * (lowerBound - parent.minimum)) / (parent.maximum - parent.minimum)) + height : parent.height + width : ((parent.width * (upperBound - lowerBound)) / (parent.maximum - parent.minimum)) + + radius: 0 + decimal: _root.decimal + minimum: lowerBound + maximum: upperBound + + minText.visible: true + maxText.visible: true + + // propagation is not working on drag ! + // so it has to be implemented here as well + onDragged: { + setBound(vMouseEvent.x + _rangeRect.x) + } + onClicked: { + setBound(vMouseEvent.x + _rangeRect.x) + } + } + + // used loader for performance since it may not always be required. + // and can be a heavy Component + Loader { id: _ticksLoader + active : ticks + anchors.fill : parent + sourceComponent : TickMarks { + decimal : _root.decimal + minimum : _root.minimum + maximum : _root.maximum + step : _root.step + stepSnap : _root.stepSnap + textColor : _root.color + } + } + + onDragged: { + setBound(vMouseEvent.x) + } + onClicked: { + setBound(vMouseEvent.x) + } + + minText.text: qsTr("LOW") + Rectangle { id : minVEdge + visible: true + color: bgColor + anchors.right: _root.left + anchors.top: _root.top + anchors.topMargin: - (height/2 - _rangeRect.height/2) + width: 2 + height: 30 + } + + maxText.text: qsTr("HIGH") + Rectangle { id : maxVEdge + visible: true + color: bgColor + anchors.left: _root.right + anchors.top: _root.top + anchors.topMargin: - (height/2 - _rangeRect.height/2) + width: 2 + height: 30 + } + + Rectangle { id: _handlerLeft + property real diameter : Variables.progressbarHandler + + anchors.verticalCenter : parent.verticalCenter + anchors.horizontalCenter: _rangeRect.left + + width : diameter + height : diameter + radius : diameter + color : Colors.highlightProgressBar + border { + width: 4 + color: "white" + } + } + + Rectangle { id: _handlerRight + property real diameter : Variables.progressbarHandler + + anchors.verticalCenter : parent.verticalCenter + anchors.horizontalCenter: _rangeRect.right + + width : diameter + height : diameter + radius : diameter + color : Colors.highlightProgressBar + border { + width: 4 + color: "white" + } + } +} Index: sources/gui/qml/pages/treatment/TreatmentHome.qml =================================================================== diff -u -r56e378f7504701b9e9a9dccaf205aef2fd52c58e -race4047d1007962c136fa32d0531102e22073f32 --- sources/gui/qml/pages/treatment/TreatmentHome.qml (.../TreatmentHome.qml) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) +++ sources/gui/qml/pages/treatment/TreatmentHome.qml (.../TreatmentHome.qml) (revision ace4047d1007962c136fa32d0531102e22073f32) @@ -42,17 +42,34 @@ spacing: Variables.columnSpacing anchors.centerIn: parent TitleText { id: _titleText + anchors.horizontalCenter: parent.horizontalCenter width: parent.width text: qsTr("Good Morning") } TouchRect { id : _startTreatmentRect + anchors.horizontalCenter: parent.horizontalCenter text.text: qsTr("START TREATMENT") button.onClicked: treatmentStarted() } TouchRect { id : _createTreatmentRect + anchors.horizontalCenter: parent.horizontalCenter text.text: qsTr("CREATE TREATMENT") button.onClicked: treatmentCreated() } + + RangeSlider { id : _testSlider + anchors.horizontalCenter: parent.horizontalCenter + bgColor : "Red" + width : 600 + height : 5 + minValue: 200 + maxValue: 300 + minimum : Variables.bloodFlowMin + maximum : Variables.bloodFlowMax + unit : Variables.unitTextFlowRate + step : Variables.bloodFlowResolution + ticks : true + } } onVisibleChanged: {