tools/hhtracer/Main.qml
author unC0Rr
Fri, 10 Jan 2025 17:37:34 +0100
changeset 16084 2d65bd46c92f
permissions -rw-r--r--
Start work on hedgehog tracer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16084
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     1
import QtQuick
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     2
import QtQuick.Controls
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     3
import QtQuick.Dialogs
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     4
import QtQuick.Layouts
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     5
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     6
ApplicationWindow {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     7
  height: 900
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     8
  title: qsTr("Tracer")
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
     9
  visible: true
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    10
  width: 1200
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    11
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    12
  header: ToolBar {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    13
    RowLayout {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    14
      Button {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    15
        text: qsTr("Choose Image...")
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    16
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    17
        onClicked: fileDialog.open()
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    18
      }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    19
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    20
      Button {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    21
        text: qsTr("Start")
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    22
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    23
        onClicked: {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    24
          stepTimer.start();
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    25
        }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    26
      }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    27
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    28
      Button {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    29
        text: qsTr("Stop")
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    30
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    31
        onClicked: {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    32
          stepTimer.stop();
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    33
        }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    34
      }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    35
    }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    36
  }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    37
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    38
  FileDialog {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    39
    id: fileDialog
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    40
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    41
    nameFilters: ["Hedgehog images (*.png)"]
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    42
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    43
    onAccepted: {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    44
      console.log("Hello")
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    45
      baseImage.source = selectedFile;
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    46
      tracer.start(fileDialog.selectedFile);
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    47
    }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    48
  }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    49
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    50
  Tracer {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    51
    id: tracer
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    52
  }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    53
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    54
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    55
  Timer {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    56
    id: stepTimer
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    57
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    58
    interval: 1500
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    59
    repeat: true
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    60
    running: false
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    61
    triggeredOnStart: true
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    62
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    63
    onTriggered: tracer.step()
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    64
  }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    65
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    66
  ColumnLayout {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    67
    anchors.fill: parent
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    68
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    69
    Image {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    70
      id: baseImage
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    71
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    72
      Layout.fillWidth: true
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    73
      Layout.preferredHeight: 128
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    74
      fillMode: Image.PreserveAspectFit
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    75
    }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    76
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    77
    GridLayout {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    78
      Layout.fillWidth: true
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    79
      Layout.fillHeight: true
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    80
      columns: 10
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    81
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    82
      Repeater {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    83
        model: tracer.solutions
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    84
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    85
        Image {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    86
          width: 32
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    87
          height: 32
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    88
          source: "file://" + modelData
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    89
          fillMode: Image.PreserveAspectFit
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    90
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    91
          Rectangle {
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    92
            border.width: 1
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    93
            border.color: "black"
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    94
            color: "transparent"
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    95
            anchors.fill: parent
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    96
          }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    97
        }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    98
      }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
    99
    }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
   100
  }
2d65bd46c92f Start work on hedgehog tracer
unC0Rr
parents:
diff changeset
   101
}