hide gap limit field for sp wallets

This commit is contained in:
Craig Raw 2026-04-23 13:53:44 +02:00
parent 1c5602aa9d
commit 0bb5e9319f
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.wallet;
import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.wallet.Wallet;
import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.control.DateStringConverter;
@ -12,6 +13,7 @@ import javafx.fxml.Initializable;
import javafx.scene.control.ComboBox;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import tornadofx.control.Field;
import javafx.util.StringConverter;
import java.net.URL;
@ -30,6 +32,9 @@ public class AdvancedController implements Initializable {
@FXML
private DatePicker birthDate;
@FXML
private Field gapLimitField;
@FXML
private IntegerSpinner gapLimit;
@ -56,6 +61,9 @@ public class AdvancedController implements Initializable {
}
});
gapLimitField.managedProperty().bind(gapLimitField.visibleProperty());
gapLimitField.setVisible(wallet.getPolicyType() != PolicyType.SINGLE_SP);
gapLimit.setValueFactory(new IntegerSpinner.ValueFactory(Wallet.DEFAULT_LOOKAHEAD, MAX_GAP_LIMIT, wallet.getGapLimit()));
gapLimit.valueProperty().addListener((observable, oldValue, newValue) -> {
if(newValue == null || newValue < Wallet.DEFAULT_LOOKAHEAD || newValue > MAX_GAP_LIMIT) {
@ -84,6 +92,7 @@ public class AdvancedController implements Initializable {
gapWarning.managedProperty().bind(gapWarning.visibleProperty());
gapWarning.setVisible(wallet.getGapLimit() >= WARNING_GAP_LIMIT);
watchLast.setPrefWidth(birthDate.getPrefWidth());
watchLast.setItems(getWatchListItems(wallet));
watchLast.setConverter(new StringConverter<>() {
@Override

View File

@ -32,7 +32,7 @@
<DatePicker editable="false" fx:id="birthDate" prefWidth="140" />
<HelpLabel helpText="The date of the earliest transaction (used to avoid scanning the entire blockchain)."/>
</Field>
<Field text="Gap limit:">
<Field fx:id="gapLimitField" text="Gap limit:">
<IntegerSpinner fx:id="gapLimit" editable="true" prefWidth="90" />
<HelpLabel helpText="Change how far ahead to look for additional transactions beyond the highest derivation with previous transaction outputs."/>
<Label fx:id="gapWarning">