GUI Show post decoding info
This commit is contained in:
+152
-37
@@ -1,4 +1,10 @@
|
||||
import { Button, LineEdit, CheckBox, Spinner, GridBox, VerticalBox, HorizontalBox } from "std-widgets.slint";
|
||||
import { Button, LineEdit, CheckBox, Spinner, GridBox, VerticalBox, HorizontalBox, ListView, ScrollView, StandardTableView } from "std-widgets.slint";
|
||||
|
||||
export struct ResultEntry {
|
||||
is-header: bool,
|
||||
is-new: bool,
|
||||
label: string,
|
||||
}
|
||||
|
||||
export component MainWindow inherits Window {
|
||||
title: "Sane Vector Log Decoder";
|
||||
@@ -12,11 +18,13 @@ export component MainWindow inherits Window {
|
||||
in-out property <bool> laps;
|
||||
in-out property <bool> busy;
|
||||
in-out property <string> status;
|
||||
in-out property <bool> has-results;
|
||||
|
||||
callback browse-dbc();
|
||||
callback browse-asc();
|
||||
callback browse-output();
|
||||
callback decode();
|
||||
callback open-results();
|
||||
|
||||
VerticalBox {
|
||||
padding: 12px;
|
||||
@@ -26,48 +34,21 @@ export component MainWindow inherits Window {
|
||||
spacing: 8px;
|
||||
|
||||
Row {
|
||||
Text {
|
||||
text: "DBC file:";
|
||||
vertical-alignment: center;
|
||||
}
|
||||
LineEdit {
|
||||
read-only: true;
|
||||
text: root.dbc-path;
|
||||
}
|
||||
Button {
|
||||
text: "Browse...";
|
||||
clicked => { root.browse-dbc(); }
|
||||
}
|
||||
Text { text: "DBC file:"; vertical-alignment: center; }
|
||||
LineEdit { read-only: true; text: root.dbc-path; }
|
||||
Button { text: "Browse..."; clicked => { root.browse-dbc(); } }
|
||||
}
|
||||
|
||||
Row {
|
||||
Text {
|
||||
text: "ASC file(s):";
|
||||
vertical-alignment: center;
|
||||
}
|
||||
LineEdit {
|
||||
read-only: true;
|
||||
text: root.asc-label;
|
||||
}
|
||||
Button {
|
||||
text: "Browse...";
|
||||
clicked => { root.browse-asc(); }
|
||||
}
|
||||
Text { text: "ASC file(s):"; vertical-alignment: center; }
|
||||
LineEdit { read-only: true; text: root.asc-label; }
|
||||
Button { text: "Browse..."; clicked => { root.browse-asc(); } }
|
||||
}
|
||||
|
||||
Row {
|
||||
Text {
|
||||
text: "Output dir:";
|
||||
vertical-alignment: center;
|
||||
}
|
||||
LineEdit {
|
||||
read-only: true;
|
||||
text: root.output-dir;
|
||||
}
|
||||
Button {
|
||||
text: "Browse...";
|
||||
clicked => { root.browse-output(); }
|
||||
}
|
||||
Text { text: "Output dir:"; vertical-alignment: center; }
|
||||
LineEdit { read-only: true; text: root.output-dir; }
|
||||
Button { text: "Browse..."; clicked => { root.browse-output(); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +76,11 @@ export component MainWindow inherits Window {
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
if root.has-results: Button {
|
||||
text: "Show results";
|
||||
clicked => { root.open-results(); }
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Decode!";
|
||||
enabled: !root.busy
|
||||
@@ -106,3 +92,132 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component ResultsWindow inherits Window {
|
||||
title: "Decode results";
|
||||
preferred-width: 900px;
|
||||
preferred-height: 520px;
|
||||
|
||||
in property <[ResultEntry]> entries;
|
||||
in-out property <int> selected-index: -1;
|
||||
|
||||
in property <string> sel-label;
|
||||
in property <string> sel-date;
|
||||
in property <int> sel-unknown-count;
|
||||
in property <int> sel-error-count;
|
||||
in property <string> sel-unknown-ids;
|
||||
in property <[[StandardListViewItem]]> sel-error-rows;
|
||||
in property <string> sel-runtime-stats;
|
||||
|
||||
callback select(int);
|
||||
|
||||
HorizontalBox {
|
||||
padding: 8px;
|
||||
spacing: 8px;
|
||||
|
||||
Rectangle {
|
||||
width: 280px;
|
||||
border-width: 1px;
|
||||
border-color: #cccccc;
|
||||
|
||||
ListView {
|
||||
for entry[i] in root.entries: Rectangle {
|
||||
height: 26px;
|
||||
background: i == root.selected-index ? #3a78d8 : transparent;
|
||||
|
||||
TouchArea {
|
||||
clicked => { root.select(i); }
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: entry.is-header ? 6px : 24px;
|
||||
padding-right: 6px;
|
||||
spacing: 6px;
|
||||
|
||||
Text {
|
||||
text: entry.label;
|
||||
font-weight: entry.is-header ? 700 : 400;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
overflow: elide;
|
||||
}
|
||||
|
||||
if entry.is-header && entry.is-new: Rectangle {
|
||||
background: #2ecc71;
|
||||
border-radius: 3px;
|
||||
width: 38px;
|
||||
height: 16px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
Text {
|
||||
text: "NEW";
|
||||
color: white;
|
||||
font-size: 10px;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VerticalBox {
|
||||
padding: 0px;
|
||||
spacing: 6px;
|
||||
horizontal-stretch: 1;
|
||||
|
||||
Text {
|
||||
text: root.selected-index >= 0 ? root.sel-label : "Select an ASC file on the left.";
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
if root.selected-index >= 0: Text {
|
||||
text: "Date: " + root.sel-date;
|
||||
}
|
||||
|
||||
if root.selected-index >= 0: Text {
|
||||
text: "Unknown IDs: " + root.sel-unknown-count
|
||||
+ " Error frames: " + root.sel-error-count;
|
||||
}
|
||||
|
||||
if root.selected-index >= 0: Text {
|
||||
text: "Unknown CAN IDs";
|
||||
font-weight: 700;
|
||||
}
|
||||
if root.selected-index >= 0: Rectangle {
|
||||
border-width: 1px;
|
||||
border-color: #cccccc;
|
||||
height: 90px;
|
||||
ScrollView {
|
||||
Text {
|
||||
text: root.sel-unknown-ids;
|
||||
wrap: word-wrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if root.selected-index >= 0: Text {
|
||||
text: "Error frames";
|
||||
font-weight: 700;
|
||||
}
|
||||
if root.selected-index >= 0: StandardTableView {
|
||||
vertical-stretch: 1;
|
||||
columns: [
|
||||
{ title: "Timestamp" },
|
||||
{ title: "Channel" },
|
||||
{ title: "Data (binary)" },
|
||||
];
|
||||
rows: root.sel-error-rows;
|
||||
}
|
||||
|
||||
if root.selected-index >= 0: Text {
|
||||
text: "Runtime stats";
|
||||
font-weight: 700;
|
||||
}
|
||||
if root.selected-index >= 0: Text {
|
||||
text: root.sel-runtime-stats;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user