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:
jp9000
2014-07-06 16:19:27 -07:00
parent a9b3da010d
commit f0cc386499
9 changed files with 332 additions and 1 deletions

View File

@@ -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);