OBSBasicStatusBar.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #pragma once
  2. #include "StatusBarWidget.hpp"
  3. #include <obs.hpp>
  4. #include <QPointer>
  5. #include <QStatusBar>
  6. class QTimer;
  7. class OBSBasicStatusBar : public QStatusBar {
  8. Q_OBJECT
  9. private:
  10. StatusBarWidget *statusWidget = nullptr;
  11. OBSWeakOutputAutoRelease streamOutput;
  12. std::vector<OBSSignal> streamSigs;
  13. OBSWeakOutputAutoRelease recordOutput;
  14. bool active = false;
  15. bool overloadedNotify = true;
  16. bool streamPauseIconToggle = false;
  17. bool disconnected = false;
  18. bool firstCongestionUpdate = false;
  19. std::vector<float> congestionArray;
  20. int retries = 0;
  21. int totalStreamSeconds = 0;
  22. int totalRecordSeconds = 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 seconds = 0;
  31. uint64_t lastBytesSent = 0;
  32. uint64_t lastBytesSentTime = 0;
  33. QPixmap excellentPixmap;
  34. QPixmap goodPixmap;
  35. QPixmap mediocrePixmap;
  36. QPixmap badPixmap;
  37. QPixmap disconnectedPixmap;
  38. QPixmap inactivePixmap;
  39. QPixmap recordingActivePixmap;
  40. QPixmap recordingPausePixmap;
  41. QPixmap recordingPauseInactivePixmap;
  42. QPixmap recordingInactivePixmap;
  43. QPixmap streamingActivePixmap;
  44. QPixmap streamingInactivePixmap;
  45. float lastCongestion = 0.0f;
  46. QPointer<QTimer> refreshTimer;
  47. QPointer<QTimer> messageTimer;
  48. obs_output_t *GetOutput();
  49. void Activate();
  50. void Deactivate();
  51. void UpdateDelayMsg();
  52. void UpdateBandwidth();
  53. void UpdateStreamTime();
  54. void UpdateRecordTime();
  55. void UpdateRecordTimeLabel();
  56. void UpdateDroppedFrames();
  57. static void OBSOutputReconnect(void *data, calldata_t *params);
  58. static void OBSOutputReconnectSuccess(void *data, calldata_t *params);
  59. public slots:
  60. void UpdateCPUUsage();
  61. void clearMessage();
  62. void showMessage(const QString &message, int timeout = 0);
  63. private slots:
  64. void Reconnect(int seconds);
  65. void ReconnectSuccess();
  66. void UpdateStatusBar();
  67. void UpdateCurrentFPS();
  68. void UpdateIcons();
  69. public:
  70. OBSBasicStatusBar(QWidget *parent);
  71. void StreamDelayStarting(int sec);
  72. void StreamDelayStopping(int sec);
  73. void StreamStarted(obs_output_t *output);
  74. void StreamStopped();
  75. void RecordingStarted(obs_output_t *output);
  76. void RecordingStopped();
  77. void RecordingPaused();
  78. void RecordingUnpaused();
  79. void ReconnectClear();
  80. };