From 4b4741b24be756fb37fb4af53a1f7bc6bd829a3a Mon Sep 17 00:00:00 2001 From: Arnaud Date: Mon, 16 Feb 2026 15:30:58 +0400 Subject: [PATCH] Add to repo --- src/qml/OnBoarding.qml | 154 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 src/qml/OnBoarding.qml diff --git a/src/qml/OnBoarding.qml b/src/qml/OnBoarding.qml new file mode 100644 index 0000000..70e7de8 --- /dev/null +++ b/src/qml/OnBoarding.qml @@ -0,0 +1,154 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Layouts +import Logos.DesignSystem +import Logos.Controls + +Rectangle { + id: root + width: 600 + height: 400 + color: Theme.palette.background + + property int discoveryPort: 8090 + property string dataDir: ".storage/data-dir" + property var backend: mockBackend + signal completed + + QtObject { + id: mockBackend + + function validateDataDir(path) { + return path != "error" + } + } + + ColumnLayout { + anchors.centerIn: parent + spacing: Theme.spacing.medium + width: 400 + + LogosText { + id: titleText + font.pixelSize: Theme.typography.headerText + text: "Logos Storage" + // anchors.verticalCenter: parent.verticalCenter + } + + ColumnLayout { + id: discoveryPortColumn + spacing: Theme.spacing.tiny + Layout.fillWidth: true + + LogosText { + text: "Discovery port" + font.pixelSize: Theme.typography.secondaryText + color: Theme.palette.text + } + + TextField { + property bool isValid: acceptableInput && text.length > 0 + + id: discoveryPortTextField + placeholderText: "Enter the discovery port" + placeholderTextColor: Theme.palette.textPlaceholder + color: acceptableInput ? Theme.palette.text : Theme.palette.error + selectByMouse: true + text: root.discoveryPort + padding: 8 + validator: IntValidator { + bottom: 1 + top: 65535 + } + onTextChanged: { + if (isValid) { + root.discoveryPort = parseInt(text) + } + } + background: Rectangle { + Rectangle { + anchors.fill: parent + color: Theme.palette.backgroundSecondary + } + + // Border bottom + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: discoveryPortTextField.isValid ? Theme.palette.textMuted : Theme.palette.error + } + } + } + } + + ColumnLayout { + spacing: Theme.spacing.tiny + Layout.fillWidth: true + + LogosText { + text: "Data dir" + } + + RowLayout { + spacing: Theme.spacing.tiny + + TextField { + property bool isValid: true + + id: dataDirTextField + padding: 8 + placeholderText: "Enter the data dir" + placeholderTextColor: Theme.palette.textPlaceholder + color: isValid ? Theme.palette.text : Theme.palette.error + selectByMouse: true + text: root.dataDir + Layout.fillWidth: true + background: Rectangle { + Rectangle { + anchors.fill: parent + color: Theme.palette.backgroundSecondary + } + + // Border bottom + Rectangle { + anchors.bottom: parent.bottom + width: parent.width + height: 1 + color: dataDirTextField.isValid ? Theme.palette.textMuted : Theme.palette.error + } + } + onTextChanged: { + if (text.length > 0) { + isValid = root.backend.validateDataDir(text) + } else { + isValid = false + } + + root.dataDir = text + } + } + + Button { + text: "Choose" + onClicked: folderDialog.open() + } + } + + FolderDialog { + id: folderDialog + onAccepted: { + dataDirTextField.text = selectedFolder + } + } + } + + Button { + text: "Next" + enabled: discoveryPortTextField.acceptableInput + && dataDirTextField.isValid + onClicked: root.completed() + } + } +}