Rearrange UI so messages are per-vehicle.
This commit is contained in:
@@ -71,89 +71,77 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
Layouts.ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Kirigami.InlineMessage { //TODO:connect to code to detect car alerts.
|
||||
Layouts.Layout.fillWidth: true
|
||||
Layouts.Layout.leftMargin: 10
|
||||
Layouts.Layout.rightMargin: 10
|
||||
z: 9997
|
||||
type: Kirigami.MessageType.Information
|
||||
id: infoMessage
|
||||
showCloseButton: true
|
||||
}
|
||||
Kirigami.CardsListView {
|
||||
anchors.fill: parent
|
||||
id: vehicleView
|
||||
model: vehicleModel
|
||||
delegate: Kirigami.Card {
|
||||
id: card
|
||||
banner {
|
||||
title: name
|
||||
}
|
||||
header: Row{
|
||||
topPadding: 10.0
|
||||
rightPadding: 10.0
|
||||
leftPadding: 10.0
|
||||
layoutDirection: Qt.RightToLeft
|
||||
spacing: 5
|
||||
Controls.Label {
|
||||
text: vin
|
||||
visible: root.wideScreen && mainPage.width > 550
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Image {
|
||||
id: vinIcon
|
||||
source: "qrc:/license.svg"
|
||||
sourceSize.width: 32
|
||||
sourceSize.height: 32
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
MouseArea {
|
||||
id: vinMouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: vinIcon
|
||||
}
|
||||
Controls.ToolTip {
|
||||
id: vinTip
|
||||
text: vin
|
||||
visible: vinMouse.containsMouse
|
||||
}
|
||||
}
|
||||
}
|
||||
contentItem: Item{
|
||||
implicitHeight: Kirigami.Units.gridUnit * 4
|
||||
Layouts.ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
text: maker + " " + vmodel
|
||||
level: 2
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: year
|
||||
level: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Examine Logs")
|
||||
iconName: "edit-find"
|
||||
onTriggered: {
|
||||
router.navigateToRoute(["main", {"route": "servicerecords", "data": {"id": id, "name": name}}]);
|
||||
}
|
||||
}
|
||||
]
|
||||
hiddenActions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Delete")
|
||||
iconName: "edit-delete"
|
||||
onTriggered: {
|
||||
vehicleModel.removeVehicle(index);
|
||||
}
|
||||
}
|
||||
]
|
||||
Kirigami.CardsListView {
|
||||
anchors.fill: parent
|
||||
id: vehicleView
|
||||
model: vehicleModel
|
||||
delegate: Kirigami.Card {
|
||||
id: card
|
||||
banner {
|
||||
title: name
|
||||
}
|
||||
Controls.ScrollBar.vertical: Controls.ScrollBar {}
|
||||
}
|
||||
header: Row{
|
||||
topPadding: 10.0
|
||||
rightPadding: 10.0
|
||||
leftPadding: 10.0
|
||||
layoutDirection: Qt.RightToLeft
|
||||
spacing: 5
|
||||
Controls.Label {
|
||||
text: vin
|
||||
visible: root.wideScreen && mainPage.width > 550
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Image {
|
||||
id: vinIcon
|
||||
source: "qrc:/license.svg"
|
||||
sourceSize.width: 32
|
||||
sourceSize.height: 32
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
MouseArea {
|
||||
id: vinMouse
|
||||
hoverEnabled: true
|
||||
anchors.fill: vinIcon
|
||||
}
|
||||
Controls.ToolTip {
|
||||
id: vinTip
|
||||
text: vin
|
||||
visible: vinMouse.containsMouse
|
||||
}
|
||||
}
|
||||
}
|
||||
contentItem: Item{
|
||||
implicitHeight: Kirigami.Units.gridUnit * 4
|
||||
Layouts.ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
text: maker + " " + vmodel
|
||||
level: 2
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: year
|
||||
level: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Examine Logs")
|
||||
iconName: "edit-find"
|
||||
onTriggered: {
|
||||
router.navigateToRoute(["main", {"route": "servicerecords", "data": {"id": id, "name": name}}]);
|
||||
}
|
||||
}
|
||||
]
|
||||
hiddenActions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Delete")
|
||||
iconName: "edit-delete"
|
||||
onTriggered: {
|
||||
vehicleModel.removeVehicle(index);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Controls.ScrollBar.vertical: Controls.ScrollBar {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,46 +272,61 @@ Kirigami.ApplicationWindow {
|
||||
router.pushRoute({"route": "addrecord", "data": serviceId});
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: serviceView
|
||||
model: recordModel
|
||||
delegate: Kirigami.SwipeListItem {
|
||||
contentItem: Layouts.ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
text: serviceprovider
|
||||
level: 2
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: servicetypename
|
||||
level: 2
|
||||
}
|
||||
Controls.Label {
|
||||
text: new Date(servicedate).toLocaleDateString(Qt.locale())
|
||||
}
|
||||
Row {
|
||||
Image {
|
||||
source: "qrc:/speed.svg"
|
||||
sourceSize.width: 16
|
||||
sourceSize.height: 16
|
||||
Layouts.ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Kirigami.InlineMessage {
|
||||
Layouts.Layout.fillWidth: true
|
||||
Layouts.Layout.leftMargin: 10
|
||||
Layouts.Layout.rightMargin: 10
|
||||
z: 9997
|
||||
type: Kirigami.MessageType.Information
|
||||
id: oilMessage
|
||||
showCloseButton: false
|
||||
Component.onCompleted: {
|
||||
//TODO: check if oil change is needed.
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: serviceView
|
||||
model: recordModel
|
||||
delegate: Kirigami.SwipeListItem {
|
||||
contentItem: Layouts.ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
text: serviceprovider
|
||||
level: 2
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: servicetypename
|
||||
level: 2
|
||||
}
|
||||
Controls.Label {
|
||||
text: miles
|
||||
text: new Date(servicedate).toLocaleDateString(Qt.locale())
|
||||
}
|
||||
Row {
|
||||
Image {
|
||||
source: "qrc:/speed.svg"
|
||||
sourceSize.width: 16
|
||||
sourceSize.height: 16
|
||||
}
|
||||
Controls.Label {
|
||||
text: miles
|
||||
}
|
||||
}
|
||||
Controls.Label {
|
||||
text: notes
|
||||
}
|
||||
}
|
||||
Controls.Label {
|
||||
text: notes
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Remove")
|
||||
iconName: "edit-delete"
|
||||
onTriggered: {
|
||||
recordModel.removeRecord(index);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Remove")
|
||||
iconName: "edit-delete"
|
||||
onTriggered: {
|
||||
recordModel.removeRecord(index);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,6 +434,7 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
if(milesField.acceptableInput) {
|
||||
recordModel.addNewRecord(providerField.text, typeField.currentValue, typeText, dateObj.toISOString(), parseInt(milesField.text), notesField.text);
|
||||
//TODO: check if emit signal to car warnings.
|
||||
router.popRoute();
|
||||
} else {
|
||||
formError.text = qsTr("Invalid number of miles.");
|
||||
|
||||
Reference in New Issue
Block a user