forked from j62/ctbrec
Added "space used" to recordings tab
This commit is contained in:
parent
898b04d610
commit
e90ef22fa1
|
@ -3,6 +3,7 @@
|
||||||
* Fixed MVLive recordings once again
|
* Fixed MVLive recordings once again
|
||||||
* Fix: "Check URLs" button stays inactive after the first run
|
* Fix: "Check URLs" button stays inactive after the first run
|
||||||
* ~~Fix: recordings for some Cam4 models still didn't start~~
|
* ~~Fix: recordings for some Cam4 models still didn't start~~
|
||||||
|
* Added "space used" to recordings tab
|
||||||
* Added menu item to add models in paused state to the "Recording" tab
|
* Added menu item to add models in paused state to the "Recording" tab
|
||||||
* Added server setting to choose between fast and accurate playlist generation
|
* Added server setting to choose between fast and accurate playlist generation
|
||||||
* Some smaller tweaks here and there
|
* Some smaller tweaks here and there
|
||||||
|
|
|
@ -106,7 +106,8 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
||||||
ObservableList<JavaFxRecording> observableRecordings = FXCollections.observableArrayList();
|
ObservableList<JavaFxRecording> observableRecordings = FXCollections.observableArrayList();
|
||||||
ContextMenu popup;
|
ContextMenu popup;
|
||||||
ProgressBar spaceLeft;
|
ProgressBar spaceLeft;
|
||||||
Label spaceLabel;
|
Label spaceFreeLabel;
|
||||||
|
Label spaceUsedValue;
|
||||||
Lock recordingsLock = new ReentrantLock();
|
Lock recordingsLock = new ReentrantLock();
|
||||||
|
|
||||||
public RecordingsTab(String title, Recorder recorder, Config config) {
|
public RecordingsTab(String title, Recorder recorder, Config config) {
|
||||||
|
@ -171,15 +172,19 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
||||||
scrollPane.setContent(table);
|
scrollPane.setContent(table);
|
||||||
|
|
||||||
HBox spaceBox = new HBox(5);
|
HBox spaceBox = new HBox(5);
|
||||||
Label l = new Label("Space left on device");
|
Label spaceLeftLabel = new Label("Space left on device");
|
||||||
HBox.setMargin(l, new Insets(2, 0, 0, 0));
|
spaceBox.getChildren().add(spaceLeftLabel);
|
||||||
spaceBox.getChildren().add(l);
|
|
||||||
spaceLeft = new ProgressBar(0);
|
spaceLeft = new ProgressBar(0);
|
||||||
spaceLeft.setPrefSize(200, 22);
|
spaceLeft.setPrefSize(200, 22);
|
||||||
spaceLabel = new Label();
|
spaceFreeLabel = new Label();
|
||||||
spaceLabel.setFont(Font.font(11));
|
spaceFreeLabel.setFont(Font.font(11));
|
||||||
StackPane stack = new StackPane(spaceLeft, spaceLabel);
|
StackPane stack = new StackPane(spaceLeft, spaceFreeLabel);
|
||||||
spaceBox.getChildren().add(stack);
|
Label spaceUsedLabel = new Label("Space used:");
|
||||||
|
spaceUsedValue = new Label();
|
||||||
|
spaceBox.getChildren().addAll(stack, spaceUsedLabel, spaceUsedValue);
|
||||||
|
HBox.setMargin(spaceLeftLabel, new Insets(2, 0, 0, 0));
|
||||||
|
HBox.setMargin(spaceUsedLabel, new Insets(2, 0, 0, 20));
|
||||||
|
HBox.setMargin(spaceUsedValue, new Insets(2, 0, 0, 0));
|
||||||
BorderPane.setMargin(spaceBox, new Insets(5));
|
BorderPane.setMargin(spaceBox, new Insets(5));
|
||||||
|
|
||||||
BorderPane root = new BorderPane();
|
BorderPane root = new BorderPane();
|
||||||
|
@ -268,6 +273,7 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
||||||
updateService.setOnSucceeded(event -> {
|
updateService.setOnSucceeded(event -> {
|
||||||
updateRecordingsTable();
|
updateRecordingsTable();
|
||||||
updateFreeSpaceDisplay();
|
updateFreeSpaceDisplay();
|
||||||
|
updateUsedSpaceDisplay();
|
||||||
});
|
});
|
||||||
updateService.setOnFailed(event -> {
|
updateService.setOnFailed(event -> {
|
||||||
LOG.info("Couldn't get list of recordings from recorder", event.getSource().getException());
|
LOG.info("Couldn't get list of recordings from recorder", event.getSource().getException());
|
||||||
|
@ -279,6 +285,11 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateUsedSpaceDisplay() {
|
||||||
|
long sum = table.getItems().stream().mapToLong(Recording::getSizeInByte).sum();
|
||||||
|
spaceUsedValue.setText(StringUtil.formatSize(sum));
|
||||||
|
}
|
||||||
|
|
||||||
private void updateFreeSpaceDisplay() {
|
private void updateFreeSpaceDisplay() {
|
||||||
if (spaceTotal != -1 && spaceFree != -1) {
|
if (spaceTotal != -1 && spaceFree != -1) {
|
||||||
double free = ((double) spaceFree) / spaceTotal;
|
double free = ((double) spaceFree) / spaceTotal;
|
||||||
|
@ -288,7 +299,7 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
||||||
DecimalFormat df = new DecimalFormat("0.00");
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
String tt = df.format(freeGiB) + " / " + df.format(totalGiB) + " GiB";
|
String tt = df.format(freeGiB) + " / " + df.format(totalGiB) + " GiB";
|
||||||
spaceLeft.setTooltip(new Tooltip(tt));
|
spaceLeft.setTooltip(new Tooltip(tt));
|
||||||
spaceLabel.setText(tt);
|
spaceFreeLabel.setText(tt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue