Improve UIs (setting, main)

This commit is contained in:
Manfred Karrer 2015-12-30 12:24:08 +01:00
parent c2dbd55e77
commit 65ad9aa709
9 changed files with 32 additions and 31 deletions

View File

@ -73,7 +73,7 @@ import static io.bitsquare.app.BitsquareEnvironment.APP_NAME_KEY;
public class BitsquareApp extends Application {
private static final Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(BitsquareApp.class);
public static final boolean DEV_MODE = false;
public static final boolean DEV_MODE = true;
public static final boolean IS_RELEASE_VERSION = !DEV_MODE && true;
private static Environment env;

View File

@ -74,11 +74,6 @@ bg color of non edit textFields: fafafa
-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;

View File

@ -350,17 +350,16 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
blockchainSyncIndicator.progressProperty().bind(model.blockchainSyncProgress);
Label bitcoinNetworkLabel = new Label();
bitcoinNetworkLabel.setId("footer-bitcoin-network-label");
bitcoinNetworkLabel.setText(model.bitcoinNetworkAsString);
bitcoinNetworkLabel.setText("/ Bitcoin network: " + model.bitcoinNetworkAsString);
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
bitcoinNetworkLabel.setId("splash-error-state-msg");
bitcoinNetworkLabel.setText("Not connected");
bitcoinNetworkLabel.setText("/ Bitcoin network: Not connected");
openBTCConnectionErrorPopup(newValue);
} else {
bitcoinNetworkLabel.setId("footer-bitcoin-network-label");
bitcoinNetworkLabel.setText(model.bitcoinNetworkAsString);
bitcoinNetworkLabel.setText("/ Bitcoin network: " + model.bitcoinNetworkAsString);
}
});
@ -368,8 +367,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
if ((double) newValue >= 1) {
blockchainSyncIndicator.setVisible(false);
blockchainSyncIndicator.setManaged(false);
blockchainSyncLabel.setVisible(false);
blockchainSyncLabel.setManaged(false);
}
});

View File

@ -252,7 +252,7 @@ class MainViewModel implements ViewModel {
log.debug("Bitcoin peers " + newValue);
numBTCPeers = (int) newValue;
numBTCPeersAsString.set(String.valueOf(newValue) + " peers");
if (blockchainSyncProgress.get() >= 1 && numBTCPeers > 1)
if (blockchainSyncProgress.get() >= 1 && numBTCPeers > 0)
blockchainSyncInfoFooter.set("Bitcoin network: Peers: " + numBTCPeers);
/* if ((int) newValue < 1) {
@ -591,6 +591,7 @@ class MainViewModel implements ViewModel {
blockchainSyncInfo.set("Blockchain synchronization complete." + nrOfPeers);
blockchainSyncIconId.set("image-connection-synced");
blockchainSyncInfoFooter.set("Bitcoin network: Peers: " + numBTCPeers);
} else if (value > 0.0) {
// We stop as soon the download started the timeout
stopBlockchainSyncTimeout();

View File

@ -51,8 +51,10 @@ public class AccountSettingsView extends ActivatableViewAndModel {
private MenuItem password, seedWords, backup, paymentAccount, arbitratorSelection;
private Navigation.Listener listener;
@FXML private VBox leftVBox;
@FXML private AnchorPane content;
@FXML
private VBox leftVBox;
@FXML
private AnchorPane content;
@Inject
private AccountSettingsView(CachingViewLoader viewLoader, Navigation navigation) {
@ -77,7 +79,7 @@ public class AccountSettingsView extends ActivatableViewAndModel {
arbitratorSelection = new MenuItem(navigation, toggleGroup, "Arbitrator selection", ArbitratorSelectionView.class, AwesomeIcon.USER_MD);
// registration = new MenuItem(navigation, toggleGroup, "Renew your account", RegistrationView.class, AwesomeIcon.BRIEFCASE);
leftVBox.getChildren().addAll(password, seedWords, backup, paymentAccount, arbitratorSelection);
leftVBox.getChildren().addAll(arbitratorSelection, paymentAccount, password, seedWords, backup);
}
@Override
@ -85,9 +87,8 @@ public class AccountSettingsView extends ActivatableViewAndModel {
navigation.addListener(listener);
ViewPath viewPath = navigation.getCurrentPath();
if (viewPath.size() == 3 && viewPath.indexOf(AccountSettingsView.class) == 2) {
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, PasswordView.class);
}
else if (viewPath.size() == 4 && viewPath.indexOf(AccountSettingsView.class) == 2) {
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, ArbitratorSelectionView.class);
} else if (viewPath.size() == 4 && viewPath.indexOf(AccountSettingsView.class) == 2) {
loadView(viewPath.get(3));
}
}
@ -148,8 +149,7 @@ class MenuItem extends ToggleButton {
if (newValue) {
setId("account-settings-item-background-selected");
icon.setTextFill(Colors.BLUE);
}
else {
} else {
setId("account-settings-item-background-active");
icon.setTextFill(Paint.valueOf("#333"));
}
@ -159,8 +159,7 @@ class MenuItem extends ToggleButton {
if (newValue) {
setId("account-settings-item-background-disabled");
icon.setTextFill(Paint.valueOf("#ccc"));
}
else {
} else {
setId("account-settings-item-background-active");
icon.setTextFill(Paint.valueOf("#333"));
}

View File

@ -25,6 +25,6 @@
AnchorPane.rightAnchor="0" AnchorPane.topAnchor="0"
xmlns:fx="http://javafx.com/fxml">
<Tab fx:id="preferencesTab" text="Preferences" closable="false"/>
<Tab fx:id="networkSettingsTab" text="Network info" closable="false"/>
<Tab fx:id="preferencesTab" text="Preferences" closable="false"/>
</TabPane>

View File

@ -52,13 +52,14 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
@Override
public void initialize() {
addTitledGroupBg(root, gridRow, 9, "Preferences");
tradeCurrencyComboBox = addLabelComboBox(root, ++gridRow, "Preferred currency:", Layout.FIRST_ROW_DISTANCE).second;
addTitledGroupBg(root, gridRow, 3, "Preferences");
tradeCurrencyComboBox = addLabelComboBox(root, gridRow, "Preferred currency:", Layout.FIRST_ROW_DISTANCE).second;
languageComboBox = addLabelComboBox(root, ++gridRow, "Language:").second;
// btcDenominationComboBox = addLabelComboBox(root, gridRow, "Bitcoin denomination:", Layout.FIRST_ROW_DISTANCE).second;
// btcDenominationComboBox = addLabelComboBox(root, ++gridRow, "Bitcoin denomination:").second;
blockExplorerComboBox = addLabelComboBox(root, ++gridRow, "Bitcoin block explorer:").second;
useAnimationsCheckBox = addLabelCheckBox(root, ++gridRow, "Use animations:", "").second;
addTitledGroupBg(root, ++gridRow, 5, "Display options", Layout.GROUP_DISTANCE);
useAnimationsCheckBox = addLabelCheckBox(root, gridRow, "Use animations:", "", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
useEffectsCheckBox = addLabelCheckBox(root, ++gridRow, "Use effects:", "").second;
showPlaceOfferConfirmationCheckBox = addLabelCheckBox(root, ++gridRow, "Show confirmation at place offer:", "").second;
showTakeOfferConfirmationCheckBox = addLabelCheckBox(root, ++gridRow, "Show confirmation at take offer:", "").second;
@ -102,7 +103,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
});
languageComboBox.setOnAction(e -> model.onSelectLanguageCode(languageComboBox.getSelectionModel().getSelectedItem()));
blockExplorerComboBox.setItems(model.blockExplorers);
blockExplorerComboBox.getSelectionModel().select(model.getBlockExplorer());
blockExplorerComboBox.setConverter(new StringConverter<BlockChainExplorer>() {

View File

@ -176,6 +176,8 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
preferences.setBitcoinNetwork(netWorkComboBox.getSelectionModel().getSelectedItem());
UserThread.runAfter(() -> BitsquareApp.shutDownHandler.run(), 1);
})
.actionButtonText("Shut down")
.closeButtonText("Cancel")
.onClose(() -> netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork()))
.show();
}

View File

@ -358,11 +358,17 @@ public class FormBuilder {
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple2<Label, CheckBox> addLabelCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle) {
Label label = addLabel(gridPane, rowIndex, title, -3);
return addLabelCheckBox(gridPane, rowIndex, title, checkBoxTitle, 0);
}
public static Tuple2<Label, CheckBox> addLabelCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle, double top) {
Label label = addLabel(gridPane, rowIndex, title, -3);
GridPane.setMargin(label, new Insets(top, 0, 0, 0));
CheckBox checkBox = new CheckBox(checkBoxTitle);
GridPane.setRowIndex(checkBox, rowIndex);
GridPane.setColumnIndex(checkBox, 1);
GridPane.setMargin(checkBox, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(checkBox);
return new Tuple2<>(label, checkBox);