This commit is contained in:
Kyle 🐆 2025-11-05 14:26:34 +07:00 committed by GitHub
commit 90e9587bdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 232 additions and 32 deletions

View file

@ -149,6 +149,9 @@ public class AppController implements Initializable {
private CheckMenuItem hideEmptyUsedAddresses; private CheckMenuItem hideEmptyUsedAddresses;
private static final BooleanProperty hideEmptyUsedAddressesProperty = new SimpleBooleanProperty(); private static final BooleanProperty hideEmptyUsedAddressesProperty = new SimpleBooleanProperty();
@FXML
private CheckMenuItem hideAmounts;
@FXML @FXML
private CheckMenuItem useHdCameraResolution; private CheckMenuItem useHdCameraResolution;
private static final BooleanProperty useHdCameraResolutionProperty = new SimpleBooleanProperty(); private static final BooleanProperty useHdCameraResolutionProperty = new SimpleBooleanProperty();
@ -384,6 +387,7 @@ public class AppController implements Initializable {
openWalletsInNewWindows.selectedProperty().bindBidirectional(openWalletsInNewWindowsProperty); openWalletsInNewWindows.selectedProperty().bindBidirectional(openWalletsInNewWindowsProperty);
hideEmptyUsedAddressesProperty.set(Config.get().isHideEmptyUsedAddresses()); hideEmptyUsedAddressesProperty.set(Config.get().isHideEmptyUsedAddresses());
hideEmptyUsedAddresses.selectedProperty().bindBidirectional(hideEmptyUsedAddressesProperty); hideEmptyUsedAddresses.selectedProperty().bindBidirectional(hideEmptyUsedAddressesProperty);
hideAmounts.setSelected(Config.get().isHideAmounts());
useHdCameraResolutionProperty.set(Config.get().getWebcamResolution() == null || Config.get().getWebcamResolution().isWidescreenAspect()); useHdCameraResolutionProperty.set(Config.get().getWebcamResolution() == null || Config.get().getWebcamResolution().isWidescreenAspect());
useHdCameraResolution.selectedProperty().bindBidirectional(useHdCameraResolutionProperty); useHdCameraResolution.selectedProperty().bindBidirectional(useHdCameraResolutionProperty);
mirrorCameraImageProperty.set(Config.get().isMirrorCapture()); mirrorCameraImageProperty.set(Config.get().isMirrorCapture());
@ -947,6 +951,13 @@ public class AppController implements Initializable {
EventManager.get().post(new HideEmptyUsedAddressesStatusEvent(item.isSelected())); EventManager.get().post(new HideEmptyUsedAddressesStatusEvent(item.isSelected()));
} }
public void hideAmounts(ActionEvent event) {
CheckMenuItem item = (CheckMenuItem)event.getSource();
Config.get().setHideAmounts(item.isSelected());
EventManager.get().post(new HideAmountsStatusEvent(item.isSelected()));
}
public void useHdCameraResolution(ActionEvent event) { public void useHdCameraResolution(ActionEvent event) {
CheckMenuItem item = (CheckMenuItem)event.getSource(); CheckMenuItem item = (CheckMenuItem)event.getSource();
if(Config.get().getWebcamResolution().isStandardAspect() && item.isSelected()) { if(Config.get().getWebcamResolution().isStandardAspect() && item.isSelected()) {
@ -3124,6 +3135,11 @@ public class AppController implements Initializable {
hideEmptyUsedAddresses.setSelected(event.isHideEmptyUsedAddresses()); hideEmptyUsedAddresses.setSelected(event.isHideEmptyUsedAddresses());
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
hideAmounts.setSelected(event.isHideAmounts());
}
@Subscribe @Subscribe
public void requestOpenWallets(RequestOpenWalletsEvent event) { public void requestOpenWallets(RequestOpenWalletsEvent event) {
EventManager.get().post(new OpenWalletsEvent(tabs.getScene().getWindow(), getOpenWalletTabData())); EventManager.get().post(new OpenWalletsEvent(tabs.getScene().getWindow(), getOpenWalletTabData()));

View file

@ -128,4 +128,15 @@ public class BalanceChart extends LineChart<Number, Number> {
NumberAxis yaxis = (NumberAxis)getYAxis(); NumberAxis yaxis = (NumberAxis)getYAxis();
yaxis.setTickLabelFormatter(new CoinAxisFormatter(yaxis, format, unit)); yaxis.setTickLabelFormatter(new CoinAxisFormatter(yaxis, format, unit));
} }
public void refreshAxisLabels() {
NumberAxis yaxis = (NumberAxis)getYAxis();
// Force the axis to redraw by invalidating the upper and lower bounds
yaxis.setAutoRanging(false);
double lower = yaxis.getLowerBound();
double upper = yaxis.getUpperBound();
yaxis.setLowerBound(lower);
yaxis.setUpperBound(upper);
yaxis.setAutoRanging(true);
}
} }

View file

@ -2,6 +2,7 @@ package com.sparrowwallet.sparrow.control;
import com.sparrowwallet.drongo.BitcoinUnit; import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.sparrow.UnitFormat; import com.sparrowwallet.sparrow.UnitFormat;
import com.sparrowwallet.sparrow.io.Config;
import javafx.scene.chart.NumberAxis; import javafx.scene.chart.NumberAxis;
import javafx.util.StringConverter; import javafx.util.StringConverter;
@ -18,6 +19,10 @@ final class CoinAxisFormatter extends StringConverter<Number> {
@Override @Override
public String toString(Number object) { public String toString(Number object) {
if(Config.get().isHideAmounts()) {
return "";
}
Double value = bitcoinUnit.getValue(object.longValue()); Double value = bitcoinUnit.getValue(object.longValue());
return new CoinTextFormatter(unitFormat).getCoinFormat().format(value); return new CoinTextFormatter(unitFormat).getCoinFormat().format(value);
} }

View file

@ -58,16 +58,22 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
DecimalFormat decimalFormat = (amount.longValue() == 0L ? format.getBtcFormat() : format.getTableBtcFormat()); DecimalFormat decimalFormat = (amount.longValue() == 0L ? format.getBtcFormat() : format.getTableBtcFormat());
final String btcValue = decimalFormat.format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN); final String btcValue = decimalFormat.format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN);
if(unit.equals(BitcoinUnit.BTC)) { if(Config.get().isHideAmounts()) {
tooltip.setValue(satsValue + " " + BitcoinUnit.SATOSHIS.getLabel()); setText(CoinLabel.HIDDEN_AMOUNT_TEXT);
setText(btcValue); setTooltip(null);
setContextMenu(null);
} else { } else {
tooltip.setValue(btcValue + " " + BitcoinUnit.BTC.getLabel()); if(unit.equals(BitcoinUnit.BTC)) {
setText(satsValue); tooltip.setValue(satsValue + " " + BitcoinUnit.SATOSHIS.getLabel());
setText(btcValue);
} else {
tooltip.setValue(btcValue + " " + BitcoinUnit.BTC.getLabel());
setText(satsValue);
}
setTooltip(tooltip);
contextMenu.updateAmount(amount);
setContextMenu(contextMenu);
} }
setTooltip(tooltip);
contextMenu.updateAmount(amount);
setContextMenu(contextMenu);
if(entry instanceof TransactionEntry transactionEntry) { if(entry instanceof TransactionEntry transactionEntry) {
tooltip.showConfirmations(transactionEntry.confirmationsProperty(), transactionEntry.isCoinbase()); tooltip.showConfirmations(transactionEntry.confirmationsProperty(), transactionEntry.isCoinbase());
@ -94,8 +100,8 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
setGraphic(node); setGraphic(node);
setContentDisplay(ContentDisplay.RIGHT); setContentDisplay(ContentDisplay.RIGHT);
if(((HashIndexEntry) entry).getType() == HashIndexEntry.Type.INPUT) { if(((HashIndexEntry) entry).getType() == HashIndexEntry.Type.INPUT && !Config.get().isHideAmounts()) {
satsValue = "-" + satsValue; setText("-" + getText());
} }
} else { } else {
setGraphic(null); setGraphic(null);

View file

@ -13,6 +13,8 @@ import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent; import javafx.scene.input.ClipboardContent;
public class CoinLabel extends Label { public class CoinLabel extends Label {
public static final String HIDDEN_AMOUNT_TEXT = "\u2022\u2022\u2022\u2022\u2022";
private final LongProperty valueProperty = new SimpleLongProperty(-1); private final LongProperty valueProperty = new SimpleLongProperty(-1);
private final Tooltip tooltip; private final Tooltip tooltip;
private final CoinContextMenu contextMenu; private final CoinContextMenu contextMenu;
@ -49,6 +51,15 @@ public class CoinLabel extends Label {
} }
private void setValueAsText(Long value, BitcoinUnit bitcoinUnit) { private void setValueAsText(Long value, BitcoinUnit bitcoinUnit) {
if(Config.get().isHideAmounts()) {
setText(HIDDEN_AMOUNT_TEXT);
setTooltip(null);
setContextMenu(null);
return;
}
setTooltip(tooltip); setTooltip(tooltip);
setContextMenu(contextMenu); setContextMenu(contextMenu);

View file

@ -72,6 +72,13 @@ public class CopyableCoinLabel extends CopyableLabel {
} }
private void setValueAsText(Long value, UnitFormat unitFormat, BitcoinUnit bitcoinUnit) { private void setValueAsText(Long value, UnitFormat unitFormat, BitcoinUnit bitcoinUnit) {
if(Config.get().isHideAmounts()) {
setText("*****");
setTooltip(null);
setContextMenu(null);
return;
}
setTooltip(tooltip); setTooltip(tooltip);
setContextMenu(contextMenu); setContextMenu(contextMenu);

View file

@ -4,6 +4,7 @@ import com.sparrowwallet.drongo.OsType;
import com.sparrowwallet.drongo.protocol.Transaction; import com.sparrowwallet.drongo.protocol.Transaction;
import com.sparrowwallet.sparrow.CurrencyRate; import com.sparrowwallet.sparrow.CurrencyRate;
import com.sparrowwallet.sparrow.UnitFormat; import com.sparrowwallet.sparrow.UnitFormat;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.wallet.Entry; import com.sparrowwallet.sparrow.wallet.Entry;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
@ -47,20 +48,27 @@ public class FiatCell extends TreeTableCell<Entry, Number> {
CurrencyRate currencyRate = coinTreeTable.getCurrencyRate(); CurrencyRate currencyRate = coinTreeTable.getCurrencyRate();
if(currencyRate != null && currencyRate.isAvailable()) { if(currencyRate != null && currencyRate.isAvailable()) {
Currency currency = currencyRate.getCurrency(); if(Config.get().isHideAmounts()) {
double btcRate = currencyRate.getBtcRate(); setText("*****");
setGraphic(null);
setTooltip(null);
setContextMenu(null);
} else {
Currency currency = currencyRate.getCurrency();
double btcRate = currencyRate.getBtcRate();
BigDecimal satsBalance = BigDecimal.valueOf(amount.longValue()); BigDecimal satsBalance = BigDecimal.valueOf(amount.longValue());
BigDecimal btcBalance = satsBalance.divide(BigDecimal.valueOf(Transaction.SATOSHIS_PER_BITCOIN)); BigDecimal btcBalance = satsBalance.divide(BigDecimal.valueOf(Transaction.SATOSHIS_PER_BITCOIN));
BigDecimal fiatBalance = btcBalance.multiply(BigDecimal.valueOf(btcRate)); BigDecimal fiatBalance = btcBalance.multiply(BigDecimal.valueOf(btcRate));
String label = format.formatCurrencyValue(fiatBalance.doubleValue()); String label = format.formatCurrencyValue(fiatBalance.doubleValue());
tooltip.setText("1 BTC = " + currency.getSymbol() + " " + format.formatCurrencyValue(btcRate)); tooltip.setText("1 BTC = " + currency.getSymbol() + " " + format.formatCurrencyValue(btcRate));
setText(label); setText(label);
setGraphic(null); setGraphic(null);
setTooltip(tooltip); setTooltip(tooltip);
setContextMenu(contextMenu); setContextMenu(contextMenu);
}
} else { } else {
setText(null); setText(null);
setGraphic(null); setGraphic(null);

View file

@ -90,6 +90,13 @@ public class FiatLabel extends CopyableLabel {
private void setValueAsText(long balance, UnitFormat unitFormat) { private void setValueAsText(long balance, UnitFormat unitFormat) {
if(getCurrency() != null && getBtcRate() > 0.0) { if(getCurrency() != null && getBtcRate() > 0.0) {
if(Config.get().isHideAmounts()) {
setText(CoinLabel.HIDDEN_AMOUNT_TEXT);
setTooltip(null);
setContextMenu(null);
return;
}
BigDecimal satsBalance = BigDecimal.valueOf(balance); BigDecimal satsBalance = BigDecimal.valueOf(balance);
BigDecimal btcBalance = satsBalance.divide(BigDecimal.valueOf(Transaction.SATOSHIS_PER_BITCOIN)); BigDecimal btcBalance = satsBalance.divide(BigDecimal.valueOf(Transaction.SATOSHIS_PER_BITCOIN));
BigDecimal fiatBalance = btcBalance.multiply(BigDecimal.valueOf(getBtcRate())); BigDecimal fiatBalance = btcBalance.multiply(BigDecimal.valueOf(getBtcRate()));

View file

@ -284,6 +284,10 @@ public class TransactionDiagram extends GridPane {
contextMenu.getItems().add(menuItem); contextMenu.getItems().add(menuItem);
setOnContextMenuRequested(contextMenuHandler); setOnContextMenuRequested(contextMenuHandler);
} }
if(getLabel() != null) {
getLabel().update(this);
}
} }
private List<Map<BlockTransactionHashIndex, WalletNode>> getDisplayedUtxoSets() { private List<Map<BlockTransactionHashIndex, WalletNode>> getDisplayedUtxoSets() {
@ -572,6 +576,10 @@ public class TransactionDiagram extends GridPane {
} }
String getSatsValue(long amount) { String getSatsValue(long amount) {
if(Config.get().isHideAmounts()) {
return CoinLabel.HIDDEN_AMOUNT_TEXT;
}
UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat(); UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat();
return format.formatSatsValue(amount); return format.formatSatsValue(amount);
} }

View file

@ -90,6 +90,10 @@ public class UtxosChart extends BarChart<String, Number> {
private void installTooltip(XYChart.Data<String, Number> item) { private void installTooltip(XYChart.Data<String, Number> item) {
Tooltip.uninstall(item.getNode(), null); Tooltip.uninstall(item.getNode(), null);
if(Config.get().isHideAmounts()) {
return;
}
String satsValue = String.format(Locale.ENGLISH, "%,d", item.getYValue()); String satsValue = String.format(Locale.ENGLISH, "%,d", item.getYValue());
Tooltip tooltip = new Tooltip(item.getXValue() + "\n" + satsValue + " sats"); Tooltip tooltip = new Tooltip(item.getXValue() + "\n" + satsValue + " sats");
tooltip.setShowDelay(Duration.millis(TOOLTIP_SHOW_DELAY)); tooltip.setShowDelay(Duration.millis(TOOLTIP_SHOW_DELAY));
@ -129,4 +133,21 @@ public class UtxosChart extends BarChart<String, Number> {
NumberAxis yaxis = (NumberAxis)getYAxis(); NumberAxis yaxis = (NumberAxis)getYAxis();
yaxis.setTickLabelFormatter(new CoinAxisFormatter(yaxis, format, unit)); yaxis.setTickLabelFormatter(new CoinAxisFormatter(yaxis, format, unit));
} }
public void refreshAxisLabels() {
NumberAxis yaxis = (NumberAxis)getYAxis();
// Force the axis to redraw by invalidating the upper and lower bounds
yaxis.setAutoRanging(false);
double lower = yaxis.getLowerBound();
double upper = yaxis.getUpperBound();
yaxis.setLowerBound(lower);
yaxis.setUpperBound(upper);
yaxis.setAutoRanging(true);
}
public void refreshTooltips() {
for(XYChart.Data<String, Number> data : utxoSeries.getData()) {
installTooltip(data);
}
}
} }

View file

@ -0,0 +1,13 @@
package com.sparrowwallet.sparrow.event;
public class HideAmountsStatusEvent {
private final boolean hideAmounts;
public HideAmountsStatusEvent(boolean hideAmounts) {
this.hideAmounts = hideAmounts;
}
public boolean isHideAmounts() {
return hideAmounts;
}
}

View file

@ -48,6 +48,10 @@ public class NewWalletTransactionsEvent {
} }
public String getValueAsText(long value) { public String getValueAsText(long value) {
if(Config.get().isHideAmounts()) {
return "*****";
}
UnitFormat format = Config.get().getUnitFormat(); UnitFormat format = Config.get().getUnitFormat();
if(format == null) { if(format == null) {
format = UnitFormat.DOT; format = UnitFormat.DOT;

View file

@ -38,6 +38,7 @@ public class FontAwesome5 extends GlyphFont {
EXTERNAL_LINK_ALT('\uf35d'), EXTERNAL_LINK_ALT('\uf35d'),
ELLIPSIS_H('\uf141'), ELLIPSIS_H('\uf141'),
EYE('\uf06e'), EYE('\uf06e'),
EYE_SLASH('\uf070'),
FEATHER_ALT('\uf56b'), FEATHER_ALT('\uf56b'),
FILE_CSV('\uf6dd'), FILE_CSV('\uf6dd'),
FILE_IMPORT('\uf56f'), FILE_IMPORT('\uf56f'),

View file

@ -47,6 +47,7 @@ public class Config {
private Theme theme; private Theme theme;
private boolean openWalletsInNewWindows = false; private boolean openWalletsInNewWindows = false;
private boolean hideEmptyUsedAddresses = false; private boolean hideEmptyUsedAddresses = false;
private boolean hideAmounts = false;
private boolean showTransactionHex = true; private boolean showTransactionHex = true;
private boolean showLoadingLog = true; private boolean showLoadingLog = true;
private boolean showAddressTransactionCount = false; private boolean showAddressTransactionCount = false;
@ -303,6 +304,15 @@ public class Config {
flush(); flush();
} }
public boolean isHideAmounts() {
return hideAmounts;
}
public void setHideAmounts(boolean hideAmounts) {
this.hideAmounts = hideAmounts;
flush();
}
public boolean isShowTransactionHex() { public boolean isShowTransactionHex() {
return showTransactionHex; return showTransactionHex;
} }

View file

@ -1781,6 +1781,12 @@ public class HeadersController extends TransactionFormController implements Init
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
transactionDiagram.update();
fee.refresh();
}
private static class WalletSignComparator implements Comparator<Wallet> { private static class WalletSignComparator implements Comparator<Wallet> {
private static final List<KeystoreSource> sourceOrder = List.of(KeystoreSource.SW_WATCH, KeystoreSource.HW_AIRGAPPED, KeystoreSource.HW_USB, KeystoreSource.SW_SEED); private static final List<KeystoreSource> sourceOrder = List.of(KeystoreSource.SW_WATCH, KeystoreSource.HW_AIRGAPPED, KeystoreSource.HW_USB, KeystoreSource.SW_SEED);

View file

@ -578,4 +578,9 @@ public class InputController extends TransactionFormController implements Initia
updateInputLegendFromWallet(inputForm.getTransactionInput(), null); updateInputLegendFromWallet(inputForm.getTransactionInput(), null);
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
spends.refresh();
}
} }

View file

@ -184,4 +184,9 @@ public class InputsController extends TransactionFormController implements Initi
updatePSBTInputs(inputsForm.getPsbt()); updatePSBTInputs(inputsForm.getPsbt());
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
total.refresh();
}
} }

View file

@ -228,4 +228,9 @@ public class OutputController extends TransactionFormController implements Initi
updateScriptPubKey(outputForm.getTransactionOutput()); updateScriptPubKey(outputForm.getTransactionOutput());
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
value.refresh();
}
} }

View file

@ -6,6 +6,7 @@ import com.sparrowwallet.drongo.protocol.TransactionOutput;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.control.CopyableCoinLabel; import com.sparrowwallet.sparrow.control.CopyableCoinLabel;
import com.sparrowwallet.sparrow.control.CopyableLabel; import com.sparrowwallet.sparrow.control.CopyableLabel;
import com.sparrowwallet.sparrow.event.HideAmountsStatusEvent;
import com.sparrowwallet.sparrow.event.TransactionOutputsChangedEvent; import com.sparrowwallet.sparrow.event.TransactionOutputsChangedEvent;
import com.sparrowwallet.sparrow.event.UnitFormatChangedEvent; import com.sparrowwallet.sparrow.event.UnitFormatChangedEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -68,4 +69,9 @@ public class OutputsController extends TransactionFormController implements Init
updatePieData(outputsPie, outputsForm.getTransaction().getOutputs()); updatePieData(outputsPie, outputsForm.getTransaction().getOutputs());
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
total.refresh();
}
} }

View file

@ -132,6 +132,12 @@ public class AddressesController extends WalletFormController implements Initial
changeTable.showTransactionsCount(event.isShowCount()); changeTable.showTransactionsCount(event.isShowCount());
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
receiveTable.refresh();
changeTable.refresh();
}
public void exportReceiveAddresses(ActionEvent event) { public void exportReceiveAddresses(ActionEvent event) {
exportAddresses(KeyPurpose.RECEIVE); exportAddresses(KeyPurpose.RECEIVE);
} }

View file

@ -405,6 +405,7 @@ public class PaymentController extends WalletFormController implements Initializ
DecimalFormat df = new DecimalFormat("#.#", unitFormat.getDecimalFormatSymbols()); DecimalFormat df = new DecimalFormat("#.#", unitFormat.getDecimalFormatSymbols());
df.setMaximumFractionDigits(8); df.setMaximumFractionDigits(8);
amount.setText(df.format(newValue.getValue(value))); amount.setText(df.format(newValue.getValue(value)));
setFiatAmount(AppServices.getFiatCurrencyExchangeRate(), value);
} }
}); });
@ -923,6 +924,11 @@ public class PaymentController extends WalletFormController implements Initializ
updateOpenWallets(event.getWallets()); updateOpenWallets(event.getWallets());
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
fiatAmount.refresh(Config.get().getUnitFormat());
}
private static class DnsPaymentService extends Service<Optional<DnsPayment>> { private static class DnsPaymentService extends Service<Optional<DnsPayment>> {
private final String hrn; private final String hrn;

View file

@ -1635,6 +1635,11 @@ public class SendController extends WalletFormController implements Initializabl
} }
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
updateTransaction();
}
private class PrivacyAnalysisTooltip extends VBox { private class PrivacyAnalysisTooltip extends VBox {
private final List<Label> analysisLabels = new ArrayList<>(); private final List<Label> analysisLabels = new ArrayList<>();

View file

@ -195,6 +195,16 @@ public class TransactionsController extends WalletFormController implements Init
fiatMempoolBalance.refresh(event.getUnitFormat()); fiatMempoolBalance.refresh(event.getUnitFormat());
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
transactionsTable.refresh();
balanceChart.refreshAxisLabels();
balance.refresh();
mempoolBalance.refresh();
fiatBalance.refresh();
fiatMempoolBalance.refresh();
}
@Subscribe @Subscribe
public void fiatCurrencySelected(FiatCurrencySelectedEvent event) { public void fiatCurrencySelected(FiatCurrencySelectedEvent event) {
if(event.getExchangeSource() == ExchangeSource.NONE) { if(event.getExchangeSource() == ExchangeSource.NONE) {

View file

@ -121,18 +121,22 @@ public class UtxosController extends WalletFormController implements Initializab
long selectedTotal = selectedEntries.stream().mapToLong(Entry::getValue).sum(); long selectedTotal = selectedEntries.stream().mapToLong(Entry::getValue).sum();
if(selectedTotal > 0) { if(selectedTotal > 0) {
if(format == null) { if(Config.get().isHideAmounts()) {
format = UnitFormat.DOT; sendSelected.setText("Send Selected");
}
if(unit == null || unit.equals(BitcoinUnit.AUTO)) {
unit = (selectedTotal >= BitcoinUnit.getAutoThreshold() ? BitcoinUnit.BTC : BitcoinUnit.SATOSHIS);
}
if(unit.equals(BitcoinUnit.BTC)) {
sendSelected.setText("Send Selected (" + format.formatBtcValue(selectedTotal) + " BTC)");
} else { } else {
sendSelected.setText("Send Selected (" + format.formatSatsValue(selectedTotal) + " sats)"); if(format == null) {
format = UnitFormat.DOT;
}
if(unit == null || unit.equals(BitcoinUnit.AUTO)) {
unit = (selectedTotal >= BitcoinUnit.getAutoThreshold() ? BitcoinUnit.BTC : BitcoinUnit.SATOSHIS);
}
if(unit.equals(BitcoinUnit.BTC)) {
sendSelected.setText("Send Selected (" + format.formatBtcValue(selectedTotal) + " BTC)");
} else {
sendSelected.setText("Send Selected (" + format.formatSatsValue(selectedTotal) + " sats)");
}
} }
} else { } else {
sendSelected.setText("Send Selected"); sendSelected.setText("Send Selected");
@ -270,6 +274,19 @@ public class UtxosController extends WalletFormController implements Initializab
fiatMempoolBalance.refresh(event.getUnitFormat()); fiatMempoolBalance.refresh(event.getUnitFormat());
} }
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
utxosTable.refresh();
utxosChart.update(getWalletForm().getWalletUtxosEntry());
utxosChart.refreshAxisLabels();
utxosChart.refreshTooltips();
balance.refresh();
mempoolBalance.refresh();
updateButtons(Config.get().getUnitFormat(), Config.get().getBitcoinUnit());
fiatBalance.refresh();
fiatMempoolBalance.refresh();
}
@Subscribe @Subscribe
public void walletHistoryStatus(WalletHistoryStatusEvent event) { public void walletHistoryStatus(WalletHistoryStatusEvent event) {
utxosTable.updateHistoryStatus(event); utxosTable.updateHistoryStatus(event);

View file

@ -120,6 +120,7 @@
<SeparatorMenuItem /> <SeparatorMenuItem />
<CheckMenuItem fx:id="openWalletsInNewWindows" mnemonicParsing="false" text="Open Wallets In New Windows" onAction="#openWalletsInNewWindows"/> <CheckMenuItem fx:id="openWalletsInNewWindows" mnemonicParsing="false" text="Open Wallets In New Windows" onAction="#openWalletsInNewWindows"/>
<CheckMenuItem fx:id="hideEmptyUsedAddresses" mnemonicParsing="false" text="Hide Empty Used Addresses" onAction="#hideEmptyUsedAddresses"/> <CheckMenuItem fx:id="hideEmptyUsedAddresses" mnemonicParsing="false" text="Hide Empty Used Addresses" onAction="#hideEmptyUsedAddresses"/>
<CheckMenuItem fx:id="hideAmounts" mnemonicParsing="false" text="Hide Amounts" onAction="#hideAmounts" accelerator="Shortcut+Shift+H"/>
<CheckMenuItem fx:id="showLoadingLog" mnemonicParsing="false" text="Show Wallet Loading Log" onAction="#showLoadingLog" /> <CheckMenuItem fx:id="showLoadingLog" mnemonicParsing="false" text="Show Wallet Loading Log" onAction="#showLoadingLog" />
<CheckMenuItem fx:id="showTxHex" mnemonicParsing="false" text="Show Transaction Hex" onAction="#showTxHex"/> <CheckMenuItem fx:id="showTxHex" mnemonicParsing="false" text="Show Transaction Hex" onAction="#showTxHex"/>
<SeparatorMenuItem /> <SeparatorMenuItem />