mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
fix: address PR review feedback
This commit is contained in:
parent
28b662d5e1
commit
f9b0d8b2f4
7 changed files with 21 additions and 36 deletions
|
|
@ -152,9 +152,6 @@ public class AppController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
private CheckMenuItem hideAmounts;
|
private CheckMenuItem hideAmounts;
|
||||||
|
|
||||||
@FXML
|
|
||||||
private ToggleButton hideAmountsToggle;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private CheckMenuItem useHdCameraResolution;
|
private CheckMenuItem useHdCameraResolution;
|
||||||
private static final BooleanProperty useHdCameraResolutionProperty = new SimpleBooleanProperty();
|
private static final BooleanProperty useHdCameraResolutionProperty = new SimpleBooleanProperty();
|
||||||
|
|
@ -391,10 +388,6 @@ public class AppController implements Initializable {
|
||||||
hideEmptyUsedAddressesProperty.set(Config.get().isHideEmptyUsedAddresses());
|
hideEmptyUsedAddressesProperty.set(Config.get().isHideEmptyUsedAddresses());
|
||||||
hideEmptyUsedAddresses.selectedProperty().bindBidirectional(hideEmptyUsedAddressesProperty);
|
hideEmptyUsedAddresses.selectedProperty().bindBidirectional(hideEmptyUsedAddressesProperty);
|
||||||
hideAmounts.setSelected(Config.get().isHideAmounts());
|
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());
|
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());
|
||||||
|
|
@ -964,11 +957,6 @@ public class AppController implements Initializable {
|
||||||
EventManager.get().post(new HideAmountsStatusEvent(item.isSelected()));
|
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) {
|
public void useHdCameraResolution(ActionEvent event) {
|
||||||
CheckMenuItem item = (CheckMenuItem)event.getSource();
|
CheckMenuItem item = (CheckMenuItem)event.getSource();
|
||||||
|
|
@ -3150,11 +3138,6 @@ public class AppController implements Initializable {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
|
public void hideAmountsStatusChanged(HideAmountsStatusEvent event) {
|
||||||
hideAmounts.setSelected(event.isHideAmounts());
|
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
|
@Subscribe
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ final class CoinAxisFormatter extends StringConverter<Number> {
|
||||||
if(Config.get().isHideAmounts()) {
|
if(Config.get().isHideAmounts()) {
|
||||||
return "";
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,19 +50,19 @@ class CoinCell extends TreeTableCell<Entry, Number> implements ConfirmationsList
|
||||||
Entry entry = getTreeTableView().getTreeItem(getIndex()).getValue();
|
Entry entry = getTreeTableView().getTreeItem(getIndex()).getValue();
|
||||||
EntryCell.applyRowStyles(this, entry);
|
EntryCell.applyRowStyles(this, entry);
|
||||||
|
|
||||||
|
CoinTreeTable coinTreeTable = (CoinTreeTable)getTreeTableView();
|
||||||
|
UnitFormat format = coinTreeTable.getUnitFormat();
|
||||||
|
BitcoinUnit unit = coinTreeTable.getBitcoinUnit();
|
||||||
|
|
||||||
|
String satsValue = format.formatSatsValue(amount.longValue());
|
||||||
|
DecimalFormat decimalFormat = (amount.longValue() == 0L ? format.getBtcFormat() : format.getTableBtcFormat());
|
||||||
|
final String btcValue = decimalFormat.format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN);
|
||||||
|
|
||||||
if(Config.get().isHideAmounts()) {
|
if(Config.get().isHideAmounts()) {
|
||||||
setText("*****");
|
setText(CoinLabel.HIDDEN_AMOUNT_TEXT);
|
||||||
setTooltip(null);
|
setTooltip(null);
|
||||||
setContextMenu(null);
|
setContextMenu(null);
|
||||||
} else {
|
} else {
|
||||||
CoinTreeTable coinTreeTable = (CoinTreeTable)getTreeTableView();
|
|
||||||
UnitFormat format = coinTreeTable.getUnitFormat();
|
|
||||||
BitcoinUnit unit = coinTreeTable.getBitcoinUnit();
|
|
||||||
|
|
||||||
String satsValue = format.formatSatsValue(amount.longValue());
|
|
||||||
DecimalFormat decimalFormat = (amount.longValue() == 0L ? format.getBtcFormat() : format.getTableBtcFormat());
|
|
||||||
final String btcValue = decimalFormat.format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN);
|
|
||||||
|
|
||||||
if(unit.equals(BitcoinUnit.BTC)) {
|
if(unit.equals(BitcoinUnit.BTC)) {
|
||||||
tooltip.setValue(satsValue + " " + BitcoinUnit.SATOSHIS.getLabel());
|
tooltip.setValue(satsValue + " " + BitcoinUnit.SATOSHIS.getLabel());
|
||||||
setText(btcValue);
|
setText(btcValue);
|
||||||
|
|
@ -100,7 +100,7 @@ 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()) {
|
||||||
setText("-" + getText());
|
setText("-" + getText());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -50,12 +52,14 @@ public class CoinLabel extends Label {
|
||||||
|
|
||||||
private void setValueAsText(Long value, BitcoinUnit bitcoinUnit) {
|
private void setValueAsText(Long value, BitcoinUnit bitcoinUnit) {
|
||||||
if(Config.get().isHideAmounts()) {
|
if(Config.get().isHideAmounts()) {
|
||||||
setText("*****");
|
setText(HIDDEN_AMOUNT_TEXT);
|
||||||
setTooltip(null);
|
setTooltip(null);
|
||||||
setContextMenu(null);
|
setContextMenu(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setTooltip(tooltip);
|
setTooltip(tooltip);
|
||||||
setContextMenu(contextMenu);
|
setContextMenu(contextMenu);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,12 @@ 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()) {
|
if(Config.get().isHideAmounts()) {
|
||||||
setText("*****");
|
setText(CoinLabel.HIDDEN_AMOUNT_TEXT);
|
||||||
setTooltip(null);
|
setTooltip(null);
|
||||||
setContextMenu(null);
|
setContextMenu(null);
|
||||||
return;
|
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()));
|
||||||
|
|
|
||||||
|
|
@ -577,8 +577,9 @@ public class TransactionDiagram extends GridPane {
|
||||||
|
|
||||||
String getSatsValue(long amount) {
|
String getSatsValue(long amount) {
|
||||||
if(Config.get().isHideAmounts()) {
|
if(Config.get().isHideAmounts()) {
|
||||||
return "*****";
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +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"/>
|
<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 />
|
||||||
|
|
@ -175,11 +175,6 @@
|
||||||
|
|
||||||
<StatusBar fx:id="statusBar" text="" minHeight="36">
|
<StatusBar fx:id="statusBar" text="" minHeight="36">
|
||||||
<rightItems>
|
<rightItems>
|
||||||
<ToggleButton fx:id="hideAmountsToggle" contentDisplay="GRAPHIC_ONLY" onAction="#toggleHideAmounts">
|
|
||||||
<tooltip>
|
|
||||||
<Tooltip text="Hide Amounts" />
|
|
||||||
</tooltip>
|
|
||||||
</ToggleButton>
|
|
||||||
<UnlabeledToggleSwitch fx:id="serverToggle">
|
<UnlabeledToggleSwitch fx:id="serverToggle">
|
||||||
<tooltip>
|
<tooltip>
|
||||||
<Tooltip text="Disconnected" />
|
<Tooltip text="Disconnected" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue