Browse Source

qml: wizard support for back button

patch-4
Sander van Grieken 2 years ago
parent
commit
5380b21568
  1. 2
      electrum/gui/qml/components/NewWalletWizard.qml
  2. 2
      electrum/gui/qml/components/ServerConnectWizard.qml
  3. 4
      electrum/gui/qml/components/controls/ElDialog.qml
  4. 2
      electrum/gui/qml/components/main.qml
  5. 4
      electrum/gui/qml/components/wizard/WCAutoConnect.qml
  6. 50
      electrum/gui/qml/components/wizard/Wizard.qml

2
electrum/gui/qml/components/NewWalletWizard.qml

@ -9,7 +9,7 @@ import "wizard"
Wizard { Wizard {
id: walletwizard id: walletwizard
title: qsTr('New Wallet') wizardTitle: qsTr('New Wallet')
signal walletCreated signal walletCreated

2
electrum/gui/qml/components/ServerConnectWizard.qml

@ -7,7 +7,7 @@ import "wizard"
Wizard { Wizard {
id: serverconnectwizard id: serverconnectwizard
title: qsTr('How do you want to connect to a server?') wizardTitle: qsTr('Network configuration')
enter: null // disable transition enter: null // disable transition

4
electrum/gui/qml/components/controls/ElDialog.qml

@ -8,6 +8,10 @@ Dialog {
property bool allowClose: true property bool allowClose: true
property string iconSource property string iconSource
function doClose() {
close()
}
onOpenedChanged: { onOpenedChanged: {
if (opened) { if (opened) {
app.activeDialogs.push(abstractdialog) app.activeDialogs.push(abstractdialog)

2
electrum/gui/qml/components/main.qml

@ -276,7 +276,7 @@ ApplicationWindow
if (activeDialogs.length > 0) { if (activeDialogs.length > 0) {
var activeDialog = activeDialogs[activeDialogs.length - 1] var activeDialog = activeDialogs[activeDialogs.length - 1]
if (activeDialog.allowClose) { if (activeDialog.allowClose) {
activeDialog.close() activeDialog.doClose()
} else { } else {
console.log('dialog disallowed close') console.log('dialog disallowed close')
} }

4
electrum/gui/qml/components/wizard/WCAutoConnect.qml

@ -13,6 +13,10 @@ WizardComponent {
ColumnLayout { ColumnLayout {
width: parent.width width: parent.width
Label {
text: qsTr('How do you want to connect to a server?')
}
InfoTextArea { InfoTextArea {
text: qsTr('Electrum communicates with remote servers to get information about your transactions and addresses. The servers all fulfill the same purpose only differing in hardware. In most cases you simply want to let Electrum pick one at random. However if you prefer feel free to select a server manually.') text: qsTr('Electrum communicates with remote servers to get information about your transactions and addresses. The servers all fulfill the same purpose only differing in hardware. In most cases you simply want to let Electrum pick one at random. However if you prefer feel free to select a server manually.')
Layout.fillWidth: true Layout.fillWidth: true

50
electrum/gui/qml/components/wizard/Wizard.qml

@ -2,7 +2,9 @@ import QtQuick 2.6
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 2.1 import QtQuick.Controls 2.1
Dialog { import "../controls"
ElDialog {
id: wizard id: wizard
modal: true modal: true
focus: true focus: true
@ -10,10 +12,22 @@ Dialog {
width: parent.width width: parent.width
height: parent.height height: parent.height
title: wizardTitle + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '')
iconSource: '../../../icons/electrum.png'
property string wizardTitle
property var wizard_data property var wizard_data
property alias pages: pages property alias pages: pages
property QtObject wiz property QtObject wiz
function doClose() {
if (pages.currentIndex == 0)
reject()
else
pages.prev()
}
function _setWizardData(wdata) { function _setWizardData(wdata) {
wizard_data = {} wizard_data = {}
Object.assign(wizard_data, wdata) // deep copy Object.assign(wizard_data, wdata) // deep copy
@ -32,7 +46,6 @@ Dialog {
} }
var url = Qt.resolvedUrl(wiz.viewToComponent(view)) var url = Qt.resolvedUrl(wiz.viewToComponent(view))
console.log(url)
var comp = Qt.createComponent(url) var comp = Qt.createComponent(url)
if (comp.status == Component.Error) { if (comp.status == Component.Error) {
console.log(comp.errorString()) console.log(comp.errorString())
@ -156,39 +169,6 @@ Dialog {
} }
} }
header: GridLayout {
columns: 2
rowSpacing: 0
Image {
source: "../../../icons/electrum.png"
Layout.preferredWidth: constants.iconSizeXLarge
Layout.preferredHeight: constants.iconSizeXLarge
Layout.leftMargin: constants.paddingMedium
Layout.topMargin: constants.paddingMedium
Layout.bottomMargin: constants.paddingMedium
}
Label {
text: title + (pages.currentItem.title ? ' - ' + pages.currentItem.title : '')
elide: Label.ElideRight
Layout.fillWidth: true
topPadding: constants.paddingXLarge
bottomPadding: constants.paddingXLarge
font.bold: true
font.pixelSize: constants.fontSizeMedium
}
Rectangle {
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.leftMargin: constants.paddingTiny
Layout.rightMargin: constants.paddingTiny
height: 1
color: Qt.rgba(0,0,0,0.5)
}
}
// make clicking the dialog background move the scope away from textedit fields // make clicking the dialog background move the scope away from textedit fields
// so the keyboard goes away // so the keyboard goes away
// TODO: here it works on desktop, but not android. hmm. // TODO: here it works on desktop, but not android. hmm.

Loading…
Cancel
Save