UI: Show remaining reconnect timeout duration
When a reconnect is occurring, the user doesn't really know that the program is waiting to reconnect to the server or not, nor does the user know how many seconds are remaining until that next attempt. This will show the reconnect timeout countdown as it's occurring.
This commit is contained in:
parent
c1e8d28548
commit
83df87c552
@ -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
|
||||
|
@ -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<OBSBasicStatusBar*>(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();
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user