mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-06-14 19:04:33 -04:00
Implement status bar
The status bar now displays: - Auto-reconnect information (reconnecting and reconnect success) - Dropped frames (as well as percentage of total video frames) - Duration of session - CPU usage of the program - Kbp/s The OBSBasic class is getting a bit big, so I separated out the status bar code to its own class derived from QStatusBar.
This commit is contained in:
@@ -90,6 +90,10 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
QAbstractItemDelegate::EndEditHint)));
|
||||
|
||||
cpuUsageInfo = os_cpu_usage_info_start();
|
||||
cpuUsageTimer = new QTimer(this);
|
||||
connect(cpuUsageTimer, SIGNAL(timeout()),
|
||||
ui->statusbar, SLOT(UpdateCPUUsage()));
|
||||
cpuUsageTimer->start(3000);
|
||||
}
|
||||
|
||||
static void SaveAudioDevice(const char *name, int channel, obs_data_t parent)
|
||||
@@ -552,6 +556,7 @@ OBSBasic::~OBSBasic()
|
||||
* can be freed, and we have no control over the destruction order of
|
||||
* the Qt UI stuff, so we have to manually clear any references to
|
||||
* libobs. */
|
||||
delete cpuUsageTimer;
|
||||
os_cpu_usage_info_destroy(cpuUsageInfo);
|
||||
|
||||
delete properties;
|
||||
@@ -1682,6 +1687,7 @@ void OBSBasic::StreamingStart()
|
||||
{
|
||||
ui->streamButton->setText("Stop Streaming");
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->statusbar->StreamStarted(streamOutput);
|
||||
}
|
||||
|
||||
void OBSBasic::StreamingStop(int code)
|
||||
@@ -1713,6 +1719,7 @@ void OBSBasic::StreamingStop(int code)
|
||||
}
|
||||
|
||||
activeRefs--;
|
||||
ui->statusbar->StreamStopped();
|
||||
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
|
||||
Reference in New Issue
Block a user