Skip to content

Commit

Permalink
Indicators and pallete fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MishkaRogachev committed Mar 3, 2019
1 parent 2b4b599 commit 51bf08d
Show file tree
Hide file tree
Showing 22 changed files with 97 additions and 60 deletions.
2 changes: 1 addition & 1 deletion sources/presentation/qml/Common/Info.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BaseInstrument {
LineSeries {
axisX: timeAxis
axisY: valueAxis
color: Indicators.Theme.positive
color: Indicators.Theme.positiveColor

VXYModelMapper {
xColumn: 0
Expand All @@ -69,7 +69,7 @@ BaseInstrument {
LineSeries {
axisX: timeAxis
axisY: valueAxis
color: Indicators.Theme.caution
color: Indicators.Theme.cautionColor

VXYModelMapper {
xColumn: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
12 changes: 10 additions & 2 deletions sources/presentation/qml/Drawer/Connection/Links/EndpointView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
41 changes: 21 additions & 20 deletions sources/presentation/qml/Drawer/Connection/Links/LinkView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 14 additions & 2 deletions sources/presentation/qml/Drawer/Logs/LogView.qml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ RowLayout {
model: vehicles
labelText: qsTr("Assigned vehicle")
textRole: "name"
flat: true
onActivated: presenter.assignVehicle(vehicles[currentIndex].id)
Layout.fillWidth: true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Controls.Card {
Controls.TextField {
id: nameEdit
labelText: qsTr("Mission name")
flat: true
onEditingFinished: presenter.rename(text)
Layout.fillWidth: true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 9 additions & 9 deletions sources/presentation/qml/Drawer/Vehicles/VehicleView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sources/presentation/qml/MainView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 51bf08d

Please sign in to comment.