diff options
Diffstat (limited to 'demo/Main.qml')
| -rw-r--r-- | demo/Main.qml | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/demo/Main.qml b/demo/Main.qml deleted file mode 100644 index 6aca201..0000000 --- a/demo/Main.qml +++ /dev/null @@ -1,173 +0,0 @@ -pragma ComponentBehavior: Bound - -import QtQuick -import QtQuick.Controls -import QtQuick.Layouts -import Xpl2 - -ApplicationWindow { - id: root - - // Set from C++ via setInitialProperties (--printheads CLI arg, default 10). - required property int demoPhCount - - height: 1200 - title: "XPL2 Demo" - visible: true - width: 900 - - Component.onCompleted: { - for (let i = 1; i <= root.demoPhCount; ++i) - phModel.append({ - "phId": i, - "versionInfo": "" - }); - } - - ListModel { - id: phModel - - } - - Connections { - function onConnectedChanged() { - debugConsole.appendLog(Xpl2Client.connected - ? "Controller connected" : - "Controller disconnected"); - } - - function onErrorOccurred(error: string) { - debugConsole.appendLog("ERROR: " + error); - } - - function onJcStatusReceived(status) { - statusPage.lastJcStatus = status; - } - - function onListeningChanged() { - debugConsole.appendLog(Xpl2Client.listening - ? "Listening on ports 9110/9111/9112" : - "Stopped listening"); - } - - function onPhStatusReceived(status) { - statusPage.lastPhStatus = status; - } - - function onPhVersionReceived(controllerId: int, printheadId: int, - mcuFirmwareVersion: string, - mcuHardwareVersion: string, - mcuFirmwareVariant: string, - fpgaFirmwareVersion: string, - fpgaHardwareVersion: string, - bootloaderVersion: string) { - for (let i = 0; i < phModel.count; ++i) { - if (phModel.get(i).phId === printheadId) { - phModel.setProperty(i, "versionInfo", - "MCU %1/%2 (%3) | FPGA %4/%5 | Boot %6".arg( - mcuFirmwareVersion).arg( - mcuHardwareVersion).arg( - mcuFirmwareVariant).arg( - fpgaFirmwareVersion).arg( - fpgaHardwareVersion).arg( - bootloaderVersion)); - break; - } - } - } - - function onShuttingDown() { - debugConsole.appendLog("SERVER SHUTTING DOWN"); - } - - function onStatusMessage(message: string) { - debugConsole.appendLog(message); - } - - target: Xpl2Client - } - - ColumnLayout { - anchors.fill: parent - spacing: 0 - - // --- Connection (always visible) --- - GroupBox { - Layout.bottomMargin: 0 - Layout.fillWidth: true - Layout.margins: 16 - title: "Connection" - - RowLayout { - anchors.fill: parent - - Label { - text: Xpl2Client.connected ? "Controller connected" : - "Waiting for controller…" - } - - Item { - Layout.fillWidth: true - } - - Button { - text: Xpl2Client.listening ? "Stop" : "Listen" - - onClicked: { - if (Xpl2Client.listening) - Xpl2Client.stopListening(); - else - Xpl2Client.startListening(); - } - } - } - } - - // --- Tab bar --- - TabBar { - id: tabBar - - Layout.fillWidth: true - Layout.leftMargin: 16 - Layout.rightMargin: 16 - - TabButton { - text: "Commands" - } - - TabButton { - text: "Status" - } - } - - // --- Swipe view --- - SwipeView { - id: swipeView - - Layout.fillHeight: true - Layout.fillWidth: true - Layout.margins: 16 - currentIndex: tabBar.currentIndex - - onCurrentIndexChanged: tabBar.currentIndex = currentIndex - - CommandsPage { - demoPhCount: root.demoPhCount - phModel: phModel - } - - StatusPage { - id: statusPage - - } - } - - // --- Debug Console --- - DebugConsole { - id: debugConsole - - Layout.fillWidth: true - Layout.preferredHeight: 160 - } - } -} |
