Browse Source

qml: remove ready signal hack, wizard_data now available at WizardComponent construction time

patch-4
Sander van Grieken 2 years ago
parent
commit
97254bb0ed
  1. 3
      electrum/gui/qml/components/wizard/WCConfirmSeed.qml
  2. 5
      electrum/gui/qml/components/wizard/WCCosignerKeystore.qml
  3. 5
      electrum/gui/qml/components/wizard/WCCosignerSeed.qml
  4. 4
      electrum/gui/qml/components/wizard/WCCreateSeed.qml
  5. 9
      electrum/gui/qml/components/wizard/WCHaveSeed.qml
  6. 5
      electrum/gui/qml/components/wizard/WCShowMasterPubkey.qml
  7. 9
      electrum/gui/qml/components/wizard/Wizard.qml

3
electrum/gui/qml/components/wizard/WCConfirmSeed.qml

@ -52,8 +52,7 @@ WizardComponent {
} }
} }
onReadyChanged: { Component.onCompleted: {
if (ready)
customwordstext.visible = wizard_data['seed_extend'] customwordstext.visible = wizard_data['seed_extend']
} }
} }

5
electrum/gui/qml/components/wizard/WCCosignerKeystore.qml

@ -40,10 +40,7 @@ WizardComponent {
} }
} }
onReadyChanged: { Component.onCompleted: {
if (!ready)
return
participants = wizard_data['multisig_participants'] participants = wizard_data['multisig_participants']
// cosigner index is determined here and put on the wizard_data dict in apply() // cosigner index is determined here and put on the wizard_data dict in apply()

5
electrum/gui/qml/components/wizard/WCCosignerSeed.qml

@ -23,10 +23,7 @@ WCHaveSeed {
wizard_data['cosigner_seed_extra_words'] = seed_extra_words wizard_data['cosigner_seed_extra_words'] = seed_extra_words
} }
onReadyChanged: { Component.onCompleted: {
if (!ready)
return
participants = wizard_data['multisig_participants'] participants = wizard_data['multisig_participants']
cosigner = wizard_data['multisig_current_cosigner'] cosigner = wizard_data['multisig_current_cosigner']
} }

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

@ -76,9 +76,7 @@ WizardComponent {
} }
} }
onReadyChanged: { Component.onCompleted: {
if (!ready)
return
bitcoin.generate_seed(wizard_data['seed_type']) bitcoin.generate_seed(wizard_data['seed_type'])
} }

9
electrum/gui/qml/components/wizard/WCHaveSeed.qml

@ -168,14 +168,9 @@ WizardComponent {
} }
Component.onCompleted: { Component.onCompleted: {
setSeedTypeHelpText()
}
onReadyChanged: {
if (!ready)
return
if (wizard_data['wallet_type'] == '2fa') if (wizard_data['wallet_type'] == '2fa')
root.is2fa = true root.is2fa = true
setSeedTypeHelpText()
} }
} }

5
electrum/gui/qml/components/wizard/WCShowMasterPubkey.qml

@ -52,10 +52,7 @@ WizardComponent {
id: bitcoin id: bitcoin
} }
onReadyChanged: { Component.onCompleted: {
if (!ready)
return
if (wizard_data['seed_variant'] == 'electrum') { if (wizard_data['seed_variant'] == 'electrum') {
masterPubkey = bitcoin.getMultisigMasterPubkey(wizard_data['seed_variant'], wizard_data['seed'], wizard_data['seed_extra_words']) masterPubkey = bitcoin.getMultisigMasterPubkey(wizard_data['seed_variant'], wizard_data['seed'], wizard_data['seed_extra_words'])
} else { } else {

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

@ -38,7 +38,11 @@ Dialog {
console.log(comp.errorString()) console.log(comp.errorString())
return null return null
} }
var page = comp.createObject(pages)
// make a deepcopy of wdata and pass it to the component
var wdata_copy={}
Object.assign(wdata_copy, wdata)
var page = comp.createObject(pages, {wizard_data: wdata_copy})
page.validChanged.connect(function() { page.validChanged.connect(function() {
pages.pagevalid = page.valid pages.pagevalid = page.valid
} ) } )
@ -58,8 +62,7 @@ Dialog {
var wdata = wiz.prev() var wdata = wiz.prev()
console.log('prev view data: ' + JSON.stringify(wdata)) console.log('prev view data: ' + JSON.stringify(wdata))
}) })
Object.assign(page.wizard_data, wdata) // deep copy
page.ready = true // signal page it can access wizard_data
pages.pagevalid = page.valid pages.pagevalid = page.valid
pages.lastpage = page.last pages.lastpage = page.last

Loading…
Cancel
Save