Merge pull request #3397 from cg2121/fix-stats-bug

UI: Fix rec time left not showing in stats
This commit is contained in:
Jim 2020-09-03 07:48:51 -07:00 committed by GitHub
commit a1434fe443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,6 +182,9 @@ OBSBasicStats::OBSBasicStats(QWidget *parent, bool closeable)
} }
obs_frontend_add_event_callback(OBSFrontendEvent, this); obs_frontend_add_event_callback(OBSFrontendEvent, this);
if (obs_frontend_recording_active())
StartRecTimeLeft();
} }
void OBSBasicStats::closeEvent(QCloseEvent *event) void OBSBasicStats::closeEvent(QCloseEvent *event)
@ -412,15 +415,20 @@ void OBSBasicStats::Update()
void OBSBasicStats::StartRecTimeLeft() void OBSBasicStats::StartRecTimeLeft()
{ {
if (recTimeLeft.isActive())
ResetRecTimeLeft();
recordTimeLeft->setText(QTStr("Calculating")); recordTimeLeft->setText(QTStr("Calculating"));
recTimeLeft.start(); recTimeLeft.start();
} }
void OBSBasicStats::ResetRecTimeLeft() void OBSBasicStats::ResetRecTimeLeft()
{ {
bitrates.clear(); if (recTimeLeft.isActive()) {
recTimeLeft.stop(); bitrates.clear();
recordTimeLeft->setText(QTStr("")); recTimeLeft.stop();
recordTimeLeft->setText(QTStr(""));
}
} }
void OBSBasicStats::RecordingTimeLeft() void OBSBasicStats::RecordingTimeLeft()