mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-05 21:24:19 -04:00
Improve Layout, add open data dir button
This commit is contained in:
parent
75edc3e17e
commit
97ccd6ad99
6 changed files with 34 additions and 24 deletions
|
@ -164,7 +164,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void buildForm() {
|
private void buildForm() {
|
||||||
addTitledGroupBg(root, gridRow, 2, "Manage accounts");
|
addTitledGroupBg(root, gridRow, 1, "Manage accounts");
|
||||||
|
|
||||||
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your cryptocurrency accounts:", Layout.FIRST_ROW_DISTANCE);
|
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your cryptocurrency accounts:", Layout.FIRST_ROW_DISTANCE);
|
||||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||||
|
@ -200,7 +200,7 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addAccountButton = addButton(root, ++gridRow, "Add new account");
|
addAccountButton = addButtonAfterGroup(root, ++gridRow, "Add new account");
|
||||||
addAccountButton.setOnAction(event -> addNewAccount());
|
addAccountButton.setOnAction(event -> addNewAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void addLanguageGroup() {
|
private void addLanguageGroup() {
|
||||||
addTitledGroupBg(root, gridRow, 2, "Which languages do you speak?");
|
addTitledGroupBg(root, gridRow, 1, "Which languages do you speak?");
|
||||||
|
|
||||||
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your languages:", Layout.FIRST_ROW_DISTANCE);
|
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your languages:", Layout.FIRST_ROW_DISTANCE);
|
||||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||||
|
@ -165,7 +165,7 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
languageComboBox = addLabelComboBox(root, ++gridRow).second;
|
languageComboBox = addLabelComboBox(root, ++gridRow, "", 15).second;
|
||||||
languageComboBox.setPromptText("Add language");
|
languageComboBox.setPromptText("Add language");
|
||||||
languageComboBox.setConverter(new StringConverter<String>() {
|
languageComboBox.setConverter(new StringConverter<String>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,13 +18,15 @@
|
||||||
package io.bitsquare.gui.main.account.content.backup;
|
package io.bitsquare.gui.main.account.content.backup;
|
||||||
|
|
||||||
import io.bitsquare.app.BitsquareEnvironment;
|
import io.bitsquare.app.BitsquareEnvironment;
|
||||||
|
import io.bitsquare.common.util.Tuple3;
|
||||||
|
import io.bitsquare.common.util.Utilities;
|
||||||
import io.bitsquare.gui.common.view.ActivatableView;
|
import io.bitsquare.gui.common.view.ActivatableView;
|
||||||
import io.bitsquare.gui.common.view.FxmlView;
|
import io.bitsquare.gui.common.view.FxmlView;
|
||||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||||
import io.bitsquare.gui.util.BSFormatter;
|
|
||||||
import io.bitsquare.gui.util.Layout;
|
import io.bitsquare.gui.util.Layout;
|
||||||
import io.bitsquare.user.Preferences;
|
import io.bitsquare.user.Preferences;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
|
@ -44,13 +46,13 @@ import static io.bitsquare.gui.util.FormBuilder.*;
|
||||||
public class BackupView extends ActivatableView<GridPane, Void> {
|
public class BackupView extends ActivatableView<GridPane, Void> {
|
||||||
|
|
||||||
|
|
||||||
|
private final File dataDir;
|
||||||
private int gridRow = 0;
|
private int gridRow = 0;
|
||||||
private final Stage stage;
|
private final Stage stage;
|
||||||
private final Preferences preferences;
|
private final Preferences preferences;
|
||||||
private final BitsquareEnvironment environment;
|
|
||||||
private final BSFormatter formatter;
|
|
||||||
private Button selectBackupDir, backupNow;
|
private Button selectBackupDir, backupNow;
|
||||||
private TextField backUpLocationTextField;
|
private TextField backUpLocationTextField;
|
||||||
|
private Button openDataDir;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -58,24 +60,25 @@ public class BackupView extends ActivatableView<GridPane, Void> {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private BackupView(Stage stage, Preferences preferences, BitsquareEnvironment environment, BSFormatter formatter) {
|
private BackupView(Stage stage, Preferences preferences, BitsquareEnvironment environment) {
|
||||||
super();
|
super();
|
||||||
this.stage = stage;
|
this.stage = stage;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
this.environment = environment;
|
dataDir = new File(environment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY));
|
||||||
this.formatter = formatter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
addTitledGroupBg(root, gridRow, 3, "Backup wallet and data");
|
addTitledGroupBg(root, gridRow, 2, "Backup wallet and data directory");
|
||||||
backUpLocationTextField = addLabelTextField(root, gridRow, "Backup location:", "", Layout.FIRST_ROW_DISTANCE).second;
|
Tuple3<Label, TextField, Button> tuple = addLabelTextFieldButton(root, gridRow, "Backup location:", "Select backup location", Layout.FIRST_ROW_DISTANCE);
|
||||||
|
|
||||||
|
backUpLocationTextField = tuple.second;
|
||||||
if (preferences.getBackupDirectory() != null)
|
if (preferences.getBackupDirectory() != null)
|
||||||
backUpLocationTextField.setText(preferences.getBackupDirectory());
|
backUpLocationTextField.setText(preferences.getBackupDirectory());
|
||||||
|
selectBackupDir = tuple.third;
|
||||||
selectBackupDir = addButton(root, ++gridRow, "Select backup location");
|
openDataDir = addLabelButton(root, ++gridRow, "Application data directory:", "Open directory", 0).second;
|
||||||
selectBackupDir.setDefaultButton(preferences.getBackupDirectory() == null);
|
openDataDir.setDefaultButton(false);
|
||||||
backupNow = addButton(root, ++gridRow, "Backup now (backup is not encrypted!)");
|
backupNow = addButtonAfterGroup(root, ++gridRow, "Backup now (backup is not encrypted!)");
|
||||||
backupNow.setDisable(preferences.getBackupDirectory() == null || preferences.getBackupDirectory().length() == 0);
|
backupNow.setDisable(preferences.getBackupDirectory() == null || preferences.getBackupDirectory().length() == 0);
|
||||||
backupNow.setDefaultButton(preferences.getBackupDirectory() != null);
|
backupNow.setDefaultButton(preferences.getBackupDirectory() != null);
|
||||||
}
|
}
|
||||||
|
@ -95,14 +98,21 @@ public class BackupView extends ActivatableView<GridPane, Void> {
|
||||||
selectBackupDir.setDefaultButton(false);
|
selectBackupDir.setDefaultButton(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
openDataDir.setOnAction(e -> {
|
||||||
|
try {
|
||||||
|
Utilities.openDirectory(dataDir);
|
||||||
|
} catch (IOException e1) {
|
||||||
|
log.error(e1.getMessage());
|
||||||
|
new Popup().warning("Cannot open directory.\nError =" + e1.getMessage()).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
backupNow.setOnAction(e -> {
|
backupNow.setOnAction(e -> {
|
||||||
String backupDirectory = preferences.getBackupDirectory();
|
String backupDirectory = preferences.getBackupDirectory();
|
||||||
if (backupDirectory.length() > 0) {
|
if (backupDirectory.length() > 0) {
|
||||||
try {
|
try {
|
||||||
String dateString = new SimpleDateFormat("YYYY-MM-dd-HHmmss").format(new Date());
|
String dateString = new SimpleDateFormat("YYYY-MM-dd-HHmmss").format(new Date());
|
||||||
String destination = Paths.get(backupDirectory, "bitsquare_backup_" + dateString).toString();
|
String destination = Paths.get(backupDirectory, "bitsquare_backup_" + dateString).toString();
|
||||||
FileUtils.copyDirectory(new File(environment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY)),
|
FileUtils.copyDirectory(dataDir,
|
||||||
new File(destination));
|
new File(destination));
|
||||||
new Popup().feedback("Backup successfully saved at:\n" + destination).show();
|
new Popup().feedback("Backup successfully saved at:\n" + destination).show();
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void buildForm() {
|
private void buildForm() {
|
||||||
addTitledGroupBg(root, gridRow, 2, "Manage accounts");
|
addTitledGroupBg(root, gridRow, 1, "Manage accounts");
|
||||||
|
|
||||||
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your national currency\naccounts:", Layout.FIRST_ROW_DISTANCE);
|
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your national currency\naccounts:", Layout.FIRST_ROW_DISTANCE);
|
||||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||||
|
@ -204,7 +204,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addAccountButton = addButton(root, ++gridRow, "Add new account");
|
addAccountButton = addButtonAfterGroup(root, ++gridRow, "Add new account");
|
||||||
addAccountButton.setOnAction(event -> addNewAccount());
|
addAccountButton.setOnAction(event -> addNewAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
headline = addTitledGroupBg(root, gridRow, 3, "");
|
headline = addTitledGroupBg(root, gridRow, 2, "");
|
||||||
passwordField = addLabelPasswordTextField(root, gridRow, "Enter password:", Layout.FIRST_ROW_DISTANCE).second;
|
passwordField = addLabelPasswordTextField(root, gridRow, "Enter password:", Layout.FIRST_ROW_DISTANCE).second;
|
||||||
passwordField.setValidator(passwordValidator);
|
passwordField.setValidator(passwordValidator);
|
||||||
passwordFieldChangeListener = (observable, oldValue, newValue) -> validatePasswords();
|
passwordFieldChangeListener = (observable, oldValue, newValue) -> validatePasswords();
|
||||||
|
@ -83,7 +83,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
|
||||||
repeatedPasswordField.setValidator(passwordValidator);
|
repeatedPasswordField.setValidator(passwordValidator);
|
||||||
repeatedPasswordFieldChangeListener = (observable, oldValue, newValue) -> validatePasswords();
|
repeatedPasswordFieldChangeListener = (observable, oldValue, newValue) -> validatePasswords();
|
||||||
|
|
||||||
Tuple3<Button, ProgressIndicator, Label> tuple = addButtonWithStatus(root, ++gridRow, "", 0);
|
Tuple3<Button, ProgressIndicator, Label> tuple = addButtonWithStatus(root, ++gridRow, "", 15);
|
||||||
pwButton = tuple.first;
|
pwButton = tuple.first;
|
||||||
ProgressIndicator progressIndicator = tuple.second;
|
ProgressIndicator progressIndicator = tuple.second;
|
||||||
progressIndicator.setVisible(false);
|
progressIndicator.setVisible(false);
|
||||||
|
|
|
@ -94,11 +94,11 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
|
||||||
datePicker = addLabelDatePicker(root, ++gridRow, "Creation Date:").second;
|
datePicker = addLabelDatePicker(root, ++gridRow, "Creation Date:").second;
|
||||||
datePicker.setMouseTransparent(true);
|
datePicker.setMouseTransparent(true);
|
||||||
|
|
||||||
addTitledGroupBg(root, ++gridRow, 3, "Restore your wallet seed words", Layout.GROUP_DISTANCE);
|
addTitledGroupBg(root, ++gridRow, 2, "Restore your wallet seed words", Layout.GROUP_DISTANCE);
|
||||||
restorSeedWordsTextArea = addLabelTextArea(root, gridRow, "Wallet seed words:", "", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
restorSeedWordsTextArea = addLabelTextArea(root, gridRow, "Wallet seed words:", "", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||||
restorSeedWordsTextArea.setPrefHeight(60);
|
restorSeedWordsTextArea.setPrefHeight(60);
|
||||||
restoreDatePicker = addLabelDatePicker(root, ++gridRow, "Creation Date:").second;
|
restoreDatePicker = addLabelDatePicker(root, ++gridRow, "Creation Date:").second;
|
||||||
restoreButton = addButton(root, ++gridRow, "Restore wallet");
|
restoreButton = addButtonAfterGroup(root, ++gridRow, "Restore wallet");
|
||||||
|
|
||||||
addTitledGroupBg(root, ++gridRow, 1, "Information", Layout.GROUP_DISTANCE);
|
addTitledGroupBg(root, ++gridRow, 1, "Information", Layout.GROUP_DISTANCE);
|
||||||
addMultilineLabel(root, gridRow, "Please write down you wallet seed words and the creation date.\n" +
|
addMultilineLabel(root, gridRow, "Please write down you wallet seed words and the creation date.\n" +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue