Index: sources/gui/qml/components/TimeText.qml =================================================================== diff -u -r34471900489397f483e052870ddc46059cef49fb -rd364178ab42a711fa1e0a41f05c61aa4b4489de0 --- sources/gui/qml/components/TimeText.qml (.../TimeText.qml) (revision 34471900489397f483e052870ddc46059cef49fb) +++ sources/gui/qml/components/TimeText.qml (.../TimeText.qml) (revision d364178ab42a711fa1e0a41f05c61aa4b4489de0) @@ -23,62 +23,79 @@ /*! * \brief Time Text Component converts seconds into hour:minute.second */ -Item { id: _root +Rectangle { id: _root + objectName: "_TimeText" //SquishQt testability property int seconds : 0 property bool secondsVisible : true - property color color : "white" + property color textColor : "white" property int textPixelSize : 90 property int textWeight : Font.ExtraLight property int secsPixelSize : 16 - width : _timeHour.contentWidth + _timeSeparator.contentWidth + _timeMinute.contentWidth + readonly property string time : _private.time + + color : "transparent" + width : _hourText.contentWidth + _timeSeparator.contentWidth + _minuteText.contentWidth height: _timeSeparator.height QtObject { id: _private - property int hour : Math.floor( seconds / 3600 ) - property int minute : Math.floor((seconds % 3600) / 60); - property int second : seconds % 60 + property int hour : Math.floor( seconds / 3600 ) + property int minute : Math.floor((seconds % 3600) / 60) + property int second : seconds % 60 + + property string separator : ":" + property string hourText : (hour < 10 ? "0" + hour : hour ) + property string minuteText : (minute < 10 ? "0" + minute : minute) + property string secondText : (second < 10 ? "0" + second : second) + + property string time : hourText + separator + minuteText + (_root.secondsVisible ? (separator + secondText) : "") } Text { id: _timeSeparator - text: ":" + objectName: "_TimeText_timeSeparator" //SquishQt testability + text: _private.separator + font.pixelSize: _root.textPixelSize font.weight: _root.textWeight - color: _root.color + color: _root.textColor anchors.centerIn: _root } - Text { id: _timeHour - property alias hour: _private.hour + Text { id: _hourText + objectName: "_TimeText_hour" //SquishQt testability + + text: _private.hourText font.pixelSize: _root.textPixelSize font.weight: _root.textWeight - color: _root.color + color: _root.textColor horizontalAlignment: Text.AlignRight anchors.right : _timeSeparator.left anchors.baseline: _timeSeparator.baseline - text: (hour < 10 ? "0"+hour : hour) } - Text { id: _timeMinute - property alias minute: _private.minute - text: (minute < 10 ? "0" + minute : minute) + Text { id: _minuteText + objectName: "_TimeText_minute" //SquishQt testability + + text: _private.minuteText font.pixelSize: _root.textPixelSize font.weight: _root.textWeight - color: _root.color + color: _root.textColor horizontalAlignment: Text.AlignLeft anchors.left: _timeSeparator.right anchors.baseline: _timeSeparator.baseline } - Text { id: _timeSecond - property alias second: _private.second + Text { id: _secondText + objectName: "_TimeText_second" //SquishQt testability + visible: _root.secondsVisible - text: (second < 10 ? "0" + second : second) + + text: _private.secondText font.pixelSize: _root.secsPixelSize - color: _root.color + color: _root.textColor horizontalAlignment: Text.AlignLeft - anchors.left: _timeMinute.right + anchors.left: _minuteText.right anchors.baseline: _timeSeparator.baseline } }