forked from j62/ctbrec
Set bandwidth throughput to 0 if no model is recorded
This commit is contained in:
parent
f4ad1a4f61
commit
f45429a01e
|
@ -324,6 +324,7 @@ public class CamrecApplication extends Application {
|
||||||
activeRecordings = models.size();
|
activeRecordings = models.size();
|
||||||
String windowTitle = activeRecordings > 0 ? "(" + activeRecordings + ") " + title : title;
|
String windowTitle = activeRecordings > 0 ? "(" + activeRecordings + ") " + title : title;
|
||||||
Platform.runLater(() -> primaryStage.setTitle(windowTitle));
|
Platform.runLater(() -> primaryStage.setTitle(windowTitle));
|
||||||
|
updateStatus();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Couldn't update window title", e);
|
LOG.warn("Couldn't update window title", e);
|
||||||
}
|
}
|
||||||
|
@ -336,12 +337,19 @@ public class CamrecApplication extends Application {
|
||||||
BandwidthMeter.addListener((bytes, dur) -> {
|
BandwidthMeter.addListener((bytes, dur) -> {
|
||||||
long seconds = dur.getSeconds();
|
long seconds = dur.getSeconds();
|
||||||
bytesPerSecond = bytes / (double)seconds;
|
bytesPerSecond = bytes / (double)seconds;
|
||||||
String humanreadable = ByteUnitFormatter.format(bytesPerSecond);
|
updateStatus();
|
||||||
String status = String.format("Recording %s / %s models @ %s/s", activeRecordings, recorder.getModels().size(), humanreadable);
|
|
||||||
Platform.runLater(() -> statusLabel.setText(status));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateStatus() {
|
||||||
|
if (activeRecordings == 0) {
|
||||||
|
bytesPerSecond = 0;
|
||||||
|
}
|
||||||
|
String humanreadable = ByteUnitFormatter.format(bytesPerSecond);
|
||||||
|
String status = String.format("Recording %s / %s models @ %s/s", activeRecordings, recorder.getModels().size(), humanreadable);
|
||||||
|
Platform.runLater(() -> statusLabel.setText(status));
|
||||||
|
}
|
||||||
|
|
||||||
private void writeColorSchemeStyleSheet() {
|
private void writeColorSchemeStyleSheet() {
|
||||||
File colorCss = new File(Config.getInstance().getConfigDir(), "color.css");
|
File colorCss = new File(Config.getInstance().getConfigDir(), "color.css");
|
||||||
try(FileOutputStream fos = new FileOutputStream(colorCss)) {
|
try(FileOutputStream fos = new FileOutputStream(colorCss)) {
|
||||||
|
|
Loading…
Reference in New Issue