Settings-tab refactoring: move Tinfoil-related options block to separate fxml, create controller, update names, remove code redundancy and simplify.
This commit is contained in:
parent
ceb6949667
commit
d1500f264b
6 changed files with 262 additions and 200 deletions
|
@ -199,7 +199,7 @@ public class FrontController implements Initializable {
|
||||||
else
|
else
|
||||||
fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));
|
fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));
|
||||||
|
|
||||||
if (getSelectedProtocol().equals("TinFoil") && MediatorControl.getInstance().getContoller().getSettingsCtrlr().getTfXciNszXczSupport())
|
if (getSelectedProtocol().equals("TinFoil") && MediatorControl.getInstance().getContoller().getSettingsCtrlr().getTinfoilSettings().isXciNszXczSupport())
|
||||||
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NSP/XCI/NSZ/XCZ", "*.nsp", "*.xci", "*.nsz", "*.xcz"));
|
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("NSP/XCI/NSZ/XCZ", "*.nsp", "*.xci", "*.nsz", "*.xcz"));
|
||||||
else if (getSelectedProtocol().equals("GoldLeaf") && (! MediatorControl.getInstance().getContoller().getSettingsCtrlr().getNSPFileFilterForGL()))
|
else if (getSelectedProtocol().equals("GoldLeaf") && (! MediatorControl.getInstance().getContoller().getSettingsCtrlr().getNSPFileFilterForGL()))
|
||||||
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Any file", "*.*"),
|
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Any file", "*.*"),
|
||||||
|
@ -273,24 +273,25 @@ public class FrontController implements Initializable {
|
||||||
}
|
}
|
||||||
else { // NET INSTALL OVER TINFOIL
|
else { // NET INSTALL OVER TINFOIL
|
||||||
final String ipValidationPattern = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
|
final String ipValidationPattern = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
|
||||||
|
final SettingsBlockTinfoilController tinfoilSettings = settings.getTinfoilSettings();
|
||||||
|
|
||||||
if (settings.isNsIpValidate() && ! getNsIp().matches(ipValidationPattern)) {
|
if (tinfoilSettings.isValidateNSHostName() && ! getNsIp().matches(ipValidationPattern)) {
|
||||||
if (!ServiceWindow.getConfirmationWindow(resourceBundle.getString("windowTitleBadIp"), resourceBundle.getString("windowBodyBadIp")))
|
if (!ServiceWindow.getConfirmationWindow(resourceBundle.getString("windowTitleBadIp"), resourceBundle.getString("windowBodyBadIp")))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nsIP = getNsIp();
|
String nsIP = getNsIp();
|
||||||
|
|
||||||
if (! settings.getExpertModeSelected())
|
if (! tinfoilSettings.isExpertModeSelected())
|
||||||
usbNetCommunications = new NETCommunications(nspToUpload, nsIP, false, "", "", "");
|
usbNetCommunications = new NETCommunications(nspToUpload, nsIP, false, "", "", "");
|
||||||
else {
|
else {
|
||||||
usbNetCommunications = new NETCommunications(
|
usbNetCommunications = new NETCommunications(
|
||||||
nspToUpload,
|
nspToUpload,
|
||||||
nsIP,
|
nsIP,
|
||||||
settings.getNotServeSelected(),
|
tinfoilSettings.isNoRequestsServe(),
|
||||||
settings.getAutoIpSelected()?"":settings.getHostIp(),
|
tinfoilSettings.isAutoDetectIp()?"":tinfoilSettings.getHostIp(),
|
||||||
settings.getRandPortSelected()?"":settings.getHostPort(),
|
tinfoilSettings.isRandomlySelectPort()?"":tinfoilSettings.getHostPort(),
|
||||||
settings.getNotServeSelected()?settings.getHostExtra():""
|
tinfoilSettings.isNoRequestsServe()?tinfoilSettings.getHostExtra():""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,8 +331,9 @@ public class FrontController implements Initializable {
|
||||||
private void handleDrop(DragEvent event){
|
private void handleDrop(DragEvent event){
|
||||||
List<File> filesDropped = event.getDragboard().getFiles();
|
List<File> filesDropped = event.getDragboard().getFiles();
|
||||||
SettingsController settingsController = MediatorControl.getInstance().getContoller().getSettingsCtrlr();
|
SettingsController settingsController = MediatorControl.getInstance().getContoller().getSettingsCtrlr();
|
||||||
|
SettingsBlockTinfoilController tinfoilSettings = settingsController.getTinfoilSettings();
|
||||||
|
|
||||||
if (getSelectedProtocol().equals("TinFoil") && settingsController.getTfXciNszXczSupport())
|
if (getSelectedProtocol().equals("TinFoil") && tinfoilSettings.isXciNszXczSupport())
|
||||||
filesDropped.removeIf(file -> ! file.getName().toLowerCase().matches("(.*\\.nsp$)|(.*\\.xci$)|(.*\\.nsz$)|(.*\\.xcz$)"));
|
filesDropped.removeIf(file -> ! file.getName().toLowerCase().matches("(.*\\.nsp$)|(.*\\.xci$)|(.*\\.nsz$)|(.*\\.xcz$)"));
|
||||||
else if (getSelectedProtocol().equals("GoldLeaf") && (! settingsController.getNSPFileFilterForGL()))
|
else if (getSelectedProtocol().equals("GoldLeaf") && (! settingsController.getNSPFileFilterForGL()))
|
||||||
filesDropped.removeIf(file -> (file.isDirectory() && ! file.getName().toLowerCase().matches(".*\\.nsp$")));
|
filesDropped.removeIf(file -> (file.isDirectory() && ! file.getName().toLowerCase().matches(".*\\.nsp$")));
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019-2020 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of NS-USBloader.
|
||||||
|
|
||||||
|
NS-USBloader is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
NS-USBloader is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package nsusbloader.Controllers;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.Initializable;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.TextFormatter;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import nsusbloader.AppPreferences;
|
||||||
|
import nsusbloader.ServiceWindow;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
public class SettingsBlockTinfoilController implements Initializable {
|
||||||
|
@FXML
|
||||||
|
private CheckBox xciNszXczSupportCB,
|
||||||
|
validateNSHostNameCB,
|
||||||
|
networkExpertModeCB,
|
||||||
|
autoDetectIpCB,
|
||||||
|
randomlySelectPortCB,
|
||||||
|
noRequestsServeCB;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private VBox networkExpertSettingsVBox;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField pcIpTF,
|
||||||
|
pcPortTF,
|
||||||
|
pcExtraTF;
|
||||||
|
|
||||||
|
private ResourceBundle resourceBundle;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||||
|
this.resourceBundle = resourceBundle;
|
||||||
|
|
||||||
|
final AppPreferences preferences = AppPreferences.getInstance();
|
||||||
|
|
||||||
|
networkExpertSettingsVBox.disableProperty().bind(networkExpertModeCB.selectedProperty().not());
|
||||||
|
|
||||||
|
pcIpTF.disableProperty().bind(autoDetectIpCB.selectedProperty());
|
||||||
|
pcPortTF.disableProperty().bind(randomlySelectPortCB.selectedProperty());
|
||||||
|
pcExtraTF.disableProperty().bind(noRequestsServeCB.selectedProperty().not());
|
||||||
|
|
||||||
|
xciNszXczSupportCB.setSelected(preferences.getTfXCI());
|
||||||
|
validateNSHostNameCB.setSelected(preferences.getNsIpValidationNeeded());
|
||||||
|
networkExpertModeCB.setSelected(preferences.getExpertMode());
|
||||||
|
pcIpTF.setText(preferences.getHostIp());
|
||||||
|
pcPortTF.setText(preferences.getHostPort());
|
||||||
|
pcExtraTF.setText(preferences.getHostExtra());
|
||||||
|
autoDetectIpCB.setSelected(preferences.getAutoDetectIp());
|
||||||
|
randomlySelectPortCB.setSelected(preferences.getRandPort());
|
||||||
|
boolean noServeRequestsFlag = preferences.getNotServeRequests();
|
||||||
|
if (noServeRequestsFlag){
|
||||||
|
noServeRequestAction(true);
|
||||||
|
}
|
||||||
|
noRequestsServeCB.setSelected(noServeRequestsFlag);
|
||||||
|
|
||||||
|
pcIpTF.setTextFormatter(buildSpacelessTextFormatter());
|
||||||
|
pcPortTF.setTextFormatter(buildPortTextFormatter());
|
||||||
|
pcExtraTF.setTextFormatter(buildSpacelessTextFormatter());
|
||||||
|
|
||||||
|
autoDetectIpCB.setOnAction(e->pcIpTF.requestFocus());
|
||||||
|
randomlySelectPortCB.setOnAction(e->pcPortTF.requestFocus());
|
||||||
|
noRequestsServeCB.selectedProperty().addListener(((observableValue, oldValue, newValue) -> noServeRequestAction(newValue)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextFormatter buildSpacelessTextFormatter(){
|
||||||
|
return new TextFormatter<>(change -> {
|
||||||
|
String text = change.getControlNewText();
|
||||||
|
|
||||||
|
if (text.contains(" ") || text.contains("\t")){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextFormatter buildPortTextFormatter(){
|
||||||
|
final String PORT_NUMBER_PATTERN = "^[0-9]{0,5}$";
|
||||||
|
|
||||||
|
return new TextFormatter<>(change -> {
|
||||||
|
String text = change.getControlNewText();
|
||||||
|
if (text.isEmpty()) {
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! text.matches(PORT_NUMBER_PATTERN)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int newPortNumber = Integer.parseInt(text);
|
||||||
|
|
||||||
|
if (newPortNumber > 65535 || newPortNumber == 0) {
|
||||||
|
ServiceWindow.getErrorNotification(resourceBundle.getString("windowTitleErrorPort"),
|
||||||
|
resourceBundle.getString("windowBodyErrorPort"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return change;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void noServeRequestAction(boolean isNoServe){
|
||||||
|
if (isNoServe){
|
||||||
|
autoDetectIpCB.setDisable(true);
|
||||||
|
autoDetectIpCB.setSelected(false);
|
||||||
|
randomlySelectPortCB.setDisable(true);
|
||||||
|
randomlySelectPortCB.setSelected(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
autoDetectIpCB.setDisable(false);
|
||||||
|
autoDetectIpCB.setSelected(true);
|
||||||
|
randomlySelectPortCB.setDisable(false);
|
||||||
|
randomlySelectPortCB.setSelected(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHostIp(){ return pcIpTF.getText(); }
|
||||||
|
public String getHostPort(){ return pcPortTF.getText(); }
|
||||||
|
public String getHostExtra(){ return pcExtraTF.getText(); }
|
||||||
|
public boolean isXciNszXczSupport(){ return xciNszXczSupportCB.isSelected(); }
|
||||||
|
public boolean isExpertModeSelected(){ return networkExpertModeCB.isSelected(); }
|
||||||
|
public boolean isAutoDetectIp(){ return autoDetectIpCB.isSelected(); }
|
||||||
|
public boolean isRandomlySelectPort(){ return randomlySelectPortCB.isSelected(); }
|
||||||
|
public boolean isNoRequestsServe(){ return noRequestsServeCB.isSelected(); }
|
||||||
|
public boolean isValidateNSHostName(){ return validateNSHostNameCB.isSelected(); }
|
||||||
|
|
||||||
|
public void updatePreferencesOnExit(){
|
||||||
|
AppPreferences preferences = AppPreferences.getInstance();
|
||||||
|
|
||||||
|
preferences.setNsIpValidationNeeded(isValidateNSHostName());
|
||||||
|
preferences.setExpertMode(isExpertModeSelected());
|
||||||
|
preferences.setAutoDetectIp(isAutoDetectIp());
|
||||||
|
preferences.setRandPort(isRandomlySelectPort());
|
||||||
|
preferences.setNotServeRequests(isNoRequestsServe());
|
||||||
|
preferences.setHostIp(getHostIp());
|
||||||
|
preferences.setHostPort(getHostPort());
|
||||||
|
preferences.setHostExtra(getHostExtra());
|
||||||
|
preferences.setTfXCI(isXciNszXczSupport());
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,21 +38,7 @@ import java.util.*;
|
||||||
public class SettingsController implements Initializable {
|
public class SettingsController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
private CheckBox nspFilesFilterForGLCB,
|
private CheckBox nspFilesFilterForGLCB,
|
||||||
validateNSHostNameCb,
|
autoCheckUpdCb;
|
||||||
expertModeCb,
|
|
||||||
autoDetectIpCb,
|
|
||||||
randPortCb,
|
|
||||||
dontServeCb,
|
|
||||||
autoCheckUpdCb,
|
|
||||||
tfXciSpprtCb;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField pcIpTextField,
|
|
||||||
pcPortTextField,
|
|
||||||
pcExtraTextField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private VBox expertSettingsVBox;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Hyperlink newVersionLink;
|
private Hyperlink newVersionLink;
|
||||||
|
@ -67,6 +53,9 @@ public class SettingsController implements Initializable {
|
||||||
@FXML
|
@FXML
|
||||||
private ChoiceBox<String> glVersionChoiceBox;
|
private ChoiceBox<String> glVersionChoiceBox;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private SettingsBlockTinfoilController settingsBlockTinfoilController;
|
||||||
|
|
||||||
private HostServices hostServices;
|
private HostServices hostServices;
|
||||||
|
|
||||||
public static final String[] glSupportedVersions = {"v0.5", "v0.7.x", "v0.8"};
|
public static final String[] glSupportedVersions = {"v0.5", "v0.7.x", "v0.8"};
|
||||||
|
@ -79,95 +68,8 @@ public class SettingsController implements Initializable {
|
||||||
final AppPreferences preferences = AppPreferences.getInstance();
|
final AppPreferences preferences = AppPreferences.getInstance();
|
||||||
|
|
||||||
nspFilesFilterForGLCB.setSelected(preferences.getNspFileFilterGL());
|
nspFilesFilterForGLCB.setSelected(preferences.getNspFileFilterGL());
|
||||||
validateNSHostNameCb.setSelected(preferences.getNsIpValidationNeeded());
|
|
||||||
expertSettingsVBox.setDisable(! preferences.getExpertMode());
|
|
||||||
expertModeCb.setSelected(preferences.getExpertMode());
|
|
||||||
expertModeCb.setOnAction(e-> expertSettingsVBox.setDisable(! expertModeCb.isSelected()));
|
|
||||||
|
|
||||||
autoDetectIpCb.setSelected(preferences.getAutoDetectIp());
|
|
||||||
pcIpTextField.setDisable(preferences.getAutoDetectIp());
|
|
||||||
autoDetectIpCb.setOnAction(e->{
|
|
||||||
pcIpTextField.setDisable(autoDetectIpCb.isSelected());
|
|
||||||
if (! autoDetectIpCb.isSelected())
|
|
||||||
pcIpTextField.requestFocus();
|
|
||||||
});
|
|
||||||
|
|
||||||
randPortCb.setSelected(preferences.getRandPort());
|
|
||||||
pcPortTextField.setDisable(preferences.getRandPort());
|
|
||||||
randPortCb.setOnAction(e->{
|
|
||||||
pcPortTextField.setDisable(randPortCb.isSelected());
|
|
||||||
if (! randPortCb.isSelected())
|
|
||||||
pcPortTextField.requestFocus();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (preferences.getNotServeRequests()){
|
|
||||||
dontServeCb.setSelected(true);
|
|
||||||
|
|
||||||
autoDetectIpCb.setSelected(false);
|
|
||||||
autoDetectIpCb.setDisable(true);
|
|
||||||
pcIpTextField.setDisable(false);
|
|
||||||
|
|
||||||
randPortCb.setSelected(false);
|
|
||||||
randPortCb.setDisable(true);
|
|
||||||
pcPortTextField.setDisable(false);
|
|
||||||
}
|
|
||||||
pcExtraTextField.setDisable(! preferences.getNotServeRequests());
|
|
||||||
|
|
||||||
dontServeCb.setOnAction(e->{
|
|
||||||
if (dontServeCb.isSelected()){
|
|
||||||
autoDetectIpCb.setSelected(false);
|
|
||||||
autoDetectIpCb.setDisable(true);
|
|
||||||
pcIpTextField.setDisable(false);
|
|
||||||
|
|
||||||
randPortCb.setSelected(false);
|
|
||||||
randPortCb.setDisable(true);
|
|
||||||
pcPortTextField.setDisable(false);
|
|
||||||
|
|
||||||
pcExtraTextField.setDisable(false);
|
|
||||||
pcIpTextField.requestFocus();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
autoDetectIpCb.setDisable(false);
|
|
||||||
autoDetectIpCb.setSelected(true);
|
|
||||||
pcIpTextField.setDisable(true);
|
|
||||||
|
|
||||||
randPortCb.setDisable(false);
|
|
||||||
randPortCb.setSelected(true);
|
|
||||||
pcPortTextField.setDisable(true);
|
|
||||||
|
|
||||||
pcExtraTextField.setDisable(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pcIpTextField.setText(preferences.getHostIp());
|
|
||||||
pcPortTextField.setText(preferences.getHostPort());
|
|
||||||
pcExtraTextField.setText(preferences.getHostExtra());
|
|
||||||
|
|
||||||
pcIpTextField.setTextFormatter(new TextFormatter<>(change -> {
|
|
||||||
if (change.getControlNewText().contains(" ") | change.getControlNewText().contains("\t"))
|
|
||||||
return null;
|
|
||||||
else
|
|
||||||
return change;
|
|
||||||
}));
|
|
||||||
pcPortTextField.setTextFormatter(new TextFormatter<>(change -> {
|
|
||||||
if (change.getControlNewText().matches("^[0-9]{0,5}$")) {
|
|
||||||
if (!change.getControlNewText().isEmpty()
|
|
||||||
&& ((Integer.parseInt(change.getControlNewText()) > 65535) || (Integer.parseInt(change.getControlNewText()) == 0))
|
|
||||||
) {
|
|
||||||
ServiceWindow.getErrorNotification(resourceBundle.getString("windowTitleErrorPort"), resourceBundle.getString("windowBodyErrorPort"));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return change;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}));
|
|
||||||
pcExtraTextField.setTextFormatter(new TextFormatter<>(change -> {
|
|
||||||
if (change.getControlNewText().contains(" ") | change.getControlNewText().contains("\t"))
|
|
||||||
return null;
|
|
||||||
else
|
|
||||||
return change;
|
|
||||||
}));
|
|
||||||
|
|
||||||
newVersionLink.setVisible(false);
|
newVersionLink.setVisible(false);
|
||||||
newVersionLink.setOnAction(e-> hostServices.showDocument(newVersionLink.getText()));
|
newVersionLink.setOnAction(e-> hostServices.showDocument(newVersionLink.getText()));
|
||||||
|
@ -182,8 +84,6 @@ public class SettingsController implements Initializable {
|
||||||
|
|
||||||
setDriversInstallFeature();
|
setDriversInstallFeature();
|
||||||
|
|
||||||
tfXciSpprtCb.setSelected(preferences.getTfXCI());
|
|
||||||
|
|
||||||
SettingsLanguagesSetup settingsLanguagesSetup = new SettingsLanguagesSetup();
|
SettingsLanguagesSetup settingsLanguagesSetup = new SettingsLanguagesSetup();
|
||||||
langCB.setItems(settingsLanguagesSetup.getLanguages());
|
langCB.setItems(settingsLanguagesSetup.getLanguages());
|
||||||
langCB.getSelectionModel().select(settingsLanguagesSetup.getRecentLanguage());
|
langCB.getSelectionModel().select(settingsLanguagesSetup.getRecentLanguage());
|
||||||
|
@ -247,18 +147,8 @@ public class SettingsController implements Initializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getNSPFileFilterForGL(){return nspFilesFilterForGLCB.isSelected(); }
|
public boolean getNSPFileFilterForGL(){return nspFilesFilterForGLCB.isSelected(); }
|
||||||
public boolean getExpertModeSelected(){ return expertModeCb.isSelected(); }
|
|
||||||
public boolean getAutoIpSelected(){ return autoDetectIpCb.isSelected(); }
|
|
||||||
public boolean getRandPortSelected(){ return randPortCb.isSelected(); }
|
|
||||||
public boolean getNotServeSelected(){ return dontServeCb.isSelected(); }
|
|
||||||
|
|
||||||
public boolean isNsIpValidate(){ return validateNSHostNameCb.isSelected(); }
|
|
||||||
|
|
||||||
public String getHostIp(){ return pcIpTextField.getText(); }
|
|
||||||
public String getHostPort(){ return pcPortTextField.getText(); }
|
|
||||||
public String getHostExtra(){ return pcExtraTextField.getText(); }
|
|
||||||
public boolean getAutoCheckForUpdates(){ return autoCheckUpdCb.isSelected(); }
|
public boolean getAutoCheckForUpdates(){ return autoCheckUpdCb.isSelected(); }
|
||||||
public boolean getTfXciNszXczSupport(){ return tfXciSpprtCb.isSelected(); } // Used also for NSZ/XCZ
|
|
||||||
|
|
||||||
public void registerHostServices(HostServices hostServices){this.hostServices = hostServices;}
|
public void registerHostServices(HostServices hostServices){this.hostServices = hostServices;}
|
||||||
|
|
||||||
|
@ -271,20 +161,15 @@ public class SettingsController implements Initializable {
|
||||||
return glVersionChoiceBox.getValue();
|
return glVersionChoiceBox.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SettingsBlockTinfoilController getTinfoilSettings(){ return settingsBlockTinfoilController; }
|
||||||
|
|
||||||
public void updatePreferencesOnExit(){
|
public void updatePreferencesOnExit(){
|
||||||
AppPreferences preferences = AppPreferences.getInstance();
|
AppPreferences preferences = AppPreferences.getInstance();
|
||||||
|
|
||||||
preferences.setNsIpValidationNeeded(isNsIpValidate());
|
|
||||||
preferences.setExpertMode(getExpertModeSelected());
|
|
||||||
preferences.setAutoDetectIp(getAutoIpSelected());
|
|
||||||
preferences.setRandPort(getRandPortSelected());
|
|
||||||
preferences.setNotServeRequests(getNotServeSelected());
|
|
||||||
preferences.setHostIp(getHostIp());
|
|
||||||
preferences.setHostPort(getHostPort());
|
|
||||||
preferences.setHostExtra(getHostExtra());
|
|
||||||
preferences.setAutoCheckUpdates(getAutoCheckForUpdates());
|
preferences.setAutoCheckUpdates(getAutoCheckForUpdates());
|
||||||
preferences.setTfXCI(getTfXciNszXczSupport());
|
|
||||||
preferences.setNspFileFilterGL(getNSPFileFilterForGL());
|
preferences.setNspFileFilterGL(getNSPFileFilterForGL());
|
||||||
preferences.setGlVersion(getGlVer());
|
preferences.setGlVersion(getGlVer());
|
||||||
|
|
||||||
|
settingsBlockTinfoilController.updatePreferencesOnExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -71,7 +71,7 @@ Steps to roll NXDT functionality back:
|
||||||
<SVGPath content="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M17,11H15V9H17V11M13,11H11V9H13V11M9,11H7V9H9V11Z" />
|
<SVGPath content="M9,22A1,1 0 0,1 8,21V18H4A2,2 0 0,1 2,16V4C2,2.89 2.9,2 4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H13.9L10.2,21.71C10,21.9 9.75,22 9.5,22V22H9M10,16V19.08L13.08,16H20V4H4V16H10M17,11H15V9H17V11M13,11H11V9H13V11M9,11H7V9H9V11Z" />
|
||||||
</graphic>
|
</graphic>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab closable="false" disable="true">
|
<Tab closable="false" >
|
||||||
<content>
|
<content>
|
||||||
<fx:include fx:id="NXDTab" source="NXDTab.fxml" VBox.vgrow="ALWAYS" />
|
<fx:include fx:id="NXDTab" source="NXDTab.fxml" VBox.vgrow="ALWAYS" />
|
||||||
</content>
|
</content>
|
||||||
|
|
80
src/main/resources/SettingsBlockTinfoil.fxml
Normal file
80
src/main/resources/SettingsBlockTinfoil.fxml
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.CheckBox?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
<VBox spacing="5.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="nsusbloader.Controllers.SettingsBlockTinfoilController">
|
||||||
|
<children>
|
||||||
|
<Label text="Tinfoil" />
|
||||||
|
<CheckBox mnemonicParsing="false" text="%tab2_Cb_AllowXciNszXcz" fx:id="xciNszXczSupportCB">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets left="5.0" />
|
||||||
|
</VBox.margin></CheckBox>
|
||||||
|
<Label disable="true" text="%tab2_Lbl_AllowXciNszXczDesc" wrapText="true">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets left="5.0" />
|
||||||
|
</VBox.margin></Label>
|
||||||
|
<CheckBox fx:id="validateNSHostNameCB" mnemonicParsing="false" text="%tab2_Cb_ValidateNSHostName">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets left="5.0" />
|
||||||
|
</VBox.margin>
|
||||||
|
</CheckBox>
|
||||||
|
<CheckBox fx:id="networkExpertModeCB" mnemonicParsing="false" text="%tab2_Cb_ExpertMode">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets left="5.0" />
|
||||||
|
</VBox.margin></CheckBox>
|
||||||
|
<VBox fx:id="networkExpertSettingsVBox" spacing="5.0">
|
||||||
|
<children>
|
||||||
|
<CheckBox fx:id="autoDetectIpCB" mnemonicParsing="false" text="%tab2_Cb_AutoDetectIp">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</VBox.margin>
|
||||||
|
</CheckBox>
|
||||||
|
<CheckBox fx:id="randomlySelectPortCB" mnemonicParsing="false" text="%tab2_Cb_RandSelectPort">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</VBox.margin>
|
||||||
|
</CheckBox>
|
||||||
|
<HBox>
|
||||||
|
<children>
|
||||||
|
<Label text="%tab2_Lbl_HostIP" />
|
||||||
|
<Label text=":" />
|
||||||
|
<Label text="%tab2_Lbl_HostPort" />
|
||||||
|
<Label text="/" />
|
||||||
|
<Label text="%tab2_Lbl_HostExtra" />
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<HBox>
|
||||||
|
<children>
|
||||||
|
<TextField fx:id="pcIpTF" promptText="XXX.XXX.XXX.XXX" />
|
||||||
|
<Label text=":" />
|
||||||
|
<TextField fx:id="pcPortTF" promptText="0-65535" />
|
||||||
|
<Label text="/" />
|
||||||
|
<TextField fx:id="pcExtraTF" HBox.hgrow="ALWAYS">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</HBox.margin>
|
||||||
|
</TextField>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
<CheckBox fx:id="noRequestsServeCB" mnemonicParsing="false" text="%tab2_Cb_DontServeRequests">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</VBox.margin>
|
||||||
|
</CheckBox>
|
||||||
|
<Label disable="true" text="%tab2_Lbl_DontServeRequestsDesc" wrapText="true">
|
||||||
|
<VBox.margin>
|
||||||
|
<Insets />
|
||||||
|
</VBox.margin>
|
||||||
|
</Label>
|
||||||
|
</children>
|
||||||
|
<padding>
|
||||||
|
<Insets left="15.0" />
|
||||||
|
</padding>
|
||||||
|
</VBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
|
@ -63,73 +63,7 @@
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</HBox>
|
</HBox>
|
||||||
<Separator prefWidth="200.0" />
|
<Separator prefWidth="200.0" />
|
||||||
<Label text="Tinfoil" />
|
<fx:include fx:id="settingsBlockTinfoil" source="SettingsBlockTinfoil.fxml"/>
|
||||||
<CheckBox fx:id="tfXciSpprtCb" mnemonicParsing="false" text="%tab2_Cb_AllowXciNszXcz">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="5.0" />
|
|
||||||
</VBox.margin></CheckBox>
|
|
||||||
<Label disable="true" text="%tab2_Lbl_AllowXciNszXczDesc" wrapText="true">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="5.0" />
|
|
||||||
</VBox.margin></Label>
|
|
||||||
<CheckBox fx:id="validateNSHostNameCb" mnemonicParsing="false" text="%tab2_Cb_ValidateNSHostName">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="5.0" />
|
|
||||||
</VBox.margin>
|
|
||||||
</CheckBox>
|
|
||||||
<CheckBox fx:id="expertModeCb" mnemonicParsing="false" text="%tab2_Cb_ExpertMode">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets left="5.0" />
|
|
||||||
</VBox.margin></CheckBox>
|
|
||||||
<VBox fx:id="expertSettingsVBox" spacing="5.0">
|
|
||||||
<children>
|
|
||||||
<CheckBox fx:id="autoDetectIpCb" mnemonicParsing="false" text="%tab2_Cb_AutoDetectIp">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</VBox.margin>
|
|
||||||
</CheckBox>
|
|
||||||
<CheckBox fx:id="randPortCb" mnemonicParsing="false" text="%tab2_Cb_RandSelectPort">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</VBox.margin>
|
|
||||||
</CheckBox>
|
|
||||||
<HBox>
|
|
||||||
<children>
|
|
||||||
<Label text="%tab2_Lbl_HostIP" />
|
|
||||||
<Label text=":" />
|
|
||||||
<Label text="%tab2_Lbl_HostPort" />
|
|
||||||
<Label text="/" />
|
|
||||||
<Label text="%tab2_Lbl_HostExtra" />
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<HBox>
|
|
||||||
<children>
|
|
||||||
<TextField fx:id="pcIpTextField" promptText="XXX.XXX.XXX.XXX" />
|
|
||||||
<Label text=":" />
|
|
||||||
<TextField fx:id="pcPortTextField" promptText="0-65535" />
|
|
||||||
<Label text="/" />
|
|
||||||
<TextField fx:id="pcExtraTextField" HBox.hgrow="ALWAYS">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</HBox.margin>
|
|
||||||
</TextField>
|
|
||||||
</children>
|
|
||||||
</HBox>
|
|
||||||
<CheckBox fx:id="dontServeCb" mnemonicParsing="false" text="%tab2_Cb_DontServeRequests">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</VBox.margin>
|
|
||||||
</CheckBox>
|
|
||||||
<Label disable="true" text="%tab2_Lbl_DontServeRequestsDesc" wrapText="true">
|
|
||||||
<VBox.margin>
|
|
||||||
<Insets />
|
|
||||||
</VBox.margin>
|
|
||||||
</Label>
|
|
||||||
</children>
|
|
||||||
<padding>
|
|
||||||
<Insets left="15.0" />
|
|
||||||
</padding>
|
|
||||||
</VBox>
|
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0" left="15.0" right="15.0" top="5.0" />
|
<Insets bottom="5.0" left="15.0" right="15.0" top="5.0" />
|
||||||
|
|
Loading…
Reference in a new issue