forked from j62/ctbrec
Add setting to diable thumbnail updates
This is a feature for people who have bandwidth / contingent restrictions. It can also help keeping the CPU usage down.
This commit is contained in:
parent
2e9aa56985
commit
97d3be0b98
|
@ -67,6 +67,7 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
private CheckBox secureCommunication = new CheckBox();
|
private CheckBox secureCommunication = new CheckBox();
|
||||||
private CheckBox chooseStreamQuality = new CheckBox();
|
private CheckBox chooseStreamQuality = new CheckBox();
|
||||||
private CheckBox multiplePlayers = new CheckBox();
|
private CheckBox multiplePlayers = new CheckBox();
|
||||||
|
private CheckBox updateThumbnails = new CheckBox();
|
||||||
private RadioButton recordLocal;
|
private RadioButton recordLocal;
|
||||||
private RadioButton recordRemote;
|
private RadioButton recordRemote;
|
||||||
private ToggleGroup recordLocation;
|
private ToggleGroup recordLocation;
|
||||||
|
@ -334,6 +335,14 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
GridPane.setMargin(chooseStreamQuality, new Insets(CHECKBOX_MARGIN, 0, 0, CHECKBOX_MARGIN));
|
GridPane.setMargin(chooseStreamQuality, new Insets(CHECKBOX_MARGIN, 0, 0, CHECKBOX_MARGIN));
|
||||||
layout.add(chooseStreamQuality, 1, row++);
|
layout.add(chooseStreamQuality, 1, row++);
|
||||||
|
|
||||||
|
l = new Label("Update thumbnails");
|
||||||
|
layout.add(l, 0, row);
|
||||||
|
updateThumbnails.setSelected(Config.getInstance().getSettings().updateThumbnails);
|
||||||
|
updateThumbnails.setOnAction((e) -> Config.getInstance().getSettings().updateThumbnails = updateThumbnails.isSelected());
|
||||||
|
GridPane.setMargin(l, new Insets(CHECKBOX_MARGIN, 0, 0, 0));
|
||||||
|
GridPane.setMargin(updateThumbnails, new Insets(CHECKBOX_MARGIN, 0, 0, CHECKBOX_MARGIN));
|
||||||
|
layout.add(updateThumbnails, 1, row++);
|
||||||
|
|
||||||
l = new Label("Maximum resolution (0 = unlimited)");
|
l = new Label("Maximum resolution (0 = unlimited)");
|
||||||
layout.add(l, 0, row);
|
layout.add(l, 0, row);
|
||||||
List<Integer> resolutionOptions = new ArrayList<>();
|
List<Integer> resolutionOptions = new ArrayList<>();
|
||||||
|
|
|
@ -262,20 +262,23 @@ public class ThumbCell extends StackPane {
|
||||||
|
|
||||||
private void setImage(String url) {
|
private void setImage(String url) {
|
||||||
if(!Objects.equals(System.getenv("CTBREC_DEV"), "1")) {
|
if(!Objects.equals(System.getenv("CTBREC_DEV"), "1")) {
|
||||||
Image img = new Image(url, true);
|
boolean updateThumbs = Config.getInstance().getSettings().updateThumbnails;
|
||||||
|
if(updateThumbs || iv.getImage() == null) {
|
||||||
|
Image img = new Image(url, true);
|
||||||
|
|
||||||
// wait for the image to load, otherwise the ImageView replaces the current image with an "empty" image,
|
// wait for the image to load, otherwise the ImageView replaces the current image with an "empty" image,
|
||||||
// which causes to show the grey background until the image is loaded
|
// which causes to show the grey background until the image is loaded
|
||||||
img.progressProperty().addListener(new ChangeListener<Number>() {
|
img.progressProperty().addListener(new ChangeListener<Number>() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
|
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
|
||||||
if(newValue.doubleValue() == 1.0) {
|
if(newValue.doubleValue() == 1.0) {
|
||||||
//imgAspectRatio = img.getHeight() / img.getWidth();
|
//imgAspectRatio = img.getHeight() / img.getWidth();
|
||||||
iv.setImage(img);
|
iv.setImage(img);
|
||||||
setThumbWidth(Config.getInstance().getSettings().thumbWidth);
|
setThumbWidth(Config.getInstance().getSettings().thumbWidth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class Settings {
|
||||||
public String proxyUser;
|
public String proxyUser;
|
||||||
public String proxyPassword;
|
public String proxyPassword;
|
||||||
public int thumbWidth = 180;
|
public int thumbWidth = 180;
|
||||||
|
public boolean updateThumbnails = true;
|
||||||
public int windowWidth = 1340;
|
public int windowWidth = 1340;
|
||||||
public int windowHeight = 800;
|
public int windowHeight = 800;
|
||||||
public boolean windowMaximized = false;
|
public boolean windowMaximized = false;
|
||||||
|
|
Loading…
Reference in New Issue