mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 21:36:45 +00:00
various minor ui improvements
This commit is contained in:
parent
4078c61d6b
commit
211e5952aa
10 changed files with 60 additions and 10 deletions
|
@ -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) {
|
||||
|
|
|
@ -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<String> autoCompletionBinding = TextFields.bindAutoCompletion(wordField, new WordlistSuggestionProvider(wordList));
|
||||
|
|
|
@ -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<String> {
|
|||
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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<String> text = dialog.showAndWait();
|
||||
if(text.isPresent() && !text.get().isEmpty() && !text.get().equals(outputDescriptorString)) {
|
||||
setDescriptorText(text.get());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<TextField fx:id="label" maxWidth="160"/>
|
||||
</Field>
|
||||
<Field text="Master fingerprint:">
|
||||
<TextField fx:id="fingerprint" maxWidth="80" promptText="00000000"/> <HelpLabel helpText="A master fingerprint is the first 4 bytes of the master public key hash.\nIt is safe to use any valid value (00000000) for Watch Only Wallets." />
|
||||
<TextField fx:id="fingerprint" maxWidth="80" promptText="00000000"/> <HelpLabel helpText="The master fingerprint uniquely identifies this keystore using the first 4 bytes of the master public key hash.\nIt is safe to use any valid value (00000000) for Watch Only Wallets." />
|
||||
</Field>
|
||||
<Field text="Derivation:">
|
||||
<TextField fx:id="derivation" maxWidth="200"/> <HelpLabel helpText="The derivation path to the xpub from the master private key.\nFor safety, derivations that match defaults for other script types are not valid." />
|
||||
|
|
Loading…
Reference in a new issue