From f3501976d78daaf72e14d0bfac0c96272aa67e28 Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Wed, 2 Sep 2020 18:08:02 -0500 Subject: [PATCH] UI: Fix rec time left not showing in stats If a user would start recording, then open the stats dialog, the recording time left would be blank. --- UI/window-basic-stats.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/UI/window-basic-stats.cpp b/UI/window-basic-stats.cpp index e4a428786..808a69fcc 100644 --- a/UI/window-basic-stats.cpp +++ b/UI/window-basic-stats.cpp @@ -182,6 +182,9 @@ OBSBasicStats::OBSBasicStats(QWidget *parent, bool closeable) } obs_frontend_add_event_callback(OBSFrontendEvent, this); + + if (obs_frontend_recording_active()) + StartRecTimeLeft(); } void OBSBasicStats::closeEvent(QCloseEvent *event) @@ -412,15 +415,20 @@ void OBSBasicStats::Update() void OBSBasicStats::StartRecTimeLeft() { + if (recTimeLeft.isActive()) + ResetRecTimeLeft(); + recordTimeLeft->setText(QTStr("Calculating")); recTimeLeft.start(); } void OBSBasicStats::ResetRecTimeLeft() { - bitrates.clear(); - recTimeLeft.stop(); - recordTimeLeft->setText(QTStr("")); + if (recTimeLeft.isActive()) { + bitrates.clear(); + recTimeLeft.stop(); + recordTimeLeft->setText(QTStr("")); + } } void OBSBasicStats::RecordingTimeLeft()