v0.3 UI is ready one more time

This commit is contained in:
Dmitry Isaenko 2019-03-19 03:30:13 +03:00
parent 31045683e4
commit 3a238d296c
7 changed files with 36 additions and 3 deletions

View file

@ -40,6 +40,25 @@ public class AppPreferences {
//------------ SETTINGS ------------------//
public boolean getNsIpValidationNeeded() {return preferences.getBoolean("NSIPVALIDATION", true);}
public void setNsIpValidationNeeded(boolean need){preferences.putBoolean("NSIPVALIDATION", need);}
public boolean getExpertMode(){return preferences.getBoolean("EXPERTMODE", false);}
public void setExpertMode(boolean mode){preferences.putBoolean("EXPERTMODE", mode);}
public boolean getAutoDetectIp(){return preferences.getBoolean("AUTOHOSTIP", true);}
public void setAutoDetectIp(boolean mode){preferences.putBoolean("AUTOHOSTIP", mode);}
public boolean getRandPort(){return preferences.getBoolean("RANDHOSTPORT", true);}
public void setRandPort(boolean mode){preferences.putBoolean("RANDHOSTPORT", mode);}
public boolean getNotServeRequests(){return preferences.getBoolean("DONTSERVEREQ", false);}
public void setNotServeRequests(boolean mode){preferences.putBoolean("DONTSERVEREQ", mode);}
public String getHostIp(){ return preferences.get("HOSTIP", "0.0.0.0");}
public void setHostIp(String ip){preferences.put("HOSTIP", ip);}
public String getHostPort(){ return preferences.get("HOSTPORT", "6042");}
public void setHostPort(String port){preferences.put("HOSTPORT", port);}
public String getHostPostfix(){ return preferences.get("HOSTPOSTFIX", "");}
public void setHostPostfix(String postfix){preferences.put("HOSTPOSTFIX", postfix);}
}

View file

@ -3,7 +3,6 @@ package nsusbloader.Controllers;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import nsusbloader.AppPreferences;
@ -40,18 +39,27 @@ public class SettingsController implements Initializable {
public void initialize(URL url, ResourceBundle resourceBundle) {
validateNSHostNameCb.setSelected(AppPreferences.getInstance().getNsIpValidationNeeded());
expertSettingsVBox.setDisable(AppPreferences.getInstance().getExpertMode());
expertSettingsVBox.setDisable(!AppPreferences.getInstance().getExpertMode());
expertModeCb.setSelected(AppPreferences.getInstance().getExpertMode());
expertModeCb.setOnAction(e->{
if (expertModeCb.isSelected())
expertSettingsVBox.setDisable(false);
else
expertSettingsVBox.setDisable(true);
});
autoDetectIpCb.setSelected(AppPreferences.getInstance().getAutoDetectIp());
randPortCb.setSelected(AppPreferences.getInstance().getRandPort());
dontServeCb.setSelected(AppPreferences.getInstance().getNotServeRequests());
}
public boolean getExpertModeSelected(){
return expertModeCb.isSelected();
}
public boolean isNsIpValidate(){ return validateNSHostNameCb.isSelected(); }
}