diff --git a/obs/data/locale/en-US.ini b/obs/data/locale/en-US.ini index 818e0813e..b8bec046a 100644 --- a/obs/data/locale/en-US.ini +++ b/obs/data/locale/en-US.ini @@ -137,7 +137,8 @@ Basic.PropertiesWindow.NoProperties="No properties available" Basic.InteractionWindow="Interacting with '%1'" # status bar -Basic.StatusBar.Reconnecting="Disconnected, reconnecting (attempt %1)" +Basic.StatusBar.Reconnecting="Disconnected, reconnecting in %2 second(s) (attempt %1)" +Basic.StatusBar.AttemptingReconnect="Attempting to reconnect... (attempt %1)" Basic.StatusBar.ReconnectSuccessful="Reconnection successful" # filters window diff --git a/obs/window-basic-status-bar.cpp b/obs/window-basic-status-bar.cpp index b092d75f7..96ef3aae0 100644 --- a/obs/window-basic-status-bar.cpp +++ b/obs/window-basic-status-bar.cpp @@ -106,6 +106,17 @@ void OBSBasicStatusBar::UpdateSessionTime() text.sprintf("%02d:%02d:%02d", hours, minutes, seconds); sessionTime->setText(text); sessionTime->setMinimumWidth(sessionTime->width()); + + if (reconnectTimeout > 0) { + QString msg = QTStr("Basic.StatusBar.Reconnecting"); + showMessage(msg.arg(QString::number(retries), + QString::number(reconnectTimeout))); + reconnectTimeout--; + + } else if (retries > 0) { + QString msg = QTStr("Basic.StatusBar.AttemptingReconnect"); + showMessage(msg.arg(QString::number(retries))); + } } void OBSBasicStatusBar::UpdateDroppedFrames() @@ -132,7 +143,8 @@ void OBSBasicStatusBar::OBSOutputReconnect(void *data, calldata_t *params) OBSBasicStatusBar *statusBar = reinterpret_cast(data); - QMetaObject::invokeMethod(statusBar, "Reconnect"); + int seconds = (int)calldata_int(params, "timeout_sec"); + QMetaObject::invokeMethod(statusBar, "Reconnect", Q_ARG(int, seconds)); UNUSED_PARAMETER(params); } @@ -145,18 +157,17 @@ void OBSBasicStatusBar::OBSOutputReconnectSuccess(void *data, calldata_t *params UNUSED_PARAMETER(params); } -void OBSBasicStatusBar::Reconnect() +void OBSBasicStatusBar::Reconnect(int seconds) { retries++; - - QString reconnectMsg = QTStr("Basic.StatusBar.Reconnecting"); - showMessage(reconnectMsg.arg(QString::number(retries))); + reconnectTimeout = seconds; } void OBSBasicStatusBar::ReconnectSuccess() { showMessage(QTStr("Basic.StatusBar.ReconnectSuccessful"), 4000); retries = 0; + reconnectTimeout = 0; bitrateUpdateSeconds = -1; lastBytesSent = 0; lastBytesSentTime = os_gettime_ns(); diff --git a/obs/window-basic-status-bar.hpp b/obs/window-basic-status-bar.hpp index 2086a81f7..8d75d404a 100644 --- a/obs/window-basic-status-bar.hpp +++ b/obs/window-basic-status-bar.hpp @@ -24,6 +24,8 @@ private: int activeRefs = 0; int totalSeconds = 0; + int reconnectTimeout = 0; + int bitrateUpdateSeconds = 0; uint64_t lastBytesSent = 0; uint64_t lastBytesSentTime = 0; @@ -43,7 +45,7 @@ private: static void OBSOutputReconnectSuccess(void *data, calldata_t *params); private slots: - void Reconnect(); + void Reconnect(int seconds); void ReconnectSuccess(); void UpdateStatusBar(); void UpdateCPUUsage();