yolobs-studio/UI/window-basic-stats.hpp

87 lines
1.7 KiB
C++
Raw Permalink Normal View History

2017-06-29 19:01:10 +00:00
#pragma once
#include <obs.hpp>
#include <util/platform.h>
2020-05-27 20:57:19 +00:00
#include <obs-frontend-api.h>
2017-06-29 19:01:10 +00:00
#include <QPointer>
#include <QWidget>
#include <QTimer>
#include <QLabel>
#include <QList>
class QGridLayout;
class QCloseEvent;
class OBSBasicStats : public QWidget {
Q_OBJECT
QLabel *fps = nullptr;
QLabel *cpuUsage = nullptr;
QLabel *hddSpace = nullptr;
2019-07-27 12:47:10 +00:00
QLabel *recordTimeLeft = nullptr;
2017-06-29 19:01:10 +00:00
QLabel *memUsage = nullptr;
QLabel *renderTime = nullptr;
QLabel *skippedFrames = nullptr;
QLabel *missedFrames = nullptr;
QGridLayout *outputLayout = nullptr;
os_cpu_usage_info_t *cpu_info = nullptr;
QTimer timer;
2019-07-27 12:47:10 +00:00
QTimer recTimeLeft;
uint64_t num_bytes = 0;
std::vector<long double> bitrates;
2017-06-29 19:01:10 +00:00
struct OutputLabels {
QPointer<QLabel> name;
QPointer<QLabel> status;
QPointer<QLabel> droppedFrames;
QPointer<QLabel> megabytesSent;
QPointer<QLabel> bitrate;
uint64_t lastBytesSent = 0;
uint64_t lastBytesSentTime = 0;
int first_total = 0;
int first_dropped = 0;
2018-02-19 19:54:37 +00:00
void Update(obs_output_t *output, bool rec);
2017-06-29 19:01:10 +00:00
void Reset(obs_output_t *output);
2019-07-27 12:47:10 +00:00
long double kbps = 0.0l;
2017-06-29 19:01:10 +00:00
};
QList<OutputLabels> outputLabels;
void AddOutputLabels(QString name);
void Update();
virtual void closeEvent(QCloseEvent *event) override;
2019-07-27 12:47:10 +00:00
static void OBSFrontendEvent(enum obs_frontend_event event, void *ptr);
2017-06-29 19:01:10 +00:00
public:
2019-07-27 12:47:10 +00:00
OBSBasicStats(QWidget *parent = nullptr, bool closable = true);
2017-06-29 19:01:10 +00:00
~OBSBasicStats();
static void InitializeValues();
2019-07-27 12:47:10 +00:00
void StartRecTimeLeft();
void ResetRecTimeLeft();
private:
QPointer<QObject> shortcutFilter;
private slots:
void RecordingTimeLeft();
2020-03-25 08:07:22 +00:00
public slots:
void Reset();
2019-07-27 12:47:10 +00:00
protected:
virtual void showEvent(QShowEvent *event) override;
virtual void hideEvent(QHideEvent *event) override;
2017-06-29 19:01:10 +00:00
};