mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
various bugs fixed
This commit is contained in:
parent
53478d9b22
commit
2a6a296cf3
7 changed files with 42 additions and 14 deletions
|
@ -20,6 +20,7 @@ public class SeedDisplayDialog extends Dialog<Void> {
|
||||||
|
|
||||||
AnchorPane anchorPane = new AnchorPane();
|
AnchorPane anchorPane = new AnchorPane();
|
||||||
ScrollPane scrollPane = new ScrollPane();
|
ScrollPane scrollPane = new ScrollPane();
|
||||||
|
scrollPane.getStyleClass().add("edge-to-edge");
|
||||||
scrollPane.setPrefHeight(74 + height);
|
scrollPane.setPrefHeight(74 + height);
|
||||||
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
|
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
|
||||||
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
|
scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
|
||||||
|
@ -32,6 +33,7 @@ public class SeedDisplayDialog extends Dialog<Void> {
|
||||||
scrollPane.setContent(keystoreAccordion);
|
scrollPane.setContent(keystoreAccordion);
|
||||||
|
|
||||||
MnemonicKeystoreImportPane keystorePane = new MnemonicKeystoreImportPane(decryptedKeystore);
|
MnemonicKeystoreImportPane keystorePane = new MnemonicKeystoreImportPane(decryptedKeystore);
|
||||||
|
keystorePane.setAnimated(false);
|
||||||
keystoreAccordion.getPanes().add(keystorePane);
|
keystoreAccordion.getPanes().add(keystorePane);
|
||||||
|
|
||||||
stackPane.getChildren().addAll(anchorPane);
|
stackPane.getChildren().addAll(anchorPane);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class WalletNameDialog extends Dialog<String> {
|
||||||
dialogPane.getButtonTypes().addAll(okButtonType);
|
dialogPane.getButtonTypes().addAll(okButtonType);
|
||||||
Button okButton = (Button) dialogPane.lookupButton(okButtonType);
|
Button okButton = (Button) dialogPane.lookupButton(okButtonType);
|
||||||
BooleanBinding isInvalid = Bindings.createBooleanBinding(() ->
|
BooleanBinding isInvalid = Bindings.createBooleanBinding(() ->
|
||||||
name.getText().length() == 0 || Storage.getWalletFile(name.getText()).exists(), name.textProperty());
|
name.getText().length() == 0 || Storage.walletExists(name.getText()), name.textProperty());
|
||||||
okButton.disableProperty().bind(isInvalid);
|
okButton.disableProperty().bind(isInvalid);
|
||||||
|
|
||||||
name.setPromptText("Wallet Name");
|
name.setPromptText("Wallet Name");
|
||||||
|
|
|
@ -46,7 +46,6 @@ public class Storage {
|
||||||
public Storage(File walletFile) {
|
public Storage(File walletFile) {
|
||||||
this.walletFile = walletFile;
|
this.walletFile = walletFile;
|
||||||
this.gson = getGson();
|
this.gson = getGson();
|
||||||
this.encryptionPubKey = NO_PASSWORD_KEY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getWalletFile() {
|
public File getWalletFile() {
|
||||||
|
|
|
@ -436,9 +436,9 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
blockchainForm.setVisible(true);
|
blockchainForm.setVisible(true);
|
||||||
|
|
||||||
if(currentHeight == null) {
|
if(currentHeight == null) {
|
||||||
blockStatus.setText(blockTransaction.getBlockHash() == null ? "Unconfirmed" : "Confirmed");
|
blockStatus.setText(blockTransaction.getHeight() > 0 ? "Confirmed" : "Unconfirmed");
|
||||||
} else {
|
} else {
|
||||||
int confirmations = blockTransaction.getBlockHash() == null ? 0 : currentHeight - blockTransaction.getHeight() + 1;
|
int confirmations = blockTransaction.getHeight() > 0 ? currentHeight - blockTransaction.getHeight() + 1 : 0;
|
||||||
if(confirmations == 0) {
|
if(confirmations == 0) {
|
||||||
blockStatus.setText("Unconfirmed");
|
blockStatus.setText("Unconfirmed");
|
||||||
} else if(confirmations == 1) {
|
} else if(confirmations == 1) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.sparrowwallet.sparrow.control.WalletPasswordDialog;
|
||||||
import com.sparrowwallet.sparrow.event.StorageEvent;
|
import com.sparrowwallet.sparrow.event.StorageEvent;
|
||||||
import com.sparrowwallet.sparrow.event.TimedEvent;
|
import com.sparrowwallet.sparrow.event.TimedEvent;
|
||||||
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
||||||
|
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands;
|
||||||
import com.sparrowwallet.sparrow.io.Storage;
|
import com.sparrowwallet.sparrow.io.Storage;
|
||||||
import com.sparrowwallet.sparrow.keystoreimport.KeystoreImportDialog;
|
import com.sparrowwallet.sparrow.keystoreimport.KeystoreImportDialog;
|
||||||
import com.sparrowwallet.sparrow.event.SettingsChangedEvent;
|
import com.sparrowwallet.sparrow.event.SettingsChangedEvent;
|
||||||
|
@ -48,6 +49,9 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
@FXML
|
@FXML
|
||||||
private Label type;
|
private Label type;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Button viewSeedButton;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Button importButton;
|
private Button importButton;
|
||||||
|
|
||||||
|
@ -84,6 +88,8 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
selectSourcePane.setVisible(false);
|
selectSourcePane.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewSeedButton.managedProperty().bind(viewSeedButton.visibleProperty());
|
||||||
|
|
||||||
updateType();
|
updateType();
|
||||||
|
|
||||||
label.setText(keystore.getLabel());
|
label.setText(keystore.getLabel());
|
||||||
|
@ -170,15 +176,10 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
|
|
||||||
private void updateType() {
|
private void updateType() {
|
||||||
type.setText(getTypeLabel(keystore));
|
type.setText(getTypeLabel(keystore));
|
||||||
if(keystore.getSource() == KeystoreSource.SW_SEED) {
|
type.setGraphic(getTypeIcon(keystore));
|
||||||
Glyph searchGlyph = new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE);
|
viewSeedButton.setVisible(keystore.getSource() == KeystoreSource.SW_SEED);
|
||||||
searchGlyph.setFontSize(12);
|
|
||||||
type.setGraphic(searchGlyph);
|
|
||||||
} else {
|
|
||||||
type.setGraphic(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
importButton.setText(keystore.getSource() == KeystoreSource.SW_WATCH ? "Import..." : "Edit...");
|
importButton.setText(keystore.getSource() == KeystoreSource.SW_WATCH ? "Import..." : "Replace...");
|
||||||
|
|
||||||
boolean editable = (keystore.getSource() == KeystoreSource.SW_WATCH);
|
boolean editable = (keystore.getSource() == KeystoreSource.SW_WATCH);
|
||||||
fingerprint.setEditable(editable);
|
fingerprint.setEditable(editable);
|
||||||
|
@ -200,6 +201,20 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Glyph getTypeIcon(Keystore keystore) {
|
||||||
|
switch (keystore.getSource()) {
|
||||||
|
case HW_USB:
|
||||||
|
return new Glyph(FontAwesome5Brands.FONT_NAME, FontAwesome5Brands.Glyph.USB);
|
||||||
|
case HW_AIRGAPPED:
|
||||||
|
return new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.SD_CARD);
|
||||||
|
case SW_SEED:
|
||||||
|
return new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.LAPTOP);
|
||||||
|
case SW_WATCH:
|
||||||
|
default:
|
||||||
|
return new Glyph(FontAwesome5.FONT_NAME, FontAwesome5.Glyph.EYE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void importKeystore(ActionEvent event) {
|
public void importKeystore(ActionEvent event) {
|
||||||
KeystoreSource initialSource = keystore.getSource();
|
KeystoreSource initialSource = keystore.getSource();
|
||||||
if(initialSource == null || !KeystoreImportDialog.getSupportedSources().contains(initialSource)) {
|
if(initialSource == null || !KeystoreImportDialog.getSupportedSources().contains(initialSource)) {
|
||||||
|
@ -232,7 +247,7 @@ public class KeystoreController extends WalletFormController implements Initiali
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showSeed(MouseEvent event) {
|
public void showSeed(ActionEvent event) {
|
||||||
int keystoreIndex = getWalletForm().getWallet().getKeystores().indexOf(keystore);
|
int keystoreIndex = getWalletForm().getWallet().getKeystores().indexOf(keystore);
|
||||||
Wallet copy = getWalletForm().getWallet().copy();
|
Wallet copy = getWalletForm().getWallet().copy();
|
||||||
|
|
||||||
|
|
|
@ -16,3 +16,7 @@
|
||||||
#fingerprint, #derivation, #xpub {
|
#fingerprint, #derivation, #xpub {
|
||||||
-fx-font-family: Courier;
|
-fx-font-family: Courier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#type {
|
||||||
|
-fx-padding: 0 17 0 0;
|
||||||
|
}
|
|
@ -20,7 +20,15 @@
|
||||||
<Form fx:id="keystoreForm" GridPane.columnIndex="0" GridPane.rowIndex="0">
|
<Form fx:id="keystoreForm" GridPane.columnIndex="0" GridPane.rowIndex="0">
|
||||||
<Fieldset inputGrow="SOMETIMES" text="">
|
<Fieldset inputGrow="SOMETIMES" text="">
|
||||||
<Field text="Type:">
|
<Field text="Type:">
|
||||||
<Label fx:id="type" contentDisplay="RIGHT" graphicTextGap="5" onMouseClicked="#showSeed"/>
|
<Label fx:id="type" graphicTextGap="8"/>
|
||||||
|
<Button fx:id="viewSeedButton" onAction="#showSeed">
|
||||||
|
<graphic>
|
||||||
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="12" icon="KEY" />
|
||||||
|
</graphic>
|
||||||
|
<tooltip>
|
||||||
|
<Tooltip text="View Seed..."/>
|
||||||
|
</tooltip>
|
||||||
|
</Button>
|
||||||
<Pane HBox.hgrow="ALWAYS" />
|
<Pane HBox.hgrow="ALWAYS" />
|
||||||
<Button fx:id="importButton" text="Import..." onAction="#importKeystore"/>
|
<Button fx:id="importButton" text="Import..." onAction="#importKeystore"/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
Loading…
Reference in a new issue