2026-02-20 18:10:59 +01:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Dialogs
|
|
|
|
|
|
|
|
|
|
import Logos.Theme
|
|
|
|
|
import Logos.Controls
|
|
|
|
|
|
|
|
|
|
Control {
|
|
|
|
|
id: root
|
|
|
|
|
|
2026-02-23 18:09:06 +01:00
|
|
|
property string configPath: ""
|
|
|
|
|
property string storePath: ""
|
2026-02-20 18:10:59 +01:00
|
|
|
property string createError: ""
|
|
|
|
|
|
|
|
|
|
signal createWallet(string configPath, string storagePath, string password)
|
|
|
|
|
|
|
|
|
|
|
2026-02-23 18:09:06 +01:00
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
function configParentFolderUrl(path) {
|
|
|
|
|
if (!path || path.length === 0) return ""
|
|
|
|
|
var p = path
|
|
|
|
|
var i = Math.max(p.lastIndexOf("/"), p.lastIndexOf("\\"))
|
|
|
|
|
if (i <= 0) return ""
|
|
|
|
|
var dir = p.substring(0, i)
|
|
|
|
|
return dir.indexOf("file://") === 0 ? dir : "file://" + dir
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-20 18:10:59 +01:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: cardColumn
|
|
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
anchors.margins: Theme.spacing.xlarge
|
|
|
|
|
spacing: Theme.spacing.large
|
|
|
|
|
|
|
|
|
|
LogosText {
|
|
|
|
|
text: qsTr("Set up LEZ Wallet")
|
|
|
|
|
font.pixelSize: Theme.typography.titleText
|
|
|
|
|
font.weight: Theme.typography.weightBold
|
|
|
|
|
color: Theme.palette.text
|
|
|
|
|
}
|
|
|
|
|
LogosText {
|
|
|
|
|
text: qsTr("Configure storage and secure with a password.")
|
|
|
|
|
font.pixelSize: Theme.typography.secondaryText
|
|
|
|
|
color: Theme.palette.textSecondary
|
|
|
|
|
Layout.topMargin: -Theme.spacing.small
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogosText {
|
|
|
|
|
text: qsTr("Storage")
|
|
|
|
|
font.pixelSize: Theme.typography.secondaryText
|
|
|
|
|
font.weight: Theme.typography.weightMedium
|
|
|
|
|
color: Theme.palette.text
|
|
|
|
|
}
|
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
spacing: Theme.spacing.small
|
2026-02-21 21:26:04 +01:00
|
|
|
LogosTextField {
|
2026-02-20 18:10:59 +01:00
|
|
|
id: storagePathField
|
2026-02-21 21:26:04 +01:00
|
|
|
Layout.fillWidth: true
|
2026-02-23 18:09:06 +01:00
|
|
|
placeholderText: qsTr("Add store path")
|
|
|
|
|
text: root.storePath
|
2026-02-20 18:10:59 +01:00
|
|
|
}
|
|
|
|
|
LogosButton {
|
|
|
|
|
text: qsTr("Browse")
|
|
|
|
|
onClicked: storageFolderDialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
LogosText {
|
2026-02-21 21:26:04 +01:00
|
|
|
text: qsTr("Config file")
|
2026-02-20 18:10:59 +01:00
|
|
|
font.pixelSize: Theme.typography.secondaryText
|
|
|
|
|
font.weight: Theme.typography.weightMedium
|
|
|
|
|
color: Theme.palette.text
|
|
|
|
|
}
|
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
spacing: Theme.spacing.small
|
2026-02-21 21:26:04 +01:00
|
|
|
LogosTextField {
|
2026-02-20 18:10:59 +01:00
|
|
|
id: configPathField
|
2026-02-21 21:26:04 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
placeholderText: qsTr("Add path to config")
|
2026-02-23 18:09:06 +01:00
|
|
|
text: root.configPath
|
2026-02-20 18:10:59 +01:00
|
|
|
}
|
|
|
|
|
LogosButton {
|
2026-02-21 21:26:04 +01:00
|
|
|
Layout.preferredHeight: configPathField.height
|
2026-02-20 18:10:59 +01:00
|
|
|
text: qsTr("Browse")
|
|
|
|
|
onClicked: configFileDialog.open()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogosText {
|
|
|
|
|
text: qsTr("Security")
|
|
|
|
|
font.pixelSize: Theme.typography.secondaryText
|
|
|
|
|
font.weight: Theme.typography.weightMedium
|
|
|
|
|
color: Theme.palette.text
|
|
|
|
|
Layout.topMargin: Theme.spacing.medium
|
|
|
|
|
}
|
2026-02-21 21:26:04 +01:00
|
|
|
LogosTextField {
|
2026-02-20 18:10:59 +01:00
|
|
|
id: passwordField
|
2026-02-21 21:26:04 +01:00
|
|
|
Layout.fillWidth: true
|
2026-02-20 18:10:59 +01:00
|
|
|
placeholderText: qsTr("Password")
|
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
|
}
|
2026-02-21 21:26:04 +01:00
|
|
|
LogosTextField {
|
2026-02-20 18:10:59 +01:00
|
|
|
id: confirmField
|
2026-02-21 21:26:04 +01:00
|
|
|
Layout.fillWidth: true
|
2026-02-20 18:10:59 +01:00
|
|
|
placeholderText: qsTr("Confirm")
|
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogosText {
|
|
|
|
|
id: errorLabel
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
font.pixelSize: Theme.typography.secondaryText
|
|
|
|
|
color: Theme.palette.error
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
visible: text.length > 0
|
|
|
|
|
text: root.createError
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogosButton {
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
text: qsTr("Create Wallet")
|
|
|
|
|
font.pixelSize: Theme.typography.secondaryText
|
|
|
|
|
onClicked: {
|
|
|
|
|
if (passwordField.text.length === 0) {
|
|
|
|
|
root.createError = qsTr("Password cannot be empty.")
|
|
|
|
|
} else if (passwordField.text !== confirmField.text) {
|
|
|
|
|
root.createError = qsTr("Passwords do not match.")
|
|
|
|
|
} else {
|
|
|
|
|
root.createError = ""
|
|
|
|
|
root.createWallet(configPathField.text, storagePathField.text, passwordField.text)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 18:09:06 +01:00
|
|
|
FileDialog {
|
2026-02-20 18:10:59 +01:00
|
|
|
id: storageFolderDialog
|
|
|
|
|
modality: Qt.NonModal
|
2026-02-23 18:09:06 +01:00
|
|
|
nameFilters: ["JSON files (*.json)"]
|
|
|
|
|
currentFolder: root.storePath ? d.configParentFolderUrl(root.storePath) : ""
|
|
|
|
|
onAccepted: storagePathField.text = selectedFile.toString().replace(/^file:\/\//, "")
|
2026-02-20 18:10:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileDialog {
|
|
|
|
|
id: configFileDialog
|
|
|
|
|
modality: Qt.NonModal
|
2026-02-23 18:09:06 +01:00
|
|
|
nameFilters: ["JSON files (*.json)"]
|
2026-04-17 00:37:17 +02:00
|
|
|
currentFolder: root.configPath ? d.configParentFolderUrl(root.configPath) : ""
|
2026-02-20 18:10:59 +01:00
|
|
|
onAccepted: {
|
|
|
|
|
if (selectedFile) configPathField.text = selectedFile.toString().replace(/^file:\/\//, "")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|