From 51bf08d65467b7a37870469150fa96a146776d2f Mon Sep 17 00:00:00 2001 From: MishkaRogachev Date: Sun, 3 Mar 2019 15:50:10 +0300 Subject: [PATCH] Indicators and pallete fixes --- 2ndparty/industrial-indicators | 2 +- sources/presentation/qml/Common/Info.qml | 2 +- .../DashboardControls/CommandBox.qml | 6 ++- .../Dashboard/DashboardControls/ModeBox.qml | 5 ++- .../DashboardControls/WaypointBox.qml | 5 ++- .../Instruments/DiagnosticsPanel.qml | 4 +- .../SingleVehicleDisplay/TopBarDelegate.qml | 6 +-- .../Drawer/Connection/Links/EndpointView.qml | 12 +++++- .../Drawer/Connection/Links/LinkEditView.qml | 6 +-- .../Drawer/Connection/Links/LinkListView.qml | 1 + .../qml/Drawer/Connection/Links/LinkView.qml | 41 ++++++++++--------- .../MavLinkSettings/MavLinkSettingsView.qml | 8 ++-- .../presentation/qml/Drawer/Logs/LogView.qml | 16 +++++++- .../Missions/MissionAssignmentView.qml | 1 + .../Planning/Missions/MissionListView.qml | 1 + .../Drawer/Planning/Missions/MissionView.qml | 1 + .../Settings/Video/VideoSourceListView.qml | 1 + .../Drawer/Settings/Video/VideoSourceView.qml | 17 ++++---- .../qml/Drawer/Vehicles/VehicleListView.qml | 1 + .../qml/Drawer/Vehicles/VehicleView.qml | 18 ++++---- sources/presentation/qml/MainView.qml | 1 + .../qml/Topbar/Connection/ConnectionInfo.qml | 2 +- 22 files changed, 97 insertions(+), 60 deletions(-) diff --git a/2ndparty/industrial-indicators b/2ndparty/industrial-indicators index fc16c67b..f8ff7238 160000 --- a/2ndparty/industrial-indicators +++ b/2ndparty/industrial-indicators @@ -1 +1 @@ -Subproject commit fc16c67b493b84861a0052b4ce2bc53f3f061da0 +Subproject commit f8ff723814fa14a1b5c58f87830f50ff53ac2ed2 diff --git a/sources/presentation/qml/Common/Info.qml b/sources/presentation/qml/Common/Info.qml index d488379d..03fd6e3a 100644 --- a/sources/presentation/qml/Common/Info.qml +++ b/sources/presentation/qml/Common/Info.qml @@ -8,7 +8,7 @@ Controls.Frame { property alias message: messageLabel.text - backgroundColor: Indicators.Theme.caution + backgroundColor: industrial.colors.neutral visible: message.length > 0 padding: industrial.padding diff --git a/sources/presentation/qml/Dashboard/DashboardControls/CommandBox.qml b/sources/presentation/qml/Dashboard/DashboardControls/CommandBox.qml index c724adae..dac97b9b 100644 --- a/sources/presentation/qml/Dashboard/DashboardControls/CommandBox.qml +++ b/sources/presentation/qml/Dashboard/DashboardControls/CommandBox.qml @@ -25,8 +25,10 @@ Controls.ComboBox { font.bold: true displayText: processingText contentColor: status == Command.Idle ? industrial.colors.onSurface: industrial.colors.onHighlight - labelColor: status == Command.Idle ? industrial.colors.onSurface: industrial.colors.onHighlight - + labelColor: { + if (!enabled) return industrial.colors.disabled; + return status == Command.Idle ? industrial.colors.onSurface : industrial.colors.onHighlight; + } onActivated: presenter.executeCommand(model[index].command, []) onStatusChanged: if (status == Command.Completed || status == Command.Rejected) timer.start() diff --git a/sources/presentation/qml/Dashboard/DashboardControls/ModeBox.qml b/sources/presentation/qml/Dashboard/DashboardControls/ModeBox.qml index e7b382ae..3a1f2bb6 100644 --- a/sources/presentation/qml/Dashboard/DashboardControls/ModeBox.qml +++ b/sources/presentation/qml/Dashboard/DashboardControls/ModeBox.qml @@ -24,7 +24,10 @@ Controls.ComboBox { if (status != Command.Idle) return industrial.colors.surface; return industrial.colors.onSurface; } - labelColor: status == Command.Idle ? industrial.colors.onSurface : industrial.colors.onHighlight + labelColor: { + if (!enabled) return industrial.colors.disabled; + return status == Command.Idle ? industrial.colors.onSurface : industrial.colors.onHighlight; + } currentIndex: { for (var i = 0; i < model.length; ++i) { if (mode == model[i]) return i; // works only with == diff --git a/sources/presentation/qml/Dashboard/DashboardControls/WaypointBox.qml b/sources/presentation/qml/Dashboard/DashboardControls/WaypointBox.qml index 3971de43..1196c5c9 100644 --- a/sources/presentation/qml/Dashboard/DashboardControls/WaypointBox.qml +++ b/sources/presentation/qml/Dashboard/DashboardControls/WaypointBox.qml @@ -16,7 +16,10 @@ Controls.ComboBox { font.pixelSize: industrial.auxFontSize font.bold: true contentColor: status == Command.Idle ? industrial.colors.onSurface: industrial.colors.selection - labelColor: status == Command.Idle ? industrial.colors.onSurface: industrial.colors.onHighlight + labelColor: { + if (!enabled) return industrial.colors.disabled; + return status == Command.Idle ? industrial.colors.onSurface : industrial.colors.onHighlight; + } backgroundColor: { if (status == Command.Rejected) return Indicators.Theme.dangerColor; if (status == Command.Sending) return Indicators.Theme.cautionColor; diff --git a/sources/presentation/qml/Dashboard/SingleVehicleDisplay/Instruments/DiagnosticsPanel.qml b/sources/presentation/qml/Dashboard/SingleVehicleDisplay/Instruments/DiagnosticsPanel.qml index 76e7c210..7fb0b5b4 100644 --- a/sources/presentation/qml/Dashboard/SingleVehicleDisplay/Instruments/DiagnosticsPanel.qml +++ b/sources/presentation/qml/Dashboard/SingleVehicleDisplay/Instruments/DiagnosticsPanel.qml @@ -57,7 +57,7 @@ BaseInstrument { LineSeries { axisX: timeAxis axisY: valueAxis - color: Indicators.Theme.positive + color: Indicators.Theme.positiveColor VXYModelMapper { xColumn: 0 @@ -69,7 +69,7 @@ BaseInstrument { LineSeries { axisX: timeAxis axisY: valueAxis - color: Indicators.Theme.caution + color: Indicators.Theme.cautionColor VXYModelMapper { xColumn: 0 diff --git a/sources/presentation/qml/Dashboard/SingleVehicleDisplay/TopBarDelegate.qml b/sources/presentation/qml/Dashboard/SingleVehicleDisplay/TopBarDelegate.qml index fc229520..a50e89fd 100644 --- a/sources/presentation/qml/Dashboard/SingleVehicleDisplay/TopBarDelegate.qml +++ b/sources/presentation/qml/Dashboard/SingleVehicleDisplay/TopBarDelegate.qml @@ -109,8 +109,8 @@ Controls.Pane { Controls.Button { id: centerButton iconSource: "qrc:/icons/center.svg" - iconColor: map.trackingVehicleId === vehicleId ? Indicators.Theme.positiveColor : - Indicators.Theme.textColor + iconColor: map.trackingVehicleId === vehicleId ? industrial.colors.selection : + industrial.colors.onSurface tipText: qsTr("Track vehicle") flat: true enabled: map.visible @@ -141,7 +141,7 @@ Controls.Pane { iconSource: "qrc:/icons/joystick.svg" tipText: (manual.enabled ? qsTr("Disable") : qsTr("Enable")) + " " + qsTr("manual control") - iconColor: manual.enabled ? Indicators.Theme.positiveColor : Indicators.Theme.textColor + iconColor: manual.enabled ? industrial.colors.selection : industrial.colors.onSurface flat: true onClicked: manual.setEnabled(!manual.enabled) } diff --git a/sources/presentation/qml/Drawer/Connection/Links/EndpointView.qml b/sources/presentation/qml/Drawer/Connection/Links/EndpointView.qml index 6c649fd7..f77aea9c 100644 --- a/sources/presentation/qml/Drawer/Connection/Links/EndpointView.qml +++ b/sources/presentation/qml/Drawer/Connection/Links/EndpointView.qml @@ -26,20 +26,28 @@ RowLayout { spacing: industrial.spacing - Controls.NumericInput { + TextInput { id: address validator: RegExpValidator { regExp: /^(([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$/ } onEditingFinished: updateEndpoint() + color: industrial.colors.onBackground + selectionColor: industrial.colors.selection + selectedTextColor: industrial.colors.onSelection + horizontalAlignment: Text.AlignHCenter Layout.fillWidth: true } - Controls.NumericInput { + TextInput { id: port inputMethodHints: Qt.ImhDigitsOnly validator: IntValidator { bottom: 0; top: 65535 } onEditingFinished: updateEndpoint() + color: industrial.colors.onBackground + selectionColor: industrial.colors.selection + selectedTextColor: industrial.colors.onSelection + horizontalAlignment: Text.AlignHCenter Layout.fillWidth: true } diff --git a/sources/presentation/qml/Drawer/Connection/Links/LinkEditView.qml b/sources/presentation/qml/Drawer/Connection/Links/LinkEditView.qml index 8eaaf6d5..4166d346 100644 --- a/sources/presentation/qml/Drawer/Connection/Links/LinkEditView.qml +++ b/sources/presentation/qml/Drawer/Connection/Links/LinkEditView.qml @@ -241,8 +241,8 @@ ColumnLayout { } AreaSeries { - color: industrial.colors.skyColor - borderColor: industrial.colors.skyColor + color: Indicators.Theme.skyColor + borderColor: Indicators.Theme.skyColor borderWidth: 3 opacity: 0.33 axisX: timeAxis @@ -251,7 +251,7 @@ ColumnLayout { titleFont.pixelSize: industrial.fontSize * 0.5 labelsVisible: false labelsFont.pixelSize: 1 - color: industrial.colors.skyColor + color: Indicators.Theme.skyColor max: statistics.maxSent } upperSeries: LineSeries { diff --git a/sources/presentation/qml/Drawer/Connection/Links/LinkListView.qml b/sources/presentation/qml/Drawer/Connection/Links/LinkListView.qml index 8032e7f6..0a277411 100644 --- a/sources/presentation/qml/Drawer/Connection/Links/LinkListView.qml +++ b/sources/presentation/qml/Drawer/Connection/Links/LinkListView.qml @@ -52,6 +52,7 @@ Item { id: addButton anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom + highlighted: true iconSource: "qrc:/ui/plus.svg" tipText: qsTr("Add Link") onClicked: if (!addMenu.visible) addMenu.open() diff --git a/sources/presentation/qml/Drawer/Connection/Links/LinkView.qml b/sources/presentation/qml/Drawer/Connection/Links/LinkView.qml index 8afeb0ce..482e40b3 100644 --- a/sources/presentation/qml/Drawer/Connection/Links/LinkView.qml +++ b/sources/presentation/qml/Drawer/Connection/Links/LinkView.qml @@ -22,30 +22,31 @@ Controls.Card { selectedLinkId = linkId; } - function toggleConnection() { - presenter.setConnected(!connected) - } - onLinkIdChanged: presenter.setLink(linkId) onDeepIn: edit() - Component.onCompleted: { - menu.addEntry(qsTr("Edit"), "qrc:/icons/edit.svg").triggered.connect(edit); - - var connectItem = menu.addEntry(); - connectItem.triggered.connect(toggleConnection); - connectItem.text = Qt.binding(function() { - return connected ? qsTr("Disconnect") : qsTr("Connect"); }); - connectItem.iconSource = Qt.binding(function() { - return connected ? "qrc:/icons/disconnect.svg" : "qrc:/icons/connect.svg"; }); - - var removeItem = menu.addEntry(qsTr("Remove"), "qrc:/icons/remove.svg"); - removeItem.iconColor = industrial.colors.negative; - removeItem.triggered.connect(presenter.remove); - } implicitWidth: grid.implicitWidth + industrial.margins * 2 implicitHeight: grid.implicitHeight + industrial.margins * 2 + menuItems: [ + Controls.MenuItem { + text: qsTr("Edit") + iconSource: "qrc:/icons/edit.svg" + onTriggered: edit() + }, + Controls.MenuItem { + text: connected ? qsTr("Disconnect") : qsTr("Connect") + iconSource: connected ? "qrc:/icons/disconnect.svg" : "qrc:/icons/connect.svg" + onTriggered: presenter.setConnected(!connected) + }, + Controls.MenuItem { + text: qsTr("Remove") + iconSource: "qrc:/icons/remove.svg" + iconColor: industrial.colors.negative + onTriggered: presenter.remove() + } + ] + Timer { running: sent interval: 100 @@ -129,13 +130,13 @@ Controls.Card { } Controls.Led { - color: sent ? industrial.colors.skyColor : industrial.colors.background + color: sent ? Indicators.Theme.skyColor : industrial.colors.background } Controls.Label { text: qsTr("Sent") + ": " + bytesSent.toFixed(1) + " " + qsTr("B/s") horizontalAlignment: Text.AlignHCenter - color: industrial.colors.skyColor + color: Indicators.Theme.skyColor Layout.fillWidth: true } } diff --git a/sources/presentation/qml/Drawer/Connection/MavLinkSettings/MavLinkSettingsView.qml b/sources/presentation/qml/Drawer/Connection/MavLinkSettings/MavLinkSettingsView.qml index 18de1069..646baaa5 100644 --- a/sources/presentation/qml/Drawer/Connection/MavLinkSettings/MavLinkSettingsView.qml +++ b/sources/presentation/qml/Drawer/Connection/MavLinkSettings/MavLinkSettingsView.qml @@ -20,11 +20,9 @@ Controls.Frame { view: mavlinkSettings } - GridLayout { + ColumnLayout { anchors.fill: parent - rowSpacing: industrial.spacing - columnSpacing: industrial.spacing - columns: 2 + spacing: industrial.spacing Controls.Label { text: qsTr("Mavlink protocol settings") @@ -37,6 +35,7 @@ Controls.Frame { labelText: qsTr("System ID") from: 0 to: 255 + flat: true Binding on value { value: sysId; when: !sysIdBox.activeFocus } onValueModified: setSysId(value) Layout.fillWidth: true @@ -47,6 +46,7 @@ Controls.Frame { labelText: qsTr("Component ID") from: 0 to: 255 + flat: true Binding on value { value: compId; when: !compIdBox.activeFocus } onValueModified: setCompId(value) Layout.fillWidth: true diff --git a/sources/presentation/qml/Drawer/Logs/LogView.qml b/sources/presentation/qml/Drawer/Logs/LogView.qml index 77d1c899..7a9d2279 100644 --- a/sources/presentation/qml/Drawer/Logs/LogView.qml +++ b/sources/presentation/qml/Drawer/Logs/LogView.qml @@ -1,6 +1,5 @@ import QtQuick 2.6 import QtQuick.Layouts 1.3 -import Industrial.JS 1.0 as JS import Industrial.Controls 1.0 as Controls import JAGCS 1.0 @@ -9,6 +8,19 @@ RowLayout { property var msg + // TODO: global helper + function pad(num, size) { + var str = num.toString(); + while (str.length < size) str = "0" + str; + return str; + } + + function formatTime(time) { + return pad(time.getHours(), 2) + ":" + + pad(time.getMinutes(), 2) + ":" + + pad(time.getSeconds(), 2); + } + LogListPresenter { id: presenter view: logView @@ -18,7 +30,7 @@ RowLayout { Controls.Label { id: timestamp anchors.verticalCenter: parent.verticalCenter - text: msg ? "[" + JS.Helper.formatTime(msg.timestamp) + "]" : "" + text: msg ? "[" + formatTime(msg.timestamp) + "]" : "" font.pixelSize: industrial.auxFontSize font.bold: true color: label.color diff --git a/sources/presentation/qml/Drawer/Planning/Missions/MissionAssignmentView.qml b/sources/presentation/qml/Drawer/Planning/Missions/MissionAssignmentView.qml index 466de236..7951ac55 100644 --- a/sources/presentation/qml/Drawer/Planning/Missions/MissionAssignmentView.qml +++ b/sources/presentation/qml/Drawer/Planning/Missions/MissionAssignmentView.qml @@ -58,6 +58,7 @@ RowLayout { model: vehicles labelText: qsTr("Assigned vehicle") textRole: "name" + flat: true onActivated: presenter.assignVehicle(vehicles[currentIndex].id) Layout.fillWidth: true } diff --git a/sources/presentation/qml/Drawer/Planning/Missions/MissionListView.qml b/sources/presentation/qml/Drawer/Planning/Missions/MissionListView.qml index 025b35f9..15ef8a12 100644 --- a/sources/presentation/qml/Drawer/Planning/Missions/MissionListView.qml +++ b/sources/presentation/qml/Drawer/Planning/Missions/MissionListView.qml @@ -52,6 +52,7 @@ Item { id: addButton anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom + highlighted: true iconSource: "qrc:/ui/plus.svg" tipText: qsTr("Add Mission") onClicked: presenter.addMission(map.centerOffsetted) diff --git a/sources/presentation/qml/Drawer/Planning/Missions/MissionView.qml b/sources/presentation/qml/Drawer/Planning/Missions/MissionView.qml index 9bdc480a..c06fd7a2 100644 --- a/sources/presentation/qml/Drawer/Planning/Missions/MissionView.qml +++ b/sources/presentation/qml/Drawer/Planning/Missions/MissionView.qml @@ -81,6 +81,7 @@ Controls.Card { Controls.TextField { id: nameEdit labelText: qsTr("Mission name") + flat: true onEditingFinished: presenter.rename(text) Layout.fillWidth: true } diff --git a/sources/presentation/qml/Drawer/Settings/Video/VideoSourceListView.qml b/sources/presentation/qml/Drawer/Settings/Video/VideoSourceListView.qml index 6873dc85..73f6afb2 100644 --- a/sources/presentation/qml/Drawer/Settings/Video/VideoSourceListView.qml +++ b/sources/presentation/qml/Drawer/Settings/Video/VideoSourceListView.qml @@ -80,6 +80,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenterOffset: parent.width / 3 anchors.bottom: parent.bottom + highlighted: true iconSource: "qrc:/ui/plus.svg" tipText: qsTr("Add video source") onClicked: if (!addMenu.visible) addMenu.open() diff --git a/sources/presentation/qml/Drawer/Settings/Video/VideoSourceView.qml b/sources/presentation/qml/Drawer/Settings/Video/VideoSourceView.qml index 81bf4da6..c10ba94e 100644 --- a/sources/presentation/qml/Drawer/Settings/Video/VideoSourceView.qml +++ b/sources/presentation/qml/Drawer/Settings/Video/VideoSourceView.qml @@ -21,19 +21,20 @@ Controls.Card { } onVideoIdChanged: presenter.setVideo(videoId) - // onDeepIn: TODO: edit video - Component.onCompleted: { - //menu.addEntry(qsTr("Edit"), "qrc:/icons/edit.svg").triggered.connect(edit); - - var removeItem = menu.addEntry(qsTr("Remove"), "qrc:/icons/remove.svg"); - removeItem.iconColor = industrial.colors.negative; - removeItem.triggered.connect(videoView.remove); - } deepEnabled: false implicitWidth: col.implicitWidth + industrial.margins * 2 implicitHeight: col.implicitHeight + industrial.margins * 2 + menuItems: [ + Controls.MenuItem { + text: qsTr("Remove") + iconSource: "qrc:/icons/remove.svg" + iconColor: industrial.colors.negative + onTriggered: videoView.remove() + } + ] + VideoSourcePresenter{ id: presenter view: videoView diff --git a/sources/presentation/qml/Drawer/Vehicles/VehicleListView.qml b/sources/presentation/qml/Drawer/Vehicles/VehicleListView.qml index e5dcebcc..1e33332f 100644 --- a/sources/presentation/qml/Drawer/Vehicles/VehicleListView.qml +++ b/sources/presentation/qml/Drawer/Vehicles/VehicleListView.qml @@ -66,6 +66,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenterOffset: parent.width / 3 anchors.bottom: parent.bottom + highlighted: true iconSource: "qrc:/ui/plus.svg" tipText: qsTr("Add Vehicle") onClicked: presenter.addVehicle() diff --git a/sources/presentation/qml/Drawer/Vehicles/VehicleView.qml b/sources/presentation/qml/Drawer/Vehicles/VehicleView.qml index dc214839..a0cfc0c8 100644 --- a/sources/presentation/qml/Drawer/Vehicles/VehicleView.qml +++ b/sources/presentation/qml/Drawer/Vehicles/VehicleView.qml @@ -18,19 +18,19 @@ Controls.Card { onTypeChanged: typeBox.currentIndex = type onVehicleIdChanged: presenter.setVehicle(vehicleId) - // onDeepIn: TODO: edit vehicle - Component.onCompleted: { - //menu.addEntry(qsTr("Edit"), "qrc:/icons/edit.svg").triggered.connect(edit); - - var removeItem = menu.addEntry(qsTr("Remove"), "qrc:/icons/remove.svg"); - removeItem.enabled = Qt.binding(function() { return vehicleId > 0 && !online; }) - removeItem.iconColor = industrial.colors.negative; - removeItem.triggered.connect(presenter.remove); - } deepEnabled: false implicitWidth: column.implicitWidth + industrial.margins * 2 implicitHeight: column.implicitHeight + industrial.margins * 2 + menuItems: [ + Controls.MenuItem { + text: qsTr("Remove") + iconSource: "qrc:/icons/remove.svg" + iconColor: industrial.colors.negative + enabled: vehicleId > 0 && !online + onTriggered: presenter.remove() + } + ] VehiclePresenter { id: presenter diff --git a/sources/presentation/qml/MainView.qml b/sources/presentation/qml/MainView.qml index 805b2077..81ab8442 100644 --- a/sources/presentation/qml/MainView.qml +++ b/sources/presentation/qml/MainView.qml @@ -39,6 +39,7 @@ Controls.ApplicationWindow { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: y + highlighted: true iconSource: "qrc:/icons/burger.svg" tipText: qsTr("Open drawer") onPressed: drawer.open() diff --git a/sources/presentation/qml/Topbar/Connection/ConnectionInfo.qml b/sources/presentation/qml/Topbar/Connection/ConnectionInfo.qml index 8bcf8ed0..26cc23b1 100644 --- a/sources/presentation/qml/Topbar/Connection/ConnectionInfo.qml +++ b/sources/presentation/qml/Topbar/Connection/ConnectionInfo.qml @@ -28,7 +28,7 @@ Controls.Popup { } Controls.Led { - color: sent ? Indicators.Theme.skyColor : Indicators.Theme.backgroundColor + color: sent ? Indicators.Theme.skyColor : industrial.colors.background } Controls.Label {