fix: address PR review feedback

This commit is contained in:
Kyle Santiago 2025-11-04 16:31:37 -05:00
parent 28b662d5e1
commit f9b0d8b2f4
7 changed files with 21 additions and 36 deletions

View file

@ -152,9 +152,6 @@ public class AppController implements Initializable {
@FXML
private CheckMenuItem hideAmounts;
@FXML
private ToggleButton hideAmountsToggle;
@FXML
private CheckMenuItem useHdCameraResolution;
private static final BooleanProperty useHdCameraResolutionProperty = new SimpleBooleanProperty();
@ -391,10 +388,6 @@ public class AppController implements Initializable {
hideEmptyUsedAddressesProperty.set(Config.get().isHideEmptyUsedAddresses());
hideEmptyUsedAddresses.selectedProperty().bindBidirectional(hideEmptyUsedAddressesProperty);
hideAmounts.setSelected(Config.get().isHideAmounts());
hideAmountsToggle.setSelected(Config.get().isHideAmounts());
Glyph eyeGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE);
Glyph eyeSlashGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE_SLASH);
hideAmountsToggle.setGraphic(Config.get().isHideAmounts() ? eyeSlashGlyph : eyeGlyph);
useHdCameraResolutionProperty.set(Config.get().getWebcamResolution() == null || Config.get().getWebcamResolution().isWidescreenAspect());
useHdCameraResolution.selectedProperty().bindBidirectional(useHdCameraResolutionProperty);
mirrorCameraImageProperty.set(Config.get().isMirrorCapture());
@ -964,11 +957,6 @@ public class AppController implements Initializable {
EventManager.get().post(new HideAmountsStatusEvent(item.isSelected()));
}
public void toggleHideAmounts(ActionEvent event) {
boolean hideAmounts = hideAmountsToggle.isSelected();
Config.get().setHideAmounts(hideAmounts);
EventManager.get().post(new HideAmountsStatusEvent(hideAmounts));
}
public void useHdCameraResolution(ActionEvent event) {
CheckMenuItem item = (CheckMenuItem)event.getSource();
@ -3150,11 +3138,6 @@ public class AppController implements Initializable {
@Subscribe
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
hideAmounts.setSelected(event.isHideAmounts());
hideAmountsToggle.setSelected(event.isHideAmounts());
Glyph glyph = event.isHideAmounts() ?
new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE_SLASH) :
new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE);
hideAmountsToggle.setGraphic(glyph);
}
@Subscribe

View file

@ -22,6 +22,7 @@ final class CoinAxisFormatter extends StringConverter<Number> {
if(Config.get().isHideAmounts()) {
return "";
}
Double value = bitcoinUnit.getValue(object.longValue());
return new CoinTextFormatter(unitFormat).getCoinFormat().format(value);
}

View file

@ -50,11 +50,6 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
Entry entry = getTreeTableView().getTreeItem(getIndex()).getValue();
EntryCell.applyRowStyles(this, entry);
if(Config.get().isHideAmounts()) {
setText("*****");
setTooltip(null);
setContextMenu(null);
} else {
CoinTreeTable coinTreeTable = (CoinTreeTable)getTreeTableView();
UnitFormat format = coinTreeTable.getUnitFormat();
BitcoinUnit unit = coinTreeTable.getBitcoinUnit();
@ -63,6 +58,11 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
DecimalFormat decimalFormat = (amount.longValue() == 0L ? format.getBtcFormat() : format.getTableBtcFormat());
final String btcValue = decimalFormat.format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN);
if(Config.get().isHideAmounts()) {
setText(CoinLabel.HIDDEN_AMOUNT_TEXT);
setTooltip(null);
setContextMenu(null);
} else {
if(unit.equals(BitcoinUnit.BTC)) {
tooltip.setValue(satsValue + " " + BitcoinUnit.SATOSHIS.getLabel());
setText(btcValue);
@ -100,7 +100,7 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
setGraphic(node);
setContentDisplay(ContentDisplay.RIGHT);
if(((HashIndexEntry) entry).getType() == HashIndexEntry.Type.INPUT) {
if(((HashIndexEntry) entry).getType() == HashIndexEntry.Type.INPUT && !Config.get().isHideAmounts()) {
setText("-" + getText());
}
} else {

View file

@ -13,6 +13,8 @@ import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
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 Tooltip tooltip;
private final CoinContextMenu contextMenu;
@ -50,12 +52,14 @@ public class CoinLabel extends Label {
private void setValueAsText(Long value, BitcoinUnit bitcoinUnit) {
if(Config.get().isHideAmounts()) {
setText("*****");
setText(HIDDEN_AMOUNT_TEXT);
setTooltip(null);
setContextMenu(null);
return;
}
setTooltip(tooltip);
setContextMenu(contextMenu);

View file

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

View file

@ -577,8 +577,9 @@ public class TransactionDiagram extends GridPane {
String getSatsValue(long amount) {
if(Config.get().isHideAmounts()) {
return "*****";
return CoinLabel.HIDDEN_AMOUNT_TEXT;
}
UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat();
return format.formatSatsValue(amount);
}

View file

@ -120,7 +120,7 @@
<SeparatorMenuItem />
<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="hideAmounts" mnemonicParsing="false" text="Hide Amounts" onAction="#hideAmounts"/>
<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="showTxHex" mnemonicParsing="false" text="Show Transaction Hex" onAction="#showTxHex"/>
<SeparatorMenuItem />
@ -175,11 +175,6 @@
<StatusBar fx:id="statusBar" text="" minHeight="36">
<rightItems>
<ToggleButton fx:id="hideAmountsToggle" contentDisplay="GRAPHIC_ONLY" onAction="#toggleHideAmounts">
<tooltip>
<Tooltip text="Hide Amounts" />
</tooltip>
</ToggleButton>
<UnlabeledToggleSwitch fx:id="serverToggle">
<tooltip>
<Tooltip text="Disconnected" />