window-basic-status-bar.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #pragma once
  2. #include <QStatusBar>
  3. #include <QPointer>
  4. #include <QTimer>
  5. #include <util/platform.h>
  6. #include <obs.h>
  7. class QLabel;
  8. class OBSBasicStatusBar : public QStatusBar {
  9. Q_OBJECT
  10. private:
  11. QLabel *delayInfo;
  12. QLabel *droppedFrames;
  13. QLabel *sessionTime;
  14. QLabel *cpuUsage;
  15. QLabel *kbps;
  16. QLabel *statusSquare;
  17. obs_output_t *streamOutput = nullptr;
  18. obs_output_t *recordOutput = nullptr;
  19. bool active = false;
  20. bool overloadedNotify = true;
  21. int retries = 0;
  22. int totalSeconds = 0;
  23. int reconnectTimeout = 0;
  24. int delaySecTotal = 0;
  25. int delaySecStarting = 0;
  26. int delaySecStopping = 0;
  27. int startSkippedFrameCount = 0;
  28. int startTotalFrameCount = 0;
  29. int lastSkippedFrameCount = 0;
  30. int bitrateUpdateSeconds = 0;
  31. uint64_t lastBytesSent = 0;
  32. uint64_t lastBytesSentTime = 0;
  33. QPixmap transparentPixmap;
  34. QPixmap greenPixmap;
  35. QPixmap grayPixmap;
  36. QPixmap redPixmap;
  37. float lastCongestion = 0.0f;
  38. QPointer<QTimer> refreshTimer;
  39. obs_output_t *GetOutput();
  40. void Activate();
  41. void Deactivate();
  42. void UpdateDelayMsg();
  43. void UpdateBandwidth();
  44. void UpdateSessionTime();
  45. void UpdateDroppedFrames();
  46. static void OBSOutputReconnect(void *data, calldata_t *params);
  47. static void OBSOutputReconnectSuccess(void *data, calldata_t *params);
  48. private slots:
  49. void Reconnect(int seconds);
  50. void ReconnectSuccess();
  51. void UpdateStatusBar();
  52. void UpdateCPUUsage();
  53. public:
  54. OBSBasicStatusBar(QWidget *parent);
  55. void StreamDelayStarting(int sec);
  56. void StreamDelayStopping(int sec);
  57. void StreamStarted(obs_output_t *output);
  58. void StreamStopped();
  59. void RecordingStarted(obs_output_t *output);
  60. void RecordingStopped();
  61. void ReconnectClear();
  62. };