settings ux tweaks, addressable script types only

This commit is contained in:
Craig Raw 2020-07-08 15:56:59 +02:00
parent 6a5b346608
commit 765a4f4c82
5 changed files with 18 additions and 9 deletions

2
drongo

@ -1 +1 @@
Subproject commit 6135338df24589ce77584c57d470f2d8d44fa995
Subproject commit 687e235c94ef181a8de6ee1fb9cf812d6e16c672

View file

@ -31,6 +31,9 @@ public class KeystoreController extends WalletFormController implements Initiali
@FXML
private StackPane selectSourcePane;
@FXML
private ToggleGroup keystoreSourceToggleGroup;
@FXML
private Label type;
@ -71,6 +74,8 @@ public class KeystoreController extends WalletFormController implements Initiali
label.setText(keystore.getLabel());
derivation.setPromptText(getWalletForm().getWallet().getScriptType().getDefaultDerivationPath());
if(keystore.getExtendedPublicKey() != null) {
xpub.setText(keystore.getExtendedPublicKey().toString());
}
@ -105,6 +110,7 @@ public class KeystoreController extends WalletFormController implements Initiali
}
public void selectSource(ActionEvent event) {
keystoreSourceToggleGroup.selectToggle(null);
ToggleButton sourceButton = (ToggleButton)event.getSource();
KeystoreSource keystoreSource = (KeystoreSource)sourceButton.getUserData();
if(keystoreSource != KeystoreSource.SW_WATCH) {
@ -200,10 +206,13 @@ public class KeystoreController extends WalletFormController implements Initiali
@Subscribe
public void update(SettingsChangedEvent event) {
if(walletForm.getWallet().equals(event.getWallet()) && event.getType().equals(SettingsChangedEvent.Type.SCRIPT_TYPE) && !derivation.getText().isEmpty()) {
if(walletForm.getWallet().equals(event.getWallet()) && event.getType().equals(SettingsChangedEvent.Type.SCRIPT_TYPE)) {
derivation.setPromptText(event.getWallet().getScriptType().getDefaultDerivationPath());
if(!derivation.getText().isEmpty()) {
String derivationPath = derivation.getText();
derivation.setText(derivationPath + " ");
derivation.setText(derivationPath);
}
}
}
}

View file

@ -89,8 +89,8 @@ public class SettingsController extends WalletFormController implements Initiali
policyType.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, policyType) -> {
walletForm.getWallet().setPolicyType(policyType);
scriptType.setItems(FXCollections.observableArrayList(ScriptType.getScriptTypesForPolicyType(policyType)));
if(!ScriptType.getScriptTypesForPolicyType(policyType).contains(walletForm.getWallet().getScriptType())) {
scriptType.setItems(FXCollections.observableArrayList(ScriptType.getAddressableScriptTypes(policyType)));
if(!ScriptType.getAddressableScriptTypes(policyType).contains(walletForm.getWallet().getScriptType())) {
scriptType.getSelectionModel().select(policyType.getDefaultScriptType());
}

View file

@ -28,7 +28,7 @@
<TextField fx:id="label" maxWidth="160"/>
</Field>
<Field text="Master fingerprint:">
<TextField fx:id="fingerprint" maxWidth="80"/>
<TextField fx:id="fingerprint" maxWidth="80" promptText="ffffffff"/>
</Field>
<Field text="Derivation:">
<TextField fx:id="derivation" maxWidth="200"/>

View file

@ -42,7 +42,7 @@
<ComboBox fx:id="scriptType">
<items>
<FXCollections fx:factory="observableArrayList">
<ScriptType fx:constant="P2PK" />
<!-- <ScriptType fx:constant="P2PK" /> -->
<ScriptType fx:constant="P2PKH" />
<ScriptType fx:constant="P2SH" />
<ScriptType fx:constant="P2SH_P2WPKH" />