move show transaction hex setting into config

This commit is contained in:
Craig Raw 2020-12-04 10:10:17 +02:00
parent 572e451279
commit 7461b47466
3 changed files with 14 additions and 6 deletions

View file

@ -144,8 +144,6 @@ public class AppController implements Initializable {
private static Integer currentBlockHeight;
public static boolean showTxHexProperty;
private static Map<Integer, Double> targetBlockFeeRates;
private static final Map<Date, Set<MempoolRateSize>> mempoolHistogram = new TreeMap<>();
@ -257,8 +255,7 @@ public class AppController implements Initializable {
selectedThemeToggle.ifPresent(toggle -> theme.selectToggle(toggle));
setTheme(null);
showTxHex.setSelected(true);
showTxHexProperty = true;
showTxHex.setSelected(Config.get().isShowTransactionHex());
exportWallet.setDisable(true);
serverToggle.selectedProperty().addListener((observable, oldValue, newValue) -> {
@ -756,8 +753,8 @@ public class AppController implements Initializable {
public void showTxHex(ActionEvent event) {
CheckMenuItem item = (CheckMenuItem)event.getSource();
Config.get().setShowTransactionHex(item.isSelected());
EventManager.get().post(new TransactionTabChangedEvent(tabs.getSelectionModel().getSelectedItem(), item.isSelected()));
showTxHexProperty = item.isSelected();
}
public void setBitcoinUnit(ActionEvent event) {

View file

@ -31,6 +31,7 @@ public class Config {
private boolean notifyNewTransactions = true;
private boolean checkNewVersions = true;
private Theme theme;
private boolean showTransactionHex = true;
private List<File> recentWalletFiles;
private Integer keyDerivationPeriod;
private File hwi;
@ -184,6 +185,15 @@ public class Config {
flush();
}
public boolean isShowTransactionHex() {
return showTransactionHex;
}
public void setShowTransactionHex(boolean showTransactionHex) {
this.showTransactionHex = showTransactionHex;
flush();
}
public List<File> getRecentWalletFiles() {
return recentWalletFiles;
}

View file

@ -12,6 +12,7 @@ import com.sparrowwallet.sparrow.TransactionTabData;
import com.sparrowwallet.sparrow.control.TransactionDiagram;
import com.sparrowwallet.sparrow.control.TransactionHexArea;
import com.sparrowwallet.sparrow.event.*;
import com.sparrowwallet.sparrow.io.Config;
import com.sparrowwallet.sparrow.net.ElectrumServer;
import javafx.application.Platform;
import javafx.fxml.FXML;
@ -63,7 +64,7 @@ public class TransactionController implements Initializable {
public void initializeView() {
initializeTxTree();
transactionMasterDetail.setShowDetailNode(AppController.showTxHexProperty);
transactionMasterDetail.setShowDetailNode(Config.get().isShowTransactionHex());
txhex.setTransaction(getTransaction());
highlightTxHex();
fetchThisAndInputBlockTransactions(0, Math.min(getTransaction().getInputs().size(), PageForm.PAGE_SIZE));