forked from j62/ctbrec
Code cleanup
This commit is contained in:
parent
25fc51521a
commit
1ec2cf5286
|
@ -44,25 +44,22 @@ import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Priority;
|
import javafx.scene.layout.Priority;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.text.Font;;
|
import javafx.scene.text.Font;
|
||||||
|
|
||||||
public class SettingsTab extends Tab implements TabSelectionListener {
|
public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
|
|
||||||
private static final transient Logger LOG = LoggerFactory.getLogger(SettingsTab.class);
|
private static final String PATTERN_NOT_A_DIGIT = "[^\\d]";
|
||||||
private static final int ONE_GiB_IN_BYTES = 1024 * 1024 * 1024;
|
private static final Logger LOG = LoggerFactory.getLogger(SettingsTab.class);
|
||||||
|
private static final int ONE_GIB_IN_BYTES = 1024 * 1024 * 1024;
|
||||||
|
|
||||||
public static final int CHECKBOX_MARGIN = 6;
|
public static final int CHECKBOX_MARGIN = 6;
|
||||||
private DirectorySelectionBox recordingsDirectory;
|
private DirectorySelectionBox recordingsDirectory;
|
||||||
private ProgramSelectionBox mediaPlayer;
|
|
||||||
private ProgramSelectionBox postProcessing;
|
private ProgramSelectionBox postProcessing;
|
||||||
private TextField server;
|
private TextField server;
|
||||||
private TextField port;
|
private TextField port;
|
||||||
private TextField onlineCheckIntervalInSecs;
|
private TextField onlineCheckIntervalInSecs;
|
||||||
private TextField overviewUpdateIntervalInSecs;
|
|
||||||
private TextField leaveSpaceOnDevice;
|
private TextField leaveSpaceOnDevice;
|
||||||
private TextField minimumLengthInSecs;
|
private TextField minimumLengthInSecs;
|
||||||
private TextField servletContext;
|
|
||||||
private CheckBox loadResolution;
|
|
||||||
private CheckBox useAuthentication = new CheckBox();
|
private CheckBox useAuthentication = new CheckBox();
|
||||||
private CheckBox useTLS = new CheckBox();
|
private CheckBox useTLS = new CheckBox();
|
||||||
private CheckBox chooseStreamQuality = new CheckBox();
|
private CheckBox chooseStreamQuality = new CheckBox();
|
||||||
|
@ -71,8 +68,6 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
private CheckBox livePreviews = new CheckBox();
|
private CheckBox livePreviews = new CheckBox();
|
||||||
private CheckBox showPlayerStarting = new CheckBox();
|
private CheckBox showPlayerStarting = new CheckBox();
|
||||||
private RadioButton recordLocal;
|
private RadioButton recordLocal;
|
||||||
private RadioButton recordRemote;
|
|
||||||
private ToggleGroup recordLocation;
|
|
||||||
private ProxySettingsPane proxySettingsPane;
|
private ProxySettingsPane proxySettingsPane;
|
||||||
private TextField maxResolution;
|
private TextField maxResolution;
|
||||||
private TextField concurrentRecordings;
|
private TextField concurrentRecordings;
|
||||||
|
@ -156,16 +151,16 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
Label l = new Label("Record Location");
|
Label l = new Label("Record Location");
|
||||||
int row = 0;
|
int row = 0;
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
recordLocation = new ToggleGroup();
|
ToggleGroup recordLocationToggleGroup = new ToggleGroup();
|
||||||
recordLocal = new RadioButton("Local");
|
recordLocal = new RadioButton("Local");
|
||||||
recordRemote = new RadioButton("Remote");
|
RadioButton recordRemote = new RadioButton("Remote");
|
||||||
recordLocal.setToggleGroup(recordLocation);
|
recordLocal.setToggleGroup(recordLocationToggleGroup);
|
||||||
recordRemote.setToggleGroup(recordLocation);
|
recordRemote.setToggleGroup(recordLocationToggleGroup);
|
||||||
recordLocal.setSelected(Config.getInstance().getSettings().localRecording);
|
recordLocal.setSelected(Config.getInstance().getSettings().localRecording);
|
||||||
recordRemote.setSelected(!recordLocal.isSelected());
|
recordRemote.setSelected(!recordLocal.isSelected());
|
||||||
layout.add(recordLocal, 1, row);
|
layout.add(recordLocal, 1, row);
|
||||||
layout.add(recordRemote, 2, row++);
|
layout.add(recordRemote, 2, row++);
|
||||||
recordLocation.selectedToggleProperty().addListener((e) -> {
|
recordLocationToggleGroup.selectedToggleProperty().addListener(e -> {
|
||||||
Config.getInstance().getSettings().localRecording = recordLocal.isSelected();
|
Config.getInstance().getSettings().localRecording = recordLocal.isSelected();
|
||||||
setRecordingMode(recordLocal.isSelected());
|
setRecordingMode(recordLocal.isSelected());
|
||||||
showRestartRequired();
|
showRestartRequired();
|
||||||
|
@ -192,7 +187,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
port = new TextField(Integer.toString(Config.getInstance().getSettings().httpPort));
|
port = new TextField(Integer.toString(Config.getInstance().getSettings().httpPort));
|
||||||
port.textProperty().addListener((observable, oldValue, newValue) -> {
|
port.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
port.setText(newValue.replaceAll("[^\\d]", ""));
|
port.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if(!port.getText().isEmpty()) {
|
if(!port.getText().isEmpty()) {
|
||||||
Config.getInstance().getSettings().httpPort = Integer.parseInt(port.getText());
|
Config.getInstance().getSettings().httpPort = Integer.parseInt(port.getText());
|
||||||
|
@ -205,7 +200,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
layout.add(port, 1, row++);
|
layout.add(port, 1, row++);
|
||||||
|
|
||||||
layout.add(new Label("Path"), 0, row);
|
layout.add(new Label("Path"), 0, row);
|
||||||
servletContext = new TextField(Config.getInstance().getSettings().servletContext);
|
TextField servletContext = new TextField(Config.getInstance().getSettings().servletContext);
|
||||||
servletContext.setPromptText("e.g. /ctbrec");
|
servletContext.setPromptText("e.g. /ctbrec");
|
||||||
servletContext.setTooltip(new Tooltip("Leave empty, if you didn't change the servletContext in the server config"));
|
servletContext.setTooltip(new Tooltip("Leave empty, if you didn't change the servletContext in the server config"));
|
||||||
servletContext.textProperty().addListener((observable, oldValue, newValue) -> {
|
servletContext.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
@ -220,7 +215,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Require authentication");
|
l = new Label("Require authentication");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
useAuthentication.setSelected(Config.getInstance().getSettings().requireAuthentication);
|
useAuthentication.setSelected(Config.getInstance().getSettings().requireAuthentication);
|
||||||
useAuthentication.setOnAction((e) -> {
|
useAuthentication.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().requireAuthentication = useAuthentication.isSelected();
|
Config.getInstance().getSettings().requireAuthentication = useAuthentication.isSelected();
|
||||||
if(useAuthentication.isSelected()) {
|
if(useAuthentication.isSelected()) {
|
||||||
byte[] key = Config.getInstance().getSettings().key;
|
byte[] key = Config.getInstance().getSettings().key;
|
||||||
|
@ -248,13 +243,13 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Use Secure Communication (TLS)");
|
l = new Label("Use Secure Communication (TLS)");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
useTLS.setSelected(Config.getInstance().getSettings().transportLayerSecurity);
|
useTLS.setSelected(Config.getInstance().getSettings().transportLayerSecurity);
|
||||||
useTLS.setOnAction((e) -> {
|
useTLS.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().transportLayerSecurity = useTLS.isSelected();
|
Config.getInstance().getSettings().transportLayerSecurity = useTLS.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
GridPane.setMargin(l, new Insets(4, CHECKBOX_MARGIN, 0, 0));
|
GridPane.setMargin(l, new Insets(4, CHECKBOX_MARGIN, 0, 0));
|
||||||
GridPane.setMargin(useTLS, new Insets(4, 0, 0, 0));
|
GridPane.setMargin(useTLS, new Insets(4, 0, 0, 0));
|
||||||
layout.add(useTLS, 1, row++);
|
layout.add(useTLS, 1, row);
|
||||||
|
|
||||||
TitledPane recordLocation = new TitledPane("Record Location", layout);
|
TitledPane recordLocation = new TitledPane("Record Location", layout);
|
||||||
recordLocation.setCollapsible(false);
|
recordLocation.setCollapsible(false);
|
||||||
|
@ -287,7 +282,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
options.add(ONE_PER_RECORDING);
|
options.add(ONE_PER_RECORDING);
|
||||||
directoryStructure = new ComboBox<>(FXCollections.observableList(options));
|
directoryStructure = new ComboBox<>(FXCollections.observableList(options));
|
||||||
directoryStructure.setValue(Config.getInstance().getSettings().recordingsDirStructure);
|
directoryStructure.setValue(Config.getInstance().getSettings().recordingsDirStructure);
|
||||||
directoryStructure.setOnAction((evt) -> {
|
directoryStructure.setOnAction(evt -> {
|
||||||
Config.getInstance().getSettings().recordingsDirStructure = directoryStructure.getValue();
|
Config.getInstance().getSettings().recordingsDirStructure = directoryStructure.getValue();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -312,7 +307,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
splitAfter = new ComboBox<>(FXCollections.observableList(splitOptions));
|
splitAfter = new ComboBox<>(FXCollections.observableList(splitOptions));
|
||||||
layout.add(splitAfter, 1, row++);
|
layout.add(splitAfter, 1, row++);
|
||||||
setSplitAfterValue();
|
setSplitAfterValue();
|
||||||
splitAfter.setOnAction((e) -> {
|
splitAfter.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().splitRecordings = splitAfter.getSelectionModel().getSelectedItem().getValue();
|
Config.getInstance().getSettings().splitRecordings = splitAfter.getSelectionModel().getSelectedItem().getValue();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -328,7 +323,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
maxResolution.setTooltip(tt);
|
maxResolution.setTooltip(tt);
|
||||||
maxResolution.textProperty().addListener((observable, oldValue, newValue) -> {
|
maxResolution.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
maxResolution.setText(newValue.replaceAll("[^\\d]", ""));
|
maxResolution.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if (!maxResolution.getText().isEmpty()) {
|
if (!maxResolution.getText().isEmpty()) {
|
||||||
int newRes = Integer.parseInt(maxResolution.getText());
|
int newRes = Integer.parseInt(maxResolution.getText());
|
||||||
|
@ -348,7 +343,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
concurrentRecordings = new TextField(Integer.toString(Config.getInstance().getSettings().concurrentRecordings));
|
concurrentRecordings = new TextField(Integer.toString(Config.getInstance().getSettings().concurrentRecordings));
|
||||||
concurrentRecordings.textProperty().addListener((observable, oldValue, newValue) -> {
|
concurrentRecordings.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
concurrentRecordings.setText(newValue.replaceAll("[^\\d]", ""));
|
concurrentRecordings.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if (!concurrentRecordings.getText().isEmpty()) {
|
if (!concurrentRecordings.getText().isEmpty()) {
|
||||||
int newConcurrentRecordings = Integer.parseInt(concurrentRecordings.getText());
|
int newConcurrentRecordings = Integer.parseInt(concurrentRecordings.getText());
|
||||||
|
@ -386,7 +381,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
onlineCheckIntervalInSecs.setTooltip(tt);
|
onlineCheckIntervalInSecs.setTooltip(tt);
|
||||||
onlineCheckIntervalInSecs.textProperty().addListener((observable, oldValue, newValue) -> {
|
onlineCheckIntervalInSecs.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
onlineCheckIntervalInSecs.setText(newValue.replaceAll("[^\\d]", ""));
|
onlineCheckIntervalInSecs.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if(!onlineCheckIntervalInSecs.getText().isEmpty()) {
|
if(!onlineCheckIntervalInSecs.getText().isEmpty()) {
|
||||||
Config.getInstance().getSettings().onlineCheckIntervalInSecs = Integer.parseInt(onlineCheckIntervalInSecs.getText());
|
Config.getInstance().getSettings().onlineCheckIntervalInSecs = Integer.parseInt(onlineCheckIntervalInSecs.getText());
|
||||||
|
@ -401,16 +396,16 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l.setTooltip(tt);
|
l.setTooltip(tt);
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
long minimumSpaceLeftInBytes = Config.getInstance().getSettings().minimumSpaceLeftInBytes;
|
long minimumSpaceLeftInBytes = Config.getInstance().getSettings().minimumSpaceLeftInBytes;
|
||||||
int minimumSpaceLeftInGiB = (int) (minimumSpaceLeftInBytes / ONE_GiB_IN_BYTES);
|
int minimumSpaceLeftInGiB = (int) (minimumSpaceLeftInBytes / ONE_GIB_IN_BYTES);
|
||||||
leaveSpaceOnDevice = new TextField(Integer.toString(minimumSpaceLeftInGiB));
|
leaveSpaceOnDevice = new TextField(Integer.toString(minimumSpaceLeftInGiB));
|
||||||
leaveSpaceOnDevice.setTooltip(tt);
|
leaveSpaceOnDevice.setTooltip(tt);
|
||||||
leaveSpaceOnDevice.textProperty().addListener((observable, oldValue, newValue) -> {
|
leaveSpaceOnDevice.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
leaveSpaceOnDevice.setText(newValue.replaceAll("[^\\d]", ""));
|
leaveSpaceOnDevice.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if(!leaveSpaceOnDevice.getText().isEmpty()) {
|
if(!leaveSpaceOnDevice.getText().isEmpty()) {
|
||||||
long spaceLeftInGiB = Long.parseLong(leaveSpaceOnDevice.getText());
|
long spaceLeftInGiB = Long.parseLong(leaveSpaceOnDevice.getText());
|
||||||
Config.getInstance().getSettings().minimumSpaceLeftInBytes = spaceLeftInGiB * ONE_GiB_IN_BYTES;
|
Config.getInstance().getSettings().minimumSpaceLeftInBytes = spaceLeftInGiB * ONE_GIB_IN_BYTES;
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -426,7 +421,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
minimumLengthInSecs.setTooltip(tt);
|
minimumLengthInSecs.setTooltip(tt);
|
||||||
minimumLengthInSecs.textProperty().addListener((observable, oldValue, newValue) -> {
|
minimumLengthInSecs.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
minimumLengthInSecs.setText(newValue.replaceAll("[^\\d]", ""));
|
minimumLengthInSecs.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if(!minimumLengthInSecs.getText().isEmpty()) {
|
if(!minimumLengthInSecs.getText().isEmpty()) {
|
||||||
int minimumLength = Integer.parseInt(minimumLengthInSecs.getText());
|
int minimumLength = Integer.parseInt(minimumLengthInSecs.getText());
|
||||||
|
@ -435,7 +430,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
GridPane.setMargin(minimumLengthInSecs, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(minimumLengthInSecs, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(minimumLengthInSecs, 1, row++);
|
layout.add(minimumLengthInSecs, 1, row);
|
||||||
|
|
||||||
TitledPane locations = new TitledPane("Recorder", layout);
|
TitledPane locations = new TitledPane("Recorder", layout);
|
||||||
locations.setCollapsible(false);
|
locations.setCollapsible(false);
|
||||||
|
@ -457,7 +452,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
layout.add(new Label("Player"), 0, row);
|
layout.add(new Label("Player"), 0, row);
|
||||||
mediaPlayer = new ProgramSelectionBox(Config.getInstance().getSettings().mediaPlayer);
|
ProgramSelectionBox mediaPlayer = new ProgramSelectionBox(Config.getInstance().getSettings().mediaPlayer);
|
||||||
mediaPlayer.fileProperty().addListener((obs, o, n) -> {
|
mediaPlayer.fileProperty().addListener((obs, o, n) -> {
|
||||||
String path = n;
|
String path = n;
|
||||||
if (!Objects.equals(path, Config.getInstance().getSettings().mediaPlayer)) {
|
if (!Objects.equals(path, Config.getInstance().getSettings().mediaPlayer)) {
|
||||||
|
@ -473,7 +468,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
Label l = new Label("Allow multiple players");
|
Label l = new Label("Allow multiple players");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
multiplePlayers.setSelected(!Config.getInstance().getSettings().singlePlayer);
|
multiplePlayers.setSelected(!Config.getInstance().getSettings().singlePlayer);
|
||||||
multiplePlayers.setOnAction((e) -> {
|
multiplePlayers.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().singlePlayer = !multiplePlayers.isSelected();
|
Config.getInstance().getSettings().singlePlayer = !multiplePlayers.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -484,7 +479,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Show \"Player Starting\" Message");
|
l = new Label("Show \"Player Starting\" Message");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
showPlayerStarting.setSelected(Config.getInstance().getSettings().showPlayerStarting);
|
showPlayerStarting.setSelected(Config.getInstance().getSettings().showPlayerStarting);
|
||||||
showPlayerStarting.setOnAction((e) -> {
|
showPlayerStarting.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().showPlayerStarting = showPlayerStarting.isSelected();
|
Config.getInstance().getSettings().showPlayerStarting = showPlayerStarting.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -494,9 +489,9 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
|
|
||||||
l = new Label("Display stream resolution in overview");
|
l = new Label("Display stream resolution in overview");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
loadResolution = new CheckBox();
|
CheckBox loadResolution = new CheckBox();
|
||||||
loadResolution.setSelected(Config.getInstance().getSettings().determineResolution);
|
loadResolution.setSelected(Config.getInstance().getSettings().determineResolution);
|
||||||
loadResolution.setOnAction((e) -> {
|
loadResolution.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().determineResolution = loadResolution.isSelected();
|
Config.getInstance().getSettings().determineResolution = loadResolution.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -507,7 +502,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Manually select stream quality");
|
l = new Label("Manually select stream quality");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
chooseStreamQuality.setSelected(Config.getInstance().getSettings().chooseStreamQuality);
|
chooseStreamQuality.setSelected(Config.getInstance().getSettings().chooseStreamQuality);
|
||||||
chooseStreamQuality.setOnAction((e) -> {
|
chooseStreamQuality.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().chooseStreamQuality = chooseStreamQuality.isSelected();
|
Config.getInstance().getSettings().chooseStreamQuality = chooseStreamQuality.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -518,7 +513,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Enable live previews (experimental)");
|
l = new Label("Enable live previews (experimental)");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
livePreviews.setSelected(Config.getInstance().getSettings().livePreviews);
|
livePreviews.setSelected(Config.getInstance().getSettings().livePreviews);
|
||||||
livePreviews.setOnAction((e) -> {
|
livePreviews.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().livePreviews = livePreviews.isSelected();
|
Config.getInstance().getSettings().livePreviews = livePreviews.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
showRestartRequired();
|
showRestartRequired();
|
||||||
|
@ -533,7 +528,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
updateThumbnails.setTooltip(tt);
|
updateThumbnails.setTooltip(tt);
|
||||||
updateThumbnails.setSelected(Config.getInstance().getSettings().updateThumbnails);
|
updateThumbnails.setSelected(Config.getInstance().getSettings().updateThumbnails);
|
||||||
updateThumbnails.setOnAction((e) -> {
|
updateThumbnails.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().updateThumbnails = updateThumbnails.isSelected();
|
Config.getInstance().getSettings().updateThumbnails = updateThumbnails.isSelected();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -545,11 +540,11 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Update overview interval (seconds)");
|
l = new Label("Update overview interval (seconds)");
|
||||||
l.setTooltip(tt);
|
l.setTooltip(tt);
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
overviewUpdateIntervalInSecs = new TextField(Integer.toString(Config.getInstance().getSettings().overviewUpdateIntervalInSecs));
|
TextField overviewUpdateIntervalInSecs = new TextField(Integer.toString(Config.getInstance().getSettings().overviewUpdateIntervalInSecs));
|
||||||
overviewUpdateIntervalInSecs.setTooltip(tt);
|
overviewUpdateIntervalInSecs.setTooltip(tt);
|
||||||
overviewUpdateIntervalInSecs.textProperty().addListener((observable, oldValue, newValue) -> {
|
overviewUpdateIntervalInSecs.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (!newValue.matches("\\d*")) {
|
if (!newValue.matches("\\d*")) {
|
||||||
overviewUpdateIntervalInSecs.setText(newValue.replaceAll("[^\\d]", ""));
|
overviewUpdateIntervalInSecs.setText(newValue.replaceAll(PATTERN_NOT_A_DIGIT, ""));
|
||||||
}
|
}
|
||||||
if(!overviewUpdateIntervalInSecs.getText().isEmpty()) {
|
if(!overviewUpdateIntervalInSecs.getText().isEmpty()) {
|
||||||
Config.getInstance().getSettings().overviewUpdateIntervalInSecs = Integer.parseInt(overviewUpdateIntervalInSecs.getText());
|
Config.getInstance().getSettings().overviewUpdateIntervalInSecs = Integer.parseInt(overviewUpdateIntervalInSecs.getText());
|
||||||
|
@ -564,7 +559,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Start Tab");
|
l = new Label("Start Tab");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
startTab = new ComboBox<>();
|
startTab = new ComboBox<>();
|
||||||
startTab.setOnAction((e) -> {
|
startTab.setOnAction(e -> {
|
||||||
Config.getInstance().getSettings().startTab = startTab.getSelectionModel().getSelectedItem();
|
Config.getInstance().getSettings().startTab = startTab.getSelectionModel().getSelectedItem();
|
||||||
saveConfig();
|
saveConfig();
|
||||||
});
|
});
|
||||||
|
@ -576,7 +571,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
l = new Label("Colors (Base / Accent)");
|
l = new Label("Colors (Base / Accent)");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
ColorSettingsPane colorSettingsPane = new ColorSettingsPane(this);
|
ColorSettingsPane colorSettingsPane = new ColorSettingsPane(this);
|
||||||
layout.add(colorSettingsPane, 1, row++);
|
layout.add(colorSettingsPane, 1, row);
|
||||||
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
GridPane.setMargin(l, new Insets(0, 0, 0, 0));
|
||||||
GridPane.setMargin(colorSettingsPane, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(colorSettingsPane, new Insets(0, 0, 0, CHECKBOX_MARGIN));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue