tools/hhtracer/Main.qml
changeset 16084 2d65bd46c92f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/hhtracer/Main.qml	Fri Jan 10 17:37:34 2025 +0100
@@ -0,0 +1,101 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Dialogs
+import QtQuick.Layouts
+
+ApplicationWindow {
+  height: 900
+  title: qsTr("Tracer")
+  visible: true
+  width: 1200
+
+  header: ToolBar {
+    RowLayout {
+      Button {
+        text: qsTr("Choose Image...")
+
+        onClicked: fileDialog.open()
+      }
+
+      Button {
+        text: qsTr("Start")
+
+        onClicked: {
+          stepTimer.start();
+        }
+      }
+
+      Button {
+        text: qsTr("Stop")
+
+        onClicked: {
+          stepTimer.stop();
+        }
+      }
+    }
+  }
+
+  FileDialog {
+    id: fileDialog
+
+    nameFilters: ["Hedgehog images (*.png)"]
+
+    onAccepted: {
+      console.log("Hello")
+      baseImage.source = selectedFile;
+      tracer.start(fileDialog.selectedFile);
+    }
+  }
+
+  Tracer {
+    id: tracer
+  }
+
+
+  Timer {
+    id: stepTimer
+
+    interval: 1500
+    repeat: true
+    running: false
+    triggeredOnStart: true
+
+    onTriggered: tracer.step()
+  }
+
+  ColumnLayout {
+    anchors.fill: parent
+
+    Image {
+      id: baseImage
+
+      Layout.fillWidth: true
+      Layout.preferredHeight: 128
+      fillMode: Image.PreserveAspectFit
+    }
+
+    GridLayout {
+      Layout.fillWidth: true
+      Layout.fillHeight: true
+      columns: 10
+
+      Repeater {
+        model: tracer.solutions
+
+        Image {
+          width: 32
+          height: 32
+          source: "file://" + modelData
+          fillMode: Image.PreserveAspectFit
+
+          Rectangle {
+            border.width: 1
+            border.color: "black"
+            color: "transparent"
+            anchors.fill: parent
+          }
+        }
+      }
+    }
+  }
+}