Implemented a screen displaying the history of operations with the board. Added dialogs for displaying messages and statuses
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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
|
||||
@@ -106,7 +107,7 @@ ApplicationWindow {
|
||||
{"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("Exit"), "icon": "qrc:/Icons/exit.svg"},
|
||||
]
|
||||
|
||||
delegate: ItemDelegate {
|
||||
@@ -151,6 +152,55 @@ ApplicationWindow {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
leftPadding: pane.minimized ? 0 : 40
|
||||
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
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.preferredHeight: 40
|
||||
}
|
||||
}
|
||||
|
||||
PropertyAnimation {
|
||||
@@ -174,7 +224,7 @@ ApplicationWindow {
|
||||
qsTr("Cell monitor"),
|
||||
qsTr("BMS settings"),
|
||||
qsTr("Visualization"),
|
||||
qsTr("History"),
|
||||
qsTr("Information output"),
|
||||
qsTr("Terminal"),
|
||||
qsTr("Exit"),
|
||||
]
|
||||
@@ -189,6 +239,45 @@ ApplicationWindow {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
Controls.ContentLabel {
|
||||
id: connectionStatusLabel
|
||||
text: qsTr("Disconnected")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
Controls.AvailabilityIndicator {
|
||||
id: connectionStatusIndicator
|
||||
enabled: false
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
}
|
||||
|
||||
Controls.ContentLabel {
|
||||
text: qsTr("V1.3")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Controls.ContentLabel {
|
||||
text: qsTr("Serial number") + ":"
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
Controls.SubtitleLabel {
|
||||
text: qsTr("9999997")
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Layout.leftMargin: 45
|
||||
Layout.rightMargin: 45
|
||||
}
|
||||
@@ -215,7 +304,7 @@ ApplicationWindow {
|
||||
Screens.VisualizationScreen {
|
||||
}
|
||||
|
||||
Screens.BmsSettingsScreen {
|
||||
Screens.DebugInformationScreen {
|
||||
}
|
||||
|
||||
Screens.BmsServiceScreen {
|
||||
@@ -224,8 +313,84 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
Screens.ConnectionScreen {
|
||||
id: connectionScreen
|
||||
Connections {
|
||||
target: BmsInterface
|
||||
|
||||
onPortConnectedChanged: {
|
||||
connectionStatusLabel.text = BmsInterface.isPortConnected() ? qsTr("Connected") : qsTr("Disconnected")
|
||||
connectionStatusIndicator.enabled = BmsInterface.isPortConnected()
|
||||
}
|
||||
|
||||
onMessageDialog: {
|
||||
if (!messageDialog.visible) {
|
||||
messageDialog.title = title
|
||||
messageDialog.description = msg
|
||||
messageDialog.good = isGood
|
||||
messageDialog.open()
|
||||
} else {
|
||||
messageDialog.queue.push({"title": title, "description": msg, "good": isGood})
|
||||
}
|
||||
}
|
||||
|
||||
onStatusMessage: {
|
||||
for (var i = 0; i < statusPopup.filteredStatuses.length; ++i) {
|
||||
if (msg === statusPopup.filteredStatuses[i]) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (!statusPopup.visible) {
|
||||
statusPopup.text = msg
|
||||
statusPopup.good = isGood
|
||||
statusPopup.open()
|
||||
hideStatusTimer.start()
|
||||
} else {
|
||||
if (statusPopup.text !== msg) {
|
||||
statusPopup.queue.push({"text": msg, "good": isGood})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Screens.ConnectionDialog {
|
||||
id: connectionDialog
|
||||
}
|
||||
|
||||
Screens.MessageDialog {
|
||||
id: messageDialog
|
||||
property var queue: []
|
||||
onClosed: {
|
||||
if (queue.length > 0) {
|
||||
var message = queue.pop()
|
||||
messageDialog.title = message.title
|
||||
messageDialog.description = message.description
|
||||
messageDialog.good = message.good
|
||||
messageDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Screens.StatusPopup {
|
||||
id: statusPopup
|
||||
|
||||
property var filteredStatuses: [qsTr("BMS configuration updated")]
|
||||
property var queue: []
|
||||
|
||||
onClosed: {
|
||||
if (queue.length > 0) {
|
||||
var message = queue.pop()
|
||||
statusPopup.text = message.text
|
||||
statusPopup.good = message.good
|
||||
statusPopup.open()
|
||||
hideStatusTimer.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hideStatusTimer
|
||||
interval: 3000
|
||||
onTriggered: statusPopup.close()
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
@@ -233,9 +398,9 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
BmsInterface.bmsConfig().loadParamsXml("://res/config.xml")
|
||||
BmsInterface.infoConfig().loadParamsXml("://res/info.xml")
|
||||
// BmsInterface.bmsConfig().loadParamsXml("://res/config.xml")
|
||||
// BmsInterface.infoConfig().loadParamsXml("://res/info.xml")
|
||||
|
||||
connectionScreen.open()
|
||||
connectionDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user