mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
rename preferences to settings
This commit is contained in:
parent
8b47701dbe
commit
8f438cd0bc
28 changed files with 113 additions and 115 deletions
|
|
@ -23,8 +23,8 @@ import com.sparrowwallet.sparrow.io.bbqr.BBQR;
|
||||||
import com.sparrowwallet.sparrow.io.bbqr.BBQRType;
|
import com.sparrowwallet.sparrow.io.bbqr.BBQRType;
|
||||||
import com.sparrowwallet.sparrow.net.ElectrumServer;
|
import com.sparrowwallet.sparrow.net.ElectrumServer;
|
||||||
import com.sparrowwallet.sparrow.net.ServerType;
|
import com.sparrowwallet.sparrow.net.ServerType;
|
||||||
import com.sparrowwallet.sparrow.preferences.PreferenceGroup;
|
import com.sparrowwallet.sparrow.settings.SettingsGroup;
|
||||||
import com.sparrowwallet.sparrow.preferences.PreferencesDialog;
|
import com.sparrowwallet.sparrow.settings.SettingsDialog;
|
||||||
import com.sparrowwallet.sparrow.paynym.PayNymDialog;
|
import com.sparrowwallet.sparrow.paynym.PayNymDialog;
|
||||||
import com.sparrowwallet.sparrow.transaction.TransactionController;
|
import com.sparrowwallet.sparrow.transaction.TransactionController;
|
||||||
import com.sparrowwallet.sparrow.transaction.TransactionData;
|
import com.sparrowwallet.sparrow.transaction.TransactionData;
|
||||||
|
|
@ -456,11 +456,11 @@ public class AppController implements Initializable {
|
||||||
OsType osType = OsType.getCurrent();
|
OsType osType = OsType.getCurrent();
|
||||||
if(osType == OsType.MACOS) {
|
if(osType == OsType.MACOS) {
|
||||||
MenuToolkit tk = MenuToolkit.toolkit();
|
MenuToolkit tk = MenuToolkit.toolkit();
|
||||||
MenuItem preferences = new MenuItem("Settings...");
|
MenuItem settings = new MenuItem("Settings...");
|
||||||
preferences.setOnAction(this::openPreferences);
|
settings.setOnAction(this::openSettings);
|
||||||
preferences.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.META_DOWN));
|
settings.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.META_DOWN));
|
||||||
Menu defaultApplicationMenu = new Menu("Apple", null, tk.createAboutMenuItem(SparrowWallet.APP_NAME, getAboutStage()), new SeparatorMenuItem(),
|
Menu defaultApplicationMenu = new Menu("Apple", null, tk.createAboutMenuItem(SparrowWallet.APP_NAME, getAboutStage()), new SeparatorMenuItem(),
|
||||||
preferences, new SeparatorMenuItem(),
|
settings, new SeparatorMenuItem(),
|
||||||
tk.createHideMenuItem(SparrowWallet.APP_NAME), tk.createHideOthersMenuItem(), tk.createUnhideAllMenuItem(), new SeparatorMenuItem(),
|
tk.createHideMenuItem(SparrowWallet.APP_NAME), tk.createHideOthersMenuItem(), tk.createUnhideAllMenuItem(), new SeparatorMenuItem(),
|
||||||
tk.createQuitMenuItem(SparrowWallet.APP_NAME));
|
tk.createQuitMenuItem(SparrowWallet.APP_NAME));
|
||||||
tk.setApplicationMenu(defaultApplicationMenu);
|
tk.setApplicationMenu(defaultApplicationMenu);
|
||||||
|
|
@ -498,7 +498,7 @@ public class AppController implements Initializable {
|
||||||
welcomeDialog.initOwner(rootStack.getScene().getWindow());
|
welcomeDialog.initOwner(rootStack.getScene().getWindow());
|
||||||
Optional<Mode> optionalMode = welcomeDialog.showAndWait();
|
Optional<Mode> optionalMode = welcomeDialog.showAndWait();
|
||||||
if(optionalMode.isPresent() && optionalMode.get().equals(Mode.ONLINE)) {
|
if(optionalMode.isPresent() && optionalMode.get().equals(Mode.ONLINE)) {
|
||||||
openPreferences(PreferenceGroup.SERVER);
|
openSettings(SettingsGroup.SERVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1387,18 +1387,18 @@ public class AppController implements Initializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openPreferences(ActionEvent event) {
|
public void openSettings(ActionEvent event) {
|
||||||
openPreferences(PreferenceGroup.GENERAL);
|
openSettings(SettingsGroup.GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openServerPreferences(ActionEvent event) {
|
public void openServerSettings(ActionEvent event) {
|
||||||
openPreferences(PreferenceGroup.SERVER);
|
openSettings(SettingsGroup.SERVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openPreferences(PreferenceGroup preferenceGroup) {
|
private void openSettings(SettingsGroup settingsGroup) {
|
||||||
PreferencesDialog preferencesDialog = new PreferencesDialog(preferenceGroup);
|
SettingsDialog settingsDialog = new SettingsDialog(settingsGroup);
|
||||||
preferencesDialog.initOwner(rootStack.getScene().getWindow());
|
settingsDialog.initOwner(rootStack.getScene().getWindow());
|
||||||
preferencesDialog.showAndWait();
|
settingsDialog.showAndWait();
|
||||||
configureSwitchServer();
|
configureSwitchServer();
|
||||||
serverToggle.setDisable(!Config.get().hasServer());
|
serverToggle.setDisable(!Config.get().hasServer());
|
||||||
}
|
}
|
||||||
|
|
@ -2758,8 +2758,8 @@ 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();
|
||||||
Hyperlink hyperlink = new Hyperlink("Server Preferences");
|
Hyperlink hyperlink = new Hyperlink("Server Settings");
|
||||||
hyperlink.setOnAction(this::openServerPreferences);
|
hyperlink.setOnAction(this::openServerSettings);
|
||||||
statusUpdated(new StatusEvent(status, hyperlink));
|
statusUpdated(new StatusEvent(status, hyperlink));
|
||||||
serverToggleStopAnimation();
|
serverToggleStopAnimation();
|
||||||
setTorIcon();
|
setTorIcon();
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import com.sparrowwallet.sparrow.io.Config;
|
||||||
import com.sparrowwallet.sparrow.io.Storage;
|
import com.sparrowwallet.sparrow.io.Storage;
|
||||||
import com.sparrowwallet.sparrow.net.PublicElectrumServer;
|
import com.sparrowwallet.sparrow.net.PublicElectrumServer;
|
||||||
import com.sparrowwallet.sparrow.net.ServerType;
|
import com.sparrowwallet.sparrow.net.ServerType;
|
||||||
import com.sparrowwallet.sparrow.preferences.PreferenceGroup;
|
import com.sparrowwallet.sparrow.settings.SettingsGroup;
|
||||||
import com.sparrowwallet.sparrow.preferences.PreferencesDialog;
|
import com.sparrowwallet.sparrow.settings.SettingsDialog;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.scene.text.Font;
|
import javafx.scene.text.Font;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
@ -57,8 +57,8 @@ public class SparrowDesktop extends Application {
|
||||||
Config.get().setMode(mode);
|
Config.get().setMode(mode);
|
||||||
|
|
||||||
if(mode.equals(Mode.ONLINE)) {
|
if(mode.equals(Mode.ONLINE)) {
|
||||||
PreferencesDialog preferencesDialog = new PreferencesDialog(PreferenceGroup.SERVER, true);
|
SettingsDialog settingsDialog = new SettingsDialog(SettingsGroup.SERVER, true);
|
||||||
Optional<Boolean> optNewWallet = preferencesDialog.showAndWait();
|
Optional<Boolean> optNewWallet = settingsDialog.showAndWait();
|
||||||
createNewWallet = optNewWallet.isPresent() && optNewWallet.get();
|
createNewWallet = optNewWallet.isPresent() && optNewWallet.get();
|
||||||
} else if(Network.get() == Network.MAINNET) {
|
} else if(Network.get() == Network.MAINNET) {
|
||||||
Config.get().setServerType(ServerType.PUBLIC_ELECTRUM_SERVER);
|
Config.get().setServerType(ServerType.PUBLIC_ELECTRUM_SERVER);
|
||||||
|
|
|
||||||
|
|
@ -1178,7 +1178,7 @@ public class ElectrumServer {
|
||||||
if(bwtStartException != null) {
|
if(bwtStartException != null) {
|
||||||
Matcher walletLoadingMatcher = RPC_WALLET_LOADING_PATTERN.matcher(bwtStartException.getMessage());
|
Matcher walletLoadingMatcher = RPC_WALLET_LOADING_PATTERN.matcher(bwtStartException.getMessage());
|
||||||
if(bwtStartException.getMessage().contains("Wallet file not specified")) {
|
if(bwtStartException.getMessage().contains("Wallet file not specified")) {
|
||||||
throw new ServerException("Bitcoin Core requires Multi-Wallet to be enabled in the Server Preferences");
|
throw new ServerException("Bitcoin Core requires Multi-Wallet to be enabled in the Server Settings");
|
||||||
} else if(bwtStartException.getMessage().contains("Upgrade Bitcoin Core to v24 or later for Taproot wallet support")) {
|
} else if(bwtStartException.getMessage().contains("Upgrade Bitcoin Core to v24 or later for Taproot wallet support")) {
|
||||||
throw new ServerException(bwtStartException.getMessage());
|
throw new ServerException(bwtStartException.getMessage());
|
||||||
} else if(bwtStartException.getMessage().contains("Wallet file verification failed. Refusing to load database.")) {
|
} else if(bwtStartException.getMessage().contains("Wallet file verification failed. Refusing to load database.")) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
|
||||||
|
|
||||||
public enum PreferenceGroup {
|
|
||||||
GENERAL, SERVER;
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
|
||||||
|
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
|
||||||
import javafx.fxml.Initializable;
|
|
||||||
|
|
||||||
public abstract class PreferencesDetailController {
|
|
||||||
private PreferencesController masterController;
|
|
||||||
|
|
||||||
public PreferencesController getMasterController() {
|
|
||||||
return masterController;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setMasterController(PreferencesController masterController) {
|
|
||||||
this.masterController = masterController;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initializeView(Config config) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
|
|
@ -29,8 +29,8 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class GeneralPreferencesController extends PreferencesDetailController {
|
public class GeneralSettingsController extends SettingsDetailController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(GeneralPreferencesController.class);
|
private static final Logger log = LoggerFactory.getLogger(GeneralSettingsController.class);
|
||||||
|
|
||||||
private static final Server CUSTOM_BLOCK_EXPLORER = new Server("http://custom.block.explorer");
|
private static final Server CUSTOM_BLOCK_EXPLORER = new Server("http://custom.block.explorer");
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
import com.sparrowwallet.sparrow.glyphfont.FontAwesome5;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
import com.github.arteam.simplejsonrpc.client.exception.JsonRpcException;
|
import com.github.arteam.simplejsonrpc.client.exception.JsonRpcException;
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
|
|
@ -52,8 +52,8 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class ServerPreferencesController extends PreferencesDetailController {
|
public class ServerSettingsController extends SettingsDetailController {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ServerPreferencesController.class);
|
private static final Logger log = LoggerFactory.getLogger(ServerSettingsController.class);
|
||||||
|
|
||||||
private static final Server MANAGE_ALIASES_SERVER = new Server("tcp://localhost", "Manage Aliases...");
|
private static final Server MANAGE_ALIASES_SERVER = new Server("tcp://localhost", "Manage Aliases...");
|
||||||
private static final Server SCAN_QR_SERVER = new Server("ssl://localhost", "Scan QR...");
|
private static final Server SCAN_QR_SERVER = new Server("ssl://localhost", "Scan QR...");
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
|
|
@ -18,14 +18,14 @@ import java.net.URL;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class PreferencesController implements Initializable {
|
public class SettingsController implements Initializable {
|
||||||
private Config config;
|
private Config config;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private ToggleGroup preferencesMenu;
|
private ToggleGroup settingsMenu;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private StackPane preferencesPane;
|
private StackPane settingsPane;
|
||||||
|
|
||||||
private final BooleanProperty closing = new SimpleBooleanProperty(false);
|
private final BooleanProperty closing = new SimpleBooleanProperty(false);
|
||||||
|
|
||||||
|
|
@ -42,22 +42,22 @@ public class PreferencesController implements Initializable {
|
||||||
|
|
||||||
public void initializeView(Config config) {
|
public void initializeView(Config config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
preferencesMenu.selectedToggleProperty().addListener((observable, oldValue, selectedToggle) -> {
|
settingsMenu.selectedToggleProperty().addListener((observable, oldValue, selectedToggle) -> {
|
||||||
if(selectedToggle == null) {
|
if(selectedToggle == null) {
|
||||||
oldValue.setSelected(true);
|
oldValue.setSelected(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceGroup preferenceGroup = (PreferenceGroup) selectedToggle.getUserData();
|
SettingsGroup settingsGroup = (SettingsGroup) selectedToggle.getUserData();
|
||||||
String fxmlName = preferenceGroup.toString().toLowerCase(Locale.ROOT);
|
String fxmlName = settingsGroup.toString().toLowerCase(Locale.ROOT);
|
||||||
setPreferencePane(fxmlName);
|
setPreferencePane(fxmlName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectGroup(PreferenceGroup preferenceGroup) {
|
public void selectGroup(SettingsGroup settingsGroup) {
|
||||||
for(Toggle toggle : preferencesMenu.getToggles()) {
|
for(Toggle toggle : settingsMenu.getToggles()) {
|
||||||
if(toggle.getUserData().equals(preferenceGroup)) {
|
if(toggle.getUserData().equals(settingsGroup)) {
|
||||||
Platform.runLater(() -> preferencesMenu.selectToggle(toggle));
|
Platform.runLater(() -> settingsMenu.selectToggle(toggle));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,17 +76,17 @@ public class PreferencesController implements Initializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
FXMLLoader setPreferencePane(String fxmlName) {
|
FXMLLoader setPreferencePane(String fxmlName) {
|
||||||
preferencesPane.getChildren().removeAll(preferencesPane.getChildren());
|
settingsPane.getChildren().removeAll(settingsPane.getChildren());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FXMLLoader preferencesDetailLoader = new FXMLLoader(AppServices.class.getResource("preferences/" + fxmlName + ".fxml"));
|
FXMLLoader settingsDetailLoader = new FXMLLoader(AppServices.class.getResource("settings/" + fxmlName + ".fxml"));
|
||||||
Node preferenceGroupNode = preferencesDetailLoader.load();
|
Node preferenceGroupNode = settingsDetailLoader.load();
|
||||||
PreferencesDetailController controller = preferencesDetailLoader.getController();
|
SettingsDetailController controller = settingsDetailLoader.getController();
|
||||||
controller.setMasterController(this);
|
controller.setMasterController(this);
|
||||||
controller.initializeView(config);
|
controller.initializeView(config);
|
||||||
preferencesPane.getChildren().add(preferenceGroupNode);
|
settingsPane.getChildren().add(preferenceGroupNode);
|
||||||
|
|
||||||
return preferencesDetailLoader;
|
return settingsDetailLoader;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalStateException("Can't find pane", e);
|
throw new IllegalStateException("Can't find pane", e);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
|
|
||||||
|
public abstract class SettingsDetailController {
|
||||||
|
private SettingsController masterController;
|
||||||
|
|
||||||
|
public SettingsController getMasterController() {
|
||||||
|
return masterController;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMasterController(SettingsController masterController) {
|
||||||
|
this.masterController = masterController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initializeView(Config config) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
package com.sparrowwallet.sparrow.preferences;
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.EventManager;
|
import com.sparrowwallet.sparrow.EventManager;
|
||||||
import com.sparrowwallet.sparrow.event.RequestConnectEvent;
|
import com.sparrowwallet.sparrow.event.RequestConnectEvent;
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
import com.sparrowwallet.sparrow.net.ElectrumServer;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.control.ButtonBar;
|
import javafx.scene.control.ButtonBar;
|
||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
|
|
@ -14,28 +13,28 @@ import org.controlsfx.tools.Borders;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PreferencesDialog extends Dialog<Boolean> {
|
public class SettingsDialog extends Dialog<Boolean> {
|
||||||
public PreferencesDialog() {
|
public SettingsDialog() {
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PreferencesDialog(PreferenceGroup initialGroup) {
|
public SettingsDialog(SettingsGroup initialGroup) {
|
||||||
this(initialGroup, false);
|
this(initialGroup, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PreferencesDialog(PreferenceGroup initialGroup, boolean initialSetup) {
|
public SettingsDialog(SettingsGroup initialGroup, boolean initialSetup) {
|
||||||
final DialogPane dialogPane = getDialogPane();
|
final DialogPane dialogPane = getDialogPane();
|
||||||
AppServices.setStageIcon(dialogPane.getScene().getWindow());
|
AppServices.setStageIcon(dialogPane.getScene().getWindow());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FXMLLoader preferencesLoader = new FXMLLoader(AppServices.class.getResource("preferences/preferences.fxml"));
|
FXMLLoader settingsLoader = new FXMLLoader(AppServices.class.getResource("settings/settings.fxml"));
|
||||||
dialogPane.setContent(Borders.wrap(preferencesLoader.load()).emptyBorder().buildAll());
|
dialogPane.setContent(Borders.wrap(settingsLoader.load()).emptyBorder().buildAll());
|
||||||
PreferencesController preferencesController = preferencesLoader.getController();
|
SettingsController settingsController = settingsLoader.getController();
|
||||||
preferencesController.initializeView(Config.get());
|
settingsController.initializeView(Config.get());
|
||||||
if(initialGroup != null) {
|
if(initialGroup != null) {
|
||||||
preferencesController.selectGroup(initialGroup);
|
settingsController.selectGroup(initialGroup);
|
||||||
} else {
|
} else {
|
||||||
preferencesController.selectGroup(PreferenceGroup.GENERAL);
|
settingsController.selectGroup(SettingsGroup.GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ButtonType closeButtonType = new javafx.scene.control.ButtonType("Close", ButtonBar.ButtonData.CANCEL_CLOSE);
|
final ButtonType closeButtonType = new javafx.scene.control.ButtonType("Close", ButtonBar.ButtonData.CANCEL_CLOSE);
|
||||||
|
|
@ -51,10 +50,10 @@ public class PreferencesDialog extends Dialog<Boolean> {
|
||||||
dialogPane.setMinHeight(dialogPane.getPrefHeight());
|
dialogPane.setMinHeight(dialogPane.getPrefHeight());
|
||||||
AppServices.moveToActiveWindowScreen(this);
|
AppServices.moveToActiveWindowScreen(this);
|
||||||
|
|
||||||
preferencesController.reconnectOnClosingProperty().set(AppServices.isConnecting() || AppServices.isConnected());
|
settingsController.reconnectOnClosingProperty().set(AppServices.isConnecting() || AppServices.isConnected());
|
||||||
setOnCloseRequest(event -> {
|
setOnCloseRequest(event -> {
|
||||||
preferencesController.closingProperty().set(true);
|
settingsController.closingProperty().set(true);
|
||||||
if(preferencesController.isReconnectOnClosing() && !(AppServices.isConnecting() || AppServices.isConnected())) {
|
if(settingsController.isReconnectOnClosing() && !(AppServices.isConnecting() || AppServices.isConnected())) {
|
||||||
EventManager.get().post(new RequestConnectEvent());
|
EventManager.get().post(new RequestConnectEvent());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.sparrowwallet.sparrow.settings;
|
||||||
|
|
||||||
|
public enum SettingsGroup {
|
||||||
|
GENERAL, SERVER;
|
||||||
|
}
|
||||||
|
|
@ -14,9 +14,9 @@ import com.sparrowwallet.sparrow.event.StorageEvent;
|
||||||
import com.sparrowwallet.sparrow.event.TimedEvent;
|
import com.sparrowwallet.sparrow.event.TimedEvent;
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
import com.sparrowwallet.sparrow.io.Storage;
|
import com.sparrowwallet.sparrow.io.Storage;
|
||||||
import com.sparrowwallet.sparrow.terminal.preferences.GeneralDialog;
|
import com.sparrowwallet.sparrow.terminal.settings.GeneralDialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.preferences.ServerStatusDialog;
|
import com.sparrowwallet.sparrow.terminal.settings.ServerStatusDialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.preferences.ServerTypeDialog;
|
import com.sparrowwallet.sparrow.terminal.settings.ServerTypeDialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.wallet.Bip39Dialog;
|
import com.sparrowwallet.sparrow.terminal.wallet.Bip39Dialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.wallet.LoadWallet;
|
import com.sparrowwallet.sparrow.terminal.wallet.LoadWallet;
|
||||||
import com.sparrowwallet.sparrow.terminal.wallet.WatchOnlyDialog;
|
import com.sparrowwallet.sparrow.terminal.wallet.WatchOnlyDialog;
|
||||||
|
|
@ -71,9 +71,9 @@ public class MasterActionListBox extends ActionListBox {
|
||||||
builder.build().showDialog(SparrowTerminal.get().getGui());
|
builder.build().showDialog(SparrowTerminal.get().getGui());
|
||||||
});
|
});
|
||||||
|
|
||||||
addItem("Preferences", () -> {
|
addItem("Settings", () -> {
|
||||||
new ActionListDialogBuilder()
|
new ActionListDialogBuilder()
|
||||||
.setTitle("Preferences")
|
.setTitle("Settings")
|
||||||
.addAction("General", () -> {
|
.addAction("General", () -> {
|
||||||
GeneralDialog generalDialog = new GeneralDialog();
|
GeneralDialog generalDialog = new GeneralDialog();
|
||||||
generalDialog.showDialog(sparrowTerminal.getGui());
|
generalDialog.showDialog(sparrowTerminal.getGui());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
import com.googlecode.lanterna.gui2.*;
|
import com.googlecode.lanterna.gui2.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
import com.googlecode.lanterna.gui2.*;
|
import com.googlecode.lanterna.gui2.*;
|
||||||
|
|
@ -41,7 +41,7 @@ public class GeneralDialog extends DialogWindow {
|
||||||
};
|
};
|
||||||
|
|
||||||
public GeneralDialog() {
|
public GeneralDialog() {
|
||||||
super("General Preferences");
|
super("General Settings");
|
||||||
|
|
||||||
setHints(List.of(Hint.CENTERED));
|
setHints(List.of(Hint.CENTERED));
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
import com.googlecode.lanterna.gui2.*;
|
import com.googlecode.lanterna.gui2.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
import com.googlecode.lanterna.gui2.*;
|
import com.googlecode.lanterna.gui2.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.google.common.net.HostAndPort;
|
import com.google.common.net.HostAndPort;
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
import com.googlecode.lanterna.gui2.*;
|
import com.googlecode.lanterna.gui2.*;
|
||||||
|
|
@ -17,7 +17,7 @@ public class ServerStatusDialog extends DialogWindow {
|
||||||
private final ComboBox<String> connect;
|
private final ComboBox<String> connect;
|
||||||
|
|
||||||
public ServerStatusDialog() {
|
public ServerStatusDialog() {
|
||||||
super("Server Preferences");
|
super("Server Settings");
|
||||||
|
|
||||||
setHints(List.of(Hint.CENTERED));
|
setHints(List.of(Hint.CENTERED));
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
import com.googlecode.lanterna.gui2.*;
|
import com.googlecode.lanterna.gui2.*;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.sparrowwallet.sparrow.terminal.preferences;
|
package com.sparrowwallet.sparrow.terminal.settings;
|
||||||
|
|
||||||
import com.google.common.net.HostAndPort;
|
import com.google.common.net.HostAndPort;
|
||||||
import com.googlecode.lanterna.TerminalSize;
|
import com.googlecode.lanterna.TerminalSize;
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
<MenuItem mnemonicParsing="false" text="Import Wallet..." onAction="#importWallet"/>
|
<MenuItem mnemonicParsing="false" text="Import Wallet..." onAction="#importWallet"/>
|
||||||
<MenuItem fx:id="exportWallet" mnemonicParsing="false" text="Export Wallet..." onAction="#exportWallet"/>
|
<MenuItem fx:id="exportWallet" mnemonicParsing="false" text="Export Wallet..." onAction="#exportWallet"/>
|
||||||
<SeparatorMenuItem styleClass="osxHide" />
|
<SeparatorMenuItem styleClass="osxHide" />
|
||||||
<MenuItem styleClass="osxHide" mnemonicParsing="false" text="Preferences..." accelerator="Shortcut+P" onAction="#openPreferences"/>
|
<MenuItem styleClass="osxHide" mnemonicParsing="false" text="Settings..." accelerator="Shortcut+," onAction="#openSettings"/>
|
||||||
<SeparatorMenuItem />
|
<SeparatorMenuItem />
|
||||||
<MenuItem fx:id="renameWallet" mnemonicParsing="false" text="Rename Wallet..." onAction="#renameWallet"/>
|
<MenuItem fx:id="renameWallet" mnemonicParsing="false" text="Rename Wallet..." onAction="#renameWallet"/>
|
||||||
<MenuItem fx:id="deleteWallet" mnemonicParsing="false" text="Delete Wallet..." onAction="#deleteWallet"/>
|
<MenuItem fx:id="deleteWallet" mnemonicParsing="false" text="Delete Wallet..." onAction="#deleteWallet"/>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<?import com.sparrowwallet.sparrow.net.FeeRatesSource?>
|
<?import com.sparrowwallet.sparrow.net.FeeRatesSource?>
|
||||||
<?import org.controlsfx.glyphfont.Glyph?>
|
<?import org.controlsfx.glyphfont.Glyph?>
|
||||||
|
|
||||||
<GridPane hgap="10.0" vgap="10.0" stylesheets="@preferences.css, @../general.css" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.preferences.GeneralPreferencesController">
|
<GridPane hgap="10.0" vgap="10.0" stylesheets="@settings.css, @../general.css" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.settings.GeneralSettingsController">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets left="25.0" right="25.0" top="25.0" />
|
<Insets left="25.0" right="25.0" top="25.0" />
|
||||||
</padding>
|
</padding>
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<?import com.sparrowwallet.sparrow.control.CopyableLabel?>
|
<?import com.sparrowwallet.sparrow.control.CopyableLabel?>
|
||||||
<?import com.sparrowwallet.sparrow.control.ComboBoxTextField?>
|
<?import com.sparrowwallet.sparrow.control.ComboBoxTextField?>
|
||||||
|
|
||||||
<GridPane hgap="10.0" vgap="10.0" stylesheets="@preferences.css, @../general.css" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.preferences.ServerPreferencesController">
|
<GridPane hgap="10.0" vgap="10.0" stylesheets="@settings.css, @../general.css" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.settings.ServerSettingsController">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets left="25.0" right="25.0" top="25.0" />
|
<Insets left="25.0" right="25.0" top="25.0" />
|
||||||
</padding>
|
</padding>
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
-fx-background-color: #1e88cf;
|
-fx-background-color: #1e88cf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#preferencesPane {
|
#settingsPane {
|
||||||
-fx-background-color: -fx-background;
|
-fx-background-color: -fx-background;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7,34 +7,34 @@
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import com.sparrowwallet.sparrow.preferences.PreferenceGroup?>
|
<?import com.sparrowwallet.sparrow.settings.SettingsGroup?>
|
||||||
<?import org.controlsfx.glyphfont.Glyph?>
|
<?import org.controlsfx.glyphfont.Glyph?>
|
||||||
<BorderPane stylesheets="@../general.css, @preferences.css" styleClass="line-border" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="com.sparrowwallet.sparrow.preferences.PreferencesController">
|
<BorderPane stylesheets="@../general.css, @settings.css" styleClass="line-border" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml" fx:controller="com.sparrowwallet.sparrow.settings.SettingsController">
|
||||||
<left>
|
<left>
|
||||||
<VBox styleClass="list-menu">
|
<VBox styleClass="list-menu">
|
||||||
<ToggleButton VBox.vgrow="ALWAYS" text="General" wrapText="true" textAlignment="CENTER" contentDisplay="TOP" styleClass="list-item" maxHeight="Infinity" toggleGroup="$preferencesMenu">
|
<ToggleButton VBox.vgrow="ALWAYS" text="General" wrapText="true" textAlignment="CENTER" contentDisplay="TOP" styleClass="list-item" maxHeight="Infinity" toggleGroup="$settingsMenu">
|
||||||
<toggleGroup>
|
<toggleGroup>
|
||||||
<ToggleGroup fx:id="preferencesMenu" />
|
<ToggleGroup fx:id="settingsMenu" />
|
||||||
</toggleGroup>
|
</toggleGroup>
|
||||||
<graphic>
|
<graphic>
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="TOOLS" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="TOOLS" />
|
||||||
</graphic>
|
</graphic>
|
||||||
<userData>
|
<userData>
|
||||||
<PreferenceGroup fx:constant="GENERAL"/>
|
<SettingsGroup fx:constant="GENERAL"/>
|
||||||
</userData>
|
</userData>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<ToggleButton VBox.vgrow="ALWAYS" text="Server" wrapText="true" textAlignment="CENTER" contentDisplay="TOP" styleClass="list-item" maxHeight="Infinity" toggleGroup="$preferencesMenu">
|
<ToggleButton VBox.vgrow="ALWAYS" text="Server" wrapText="true" textAlignment="CENTER" contentDisplay="TOP" styleClass="list-item" maxHeight="Infinity" toggleGroup="$settingsMenu">
|
||||||
<graphic>
|
<graphic>
|
||||||
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SERVER" />
|
<Glyph fontFamily="Font Awesome 5 Free Solid" fontSize="20" icon="SERVER" />
|
||||||
</graphic>
|
</graphic>
|
||||||
<userData>
|
<userData>
|
||||||
<PreferenceGroup fx:constant="SERVER"/>
|
<SettingsGroup fx:constant="SERVER"/>
|
||||||
</userData>
|
</userData>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
</VBox>
|
</VBox>
|
||||||
</left>
|
</left>
|
||||||
<center>
|
<center>
|
||||||
<StackPane fx:id="preferencesPane">
|
<StackPane fx:id="settingsPane">
|
||||||
|
|
||||||
</StackPane>
|
</StackPane>
|
||||||
</center>
|
</center>
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
<TextField fx:id="fingerprint" maxWidth="80" promptText="00000000"/> <Region style="-fx-max-width: 5" /> <LifeHashIcon fx:id="fingerprintIcon" /> <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." />
|
<TextField fx:id="fingerprint" maxWidth="80" promptText="00000000"/> <Region style="-fx-max-width: 5" /> <LifeHashIcon fx:id="fingerprintIcon" /> <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>
|
||||||
<Field text="Derivation:">
|
<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 and networks are not valid.\nThis validation can be turned off in the General Preferences." />
|
<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 and networks are not valid.\nThis validation can be turned off in the General Settings." />
|
||||||
</Field>
|
</Field>
|
||||||
<Field fx:id="xpubField" text="xpub:">
|
<Field fx:id="xpubField" text="xpub:">
|
||||||
<TextArea fx:id="xpub" wrapText="true" prefRowCount="2" maxHeight="52" />
|
<TextArea fx:id="xpub" wrapText="true" prefRowCount="2" maxHeight="52" />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue