mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-04 21:29:48 -04:00
Add footer with status info
This commit is contained in:
parent
33a539ca52
commit
24d29eaa83
15 changed files with 380 additions and 207 deletions
|
@ -39,13 +39,6 @@
|
|||
<include>**/*.css</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
|
|
@ -91,7 +91,7 @@ public class BitsquareApp extends Application {
|
|||
CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);
|
||||
View view = viewLoader.load(MainView.class);
|
||||
|
||||
scene = new Scene((Parent) view.getRoot(), 1000, 620);
|
||||
scene = new Scene((Parent) view.getRoot(), 1000, 650);
|
||||
scene.getStylesheets().setAll(
|
||||
"/io/bitsquare/gui/bitsquare.css",
|
||||
"/io/bitsquare/gui/images.css");
|
||||
|
|
|
@ -56,6 +56,21 @@ lower gradient color on tab: dddddd
|
|||
-fx-background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
#footer-pane {
|
||||
-fx-background-color: #ddd;
|
||||
-fx-font-size: 12;
|
||||
-fx-text-fill: #333;
|
||||
}
|
||||
|
||||
#footer-pane-line {
|
||||
-fx-background: #bbb;
|
||||
}
|
||||
|
||||
#footer-bitcoin-network-label {
|
||||
-fx-text-fill: -fx-accent;
|
||||
-fx-font-size: 12;
|
||||
}
|
||||
|
||||
#headline-label {
|
||||
-fx-font-weight: bold;
|
||||
-fx-font-size: 18;
|
||||
|
|
|
@ -114,7 +114,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
setLeftAnchor(this, 0d);
|
||||
setRightAnchor(this, 0d);
|
||||
setTopAnchor(this, 60d);
|
||||
setBottomAnchor(this, 25d);
|
||||
setBottomAnchor(this, 10d);
|
||||
}};
|
||||
|
||||
AnchorPane applicationContainer = new AnchorPane(leftNavPane, rightNavPane, contentContainer) {{
|
||||
|
@ -124,6 +124,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
BorderPane baseApplicationContainer = new BorderPane(applicationContainer) {{
|
||||
setId("base-content-container");
|
||||
}};
|
||||
baseApplicationContainer.setBottom(createFooter());
|
||||
|
||||
setupNotificationIcon(portfolioButtonHolder);
|
||||
|
||||
|
@ -187,15 +188,84 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
});
|
||||
}
|
||||
|
||||
private VBox createSplashScreen() {
|
||||
VBox vBox = new VBox();
|
||||
vBox.setAlignment(Pos.CENTER);
|
||||
vBox.setSpacing(0);
|
||||
vBox.setId("splash");
|
||||
private AnchorPane createFooter() {
|
||||
// BTC
|
||||
Label blockchainSyncLabel = new Label();
|
||||
blockchainSyncLabel.setId("footer-pane");
|
||||
blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfoFooter);
|
||||
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
|
||||
blockchainSyncLabel.setId("splash-error-state-msg");
|
||||
Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n\nReason: " +
|
||||
newValue);
|
||||
});
|
||||
|
||||
ImageView logo = new ImageView();
|
||||
logo.setId("image-splash-logo");
|
||||
ProgressBar blockchainSyncIndicator = new ProgressBar(-1);
|
||||
blockchainSyncIndicator.setPrefWidth(120);
|
||||
blockchainSyncIndicator.setMaxHeight(10);
|
||||
blockchainSyncIndicator.progressProperty().bind(model.blockchainSyncProgress);
|
||||
|
||||
Label bitcoinNetworkLabel = new Label();
|
||||
bitcoinNetworkLabel.setId("footer-bitcoin-network-label");
|
||||
bitcoinNetworkLabel.setText(model.bitcoinNetworkAsString);
|
||||
|
||||
model.blockchainSyncProgress.addListener((ov, oldValue, newValue) -> {
|
||||
if ((double) newValue >= 1) {
|
||||
blockchainSyncIndicator.setVisible(false);
|
||||
blockchainSyncIndicator.setManaged(false);
|
||||
blockchainSyncLabel.setVisible(false);
|
||||
blockchainSyncLabel.setManaged(false);
|
||||
}
|
||||
});
|
||||
|
||||
HBox blockchainSyncBox = new HBox();
|
||||
blockchainSyncBox.setSpacing(10);
|
||||
blockchainSyncBox.setAlignment(Pos.CENTER);
|
||||
blockchainSyncBox.getChildren().addAll(blockchainSyncLabel, blockchainSyncIndicator, bitcoinNetworkLabel);
|
||||
setLeftAnchor(blockchainSyncBox, 20d);
|
||||
setBottomAnchor(blockchainSyncBox, 7d);
|
||||
|
||||
// version
|
||||
Label versionLabel = new Label();
|
||||
versionLabel.setId("footer-pane");
|
||||
versionLabel.setTextAlignment(TextAlignment.CENTER);
|
||||
versionLabel.setAlignment(Pos.BASELINE_CENTER);
|
||||
versionLabel.setText(model.version);
|
||||
root.widthProperty().addListener((ov, oldValue, newValue) -> {
|
||||
versionLabel.setLayoutX(((double) newValue - versionLabel.getWidth()) / 2);
|
||||
});
|
||||
setBottomAnchor(versionLabel, 7d);
|
||||
|
||||
|
||||
// P2P
|
||||
Label bootstrapLabel = new Label();
|
||||
bootstrapLabel.setId("footer-pane");
|
||||
setRightAnchor(bootstrapLabel, 60d);
|
||||
setBottomAnchor(bootstrapLabel, 7d);
|
||||
bootstrapLabel.textProperty().bind(model.bootstrapInfoFooter);
|
||||
|
||||
ImageView bootstrapIcon = new ImageView();
|
||||
setRightAnchor(bootstrapIcon, 20d);
|
||||
setBottomAnchor(bootstrapIcon, 9d);
|
||||
bootstrapIcon.idProperty().bind(model.bootstrapIconId);
|
||||
|
||||
// line
|
||||
Separator separator = new Separator();
|
||||
separator.setId("footer-pane-line");
|
||||
separator.setPrefHeight(1);
|
||||
setLeftAnchor(separator, 0d);
|
||||
setRightAnchor(separator, 0d);
|
||||
setTopAnchor(separator, 0d);
|
||||
|
||||
AnchorPane footerContainer = new AnchorPane(separator, blockchainSyncBox, versionLabel, bootstrapLabel, bootstrapIcon) {{
|
||||
setId("footer-pane");
|
||||
setMinHeight(30);
|
||||
setMaxHeight(30);
|
||||
}};
|
||||
|
||||
return footerContainer;
|
||||
}
|
||||
|
||||
private HBox createBitcoinInfoBox() {
|
||||
Label blockchainSyncLabel = new Label();
|
||||
blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfo);
|
||||
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
|
||||
|
@ -232,7 +302,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
blockchainSyncBox.setPrefHeight(50);
|
||||
blockchainSyncBox.getChildren().addAll(blockchainSyncLabel, blockchainSyncIndicator,
|
||||
blockchainSyncIcon, bitcoinNetworkLabel);
|
||||
return blockchainSyncBox;
|
||||
}
|
||||
|
||||
private HBox createP2PNetworkBox() {
|
||||
Label bootstrapStateLabel = new Label();
|
||||
bootstrapStateLabel.setWrapText(true);
|
||||
bootstrapStateLabel.setMaxWidth(500);
|
||||
|
@ -272,8 +345,10 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
bootstrapBox.setAlignment(Pos.CENTER);
|
||||
bootstrapBox.setPrefHeight(50);
|
||||
bootstrapBox.getChildren().addAll(bootstrapStateLabel, bootstrapIndicator, bootstrapIcon);
|
||||
return bootstrapBox;
|
||||
}
|
||||
|
||||
// software update
|
||||
private HBox createUpdateBox() {
|
||||
Label updateInfoLabel = new Label();
|
||||
updateInfoLabel.setTextAlignment(TextAlignment.RIGHT);
|
||||
updateInfoLabel.textProperty().bind(model.updateInfo);
|
||||
|
@ -297,8 +372,121 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
updateBox.setAlignment(Pos.CENTER);
|
||||
updateBox.setPrefHeight(20);
|
||||
updateBox.getChildren().addAll(updateInfoLabel, restartButton, updateIcon);
|
||||
return updateBox;
|
||||
}
|
||||
|
||||
vBox.getChildren().addAll(logo, blockchainSyncBox, bootstrapBox, updateBox);
|
||||
private VBox createSplashScreen() {
|
||||
VBox vBox = new VBox();
|
||||
vBox.setAlignment(Pos.CENTER);
|
||||
vBox.setSpacing(0);
|
||||
vBox.setId("splash");
|
||||
|
||||
ImageView logo = new ImageView();
|
||||
logo.setId("image-splash-logo");
|
||||
|
||||
/*Label blockchainSyncLabel = new Label();
|
||||
blockchainSyncLabel.textProperty().bind(model.blockchainSyncInfo);
|
||||
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
|
||||
blockchainSyncLabel.setId("splash-error-state-msg");
|
||||
Popups.openErrorPopup("Error", "Connecting to the bitcoin network failed. \n\nReason: " +
|
||||
newValue);
|
||||
});
|
||||
|
||||
ProgressBar blockchainSyncIndicator = new ProgressBar(-1);
|
||||
blockchainSyncIndicator.setPrefWidth(120);
|
||||
blockchainSyncIndicator.progressProperty().bind(model.blockchainSyncProgress);
|
||||
|
||||
ImageView blockchainSyncIcon = new ImageView();
|
||||
blockchainSyncIcon.setVisible(false);
|
||||
blockchainSyncIcon.setManaged(false);
|
||||
|
||||
model.blockchainSyncIconId.addListener((ov, oldValue, newValue) -> {
|
||||
blockchainSyncIcon.setId(newValue);
|
||||
blockchainSyncIcon.setVisible(true);
|
||||
blockchainSyncIcon.setManaged(true);
|
||||
|
||||
blockchainSyncIndicator.setVisible(false);
|
||||
blockchainSyncIndicator.setManaged(false);
|
||||
});
|
||||
|
||||
Label bitcoinNetworkLabel = new Label();
|
||||
bitcoinNetworkLabel.setText(model.bitcoinNetworkAsString);
|
||||
bitcoinNetworkLabel.setId("splash-bitcoin-network-label");
|
||||
|
||||
HBox blockchainSyncBox = new HBox();
|
||||
blockchainSyncBox.setSpacing(10);
|
||||
blockchainSyncBox.setAlignment(Pos.CENTER);
|
||||
blockchainSyncBox.setPadding(new Insets(40, 0, 0, 0));
|
||||
blockchainSyncBox.setPrefHeight(50);
|
||||
blockchainSyncBox.getChildren().addAll(blockchainSyncLabel, blockchainSyncIndicator,
|
||||
blockchainSyncIcon, bitcoinNetworkLabel);*/
|
||||
|
||||
/* Label bootstrapStateLabel = new Label();
|
||||
bootstrapStateLabel.setWrapText(true);
|
||||
bootstrapStateLabel.setMaxWidth(500);
|
||||
bootstrapStateLabel.setTextAlignment(TextAlignment.CENTER);
|
||||
bootstrapStateLabel.textProperty().bind(model.bootstrapInfo);
|
||||
|
||||
ProgressIndicator bootstrapIndicator = new ProgressIndicator();
|
||||
bootstrapIndicator.setMaxSize(24, 24);
|
||||
bootstrapIndicator.progressProperty().bind(model.bootstrapProgress);
|
||||
|
||||
model.bootstrapErrorMsg.addListener((ov, oldValue, newValue) -> {
|
||||
bootstrapStateLabel.setId("splash-error-state-msg");
|
||||
bootstrapIndicator.setVisible(false);
|
||||
|
||||
Popups.openErrorPopup("Error", "Connecting to the Bitsquare network failed. \n\nReason: " +
|
||||
model.bootstrapErrorMsg.get());
|
||||
});
|
||||
|
||||
ImageView bootstrapIcon = new ImageView();
|
||||
bootstrapIcon.setVisible(false);
|
||||
bootstrapIcon.setManaged(false);
|
||||
|
||||
model.bootstrapIconId.addListener((ov, oldValue, newValue) -> {
|
||||
bootstrapIcon.setId(newValue);
|
||||
bootstrapIcon.setVisible(true);
|
||||
bootstrapIcon.setManaged(true);
|
||||
});
|
||||
model.bootstrapProgress.addListener((ov, oldValue, newValue) -> {
|
||||
if ((double) newValue >= 1) {
|
||||
bootstrapIndicator.setVisible(false);
|
||||
bootstrapIndicator.setManaged(false);
|
||||
}
|
||||
});
|
||||
|
||||
HBox bootstrapBox = new HBox();
|
||||
bootstrapBox.setSpacing(10);
|
||||
bootstrapBox.setAlignment(Pos.CENTER);
|
||||
bootstrapBox.setPrefHeight(50);
|
||||
bootstrapBox.getChildren().addAll(bootstrapStateLabel, bootstrapIndicator, bootstrapIcon);*/
|
||||
|
||||
// software update
|
||||
/* Label updateInfoLabel = new Label();
|
||||
updateInfoLabel.setTextAlignment(TextAlignment.RIGHT);
|
||||
updateInfoLabel.textProperty().bind(model.updateInfo);
|
||||
|
||||
Button restartButton = new Button("Restart");
|
||||
restartButton.setDefaultButton(true);
|
||||
restartButton.visibleProperty().bind(model.showRestartButton);
|
||||
restartButton.managedProperty().bind(model.showRestartButton);
|
||||
restartButton.setOnAction(e -> model.restart());
|
||||
|
||||
ImageView updateIcon = new ImageView();
|
||||
updateIcon.setId(model.updateIconId.get());
|
||||
model.updateIconId.addListener((ov, oldValue, newValue) -> {
|
||||
updateIcon.setId(newValue);
|
||||
updateIcon.setVisible(true);
|
||||
updateIcon.setManaged(true);
|
||||
});
|
||||
|
||||
HBox updateBox = new HBox();
|
||||
updateBox.setSpacing(10);
|
||||
updateBox.setAlignment(Pos.CENTER);
|
||||
updateBox.setPrefHeight(20);
|
||||
updateBox.getChildren().addAll(updateInfoLabel, restartButton, updateIcon);*/
|
||||
|
||||
vBox.getChildren().addAll(logo, createBitcoinInfoBox(), createP2PNetworkBox(), createUpdateBox());
|
||||
return vBox;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package io.bitsquare.gui.main;
|
||||
|
||||
import io.bitsquare.app.UpdateProcess;
|
||||
import io.bitsquare.app.Version;
|
||||
import io.bitsquare.arbitration.ArbitrationRepository;
|
||||
import io.bitsquare.btc.BitcoinNetwork;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
|
@ -27,8 +28,8 @@ import io.bitsquare.gui.common.model.ViewModel;
|
|||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.locale.CountryUtil;
|
||||
import io.bitsquare.p2p.BaseP2PService;
|
||||
import io.bitsquare.p2p.BootstrapState;
|
||||
import io.bitsquare.p2p.ClientNode;
|
||||
import io.bitsquare.p2p.tomp2p.BootstrappedPeerBuilder;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.TradeManager;
|
||||
import io.bitsquare.trade.offer.OpenOfferManager;
|
||||
|
@ -61,18 +62,22 @@ class MainViewModel implements ViewModel {
|
|||
|
||||
// BTC network
|
||||
final StringProperty blockchainSyncInfo = new SimpleStringProperty("Initializing");
|
||||
final StringProperty blockchainSyncInfoFooter = new SimpleStringProperty("Initializing");
|
||||
final DoubleProperty blockchainSyncProgress = new SimpleDoubleProperty(-1);
|
||||
final StringProperty walletServiceErrorMsg = new SimpleStringProperty();
|
||||
final StringProperty blockchainSyncIconId = new SimpleStringProperty();
|
||||
|
||||
// P2P network
|
||||
final StringProperty bootstrapInfo = new SimpleStringProperty();
|
||||
final StringProperty bootstrapInfo = new SimpleStringProperty("Connecting to P2P network...");
|
||||
final StringProperty bootstrapInfoFooter = new SimpleStringProperty();
|
||||
final DoubleProperty bootstrapProgress = new SimpleDoubleProperty(-1);
|
||||
final StringProperty bootstrapErrorMsg = new SimpleStringProperty();
|
||||
final StringProperty bootstrapIconId = new SimpleStringProperty();
|
||||
|
||||
// software update
|
||||
final StringProperty updateInfo = new SimpleStringProperty();
|
||||
String version = "v." + Version.VERSION;
|
||||
|
||||
final BooleanProperty showRestartButton = new SimpleBooleanProperty(false);
|
||||
final StringProperty updateIconId = new SimpleStringProperty();
|
||||
|
||||
|
@ -110,7 +115,7 @@ class MainViewModel implements ViewModel {
|
|||
this.updateProcess = updateProcess;
|
||||
this.formatter = formatter;
|
||||
|
||||
bitcoinNetworkAsString = bitcoinNetwork.toString();
|
||||
bitcoinNetworkAsString = formatter.formatBitcoinNetwork(bitcoinNetwork);
|
||||
|
||||
updateProcess.state.addListener((observableValue, oldValue, newValue) -> applyUpdateState(newValue));
|
||||
applyUpdateState(updateProcess.state.get());
|
||||
|
@ -131,26 +136,22 @@ class MainViewModel implements ViewModel {
|
|||
public void initBackend() {
|
||||
Platform.runLater(updateProcess::init);
|
||||
|
||||
setBitcoinNetworkSyncProgress(-1);
|
||||
walletService.getDownloadProgress().subscribe(
|
||||
percentage -> Platform.runLater(() -> {
|
||||
if (percentage > 0)
|
||||
setBitcoinNetworkSyncProgress(percentage / 100.0);
|
||||
}),
|
||||
error -> log.error(error.toString()),
|
||||
() -> Platform.runLater(() -> setBitcoinNetworkSyncProgress(1.0)));
|
||||
walletService.downloadPercentageProperty().addListener((ov, oldValue, newValue) -> {
|
||||
setBitcoinNetworkSyncProgress((double) newValue);
|
||||
});
|
||||
setBitcoinNetworkSyncProgress(walletService.downloadPercentageProperty().get());
|
||||
|
||||
// Set executor for all P2PServices
|
||||
BaseP2PService.setUserThread(Platform::runLater);
|
||||
|
||||
Observable<BootstrapState> bootstrapStateAsObservable = clientNode.bootstrap(keyRing.getDhtSignatureKeyPair());
|
||||
Observable<BootstrappedPeerBuilder.State> bootstrapStateAsObservable = clientNode.bootstrap(keyRing.getDhtSignatureKeyPair());
|
||||
bootstrapStateAsObservable.publish();
|
||||
bootstrapStateAsObservable.subscribe(
|
||||
state -> Platform.runLater(() -> setBootstrapState(state)),
|
||||
error -> Platform.runLater(() -> {
|
||||
log.error(error.toString());
|
||||
bootstrapErrorMsg.set(error.getMessage());
|
||||
bootstrapInfo.set("Connecting to the Bitsquare network failed.");
|
||||
bootstrapInfo.set("Connecting to the P2P network failed.");
|
||||
bootstrapProgress.set(0);
|
||||
|
||||
}),
|
||||
|
@ -220,7 +221,7 @@ class MainViewModel implements ViewModel {
|
|||
private void applyUpdateState(UpdateProcess.State state) {
|
||||
switch (state) {
|
||||
case CHECK_FOR_UPDATES:
|
||||
updateInfo.set("Checking for updates...");
|
||||
updateInfo.set("Check for updates...");
|
||||
updateIconId.set("image-update-in-progress");
|
||||
break;
|
||||
case UPDATE_AVAILABLE:
|
||||
|
@ -229,30 +230,33 @@ class MainViewModel implements ViewModel {
|
|||
showRestartButton.set(true);
|
||||
break;
|
||||
case UP_TO_DATE:
|
||||
updateInfo.set("Software is up to date.");
|
||||
updateInfo.set("Software is up to date. Version: " + Version.VERSION);
|
||||
updateIconId.set("image-update-up-to-date");
|
||||
break;
|
||||
case FAILURE:
|
||||
updateInfo.set(updateProcess.getErrorMessage());
|
||||
log.error(updateProcess.getErrorMessage());
|
||||
updateInfo.set("Check for updates failed. ");
|
||||
updateIconId.set("image-update-failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void setBootstrapState(BootstrapState state) {
|
||||
private void setBootstrapState(BootstrappedPeerBuilder.State state) {
|
||||
switch (state) {
|
||||
case DISCOVERY_DIRECT_SUCCEEDED:
|
||||
bootstrapIconId.set("image-connection-direct");
|
||||
bootstrapInfoFooter.set("Direct connection");
|
||||
break;
|
||||
case DISCOVERY_MANUAL_PORT_FORWARDING_SUCCEEDED:
|
||||
case DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED:
|
||||
bootstrapIconId.set("image-connection-nat");
|
||||
bootstrapInfoFooter.set("Connected with port forwarding");
|
||||
break;
|
||||
case RELAY_SUCCEEDED:
|
||||
bootstrapIconId.set("image-connection-relay");
|
||||
bootstrapInfoFooter.set("Connected with relay node");
|
||||
break;
|
||||
default:
|
||||
bootstrapIconId.set(null);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -261,15 +265,13 @@ class MainViewModel implements ViewModel {
|
|||
case DISCOVERY_MANUAL_PORT_FORWARDING_SUCCEEDED:
|
||||
case DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED:
|
||||
case RELAY_SUCCEEDED:
|
||||
bootstrapInfo.set("Bootstrapping to P2P network: " + state.getMessage());
|
||||
bootstrapInfo.set(state.getMessage());
|
||||
bootstrapProgress.set(-1);
|
||||
break;
|
||||
case BOOT_STRAP_SUCCEEDED:
|
||||
bootstrapInfo.set("Successfully connected to P2P network: " + state.getMessage());
|
||||
bootstrapProgress.set(1);
|
||||
break;
|
||||
default:
|
||||
bootstrapInfo.set("Connecting to P2P network: " + state.getMessage());
|
||||
bootstrapProgress.set(-1);
|
||||
break;
|
||||
}
|
||||
|
@ -278,6 +280,7 @@ class MainViewModel implements ViewModel {
|
|||
private void setWalletServiceException(Throwable error) {
|
||||
setBitcoinNetworkSyncProgress(0);
|
||||
blockchainSyncInfo.set("Connecting to the bitcoin network failed.");
|
||||
blockchainSyncInfoFooter.set("Connection failed.");
|
||||
if (error instanceof TimeoutException) {
|
||||
walletServiceErrorMsg.set("Please check your network connection.\n\n" +
|
||||
"You must allow outgoing TCP connections to port 18333 for the bitcoin testnet.\n\n" +
|
||||
|
@ -332,9 +335,11 @@ class MainViewModel implements ViewModel {
|
|||
}
|
||||
else if (value > 0.0) {
|
||||
blockchainSyncInfo.set("Synchronizing blockchain: " + formatter.formatToPercent(value));
|
||||
blockchainSyncInfoFooter.set("Synchronizing: " + formatter.formatToPercent(value));
|
||||
}
|
||||
else {
|
||||
blockchainSyncInfo.set("Connecting to the bitcoin network...");
|
||||
blockchainSyncInfoFooter.set("Connecting...");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package io.bitsquare.gui.main.settings.network;
|
|||
import io.bitsquare.btc.BitcoinNetwork;
|
||||
import io.bitsquare.gui.common.view.FxmlView;
|
||||
import io.bitsquare.gui.common.view.InitializableView;
|
||||
import io.bitsquare.gui.util.BSFormatter;
|
||||
import io.bitsquare.p2p.ClientNode;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -30,19 +31,19 @@ import javafx.scene.control.*;
|
|||
@FxmlView
|
||||
public class NetworkSettingsView extends InitializableView {
|
||||
|
||||
private final String bitcoinNetworkValue;
|
||||
private final String bitcoinNetworkString;
|
||||
private final ClientNode clientNode;
|
||||
|
||||
@FXML TextField bitcoinNetwork, connectionType, nodeAddress, bootstrapNodeAddress;
|
||||
|
||||
@Inject
|
||||
public NetworkSettingsView(BitcoinNetwork bitcoinNetwork, ClientNode clientNode) {
|
||||
this.bitcoinNetworkValue = bitcoinNetwork.toString();
|
||||
public NetworkSettingsView(BitcoinNetwork bitcoinNetwork, ClientNode clientNode, BSFormatter formatter) {
|
||||
this.bitcoinNetworkString = formatter.formatBitcoinNetwork(bitcoinNetwork);
|
||||
this.clientNode = clientNode;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
bitcoinNetwork.setText(bitcoinNetworkValue);
|
||||
bitcoinNetwork.setText(bitcoinNetworkString);
|
||||
connectionType.setText(clientNode.getConnectionType().toString());
|
||||
nodeAddress.setText(clientNode.getAddress().toString());
|
||||
bootstrapNodeAddress.setText(clientNode.getBootstrapNodeAddress().toString());
|
||||
|
|
|
@ -19,6 +19,7 @@ package io.bitsquare.gui.util;
|
|||
|
||||
import io.bitsquare.arbitration.ArbitrationRepository;
|
||||
import io.bitsquare.arbitration.Arbitrator;
|
||||
import io.bitsquare.btc.BitcoinNetwork;
|
||||
import io.bitsquare.locale.BSResources;
|
||||
import io.bitsquare.locale.Country;
|
||||
import io.bitsquare.locale.CurrencyUtil;
|
||||
|
@ -363,4 +364,17 @@ public class BSFormatter {
|
|||
Date unlockDate = new Date(new Date().getTime() + missingBlocks * 10 * 60 * 1000);
|
||||
return dateFormatter.format(unlockDate) + " " + timeFormatter.format(unlockDate);
|
||||
}
|
||||
|
||||
public String formatBitcoinNetwork(BitcoinNetwork bitcoinNetwork) {
|
||||
switch (bitcoinNetwork) {
|
||||
case MAINNET:
|
||||
return "Mainnet";
|
||||
case TESTNET:
|
||||
return "Testnet";
|
||||
case REGTEST:
|
||||
return "Regtest";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue