mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
add link to server preferences in status bar on connection failure
This commit is contained in:
parent
a68eeb4669
commit
4e4fd7501c
3 changed files with 35 additions and 4 deletions
|
@ -1213,6 +1213,11 @@ public class AppController implements Initializable {
|
||||||
preferencesDialog.showAndWait();
|
preferencesDialog.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openServerPreferences(ActionEvent event) {
|
||||||
|
PreferencesDialog preferencesDialog = new PreferencesDialog(PreferenceGroup.SERVER);
|
||||||
|
preferencesDialog.showAndWait();
|
||||||
|
}
|
||||||
|
|
||||||
public void signVerifyMessage(ActionEvent event) {
|
public void signVerifyMessage(ActionEvent event) {
|
||||||
MessageSignDialog messageSignDialog = null;
|
MessageSignDialog messageSignDialog = null;
|
||||||
WalletForm selectedWalletForm = getSelectedWalletForm();
|
WalletForm selectedWalletForm = getSelectedWalletForm();
|
||||||
|
@ -2096,6 +2101,7 @@ public class AppController implements Initializable {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void statusUpdated(StatusEvent event) {
|
public void statusUpdated(StatusEvent event) {
|
||||||
statusBar.setText(event.getStatus());
|
statusBar.setText(event.getStatus());
|
||||||
|
statusBar.setGraphic(event.getGraphic());
|
||||||
|
|
||||||
if(wait != null && wait.getStatus() == Animation.Status.RUNNING) {
|
if(wait != null && wait.getStatus() == Animation.Status.RUNNING) {
|
||||||
wait.stop();
|
wait.stop();
|
||||||
|
@ -2104,6 +2110,7 @@ public class AppController implements Initializable {
|
||||||
wait.setOnFinished((e) -> {
|
wait.setOnFinished((e) -> {
|
||||||
if(statusBar.getText().equals(event.getStatus())) {
|
if(statusBar.getText().equals(event.getStatus())) {
|
||||||
statusBar.setText("");
|
statusBar.setText("");
|
||||||
|
statusBar.setGraphic(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
wait.play();
|
wait.play();
|
||||||
|
@ -2133,6 +2140,7 @@ public class AppController implements Initializable {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void timedWorker(TimedEvent event) {
|
public void timedWorker(TimedEvent event) {
|
||||||
|
statusBar.setGraphic(null);
|
||||||
if(event.getTimeMills() == 0) {
|
if(event.getTimeMills() == 0) {
|
||||||
if(statusTimeline != null && statusTimeline.getStatus() == Animation.Status.RUNNING) {
|
if(statusTimeline != null && statusTimeline.getStatus() == Animation.Status.RUNNING) {
|
||||||
statusTimeline.stop();
|
statusTimeline.stop();
|
||||||
|
@ -2148,6 +2156,7 @@ public class AppController implements Initializable {
|
||||||
new KeyFrame(Duration.ZERO, new KeyValue(statusBar.progressProperty(), 0)),
|
new KeyFrame(Duration.ZERO, new KeyValue(statusBar.progressProperty(), 0)),
|
||||||
new KeyFrame(Duration.millis(event.getTimeMills()), e -> {
|
new KeyFrame(Duration.millis(event.getTimeMills()), e -> {
|
||||||
statusBar.setText("");
|
statusBar.setText("");
|
||||||
|
statusBar.setGraphic(null);
|
||||||
statusBar.setProgress(0);
|
statusBar.setProgress(0);
|
||||||
}, new KeyValue(statusBar.progressProperty(), 1))
|
}, new KeyValue(statusBar.progressProperty(), 1))
|
||||||
);
|
);
|
||||||
|
@ -2192,7 +2201,9 @@ public class AppController implements Initializable {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void connectionFailed(ConnectionFailedEvent event) {
|
public void connectionFailed(ConnectionFailedEvent event) {
|
||||||
String status = CONNECTION_FAILED_PREFIX + event.getMessage();
|
String status = CONNECTION_FAILED_PREFIX + event.getMessage();
|
||||||
statusUpdated(new StatusEvent(status));
|
Hyperlink hyperlink = new Hyperlink("Server Preferences");
|
||||||
|
hyperlink.setOnAction(this::openServerPreferences);
|
||||||
|
statusUpdated(new StatusEvent(status, hyperlink));
|
||||||
serverToggleStopAnimation();
|
serverToggleStopAnimation();
|
||||||
setTorIcon();
|
setTorIcon();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,29 @@
|
||||||
package com.sparrowwallet.sparrow.event;
|
package com.sparrowwallet.sparrow.event;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
|
||||||
public class StatusEvent {
|
public class StatusEvent {
|
||||||
public static final int DEFAULT_SHOW_DURATION_SECS = 20;
|
public static final int DEFAULT_SHOW_DURATION_SECS = 20;
|
||||||
|
|
||||||
private final String status;
|
private final String status;
|
||||||
|
private final Node graphic;
|
||||||
private final int showDuration;
|
private final int showDuration;
|
||||||
|
|
||||||
public StatusEvent(String status) {
|
public StatusEvent(String status) {
|
||||||
this(status, DEFAULT_SHOW_DURATION_SECS);
|
this(status, null, DEFAULT_SHOW_DURATION_SECS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatusEvent(String status, Node graphic) {
|
||||||
|
this(status, graphic, DEFAULT_SHOW_DURATION_SECS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatusEvent(String status, int showDuration) {
|
public StatusEvent(String status, int showDuration) {
|
||||||
|
this(status, null, showDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatusEvent(String status, Node graphic, int showDuration) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
this.graphic = graphic;
|
||||||
this.showDuration = showDuration;
|
this.showDuration = showDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +31,10 @@ public class StatusEvent {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Node getGraphic() {
|
||||||
|
return graphic;
|
||||||
|
}
|
||||||
|
|
||||||
public int getShowDuration() {
|
public int getShowDuration() {
|
||||||
return showDuration;
|
return showDuration;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,15 +59,19 @@
|
||||||
-fx-spacing: 10;
|
-fx-spacing: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-hyperlink {
|
.version-hyperlink, .status-bar .status-label .hyperlink {
|
||||||
-fx-border-color: transparent;
|
-fx-border-color: transparent;
|
||||||
-fx-text-fill: #1e88cf;
|
-fx-text-fill: #1e88cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-hyperlink:visited {
|
.version-hyperlink:visited, .status-bar .status-label .hyperlink {
|
||||||
-fx-underline: false;
|
-fx-underline: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.status-bar .status-label {
|
||||||
|
-fx-content-display: RIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
.core-server.toggle-switch:selected .thumb-area {
|
.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-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;
|
-fx-background-insets: 0, 1;
|
||||||
|
|
Loading…
Reference in a new issue