diff --git a/src/main/java/com/sparrowwallet/sparrow/AppController.java b/src/main/java/com/sparrowwallet/sparrow/AppController.java index 5a2f51c4..64ac61aa 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppController.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppController.java @@ -75,6 +75,7 @@ public class AppController implements Initializable { public static final String DRAG_OVER_CLASS = "drag-over"; public static final double TAB_LABEL_GRAPHIC_OPACITY_INACTIVE = 0.8; public static final double TAB_LABEL_GRAPHIC_OPACITY_ACTIVE = 0.95; + public static final String LOADING_TRANSACTIONS_MESSAGE = "Loading wallet, select Transactions tab to view..."; @FXML private MenuItem saveTransaction; @@ -1356,6 +1357,7 @@ public class AppController implements Initializable { @Subscribe public void versionUpdated(VersionUpdatedEvent event) { Hyperlink versionUpdateLabel = new Hyperlink("Sparrow " + event.getVersion() + " available"); + versionUpdateLabel.getStyleClass().add("version-hyperlink"); versionUpdateLabel.setOnAction(event1 -> { AppServices.get().getApplication().getHostServices().showDocument("https://www.sparrowwallet.com/download"); }); @@ -1449,7 +1451,7 @@ public class AppController implements Initializable { @Subscribe public void walletTabsClosed(WalletTabsClosedEvent event) { if(event.getClosedWalletTabData().stream().map(WalletTabData::getWallet).anyMatch(loadingWallets::remove) && loadingWallets.isEmpty()) { - if(statusBar.getText().equals("Loading transactions...")) { + if(statusBar.getText().equals(LOADING_TRANSACTIONS_MESSAGE)) { statusBar.setText(""); } if(statusTimeline == null || statusTimeline.getStatus() != Animation.Status.RUNNING) { @@ -1471,7 +1473,7 @@ public class AppController implements Initializable { public void walletHistoryStarted(WalletHistoryStartedEvent event) { if(AppServices.isConnected() && getOpenWallets().containsKey(event.getWallet())) { if(event.getWalletNode() == null && event.getWallet().getTransactions().isEmpty()) { - statusUpdated(new StatusEvent("Loading transactions...", 120)); + statusUpdated(new StatusEvent(LOADING_TRANSACTIONS_MESSAGE, 120)); if(statusTimeline == null || statusTimeline.getStatus() != Animation.Status.RUNNING) { statusBar.setProgress(-1); loadingWallets.add(event.getWallet()); @@ -1484,7 +1486,7 @@ public class AppController implements Initializable { @Subscribe public void walletHistoryFinished(WalletHistoryFinishedEvent event) { if(getOpenWallets().containsKey(event.getWallet())) { - if(statusBar.getText().equals("Loading transactions...")) { + if(statusBar.getText().equals(LOADING_TRANSACTIONS_MESSAGE)) { statusBar.setText(""); } if(statusTimeline == null || statusTimeline.getStatus() != Animation.Status.RUNNING) { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java index 20f73b46..3ea899f1 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java @@ -392,6 +392,19 @@ public class MnemonicKeystoreImportPane extends TitledDescriptionPane { label.setAlignment(Pos.CENTER_RIGHT); wordField = new TextField(); wordField.setMaxWidth(100); + TextFormatter formatter = new TextFormatter<>((TextFormatter.Change change) -> { + String text = change.getText(); + // if text was added, fix the text to fit the requirements + if(!text.isEmpty()) { + String newText = text.replace(" ", "").toLowerCase(); + int carretPos = change.getCaretPosition() - text.length() + newText.length(); + change.setText(newText); + // fix caret position based on difference in originally added text and fixed text + change.selectRange(carretPos, carretPos); + } + return change; + }); + wordField.setTextFormatter(formatter); wordList = Bip39MnemonicCode.INSTANCE.getWordList(); AutoCompletionBinding autoCompletionBinding = TextFields.bindAutoCompletion(wordField, new WordlistSuggestionProvider(wordList)); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TextAreaDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/TextAreaDialog.java index 01c6f129..abbc047e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TextAreaDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TextAreaDialog.java @@ -4,6 +4,8 @@ import com.sparrowwallet.sparrow.AppServices; import javafx.application.Platform; import javafx.beans.NamedArg; import javafx.scene.control.*; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; @@ -18,6 +20,9 @@ public class TextAreaDialog extends Dialog { public TextAreaDialog(@NamedArg("defaultValue") String defaultValue) { final DialogPane dialogPane = getDialogPane(); + Image image = new Image("/image/sparrow-small.png"); + dialogPane.setGraphic(new ImageView(image)); + HBox hbox = new HBox(); this.textArea = new TextArea(defaultValue); this.textArea.setMaxWidth(Double.MAX_VALUE); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java index ad206f7a..0befd815 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java @@ -252,12 +252,21 @@ public class KeystoreController extends WalletFormController implements Initiali importButton.setTooltip(new Tooltip(keystore.getSource() == KeystoreSource.SW_WATCH ? "Import a keystore from an external source" : "Replace this keystore with another source")); boolean editable = (keystore.getSource() == KeystoreSource.SW_WATCH); - fingerprint.setEditable(editable); - derivation.setEditable(editable); - xpub.setEditable(editable); + setEditable(fingerprint, editable); + setEditable(derivation, editable); + setEditable(xpub, editable); scanXpubQR.setVisible(editable); } + private void setEditable(TextInputControl textInputControl, boolean editable) { + textInputControl.setEditable(editable); + if(!editable && !textInputControl.getStyleClass().contains("readonly")) { + textInputControl.getStyleClass().add("readonly"); + } else if(editable) { + textInputControl.getStyleClass().remove("readonly"); + } + } + private String getTypeLabel(Keystore keystore) { switch (keystore.getSource()) { case HW_USB: diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java index 99031130..852f8279 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SettingsController.java @@ -276,7 +276,7 @@ public class SettingsController extends WalletFormController implements Initiali TextAreaDialog dialog = new TextAreaDialog(outputDescriptorString); dialog.setTitle("Edit wallet output descriptor"); - dialog.getDialogPane().setHeaderText("Wallet output descriptor:"); + dialog.getDialogPane().setHeaderText("The wallet configuration is specified in the output descriptor.\nChanges to the output descriptor will modify the wallet configuration."); Optional text = dialog.showAndWait(); if(text.isPresent() && !text.get().isEmpty() && !text.get().equals(outputDescriptorString)) { setDescriptorText(text.get()); diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.css b/src/main/resources/com/sparrowwallet/sparrow/app.css index a03bba41..996c266f 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.css +++ b/src/main/resources/com/sparrowwallet/sparrow/app.css @@ -34,6 +34,15 @@ -fx-spacing: 10; } +.version-hyperlink { + -fx-border-color: transparent; + -fx-text-fill: #1e88cf; +} + +.version-hyperlink:visited { + -fx-underline: false; +} + .core-server.toggle-switch:selected .thumb-area { -fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -20%), derive(-fx-text-box-border, -30%)), linear-gradient(to bottom, derive(#50a14f, 30%), #50a14f); -fx-background-insets: 0, 1; diff --git a/src/main/resources/com/sparrowwallet/sparrow/darktheme.css b/src/main/resources/com/sparrowwallet/sparrow/darktheme.css index 10c17d12..18e8760e 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/darktheme.css +++ b/src/main/resources/com/sparrowwallet/sparrow/darktheme.css @@ -152,6 +152,14 @@ color-grey: #3e4451; } +.root .readonly.text-input { + -fx-text-fill: lightgray; +} + +.root .descriptor-text { + -fx-fill: lightgray; +} + .root .success { -fx-text-fill: #98c379; } diff --git a/src/main/resources/com/sparrowwallet/sparrow/descriptor.css b/src/main/resources/com/sparrowwallet/sparrow/descriptor.css index 38ef742a..c1821cd3 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/descriptor.css +++ b/src/main/resources/com/sparrowwallet/sparrow/descriptor.css @@ -1,3 +1,3 @@ -.descriptor-text { -fx-fill: -fx-text-inner-color } -.descriptor-error { -fx-fill: #ca1243 } +.descriptor-text { -fx-fill: derive(-fx-text-inner-color, 40%) } +.descriptor-error { -fx-fill: rgba(202, 18, 67, 0.8) } diff --git a/src/main/resources/com/sparrowwallet/sparrow/general.css b/src/main/resources/com/sparrowwallet/sparrow/general.css index ecf8fbba..cb3310dd 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/general.css +++ b/src/main/resources/com/sparrowwallet/sparrow/general.css @@ -128,6 +128,10 @@ -fx-background-color: #116a8d; } +.readonly.text-input { + -fx-text-fill: derive(-fx-text-inner-color, 40%); +} + .help-label { -fx-padding: 0 0 0 10; } diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml b/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml index 35b729bb..b8982d4e 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/keystore.fxml @@ -41,7 +41,7 @@ - +