From f45429a01e601c5cc567451ea909ddac4bb900a2 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Fri, 12 Jun 2020 18:46:50 +0200 Subject: [PATCH] Set bandwidth throughput to 0 if no model is recorded --- .../src/main/java/ctbrec/ui/CamrecApplication.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/main/java/ctbrec/ui/CamrecApplication.java b/client/src/main/java/ctbrec/ui/CamrecApplication.java index af619c8a..dd402d03 100644 --- a/client/src/main/java/ctbrec/ui/CamrecApplication.java +++ b/client/src/main/java/ctbrec/ui/CamrecApplication.java @@ -324,6 +324,7 @@ public class CamrecApplication extends Application { activeRecordings = models.size(); String windowTitle = activeRecordings > 0 ? "(" + activeRecordings + ") " + title : title; Platform.runLater(() -> primaryStage.setTitle(windowTitle)); + updateStatus(); } catch (Exception e) { LOG.warn("Couldn't update window title", e); } @@ -336,12 +337,19 @@ public class CamrecApplication extends Application { BandwidthMeter.addListener((bytes, dur) -> { long seconds = dur.getSeconds(); bytesPerSecond = bytes / (double)seconds; - 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)); + updateStatus(); }); } + 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() { File colorCss = new File(Config.getInstance().getConfigDir(), "color.css"); try(FileOutputStream fos = new FileOutputStream(colorCss)) {