From 1fc06361f81cf2889d3d649a9a3542f8ce98e319 Mon Sep 17 00:00:00 2001 From: Yury Shuvakin Date: Mon, 29 Aug 2022 02:57:42 +0300 Subject: [PATCH] Added some UI fixes --- qml/Controls/AvailabilityIndicator.qml | 4 +- qml/Controls/TabButton.qml | 2 + qml/MainWindow.qml | 1 + qml/Screens/BmsSettingsScreen.qml | 26 ++++--- qml/Utils/Palette.qml | 2 + translations/cubo_en.ts | 94 +++++++++++++------------- translations/cubo_it.ts | 94 +++++++++++++------------- translations/cubo_ru.ts | 94 +++++++++++++------------- 8 files changed, 164 insertions(+), 153 deletions(-) diff --git a/qml/Controls/AvailabilityIndicator.qml b/qml/Controls/AvailabilityIndicator.qml index 7650c35..3b2faef 100644 --- a/qml/Controls/AvailabilityIndicator.qml +++ b/qml/Controls/AvailabilityIndicator.qml @@ -4,9 +4,11 @@ import Utils 1.0 Rectangle { property bool enabled: false + property bool neutral: true implicitWidth: 18 implicitHeight: 18 radius: implicitWidth / 2 - color: enabled ? Palette.alternativeBackgroundColor : Palette.borderColor + color: enabled ? Palette.goodColor : + (neutral ? Palette.borderColor : Palette.invalidColor) } diff --git a/qml/Controls/TabButton.qml b/qml/Controls/TabButton.qml index 5f1a80f..20301bc 100644 --- a/qml/Controls/TabButton.qml +++ b/qml/Controls/TabButton.qml @@ -15,6 +15,8 @@ TabButton { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight + maximumLineCount: 2 + wrapMode: Text.Wrap } background: Item { diff --git a/qml/MainWindow.qml b/qml/MainWindow.qml index 0bb3a30..74387e9 100644 --- a/qml/MainWindow.qml +++ b/qml/MainWindow.qml @@ -169,6 +169,7 @@ ApplicationWindow { Controls.AvailabilityIndicator { id: connectionStatusIndicator enabled: false + neutral: false Layout.alignment: Qt.AlignCenter } diff --git a/qml/Screens/BmsSettingsScreen.qml b/qml/Screens/BmsSettingsScreen.qml index 729124f..bc16222 100644 --- a/qml/Screens/BmsSettingsScreen.qml +++ b/qml/Screens/BmsSettingsScreen.qml @@ -692,32 +692,36 @@ RowLayout { Controls.OutlineButton { text: qsTr("Read default settings") Layout.fillWidth: true - onClicked: BmsInterface.commands().getBMSconfDefault() + onClicked: if (BmsInterface.isPortConnected()) { + BmsInterface.commands().getBMSconfDefault() + } } Controls.OutlineButton { text: qsTr("Read current settings from BMS") Layout.fillWidth: true - onClicked: BmsInterface.commands().getBMSconf() + onClicked: if (BmsInterface.isPortConnected()) { + BmsInterface.commands().getBMSconf() + } } Controls.OutlineButton { text: qsTr("Write current values to BMS") Layout.fillWidth: true - onClicked: { - writeValuesToConfig() - BmsInterface.commands().setBMSconf() - } + onClicked: if (BmsInterface.isPortConnected()) { + writeValuesToConfig() + BmsInterface.commands().setBMSconf() + } } 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() - } + onClicked: if (BmsInterface.isPortConnected()) { + needWait(true, qsTr("The settings are written to non-volatile memory.\nWait, please.")) + writeValuesToConfig() + BmsInterface.commands().storeBMSConfig() + } } Layout.fillWidth: true diff --git a/qml/Utils/Palette.qml b/qml/Utils/Palette.qml index ac447fb..4745cbc 100644 --- a/qml/Utils/Palette.qml +++ b/qml/Utils/Palette.qml @@ -25,4 +25,6 @@ QtObject { property color informationColor: "#4C68ED" property color invalidColor: "#A31C00" + property color goodColor: "#009352" + property color neutralColor: "#DFE0EB" } diff --git a/translations/cubo_en.ts b/translations/cubo_en.ts index b5156a8..3cecad4 100644 --- a/translations/cubo_en.ts +++ b/translations/cubo_en.ts @@ -374,7 +374,7 @@ - + The settings are written to non-volatile memory. Wait, please. @@ -441,17 +441,17 @@ Wait, please. - + Read current settings from BMS - + Write to non-volatile memory of BMS - + Write current values to BMS @@ -617,22 +617,22 @@ Wait, please. - + Disconnected - + Serial number - + Connected - + Tool started @@ -717,110 +717,110 @@ Wait, please. - - - - - - + + + + + + Time, s - - - + + + Voltage, V - + Current, A - - + + Temperature, °C - + Pause data collection - + Resume data collection - + Clear data - + Reset zoom - - + + Cell # - - + + Voltage indicator - - + + Current indicator - - - - + + + + Maximum temperature - - - - + + + + Average temperature - - - - + + + + Minimum temperature - - + + Maximum voltage - + Average voltage - - + + Minimum voltage diff --git a/translations/cubo_it.ts b/translations/cubo_it.ts index eb8a1e9..2cd3869 100644 --- a/translations/cubo_it.ts +++ b/translations/cubo_it.ts @@ -374,7 +374,7 @@ - + The settings are written to non-volatile memory. Wait, please. @@ -441,17 +441,17 @@ Wait, please. - + Read current settings from BMS - + Write to non-volatile memory of BMS - + Write current values to BMS @@ -617,22 +617,22 @@ Wait, please. - + Disconnected - + Serial number - + Connected - + Tool started @@ -717,110 +717,110 @@ Wait, please. - - - - - - + + + + + + Time, s - - - + + + Voltage, V - + Current, A - - + + Temperature, °C - + Pause data collection - + Resume data collection - + Clear data - + Reset zoom - - + + Cell # - - + + Voltage indicator - - + + Current indicator - - - - + + + + Maximum temperature - - - - + + + + Average temperature - - - - + + + + Minimum temperature - - + + Maximum voltage - + Average voltage - - + + Minimum voltage diff --git a/translations/cubo_ru.ts b/translations/cubo_ru.ts index a66f327..ddb2754 100644 --- a/translations/cubo_ru.ts +++ b/translations/cubo_ru.ts @@ -374,7 +374,7 @@ Загрузить настройки по-умолчанию - + The settings are written to non-volatile memory. Wait, please. Выполняется запись настроек в энергонезависимую память. @@ -446,17 +446,17 @@ Wait, please. Загрузить настройки из файла - + Read current settings from BMS Загрузить текущие настройки из BMS - + Write to non-volatile memory of BMS Записать в энергонезависимую память BMS - + Write current values to BMS Записать текущие значения в BMS @@ -621,7 +621,7 @@ Wait, please. Терминал - + Tool started Утилита запущена @@ -631,17 +631,17 @@ Wait, please. - + Disconnected Отключено - + Serial number Серийный номер - + Connected Подключено @@ -726,110 +726,110 @@ Wait, please. Список ячеек - - - - - - + + + + + + Time, s Время, c - - - + + + Voltage, V Напряжение, В - + Current, A Ток, А - - + + Temperature, °C Температура, °C - + Pause data collection Приостановить сбор данных - + Resume data collection Продолжить сбор данных - + Clear data Очистить данные - + Reset zoom Сбросить масштаб - - + + Cell # Ячейка № - - + + Voltage indicator Показатель вольтажа - - + + Current indicator Показатель тока - - - - + + + + Maximum temperature Максимальная температура - - - - + + + + Average temperature Средняя температура - - - - + + + + Minimum temperature Минимальная температура - - + + Maximum voltage Максимальное напряжение - + Average voltage Среднее напряжение - - + + Minimum voltage Минимальное напряжение