Added "space used" to recordings tab
This commit is contained in:
parent
898b04d610
commit
e90ef22fa1
|
@ -3,6 +3,7 @@
|
|||
* Fixed MVLive recordings once again
|
||||
* Fix: "Check URLs" button stays inactive after the first run
|
||||
* ~~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 server setting to choose between fast and accurate playlist generation
|
||||
* Some smaller tweaks here and there
|
||||
|
|
|
@ -106,7 +106,8 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
|||
ObservableList<JavaFxRecording> observableRecordings = FXCollections.observableArrayList();
|
||||
ContextMenu popup;
|
||||
ProgressBar spaceLeft;
|
||||
Label spaceLabel;
|
||||
Label spaceFreeLabel;
|
||||
Label spaceUsedValue;
|
||||
Lock recordingsLock = new ReentrantLock();
|
||||
|
||||
public RecordingsTab(String title, Recorder recorder, Config config) {
|
||||
|
@ -171,15 +172,19 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
|||
scrollPane.setContent(table);
|
||||
|
||||
HBox spaceBox = new HBox(5);
|
||||
Label l = new Label("Space left on device");
|
||||
HBox.setMargin(l, new Insets(2, 0, 0, 0));
|
||||
spaceBox.getChildren().add(l);
|
||||
Label spaceLeftLabel = new Label("Space left on device");
|
||||
spaceBox.getChildren().add(spaceLeftLabel);
|
||||
spaceLeft = new ProgressBar(0);
|
||||
spaceLeft.setPrefSize(200, 22);
|
||||
spaceLabel = new Label();
|
||||
spaceLabel.setFont(Font.font(11));
|
||||
StackPane stack = new StackPane(spaceLeft, spaceLabel);
|
||||
spaceBox.getChildren().add(stack);
|
||||
spaceFreeLabel = new Label();
|
||||
spaceFreeLabel.setFont(Font.font(11));
|
||||
StackPane stack = new StackPane(spaceLeft, spaceFreeLabel);
|
||||
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 root = new BorderPane();
|
||||
|
@ -268,6 +273,7 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
|||
updateService.setOnSucceeded(event -> {
|
||||
updateRecordingsTable();
|
||||
updateFreeSpaceDisplay();
|
||||
updateUsedSpaceDisplay();
|
||||
});
|
||||
updateService.setOnFailed(event -> {
|
||||
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() {
|
||||
if (spaceTotal != -1 && spaceFree != -1) {
|
||||
double free = ((double) spaceFree) / spaceTotal;
|
||||
|
@ -288,7 +299,7 @@ public class RecordingsTab extends Tab implements TabSelectionListener {
|
|||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
String tt = df.format(freeGiB) + " / " + df.format(totalGiB) + " GiB";
|
||||
spaceLeft.setTooltip(new Tooltip(tt));
|
||||
spaceLabel.setText(tt);
|
||||
spaceFreeLabel.setText(tt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue