A system of translations into different languages has been implemented. Added translations into Russian. Various UI fixes for valid internationalization

This commit is contained in:
Yury Shuvakin
2022-08-28 11:33:56 +03:00
parent 2a960893d0
commit 4a0f78c247
39 changed files with 3365 additions and 357 deletions

View File

@@ -0,0 +1,57 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import Utils 1.0
BusyIndicator {
id: control
running: true
implicitWidth: 86
implicitHeight: 86
contentItem: Item {
id: item
width: parent.width
height: parent.height
opacity: control.running ? 1 : 0
Behavior on opacity {
OpacityAnimator {
duration: 250
}
}
RotationAnimator {
target: item
running: control.visible && control.running
from: 0
to: 360
loops: Animation.Infinite
duration: 5000
}
Repeater {
id: repeater
model: 6
Rectangle {
x: item.width / 2 - width / 2
y: item.height / 2 - height / 2
implicitWidth: 12
implicitHeight: 12
radius: 6
color: Palette.alternativeBackgroundColor
transform: [
Translate {
y: -Math.min(item.width, item.height) * 0.5 + 6
},
Rotation {
angle: index / repeater.count * 360
origin.x: 6
origin.y: 6
}
]
}
}
}
}

View File

@@ -15,6 +15,8 @@ Button {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
maximumLineCount: 2
wrapMode: Text.Wrap
}
background: Rectangle {

View File

@@ -1,5 +0,0 @@
import QtQuick 2.0
Item {
}

View File

@@ -5,13 +5,15 @@ import Utils 1.0
Shape {
id: shape
implicitWidth: 1
implicitHeight: 1
property bool horizontal: true
ShapePath {
strokeColor: Palette.borderColor
strokeStyle: ShapePath.SolidLine
startX: 0
startY: 0
PathLine { x: shape.width; y: 0 }
PathLine { x: horizontal ? shape.width : 0; y: horizontal ? 0 : shape.height }
}
}

View File

@@ -0,0 +1,59 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import Utils 1.0
ItemDelegate {
id: control
implicitHeight: 52
padding: 0
leftPadding: control.minimized ? 0 : 40
font.weight: Font.Bold
icon.color: "transparent"
icon.width: 24
icon.height: 24
property bool minimized: false
contentItem: RowLayout {
spacing: control.minimized ? 0 : 25
Item {
visible: control.minimized
Layout.fillWidth: true
}
Image {
source: control.icon.source
sourceSize.width: control.icon.width
sourceSize.height: control.icon.height
Layout.alignment: Qt.AlignCenter
ColorOverlay {
anchors.fill: parent
source: parent
color: icon.color
visible: icon.color !== "transparent"
}
}
Label {
text: control.text
font: control.font
color: Palette.alternativeTextColor
visible: !control.minimized
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
}
Item {
Layout.fillWidth: true
}
}
background: Rectangle {
color: control.pressed ? Palette.pressedButtonColor :
control.hovered ? Palette.hoveredButtonColor : Palette.buttonColor
}
}

View File

@@ -15,6 +15,8 @@ Button {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
maximumLineCount: 2
wrapMode: Text.Wrap
}
background: Rectangle {

View File

@@ -1,5 +0,0 @@
import QtQuick 2.0
Item {
}

View File

@@ -6,6 +6,6 @@ import Utils 1.0
TextArea {
color: Palette.textColor
selectByMouse: true
selectionColor: Palette.alternativeBackgroundColor
selectionColor: Palette.selectedTextBackgroundColor
font.pixelSize: 16
}

View File

@@ -7,7 +7,7 @@ TextField {
implicitHeight: 58
color: Palette.textColor
selectByMouse: true
selectionColor: Palette.alternativeBackgroundColor
selectionColor: Palette.selectedTextBackgroundColor
background: Rectangle {
color: enabled ? Palette.backgroundColor : Palette.hoveredBackgroundColor

View File

@@ -1,7 +1,5 @@
module Controls
Label 1.0 Label.qml
ComboBox 1.0 ComboBox.qml
PaneItem 1.0 PaneItem.qml
ScrollBar 1.0 ScrollBar.qml
Button 1.0 Button.qml
OutlineButton 1.0 OutlineButton.qml
@@ -22,3 +20,5 @@ ChartView 1.0 ChartView.qml
TextArea 1.0 TextArea.qml
DialogHeader 1.0 DialogHeader.qml
DialogBackground 1.0 DialogBackground.qml
BusyIndicator 1.0 BusyIndicator.qml
MenuItemDelegate 1.0 MenuItemDelegate.qml

View File

@@ -1,18 +1,18 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="path-1-inside-1_973_566" fill="white">
<rect x="1.5" y="1" width="10" height="14" rx="1"/>
<rect x="1" y="1" width="9" height="13" rx="1"/>
</mask>
<rect x="1.5" y="1" width="10" height="14" rx="1" stroke="white" stroke-width="4" mask="url(#path-1-inside-1_973_566)"/>
<rect x="1" y="1" width="9" height="13" rx="1" stroke="white" stroke-width="2" mask="url(#path-1-inside-1_973_566)"/>
<mask id="path-2-inside-2_973_566" fill="white">
<rect x="12.5" y="1" width="10" height="7" rx="1"/>
<rect x="13" y="1" width="9" height="7" rx="1"/>
</mask>
<rect x="12.5" y="1" width="10" height="7" rx="1" stroke="white" stroke-width="4" mask="url(#path-2-inside-2_973_566)"/>
<rect x="13" y="1" width="9" height="7" rx="1" stroke="white" stroke-width="2" mask="url(#path-2-inside-2_973_566)"/>
<mask id="path-3-inside-3_973_566" fill="white">
<rect x="12.5" y="9" width="10" height="14" rx="1"/>
<rect x="13" y="11" width="9" height="12" rx="1"/>
</mask>
<rect x="12.5" y="9" width="10" height="14" rx="1" stroke="white" stroke-width="4" mask="url(#path-3-inside-3_973_566)"/>
<rect x="13" y="11" width="9" height="12" rx="1" stroke="white" stroke-width="2" mask="url(#path-3-inside-3_973_566)"/>
<mask id="path-4-inside-4_973_566" fill="white">
<rect x="1.5" y="16" width="10" height="7" rx="1"/>
<rect x="1" y="17" width="9" height="6" rx="1"/>
</mask>
<rect x="1.5" y="16" width="10" height="7" rx="1" stroke="white" stroke-width="4" mask="url(#path-4-inside-4_973_566)"/>
<rect x="1" y="17" width="9" height="6" rx="1" stroke="white" stroke-width="2" mask="url(#path-4-inside-4_973_566)"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1003 B

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#41479B;" d="M473.655,88.276H38.345C17.167,88.276,0,105.443,0,126.621V385.38
c0,21.177,17.167,38.345,38.345,38.345h435.31c21.177,0,38.345-17.167,38.345-38.345V126.621
C512,105.443,494.833,88.276,473.655,88.276z"/>
<path style="fill:#F5F5F5;" d="M511.469,120.282c-3.022-18.159-18.797-32.007-37.814-32.007h-9.977l-163.54,107.147V88.276h-88.276
v107.147L48.322,88.276h-9.977c-19.017,0-34.792,13.847-37.814,32.007l139.778,91.58H0v88.276h140.309L0.531,391.717
c3.022,18.159,18.797,32.007,37.814,32.007h9.977l163.54-107.147v107.147h88.276V316.577l163.54,107.147h9.977
c19.017,0,34.792-13.847,37.814-32.007l-139.778-91.58H512v-88.276H371.691L511.469,120.282z"/>
<g>
<polygon style="fill:#FF4B55;" points="282.483,88.276 229.517,88.276 229.517,229.517 0,229.517 0,282.483 229.517,282.483
229.517,423.724 282.483,423.724 282.483,282.483 512,282.483 512,229.517 282.483,229.517 "/>
<path style="fill:#FF4B55;" d="M24.793,421.252l186.583-121.114h-32.428L9.224,410.31
C13.377,415.157,18.714,418.955,24.793,421.252z"/>
<path style="fill:#FF4B55;" d="M346.388,300.138H313.96l180.716,117.305c5.057-3.321,9.277-7.807,12.287-13.075L346.388,300.138z"
/>
<path style="fill:#FF4B55;" d="M4.049,109.475l157.73,102.387h32.428L15.475,95.842C10.676,99.414,6.749,104.084,4.049,109.475z"/>
<path style="fill:#FF4B55;" d="M332.566,211.862l170.035-110.375c-4.199-4.831-9.578-8.607-15.699-10.86L300.138,211.862H332.566z"
/>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#73AF00;" d="M38.345,88.273C17.167,88.273,0,105.44,0,126.618v258.759c0,21.177,17.167,38.345,38.345,38.345
h132.322V88.273H38.345z"/>
<rect x="170.67" y="88.277" style="fill:#F5F5F5;" width="170.67" height="335.45"/>
<path style="fill:#FF4B55;" d="M473.655,88.273H341.333v335.448h132.322c21.177,0,38.345-17.167,38.345-38.345V126.618
C512,105.44,494.833,88.273,473.655,88.273z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 894 B

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#F5F5F5;" d="M473.655,88.276H38.345C17.167,88.276,0,105.443,0,126.621v73.471h512v-73.471
C512,105.443,494.833,88.276,473.655,88.276z"/>
<path style="fill:#FF4B55;" d="M0,385.379c0,21.177,17.167,38.345,38.345,38.345h435.31c21.177,0,38.345-17.167,38.345-38.345
v-73.471H0V385.379z"/>
<rect y="200.09" style="fill:#41479B;" width="512" height="111.81"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 867 B

View File

@@ -1,7 +1,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.0
import Controls 1.0 as Controls
import Screens 1.0 as Screens
@@ -10,7 +9,7 @@ import Utils 1.0
ApplicationWindow {
id: window
title: qsTr("Cubo Verde BMS Tool")
title: qsTr("Cubo Verde BMS tool")
width: 1366
height: 768
visible: true
@@ -45,38 +44,11 @@ ApplicationWindow {
Layout.preferredHeight: pane.minimized ? 85 : 40
}
ItemDelegate {
leftPadding: pane.minimized ? 0 : 40
contentItem: RowLayout {
height: 50
spacing: 25
Item {
visible: pane.minimized
Layout.fillWidth: true
}
Image {
source: "qrc:/Icons/hide-menu.svg"
mirror: pane.minimized
Layout.alignment: Qt.AlignCenter
}
Label {
text: qsTr("Hide menu")
color: Palette.alternativeTextColor
visible: !pane.minimized
}
Item {
Layout.fillWidth: true
}
}
background: Rectangle {
color: "transparent"
}
Controls.MenuItemDelegate {
text: qsTr("Hide menu")
font.weight: Font.Normal
icon.source: "qrc:/Icons/hide-menu.svg"
minimized: pane.minimized
onClicked: if (pane.implicitWidth === 300) {
animation.from = 300
@@ -90,7 +62,6 @@ ApplicationWindow {
pane.minimized = false
}
Layout.preferredHeight: 52
Layout.fillWidth: true
}
@@ -100,101 +71,36 @@ ApplicationWindow {
ListView {
id: menuView
model: [
property var menuModel: [
{"text": qsTr("AKB monitor"), "icon": "qrc:/Icons/akb-monitor.svg"},
{"text": qsTr("Cell monitor"), "icon": "qrc:/Icons/cell-monitor.svg"},
{"text": qsTr("Configuration"), "icon": "qrc:/Icons/bms-configuration.svg"},
{"text": qsTr("Visualization"), "icon": "qrc:/Icons/visualization.svg"},
{"text": qsTr("History"), "icon": "qrc:/Icons/history.svg"},
{"text": qsTr("BMS service"), "icon": "qrc:/Icons/bms-service.svg"},
// {"text": qsTr("Exit"), "icon": "qrc:/Icons/exit.svg"},
{"text": qsTr("BMS service"), "icon": "qrc:/Icons/bms-service.svg"}
]
delegate: ItemDelegate {
id: menuDelegate
model: menuModel.length
delegate: Controls.MenuItemDelegate {
width: ListView.view.width
height: 52
leftPadding: pane.minimized ? 0 : 40
highlighted: ListView.isCurrentItem
text: menuView.menuModel[modelData].text
icon.source: menuView.menuModel[modelData].icon
minimized: pane.minimized
onClicked: menuView.currentIndex = index
contentItem: RowLayout {
spacing: pane.minimized ? 0 : 25
height: 50
Item {
visible: pane.minimized
Layout.fillWidth: true
}
Image {
source: modelData.icon
Layout.alignment: Qt.AlignCenter
}
Label {
text: modelData.text
font.weight: Font.Bold
color: Palette.alternativeTextColor
visible: !pane.minimized
}
Item {
Layout.fillWidth: true
}
}
background: Rectangle {
color: menuDelegate.highlighted ? Palette.pressedButtonColor : Palette.buttonColor
}
}
Layout.fillHeight: true
Layout.fillWidth: true
}
ItemDelegate {
leftPadding: pane.minimized ? 0 : 40
Controls.MenuItemDelegate {
text: qsTr("Connection")
icon.source: "qrc:/Icons/connection.svg"
icon.color: "#FFFFFF"
minimized: pane.minimized
onClicked: connectionDialog.open()
contentItem: RowLayout {
spacing: pane.minimized ? 0 : 25
height: 50
Item {
visible: pane.minimized
Layout.fillWidth: true
}
Image {
source: "qrc:/Icons/connection.svg"
sourceSize.width: 24
sourceSize.height: 24
Layout.alignment: Qt.AlignCenter
ColorOverlay {
anchors.fill: parent
source: parent
color: "#FFFFFF"
}
}
Label {
text: qsTr("Connection")
font.weight: Font.Bold
color: Palette.alternativeTextColor
visible: !pane.minimized
}
Item {
Layout.fillWidth: true
}
}
background: Rectangle {
color: parent.down ? Palette.pressedButtonColor : Palette.buttonColor
}
Layout.fillWidth: true
}
@@ -216,6 +122,8 @@ ApplicationWindow {
}
ColumnLayout {
spacing: 0
RowLayout {
id: topBar
@@ -226,13 +134,13 @@ ApplicationWindow {
qsTr("Visualization"),
qsTr("Information output"),
qsTr("Terminal"),
qsTr("Exit"),
]
Label {
text: topBar.labels[stack.currentIndex]
font.pixelSize: 38
font.weight: Font.Bold
color: Palette.textColor
}
Item {
@@ -240,8 +148,14 @@ ApplicationWindow {
}
RowLayout {
spacing: 20
ColumnLayout {
spacing: 5
RowLayout {
spacing: 7
Controls.ContentLabel {
id: connectionStatusLabel
text: qsTr("Disconnected")
@@ -264,6 +178,8 @@ ApplicationWindow {
}
RowLayout {
spacing: 5
Controls.ContentLabel {
text: qsTr("Serial number") + ":"
Layout.alignment: Qt.AlignRight
@@ -277,11 +193,111 @@ ApplicationWindow {
Layout.alignment: Qt.AlignRight
}
Layout.topMargin: 15
Layout.bottomMargin: 15
Layout.fillHeight: true
}
Controls.LineSeparator {
horizontal: false
Layout.fillHeight: true
Layout.topMargin: 15
Layout.bottomMargin: 15
}
Item {
RowLayout {
id: languagesLayout
anchors.fill: parent
spacing: 10
Controls.ContentLabel {
text: Translator.currentLanguageName
}
Image {
source: Translator.currentLanguageIcon
sourceSize.width: 30
sourceSize.height: 26
}
}
MouseArea {
anchors.fill: parent
onClicked: languagesPopup.open()
}
Popup {
id: languagesPopup
width: 90
contentHeight: languagesList.contentHeight
padding: 1
x: -(width - languagesLayout.width) / 2
y: languagesLayout.height + 2
background: Rectangle {
color: Palette.backgroundColor
radius: 6
border.width: 1
border.color: Palette.borderColor
}
contentItem: ListView {
id: languagesList
model: [Translator.Russian, Translator.English, Translator.Italian]
width: languagesPopup.width
height: 120
clip: true
spacing: 0
delegate: Rectangle {
width: ListView.view.width
height: 40
color: Palette.backgroundColor
RowLayout {
anchors.fill: parent
spacing: 10
Controls.ContentLabel {
text: Translator.languageName(modelData)
Layout.fillWidth: true
Layout.leftMargin: 10
}
Image {
source: Translator.languageIcon(modelData)
sourceSize.width: 30
sourceSize.height: 26
Layout.rightMargin: 10
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onPressed: parent.color = Palette.selectedBackgroundColor
onReleased: parent.color = Palette.backgroundColor
onEntered: parent.color = Palette.hoveredBackgroundColor
onExited: parent.color = Palette.backgroundColor
onClicked: {
languagesPopup.close()
Translator.currentLanguage = modelData
}
}
}
}
}
Layout.preferredWidth: languagesLayout.implicitWidth
Layout.fillHeight: true
}
}
Layout.leftMargin: 45
Layout.rightMargin: 45
Layout.maximumHeight: 90
}
StackLayout {
@@ -301,6 +317,14 @@ ApplicationWindow {
}
Screens.BmsSettingsScreen {
onNeedWait: {
if (active) {
busyPopup.text = text
busyPopup.open()
} else {
busyPopup.close()
}
}
}
Screens.VisualizationScreen {
@@ -319,7 +343,7 @@ ApplicationWindow {
target: BmsInterface
onPortConnectedChanged: {
connectionStatusLabel.text = BmsInterface.isPortConnected() ? qsTr("Connected") : qsTr("Disconnected")
connectionStatusLabel.text = Qt.binding(function(){ return BmsInterface.isPortConnected() ? qsTr("Connected") : qsTr("Disconnected") })
connectionStatusIndicator.enabled = BmsInterface.isPortConnected()
if (BmsInterface.isPortConnected()) {
BmsInterface.commands().getBMSconf()
@@ -351,7 +375,6 @@ ApplicationWindow {
statusPopup.text = msg
statusPopup.good = isGood
statusPopup.open()
hideStatusTimer.start()
} else {
if (statusPopup.text !== msg) {
statusPopup.queue.push({"text": msg, "good": isGood})
@@ -395,7 +418,7 @@ ApplicationWindow {
Screens.StatusPopup {
id: statusPopup
property var filteredStatuses: []//[qsTr("BMS configuration updated")]
property var filteredStatuses: []
property var queue: []
onClosed: {
@@ -404,9 +427,13 @@ ApplicationWindow {
statusPopup.text = message.text
statusPopup.good = message.good
statusPopup.open()
hideStatusTimer.start()
}
}
onOpened: {
hideStatusTimer.start()
busyPopup.close()
}
}
Timer {
@@ -415,13 +442,57 @@ ApplicationWindow {
onTriggered: statusPopup.close()
}
Popup {
id: busyPopup
x: (parent.width - width) / 2
y: (parent.height - height) / 2
modal: true
closePolicy: Popup.NoAutoClose
property string text: ""
background: Rectangle {
color: "transparent"
}
ColumnLayout {
Controls.BusyIndicator {
running: true
Layout.alignment: Qt.AlignCenter
}
Controls.SubtitleLabel {
text: busyPopup.text
color: Palette.alternativeTextColor
maximumLineCount: 3
wrapMode: Text.Wrap
font.pixelSize: 20
Layout.alignment: Qt.AlignCenter
horizontalAlignment: Text.AlignHCenter
background: Rectangle {
color: Palette.textColor
opacity: 0.3
radius: 6
}
}
}
onOpened: hideBusyTimer.start()
onClosed: hideBusyTimer.stop()
}
Timer {
id: hideBusyTimer
interval: 30000
onTriggered: busyPopup.close()
}
background: Rectangle {
color: Palette.screenBackgroundColor
}
Component.onCompleted: {
// BmsInterface.bmsConfig().loadParamsXml("://res/config.xml")
// BmsInterface.infoConfig().loadParamsXml("://res/info.xml")
connectionDialog.open()
}
}

View File

@@ -16,7 +16,7 @@ Item {
Layout.fillWidth: true
RowLayout {
spacing: 90
spacing: 70
anchors.fill: parent
Controls.TitleLabel {
@@ -41,14 +41,14 @@ Item {
GridLayout {
columns: 2
columnSpacing: 90
columnSpacing: 70
rowSpacing: 20
anchors.fill: parent
RowLayout {
spacing: 10
Controls.ContentLabel {
text: qsTr("Battery charge level, V")
text: qsTr("Battery charge level, %")
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth
}
@@ -222,7 +222,7 @@ Item {
GridLayout {
columns: 2
columnSpacing: 90
columnSpacing: 70
rowSpacing: 20
anchors.fill: parent

View File

@@ -12,6 +12,8 @@ RowLayout {
property real contentRowSpacing: 20
property real contentColumnSpacing: 35
signal needWait(bool active, string text)
spacing: contentColumnSpacing
Flickable {
@@ -163,12 +165,16 @@ RowLayout {
Controls.SubtitleLabel {
text: qsTr("Maximum charge current, A")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.SubtitleLabel {
text: qsTr("Maximum load current, A")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -189,6 +195,8 @@ RowLayout {
Controls.SubtitleLabel {
text: qsTr("Maximum temperature, °C")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
@@ -224,12 +232,16 @@ RowLayout {
Controls.SubtitleLabel {
text: qsTr("Lower disable threshold, V")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.SubtitleLabel {
text: qsTr("Upper disable threshold, V")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -250,14 +262,16 @@ RowLayout {
Controls.SubtitleLabel {
text: qsTr("Lower enable threshold (should be higher than disable), V")
maximumLineCount: 2
maximumLineCount: 3
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
Controls.SubtitleLabel {
text: qsTr("Upper enable threshold (should be higher than disable), V")
maximumLineCount: 2
maximumLineCount: 3
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
}
@@ -328,6 +342,8 @@ RowLayout {
Controls.SubtitleLabel {
text: qsTr("Cell balancing interval, ms")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
@@ -367,13 +383,13 @@ RowLayout {
spacing: 20
Controls.LabelWithBackground {
text: qsTr(" 1")
text: qsTr("# 1")
Layout.preferredWidth: outputSettingsFrame.outputNumberSize
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
Controls.CheckBox {
text: qsTr("Use for management")
text: qsTr("Use for storage management")
Layout.fillWidth: true
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -391,7 +407,7 @@ RowLayout {
spacing: 20
Controls.LabelWithBackground {
text: qsTr(" 2")
text: qsTr("# 2")
Layout.preferredWidth: outputSettingsFrame.outputNumberSize
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -408,6 +424,8 @@ RowLayout {
Controls.SubtitleLabel {
text: qsTr("Change in value during SOC")
maximumLineCount: 2
wrapMode: Text.WordWrap
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
@@ -429,7 +447,7 @@ RowLayout {
spacing: 20
Controls.LabelWithBackground {
text: qsTr(" 3")
text: qsTr("# 3")
Layout.preferredWidth: outputSettingsFrame.outputNumberSize
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -476,7 +494,7 @@ RowLayout {
spacing: 20
Controls.LabelWithBackground {
text: qsTr(" 4")
text: qsTr("# 4")
Layout.preferredWidth: outputSettingsFrame.outputNumberSize
Layout.preferredHeight: outputSettingsFrame.outputNumberSize
}
@@ -534,7 +552,7 @@ RowLayout {
anchors.fill: parent
Controls.SubtitleLabel {
text: qsTr("Current sensor value «0»")
text: qsTr("Current sensor value \"0\"")
Layout.fillWidth: true
Layout.columnSpan: 2
}
@@ -549,7 +567,7 @@ RowLayout {
Controls.Button {
id: zeroSensorValueCalibrationButton
text: qsTr("Calibrate «0»")
text: qsTr("Calibrate \"0\"")
Layout.fillWidth: true
Layout.maximumWidth: (parent.width - parent.columnSpacing) / 2
Layout.columnSpan: 2
@@ -561,6 +579,7 @@ RowLayout {
Controls.OutlineButton {
text: qsTr("Load settings from file")
onClicked: loadFileDialog.open()
Layout.preferredWidth: 270
FileDialog {
id: loadFileDialog
@@ -576,6 +595,7 @@ RowLayout {
Controls.OutlineButton {
text: qsTr("Save settings to file")
onClicked: saveFileDialog.open()
Layout.preferredWidth: 270
FileDialog {
id: saveFileDialog
@@ -637,7 +657,7 @@ RowLayout {
}
Controls.LinkLabel {
text: qsTr("Current sensor value «0»")
text: qsTr("Current sensor value \"0\"")
onClicked: settingsFlickable.contentY = zeroSensorSettingsFrame.mapToItem(settingsFlickable.contentItem, 0, 0).y
}
@@ -649,7 +669,7 @@ RowLayout {
spacing: 15
Controls.OutlineButton {
text: qsTr("Read settings from file")
text: qsTr("Read default settings")
Layout.fillWidth: true
onClicked: BmsInterface.commands().getBMSconfDefault()
}
@@ -661,15 +681,6 @@ RowLayout {
}
Controls.OutlineButton {
text: qsTr("Write to non-volatile memory of BMS")
Layout.fillWidth: true
onClicked: {
writeValuesToConfig()
BmsInterface.commands().storeBMSConfig()
}
}
Controls.Button {
text: qsTr("Write current values to BMS")
Layout.fillWidth: true
onClicked: {
@@ -678,10 +689,20 @@ RowLayout {
}
}
Controls.Button {
text: qsTr("Write to non-volatile memory of BMS")
Layout.fillWidth: true
onClicked: {
needWait(true, qsTr("The settings are written to non-volatile memory.\nWait, please."))
writeValuesToConfig()
BmsInterface.commands().storeBMSConfig()
}
}
Layout.fillWidth: true
}
Layout.maximumWidth: 320
Layout.maximumWidth: 280
Layout.fillHeight: true
}

View File

@@ -21,7 +21,7 @@ Item {
Layout.fillWidth: true
Controls.SubtitleLabel {
text: qsTr("")
text: qsTr("#")
color: Palette.tableHeaderTextColor
anchors.centerIn: parent
}

View File

@@ -9,7 +9,7 @@ import Utils 1.0
Dialog {
id: root
title: qsTr("Connection screen")
width: 400
width: 470
height: 320
modal: true
closePolicy: Popup.CloseOnEscape
@@ -79,7 +79,7 @@ Dialog {
Connections {
target: BmsInterface
onPortConnectedChanged: {
connectButton.text = BmsInterface.isPortConnected() ? qsTr("Disconnect") : qsTr("Connect")
connectButton.text = Qt.binding(function() { return BmsInterface.isPortConnected() ? qsTr("Disconnect") : qsTr("Connect") })
serialBox.enabled = !BmsInterface.isPortConnected()
}
}

View File

@@ -37,27 +37,27 @@ ColumnLayout {
Controls.TabButton {
text: qsTr("Current")
width: bar.width / 6 * 0.9
}
Controls.TabButton {
text: qsTr("Battery temperature")
width: bar.width / 6 * 1.2
}
Controls.TabButton {
text: qsTr("BMS temperature")
width: bar.width / 6 * 1.2
}
Controls.TabButton {
text: qsTr("Cell voltage")
width: bar.width / 6 * 0.8
}
Controls.TabButton {
text: qsTr("Battery temperature")
width: bar.width / 6 * 1.3
}
Controls.TabButton {
text: qsTr("BMS temperature")
width: bar.width / 6 * 1.1
}
Controls.TabButton {
text: qsTr("Cell voltage")
width: bar.width / 6 * 1
}
Controls.TabButton {
text: qsTr("Cell list")
width: bar.width / 6 * 0.9
width: bar.width / 6 * 0.85
}
Layout.fillWidth: true
@@ -81,6 +81,8 @@ ColumnLayout {
Controls.CheckBox {
id: checkSeries
checked: true
spacing: 10
onCheckedChanged: {
if (checked) {
chartItem.series(modelData).color = seriesColor
@@ -103,7 +105,7 @@ ColumnLayout {
chartItem = ListView.view ? ListView.view.chartItem : parent.chartItem
horizontal = !ListView.view
seriesColor = chartItem.series(modelData).color
checkSeries.text = chartItem.series(modelData).name
checkSeries.text = Qt.binding(function(){ return chartItem.series(modelData).name })
}
}
}
@@ -145,7 +147,7 @@ ColumnLayout {
RowLayout {
visible: horizontalLegend
spacing: 20
spacing: 0
property Controls.ChartView chartItem: chart
@@ -170,7 +172,7 @@ ColumnLayout {
property Controls.ChartView chartItem: chart
Layout.preferredWidth: 180
Layout.preferredWidth: 200
Layout.fillHeight: true
}
}
@@ -362,6 +364,15 @@ ColumnLayout {
}
}
Connections {
target: Translator
onCurrentLanguageChanged: {
for (var i = 0; i < cellListLoader.item.chart.count; ++i) {
cellListLoader.item.chart.series(i).name = qsTr("Cell #") + (i + 1).toString()
}
}
}
Connections {
target: BmsInterface.commands()
@@ -461,38 +472,53 @@ ColumnLayout {
Component.onCompleted: {
voltageLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Voltage indicator"),
voltageLoader.item.chart.xAxis, voltageLoader.item.chart.yAxis)
voltageLoader.item.chart.series(0).name = Qt.binding(function(){ return qsTr("Voltage indicator") })
voltageLoader.item.chart.axes[0].max = 10
voltageLoader.item.seriesCount = voltageLoader.item.chart.count
////////////////////////////////////////////////////////////////////////////////////////////////////////////
currentLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Current indicator"),
currentLoader.item.chart.xAxis, currentLoader.item.chart.yAxis)
currentLoader.item.chart.series(0).name = Qt.binding(function(){ return qsTr("Current indicator") })
currentLoader.item.chart.axes[0].max = 10
currentLoader.item.seriesCount = currentLoader.item.chart.count
////////////////////////////////////////////////////////////////////////////////////////////////////////////
batteryTemperatureLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Maximum temperature"),
batteryTemperatureLoader.item.chart.xAxis, batteryTemperatureLoader.item.chart.yAxis)
batteryTemperatureLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Average temperature"),
batteryTemperatureLoader.item.chart.xAxis, batteryTemperatureLoader.item.chart.yAxis)
batteryTemperatureLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Minimum temperature"),
batteryTemperatureLoader.item.chart.xAxis, batteryTemperatureLoader.item.chart.yAxis)
batteryTemperatureLoader.item.chart.series(0).name = Qt.binding(function(){ return qsTr("Maximum temperature") })
batteryTemperatureLoader.item.chart.series(1).name = Qt.binding(function(){ return qsTr("Average temperature") })
batteryTemperatureLoader.item.chart.series(2).name = Qt.binding(function(){ return qsTr("Minimum temperature") })
batteryTemperatureLoader.item.chart.axes[0].max = 10
batteryTemperatureLoader.item.seriesCount = batteryTemperatureLoader.item.chart.count
///////////////////////////////////////////////////////////////////////////////////////////////////////////
bmsTemperatureLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Maximum temperature"),
bmsTemperatureLoader.item.chart.xAxis, bmsTemperatureLoader.item.chart.yAxis)
bmsTemperatureLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Average temperature"),
bmsTemperatureLoader.item.chart.xAxis, bmsTemperatureLoader.item.chart.yAxis)
bmsTemperatureLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Minimum temperature"),
bmsTemperatureLoader.item.chart.xAxis, bmsTemperatureLoader.item.chart.yAxis)
bmsTemperatureLoader.item.chart.series(0).name = Qt.binding(function(){ return qsTr("Maximum temperature") })
bmsTemperatureLoader.item.chart.series(1).name = Qt.binding(function(){ return qsTr("Average temperature") })
bmsTemperatureLoader.item.chart.series(2).name = Qt.binding(function(){ return qsTr("Minimum temperature") })
bmsTemperatureLoader.item.chart.axes[0].max = 10
bmsTemperatureLoader.item.seriesCount = bmsTemperatureLoader.item.chart.count
///////////////////////////////////////////////////////////////////////////////////////////////////////////
cellVoltageLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Maximum voltage"),
cellVoltageLoader.item.chart.xAxis, cellVoltageLoader.item.chart.yAxis)
cellVoltageLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Average voltage"),
cellVoltageLoader.item.chart.xAxis, cellVoltageLoader.item.chart.yAxis)
cellVoltageLoader.item.chart.createSeries(ChartView.SeriesTypeLine, qsTr("Minimum voltage"),
cellVoltageLoader.item.chart.xAxis, cellVoltageLoader.item.chart.yAxis)
cellVoltageLoader.item.chart.series(0).name = Qt.binding(function(){ return qsTr("Maximum voltage") })
cellVoltageLoader.item.chart.series(1).name = Qt.binding(function(){ return qsTr("Average voltage") })
cellVoltageLoader.item.chart.series(2).name = Qt.binding(function(){ return qsTr("Minimum voltage") })
cellVoltageLoader.item.chart.axes[0].max = 10
cellVoltageLoader.item.seriesCount = cellVoltageLoader.item.chart.count
}

View File

@@ -14,6 +14,7 @@ QtObject {
property color alternativeBackgroundColor: "#009352"
property color screenBackgroundColor: "#F7F8FC"
property color tableHeaderBackgroundColor: "#F0F1F4"
property color selectedTextBackgroundColor: "#009150"
property color borderColor: "#DFE0EB"

View File

@@ -14,5 +14,8 @@
<file>Icons/close.svg</file>
<file>Icons/info.svg</file>
<file>Icons/warning.svg</file>
<file>Icons/english-flag.svg</file>
<file>Icons/italian-flag.svg</file>
<file>Icons/russian-flag.svg</file>
</qresource>
</RCC>

View File

@@ -5,8 +5,6 @@
<file>Screens/AkbMonitorScreen.qml</file>
<file>Screens/CellMonitorScreen.qml</file>
<file>Controls/ComboBox.qml</file>
<file>Controls/PaneItem.qml</file>
<file>Controls/Label.qml</file>
<file>Utils/Palette.qml</file>
<file>Controls/qmldir</file>
<file>Screens/qmldir</file>
@@ -38,5 +36,7 @@
<file>Screens/MessageDialog.qml</file>
<file>Screens/StatusPopup.qml</file>
<file>Utils/MathHelper.qml</file>
<file>Controls/BusyIndicator.qml</file>
<file>Controls/MenuItemDelegate.qml</file>
</qresource>
</RCC>