Index: sources/gui/qml/pages/settings/SettingsDateTime.qml =================================================================== diff -u -ra5760947d3ed0d2748ba023a1c25e3c6aa0b1de1 -r6e18f1d24b8cc3d84d26f46f36f73deb34e54371 --- sources/gui/qml/pages/settings/SettingsDateTime.qml (.../SettingsDateTime.qml) (revision a5760947d3ed0d2748ba023a1c25e3c6aa0b1de1) +++ sources/gui/qml/pages/settings/SettingsDateTime.qml (.../SettingsDateTime.qml) (revision 6e18f1d24b8cc3d84d26f46f36f73deb34e54371) @@ -22,6 +22,7 @@ // Qml imports import "qrc:/globals" import "qrc:/components" +import "qrc:/compounds" /*! * \brief SettingsDateTimeSet is used to adjust the @@ -40,115 +41,169 @@ _hours .textInput.acceptableInput && _minutes.textInput.acceptableInput + readonly property color entryTextColor : _ntpSwitch.checked ? Colors.borderDisableButton : Colors.textMain + confirmEnabled : isValid - firstFocusInput : _hours notificationText: vDateTime.status onConfirmClicked: { - vDateTime.doConfirm( + vDevice.doDateTime( _year .textInput.text , _month .textInput.text , _day .textInput.text , _hours .textInput.text , - _minutes.textInput.text ) + _minutes.textInput.text , + _ntpSwitch.checked ) } onVisibleChanged: { // it seems entering in the TextInput by keyboard breaks the binding + refreshDateTime() + } + + function refreshDateTime() { _year .textInput.text = vDateTime.year _month .textInput.text = vDateTime.month _day .textInput.text = vDateTime.day _hours .textInput.text = vDateTime.hour _minutes.textInput.text = vDateTime.minute } - Column { id: _container - spacing: 70 - y : Qt.inputMethod.visible && _keyboard.visible ? topMarginContent : ( (_root.height - _container.height) / 2 ) - Behavior on y { NumberAnimation { duration: Variables.keybardAnimationDuration } } - anchors.horizontalCenter: parent.horizontalCenter + Connections { target: vDevice + // ... WILL BE UPDATE IN LDT-2909 + // send fw date/time after succesfully settings it in shell script + function onDateTimeChanged ( vValue ) { vDateTime.doConfirm( + _year .textInput.text , + _month .textInput.text , + _day .textInput.text , + _hours .textInput.text , + _minutes.textInput.text , + _ntpSwitch.checked ) } + } - Row { // time - spacing: 5 - Text { id: _timeLabel - width: labelWidth - text: qsTr("Time (HH:MM)") - color: Colors.textMain - font.pixelSize: Fonts.fontPixelTextRectExtra + Connections { target: vDateTime + function onDidRefreshUIFields ( ) { refreshDateTime() } + + } + + contentItem: Column { id: _container + spacing : 25 + + LabelUnitContainer { id: _ntpSettings + anchors.horizontalCenter : parent.horizontalCenter + width : Variables.adjustmentLabelUnitContainerWidth + height : Variables.adjustmentLabelUnitContainerHeight + unitText : qsTr("Network Time Protocol") + text : qsTr("NTP") + contentArea.anchors.leftMargin : width * 0.75 + + contentItem: BaseSwitch { id: _ntpSwitch + checked : vDateTime.ntp } + } - TextEntry { id : _hours - nextInput : _minutes - label.visible : false - width : entryWidth - validator : IntValidator { - bottom : 0 - top : 23 + LabelUnitContainer { id: _timeContainer + anchors.horizontalCenter : parent.horizontalCenter + width : Variables.adjustmentLabelUnitContainerWidth + height : Variables.adjustmentLabelUnitContainerHeight + text : qsTr("Time") + unitText : vDateTime.timeFormat + enabled : ! _ntpSwitch.checked + + contentItem: Row { // time + anchors.centerIn: parent + + TextEntry { id: _hours + nextInput : _minutes + line.visible : false + width : entryWidth + showPlaceHolderText : true + showDisabledColor : true + validator : IntValidator { + bottom : 0 + top : 23 + } + textInput.font.pixelSize: Fonts.fontPixelValueControl } - } - Text { id : _colon - text : qsTr(":") - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - } + Label { + text : qsTr(":") + color : _root.entryTextColor + width : 10 + } - TextEntry { id : _minutes - nextInput : _month - label.visible : false - width : entryWidth - validator : IntValidator { - bottom : 0 - top : 59 + TextEntry { id: _minutes + nextInput : _month + line.visible : false + width : entryWidth + showPlaceHolderText : true + showDisabledColor : true + validator : IntValidator { + bottom : 0 + top : 59 + } + textInput.font.pixelSize: Fonts.fontPixelValueControl } } } - Row { // date - spacing: 5 - Text { id : _dateLabel - width : labelWidth - text : qsTr("Date (MM/DD/YYYY)") - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - } + LabelUnitContainer { id: _dateContainer + anchors.horizontalCenter : parent.horizontalCenter + width : Variables.adjustmentLabelUnitContainerWidth + height : Variables.adjustmentLabelUnitContainerHeight + text : qsTr("Date") + unitText : vDateTime.dateFormat + enabled : ! _ntpSwitch.checked - TextEntry { id : _month - nextInput : _day - label.visible : false - width : entryWidth - validator : IntValidator { - bottom : 1 - top : 12 + contentItem: Row { // time + anchors.centerIn: parent + + TextEntry { id: _month + nextInput : _day + line.visible : false + width : entryWidth + showPlaceHolderText : true + showDisabledColor : true + validator : IntValidator { + bottom : 1 + top : 12 + } + textInput.font.pixelSize: Fonts.fontPixelValueControl } - } - Text { id : _slashMonthDay - text : qsTr("/") - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - } + Label { id : _slashMonthDay + text : qsTr("/") + color : _root.entryTextColor + width : 5 + } - TextEntry { id : _day - nextInput : _year - label.visible : false - width : entryWidth - validator : IntValidator { - bottom : 1 - top : 31 + TextEntry { id: _day + nextInput : _year + line.visible : false + width : entryWidth + showPlaceHolderText : true + showDisabledColor : true + validator : IntValidator { + bottom : 1 + top : 31 + } + textInput.font.pixelSize: Fonts.fontPixelValueControl } - } - Text { id : _slashDayYear - text : qsTr("/") - color : Colors.textMain - font.pixelSize : Fonts.fontPixelTextRectExtra - } + Label { id : _slashDayYear + text : qsTr("/") + color : _root.entryTextColor + width : 5 + } - TextEntry { id : _year - label.visible : false - width : entryWidth - validator : IntValidator { - bottom : 1970 - top : 2100 // seems date command is not accepting more than 2100 + TextEntry { id: _year + line.visible : false + width : entryWidth + showPlaceHolderText : true + showDisabledColor : true + validator : IntValidator { + bottom : 1970 + top : 2100 // seems date command is not accepting more than 2100 + } + textInput.font.pixelSize: Fonts.fontPixelValueControl } } }