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 @FXML
private StackPane selectSourcePane; private StackPane selectSourcePane;
@FXML
private ToggleGroup keystoreSourceToggleGroup;
@FXML @FXML
private Label type; private Label type;
@ -71,6 +74,8 @@ public class KeystoreController extends WalletFormController implements Initiali
label.setText(keystore.getLabel()); label.setText(keystore.getLabel());
derivation.setPromptText(getWalletForm().getWallet().getScriptType().getDefaultDerivationPath());
if(keystore.getExtendedPublicKey() != null) { if(keystore.getExtendedPublicKey() != null) {
xpub.setText(keystore.getExtendedPublicKey().toString()); xpub.setText(keystore.getExtendedPublicKey().toString());
} }
@ -105,6 +110,7 @@ public class KeystoreController extends WalletFormController implements Initiali
} }
public void selectSource(ActionEvent event) { public void selectSource(ActionEvent event) {
keystoreSourceToggleGroup.selectToggle(null);
ToggleButton sourceButton = (ToggleButton)event.getSource(); ToggleButton sourceButton = (ToggleButton)event.getSource();
KeystoreSource keystoreSource = (KeystoreSource)sourceButton.getUserData(); KeystoreSource keystoreSource = (KeystoreSource)sourceButton.getUserData();
if(keystoreSource != KeystoreSource.SW_WATCH) { if(keystoreSource != KeystoreSource.SW_WATCH) {
@ -200,10 +206,13 @@ public class KeystoreController extends WalletFormController implements Initiali
@Subscribe @Subscribe
public void update(SettingsChangedEvent event) { 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(); String derivationPath = derivation.getText();
derivation.setText(derivationPath + " "); derivation.setText(derivationPath + " ");
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) -> { policyType.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, policyType) -> {
walletForm.getWallet().setPolicyType(policyType); walletForm.getWallet().setPolicyType(policyType);
scriptType.setItems(FXCollections.observableArrayList(ScriptType.getScriptTypesForPolicyType(policyType))); scriptType.setItems(FXCollections.observableArrayList(ScriptType.getAddressableScriptTypes(policyType)));
if(!ScriptType.getScriptTypesForPolicyType(policyType).contains(walletForm.getWallet().getScriptType())) { if(!ScriptType.getAddressableScriptTypes(policyType).contains(walletForm.getWallet().getScriptType())) {
scriptType.getSelectionModel().select(policyType.getDefaultScriptType()); scriptType.getSelectionModel().select(policyType.getDefaultScriptType());
} }

View file

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

View file

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