From 16d16de3c794a5067ac7ba8892b365d22d753413 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 20 Feb 2026 14:35:52 +0400 Subject: [PATCH] Add more qml --- src/qml/AdvancedSetup.qml | 110 +++++++++++++++++++++++ src/qml/ModeSelector.qml | 179 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 289 insertions(+) create mode 100644 src/qml/AdvancedSetup.qml create mode 100644 src/qml/ModeSelector.qml diff --git a/src/qml/AdvancedSetup.qml b/src/qml/AdvancedSetup.qml new file mode 100644 index 0000000..48dd6fc --- /dev/null +++ b/src/qml/AdvancedSetup.qml @@ -0,0 +1,110 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Logos.Theme +import Logos.Controls + +LogosStorageLayout { + id: root + + property var backend: null + + signal back + signal completed(string configJson) + + ColumnLayout { + anchors.fill: parent + anchors.margins: 40 + spacing: Theme.spacing.medium + + LogosText { + text: "Advanced Configuration" + font.pixelSize: Theme.typography.titleText + Layout.alignment: Qt.AlignHCenter + } + + LogosText { + text: "Edit the JSON configuration below, then click Validate." + font.pixelSize: Theme.typography.primaryText + Layout.alignment: Qt.AlignHCenter + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + Layout.fillWidth: true + } + + // ── JSON editor ────────────────────────────────────────────────── + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: "#1e1e1e" + radius: 8 + border.color: jsonArea.isValid ? "#3a3a3a" : "#ff0000" + border.width: 1 + + ScrollView { + anchors.fill: parent + anchors.margins: 2 + + TextArea { + id: jsonArea + font.family: "monospace" + font.pixelSize: 12 + color: "#d4d4d4" + wrapMode: Text.WrapAnywhere + background: Item {} + + property bool isValid: true + + Component.onCompleted: { + text = (root.backend && root.backend.configJson) ? root.backend.configJson : "{}" + validate() + } + + function validate() { + try { + JSON.parse(text) + isValid = true + } catch (e) { + isValid = false + } + } + + onTextChanged: validate() + } + } + } + + // ── Buttons ────────────────────────────────────────────────────── + RowLayout { + Layout.alignment: Qt.AlignHCenter + spacing: Theme.spacing.medium + + LogosStorageButton { + text: "Back" + onClicked: root.back() + } + + Rectangle { + width: 120 + height: 36 + radius: 8 + color: jsonArea.isValid ? "#4CAF50" : "#444444" + + Text { + anchors.centerIn: parent + text: "Validate" + color: "white" + font.pixelSize: 14 + font.bold: true + } + + MouseArea { + anchors.fill: parent + enabled: jsonArea.isValid + cursorShape: jsonArea.isValid ? Qt.PointingHandCursor : Qt.ArrowCursor + onClicked: root.completed(jsonArea.text) + } + } + } + } +} diff --git a/src/qml/ModeSelector.qml b/src/qml/ModeSelector.qml new file mode 100644 index 0000000..a9861b3 --- /dev/null +++ b/src/qml/ModeSelector.qml @@ -0,0 +1,179 @@ +import QtQuick +import QtQuick.Layouts +import Logos.Theme +import Logos.Controls + +LogosStorageLayout { + id: root + + signal completed(bool isGuide) + + property int selectedMode: -1 // 0 = guide, 1 = advanced + + ColumnLayout { + anchors.centerIn: parent + spacing: Theme.spacing.medium + width: 430 + + LogosText { + text: "Logos Storage" + font.pixelSize: Theme.typography.titleText + Layout.alignment: Qt.AlignHCenter + } + + LogosText { + text: "How would you like to set up your node?" + font.pixelSize: Theme.typography.primaryText + Layout.alignment: Qt.AlignHCenter + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + Layout.fillWidth: true + } + + Item { + height: Theme.spacing.medium + } + + Row { + spacing: Theme.spacing.medium + Layout.alignment: Qt.AlignHCenter + + // ── Guide card ─────────────────────────────────────────────── + Rectangle { + width: 190 + height: 230 + radius: 14 + color: root.selectedMode === 0 ? Qt.rgba(1, 1, 1, 0.08) : "transparent" + border.color: root.selectedMode === 0 ? "white" : Qt.rgba(1, 1, 1, 0.2) + border.width: root.selectedMode === 0 ? 2 : 1 + + ColumnLayout { + anchors.centerIn: parent + spacing: 14 + + // Nothing OS dot icon — crosshair/compass + Grid { + columns: 5 + spacing: 4 + Layout.alignment: Qt.AlignHCenter + + Repeater { + model: [ + 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, + 1, 1, 0, 1, 1, + 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0 + ] + Rectangle { + width: 6 + height: 6 + radius: 2 + color: "white" + opacity: modelData ? 0.9 : 0.1 + } + } + } + + Text { + text: "Guide" + color: "white" + font.pixelSize: 16 + font.bold: true + Layout.alignment: Qt.AlignHCenter + } + + Text { + text: "Step-by-step setup.\nRecommended for\nmost users." + color: Qt.rgba(1, 1, 1, 0.55) + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: 150 + wrapMode: Text.WordWrap + } + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: root.selectedMode = 0 + } + } + + // ── Advanced card ──────────────────────────────────────────── + Rectangle { + width: 190 + height: 230 + radius: 14 + color: root.selectedMode === 1 ? Qt.rgba(1, 1, 1, 0.08) : "transparent" + border.color: root.selectedMode === 1 ? "white" : Qt.rgba(1, 1, 1, 0.2) + border.width: root.selectedMode === 1 ? 2 : 1 + + ColumnLayout { + anchors.centerIn: parent + spacing: 14 + + // Nothing OS dot icon — X pattern + Grid { + columns: 5 + spacing: 4 + Layout.alignment: Qt.AlignHCenter + + Repeater { + model: [ + 1, 0, 0, 0, 1, + 0, 1, 0, 1, 0, + 0, 0, 1, 0, 0, + 0, 1, 0, 1, 0, + 1, 0, 0, 0, 1 + ] + Rectangle { + width: 6 + height: 6 + radius: 2 + color: "white" + opacity: modelData ? 0.9 : 0.1 + } + } + } + + Text { + text: "Advanced" + color: "white" + font.pixelSize: 16 + font.bold: true + Layout.alignment: Qt.AlignHCenter + } + + Text { + text: "Manual JSON\nconfiguration for\nexperienced users." + color: Qt.rgba(1, 1, 1, 0.55) + font.pixelSize: 12 + horizontalAlignment: Text.AlignHCenter + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: 150 + wrapMode: Text.WordWrap + } + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: root.selectedMode = 1 + } + } + } + + Item { + height: Theme.spacing.small + } + + LogosStorageButton { + text: "Continue" + enabled: root.selectedMode !== -1 + onClicked: root.completed(root.selectedMode === 0) + Layout.alignment: Qt.AlignHCenter + } + } +}